--- a/BCompiler.st Mon May 20 10:42:54 1996 +0200
+++ b/BCompiler.st Mon May 20 10:50:55 1996 +0200
@@ -1277,244 +1277,245 @@
needRetry := true.
symCodeSize := symbolicCodeArray size.
ShareCode ifTrue:[
- codeBytes := self checkForCommonCode:symbolicCodeArray.
- codeBytes notNil ifTrue:[
- ^ self
- ].
+ codeBytes := self checkForCommonCode:symbolicCodeArray.
+ codeBytes notNil ifTrue:[
+ ^ self
+ ].
].
codeSize := symCodeSize.
[needRetry] whileTrue:[
- stackDepth := 0.
- maxStackDepth := 0.
+ stackDepth := 0.
+ maxStackDepth := 0.
- codeBytes := ByteArray uninitializedNew:codeSize.
- relocInfo := Array basicNew:(codeSize + 1).
- symIndex := 1.
- codeIndex := 1.
+ codeBytes := ByteArray uninitializedNew:codeSize.
+ relocInfo := Array basicNew:(codeSize + 1).
+ symIndex := 1.
+ codeIndex := 1.
- needRetry := false.
- round := round + 1.
+ needRetry := false.
+ round := round + 1.
- [symIndex <= symCodeSize] whileTrue:[
- relocInfo at:symIndex put:codeIndex.
+ [symIndex <= symCodeSize] whileTrue:[
+ relocInfo at:symIndex put:codeIndex.
- codeSymbol := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- stackDelta := 0.
- extra := extraLiteral := nil.
- lineno := false.
+ codeSymbol := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ stackDelta := 0.
+ extra := extraLiteral := nil.
+ lineno := false.
- self appendByteCodeFor:codeSymbol.
+ self appendByteCodeFor:codeSymbol.
- extraLiteral notNil ifTrue:[
- self addLiteral:extraLiteral
- ].
+ extraLiteral notNil ifTrue:[
+ self addLiteral:extraLiteral
+ ].
- lineno ifTrue:[
- self appendByte:((symbolicCodeArray at:symIndex) min:255).
- symIndex := symIndex + 1
- ].
+ lineno ifTrue:[
+ self appendByte:((symbolicCodeArray at:symIndex) min:255).
+ symIndex := symIndex + 1
+ ].
- extra notNil ifTrue:[
- (extra == #number) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendSignedByte:index
+ extra notNil ifTrue:[
+ (extra == #number) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendSignedByte:index
- ] ifFalse:[ (extra == #number16) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- self appendSignedWord:index
+ ] ifFalse:[ (extra == #number16) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ self appendSignedWord:index
- ] ifFalse:[ (extra == #unsigned16) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- self appendWord:index
+ ] ifFalse:[ (extra == #unsigned16) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ self appendWord:index
- ] ifFalse:[ (extra == #index) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index
+ ] ifFalse:[ (extra == #index) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index
- ] ifFalse:[ (extra == #lit) ifTrue:[
- index := self addLiteral:(symbolicCodeArray at:symIndex).
- symIndex := symIndex + 1.
- self appendByte:index
+ ] ifFalse:[ (extra == #lit) ifTrue:[
+ index := self addLiteral:(symbolicCodeArray at:symIndex).
+ symIndex := symIndex + 1.
+ self appendByte:index
- ] ifFalse:[ (extra == #speciallit) ifTrue:[
- index := self addLiteral:(symbolicCodeArray at:symIndex).
- index > 255 ifTrue:[
- self parseError:'too many globals (' ,
- (symbolicCodeArray at:symIndex) ,
- ' index=' , index printString ,
- ') in method - please simplify'.
- ^ #Error
- ].
- symIndex := symIndex + 1.
- self appendByte:index.
- self appendEmptyShort. "space for inline-generation"
- self appendEmptyLong. "space for inline-address"
- symIndex := symIndex + 6
+ ] ifFalse:[ (extra == #speciallit) ifTrue:[
+ index := self addLiteral:(symbolicCodeArray at:symIndex).
+ index > 255 ifTrue:[
+ self parseError:'too many globals (' ,
+ (symbolicCodeArray at:symIndex) ,
+ ' index=' , index printString ,
+ ') in method - please simplify'.
+ ^ #Error
+ ].
+ symIndex := symIndex + 1.
+ self appendByte:index.
+ self appendEmptyShort. "space for inline-generation"
+ self appendEmptyLong. "space for inline-address"
+ symIndex := symIndex + 6
- ] ifFalse:[ (extra == #speciallitS) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index.
- self appendEmptyShort. "space for inline-generation"
- self appendEmptyLong. "space for inline-address"
- symIndex := symIndex + 6
+ ] ifFalse:[ (extra == #speciallitS) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index.
+ self appendEmptyShort. "space for inline-generation"
+ self appendEmptyLong. "space for inline-address"
+ symIndex := symIndex + 6
- ] ifFalse:[ (extra == #speciallitL) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- self appendWord:index.
- self appendEmptyShort. "space for inline-generation"
- self appendEmptyLong. "space for inline-address"
- symIndex := symIndex + 6
+ ] ifFalse:[ (extra == #speciallitL) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ self appendWord:index.
+ self appendEmptyShort. "space for inline-generation"
+ self appendEmptyLong. "space for inline-address"
+ symIndex := symIndex + 6
- ] ifFalse:[ (extra == #offset) ifTrue:[
- relocInfo at:symIndex put:codeIndex.
- self addReloc:symIndex.
- symIndex := symIndex + 1.
- self appendByte:0
+ ] ifFalse:[ (extra == #offset) ifTrue:[
+ relocInfo at:symIndex put:codeIndex.
+ self addReloc:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:0
- ] ifFalse:[ (extra == #indexLevel) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index.
- level := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:level
+ ] ifFalse:[ (extra == #indexLevel) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index.
+ level := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:level
- ] ifFalse:[ (extra == #offsetNvarNarg) ifTrue:[
- relocInfo at:symIndex put:codeIndex.
- self addReloc:symIndex.
- symIndex := symIndex + 1.
- self appendEmptyByte.
- nvars := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nvars.
- level := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:level
+ ] ifFalse:[ (extra == #offsetNvarNarg) ifTrue:[
+ relocInfo at:symIndex put:codeIndex.
+ self addReloc:symIndex.
+ symIndex := symIndex + 1.
+ self appendEmptyByte.
+ nvars := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nvars.
+ level := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:level
- ] ifFalse:[ (extra == #absoffset) ifTrue:[
- relocInfo at:symIndex put:codeIndex.
- self addReloc:symIndex.
- addr := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:(addr bitAnd:16rFF).
- self appendByte:((addr bitShift:-8) bitAnd:16rFF).
+ ] ifFalse:[ (extra == #absoffset) ifTrue:[
+ relocInfo at:symIndex put:codeIndex.
+ self addReloc:symIndex.
+ addr := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:(addr bitAnd:16rFF).
+ self appendByte:((addr bitShift:-8) bitAnd:16rFF).
- ] ifFalse:[ (extra == #absoffsetNvarNarg) ifTrue:[
- relocInfo at:symIndex put:codeIndex.
- self addReloc:symIndex.
- addr := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:(addr bitAnd:16rFF).
- self appendByte:((addr bitShift:-8) bitAnd:16rFF).
- nvars := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nvars.
- level := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:level
+ ] ifFalse:[ (extra == #absoffsetNvarNarg) ifTrue:[
+ relocInfo at:symIndex put:codeIndex.
+ self addReloc:symIndex.
+ addr := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:(addr bitAnd:16rFF).
+ self appendByte:((addr bitShift:-8) bitAnd:16rFF).
+ nvars := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nvars.
+ level := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:level
- ] ifFalse:[ (extra == #special) ifTrue:[
- ((codeSymbol == #send)
- or:[codeSymbol == #sendSelf
- or:[codeSymbol == #superSend
- or:[codeSymbol == #hereSend]]]) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- nargs := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nargs.
- self appendByte:index.
+ ] ifFalse:[ (extra == #special) ifTrue:[
+ ((codeSymbol == #send)
+ or:[codeSymbol == #sendSelf
+ or:[codeSymbol == #superSend
+ or:[codeSymbol == #hereSend]]]) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ nargs := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nargs.
+ self appendByte:index.
- (codeSymbol == #superSend
- or:[codeSymbol == #hereSend]) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index
- ].
- stackDelta := nargs negated.
- codeSymbol == #sendSelf ifTrue:[
- stackDelta := stackDelta + 1
- ]
- ] ifFalse:[
- (codeSymbol == #sendDrop) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- nargs := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nargs.
- self appendByte:index.
- stackDelta := (nargs + 1) negated
- ]
- ]
+ (codeSymbol == #superSend
+ or:[codeSymbol == #hereSend]) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index
+ ].
+ stackDelta := nargs negated.
+ codeSymbol == #sendSelf ifTrue:[
+ stackDelta := stackDelta + 1
+ ]
+ ] ifFalse:[
+ (codeSymbol == #sendDrop) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ nargs := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nargs.
+ self appendByte:index.
+ stackDelta := (nargs + 1) negated
+ ]
+ ]
- ] ifFalse:[ (extra == #specialL) ifTrue:[
- ((codeSymbol == #sendL)
- or:[codeSymbol == #sendSelfL
- or:[codeSymbol == #superSendL
- or:[codeSymbol == #hereSendL]]]) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- nargs := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nargs.
- self appendWord:index.
- (codeSymbol == #superSendL
- or:[codeSymbol == #hereSendL]) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- self appendWord:index.
- ].
- stackDelta := nargs negated.
- codeSymbol == #sendSelfL ifTrue:[
- stackDelta := stackDelta + 1
- ]
- ]
- ] ifFalse:[ (extra == #specialSend) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index.
- ]]]]]]]]]]]]]]]]
- ].
+ ] ifFalse:[ (extra == #specialL) ifTrue:[
+ ((codeSymbol == #sendL)
+ or:[codeSymbol == #sendSelfL
+ or:[codeSymbol == #superSendL
+ or:[codeSymbol == #hereSendL]]]) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ nargs := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nargs.
+ self appendWord:index.
+ (codeSymbol == #superSendL
+ or:[codeSymbol == #hereSendL]) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ self appendWord:index.
+ ].
+ stackDelta := nargs negated.
+ codeSymbol == #sendSelfL ifTrue:[
+ stackDelta := stackDelta + 1
+ ]
+ ]
+ ] ifFalse:[ (extra == #specialSend) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index.
+ ]]]]]]]]]]]]]]]]
+ ].
- stackDepth := stackDepth + stackDelta.
- (stackDepth > maxStackDepth) ifTrue:[
- maxStackDepth := stackDepth
- ]
- ].
- relocInfo at:symIndex put:codeIndex.
+ stackDepth := stackDepth + stackDelta.
+ (stackDepth > maxStackDepth) ifTrue:[
+ maxStackDepth := stackDepth
+ ]
+ ].
+ relocInfo at:symIndex put:codeIndex.
- needRetry ifFalse:[
- "
- now relocate - returns true if ok, false if we have to do it again
- (when short jumps have been changed to long jumps)
- "
- relocList notNil ifTrue:[
- needRetry := (self relocateWith:symbolicCodeArray relocInfo:relocInfo) not.
- "
- if returned with false, a relative jump was made into
- an absolute jump - need to start over with one more byte space
- "
- needRetry ifTrue:[
- relocList := nil.
- codeSize := codeSize + 1.
- ]
- ]
- ] ifTrue:[
- 'compiling again ...' infoPrintNL.
- ]
+ needRetry ifFalse:[
+ "
+ now relocate - returns true if ok, false if we have to do it again
+ (when short jumps have been changed to long jumps)
+ "
+ relocList notNil ifTrue:[
+ needRetry := (self relocateWith:symbolicCodeArray relocInfo:relocInfo) not.
+ "
+ if returned with false, a relative jump was made into
+ an absolute jump - need to start over with one more byte space
+ "
+ needRetry ifTrue:[
+ relocList := nil.
+ codeSize := codeSize + 1.
+ ]
+ ]
+ ] ifTrue:[
+ 'compiling again ...' infoPrintCR.
+ ]
].
"code printNL."
^ errorFlag
"Modified: 3.9.1995 / 12:59:43 / claus"
+ "Modified: 20.5.1996 / 10:31:20 / cg"
!
genSymbolicCode
@@ -2003,13 +2004,13 @@
"for debugging - leave c intermediate"
STCKeepCIntermediate == true ifTrue:[
command := stcPath , ' ' , flags , ' -C ' , stFileName.
- 'executing: ' infoPrint. command infoPrintNL.
+ 'executing: ' infoPrint. command infoPrintCR.
OperatingSystem executeCommand:command
].
oFileName asFilename exists ifTrue:[
ok ifFalse:[
- 'oops - system says it failed - but o-file is there ...' infoPrintNL.
+ 'oops - system says it failed - but o-file is there ...' infoPrintCR.
ok := true
]
] ifFalse:[
@@ -2073,7 +2074,7 @@
self parseError:'dynamic load failed - cannot create machine code' position:1.
^ #CannotLoad
].
-"/ ('handle is ' , handle printString) infoPrintNL.
+"/ ('handle is ' , handle printString) infoPrintCR.
address := ObjectFileLoader getFunction:'__' , initName , '_Init' from:handle.
address isNil ifTrue:[
@@ -2095,7 +2096,7 @@
]
].
-"/ ('init at ' , address printString) infoPrintNL.
+"/ ('init at ' , address printString) infoPrintCR.
m := ObjectFileLoader
callInitFunctionAt:address
@@ -2186,7 +2187,7 @@
"
"Modified: 14.9.1995 / 22:33:04 / claus"
- "Modified: 18.5.1996 / 15:41:34 / cg"
+ "Modified: 20.5.1996 / 10:31:18 / cg"
!
createLoadableObjectFor:baseFileName
@@ -2259,6 +2260,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.78 1996-05-18 14:43:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.79 1996-05-20 08:50:55 cg Exp $'
! !
ByteCodeCompiler initialize!
--- a/ByteCodeCompiler.st Mon May 20 10:42:54 1996 +0200
+++ b/ByteCodeCompiler.st Mon May 20 10:50:55 1996 +0200
@@ -1277,244 +1277,245 @@
needRetry := true.
symCodeSize := symbolicCodeArray size.
ShareCode ifTrue:[
- codeBytes := self checkForCommonCode:symbolicCodeArray.
- codeBytes notNil ifTrue:[
- ^ self
- ].
+ codeBytes := self checkForCommonCode:symbolicCodeArray.
+ codeBytes notNil ifTrue:[
+ ^ self
+ ].
].
codeSize := symCodeSize.
[needRetry] whileTrue:[
- stackDepth := 0.
- maxStackDepth := 0.
+ stackDepth := 0.
+ maxStackDepth := 0.
- codeBytes := ByteArray uninitializedNew:codeSize.
- relocInfo := Array basicNew:(codeSize + 1).
- symIndex := 1.
- codeIndex := 1.
+ codeBytes := ByteArray uninitializedNew:codeSize.
+ relocInfo := Array basicNew:(codeSize + 1).
+ symIndex := 1.
+ codeIndex := 1.
- needRetry := false.
- round := round + 1.
+ needRetry := false.
+ round := round + 1.
- [symIndex <= symCodeSize] whileTrue:[
- relocInfo at:symIndex put:codeIndex.
+ [symIndex <= symCodeSize] whileTrue:[
+ relocInfo at:symIndex put:codeIndex.
- codeSymbol := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- stackDelta := 0.
- extra := extraLiteral := nil.
- lineno := false.
+ codeSymbol := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ stackDelta := 0.
+ extra := extraLiteral := nil.
+ lineno := false.
- self appendByteCodeFor:codeSymbol.
+ self appendByteCodeFor:codeSymbol.
- extraLiteral notNil ifTrue:[
- self addLiteral:extraLiteral
- ].
+ extraLiteral notNil ifTrue:[
+ self addLiteral:extraLiteral
+ ].
- lineno ifTrue:[
- self appendByte:((symbolicCodeArray at:symIndex) min:255).
- symIndex := symIndex + 1
- ].
+ lineno ifTrue:[
+ self appendByte:((symbolicCodeArray at:symIndex) min:255).
+ symIndex := symIndex + 1
+ ].
- extra notNil ifTrue:[
- (extra == #number) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendSignedByte:index
+ extra notNil ifTrue:[
+ (extra == #number) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendSignedByte:index
- ] ifFalse:[ (extra == #number16) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- self appendSignedWord:index
+ ] ifFalse:[ (extra == #number16) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ self appendSignedWord:index
- ] ifFalse:[ (extra == #unsigned16) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- self appendWord:index
+ ] ifFalse:[ (extra == #unsigned16) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ self appendWord:index
- ] ifFalse:[ (extra == #index) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index
+ ] ifFalse:[ (extra == #index) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index
- ] ifFalse:[ (extra == #lit) ifTrue:[
- index := self addLiteral:(symbolicCodeArray at:symIndex).
- symIndex := symIndex + 1.
- self appendByte:index
+ ] ifFalse:[ (extra == #lit) ifTrue:[
+ index := self addLiteral:(symbolicCodeArray at:symIndex).
+ symIndex := symIndex + 1.
+ self appendByte:index
- ] ifFalse:[ (extra == #speciallit) ifTrue:[
- index := self addLiteral:(symbolicCodeArray at:symIndex).
- index > 255 ifTrue:[
- self parseError:'too many globals (' ,
- (symbolicCodeArray at:symIndex) ,
- ' index=' , index printString ,
- ') in method - please simplify'.
- ^ #Error
- ].
- symIndex := symIndex + 1.
- self appendByte:index.
- self appendEmptyShort. "space for inline-generation"
- self appendEmptyLong. "space for inline-address"
- symIndex := symIndex + 6
+ ] ifFalse:[ (extra == #speciallit) ifTrue:[
+ index := self addLiteral:(symbolicCodeArray at:symIndex).
+ index > 255 ifTrue:[
+ self parseError:'too many globals (' ,
+ (symbolicCodeArray at:symIndex) ,
+ ' index=' , index printString ,
+ ') in method - please simplify'.
+ ^ #Error
+ ].
+ symIndex := symIndex + 1.
+ self appendByte:index.
+ self appendEmptyShort. "space for inline-generation"
+ self appendEmptyLong. "space for inline-address"
+ symIndex := symIndex + 6
- ] ifFalse:[ (extra == #speciallitS) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index.
- self appendEmptyShort. "space for inline-generation"
- self appendEmptyLong. "space for inline-address"
- symIndex := symIndex + 6
+ ] ifFalse:[ (extra == #speciallitS) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index.
+ self appendEmptyShort. "space for inline-generation"
+ self appendEmptyLong. "space for inline-address"
+ symIndex := symIndex + 6
- ] ifFalse:[ (extra == #speciallitL) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- self appendWord:index.
- self appendEmptyShort. "space for inline-generation"
- self appendEmptyLong. "space for inline-address"
- symIndex := symIndex + 6
+ ] ifFalse:[ (extra == #speciallitL) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ self appendWord:index.
+ self appendEmptyShort. "space for inline-generation"
+ self appendEmptyLong. "space for inline-address"
+ symIndex := symIndex + 6
- ] ifFalse:[ (extra == #offset) ifTrue:[
- relocInfo at:symIndex put:codeIndex.
- self addReloc:symIndex.
- symIndex := symIndex + 1.
- self appendByte:0
+ ] ifFalse:[ (extra == #offset) ifTrue:[
+ relocInfo at:symIndex put:codeIndex.
+ self addReloc:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:0
- ] ifFalse:[ (extra == #indexLevel) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index.
- level := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:level
+ ] ifFalse:[ (extra == #indexLevel) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index.
+ level := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:level
- ] ifFalse:[ (extra == #offsetNvarNarg) ifTrue:[
- relocInfo at:symIndex put:codeIndex.
- self addReloc:symIndex.
- symIndex := symIndex + 1.
- self appendEmptyByte.
- nvars := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nvars.
- level := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:level
+ ] ifFalse:[ (extra == #offsetNvarNarg) ifTrue:[
+ relocInfo at:symIndex put:codeIndex.
+ self addReloc:symIndex.
+ symIndex := symIndex + 1.
+ self appendEmptyByte.
+ nvars := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nvars.
+ level := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:level
- ] ifFalse:[ (extra == #absoffset) ifTrue:[
- relocInfo at:symIndex put:codeIndex.
- self addReloc:symIndex.
- addr := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:(addr bitAnd:16rFF).
- self appendByte:((addr bitShift:-8) bitAnd:16rFF).
+ ] ifFalse:[ (extra == #absoffset) ifTrue:[
+ relocInfo at:symIndex put:codeIndex.
+ self addReloc:symIndex.
+ addr := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:(addr bitAnd:16rFF).
+ self appendByte:((addr bitShift:-8) bitAnd:16rFF).
- ] ifFalse:[ (extra == #absoffsetNvarNarg) ifTrue:[
- relocInfo at:symIndex put:codeIndex.
- self addReloc:symIndex.
- addr := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:(addr bitAnd:16rFF).
- self appendByte:((addr bitShift:-8) bitAnd:16rFF).
- nvars := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nvars.
- level := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:level
+ ] ifFalse:[ (extra == #absoffsetNvarNarg) ifTrue:[
+ relocInfo at:symIndex put:codeIndex.
+ self addReloc:symIndex.
+ addr := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:(addr bitAnd:16rFF).
+ self appendByte:((addr bitShift:-8) bitAnd:16rFF).
+ nvars := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nvars.
+ level := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:level
- ] ifFalse:[ (extra == #special) ifTrue:[
- ((codeSymbol == #send)
- or:[codeSymbol == #sendSelf
- or:[codeSymbol == #superSend
- or:[codeSymbol == #hereSend]]]) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- nargs := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nargs.
- self appendByte:index.
+ ] ifFalse:[ (extra == #special) ifTrue:[
+ ((codeSymbol == #send)
+ or:[codeSymbol == #sendSelf
+ or:[codeSymbol == #superSend
+ or:[codeSymbol == #hereSend]]]) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ nargs := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nargs.
+ self appendByte:index.
- (codeSymbol == #superSend
- or:[codeSymbol == #hereSend]) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index
- ].
- stackDelta := nargs negated.
- codeSymbol == #sendSelf ifTrue:[
- stackDelta := stackDelta + 1
- ]
- ] ifFalse:[
- (codeSymbol == #sendDrop) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- nargs := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nargs.
- self appendByte:index.
- stackDelta := (nargs + 1) negated
- ]
- ]
+ (codeSymbol == #superSend
+ or:[codeSymbol == #hereSend]) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index
+ ].
+ stackDelta := nargs negated.
+ codeSymbol == #sendSelf ifTrue:[
+ stackDelta := stackDelta + 1
+ ]
+ ] ifFalse:[
+ (codeSymbol == #sendDrop) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ nargs := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nargs.
+ self appendByte:index.
+ stackDelta := (nargs + 1) negated
+ ]
+ ]
- ] ifFalse:[ (extra == #specialL) ifTrue:[
- ((codeSymbol == #sendL)
- or:[codeSymbol == #sendSelfL
- or:[codeSymbol == #superSendL
- or:[codeSymbol == #hereSendL]]]) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- nargs := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:nargs.
- self appendWord:index.
- (codeSymbol == #superSendL
- or:[codeSymbol == #hereSendL]) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 2.
- self appendWord:index.
- ].
- stackDelta := nargs negated.
- codeSymbol == #sendSelfL ifTrue:[
- stackDelta := stackDelta + 1
- ]
- ]
- ] ifFalse:[ (extra == #specialSend) ifTrue:[
- index := symbolicCodeArray at:symIndex.
- symIndex := symIndex + 1.
- self appendByte:index.
- ]]]]]]]]]]]]]]]]
- ].
+ ] ifFalse:[ (extra == #specialL) ifTrue:[
+ ((codeSymbol == #sendL)
+ or:[codeSymbol == #sendSelfL
+ or:[codeSymbol == #superSendL
+ or:[codeSymbol == #hereSendL]]]) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ nargs := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:nargs.
+ self appendWord:index.
+ (codeSymbol == #superSendL
+ or:[codeSymbol == #hereSendL]) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 2.
+ self appendWord:index.
+ ].
+ stackDelta := nargs negated.
+ codeSymbol == #sendSelfL ifTrue:[
+ stackDelta := stackDelta + 1
+ ]
+ ]
+ ] ifFalse:[ (extra == #specialSend) ifTrue:[
+ index := symbolicCodeArray at:symIndex.
+ symIndex := symIndex + 1.
+ self appendByte:index.
+ ]]]]]]]]]]]]]]]]
+ ].
- stackDepth := stackDepth + stackDelta.
- (stackDepth > maxStackDepth) ifTrue:[
- maxStackDepth := stackDepth
- ]
- ].
- relocInfo at:symIndex put:codeIndex.
+ stackDepth := stackDepth + stackDelta.
+ (stackDepth > maxStackDepth) ifTrue:[
+ maxStackDepth := stackDepth
+ ]
+ ].
+ relocInfo at:symIndex put:codeIndex.
- needRetry ifFalse:[
- "
- now relocate - returns true if ok, false if we have to do it again
- (when short jumps have been changed to long jumps)
- "
- relocList notNil ifTrue:[
- needRetry := (self relocateWith:symbolicCodeArray relocInfo:relocInfo) not.
- "
- if returned with false, a relative jump was made into
- an absolute jump - need to start over with one more byte space
- "
- needRetry ifTrue:[
- relocList := nil.
- codeSize := codeSize + 1.
- ]
- ]
- ] ifTrue:[
- 'compiling again ...' infoPrintNL.
- ]
+ needRetry ifFalse:[
+ "
+ now relocate - returns true if ok, false if we have to do it again
+ (when short jumps have been changed to long jumps)
+ "
+ relocList notNil ifTrue:[
+ needRetry := (self relocateWith:symbolicCodeArray relocInfo:relocInfo) not.
+ "
+ if returned with false, a relative jump was made into
+ an absolute jump - need to start over with one more byte space
+ "
+ needRetry ifTrue:[
+ relocList := nil.
+ codeSize := codeSize + 1.
+ ]
+ ]
+ ] ifTrue:[
+ 'compiling again ...' infoPrintCR.
+ ]
].
"code printNL."
^ errorFlag
"Modified: 3.9.1995 / 12:59:43 / claus"
+ "Modified: 20.5.1996 / 10:31:20 / cg"
!
genSymbolicCode
@@ -2003,13 +2004,13 @@
"for debugging - leave c intermediate"
STCKeepCIntermediate == true ifTrue:[
command := stcPath , ' ' , flags , ' -C ' , stFileName.
- 'executing: ' infoPrint. command infoPrintNL.
+ 'executing: ' infoPrint. command infoPrintCR.
OperatingSystem executeCommand:command
].
oFileName asFilename exists ifTrue:[
ok ifFalse:[
- 'oops - system says it failed - but o-file is there ...' infoPrintNL.
+ 'oops - system says it failed - but o-file is there ...' infoPrintCR.
ok := true
]
] ifFalse:[
@@ -2073,7 +2074,7 @@
self parseError:'dynamic load failed - cannot create machine code' position:1.
^ #CannotLoad
].
-"/ ('handle is ' , handle printString) infoPrintNL.
+"/ ('handle is ' , handle printString) infoPrintCR.
address := ObjectFileLoader getFunction:'__' , initName , '_Init' from:handle.
address isNil ifTrue:[
@@ -2095,7 +2096,7 @@
]
].
-"/ ('init at ' , address printString) infoPrintNL.
+"/ ('init at ' , address printString) infoPrintCR.
m := ObjectFileLoader
callInitFunctionAt:address
@@ -2186,7 +2187,7 @@
"
"Modified: 14.9.1995 / 22:33:04 / claus"
- "Modified: 18.5.1996 / 15:41:34 / cg"
+ "Modified: 20.5.1996 / 10:31:18 / cg"
!
createLoadableObjectFor:baseFileName
@@ -2259,6 +2260,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.78 1996-05-18 14:43:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.79 1996-05-20 08:50:55 cg Exp $'
! !
ByteCodeCompiler initialize!