7196681: NPG: Some JSR 292 tests crash in Windows exception handler
authorcoleenp
Tue, 11 Sep 2012 20:20:38 -0400
changeset 13743 154102966e74
parent 13742 9180987e305d
child 13746 29cbbe538b73
7196681: NPG: Some JSR 292 tests crash in Windows exception handler Summary: There was a rogue os::breakpoint() call in log_dependency left over from the jsr292 merge. Also changed verify_oop() calls for metadata to verify_{method,klass}_ptr. Reviewed-by: kvn, twisti
hotspot/src/cpu/sparc/vm/assembler_sparc.hpp
hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp
hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
hotspot/src/cpu/x86/vm/assembler_x86.hpp
hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp
hotspot/src/cpu/x86/vm/methodHandles_x86.cpp
hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
hotspot/src/share/vm/code/dependencies.cpp
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Tue Sep 11 20:20:38 2012 -0400
@@ -2375,8 +2375,14 @@
   void _verify_oop(Register reg, const char * msg, const char * file, int line);
   void _verify_oop_addr(Address addr, const char * msg, const char * file, int line);
 
+  // TODO: verify_method and klass metadata (compare against vptr?)
+  void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
+  void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line){}
+
 #define verify_oop(reg) _verify_oop(reg, "broken oop " #reg, __FILE__, __LINE__)
 #define verify_oop_addr(addr) _verify_oop_addr(addr, "broken oop addr ", __FILE__, __LINE__)
+#define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
+#define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
 
         // only if +VerifyOops
   void verify_FPU(int stack_depth, const char* s = "illegal FPU state");
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Tue Sep 11 20:20:38 2012 -0400
@@ -346,7 +346,7 @@
         // load receiver klass itself
         __ null_check(receiver_reg, oopDesc::klass_offset_in_bytes());
         __ load_klass(receiver_reg, temp1_recv_klass);
-        __ verify_oop(temp1_recv_klass);
+        __ verify_klass_ptr(temp1_recv_klass);
       }
       BLOCK_COMMENT("check_receiver {");
       // The receiver for the MemberName must be in receiver_reg.
@@ -354,14 +354,14 @@
       if (VerifyMethodHandles && iid == vmIntrinsics::_linkToSpecial) {
         // Did not load it above...
         __ load_klass(receiver_reg, temp1_recv_klass);
-        __ verify_oop(temp1_recv_klass);
+        __ verify_klass_ptr(temp1_recv_klass);
       }
       if (VerifyMethodHandles && iid != vmIntrinsics::_linkToInterface) {
         Label L_ok;
         Register temp2_defc = temp2;
         __ load_heap_oop(member_clazz, temp2_defc);
         load_klass_from_Class(_masm, temp2_defc, temp3, temp4);
-        __ verify_oop(temp2_defc);
+        __ verify_klass_ptr(temp2_defc);
         __ check_klass_subtype(temp1_recv_klass, temp2_defc, temp3, temp4, L_ok);
         // If we get here, the type check failed!
         __ STOP("receiver class disagrees with MemberName.clazz");
@@ -438,7 +438,7 @@
       Register temp3_intf = temp3;
       __ load_heap_oop(member_clazz, temp3_intf);
       load_klass_from_Class(_masm, temp3_intf, temp2, temp4);
-      __ verify_oop(temp3_intf);
+      __ verify_klass_ptr(temp3_intf);
 
       Register G5_index = G5_method;
       __ ld_ptr(member_vmindex, G5_index);
@@ -458,7 +458,7 @@
                                  temp2, no_sethi_temp,
                                  L_no_such_interface);
 
-      __ verify_oop(G5_method);
+      __ verify_method_ptr(G5_method);
       jump_from_method_handle(_masm, G5_method, temp2, temp3, for_compiler_entry);
 
       __ bind(L_no_such_interface);
@@ -479,7 +479,7 @@
       // After figuring out which concrete method to call, jump into it.
       // Note that this works in the interpreter with no data motion.
       // But the compiled version will require that rcx_recv be shifted out.
-      __ verify_oop(G5_method);
+      __ verify_method_ptr(G5_method);
       jump_from_method_handle(_masm, G5_method, temp1, temp3, for_compiler_entry);
     }
   }
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Tue Sep 11 20:20:38 2012 -0400
@@ -3018,7 +3018,7 @@
   // get receiver klass
   __ null_check(O0_recv, oopDesc::klass_offset_in_bytes());
   __ load_klass(O0_recv, O0_recv);
-  __ verify_oop(O0_recv);
+  __ verify_klass_ptr(O0_recv);
 
   __ profile_virtual_call(O0_recv, O4);
 
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Tue Sep 11 20:20:38 2012 -0400
@@ -2274,9 +2274,17 @@
   // Debugging
 
   // only if +VerifyOops
+  // TODO: Make these macros with file and line like sparc version!
   void verify_oop(Register reg, const char* s = "broken oop");
   void verify_oop_addr(Address addr, const char * s = "broken oop addr");
 
+  // TODO: verify method and klass metadata (compare against vptr?)
+  void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
+  void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line){}
+
+#define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
+#define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
+
   // only if +VerifyFPU
   void verify_FPU(int stack_depth, const char* s = "illegal FPU state");
 
--- a/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/cpu/x86/vm/cppInterpreter_x86.cpp	Tue Sep 11 20:20:38 2012 -0400
@@ -1110,7 +1110,7 @@
 
   // allocate space for parameters
   __ movptr(method, STATE(_method));
-  __ verify_oop(method);
+  __ verify_method_ptr(method);
   __ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset()));
   __ shll(t, 2);
 #ifdef _LP64
@@ -1134,7 +1134,7 @@
     __ movptr(method, STATE(_method));
     __ cmpptr(Address(thread, Thread::pending_exception_offset()), (int32_t)NULL_WORD);
     __ jcc(Assembler::notEqual, pending_exception_present);
-    __ verify_oop(method);
+    __ verify_method_ptr(method);
     __ movptr(t, Address(method, Method::signature_handler_offset()));
     __ bind(L);
   }
@@ -1162,7 +1162,7 @@
   __ movptr(from_ptr, STATE(_locals));  // get the from pointer
   __ call(t);
   __ movptr(method, STATE(_method));
-  __ verify_oop(method);
+  __ verify_method_ptr(method);
 
   // result handler is in rax
   // set result handler
@@ -1176,7 +1176,7 @@
     __ jcc(Assembler::notZero, L);
     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::prepare_native_call), method);
     __ movptr(method, STATE(_method));
-    __ verify_oop(method);
+    __ verify_method_ptr(method);
     __ movptr(rax, Address(method, Method::native_function_offset()));
     __ bind(L);
   }
@@ -1351,7 +1351,7 @@
     __ increment(rsp, wordSize);
 
     __ movptr(method, STATE(_method));
-    __ verify_oop(method);
+    __ verify_method_ptr(method);
     __ movptr(thread, STATE(_thread));                       // get thread
 
     __ bind(Continue);
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Tue Sep 11 20:20:38 2012 -0400
@@ -118,7 +118,7 @@
 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp,
                                             bool for_compiler_entry) {
   assert(method == rbx, "interpreter calling convention");
-  __ verify_oop(method);
+  __ verify_method_ptr(method);
 
   if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
     Label run_compiled_code;
@@ -358,7 +358,7 @@
         // load receiver klass itself
         __ null_check(receiver_reg, oopDesc::klass_offset_in_bytes());
         __ load_klass(temp1_recv_klass, receiver_reg);
-        __ verify_oop(temp1_recv_klass);
+        __ verify_klass_ptr(temp1_recv_klass);
       }
       BLOCK_COMMENT("check_receiver {");
       // The receiver for the MemberName must be in receiver_reg.
@@ -366,14 +366,14 @@
       if (VerifyMethodHandles && iid == vmIntrinsics::_linkToSpecial) {
         // Did not load it above...
         __ load_klass(temp1_recv_klass, receiver_reg);
-        __ verify_oop(temp1_recv_klass);
+        __ verify_klass_ptr(temp1_recv_klass);
       }
       if (VerifyMethodHandles && iid != vmIntrinsics::_linkToInterface) {
         Label L_ok;
         Register temp2_defc = temp2;
         __ load_heap_oop(temp2_defc, member_clazz);
         load_klass_from_Class(_masm, temp2_defc);
-        __ verify_oop(temp2_defc);
+        __ verify_klass_ptr(temp2_defc);
         __ check_klass_subtype(temp1_recv_klass, temp2_defc, temp3, L_ok);
         // If we get here, the type check failed!
         __ STOP("receiver class disagrees with MemberName.clazz");
@@ -451,7 +451,7 @@
       Register temp3_intf = temp3;
       __ load_heap_oop(temp3_intf, member_clazz);
       load_klass_from_Class(_masm, temp3_intf);
-      __ verify_oop(temp3_intf);
+      __ verify_klass_ptr(temp3_intf);
 
       Register rbx_index = rbx_method;
       __ movptr(rbx_index, member_vmindex);
@@ -471,7 +471,7 @@
                                  temp2,
                                  L_no_such_interface);
 
-      __ verify_oop(rbx_method);
+      __ verify_method_ptr(rbx_method);
       jump_from_method_handle(_masm, rbx_method, temp2, for_compiler_entry);
       __ hlt();
 
@@ -491,7 +491,7 @@
       // After figuring out which concrete method to call, jump into it.
       // Note that this works in the interpreter with no data motion.
       // But the compiled version will require that rcx_recv be shifted out.
-      __ verify_oop(rbx_method);
+      __ verify_method_ptr(rbx_method);
       jump_from_method_handle(_masm, rbx_method, temp1, for_compiler_entry);
     }
   }
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Tue Sep 11 20:20:38 2012 -0400
@@ -3107,7 +3107,7 @@
   prepare_invoke(byte_no,
                  rbx_method, rax_mtype,  // get f2 Method*, f1 MethodType
                  rcx_recv);
-  __ verify_oop(rbx_method);
+  __ verify_method_ptr(rbx_method);
   __ verify_oop(rcx_recv);
   __ null_check(rcx_recv);
 
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Tue Sep 11 20:20:38 2012 -0400
@@ -3158,7 +3158,7 @@
   prepare_invoke(byte_no,
                  rbx_method, rax_mtype,  // get f2 Method*, f1 MethodType
                  rcx_recv);
-  __ verify_oop(rbx_method);
+  __ verify_method_ptr(rbx_method);
   __ verify_oop(rcx_recv);
   __ null_check(rcx_recv);
 
--- a/hotspot/src/share/vm/code/dependencies.cpp	Tue Sep 11 16:20:57 2012 +0200
+++ b/hotspot/src/share/vm/code/dependencies.cpp	Tue Sep 11 20:20:38 2012 -0400
@@ -567,9 +567,6 @@
 
 void Dependencies::DepStream::log_dependency(Klass* witness) {
   if (_deps == NULL && xtty == NULL)  return;  // fast cutout for runtime
-  if (type() == call_site_target_value) {
-    os::breakpoint();
-  }
   int nargs = argument_count();
   DepArgument args[max_arg_count];
   for (int j = 0; j < nargs; j++) {