MessageNode.st
changeset 308 fe3b95e6d9c0
parent 289 7134d1233ba6
child 309 11b78163a914
equal deleted inserted replaced
307:2552fd5e8592 308:fe3b95e6d9c0
    15 	classVariableNames:''
    15 	classVariableNames:''
    16 	poolDictionaries:''
    16 	poolDictionaries:''
    17 	category:'System-Compiler-Support'
    17 	category:'System-Compiler-Support'
    18 !
    18 !
    19 
    19 
    20 !MessageNode class methodsFor:'documentation'!
    20 !MessageNode  class methodsFor:'documentation'!
    21 
    21 
    22 copyright
    22 copyright
    23 "
    23 "
    24  COPYRIGHT (c) 1989 by Claus Gittinger
    24  COPYRIGHT (c) 1989 by Claus Gittinger
    25 	      All Rights Reserved
    25 	      All Rights Reserved
    41     [author:]
    41     [author:]
    42         Claus Gittinger
    42         Claus Gittinger
    43 "
    43 "
    44 ! !
    44 ! !
    45 
    45 
    46 !MessageNode class methodsFor:'instance creation'!
    46 !MessageNode  class methodsFor:'instance creation'!
    47 
    47 
    48 receiver:recNode selector:selectorString 
    48 receiver:recNode selector:selectorString 
    49     ^ (self basicNew) receiver:recNode selector:selectorString args:nil lineno:0
    49     ^ (self basicNew) receiver:recNode selector:selectorString args:nil lineno:0
    50 !
    50 !
    51 
    51 
   604      needLineNr|
   604      needLineNr|
   605 
   605 
   606     theReceiver := receiver.
   606     theReceiver := receiver.
   607 
   607 
   608     (theReceiver isMessage) ifTrue:[
   608     (theReceiver isMessage) ifTrue:[
   609 	subsel := theReceiver selector.
   609         subsel := theReceiver selector.
   610 	(subsel == #and:) ifTrue:[
   610 
   611 	    self codeAndIfOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler.
   611         (subsel == #and:) ifTrue:[
   612 	    ^ self
   612             theReceiver arg1 isBlockNode ifTrue:[
   613 	].
   613                 self codeAndIfOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler.
   614 	(subsel == #or:) ifTrue:[
   614                 ^ self
   615 	    self codeOrIfOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler.
   615             ]
   616 	    ^ self
   616         ].
   617 	]
   617         (subsel == #or:) ifTrue:[
       
   618             theReceiver arg1 isBlockNode ifTrue:[
       
   619                 self codeOrIfOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler.
       
   620                 ^ self
       
   621             ]
       
   622         ]
   618     ].
   623     ].
   619     (selector == #ifTrue:) ifTrue:[
   624     (selector == #ifTrue:) ifTrue:[
   620 	theByteCode := #falseJump
   625         theByteCode := #falseJump
   621     ] ifFalse:[
   626     ] ifFalse:[
   622 	theByteCode := #trueJump
   627         theByteCode := #trueJump
   623     ].
   628     ].
   624     optByteCode := self optimizedConditionFor:theReceiver
   629     optByteCode := self optimizedConditionFor:theReceiver
   625 					 with:theByteCode.
   630                                          with:theByteCode.
   626     optByteCode notNil ifTrue:[
   631     optByteCode notNil ifTrue:[
   627 	((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[
   632         ((optByteCode == #eqJump) or:[optByteCode == #notEqJump]) ifTrue:[
   628 	    theArg := theReceiver arg1
   633             theArg := theReceiver arg1
   629 	].
   634         ].
   630 	theReceiver := theReceiver receiver.
   635         theReceiver := theReceiver receiver.
   631 	theByteCode := optByteCode
   636         theByteCode := optByteCode
   632     ].
   637     ].
   633 
   638 
   634     theReceiver codeOn:aStream inBlock:b for:aCompiler.
   639     theReceiver codeOn:aStream inBlock:b for:aCompiler.
   635     theArg notNil ifTrue:[
   640     theArg notNil ifTrue:[
   636 	theArg codeOn:aStream inBlock:b for:aCompiler
   641         theArg codeOn:aStream inBlock:b for:aCompiler
   637     ].
   642     ].
   638 
   643 
   639     needLineNr := true.
   644     needLineNr := true.
   640     theArg isNil ifTrue:[
   645     theArg isNil ifTrue:[
   641 	theReceiver isMessage ifTrue:[
   646         theReceiver isMessage ifTrue:[
   642 	    (aCompiler hasLineNumber:(theReceiver selector)) ifTrue:[
   647             (aCompiler hasLineNumber:(theReceiver selector)) ifTrue:[
   643 		theReceiver lineNumber == lineNr ifTrue:[
   648                 theReceiver lineNumber == lineNr ifTrue:[
   644 		    needLineNr := false
   649                     needLineNr := false
   645 		]
   650                 ]
   646 	    ]
   651             ]
   647 	]
   652         ]
   648     ].
   653     ].
   649 
   654 
   650     needLineNr ifTrue:[
   655     needLineNr ifTrue:[
   651 	(lineNr between:1 and:255) ifTrue:[
   656         (lineNr between:1 and:255) ifTrue:[
   652 	    aStream nextPut:#lineno; nextPut:lineNr.
   657             aStream nextPut:#lineno; nextPut:lineNr.
   653 	]
   658         ]
   654     ].
   659     ].
   655 
   660 
   656     aStream nextPut:theByteCode.
   661     aStream nextPut:theByteCode.
   657     pos := aStream position.
   662     pos := aStream position.
   658     aStream nextPut:0.
   663     aStream nextPut:0.
   659     (argArray at: 1) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler.
   664     (argArray at: 1) codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler.
   660 
   665 
   661     code := aStream contents.
   666     code := aStream contents.
   662     valueNeeded ifTrue:[
   667     valueNeeded ifTrue:[
   663 	aStream nextPut:#jump.
   668         aStream nextPut:#jump.
   664 	pos2 := aStream position.
   669         pos2 := aStream position.
   665 	aStream nextPut:0.
   670         aStream nextPut:0.
   666 	code at:pos put:(aStream position).
   671         code at:pos put:(aStream position).
   667 	aStream nextPut:#pushNil.
   672         aStream nextPut:#pushNil.
   668 	code at:pos2 put:(aStream position)
   673         code at:pos2 put:(aStream position)
   669     ] ifFalse:[
   674     ] ifFalse:[
   670 	code at:pos put:(aStream position)
   675         code at:pos put:(aStream position)
   671     ]
   676     ]
       
   677 
       
   678     "Modified: 18.7.1996 / 09:58:53 / cg"
   672 !
   679 !
   673 
   680 
   674 codeOn:aStream inBlock:b for:aCompiler
   681 codeOn:aStream inBlock:b for:aCompiler
   675     self codeOn:aStream inBlock:b valueNeeded:true for:aCompiler
   682     self codeOn:aStream inBlock:b valueNeeded:true for:aCompiler
   676 !
   683 !
  1552 
  1559 
  1553 isMessage
  1560 isMessage
  1554     ^ true
  1561     ^ true
  1555 ! !
  1562 ! !
  1556 
  1563 
  1557 !MessageNode class methodsFor:'documentation'!
  1564 !MessageNode  class methodsFor:'documentation'!
  1558 
  1565 
  1559 version
  1566 version
  1560     ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.48 1996-06-17 14:13:49 cg Exp $'
  1567     ^ '$Header: /cvs/stx/stx/libcomp/MessageNode.st,v 1.49 1996-07-18 08:01:16 cg Exp $'
  1561 ! !
  1568 ! !