0 Replies Latest reply on Nov 19, 2008 8:16 AM by (Paul_Reilly)

    [svn] 4138: * Added support for SWC reuse.

      Revision: 4138<br />Author:   preilly@adobe.com<br />Date:     2008-11-19 08:15:59 -0800 (Wed, 19 Nov 2008)<br /><br />Log Message:<br />-----------<br />* Added support for SWC reuse.  This isn't just reusing the bytes to<br />  lower I/O, which we were already doing.  This means not reparsing<br />  the bytes unless they become out of data.  The trick with making<br />  this work is validating each of the SWC based cached<br />  CompilationUnits at the beginning of each compilation.  When a SWC<br />  based CompilationUnit becomes obsolete or is removed from the<br />  library path, all the CompilationUnit's, which depended on it, are<br />  forced to be recompiled.<br /><br />  Note: bugs with the SWC reuse logic often show up as errors claiming<br />  that type foo is not an instance of type foo.  This most likely<br />  means that foo was reloaded, but something that depended on foo<br />  wasn't reloaded.  Please file bugs for any errors like this and give<br />  me a heads up.<br /><br />  Flex Builder has logic to take advantage of this change in the case<br />  of application compilations, but it will need to be updated to take<br />  advantage of SWC reuse in the case of library compilations.  The<br />  biggest benefit of this change will be seen when all the libraries<br />  and applications in a workspace share a SwcCache.<br /><br />  Updates to the performance testsuite to enable it to take advantage<br />  of these changes will follow.<br /><br />tests Passed: checkintests, performance testsuite, fcsh unit tests<br /><br />Needs QA: YES<br /><br />Needs DOC: NO<br /><br />API Change: Yes - a few changes to the OEM compiler API<br /><br />Reviewer: Pete and Darrell<br /><br />Code-level description of changes:<br /> <br />  modules/asc/src/java/macromedia/asc/util/ContextStatics.java<br /><br />    Added clearUserDefined(), which allows Flex to use one<br />    ContextStatics instance when compiling multiple libraries and<br />    applications.  If we didn't clear out the userDefined Map,<br />    definitions from one compilation could potentially spill over into<br />    others where they might not be defined or might be defined<br />    differently.<br /><br />  modules/compiler/src/java/flex2/tools/oem/Application.java<br />  modules/compiler/src/java/flex2/tools/oem/Library.java<br /><br />    Renamed instance variable "configuration" to "oemConfiguration".<br /><br />    Renamed method param "OEMConfiguration c" to "OEMConfiguration<br />    localOEMConfiguration".<br /><br />    Renamed local variable "OEMConfiguration c" to "OEMConfiguration<br />    tempOEMConfiguration".<br /><br />    Removed a bunch of duplicate code from recompile().<br /><br />    Added support for reporting the start and end of a "full" compile.<br />    Before full compiles were reported as "inactive".<br /><br />    Added support for using LibraryCache's new perCompileData<br />    variable.<br /><br />    Modified Library.link() to use a SwcDynamicArchive instead of a<br />    SwcWriteOnlyArchive when the file name is known.  This allows us<br />    to reuse the compilation units in the archive for subsequent<br />    compilations.<br /><br />  modules/compiler/src/java/flex2/tools/oem/LibraryCache.java<br /><br />    Added contextStatics variable and accessors.<br /><br />  modules/compiler/src/java/flex2/tools/oem/internal/OEMReport.java<br /><br />    Updated to leverage CompilationUnit.hasAssets() and to reflect<br />    change in type of CompilationUnit's inheritance, namespaces,<br />    types, and expressions.<br /><br />  modules/compiler/src/java/flex2/tools/oem/internal/OEMUtil.java<br /><br />    Modified areSwcFileChecksumsEqual() to ignore timestamp changes<br />    with catalog.xml and library.swf.  When we are reusing cached<br />    SWC's, the catalog.xml and library.swf are updated each time we<br />    save the SwcDynamicArchive, but we don't want to reload the SWC<br />    from disk, because all the compilation units represented by<br />    catalog.xml should be cached.  If any of the cached<br />    CompilationUnit's becomes out of data,<br />    CompilerAPI.validateCompilationUnits() will handle removing the<br />    cached CompilationUnit, which will cause it to be reloaded from<br />    disk.<br /><br />  modules/compiler/src/java/flex2/compiler/swc/SwcCache.java<br /><br />    Renamed "swcs" to "swcLRUCache" to reduce confusion with other<br />    variables named "swcs".<br /><br />    Added tracking of removed and updated cached Swc's.<br /><br />    Removed cleanExtraData().<br /><br />  modules/compiler/src/java/flex2/compiler/swc/SwcArchive.java<br /><br />    Added generics to getFiles().<br /><br />  modules/compiler/src/java/flex2/compiler/swc/SwcGroup.java<br /><br />    Added tracking of obsoleted scripts.<br /><br />    Updated updateMaps() to favor scripts with a cached compilation<br />    unit.<br /><br />  modules/compiler/src/java/flex2/compiler/swc/SwcScript.java<br /><br />    Replaced misc with compilationUnit.<br /><br />    Added toString() to aid with debugging.<br /><br />  modules/compiler/src/java/flex2/compiler/swc/SwcDirectoryArchive.java<br /><br />    Added generics to getFiles().<br /><br />  modules/compiler/src/java/flex2/compiler/swc/SwcPathResolver.java<br /><br />    Updated resolve() to prevent resolving foo.swc$bar.css to<br />    blah.swc$bar.css, which was causing the framework.swc<br />    defaults.css's timestamp to be compared with the charting<br />    defaults.css timestamp.  Grrr.<br /><br />  modules/compiler/src/java/flex2/compiler/swc/Swc.java<br /><br />    Updated to allow exported Swc's to be used for reading.<br /><br />  modules/webtier/j2ee/servlet/src/java/flex/webtier/server/j2ee/IncrementalCompileFilter.j ava<br />  modules/compiler/src/java/flex2/tools/Fcsh.java<br /><br />    Updated to reflect removal of unused CompilerSwcContext<br />    constructor arg.<br /><br />  modules/compiler/src/java/flex2/tools/PreLink.java<br />  modules/compiler/src/java/flex2/tools/CompcPreLink.java<br />  modules/compiler/src/java/flex2/linker/SimpleMovie.java<br />  modules/compiler/src/java/flex2/compiler/as3/EmbedExtension.java<br />  modules/compiler/src/java/flex2/compiler/as3/EmbedUtil.java<br /><br />    Updated to leverage CompilationUnit.hasAssets().<br /><br />  modules/compiler/src/java/flex2/compiler/util/Name.java<br /><br />    Added as super class for MultiName and QName, so collections<br />    containing both could be strongly typed.<br /><br />  modules/compiler/src/java/flex2/compiler_en.properties<br />  modules/compiler/src/java/flex2/linker/CULinkable.java<br />  modules/compiler/src/java/flex2/linker/ConsoleApplication.java<br />  modules/compiler/src/java/flex2/compiler/asdoc/ASDocExtension.java<br />  modules/compiler/src/java/flex2/compiler/PersistenceStore.java<br />  modules/compiler/src/java/flex2/compiler/abc/AbcCompiler.java<br />  modules/compiler/src/java/flex2/compiler/as3/EmbedEvaluator.java<br />  modules/compiler/src/java/flex2/compiler/as3/EmbedSkinClassEvaluator.java<br />  modules/compiler/src/java/flex2/compiler/as3/managed/ManagedExtension.java<br />  modules/compiler/src/java/flex2/compiler/as3/As3Compiler.java<br />  modules/compiler/src/java/flex2/compiler/as3/StyleEvaluator.java<br />  modules/compiler/src/java/flex2/compiler/as3/HostComponentEvaluator.java<br />  modules/compiler/src/java/flex2/compiler/as3/SyntaxTreeEvaluator.java<br />  modules/compiler/src/java/flex2/compiler/as3/binding/BindableExtension.java<br />  modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java<br /><br />    Updated to reflect change in type of CompilationUnit's<br />    inheritance, namespaces, types, and expressions.<br /><br />  modules/compiler/src/java/flex2/compiler/Source.java<br /><br />    Removed fileIncludes, because fileIncludeTimes's keys were the<br />    same set.<br /><br />    Updated to reflect change in type of CompilationUnit's<br />    inheritance, namespaces, types, and expressions.<br /><br />  modules/compiler/src/java/flex2/compiler/asdoc/ClassTable.java<br /><br />    Increased use of generics.<br /><br />  modules/compiler/src/java/flex2/compiler/CompilationUnit.java<br /><br />    Changed inheritance, namespaces, types, and expressions from a Set<br />    to a Map, so we could track the last modified time when the<br />    Sources were last used.  This allows us to track if they changed.<br /><br />    Made assets lazily created.<br /><br />    Removed "misc" context attribute usage.<br /><br />  modules/compiler/src/java/flex2/compiler/CompilerSwcContext.java<br /><br />    Removed unused fullCompile variable.<br /><br />    Added logic to track obsoleted and removed Sources.<br /><br />  modules/compiler/src/java/flex2/compiler/CompilerAPI.java<br /><br />    Significantly refactored validateCompilationUnits().  It now<br />    validates sources from the CompilerSwcContext and in the case of<br />    library compilations, it validates the included classes.  It also<br />    builds up a backwards dependency map, so we can remove all the<br />    dependencies when a source is removed.  This made the<br />    DependencyGraph usage unnecessary.  The DependencyGraph usage also<br />    happened to be flawed, because it really should have been looping<br />    each time a potential "type" or "expression" source was removed<br />    until no new sources were removed.  I actually tried implementing<br />    this and it was incredibly slow.<br /><br />    Added dependentFileModified() helper method.<br /><br />  modules/compiler/src/java/flex2/compiler/as3/reflect/NodeMagic.java<br /><br />    Removed out of date comment.<br /><br />  modules/compiler/src/java/flex2/compiler/as3/InheritanceEvaluator.java<br /><br />    Replaced use of MultiNameSet with HashSet<Name>.<br /><br />  modules/compiler/src/java/flex2/compiler/as3/binding/DataBindingExtension.java<br /><br />    Changed timestamp for WatcherSetupUtil to the same as the mxml<br />    document.  Now that we validate sources in the ResourceContainer,<br />    any changes of Bindable metadata in dependent sources will cause a<br />    recompile.  The use of System.currentTimeMillis() was a hack.<br /><br />  modules/compiler/src/java/flex2/compiler/css/StyleModule.vm<br /><br />    Removed unused import.<br /><br />  modules/compiler/src/java/flex2/compiler/SourcePath.java<br />  modules/compiler/src/java/flex2/compiler/io/LocalFile.java<br /><br />    No change in functionality.<br /><br />  modules/compiler/src/java/flex2/compiler/FileSpec.java<br /><br />    Added use of CompilationUnit.hasAssets().<br /><br />  modules/compiler/src/java/flex2/compiler/util/QName.java<br />  modules/compiler/src/java/flex2/compiler/util/MultiName.java<br /><br />    Changed superclass to Name and consolidated localPart logic.<br /><br />  modules/compiler/src/java/flex2/compiler/util/MultiNameMap.java<br /><br />    Added some generics.<br /><br />Modified Paths:<br />--------------<br />    flex/sdk/trunk/modules/asc/src/java/macromedia/asc/util/ContextStatics.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/CompilationUnit.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/CompilerAPI.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/CompilerSwcContext.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/FileSpec.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/PersistenceStore.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/Source.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/SourcePath.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/abc/AbcCompiler.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/As3Compiler.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/EmbedEvaluator.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/EmbedExtension.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/EmbedSkinClassEvaluator.java< br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/EmbedUtil.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/HostComponentEvaluator.java<b r />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/InheritanceEvaluator.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/StyleEvaluator.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/SyntaxTreeEvaluator.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/binding/BindableExtension.jav a<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/binding/DataBindingExtension. java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/managed/ManagedExtension.java <br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/as3/reflect/NodeMagic.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/ASDocExtension.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/ClassTable.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleModule.vm<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/io/LocalFile.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/Swc.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcArchive.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcCache.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcDirectoryArchive.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcGroup.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcPathResolver.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/swc/SwcScript.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/util/MultiName.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/util/MultiNameMap.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/util/QName.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler_en.properties<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/linker/CULinkable.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/linker/ConsoleApplication.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/linker/SimpleMovie.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/tools/CompcPreLink.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/tools/Fcsh.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/tools/PreLink.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/Application.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/Library.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/LibraryCache.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/internal/OEMReport.java<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/tools/oem/internal/OEMUtil.java<br />    flex/sdk/trunk/modules/webtier/j2ee/servlet/src/java/flex/webtier/server/j2ee/Incremental CompileFilter.java<br /><br />Added Paths:<br />-----------<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/util/Name.java<br /><br />Removed Paths:<br />-------------<br />    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/util/MultiNameSet.java