Move method's literals form literalArray to indexed instvars.
authorStefan Vogel <sv@exept.de>
Fri, 28 Jun 1996 17:32:43 +0200
changeset 292 163651658aee
parent 291 c0d5159014be
child 293 bc0459613b27
Move method's literals form literalArray to indexed instvars.
BCompiler.st
ByteCodeCompiler.st
ImmArray.st
ImmutableArray.st
LazyMethod.st
--- a/BCompiler.st	Fri Jun 21 19:50:40 1996 +0200
+++ b/BCompiler.st	Fri Jun 28 17:32:43 1996 +0200
@@ -10,7 +10,7 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:2.10.9 on 14-jun-1996 at 12:20:17'                   !
+'From Smalltalk/X, Version:2.10.9 on 25-jun-1996 at 14:32:07'                   !
 
 Parser subclass:#ByteCodeCompiler
 	instanceVariableNames:'codeBytes codeIndex litArray stackDelta extra lineno extraLiteral
@@ -22,7 +22,7 @@
 	category:'System-Compiler'
 !
 
-!ByteCodeCompiler class methodsFor:'documentation'!
+!ByteCodeCompiler  class methodsFor:'documentation'!
 
 copyright
 "
@@ -89,7 +89,7 @@
 "
 ! !
 
-!ByteCodeCompiler class methodsFor:'initialization'!
+!ByteCodeCompiler  class methodsFor:'initialization'!
 
 initialize
     ShareCode := true.
@@ -97,7 +97,7 @@
     "Modified: 9.2.1996 / 17:33:44 / cg"
 ! !
 
-!ByteCodeCompiler class methodsFor:'compiling methods'!
+!ByteCodeCompiler  class methodsFor:'compiling methods'!
 
 compile:methodText forClass:classToCompileFor
     "compile a source-string for a method in classToCompileFor"
@@ -402,13 +402,6 @@
      finally create the new method-object
     "
     newMethod := compiler createMethod.
-"/    newMethod := Method new.
-"/    lits := compiler literalArray.
-"/    lits notNil ifTrue:[
-"/        "literals MUST be an array - not just any Collection"
-"/        lits := Array withAll:lits.
-"/        newMethod literals:lits
-"/    ].
     primNr notNil ifTrue:[
         newMethod code:(compiler checkForPrimitiveCode:primNr).
     ] ifFalse:[
@@ -443,6 +436,7 @@
 
     "Created: 29.10.1995 / 19:59:36 / cg"
     "Modified: 18.5.1996 / 16:39:55 / cg"
+    "Modified: 24.6.1996 / 12:41:13 / stefan"
 !
 
 compile:methodText forClass:classToCompileFor notifying:requestor
@@ -478,7 +472,7 @@
 
 ! !
 
-!ByteCodeCompiler class methodsFor:'constants'!
+!ByteCodeCompiler  class methodsFor:'constants'!
 
 byteCodeFor:aSymbol
     "returns the numeric code for some symbolic bytecodes."
@@ -500,7 +494,7 @@
     self error
 ! !
 
-!ByteCodeCompiler class methodsFor:'stc compilation defaults'!
+!ByteCodeCompiler  class methodsFor:'stc compilation defaults'!
 
 canCreateMachineCode
     "return true, if compilation to machine code is supported.
@@ -1239,14 +1233,11 @@
 !
 
 createMethod
-    |newMethod lits|
-
-    newMethod := Method new.
+    |newMethod i|
 
-    lits := litArray.
-    lits notNil ifTrue:[
-        "/ literals MUST be an array - not just any Collection
-        newMethod literals:(Array withAll:lits)
+    newMethod := Method new:(litArray size).
+    litArray notNil ifTrue:[
+        newMethod literals:litArray
     ].
 
     newMethod numberOfMethodVars:(self numberOfMethodVars).
@@ -1261,6 +1252,7 @@
 
     "Created: 18.5.1996 / 16:33:17 / cg"
     "Modified: 18.5.1996 / 16:41:31 / cg"
+    "Modified: 24.6.1996 / 12:32:50 / stefan"
 !
 
 genByteCodeFrom:symbolicCodeArray
@@ -2241,13 +2233,11 @@
     "return a stub method which traps and reports an error whenever
      called."
 
-    |newMethod lits|
+    |newMethod|
 
-    newMethod := Method new.
-    lits := litArray.
-    lits notNil ifTrue:[
-        "literals MUST be an array - not just any Collection"
-        newMethod literals:(Array withAll:lits)
+    newMethod := Method new:(litArray size).
+    litArray notNil ifTrue:[
+        newMethod literals:litArray
     ].
 
     newMethod makeUncompiled.
@@ -2261,11 +2251,12 @@
     ^ newMethod
 
     "Modified: 18.5.1996 / 16:39:12 / cg"
+    "Modified: 24.6.1996 / 12:28:24 / stefan"
 ! !
 
-!ByteCodeCompiler class methodsFor:'documentation'!
+!ByteCodeCompiler  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.80 1996-06-14 11:19:30 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.81 1996-06-28 15:32:36 stefan Exp $'
 ! !
 ByteCodeCompiler initialize!
--- a/ByteCodeCompiler.st	Fri Jun 21 19:50:40 1996 +0200
+++ b/ByteCodeCompiler.st	Fri Jun 28 17:32:43 1996 +0200
@@ -10,7 +10,7 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:2.10.9 on 14-jun-1996 at 12:20:17'                   !
+'From Smalltalk/X, Version:2.10.9 on 25-jun-1996 at 14:32:07'                   !
 
 Parser subclass:#ByteCodeCompiler
 	instanceVariableNames:'codeBytes codeIndex litArray stackDelta extra lineno extraLiteral
@@ -22,7 +22,7 @@
 	category:'System-Compiler'
 !
 
-!ByteCodeCompiler class methodsFor:'documentation'!
+!ByteCodeCompiler  class methodsFor:'documentation'!
 
 copyright
 "
@@ -89,7 +89,7 @@
 "
 ! !
 
-!ByteCodeCompiler class methodsFor:'initialization'!
+!ByteCodeCompiler  class methodsFor:'initialization'!
 
 initialize
     ShareCode := true.
@@ -97,7 +97,7 @@
     "Modified: 9.2.1996 / 17:33:44 / cg"
 ! !
 
-!ByteCodeCompiler class methodsFor:'compiling methods'!
+!ByteCodeCompiler  class methodsFor:'compiling methods'!
 
 compile:methodText forClass:classToCompileFor
     "compile a source-string for a method in classToCompileFor"
@@ -402,13 +402,6 @@
      finally create the new method-object
     "
     newMethod := compiler createMethod.
-"/    newMethod := Method new.
-"/    lits := compiler literalArray.
-"/    lits notNil ifTrue:[
-"/        "literals MUST be an array - not just any Collection"
-"/        lits := Array withAll:lits.
-"/        newMethod literals:lits
-"/    ].
     primNr notNil ifTrue:[
         newMethod code:(compiler checkForPrimitiveCode:primNr).
     ] ifFalse:[
@@ -443,6 +436,7 @@
 
     "Created: 29.10.1995 / 19:59:36 / cg"
     "Modified: 18.5.1996 / 16:39:55 / cg"
+    "Modified: 24.6.1996 / 12:41:13 / stefan"
 !
 
 compile:methodText forClass:classToCompileFor notifying:requestor
@@ -478,7 +472,7 @@
 
 ! !
 
-!ByteCodeCompiler class methodsFor:'constants'!
+!ByteCodeCompiler  class methodsFor:'constants'!
 
 byteCodeFor:aSymbol
     "returns the numeric code for some symbolic bytecodes."
@@ -500,7 +494,7 @@
     self error
 ! !
 
-!ByteCodeCompiler class methodsFor:'stc compilation defaults'!
+!ByteCodeCompiler  class methodsFor:'stc compilation defaults'!
 
 canCreateMachineCode
     "return true, if compilation to machine code is supported.
@@ -1239,14 +1233,11 @@
 !
 
 createMethod
-    |newMethod lits|
-
-    newMethod := Method new.
+    |newMethod i|
 
-    lits := litArray.
-    lits notNil ifTrue:[
-        "/ literals MUST be an array - not just any Collection
-        newMethod literals:(Array withAll:lits)
+    newMethod := Method new:(litArray size).
+    litArray notNil ifTrue:[
+        newMethod literals:litArray
     ].
 
     newMethod numberOfMethodVars:(self numberOfMethodVars).
@@ -1261,6 +1252,7 @@
 
     "Created: 18.5.1996 / 16:33:17 / cg"
     "Modified: 18.5.1996 / 16:41:31 / cg"
+    "Modified: 24.6.1996 / 12:32:50 / stefan"
 !
 
 genByteCodeFrom:symbolicCodeArray
@@ -2241,13 +2233,11 @@
     "return a stub method which traps and reports an error whenever
      called."
 
-    |newMethod lits|
+    |newMethod|
 
-    newMethod := Method new.
-    lits := litArray.
-    lits notNil ifTrue:[
-        "literals MUST be an array - not just any Collection"
-        newMethod literals:(Array withAll:lits)
+    newMethod := Method new:(litArray size).
+    litArray notNil ifTrue:[
+        newMethod literals:litArray
     ].
 
     newMethod makeUncompiled.
@@ -2261,11 +2251,12 @@
     ^ newMethod
 
     "Modified: 18.5.1996 / 16:39:12 / cg"
+    "Modified: 24.6.1996 / 12:28:24 / stefan"
 ! !
 
-!ByteCodeCompiler class methodsFor:'documentation'!
+!ByteCodeCompiler  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.80 1996-06-14 11:19:30 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.81 1996-06-28 15:32:36 stefan Exp $'
 ! !
 ByteCodeCompiler initialize!
--- a/ImmArray.st	Fri Jun 21 19:50:40 1996 +0200
+++ b/ImmArray.st	Fri Jun 28 17:32:43 1996 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.9 on 25-jun-1996 at 14:32:57'                   !
+
 Array subclass:#ImmutableArray
 	instanceVariableNames:''
 	classVariableNames:''
@@ -17,7 +19,7 @@
 	category:'System-Compiler-Support'
 !
 
-!ImmutableArray class methodsFor:'documentation'!
+!ImmutableArray  class methodsFor:'documentation'!
 
 copyright
 "
@@ -115,14 +117,17 @@
     "find the method that contains me"
 
     Method allSubInstances do:[:aMethod |
-	|lits|
-
-	lits := aMethod literals.
-	(lits notNil and:[(lits identityIndexOf:self) ~~ 0]) ifTrue:[
-	    ^ aMethod
-	]
+        (aMethod referencesGlobal:self) ifTrue:[
+            ^ aMethod.
+        ].
     ].
     ^ nil
+
+    " 
+      #(1 2 3) creator
+    "
+
+    "Modified: 24.6.1996 / 15:36:28 / stefan"
 !
 
 notifyStoreError
@@ -183,8 +188,8 @@
     ^ super becomeNil
 ! !
 
-!ImmutableArray class methodsFor:'documentation'!
+!ImmutableArray  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmArray.st,v 1.14 1996-04-25 17:09:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmArray.st,v 1.15 1996-06-28 15:32:42 stefan Exp $'
 ! !
--- a/ImmutableArray.st	Fri Jun 21 19:50:40 1996 +0200
+++ b/ImmutableArray.st	Fri Jun 28 17:32:43 1996 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.9 on 25-jun-1996 at 14:32:57'                   !
+
 Array subclass:#ImmutableArray
 	instanceVariableNames:''
 	classVariableNames:''
@@ -17,7 +19,7 @@
 	category:'System-Compiler-Support'
 !
 
-!ImmutableArray class methodsFor:'documentation'!
+!ImmutableArray  class methodsFor:'documentation'!
 
 copyright
 "
@@ -115,14 +117,17 @@
     "find the method that contains me"
 
     Method allSubInstances do:[:aMethod |
-	|lits|
-
-	lits := aMethod literals.
-	(lits notNil and:[(lits identityIndexOf:self) ~~ 0]) ifTrue:[
-	    ^ aMethod
-	]
+        (aMethod referencesGlobal:self) ifTrue:[
+            ^ aMethod.
+        ].
     ].
     ^ nil
+
+    " 
+      #(1 2 3) creator
+    "
+
+    "Modified: 24.6.1996 / 15:36:28 / stefan"
 !
 
 notifyStoreError
@@ -183,8 +188,8 @@
     ^ super becomeNil
 ! !
 
-!ImmutableArray class methodsFor:'documentation'!
+!ImmutableArray  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmutableArray.st,v 1.14 1996-04-25 17:09:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmutableArray.st,v 1.15 1996-06-28 15:32:42 stefan Exp $'
 ! !
--- a/LazyMethod.st	Fri Jun 21 19:50:40 1996 +0200
+++ b/LazyMethod.st	Fri Jun 28 17:32:43 1996 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.9 on 25-jun-1996 at 14:32:52'                   !
+
 Method subclass:#LazyMethod
 	instanceVariableNames:''
 	classVariableNames:'Access CompilationFailedSignal'
@@ -17,7 +19,7 @@
 	category:'Kernel-Methods'
 !
 
-!LazyMethod class methodsFor:'documentation'!
+!LazyMethod  class methodsFor:'documentation'!
 
 copyright
 "
@@ -56,7 +58,7 @@
 "
 ! !
 
-!LazyMethod class methodsFor:'initialization'!
+!LazyMethod  class methodsFor:'initialization'!
 
 initialize
     CompilationFailedSignal isNil ifTrue:[
@@ -69,7 +71,7 @@
     ]
 ! !
 
-!LazyMethod class methodsFor:'Signal constants'!
+!LazyMethod  class methodsFor:'Signal constants'!
 
 compilationFailedSignal
     ^ CompilationFailedSignal
@@ -97,18 +99,18 @@
 "/  ].
 
     [
-	Access critical:[
-	    m := self asExecutableMethod.
-	].
+        Access critical:[
+            m := self asExecutableMethod.
+        ].
     ] valueUninterruptably.
 
     (m isNil or:[(byteCode := m byteCode) isNil and:[m code isNil]]) ifTrue:[
-	"
-	 compilation failed
-	"
-	^ nil
+        "
+         compilation failed
+        "
+        ^ nil
     ].
-    literals := m literals.
+    self literals:m literals.
     flags := m flags.
     self code:(m code).
     self changeClassToThatOf:m.
@@ -116,6 +118,7 @@
 
     "Created: 24.10.1995 / 14:02:50 / cg"
     "Modified: 24.10.1995 / 15:35:50 / cg"
+    "Modified: 24.6.1996 / 17:23:57 / stefan"
 ! !
 
 !LazyMethod methodsFor:'error handling'!
@@ -182,9 +185,9 @@
     ^ true
 ! !
 
-!LazyMethod class methodsFor:'documentation'!
+!LazyMethod  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/LazyMethod.st,v 1.19 1996-04-25 16:48:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/LazyMethod.st,v 1.20 1996-06-28 15:32:43 stefan Exp $'
 ! !
 LazyMethod initialize!