public void box ( final Type type ) { if ( type . getSort ( ) == Type . OBJECT || type . getSort ( ) == Type . ARRAY ) { return ; } if ( type == Type . VOID_TYPE ) { push ( ( String ) null ) ; } else { Type boxed = getBoxedType ( type ) ; newInstance ( boxed ) ; if ( type . getSize ( ) == 2 ) { // Pp -> Ppo -> oPpo -> ooPpo -> ooPp -> o dupX2 ( ) ; dupX2 ( ) ; pop ( ) ; } else { // p -> po -> opo -> oop -> o dupX1 ( ) ; swap ( ) ; } invokeConstructor ( boxed , new Method ( "<init>" , Type . VOID_TYPE , new Type [ ] { type } ) ) ; } }
Generates the instructions to box the top stack value . This value is replaced by its boxed equivalent on top of the stack .