protected final void build_unitialized_NEW_map ( InstructionList il ) { uninitialized_NEW_map . clear ( ) ; il . setPositions ( ) ; for ( StackMapEntry smte : stack_map_table ) { int frame_type = smte . getFrameType ( ) ; if ( ( frame_type >= Const . SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Const . SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED ) || ( frame_type >= Const . APPEND_FRAME && frame_type <= Const . APPEND_FRAME_MAX ) || ( frame_type == Const . FULL_FRAME ) ) { if ( smte . getNumberOfLocals ( ) > 0 ) { for ( StackMapType smt : smte . getTypesOfLocals ( ) ) { if ( smt . getType ( ) == Const . ITEM_NewObject ) { int i = smt . getIndex ( ) ; uninitialized_NEW_map . put ( il . findHandle ( i ) , i ) ; } } } if ( smte . getNumberOfStackItems ( ) > 0 ) { for ( StackMapType smt : smte . getTypesOfStackItems ( ) ) { if ( smt . getType ( ) == Const . ITEM_NewObject ) { int i = smt . getIndex ( ) ; uninitialized_NEW_map . put ( il . findHandle ( i ) , i ) ; } } } } } }
We need to locate and remember any NEW instructions that create uninitialized objects . Their offset may be contained in a StackMap entry and will probably need to be updated as we add instrumentation code . Note that these instructions are fairly rare .