#TUNING by cg
authorClaus Gittinger <cg@exept.de>
Sun, 12 Feb 2017 19:07:03 +0100
changeset 21407 6ce47a4b5aba
parent 21406 c8b4c0f96850
child 21408 e641024561c6
#TUNING by cg class: Metaclass changed: #name:inEnvironment:subclassOf:instanceVariableNames:variable:words:pointers:classVariableNames:poolDictionaries:category:comment:changed:classInstanceVariableNames: care to autoload sharedpools when autoloading a class; otherwise, recompilations are needed, when the shared pool is later loaded (and unknown vars have been compiled as globals)
Metaclass.st
--- a/Metaclass.st	Sun Feb 12 16:25:59 2017 +0100
+++ b/Metaclass.st	Sun Feb 12 19:07:03 2017 +0100
@@ -111,8 +111,6 @@
     "Modified: 23.4.1996 / 15:59:44 / cg"
 ! !
 
-
-
 !Metaclass methodsFor:'Compatibility-ST80'!
 
 comment:aString
@@ -131,6 +129,7 @@
     "Created: / 1.11.1997 / 13:16:45 / cg"
 ! !
 
+
 !Metaclass methodsFor:'autoload check'!
 
 isLoaded
@@ -322,7 +321,7 @@
      to allow existing instances some life.
      This might change in the future.
     "
-    |builder|
+    |builder newClass|
 
     builder := self newClassBuilder.
     builder name:newName
@@ -338,7 +337,16 @@
         comment:commentString
         changed:changed
         classInstanceVariableNames:stringOfClassInstVarNamesOrNil.
-    ^ builder buildClass.
+    newClass := builder buildClass.
+
+    "/ if the class was autoloaded, and it refers to any autoloaded shared pool,
+    "/ reference the pool now. So it will be present, when methods are compiled
+    "/ (avoids costy recompiles which may happen, if the sharedPool is loaded 
+    "/  after the methods have been compiled assuming that those names are globals)
+    (newClass sharedPools ? #()) do:[:each | each autoload].
+    ^ newClass
+
+    "Modified: / 12-02-2017 / 10:58:59 / cg"
 !
 
 new