gnu.expr

Class ConditionalTarget


public class ConditionalTarget
extends Target

This is the Target of a boolean expression, in a conditional context. If the expression evaluates to, transfer to the ifTrue label; if false, tranfer to the ifFalse label.

Field Summary

Label
ifFalse
Label
ifTrue
boolean
trueBranchComesFirst
True if the ifTrue label comes before the ifFalse label.

Fields inherited from class gnu.expr.Target

Ignore, pushObject

Constructor Summary

ConditionalTarget(Label ifTrue, Label ifFalse, Language language)

Method Summary

void
compileFromStack(Compilation comp, Type stackType)
void
emitGotoFirstBranch(CodeAttr code)
Goto whichever of IfTrue or ifFalse is specified by trueBranchComesFirst.
Type
getType()

Methods inherited from class gnu.expr.Target

compileFromStack, getType, pushValue

Field Details

ifFalse

public Label ifFalse

ifTrue

public Label ifTrue

trueBranchComesFirst

public boolean trueBranchComesFirst
True if the ifTrue label comes before the ifFalse label. This is used in the hope we can optimize away a branch followed by its target.

Constructor Details

ConditionalTarget

public ConditionalTarget(Label ifTrue,
                         Label ifFalse,
                         Language language)
Parameters:
ifTrue - label to jump to if this evaluates to true
ifFalse - label to jump to if true
language - specifies what values are true

Method Details

compileFromStack

public void compileFromStack(Compilation comp,
                             Type stackType)
Overrides:
compileFromStack in interface Target

emitGotoFirstBranch

public final void emitGotoFirstBranch(CodeAttr code)
Goto whichever of IfTrue or ifFalse is specified by trueBranchComesFirst. Normally, the goto should get optimized away as a no-op.

getType

public Type getType()
Overrides:
getType in interface Target