MessageNode.st
changeset 189 673580572edd
parent 186 05a99f1bd747
child 199 1b3b350a3f59
--- a/MessageNode.st	Wed Jan 10 12:51:44 1996 +0100
+++ b/MessageNode.st	Thu Jan 11 17:12:38 1996 +0100
@@ -526,7 +526,7 @@
 codeForCascadeOn:aStream inBlock:b for:aCompiler
     "like codeOn, but always leave the receiver instead of the result"
 
-    |nargs isBuiltIn code litIndex|
+    |nargs isBuiltIn code codeL litIndex cls clsLitIndex|
 
     argArray isNil ifTrue:[
 	nargs := 0
@@ -574,16 +574,30 @@
 	]
     ].
     litIndex := aCompiler addLiteral:selector.
-    litIndex <= 255 ifTrue:[
-	receiver isSuper ifTrue:[
-	    receiver isHere ifTrue:[
-		code := #hereSend
-	    ] ifFalse:[
-		code := #superSend.
-	    ].
-	    aStream nextPut:code; nextPut:lineNr; nextPut:litIndex; nextPut:nargs; nextPut:nil; nextPut:#drop.
+
+    receiver isSuper ifTrue:[
+	cls := aCompiler targetClass.
+	receiver isHere ifTrue:[
+	    code := #hereSend.
+	    codeL := #hereSendL.
+	] ifFalse:[
+	    code := #superSend.
+	    codeL := #superSendL.
+	    cls := cls superclass.
+	].
+	clsLitIndex := aCompiler addLiteral:cls.
+
+	(litIndex <= 255 and:[clsLitIndex <= 255]) ifTrue:[
+	    aStream nextPut:code; nextPut:lineNr; nextPut:litIndex; nextPut:nargs; nextPut:clsLitIndex; nextPut:#drop.
 	    ^ self
 	].
+
+	"need 16bit litIndex"
+	aStream nextPut:codeL; nextPut:lineNr; nextPut:litIndex; nextPut:0; nextPut:nargs; nextPut:clsLitIndex; nextPut:0; nextPut:#drop.
+	^ self
+    ].
+
+    litIndex <= 255 ifTrue:[
 	(nargs <= 3) ifTrue:[
 	    code := #(sendDrop0 sendDrop1 sendDrop2 sendDrop3) at:(nargs+1).
 	    aStream nextPut:code; nextPut:lineNr; nextPut:litIndex.
@@ -594,16 +608,9 @@
 	^ self
     ].
     "need 16bit litIndex"
-    receiver isSuper ifTrue:[
-	receiver isHere ifTrue:[
-	    code := #hereSendL
-	] ifFalse:[
-	    code := #superSendL.
-	].
-	aStream nextPut:code; nextPut:lineNr; nextPut:litIndex; nextPut:0; nextPut:nargs; nextPut:nil; nextPut:#drop.
-	^ self
-    ].
     aStream nextPut:#sendDropL; nextPut:lineNr; nextPut:litIndex; nextPut:0; nextPut:nargs
+
+    "Modified: 11.1.1996 / 16:51:40 / cg"
 !
 
 codeForSideEffectOn:aStream inBlock:b for:aCompiler
@@ -1089,7 +1096,7 @@
     "like code on, but assumes that receiver has already been
      coded onto stack - needed for cascade"
 
-    |nargs isBuiltIn code litIndex|
+    |nargs isBuiltIn code codeL litIndex cls clsLitIndex|
 
     argArray isNil ifTrue:[
 	nargs := 0
@@ -1136,21 +1143,23 @@
     ].
 
     receiver isSuper ifTrue:[
+
+	cls := aCompiler targetClass.
+	receiver isHere ifTrue:[
+	    code := #hereSend.
+	    codeL := #hereSendL
+	] ifFalse:[
+	    code := #superSend.
+	    codeL := #superSend.
+	    cls := cls superclass.
+	].
+	clsLitIndex := aCompiler addLiteral:cls.
+
 	litIndex := aCompiler addLiteral:selector.
-	litIndex <= 255 ifTrue:[
-	    receiver isHere ifTrue:[
-		code := #hereSend
-	    ] ifFalse:[
-		code := #superSend.
-	    ].
-	    aStream nextPut:code; nextPut:lineNr; nextPut:litIndex; nextPut:nargs; nextPut:nil.
+	(litIndex <= 255 and:[clsLitIndex <= 255]) ifTrue:[
+	    aStream nextPut:code; nextPut:lineNr; nextPut:litIndex; nextPut:nargs; nextPut:clsLitIndex.
 	] ifFalse:[
-	    receiver isHere ifTrue:[
-		code := #hereSendL
-	    ] ifFalse:[
-		code := #superSendL.
-	    ].
-	    aStream nextPut:code; nextPut:lineNr; nextPut:litIndex; nextPut:0; nextPut:nargs; nextPut:nil.
+	    aStream nextPut:codeL; nextPut:lineNr; nextPut:litIndex; nextPut:0; nextPut:nargs; nextPut:clsLitIndex; nextPut:0.
 	].
 	valueNeeded ifFalse:[
 	    aStream nextPut:#drop
@@ -1196,6 +1205,8 @@
 	code := #sendDropL
     ].
     aStream nextPut:code; nextPut:lineNr; nextPut:litIndex; nextPut:0; nextPut:nargs
+
+    "Modified: 11.1.1996 / 16:46:41 / cg"
 !
 
 codeTimesRepeatOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler
@@ -1564,5 +1575,5 @@
 !MessageNode class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.37 1996-01-07 12:34:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.38 1996-01-11 16:12:38 cg Exp $'
 ! !