Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.flow
Class CreateIfThenElseOperator

java.lang.Object
  extended bynet.sf.jode.flow.CreateIfThenElseOperator

public class CreateIfThenElseOperator
extends java.lang.Object


Constructor Summary
CreateIfThenElseOperator()
           
 
Method Summary
static boolean create(InstructionContainer ic, StructuredBlock last)
          This handles the normal form of the ?
static boolean createFunny(ConditionalBlock cb, StructuredBlock last)
          This handles the more complicated form of the ?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateIfThenElseOperator

public CreateIfThenElseOperator()
Method Detail

createFunny

public static boolean createFunny(ConditionalBlock cb,
                                  StructuredBlock last)
This handles the more complicated form of the ?-:-operator used in a conditional block. The simplest case is:
   if (cond)
       PUSH e1
   else {
       IF (c2)
           GOTO flow_2_
       PUSH false
   }
 ->IF (stack_0 == 0)
     GOTO flow_1_
   GOTO flow_2_
 
is transformed to
   push cond ? e1 : c2
 ->IF (stack_0 == 0)
     GOTO flow_1_
   GOTO flow_2_
 
The -> points to the lastModified block. Note that both the if and the then part may contain this condition+push0-block. There may be even stack if-then-else-blocks for very complicated nested ?-:-Operators.

Also note that the produced code is suboptimal: The push-0 could sometimes be better replaced with a correct jump.


create

public static boolean create(InstructionContainer ic,
                             StructuredBlock last)
This handles the normal form of the ?-:-operator:
   if (cond)
       push e1
       GOTO flow_1_
 ->push e2
   GOTO flow_2
 
is transformed to
 ->push cond ? e1 : e2
 
The -> points to the lastModified block.


Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.