--- a/BCompiler.st Mon Feb 26 15:40:15 1996 +0100
+++ b/BCompiler.st Mon Feb 26 15:43:21 1996 +0100
@@ -52,31 +52,31 @@
Instance variables:
- codeBytes <ByteArry> bytecodes
- codeIndex <SmallInteger> next index to put into code array
- litArray <OrderedCollection> literals
- stackDelta <SmallInteger> return value of byteCodeFor:
- extra <Symbol> return value of byteCodeFor:
- lineno <Boolean> return value of byteCodeFor:
- maxStackDepth <SmallInteger> stack need of method
- relocList <Array> used temporary for relocation
+ codeBytes <ByteArry> bytecodes
+ codeIndex <SmallInteger> next index to put into code array
+ litArray <OrderedCollection> literals
+ stackDelta <SmallInteger> return value of byteCodeFor:
+ extra <Symbol> return value of byteCodeFor:
+ lineno <Boolean> return value of byteCodeFor:
+ maxStackDepth <SmallInteger> stack need of method
+ relocList <Array> used temporary for relocation
Class variables:
- JumpToAbsJump <Dictionary> internal table to map opcodes
+ JumpToAbsJump <Dictionary> internal table to map opcodes
- SequenceNumber <Integer> counting intermediate stc-compiled
- objects (for unique o-file naming)
+ SequenceNumber <Integer> counting intermediate stc-compiled
+ objects (for unique o-file naming)
- STCCompilationDefines passed to stc as command line arguments
- STCCompilationIncludes
- STCCompilationOptions
- <String>
+ STCCompilationDefines passed to stc as command line arguments
+ STCCompilationIncludes
+ STCCompilationOptions
+ <String>
- STCCompilation <Symbol> #always, #primitiveOnly or #never
- controls when stc compilation is wanted
+ STCCompilation <Symbol> #always, #primitiveOnly or #never
+ controls when stc compilation is wanted
- ShareCode <Boolean> reuse byteArrays for common (simple) code sequences
+ ShareCode <Boolean> reuse byteArrays for common (simple) code sequences
This is normally a 'good' optimization,
expect if you plan to modify the byteCodes.
"
@@ -165,7 +165,7 @@
!
compile:aString forClass:aClass inCategory:cat notifying:requestor
- install:install skipIfSame:skipIfSame silent:silent
+ install:install skipIfSame:skipIfSame silent:silent
"the basic workhorse method for compiling:
compile a source-string for a method in classToCompileFor.
@@ -195,90 +195,90 @@
compiler notifying:requestor.
silent ifTrue:[
"/ compiler ignoreErrors.
- compiler ignoreWarnings
+ compiler ignoreWarnings
].
compiler nextToken.
(compiler parseMethodSpec == #Error) ifTrue:[
- compiler parseError:'syntax error in method specification'.
- tree := #Error
+ compiler parseError:'syntax error in method specification'.
+ tree := #Error
] ifFalse:[
- lazy ifFalse:[
- "check if same source"
- (skipIfSame and:[(sel := compiler selector) notNil]) ifTrue:[
- oldMethod := aClass compiledMethodAt:sel.
- oldMethod notNil ifTrue:[
- oldMethod source = aString ifTrue:[
- oldMethod isInvalid ifFalse:[
- silencio ifFalse:[
- Transcript showCr:(' unchanged: ',aClass name,' ',compiler selector)
- ].
- "
- same. however, category may be different
- "
- (cat notNil and:[cat ~= oldMethod category]) ifTrue:[
- oldMethod category:cat.
- oldMethod changed:#category.
+ lazy ifFalse:[
+ "check if same source"
+ (skipIfSame and:[(sel := compiler selector) notNil]) ifTrue:[
+ oldMethod := aClass compiledMethodAt:sel.
+ oldMethod notNil ifTrue:[
+ oldMethod source = aString ifTrue:[
+ oldMethod isInvalid ifFalse:[
+ silencio ifFalse:[
+ Transcript showCr:(' unchanged: ',aClass name,' ',compiler selector)
+ ].
+ "
+ same. however, category may be different
+ "
+ (cat notNil and:[cat ~= oldMethod category]) ifTrue:[
+ oldMethod category:cat.
+ oldMethod changed:#category.
"/ aClass updateRevisionString.
- aClass addChangeRecordForMethodCategory:oldMethod category:cat.
- ].
- ^ oldMethod
- ]
- ]
- ]
- ].
- tree := compiler parseMethodBody.
- compiler tree:tree.
- ]
+ aClass addChangeRecordForMethodCategory:oldMethod category:cat.
+ ].
+ ^ oldMethod
+ ]
+ ]
+ ]
+ ].
+ tree := compiler parseMethodBody.
+ compiler tree:tree.
+ ]
].
(compiler errorFlag or:[tree == #Error]) ifTrue:[
- compiler showErrorMessageForClass:aClass.
- ^ #Error
+ compiler showErrorMessageForClass:aClass.
+ ^ #Error
].
sel := compiler selector.
"if no error and also no selector ..."
sel isNil ifTrue:[
- "... it was just a comment or other empty stuff"
- ^ nil
+ "... it was just a comment or other empty stuff"
+ ^ nil
].
lazy ifFalse:[
- "
- freak-out support ...
- "
- (compiler hasNonOptionalPrimitiveCode
- or:[(compiler hasPrimitiveCode and:[self canCreateMachineCode])
- or:[STCCompilation == #always and:[sel ~~ #doIt]]]) ifTrue:[
- newMethod := compiler
- compileToMachineCode:aString
- forClass:aClass
- inCategory:cat
- notifying:requestor
- install:install
- skipIfSame:skipIfSame
- silent:silent.
+ "
+ freak-out support ...
+ "
+ (compiler hasNonOptionalPrimitiveCode
+ or:[(compiler hasPrimitiveCode and:[self canCreateMachineCode])
+ or:[STCCompilation == #always and:[sel ~~ #doIt]]]) ifTrue:[
+ newMethod := compiler
+ compileToMachineCode:aString
+ forClass:aClass
+ inCategory:cat
+ notifying:requestor
+ install:install
+ skipIfSame:skipIfSame
+ silent:silent.
- newMethod == #Error ifTrue:[
- compiler showErrorMessageForClass:aClass.
- ^ #Error
- ].
+ newMethod == #Error ifTrue:[
+ compiler showErrorMessageForClass:aClass.
+ ^ #Error
+ ].
- (newMethod == #CannotLoad) ifTrue:[
- newMethod := compiler trappingStubMethodFor:aString inCategory:cat.
+ (newMethod == #CannotLoad) ifTrue:[
+ newMethod := compiler trappingStubMethodFor:aString inCategory:cat.
- keptOldCode := false.
- install ifTrue:[
- "/
- "/ be very careful with existing methods
- "/ (otherwise, you could easily make your system unusable in systems which cannot load)
- "/
- sel notNil ifTrue:[
- oldMethod := aClass compiledMethodAt:sel
- ].
- (oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[
- answer := Dialog
- confirm:'installation of binary code is not possible or disabled.
+ keptOldCode := false.
+ install ifTrue:[
+ "/
+ "/ be very careful with existing methods
+ "/ (otherwise, you could easily make your system unusable in systems which cannot load)
+ "/
+ sel notNil ifTrue:[
+ oldMethod := aClass compiledMethodAt:sel
+ ].
+ (oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[
+ answer := Dialog
+ confirm:'installation of binary code is not possible or disabled.
Shall I use the old methods functionality
or instead create a dummy trap method for it ?
@@ -289,31 +289,31 @@
Close this warnBox to abort the compilation.
'
- yesLabel:'trap code'
- noLabel:'keep old'.
- answer isNil ifTrue:[
- ^ #Error
- ].
- answer == false ifTrue:[
- newMethod code:(oldMethod code).
- keptOldCode := true.
- ].
- ].
- aClass addSelector:sel withMethod:newMethod
- ].
- Transcript show:'*** '.
- sel notNil ifTrue:[
- Transcript show:(sel ,' ')
- ].
- keptOldCode ifTrue:[
- msg := 'not really compiled - method still shows previous behavior'.
- ] ifFalse:[
- msg := 'not compiled to machine code - created a stub instead.'.
- ].
- Transcript showCr:msg.
- ].
- ^ newMethod
- ].
+ yesLabel:'trap code'
+ noLabel:'keep old'.
+ answer isNil ifTrue:[
+ ^ #Error
+ ].
+ answer == false ifTrue:[
+ newMethod code:(oldMethod code).
+ keptOldCode := true.
+ ].
+ ].
+ aClass addSelector:sel withMethod:newMethod
+ ].
+ Transcript show:'*** '.
+ sel notNil ifTrue:[
+ Transcript show:(sel ,' ')
+ ].
+ keptOldCode ifTrue:[
+ msg := 'not really compiled - method still shows previous behavior'.
+ ] ifFalse:[
+ msg := 'not compiled to machine code - created a stub instead.'.
+ ].
+ Transcript showCr:msg.
+ ].
+ ^ newMethod
+ ].
].
"
@@ -322,58 +322,58 @@
compile itself when first called.
"
lazy ifTrue:[
- newMethod := LazyMethod new.
- (ClassCategoryReader sourceMode == #sourceReference) ifTrue:[
- sourceFile := ObjectMemory nameForSources.
- sourceFile notNil ifTrue:[
- sourceStream := sourceFile asFilename appendingWriteStream.
- ]
- ].
- sourceStream isNil ifTrue:[
- newMethod source:aString.
- ] ifFalse:[
- sourceStream setToEnd.
- pos := sourceStream position.
- sourceStream nextChunkPut:aString.
- sourceStream close.
- newMethod sourceFilename:sourceFile position:pos.
- ].
- newMethod category:cat.
- Project notNil ifTrue:[
- newMethod package:(Project currentPackageName)
- ].
+ newMethod := LazyMethod new.
+ (ClassCategoryReader sourceMode == #sourceReference) ifTrue:[
+ sourceFile := ObjectMemory nameForSources.
+ sourceFile notNil ifTrue:[
+ sourceStream := sourceFile asFilename appendingWriteStream.
+ ]
+ ].
+ sourceStream isNil ifTrue:[
+ newMethod source:aString.
+ ] ifFalse:[
+ sourceStream setToEnd.
+ pos := sourceStream position.
+ sourceStream nextChunkPut:aString.
+ sourceStream close.
+ newMethod sourceFilename:sourceFile position:pos.
+ ].
+ newMethod category:cat.
+ Project notNil ifTrue:[
+ newMethod package:(Project currentPackageName)
+ ].
- aClass addSelector:sel withLazyMethod:newMethod.
- ^ newMethod
+ aClass addSelector:sel withLazyMethod:newMethod.
+ ^ newMethod
].
(primNr := compiler primitiveNumber) isNil ifTrue:[
- "
- produce symbolic code first
- "
- symbolicCodeArray := compiler genSymbolicCode.
+ "
+ produce symbolic code first
+ "
+ symbolicCodeArray := compiler genSymbolicCode.
- (symbolicCodeArray == #Error) ifTrue:[
- Transcript show:' '.
- sel notNil ifTrue:[
- Transcript show:(sel ,' ')
- ].
- Transcript showCr:'translation error'.
- ^ #Error
- ].
+ (symbolicCodeArray == #Error) ifTrue:[
+ Transcript show:' '.
+ sel notNil ifTrue:[
+ Transcript show:(sel ,' ')
+ ].
+ Transcript showCr:'translation error'.
+ ^ #Error
+ ].
- "
- take this, producing bytecode
- (someone willin' to make machine code :-)
- "
- ((compiler genByteCodeFrom:symbolicCodeArray) == #Error) ifTrue:[
- Transcript show:' '.
- sel notNil ifTrue:[
- Transcript show:(sel ,' ')
- ].
- Transcript showCr:'relocation error - must be simplified'.
- ^ #Error
- ].
+ "
+ take this, producing bytecode
+ (someone willin' to make machine code :-)
+ "
+ ((compiler genByteCodeFrom:symbolicCodeArray) == #Error) ifTrue:[
+ Transcript show:' '.
+ sel notNil ifTrue:[
+ Transcript show:(sel ,' ')
+ ].
+ Transcript showCr:'relocation error - must be simplified'.
+ ^ #Error
+ ].
].
"
@@ -382,14 +382,14 @@
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
+ "literals MUST be an array - not just any Collection"
+ lits := Array withAll:lits.
+ newMethod literals:lits
].
primNr notNil ifTrue:[
- newMethod code:(compiler checkForPrimitiveCode:primNr).
+ newMethod code:(compiler checkForPrimitiveCode:primNr).
] ifFalse:[
- newMethod byteCode:(compiler code).
+ newMethod byteCode:(compiler code).
].
newMethod numberOfMethodVars:(compiler numberOfMethodVars).
newMethod numberOfMethodArgs:(compiler numberOfMethodArgs).
@@ -399,21 +399,21 @@
if there where any corrections, install the updated source
"
(newSource := compiler correctedSource) notNil ifTrue:[
- newMethod source:newSource
+ newMethod source:newSource
] ifFalse:[
- newMethod source:aString.
+ newMethod source:aString.
].
newMethod category:cat.
Project notNil ifTrue:[
- newMethod package:(Project currentPackageName)
+ newMethod package:(Project currentPackageName)
].
install ifTrue:[
- aClass addSelector:sel withMethod:newMethod
+ aClass addSelector:sel withMethod:newMethod
].
silencio ifFalse:[
- Transcript showCr:(' compiled: ', aClass name,' ', sel)
+ Transcript showCr:(' compiled: ', aClass name,' ', sel)
].
^ newMethod
@@ -1885,6 +1885,8 @@
command := stcPath , ' ' , flags , ' -c ' , stFileName.
"/ command printNL.
+ self activityNotification:'compiling'.
+
ok := OperatingSystem executeCommand:command.
status := OperatingSystem lastExecStatus.
@@ -1944,11 +1946,16 @@
^ #CannotLoad
].
+ "
+ if required, make a shared or otherwise loadable object file for it
+ "
+ self activityNotification:'linking'.
oFileName := ObjectFileLoader createLoadableObjectFor:initName.
"
load the objectfile
"
+ self activityNotification:'loading'.
handle := ObjectFileLoader loadDynamicObject:oFileName.
handle isNil ifTrue:[
OperatingSystem removeFile:stFileName.
@@ -2140,6 +2147,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.67 1996-02-26 14:40:15 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.68 1996-02-26 14:43:21 cg Exp $'
! !
ByteCodeCompiler initialize!
--- a/ByteCodeCompiler.st Mon Feb 26 15:40:15 1996 +0100
+++ b/ByteCodeCompiler.st Mon Feb 26 15:43:21 1996 +0100
@@ -52,31 +52,31 @@
Instance variables:
- codeBytes <ByteArry> bytecodes
- codeIndex <SmallInteger> next index to put into code array
- litArray <OrderedCollection> literals
- stackDelta <SmallInteger> return value of byteCodeFor:
- extra <Symbol> return value of byteCodeFor:
- lineno <Boolean> return value of byteCodeFor:
- maxStackDepth <SmallInteger> stack need of method
- relocList <Array> used temporary for relocation
+ codeBytes <ByteArry> bytecodes
+ codeIndex <SmallInteger> next index to put into code array
+ litArray <OrderedCollection> literals
+ stackDelta <SmallInteger> return value of byteCodeFor:
+ extra <Symbol> return value of byteCodeFor:
+ lineno <Boolean> return value of byteCodeFor:
+ maxStackDepth <SmallInteger> stack need of method
+ relocList <Array> used temporary for relocation
Class variables:
- JumpToAbsJump <Dictionary> internal table to map opcodes
+ JumpToAbsJump <Dictionary> internal table to map opcodes
- SequenceNumber <Integer> counting intermediate stc-compiled
- objects (for unique o-file naming)
+ SequenceNumber <Integer> counting intermediate stc-compiled
+ objects (for unique o-file naming)
- STCCompilationDefines passed to stc as command line arguments
- STCCompilationIncludes
- STCCompilationOptions
- <String>
+ STCCompilationDefines passed to stc as command line arguments
+ STCCompilationIncludes
+ STCCompilationOptions
+ <String>
- STCCompilation <Symbol> #always, #primitiveOnly or #never
- controls when stc compilation is wanted
+ STCCompilation <Symbol> #always, #primitiveOnly or #never
+ controls when stc compilation is wanted
- ShareCode <Boolean> reuse byteArrays for common (simple) code sequences
+ ShareCode <Boolean> reuse byteArrays for common (simple) code sequences
This is normally a 'good' optimization,
expect if you plan to modify the byteCodes.
"
@@ -165,7 +165,7 @@
!
compile:aString forClass:aClass inCategory:cat notifying:requestor
- install:install skipIfSame:skipIfSame silent:silent
+ install:install skipIfSame:skipIfSame silent:silent
"the basic workhorse method for compiling:
compile a source-string for a method in classToCompileFor.
@@ -195,90 +195,90 @@
compiler notifying:requestor.
silent ifTrue:[
"/ compiler ignoreErrors.
- compiler ignoreWarnings
+ compiler ignoreWarnings
].
compiler nextToken.
(compiler parseMethodSpec == #Error) ifTrue:[
- compiler parseError:'syntax error in method specification'.
- tree := #Error
+ compiler parseError:'syntax error in method specification'.
+ tree := #Error
] ifFalse:[
- lazy ifFalse:[
- "check if same source"
- (skipIfSame and:[(sel := compiler selector) notNil]) ifTrue:[
- oldMethod := aClass compiledMethodAt:sel.
- oldMethod notNil ifTrue:[
- oldMethod source = aString ifTrue:[
- oldMethod isInvalid ifFalse:[
- silencio ifFalse:[
- Transcript showCr:(' unchanged: ',aClass name,' ',compiler selector)
- ].
- "
- same. however, category may be different
- "
- (cat notNil and:[cat ~= oldMethod category]) ifTrue:[
- oldMethod category:cat.
- oldMethod changed:#category.
+ lazy ifFalse:[
+ "check if same source"
+ (skipIfSame and:[(sel := compiler selector) notNil]) ifTrue:[
+ oldMethod := aClass compiledMethodAt:sel.
+ oldMethod notNil ifTrue:[
+ oldMethod source = aString ifTrue:[
+ oldMethod isInvalid ifFalse:[
+ silencio ifFalse:[
+ Transcript showCr:(' unchanged: ',aClass name,' ',compiler selector)
+ ].
+ "
+ same. however, category may be different
+ "
+ (cat notNil and:[cat ~= oldMethod category]) ifTrue:[
+ oldMethod category:cat.
+ oldMethod changed:#category.
"/ aClass updateRevisionString.
- aClass addChangeRecordForMethodCategory:oldMethod category:cat.
- ].
- ^ oldMethod
- ]
- ]
- ]
- ].
- tree := compiler parseMethodBody.
- compiler tree:tree.
- ]
+ aClass addChangeRecordForMethodCategory:oldMethod category:cat.
+ ].
+ ^ oldMethod
+ ]
+ ]
+ ]
+ ].
+ tree := compiler parseMethodBody.
+ compiler tree:tree.
+ ]
].
(compiler errorFlag or:[tree == #Error]) ifTrue:[
- compiler showErrorMessageForClass:aClass.
- ^ #Error
+ compiler showErrorMessageForClass:aClass.
+ ^ #Error
].
sel := compiler selector.
"if no error and also no selector ..."
sel isNil ifTrue:[
- "... it was just a comment or other empty stuff"
- ^ nil
+ "... it was just a comment or other empty stuff"
+ ^ nil
].
lazy ifFalse:[
- "
- freak-out support ...
- "
- (compiler hasNonOptionalPrimitiveCode
- or:[(compiler hasPrimitiveCode and:[self canCreateMachineCode])
- or:[STCCompilation == #always and:[sel ~~ #doIt]]]) ifTrue:[
- newMethod := compiler
- compileToMachineCode:aString
- forClass:aClass
- inCategory:cat
- notifying:requestor
- install:install
- skipIfSame:skipIfSame
- silent:silent.
+ "
+ freak-out support ...
+ "
+ (compiler hasNonOptionalPrimitiveCode
+ or:[(compiler hasPrimitiveCode and:[self canCreateMachineCode])
+ or:[STCCompilation == #always and:[sel ~~ #doIt]]]) ifTrue:[
+ newMethod := compiler
+ compileToMachineCode:aString
+ forClass:aClass
+ inCategory:cat
+ notifying:requestor
+ install:install
+ skipIfSame:skipIfSame
+ silent:silent.
- newMethod == #Error ifTrue:[
- compiler showErrorMessageForClass:aClass.
- ^ #Error
- ].
+ newMethod == #Error ifTrue:[
+ compiler showErrorMessageForClass:aClass.
+ ^ #Error
+ ].
- (newMethod == #CannotLoad) ifTrue:[
- newMethod := compiler trappingStubMethodFor:aString inCategory:cat.
+ (newMethod == #CannotLoad) ifTrue:[
+ newMethod := compiler trappingStubMethodFor:aString inCategory:cat.
- keptOldCode := false.
- install ifTrue:[
- "/
- "/ be very careful with existing methods
- "/ (otherwise, you could easily make your system unusable in systems which cannot load)
- "/
- sel notNil ifTrue:[
- oldMethod := aClass compiledMethodAt:sel
- ].
- (oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[
- answer := Dialog
- confirm:'installation of binary code is not possible or disabled.
+ keptOldCode := false.
+ install ifTrue:[
+ "/
+ "/ be very careful with existing methods
+ "/ (otherwise, you could easily make your system unusable in systems which cannot load)
+ "/
+ sel notNil ifTrue:[
+ oldMethod := aClass compiledMethodAt:sel
+ ].
+ (oldMethod notNil and:[oldMethod code ~= newMethod code]) ifTrue:[
+ answer := Dialog
+ confirm:'installation of binary code is not possible or disabled.
Shall I use the old methods functionality
or instead create a dummy trap method for it ?
@@ -289,31 +289,31 @@
Close this warnBox to abort the compilation.
'
- yesLabel:'trap code'
- noLabel:'keep old'.
- answer isNil ifTrue:[
- ^ #Error
- ].
- answer == false ifTrue:[
- newMethod code:(oldMethod code).
- keptOldCode := true.
- ].
- ].
- aClass addSelector:sel withMethod:newMethod
- ].
- Transcript show:'*** '.
- sel notNil ifTrue:[
- Transcript show:(sel ,' ')
- ].
- keptOldCode ifTrue:[
- msg := 'not really compiled - method still shows previous behavior'.
- ] ifFalse:[
- msg := 'not compiled to machine code - created a stub instead.'.
- ].
- Transcript showCr:msg.
- ].
- ^ newMethod
- ].
+ yesLabel:'trap code'
+ noLabel:'keep old'.
+ answer isNil ifTrue:[
+ ^ #Error
+ ].
+ answer == false ifTrue:[
+ newMethod code:(oldMethod code).
+ keptOldCode := true.
+ ].
+ ].
+ aClass addSelector:sel withMethod:newMethod
+ ].
+ Transcript show:'*** '.
+ sel notNil ifTrue:[
+ Transcript show:(sel ,' ')
+ ].
+ keptOldCode ifTrue:[
+ msg := 'not really compiled - method still shows previous behavior'.
+ ] ifFalse:[
+ msg := 'not compiled to machine code - created a stub instead.'.
+ ].
+ Transcript showCr:msg.
+ ].
+ ^ newMethod
+ ].
].
"
@@ -322,58 +322,58 @@
compile itself when first called.
"
lazy ifTrue:[
- newMethod := LazyMethod new.
- (ClassCategoryReader sourceMode == #sourceReference) ifTrue:[
- sourceFile := ObjectMemory nameForSources.
- sourceFile notNil ifTrue:[
- sourceStream := sourceFile asFilename appendingWriteStream.
- ]
- ].
- sourceStream isNil ifTrue:[
- newMethod source:aString.
- ] ifFalse:[
- sourceStream setToEnd.
- pos := sourceStream position.
- sourceStream nextChunkPut:aString.
- sourceStream close.
- newMethod sourceFilename:sourceFile position:pos.
- ].
- newMethod category:cat.
- Project notNil ifTrue:[
- newMethod package:(Project currentPackageName)
- ].
+ newMethod := LazyMethod new.
+ (ClassCategoryReader sourceMode == #sourceReference) ifTrue:[
+ sourceFile := ObjectMemory nameForSources.
+ sourceFile notNil ifTrue:[
+ sourceStream := sourceFile asFilename appendingWriteStream.
+ ]
+ ].
+ sourceStream isNil ifTrue:[
+ newMethod source:aString.
+ ] ifFalse:[
+ sourceStream setToEnd.
+ pos := sourceStream position.
+ sourceStream nextChunkPut:aString.
+ sourceStream close.
+ newMethod sourceFilename:sourceFile position:pos.
+ ].
+ newMethod category:cat.
+ Project notNil ifTrue:[
+ newMethod package:(Project currentPackageName)
+ ].
- aClass addSelector:sel withLazyMethod:newMethod.
- ^ newMethod
+ aClass addSelector:sel withLazyMethod:newMethod.
+ ^ newMethod
].
(primNr := compiler primitiveNumber) isNil ifTrue:[
- "
- produce symbolic code first
- "
- symbolicCodeArray := compiler genSymbolicCode.
+ "
+ produce symbolic code first
+ "
+ symbolicCodeArray := compiler genSymbolicCode.
- (symbolicCodeArray == #Error) ifTrue:[
- Transcript show:' '.
- sel notNil ifTrue:[
- Transcript show:(sel ,' ')
- ].
- Transcript showCr:'translation error'.
- ^ #Error
- ].
+ (symbolicCodeArray == #Error) ifTrue:[
+ Transcript show:' '.
+ sel notNil ifTrue:[
+ Transcript show:(sel ,' ')
+ ].
+ Transcript showCr:'translation error'.
+ ^ #Error
+ ].
- "
- take this, producing bytecode
- (someone willin' to make machine code :-)
- "
- ((compiler genByteCodeFrom:symbolicCodeArray) == #Error) ifTrue:[
- Transcript show:' '.
- sel notNil ifTrue:[
- Transcript show:(sel ,' ')
- ].
- Transcript showCr:'relocation error - must be simplified'.
- ^ #Error
- ].
+ "
+ take this, producing bytecode
+ (someone willin' to make machine code :-)
+ "
+ ((compiler genByteCodeFrom:symbolicCodeArray) == #Error) ifTrue:[
+ Transcript show:' '.
+ sel notNil ifTrue:[
+ Transcript show:(sel ,' ')
+ ].
+ Transcript showCr:'relocation error - must be simplified'.
+ ^ #Error
+ ].
].
"
@@ -382,14 +382,14 @@
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
+ "literals MUST be an array - not just any Collection"
+ lits := Array withAll:lits.
+ newMethod literals:lits
].
primNr notNil ifTrue:[
- newMethod code:(compiler checkForPrimitiveCode:primNr).
+ newMethod code:(compiler checkForPrimitiveCode:primNr).
] ifFalse:[
- newMethod byteCode:(compiler code).
+ newMethod byteCode:(compiler code).
].
newMethod numberOfMethodVars:(compiler numberOfMethodVars).
newMethod numberOfMethodArgs:(compiler numberOfMethodArgs).
@@ -399,21 +399,21 @@
if there where any corrections, install the updated source
"
(newSource := compiler correctedSource) notNil ifTrue:[
- newMethod source:newSource
+ newMethod source:newSource
] ifFalse:[
- newMethod source:aString.
+ newMethod source:aString.
].
newMethod category:cat.
Project notNil ifTrue:[
- newMethod package:(Project currentPackageName)
+ newMethod package:(Project currentPackageName)
].
install ifTrue:[
- aClass addSelector:sel withMethod:newMethod
+ aClass addSelector:sel withMethod:newMethod
].
silencio ifFalse:[
- Transcript showCr:(' compiled: ', aClass name,' ', sel)
+ Transcript showCr:(' compiled: ', aClass name,' ', sel)
].
^ newMethod
@@ -1885,6 +1885,8 @@
command := stcPath , ' ' , flags , ' -c ' , stFileName.
"/ command printNL.
+ self activityNotification:'compiling'.
+
ok := OperatingSystem executeCommand:command.
status := OperatingSystem lastExecStatus.
@@ -1944,11 +1946,16 @@
^ #CannotLoad
].
+ "
+ if required, make a shared or otherwise loadable object file for it
+ "
+ self activityNotification:'linking'.
oFileName := ObjectFileLoader createLoadableObjectFor:initName.
"
load the objectfile
"
+ self activityNotification:'loading'.
handle := ObjectFileLoader loadDynamicObject:oFileName.
handle isNil ifTrue:[
OperatingSystem removeFile:stFileName.
@@ -2140,6 +2147,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.67 1996-02-26 14:40:15 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.68 1996-02-26 14:43:21 cg Exp $'
! !
ByteCodeCompiler initialize!