726 return x; 727 } 728 729 /** 730 * Stores a given local variable at the specified index. If the value occupies two slots, then 731 * the next local variable index is also overwritten. 732 * 733 * @param i the index at which to store 734 * @param slotKind the kind of the local variable from the point of view of the bytecodes 735 * @param x the instruction which produces the value for the local 736 */ 737 public void storeLocal(int i, JavaKind slotKind, ValueNode x) { 738 assert verifyKind(slotKind, x); 739 740 if (locals[i] == TWO_SLOT_MARKER) { 741 /* Writing the second slot of a two-slot value invalidates the first slot. */ 742 locals[i - 1] = null; 743 } 744 locals[i] = x; 745 if (slotKind.needsTwoSlots()) { 746 /* Writing a two-slot value: mark the second slot. */ 747 locals[i + 1] = TWO_SLOT_MARKER; 748 } else if (i < locals.length - 1 && locals[i + 1] == TWO_SLOT_MARKER) { 749 /* 750 * Writing a one-slot value to an index previously occupied by a two-slot value: clear 751 * the old marker of the second slot. 752 */ 753 locals[i + 1] = null; 754 } 755 } 756 757 /** 758 * Pushes an instruction onto the stack with the expected type. 759 * 760 * @param slotKind the kind of the stack element from the point of view of the bytecodes 761 * @param x the instruction to push onto the stack 762 */ 763 public void push(JavaKind slotKind, ValueNode x) { 764 assert verifyKind(slotKind, x); 765 | 726 return x; 727 } 728 729 /** 730 * Stores a given local variable at the specified index. If the value occupies two slots, then 731 * the next local variable index is also overwritten. 732 * 733 * @param i the index at which to store 734 * @param slotKind the kind of the local variable from the point of view of the bytecodes 735 * @param x the instruction which produces the value for the local 736 */ 737 public void storeLocal(int i, JavaKind slotKind, ValueNode x) { 738 assert verifyKind(slotKind, x); 739 740 if (locals[i] == TWO_SLOT_MARKER) { 741 /* Writing the second slot of a two-slot value invalidates the first slot. */ 742 locals[i - 1] = null; 743 } 744 locals[i] = x; 745 if (slotKind.needsTwoSlots()) { 746 if (i < locals.length - 2 && locals[i + 2] == TWO_SLOT_MARKER) { 747 /* 748 * Writing a two-slot marker to an index previously occupied by a two-slot value: 749 * clear the old marker of the second slot. 750 */ 751 locals[i + 2] = null; 752 } 753 /* Writing a two-slot value: mark the second slot. */ 754 locals[i + 1] = TWO_SLOT_MARKER; 755 } else if (i < locals.length - 1 && locals[i + 1] == TWO_SLOT_MARKER) { 756 /* 757 * Writing a one-slot value to an index previously occupied by a two-slot value: clear 758 * the old marker of the second slot. 759 */ 760 locals[i + 1] = null; 761 } 762 } 763 764 /** 765 * Pushes an instruction onto the stack with the expected type. 766 * 767 * @param slotKind the kind of the stack element from the point of view of the bytecodes 768 * @param x the instruction to push onto the stack 769 */ 770 public void push(JavaKind slotKind, ValueNode x) { 771 assert verifyKind(slotKind, x); 772 |