Generates the instructions to box the top stack value. This value is replaced by its boxed equivalent on top of the stack. @param type the type of the top stack value.
(final Type type)
| 826 | * @param type the type of the top stack value. |
| 827 | */ |
| 828 | public void box(final Type type) { |
| 829 | if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) { |
| 830 | return; |
| 831 | } |
| 832 | if (type == Type.VOID_TYPE) { |
| 833 | push((String) null); |
| 834 | } else { |
| 835 | Type boxedType = getBoxedType(type); |
| 836 | newInstance(boxedType); |
| 837 | if (type.getSize() == 2) { |
| 838 | // Pp -> Ppo -> oPpo -> ooPpo -> ooPp -> o |
| 839 | dupX2(); |
| 840 | dupX2(); |
| 841 | pop(); |
| 842 | } else { |
| 843 | // p -> po -> opo -> oop -> o |
| 844 | dupX1(); |
| 845 | swap(); |
| 846 | } |
| 847 | invokeConstructor(boxedType, new Method("<init>", Type.VOID_TYPE, new Type[] {type})); |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | /** |
| 852 | * Generates the instructions to box the top stack value using Java 5's valueOf() method. This |
no test coverage detected