< prev index next >

src/hotspot/share/interpreter/rewriter.cpp

Print this page
*** 169,11 ***
  
  // Rewrite a classfile-order CP index into a native-order CPC index.
  void Rewriter::rewrite_member_reference(address bcp, int offset, bool reverse) {
    address p = bcp + offset;
    if (!reverse) {
!     int  cp_index    = Bytes::get_Java_u2(p);
      int  cache_index = cp_entry_to_cp_cache(cp_index);
      Bytes::put_native_u2(p, cache_index);
      if (!_method_handle_invokers.is_empty())
        maybe_rewrite_invokehandle(p - 1, cp_index, cache_index, reverse);
    } else {
--- 169,11 ---
  
  // Rewrite a classfile-order CP index into a native-order CPC index.
  void Rewriter::rewrite_member_reference(address bcp, int offset, bool reverse) {
    address p = bcp + offset;
    if (!reverse) {
!     int cp_index    = Bytes::get_Java_u2(p);
      int  cache_index = cp_entry_to_cp_cache(cp_index);
      Bytes::put_native_u2(p, cache_index);
      if (!_method_handle_invokers.is_empty())
        maybe_rewrite_invokehandle(p - 1, cp_index, cache_index, reverse);
    } else {

*** 205,11 ***
    } else {
      rewrite_member_reference(bcp, offset, reverse);
    }
  }
  
- 
  // Adjust the invocation bytecode for a signature-polymorphic method (MethodHandle.invoke, etc.)
  void Rewriter::maybe_rewrite_invokehandle(address opc, int cp_index, int cache_index, bool reverse) {
    if (!reverse) {
      if ((*opc) == (u1)Bytecodes::_invokevirtual ||
          // allow invokespecial as an alias, although it would be very odd:
--- 205,10 ---

*** 450,15 ***
  
              fieldDescriptor fd;
              if (klass->find_field(field_name, field_sig, &fd) != NULL) {
                if (fd.access_flags().is_final()) {
                  if (fd.access_flags().is_static()) {
!                   if (!method->is_static_initializer()) {
                      fd.set_has_initialized_final_update(true);
                    }
                  } else {
!                   if (!method->is_object_initializer()) {
                      fd.set_has_initialized_final_update(true);
                    }
                  }
                }
              }
--- 449,15 ---
  
              fieldDescriptor fd;
              if (klass->find_field(field_name, field_sig, &fd) != NULL) {
                if (fd.access_flags().is_final()) {
                  if (fd.access_flags().is_static()) {
!                   if (!method->is_class_initializer()) {
                      fd.set_has_initialized_final_update(true);
                    }
                  } else {
!                   if (!method->is_object_constructor()) {
                      fd.set_has_initialized_final_update(true);
                    }
                  }
                }
              }

*** 466,10 ***
--- 465,11 ---
          }
        }
        // fall through
        case Bytecodes::_getstatic      : // fall through
        case Bytecodes::_getfield       : // fall through
+       case Bytecodes::_withfield     : // fall through but may require more checks for correctness
        case Bytecodes::_invokevirtual  : // fall through
        case Bytecodes::_invokestatic   :
        case Bytecodes::_invokeinterface:
        case Bytecodes::_invokehandle   : // if reverse=true
          rewrite_member_reference(bcp, prefix_length+1, reverse);
< prev index next >