8135085: Change Method::_intrinsic_id from u1 to u2
authorminqi
Fri, 18 Sep 2015 13:41:11 -0700
changeset 32820 ec181adbf3b1
parent 32819 a815f78586d2
child 32821 ef088e4410ea
8135085: Change Method::_intrinsic_id from u1 to u2 Summary: Convert Method::_intrinsic_id from u1 to u2 to expand id range over 255. Reviewed-by: coleenp, iklam, jiangli Contributed-by: aleksey.shipilev@oracle.com
hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp
hotspot/src/cpu/aarch64/vm/methodHandles_aarch64.cpp
hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp
hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp
hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp
hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp
hotspot/src/cpu/x86/vm/interp_masm_x86.cpp
hotspot/src/cpu/x86/vm/methodHandles_x86.cpp
hotspot/src/share/vm/oops/method.hpp
hotspot/src/share/vm/runtime/vmStructs.cpp
--- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -1608,6 +1608,8 @@
     test_method_data_pointer(mdp, profile_continue);
 
     if (MethodData::profile_return_jsr292_only()) {
+      assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
+
       // If we don't profile all invoke bytecodes we must make sure
       // it's a bytecode we indeed profile. We can't go back to the
       // begining of the ProfileData we intend to update to check its
@@ -1620,7 +1622,7 @@
       cmp(rscratch1, Bytecodes::_invokehandle);
       br(Assembler::EQ, do_profile);
       get_method(tmp);
-      ldrb(rscratch1, Address(tmp, Method::intrinsic_id_offset_in_bytes()));
+      ldrh(rscratch1, Address(tmp, Method::intrinsic_id_offset_in_bytes()));
       cmp(rscratch1, vmIntrinsics::_compiledLambdaForm);
       br(Assembler::NE, profile_continue);
 
--- a/hotspot/src/cpu/aarch64/vm/methodHandles_aarch64.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/cpu/aarch64/vm/methodHandles_aarch64.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -188,9 +188,11 @@
   address entry_point = __ pc();
 
   if (VerifyMethodHandles) {
+    assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
+
     Label L;
     BLOCK_COMMENT("verify_intrinsic_id {");
-    __ ldrb(rscratch1, Address(rmethod, Method::intrinsic_id_offset_in_bytes()));
+    __ ldrh(rscratch1, Address(rmethod, Method::intrinsic_id_offset_in_bytes()));
     __ cmp(rscratch1, (int) iid);
     __ br(Assembler::EQ, L);
     if (iid == vmIntrinsics::_linkToVirtual ||
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -1817,13 +1817,15 @@
     test_method_data_pointer(profile_continue);
 
     if (MethodData::profile_return_jsr292_only()) {
+      assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
+
       // If we don't profile all invoke bytecodes we must make sure
       // it's a bytecode we indeed profile. We can't go back to the
       // begining of the ProfileData we intend to update to check its
       // type because we're right after it and we don't known its
       // length.
       lbz(tmp1, 0, R14_bcp);
-      lbz(tmp2, Method::intrinsic_id_offset_in_bytes(), R19_method);
+      lhz(tmp2, Method::intrinsic_id_offset_in_bytes(), R19_method);
       cmpwi(CCR0, tmp1, Bytecodes::_invokedynamic);
       cmpwi(CCR1, tmp1, Bytecodes::_invokehandle);
       cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
--- a/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -224,11 +224,12 @@
   address entry_point = __ pc();
 
   if (VerifyMethodHandles) {
+    assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
+
     Label L;
     BLOCK_COMMENT("verify_intrinsic_id {");
     __ load_sized_value(temp1, Method::intrinsic_id_offset_in_bytes(), R19_method,
-                        sizeof(u1), /*is_signed*/ false);
-    // assert(sizeof(u1) == sizeof(Method::_intrinsic_id), "");
+                        sizeof(u2), /*is_signed*/ false);
     __ cmpwi(CCR1, temp1, (int) iid);
     __ beq(CCR1, L);
     if (iid == vmIntrinsics::_linkToVirtual ||
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2021,6 +2021,8 @@
     test_method_data_pointer(profile_continue);
 
     if (MethodData::profile_return_jsr292_only()) {
+      assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
+
       // If we don't profile all invoke bytecodes we must make sure
       // it's a bytecode we indeed profile. We can't go back to the
       // begining of the ProfileData we intend to update to check its
@@ -2031,7 +2033,7 @@
       cmp_and_br_short(tmp1, Bytecodes::_invokedynamic, equal, pn, do_profile);
       cmp(tmp1, Bytecodes::_invokehandle);
       br(equal, false, pn, do_profile);
-      delayed()->ldub(Lmethod, Method::intrinsic_id_offset_in_bytes(), tmp1);
+      delayed()->lduh(Lmethod, Method::intrinsic_id_offset_in_bytes(), tmp1);
       cmp_and_br_short(tmp1, vmIntrinsics::_compiledLambdaForm, notEqual, pt, profile_continue);
 
       bind(do_profile);
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -229,9 +229,11 @@
   address entry_point = __ pc();
 
   if (VerifyMethodHandles) {
+    assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
+
     Label L;
     BLOCK_COMMENT("verify_intrinsic_id {");
-    __ ldub(Address(G5_method, Method::intrinsic_id_offset_in_bytes()), O1_scratch);
+    __ lduh(Address(G5_method, Method::intrinsic_id_offset_in_bytes()), O1_scratch);
     __ cmp_and_br_short(O1_scratch, (int) iid, Assembler::equal, Assembler::pt, L);
     if (iid == vmIntrinsics::_linkToVirtual ||
         iid == vmIntrinsics::_linkToSpecial) {
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -169,6 +169,8 @@
     test_method_data_pointer(mdp, profile_continue);
 
     if (MethodData::profile_return_jsr292_only()) {
+      assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
+
       // If we don't profile all invoke bytecodes we must make sure
       // it's a bytecode we indeed profile. We can't go back to the
       // begining of the ProfileData we intend to update to check its
@@ -180,7 +182,7 @@
       cmpb(Address(_bcp_register, 0), Bytecodes::_invokehandle);
       jcc(Assembler::equal, do_profile);
       get_method(tmp);
-      cmpb(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
+      cmpw(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
       jcc(Assembler::notEqual, profile_continue);
 
       bind(do_profile);
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -222,9 +222,11 @@
   address entry_point = __ pc();
 
   if (VerifyMethodHandles) {
+    assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
+
     Label L;
     BLOCK_COMMENT("verify_intrinsic_id {");
-    __ cmpb(Address(rbx_method, Method::intrinsic_id_offset_in_bytes()), (int) iid);
+    __ cmpw(Address(rbx_method, Method::intrinsic_id_offset_in_bytes()), (int) iid);
     __ jcc(Assembler::equal, L);
     if (iid == vmIntrinsics::_linkToVirtual ||
         iid == vmIntrinsics::_linkToSpecial) {
--- a/hotspot/src/share/vm/oops/method.hpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/share/vm/oops/method.hpp	Fri Sep 18 13:41:11 2015 -0700
@@ -72,7 +72,7 @@
   int               _result_index;               // C++ interpreter needs for converting results to/from stack
 #endif
   u2                _method_size;                // size of this object
-  u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
+  u2                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
 
   // Flags
   enum Flags {
@@ -653,7 +653,7 @@
   // for code generation
   static int method_data_offset_in_bytes()       { return offset_of(Method, _method_data); }
   static int intrinsic_id_offset_in_bytes()      { return offset_of(Method, _intrinsic_id); }
-  static int intrinsic_id_size_in_bytes()        { return sizeof(u1); }
+  static int intrinsic_id_size_in_bytes()        { return sizeof(u2); }
 
   // Static methods that are used to implement member methods where an exposed this pointer
   // is needed due to possible GCs
@@ -777,7 +777,7 @@
 
   // Support for inlining of intrinsic methods
   vmIntrinsics::ID intrinsic_id() const          { return (vmIntrinsics::ID) _intrinsic_id;           }
-  void     set_intrinsic_id(vmIntrinsics::ID id) {                           _intrinsic_id = (u1) id; }
+  void     set_intrinsic_id(vmIntrinsics::ID id) {                           _intrinsic_id = (u2) id; }
 
   // Helper routines for intrinsic_id() and vmIntrinsics::method().
   void init_intrinsic_id();     // updates from _none if a match
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Sep 18 07:01:23 2015 -0400
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Sep 18 13:41:11 2015 -0700
@@ -383,7 +383,7 @@
   nonstatic_field(Method,                      _access_flags,                                 AccessFlags)                           \
   nonstatic_field(Method,                      _vtable_index,                                 int)                                   \
   nonstatic_field(Method,                      _method_size,                                  u2)                                    \
-  nonstatic_field(Method,                      _intrinsic_id,                                 u1)                                    \
+  nonstatic_field(Method,                      _intrinsic_id,                                 u2)                                    \
   nonproduct_nonstatic_field(Method,           _compiled_invocation_count,                    int)                                   \
   volatile_nonstatic_field(Method,             _code,                                         nmethod*)                              \
   nonstatic_field(Method,                      _i2i_entry,                                    address)                               \