src/share/vm/classfile/verifier.cpp

changeset 7666
6b65121b3258
parent 7643
695017a614d5
child 7994
04ff2f6cd0eb
child 8525
0095e54dcaa1
     1.1 --- a/src/share/vm/classfile/verifier.cpp	Thu Mar 19 15:25:54 2015 +0100
     1.2 +++ b/src/share/vm/classfile/verifier.cpp	Wed Mar 25 08:16:48 2015 -0400
     1.3 @@ -655,6 +655,7 @@
     1.4  
     1.5  
     1.6      bool this_uninit = false;  // Set to true when invokespecial <init> initialized 'this'
     1.7 +    bool verified_exc_handlers = false;
     1.8  
     1.9      // Merge with the next instruction
    1.10      {
    1.11 @@ -686,6 +687,18 @@
    1.12          }
    1.13        }
    1.14  
    1.15 +      // Look for possible jump target in exception handlers and see if it
    1.16 +      // matches current_frame.  Do this check here for astore*, dstore*,
    1.17 +      // fstore*, istore*, and lstore* opcodes because they can change the type
    1.18 +      // state by adding a local.  JVM Spec says that the incoming type state
    1.19 +      // should be used for this check.  So, do the check here before a possible
    1.20 +      // local is added to the type state.
    1.21 +      if (Bytecodes::is_store_into_local(opcode) && bci >= ex_min && bci < ex_max) {
    1.22 +        verify_exception_handler_targets(
    1.23 +          bci, this_uninit, &current_frame, &stackmap_table, CHECK_VERIFY(this));
    1.24 +        verified_exc_handlers = true;
    1.25 +      }
    1.26 +
    1.27        switch (opcode) {
    1.28          case Bytecodes::_nop :
    1.29            no_control_flow = false; break;
    1.30 @@ -1662,9 +1675,13 @@
    1.31        }  // end switch
    1.32      }  // end Merge with the next instruction
    1.33  
    1.34 -    // Look for possible jump target in exception handlers and see if it
    1.35 -    // matches current_frame
    1.36 -    if (bci >= ex_min && bci < ex_max) {
    1.37 +    // Look for possible jump target in exception handlers and see if it matches
    1.38 +    // current_frame.  Don't do this check if it has already been done (for
    1.39 +    // ([a,d,f,i,l]store* opcodes).  This check cannot be done earlier because
    1.40 +    // opcodes, such as invokespecial, may set the this_uninit flag.
    1.41 +    assert(!(verified_exc_handlers && this_uninit),
    1.42 +      "Exception handler targets got verified before this_uninit got set");
    1.43 +    if (!verified_exc_handlers && bci >= ex_min && bci < ex_max) {
    1.44        verify_exception_handler_targets(
    1.45          bci, this_uninit, &current_frame, &stackmap_table, CHECK_VERIFY(this));
    1.46      }

mercurial