src/share/vm/opto/graphKit.cpp

changeset 6733
00c8a1255912
parent 6518
62c54fcc0a35
child 6876
710a3c8b516e
child 7026
922c87c9aed4
     1.1 --- a/src/share/vm/opto/graphKit.cpp	Fri Jun 13 15:04:38 2014 -0700
     1.2 +++ b/src/share/vm/opto/graphKit.cpp	Tue Jun 17 09:02:30 2014 +0000
     1.3 @@ -2458,7 +2458,7 @@
     1.4  
     1.5  //------------------------------make_slow_call_ex------------------------------
     1.6  // Make the exception handler hookups for the slow call
     1.7 -void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj) {
     1.8 +void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool separate_io_proj, bool deoptimize) {
     1.9    if (stopped())  return;
    1.10  
    1.11    // Make a catch node with just two handlers:  fall-through and catch-all
    1.12 @@ -2472,11 +2472,17 @@
    1.13      set_i_o(i_o);
    1.14  
    1.15      if (excp != top()) {
    1.16 -      // Create an exception state also.
    1.17 -      // Use an exact type if the caller has specified a specific exception.
    1.18 -      const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull);
    1.19 -      Node*       ex_oop  = new (C) CreateExNode(ex_type, control(), i_o);
    1.20 -      add_exception_state(make_exception_state(_gvn.transform(ex_oop)));
    1.21 +      if (deoptimize) {
    1.22 +        // Deoptimize if an exception is caught. Don't construct exception state in this case.
    1.23 +        uncommon_trap(Deoptimization::Reason_unhandled,
    1.24 +                      Deoptimization::Action_none);
    1.25 +      } else {
    1.26 +        // Create an exception state also.
    1.27 +        // Use an exact type if the caller has specified a specific exception.
    1.28 +        const Type* ex_type = TypeOopPtr::make_from_klass_unique(ex_klass)->cast_to_ptr_type(TypePtr::NotNull);
    1.29 +        Node*       ex_oop  = new (C) CreateExNode(ex_type, control(), i_o);
    1.30 +        add_exception_state(make_exception_state(_gvn.transform(ex_oop)));
    1.31 +      }
    1.32      }
    1.33    }
    1.34  
    1.35 @@ -3290,7 +3296,8 @@
    1.36  
    1.37  //---------------------------set_output_for_allocation-------------------------
    1.38  Node* GraphKit::set_output_for_allocation(AllocateNode* alloc,
    1.39 -                                          const TypeOopPtr* oop_type) {
    1.40 +                                          const TypeOopPtr* oop_type,
    1.41 +                                          bool deoptimize_on_exception) {
    1.42    int rawidx = Compile::AliasIdxRaw;
    1.43    alloc->set_req( TypeFunc::FramePtr, frameptr() );
    1.44    add_safepoint_edges(alloc);
    1.45 @@ -3298,7 +3305,7 @@
    1.46    set_control( _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Control) ) );
    1.47    // create memory projection for i_o
    1.48    set_memory ( _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Memory, true) ), rawidx );
    1.49 -  make_slow_call_ex(allocx, env()->Throwable_klass(), true);
    1.50 +  make_slow_call_ex(allocx, env()->Throwable_klass(), true, deoptimize_on_exception);
    1.51  
    1.52    // create a memory projection as for the normal control path
    1.53    Node* malloc = _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Memory));
    1.54 @@ -3376,9 +3383,11 @@
    1.55  // The optional arguments are for specialized use by intrinsics:
    1.56  //  - If 'extra_slow_test' if not null is an extra condition for the slow-path.
    1.57  //  - If 'return_size_val', report the the total object size to the caller.
    1.58 +//  - deoptimize_on_exception controls how Java exceptions are handled (rethrow vs deoptimize)
    1.59  Node* GraphKit::new_instance(Node* klass_node,
    1.60                               Node* extra_slow_test,
    1.61 -                             Node* *return_size_val) {
    1.62 +                             Node* *return_size_val,
    1.63 +                             bool deoptimize_on_exception) {
    1.64    // Compute size in doublewords
    1.65    // The size is always an integral number of doublewords, represented
    1.66    // as a positive bytewise size stored in the klass's layout_helper.
    1.67 @@ -3447,7 +3456,7 @@
    1.68                             size, klass_node,
    1.69                             initial_slow_test);
    1.70  
    1.71 -  return set_output_for_allocation(alloc, oop_type);
    1.72 +  return set_output_for_allocation(alloc, oop_type, deoptimize_on_exception);
    1.73  }
    1.74  
    1.75  //-------------------------------new_array-------------------------------------
    1.76 @@ -3457,7 +3466,8 @@
    1.77  Node* GraphKit::new_array(Node* klass_node,     // array klass (maybe variable)
    1.78                            Node* length,         // number of array elements
    1.79                            int   nargs,          // number of arguments to push back for uncommon trap
    1.80 -                          Node* *return_size_val) {
    1.81 +                          Node* *return_size_val,
    1.82 +                          bool deoptimize_on_exception) {
    1.83    jint  layout_con = Klass::_lh_neutral_value;
    1.84    Node* layout_val = get_layout_helper(klass_node, layout_con);
    1.85    int   layout_is_con = (layout_val == NULL);
    1.86 @@ -3600,7 +3610,7 @@
    1.87      ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
    1.88    }
    1.89  
    1.90 -  Node* javaoop = set_output_for_allocation(alloc, ary_type);
    1.91 +  Node* javaoop = set_output_for_allocation(alloc, ary_type, deoptimize_on_exception);
    1.92  
    1.93    // Cast length on remaining path to be as narrow as possible
    1.94    if (map()->find_edge(length) >= 0) {

mercurial