< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Items.java

Print this page




 157         return new MemberItem(member, nonvirtual);
 158     }
 159 
 160     /** Make an item representing a literal.
 161      *  @param type     The literal's type.
 162      *  @param value    The literal's value.
 163      */
 164     Item makeImmediateItem(Type type, Object value) {
 165         return new ImmediateItem(type, value);
 166     }
 167 
 168     /** Make an item representing an assignment expression.
 169      *  @param lhs      The item representing the assignment's left hand side.
 170      */
 171     Item makeAssignItem(Item lhs) {
 172         return new AssignItem(lhs);
 173     }
 174 
 175     /** Make an item representing a conditional or unconditional jump.
 176      *  @param opcode      The jump's opcode.
 177      *  @param trueJumps   A chain encomassing all jumps that can be taken
 178      *                     if the condition evaluates to true.
 179      *  @param falseJumps  A chain encomassing all jumps that can be taken
 180      *                     if the condition evaluates to false.
 181      */
 182     CondItem makeCondItem(int opcode, Chain trueJumps, Chain falseJumps) {
 183         return new CondItem(opcode, trueJumps, falseJumps);
 184     }
 185 
 186     /** Make an item representing a conditional or unconditional jump.
 187      *  @param opcode      The jump's opcode.
 188      */
 189     CondItem makeCondItem(int opcode) {
 190         return makeCondItem(opcode, null, null);
 191     }
 192 
 193     /** The base class of all items, which implements default behavior.
 194      */
 195     abstract class Item {
 196 
 197         /** The type code of values represented by this item.
 198          */
 199         int typecode;


 737             lhs.store();
 738         }
 739 
 740         void stash(int toscode) {
 741             Assert.error();
 742         }
 743 
 744         int width() {
 745             return lhs.width() + Code.width(typecode);
 746         }
 747 
 748         public String toString() {
 749             return "assign(lhs = " + lhs + ")";
 750         }
 751     }
 752 
 753     /** An item representing a conditional or unconditional jump.
 754      */
 755     class CondItem extends Item {
 756 
 757         /** A chain encomassing all jumps that can be taken
 758          *  if the condition evaluates to true.
 759          */
 760         Chain trueJumps;
 761 
 762         /** A chain encomassing all jumps that can be taken
 763          *  if the condition evaluates to false.
 764          */
 765         Chain falseJumps;
 766 
 767         /** The jump's opcode.
 768          */
 769         int opcode;
 770 
 771         /*
 772          *  An abstract syntax tree of this item. It is needed
 773          *  for branch entries in 'CharacterRangeTable' attribute.
 774          */
 775         JCTree tree;
 776 
 777         CondItem(int opcode, Chain truejumps, Chain falsejumps) {
 778             super(BYTEcode);
 779             this.opcode = opcode;
 780             this.trueJumps = truejumps;
 781             this.falseJumps = falsejumps;
 782         }




 157         return new MemberItem(member, nonvirtual);
 158     }
 159 
 160     /** Make an item representing a literal.
 161      *  @param type     The literal's type.
 162      *  @param value    The literal's value.
 163      */
 164     Item makeImmediateItem(Type type, Object value) {
 165         return new ImmediateItem(type, value);
 166     }
 167 
 168     /** Make an item representing an assignment expression.
 169      *  @param lhs      The item representing the assignment's left hand side.
 170      */
 171     Item makeAssignItem(Item lhs) {
 172         return new AssignItem(lhs);
 173     }
 174 
 175     /** Make an item representing a conditional or unconditional jump.
 176      *  @param opcode      The jump's opcode.
 177      *  @param trueJumps   A chain encompassing all jumps that can be taken
 178      *                     if the condition evaluates to true.
 179      *  @param falseJumps  A chain encompassing all jumps that can be taken
 180      *                     if the condition evaluates to false.
 181      */
 182     CondItem makeCondItem(int opcode, Chain trueJumps, Chain falseJumps) {
 183         return new CondItem(opcode, trueJumps, falseJumps);
 184     }
 185 
 186     /** Make an item representing a conditional or unconditional jump.
 187      *  @param opcode      The jump's opcode.
 188      */
 189     CondItem makeCondItem(int opcode) {
 190         return makeCondItem(opcode, null, null);
 191     }
 192 
 193     /** The base class of all items, which implements default behavior.
 194      */
 195     abstract class Item {
 196 
 197         /** The type code of values represented by this item.
 198          */
 199         int typecode;


 737             lhs.store();
 738         }
 739 
 740         void stash(int toscode) {
 741             Assert.error();
 742         }
 743 
 744         int width() {
 745             return lhs.width() + Code.width(typecode);
 746         }
 747 
 748         public String toString() {
 749             return "assign(lhs = " + lhs + ")";
 750         }
 751     }
 752 
 753     /** An item representing a conditional or unconditional jump.
 754      */
 755     class CondItem extends Item {
 756 
 757         /** A chain encompassing all jumps that can be taken
 758          *  if the condition evaluates to true.
 759          */
 760         Chain trueJumps;
 761 
 762         /** A chain encompassing all jumps that can be taken
 763          *  if the condition evaluates to false.
 764          */
 765         Chain falseJumps;
 766 
 767         /** The jump's opcode.
 768          */
 769         int opcode;
 770 
 771         /*
 772          *  An abstract syntax tree of this item. It is needed
 773          *  for branch entries in 'CharacterRangeTable' attribute.
 774          */
 775         JCTree tree;
 776 
 777         CondItem(int opcode, Chain truejumps, Chain falsejumps) {
 778             super(BYTEcode);
 779             this.opcode = opcode;
 780             this.trueJumps = truejumps;
 781             this.falseJumps = falsejumps;
 782         }


< prev index next >