# HG changeset patch # User Claus Gittinger # Date 821018042 -3600 # Node ID 05a99f1bd747456e6e982ba36d8cbd02b98e794a # Parent 21ef5ceda83866fdaaacbba4affa8262924a67bd *** empty log message *** diff -r 21ef5ceda838 -r 05a99f1bd747 MessageNd.st --- a/MessageNd.st Sat Jan 06 16:01:10 1996 +0100 +++ b/MessageNd.st Sun Jan 07 13:34:02 1996 +0100 @@ -501,15 +501,15 @@ self halt:'not yet implemented'. theReceiver := receiver. (selector == #and:) ifTrue:[ - theByteCode := #falseJump + theByteCode := #falseJump ] ifFalse:[ - theByteCode := #trueJump + theByteCode := #trueJump ]. " (self canOptimizeConditionFor:receiver) ifTrue:[ - theByteCode := self optimizedConditionFor:theReceiver - with:theByteCode. - theReceiver := theReceiver receiver + theByteCode := self optimizedConditionFor:theReceiver + with:theByteCode. + theReceiver := theReceiver receiver ]. " theReceiver codeOn:aStream inBlock:b for:aCompiler. @@ -619,67 +619,67 @@ " (theReceiver isMessage) ifTrue:[ - subsel := theReceiver selector. - (subsel == #and:) ifTrue:[ - self codeAndIfElseOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. - ^ self - ]. - (subsel == #or:) ifTrue:[ - self codeOrIfElseOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. - ^ self - ] + subsel := theReceiver selector. + (subsel == #and:) ifTrue:[ + self codeAndIfElseOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. + ^ self + ]. + (subsel == #or:) ifTrue:[ + self codeOrIfElseOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. + ^ self + ] ]. " (selector == #ifTrue:ifFalse:) ifTrue:[ - theByteCode := #falseJump + theByteCode := #falseJump ] ifFalse:[ - (selector == #ifFalse:ifTrue:) ifTrue:[ - theByteCode := #trueJump - ] + (selector == #ifFalse:ifTrue:) ifTrue:[ + theByteCode := #trueJump + ] ]. optByteCode := self optimizedConditionFor:theReceiver - with:theByteCode. + with:theByteCode. optByteCode notNil ifTrue:[ - ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[ - theArg := theReceiver arg1 - ]. - theReceiver := theReceiver receiver. - theByteCode := optByteCode + ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[ + theArg := theReceiver arg1 + ]. + theReceiver := theReceiver receiver. + theByteCode := optByteCode ]. theByteCode notNil ifTrue:[ - theReceiver codeOn:aStream inBlock:b for:aCompiler. + theReceiver codeOn:aStream inBlock:b for:aCompiler. - needLineNr := true. - theArg isNil ifTrue:[ - theReceiver isMessage ifTrue:[ - (self class hasLineNumber:(theReceiver selector)) ifTrue:[ - theReceiver lineNumber == lineNr ifTrue:[ - needLineNr := false - ] - ] - ] - ]. - theArg notNil ifTrue:[ - theArg codeOn:aStream inBlock:b for:aCompiler - ]. + needLineNr := true. + theArg isNil ifTrue:[ + theReceiver isMessage ifTrue:[ + (self class hasLineNumber:(theReceiver selector)) ifTrue:[ + theReceiver lineNumber == lineNr ifTrue:[ + needLineNr := false + ] + ] + ] + ]. + theArg notNil ifTrue:[ + theArg codeOn:aStream inBlock:b for:aCompiler + ]. - needLineNr ifTrue:[ - (lineNr between:1 and:255) ifTrue:[ - aStream nextPut:#lineno; nextPut:lineNr. - ] - ]. + needLineNr ifTrue:[ + (lineNr between:1 and:255) ifTrue:[ + aStream nextPut:#lineno; nextPut:lineNr. + ] + ]. - aStream nextPut:theByteCode. - pos := aStream position. - aStream nextPut:0. - (argArray at:1) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. - aStream nextPut:#jump. - pos2 := aStream position. - aStream nextPut:0. - code := aStream contents. - code at:pos put:(aStream position). - (argArray at:2) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. - code at:pos2 put:(aStream position) + aStream nextPut:theByteCode. + pos := aStream position. + aStream nextPut:0. + (argArray at:1) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. + aStream nextPut:#jump. + pos2 := aStream position. + aStream nextPut:0. + code := aStream contents. + code at:pos put:(aStream position). + (argArray at:2) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. + code at:pos2 put:(aStream position) ] "Modified: 13.12.1995 / 18:51:39 / cg" @@ -1227,19 +1227,19 @@ |pos pos2 theReceiver theArg theByteCode optByteCode needLineNr blockExpr| (selector == #whileTrue:) ifTrue:[ - theByteCode := #falseJump + theByteCode := #falseJump ] ifFalse:[ - theByteCode := #trueJump + theByteCode := #trueJump ]. theReceiver := receiver. optByteCode := self optimizedConditionFor:theReceiver with:theByteCode. optByteCode notNil ifTrue:[ - ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[ - theArg := receiver statements expression arg1 - ]. - theReceiver := receiver statements expression receiver. - theByteCode := optByteCode + ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[ + theArg := receiver statements expression arg1 + ]. + theReceiver := receiver statements expression receiver. + theByteCode := optByteCode ]. "/ OLD: @@ -1249,18 +1249,18 @@ pos := aStream position. optByteCode notNil ifTrue:[ - theReceiver codeOn:aStream inBlock:b for:aCompiler. - theArg notNil ifTrue:[ - theArg codeOn:aStream inBlock:b for:aCompiler - ] + theReceiver codeOn:aStream inBlock:b for:aCompiler. + theArg notNil ifTrue:[ + theArg codeOn:aStream inBlock:b for:aCompiler + ] ] ifFalse:[ - theReceiver codeInlineOn:aStream inBlock:b for:aCompiler. + theReceiver codeInlineOn:aStream inBlock:b for:aCompiler. - "/ - "/ cannot enable code below - "/ (tiny loops would not be debuggable with next, since lineNo remains the same) - "/ think about it ... - "/ + "/ + "/ cannot enable code below + "/ (tiny loops would not be debuggable with next, since lineNo remains the same) + "/ think about it ... + "/ "/ blockExpr := theReceiver simpleSendBlockReceiver. "/ blockExpr notNil ifTrue:[ "/ blockExpr isMessage ifTrue:[ @@ -1274,9 +1274,9 @@ ]. needLineNr ifTrue:[ - (lineNr between:1 and:255) ifTrue:[ - aStream nextPut:#lineno; nextPut:lineNr. - ] + (lineNr between:1 and:255) ifTrue:[ + aStream nextPut:#lineno; nextPut:lineNr. + ] ]. aStream nextPut:theByteCode. @@ -1298,12 +1298,14 @@ ! optimizedConditionFor:aReceiver with:aByteCode - |rec sel| + |rec sel stats| rec := aReceiver. (rec isBlock) ifTrue:[ - rec statements nextStatement isNil ifTrue:[ - rec := rec statements expression + (stats := rec statements) notNil ifTrue:[ + stats nextStatement isNil ifTrue:[ + rec := rec statements expression + ] ] ]. (rec isUnaryMessage) ifTrue:[ @@ -1562,5 +1564,5 @@ !MessageNode class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libcomp/Attic/MessageNd.st,v 1.36 1995-12-13 19:04:48 cg Exp $' + ^ '$Header: /cvs/stx/stx/libcomp/Attic/MessageNd.st,v 1.37 1996-01-07 12:34:02 cg Exp $' ! ! diff -r 21ef5ceda838 -r 05a99f1bd747 MessageNode.st --- a/MessageNode.st Sat Jan 06 16:01:10 1996 +0100 +++ b/MessageNode.st Sun Jan 07 13:34:02 1996 +0100 @@ -501,15 +501,15 @@ self halt:'not yet implemented'. theReceiver := receiver. (selector == #and:) ifTrue:[ - theByteCode := #falseJump + theByteCode := #falseJump ] ifFalse:[ - theByteCode := #trueJump + theByteCode := #trueJump ]. " (self canOptimizeConditionFor:receiver) ifTrue:[ - theByteCode := self optimizedConditionFor:theReceiver - with:theByteCode. - theReceiver := theReceiver receiver + theByteCode := self optimizedConditionFor:theReceiver + with:theByteCode. + theReceiver := theReceiver receiver ]. " theReceiver codeOn:aStream inBlock:b for:aCompiler. @@ -619,67 +619,67 @@ " (theReceiver isMessage) ifTrue:[ - subsel := theReceiver selector. - (subsel == #and:) ifTrue:[ - self codeAndIfElseOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. - ^ self - ]. - (subsel == #or:) ifTrue:[ - self codeOrIfElseOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. - ^ self - ] + subsel := theReceiver selector. + (subsel == #and:) ifTrue:[ + self codeAndIfElseOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. + ^ self + ]. + (subsel == #or:) ifTrue:[ + self codeOrIfElseOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. + ^ self + ] ]. " (selector == #ifTrue:ifFalse:) ifTrue:[ - theByteCode := #falseJump + theByteCode := #falseJump ] ifFalse:[ - (selector == #ifFalse:ifTrue:) ifTrue:[ - theByteCode := #trueJump - ] + (selector == #ifFalse:ifTrue:) ifTrue:[ + theByteCode := #trueJump + ] ]. optByteCode := self optimizedConditionFor:theReceiver - with:theByteCode. + with:theByteCode. optByteCode notNil ifTrue:[ - ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[ - theArg := theReceiver arg1 - ]. - theReceiver := theReceiver receiver. - theByteCode := optByteCode + ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[ + theArg := theReceiver arg1 + ]. + theReceiver := theReceiver receiver. + theByteCode := optByteCode ]. theByteCode notNil ifTrue:[ - theReceiver codeOn:aStream inBlock:b for:aCompiler. + theReceiver codeOn:aStream inBlock:b for:aCompiler. - needLineNr := true. - theArg isNil ifTrue:[ - theReceiver isMessage ifTrue:[ - (self class hasLineNumber:(theReceiver selector)) ifTrue:[ - theReceiver lineNumber == lineNr ifTrue:[ - needLineNr := false - ] - ] - ] - ]. - theArg notNil ifTrue:[ - theArg codeOn:aStream inBlock:b for:aCompiler - ]. + needLineNr := true. + theArg isNil ifTrue:[ + theReceiver isMessage ifTrue:[ + (self class hasLineNumber:(theReceiver selector)) ifTrue:[ + theReceiver lineNumber == lineNr ifTrue:[ + needLineNr := false + ] + ] + ] + ]. + theArg notNil ifTrue:[ + theArg codeOn:aStream inBlock:b for:aCompiler + ]. - needLineNr ifTrue:[ - (lineNr between:1 and:255) ifTrue:[ - aStream nextPut:#lineno; nextPut:lineNr. - ] - ]. + needLineNr ifTrue:[ + (lineNr between:1 and:255) ifTrue:[ + aStream nextPut:#lineno; nextPut:lineNr. + ] + ]. - aStream nextPut:theByteCode. - pos := aStream position. - aStream nextPut:0. - (argArray at:1) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. - aStream nextPut:#jump. - pos2 := aStream position. - aStream nextPut:0. - code := aStream contents. - code at:pos put:(aStream position). - (argArray at:2) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. - code at:pos2 put:(aStream position) + aStream nextPut:theByteCode. + pos := aStream position. + aStream nextPut:0. + (argArray at:1) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. + aStream nextPut:#jump. + pos2 := aStream position. + aStream nextPut:0. + code := aStream contents. + code at:pos put:(aStream position). + (argArray at:2) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler. + code at:pos2 put:(aStream position) ] "Modified: 13.12.1995 / 18:51:39 / cg" @@ -1227,19 +1227,19 @@ |pos pos2 theReceiver theArg theByteCode optByteCode needLineNr blockExpr| (selector == #whileTrue:) ifTrue:[ - theByteCode := #falseJump + theByteCode := #falseJump ] ifFalse:[ - theByteCode := #trueJump + theByteCode := #trueJump ]. theReceiver := receiver. optByteCode := self optimizedConditionFor:theReceiver with:theByteCode. optByteCode notNil ifTrue:[ - ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[ - theArg := receiver statements expression arg1 - ]. - theReceiver := receiver statements expression receiver. - theByteCode := optByteCode + ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[ + theArg := receiver statements expression arg1 + ]. + theReceiver := receiver statements expression receiver. + theByteCode := optByteCode ]. "/ OLD: @@ -1249,18 +1249,18 @@ pos := aStream position. optByteCode notNil ifTrue:[ - theReceiver codeOn:aStream inBlock:b for:aCompiler. - theArg notNil ifTrue:[ - theArg codeOn:aStream inBlock:b for:aCompiler - ] + theReceiver codeOn:aStream inBlock:b for:aCompiler. + theArg notNil ifTrue:[ + theArg codeOn:aStream inBlock:b for:aCompiler + ] ] ifFalse:[ - theReceiver codeInlineOn:aStream inBlock:b for:aCompiler. + theReceiver codeInlineOn:aStream inBlock:b for:aCompiler. - "/ - "/ cannot enable code below - "/ (tiny loops would not be debuggable with next, since lineNo remains the same) - "/ think about it ... - "/ + "/ + "/ cannot enable code below + "/ (tiny loops would not be debuggable with next, since lineNo remains the same) + "/ think about it ... + "/ "/ blockExpr := theReceiver simpleSendBlockReceiver. "/ blockExpr notNil ifTrue:[ "/ blockExpr isMessage ifTrue:[ @@ -1274,9 +1274,9 @@ ]. needLineNr ifTrue:[ - (lineNr between:1 and:255) ifTrue:[ - aStream nextPut:#lineno; nextPut:lineNr. - ] + (lineNr between:1 and:255) ifTrue:[ + aStream nextPut:#lineno; nextPut:lineNr. + ] ]. aStream nextPut:theByteCode. @@ -1298,12 +1298,14 @@ ! optimizedConditionFor:aReceiver with:aByteCode - |rec sel| + |rec sel stats| rec := aReceiver. (rec isBlock) ifTrue:[ - rec statements nextStatement isNil ifTrue:[ - rec := rec statements expression + (stats := rec statements) notNil ifTrue:[ + stats nextStatement isNil ifTrue:[ + rec := rec statements expression + ] ] ]. (rec isUnaryMessage) ifTrue:[ @@ -1562,5 +1564,5 @@ !MessageNode class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.36 1995-12-13 19:04:48 cg Exp $' + ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.37 1996-01-07 12:34:02 cg Exp $' ! !