Bad change in previous version. Need extra bytecode as jump target.
--- a/BCompiler.st Thu Aug 15 15:06:00 1996 +0200
+++ b/BCompiler.st Thu Aug 15 18:35:37 1996 +0200
@@ -1547,19 +1547,22 @@
"not a return - add retSelf"
"
if the last statement was a send for side-effect,
- replace the previous drop by a retSelf
+ replace the previous drop by a retSelf.
+ In this case we have to keep an extra retSelf bacause
+ it could be a jump target.
"
(lastStatement notNil
- and:[(code := codeStream contents) notNil
- and:[code size > 0
- and:[code last == #drop]]]) ifTrue:[
- codeStream position:(codeStream position - 1).
+ and:[(code := codeStream contents) notNil
+ and:[code size > 0
+ and:[code last == #drop]]]) ifTrue:[
+ codeStream backStep.
+ codeStream nextPut:#retSelf
].
codeStream nextPut:#retSelf
].
^ codeStream contents
- "Modified: 10.8.1996 / 00:21:00 / stefan"
+ "Modified: 15.8.1996 / 17:35:02 / stefan"
!
hasLineNumber:sel
@@ -2331,6 +2334,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.89 1996-08-09 23:18:17 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.90 1996-08-15 16:35:37 stefan Exp $'
! !
ByteCodeCompiler initialize!
--- a/ByteCodeCompiler.st Thu Aug 15 15:06:00 1996 +0200
+++ b/ByteCodeCompiler.st Thu Aug 15 18:35:37 1996 +0200
@@ -1547,19 +1547,22 @@
"not a return - add retSelf"
"
if the last statement was a send for side-effect,
- replace the previous drop by a retSelf
+ replace the previous drop by a retSelf.
+ In this case we have to keep an extra retSelf bacause
+ it could be a jump target.
"
(lastStatement notNil
- and:[(code := codeStream contents) notNil
- and:[code size > 0
- and:[code last == #drop]]]) ifTrue:[
- codeStream position:(codeStream position - 1).
+ and:[(code := codeStream contents) notNil
+ and:[code size > 0
+ and:[code last == #drop]]]) ifTrue:[
+ codeStream backStep.
+ codeStream nextPut:#retSelf
].
codeStream nextPut:#retSelf
].
^ codeStream contents
- "Modified: 10.8.1996 / 00:21:00 / stefan"
+ "Modified: 15.8.1996 / 17:35:02 / stefan"
!
hasLineNumber:sel
@@ -2331,6 +2334,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.89 1996-08-09 23:18:17 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.90 1996-08-15 16:35:37 stefan Exp $'
! !
ByteCodeCompiler initialize!