VarNode.st
changeset 117 3736a828cb50
parent 106 2653f74569d1
child 135 aa4f7b8f121e
--- a/VarNode.st	Wed Aug 30 20:26:53 1995 +0200
+++ b/VarNode.st	Thu Sep 07 14:07:16 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1994 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libcomp/Attic/VarNode.st,v 1.10 1995-08-13 20:52:47 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/VarNode.st,v 1.11 1995-09-07 12:07:16 claus Exp $
 '!
 
 !VariableNode class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libcomp/Attic/VarNode.st,v 1.10 1995-08-13 20:52:47 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/VarNode.st,v 1.11 1995-09-07 12:07:16 claus Exp $
 "
 !
 
@@ -257,7 +257,7 @@
 !
 
 codeOn:aStream inBlock:codeBlock for:aCompiler
-    |theCode b deltaLevel|
+    |theCode b deltaLevel litIndex|
 
     (type == #MethodArg) ifTrue:[
 	(index <= 4) ifTrue:[
@@ -328,15 +328,27 @@
 	^ self
     ].
     (type == #GlobalVariable) ifTrue:[
-	aStream nextPut:#pushGlobal; nextPut:name.
+"/        aStream nextPut:#pushGlobal; nextPut:name.
+	litIndex := aCompiler addLiteral:name asSymbol.
+	litIndex < 256 ifTrue:[
+	    aStream nextPut:#pushGlobalS; nextPut:litIndex
+	] ifFalse:[
+	    aStream nextPut:#pushGlobalL; nextPut:litIndex; nextPut:0
+	].
 	"slot for generation and cell address (4 byte)"
-	aStream nextPut:0; nextPut:0; nextPut:0; nextPut:0; nextPut:0.
+	aStream next:5 put:0.
 	^ self
     ].
     (type == #ClassVariable) ifTrue:[
-	aStream nextPut:#pushClassVar; nextPut:(selfClass name , ':' , name) asSymbol.
+"/        aStream nextPut:#pushClassVar; nextPut:(selfClass name , ':' , name) asSymbol.
+	litIndex := aCompiler addLiteral:(selfClass name , ':' , name) asSymbol.
+	litIndex < 256 ifTrue:[
+	    aStream nextPut:#pushClassVarS; nextPut:litIndex
+	] ifFalse:[
+	    aStream nextPut:#pushClassVarL; nextPut:litIndex; nextPut:0
+	].
 	"slot for generation and cell address (4 byte)"
-	aStream nextPut:0; nextPut:0; nextPut:0; nextPut:0; nextPut:0.
+	aStream next:5 put:0.
 	^ self
     ].
     (type == #BlockVariable) ifTrue:[
@@ -371,7 +383,7 @@
 !
 
 codeStoreOn:aStream inBlock:codeBlock valueNeeded:valueNeeded for:aCompiler
-    |theCode b deltaLevel|
+    |theCode b deltaLevel litIndex|
 
     valueNeeded ifTrue:[
 	aStream nextPut:#dup
@@ -400,12 +412,6 @@
 	aStream nextPut:#storeInstVar; nextPut:index.
 	^ self
     ].
-    (type == #GlobalVariable) ifTrue:[
-	aStream nextPut:#storeGlobal; nextPut:name.
-	"slot for generation and cell address (4 byte)"
-	aStream nextPut:0; nextPut:0; nextPut:0; nextPut:0; nextPut:0.
-	^ self
-    ].
     (type == #BlockVariable) ifTrue:[
 	"find deltaLevel to block, where variable was defined"
 	b := codeBlock.
@@ -425,8 +431,26 @@
 	aStream nextPut:index.
 	^ self
     ].
+    (type == #GlobalVariable) ifTrue:[
+"/        aStream nextPut:#storeGlobal; nextPut:name.
+	litIndex := aCompiler addLiteral:name asSymbol.
+	litIndex < 256 ifTrue:[
+	    aStream nextPut:#storeGlobalS; nextPut:litIndex
+	] ifFalse:[
+	    aStream nextPut:#storeGlobalL; nextPut:litIndex; nextPut:0
+	].
+	"slot for generation and cell address (4 byte)"
+	aStream nextPut:0; nextPut:0; nextPut:0; nextPut:0; nextPut:0.
+	^ self
+    ].
     (type == #ClassVariable) ifTrue:[
-	aStream nextPut:#storeClassVar; nextPut:(selfClass name , ':' , name) asSymbol.
+"/        aStream nextPut:#storeClassVar; nextPut:(selfClass name , ':' , name) asSymbol.
+	litIndex := aCompiler addLiteral:(selfClass name , ':' , name) asSymbol.
+	litIndex < 256 ifTrue:[
+	    aStream nextPut:#storeClassVarS; nextPut:litIndex
+	] ifFalse:[
+	    aStream nextPut:#storeClassVarL; nextPut:litIndex; nextPut:0
+	].
 	"slot for generation and cell address (4 byte)"
 	aStream nextPut:0; nextPut:0; nextPut:0; nextPut:0; nextPut:0.
 	^ self