Refactor deserialization initialization in built-ins and JS

BuiltinsPackageFragment was only designed to work with a single instance alive.
Because of this, it was creating deserialization subsystem upon initialization.
This was not working perfectly in JS where it was used, because multiple
storage managers, class caches and other components were created for each
package, leading to different concurrency errors and performance hits. Also in
the near future another package fragment will be needed to represent the
built-in package "kotlin.reflect"
This commit is contained in:
Alexander Udalov
2015-04-17 21:19:19 +03:00
parent 19ddb4b510
commit 3d928a0842
10 changed files with 183 additions and 102 deletions
@@ -66,7 +66,8 @@ public object JsAnalyzerFacade : AnalyzerFacade<JsResolverForModule, PlatformAna
if (!JsHeaderLibraryDetectionUtil.isJsHeaderLibraryWithSources(files.toList())) {
val providers = moduleInfo.library.getFiles(OrderRootType.CLASSES)
.flatMap { KotlinJavascriptMetadataUtils.loadMetadata(PathUtil.getLocalPath(it)!!) }
.flatMap { KotlinJavascriptSerializationUtil.getPackageFragmentProviders(moduleDescriptor, it.body) }
.map { KotlinJavascriptSerializationUtil.createPackageFragmentProvider(moduleDescriptor, it.body) }
.filterNotNull()
if (providers.isNotEmpty()) {
packageFragmentProvider = CompositePackageFragmentProvider(listOf(packageFragmentProvider) + providers)