Optimize double #retSelf.
--- a/BCompiler.st Sat Aug 10 00:55:35 1996 +0200
+++ b/BCompiler.st Sat Aug 10 01:18:17 1996 +0200
@@ -1538,28 +1538,28 @@
thisStatement := tree.
[thisStatement notNil] whileTrue:[
- lastStatement := thisStatement.
- thisStatement codeForSideEffectOn:codeStream inBlock:nil for:self.
- thisStatement := thisStatement nextStatement
+ lastStatement := thisStatement.
+ thisStatement codeForSideEffectOn:codeStream inBlock:nil for:self.
+ thisStatement := thisStatement nextStatement
].
(lastStatement isNil or:[lastStatement isReturnNode not])
ifTrue:[
- "not a return - add retSelf"
- "
- if the last statement was a send for side-effect,
- replace the previous drop by a retSelf
- "
- lastStatement notNil ifTrue:[
- ((code := codeStream contents) notNil
- and:[code size > 0
- and:[code last == #drop]]) ifTrue:[
- codeStream position:(codeStream position - 1).
- codeStream nextPut:#retSelf
- ]
- ].
- codeStream nextPut:#retSelf
+ "not a return - add retSelf"
+ "
+ if the last statement was a send for side-effect,
+ replace the previous drop by a retSelf
+ "
+ (lastStatement notNil
+ and:[(code := codeStream contents) notNil
+ and:[code size > 0
+ and:[code last == #drop]]]) ifTrue:[
+ codeStream position:(codeStream position - 1).
+ ].
+ codeStream nextPut:#retSelf
].
^ codeStream contents
+
+ "Modified: 10.8.1996 / 00:21:00 / stefan"
!
hasLineNumber:sel
@@ -2331,6 +2331,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.88 1996-08-05 16:57:35 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.89 1996-08-09 23:18:17 stefan Exp $'
! !
ByteCodeCompiler initialize!
--- a/ByteCodeCompiler.st Sat Aug 10 00:55:35 1996 +0200
+++ b/ByteCodeCompiler.st Sat Aug 10 01:18:17 1996 +0200
@@ -1538,28 +1538,28 @@
thisStatement := tree.
[thisStatement notNil] whileTrue:[
- lastStatement := thisStatement.
- thisStatement codeForSideEffectOn:codeStream inBlock:nil for:self.
- thisStatement := thisStatement nextStatement
+ lastStatement := thisStatement.
+ thisStatement codeForSideEffectOn:codeStream inBlock:nil for:self.
+ thisStatement := thisStatement nextStatement
].
(lastStatement isNil or:[lastStatement isReturnNode not])
ifTrue:[
- "not a return - add retSelf"
- "
- if the last statement was a send for side-effect,
- replace the previous drop by a retSelf
- "
- lastStatement notNil ifTrue:[
- ((code := codeStream contents) notNil
- and:[code size > 0
- and:[code last == #drop]]) ifTrue:[
- codeStream position:(codeStream position - 1).
- codeStream nextPut:#retSelf
- ]
- ].
- codeStream nextPut:#retSelf
+ "not a return - add retSelf"
+ "
+ if the last statement was a send for side-effect,
+ replace the previous drop by a retSelf
+ "
+ (lastStatement notNil
+ and:[(code := codeStream contents) notNil
+ and:[code size > 0
+ and:[code last == #drop]]]) ifTrue:[
+ codeStream position:(codeStream position - 1).
+ ].
+ codeStream nextPut:#retSelf
].
^ codeStream contents
+
+ "Modified: 10.8.1996 / 00:21:00 / stefan"
!
hasLineNumber:sel
@@ -2331,6 +2331,6 @@
!ByteCodeCompiler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.88 1996-08-05 16:57:35 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ByteCodeCompiler.st,v 1.89 1996-08-09 23:18:17 stefan Exp $'
! !
ByteCodeCompiler initialize!