changeset 2181:e4fee0bdaa85

7008809: should report the class in ArrayStoreExceptions from compiled code Reviewed-by: iveresov, twisti
author never
date Mon, 24 Jan 2011 13:34:18 -0800
parents aa4b04b68652
children f966c66b5463
files src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp src/cpu/sparc/vm/c1_Runtime1_sparc.cpp src/cpu/x86/vm/c1_CodeStubs_x86.cpp src/cpu/x86/vm/c1_Runtime1_x86.cpp src/share/vm/c1/c1_CodeStubs.hpp src/share/vm/c1/c1_LIR.cpp src/share/vm/c1/c1_Runtime1.cpp src/share/vm/c1/c1_Runtime1.hpp
diffstat 8 files changed, 16 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Fri Jan 21 13:03:13 2011 -0800
+++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Mon Jan 24 13:34:18 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -129,27 +129,6 @@
 }
 
 
-// Implementation of ArrayStoreExceptionStub
-
-ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info):
-  _info(info) {
-}
-
-
-void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) {
-  __ bind(_entry);
-  __ call(Runtime1::entry_for(Runtime1::throw_array_store_exception_id), relocInfo::runtime_call_type);
-  __ delayed()->nop();
-  ce->add_call_info_here(_info);
-  ce->verify_oop_map(_info);
-#ifdef ASSERT
-  __ should_not_reach_here();
-#endif
-}
-
-
-
-
 // Implementation of NewInstanceStub
 
 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
--- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Fri Jan 21 13:03:13 2011 -0800
+++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Mon Jan 24 13:34:18 2011 -0800
@@ -709,7 +709,7 @@
     case throw_array_store_exception_id:
       {
         __ set_info("throw_array_store_exception", dont_gc_arguments);
-        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), false);
+        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
       }
       break;
 
--- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Fri Jan 21 13:03:13 2011 -0800
+++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Mon Jan 24 13:34:18 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -411,20 +411,6 @@
 }
 
 
-ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info):
-  _info(info) {
-}
-
-
-void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) {
-  assert(__ rsp_offset() == 0, "frame size should be fixed");
-  __ bind(_entry);
-  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::throw_array_store_exception_id)));
-  ce->add_call_info_here(_info);
-  debug_only(__ should_not_reach_here());
-}
-
-
 void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
   //---------------slow case: call to native-----------------
   __ bind(_entry);
--- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Fri Jan 21 13:03:13 2011 -0800
+++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Mon Jan 24 13:34:18 2011 -0800
@@ -1337,7 +1337,7 @@
       { StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments);
         // tos + 0: link
         //     + 1: return address
-        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), false);
+        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
       }
       break;
 
--- a/src/share/vm/c1/c1_CodeStubs.hpp	Fri Jan 21 13:03:13 2011 -0800
+++ b/src/share/vm/c1/c1_CodeStubs.hpp	Mon Jan 24 13:34:18 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -476,18 +476,12 @@
 
 
 
-class ArrayStoreExceptionStub: public CodeStub {
+class ArrayStoreExceptionStub: public SimpleExceptionStub {
  private:
   CodeEmitInfo* _info;
 
  public:
-  ArrayStoreExceptionStub(CodeEmitInfo* info);
-  virtual void emit_code(LIR_Assembler* emit);
-  virtual CodeEmitInfo* info() const             { return _info; }
-  virtual bool is_exception_throw_stub() const   { return true; }
-  virtual void visit(LIR_OpVisitState* visitor) {
-    visitor->do_slow_case(_info);
-  }
+  ArrayStoreExceptionStub(LIR_Opr obj, CodeEmitInfo* info): SimpleExceptionStub(Runtime1::throw_array_store_exception_id, obj, info) {}
 #ifndef PRODUCT
   virtual void print_name(outputStream* out) const { out->print("ArrayStoreExceptionStub"); }
 #endif // PRODUCT
--- a/src/share/vm/c1/c1_LIR.cpp	Fri Jan 21 13:03:13 2011 -0800
+++ b/src/share/vm/c1/c1_LIR.cpp	Mon Jan 24 13:34:18 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -396,7 +396,7 @@
   , _should_profile(false)
 {
   if (code == lir_store_check) {
-    _stub = new ArrayStoreExceptionStub(info_for_exception);
+    _stub = new ArrayStoreExceptionStub(object, info_for_exception);
     assert(info_for_exception != NULL, "store_check throws exceptions");
   } else {
     ShouldNotReachHere();
--- a/src/share/vm/c1/c1_Runtime1.cpp	Fri Jan 21 13:03:13 2011 -0800
+++ b/src/share/vm/c1/c1_Runtime1.cpp	Mon Jan 24 13:34:18 2011 -0800
@@ -339,8 +339,10 @@
 JRT_END
 
 
-JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread))
-  THROW(vmSymbolHandles::java_lang_ArrayStoreException());
+JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
+  ResourceMark rm(thread);
+  const char* klass_name = Klass::cast(obj->klass())->external_name();
+  SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
 JRT_END
 
 
--- a/src/share/vm/c1/c1_Runtime1.hpp	Fri Jan 21 13:03:13 2011 -0800
+++ b/src/share/vm/c1/c1_Runtime1.hpp	Mon Jan 24 13:34:18 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -143,9 +143,9 @@
   static void throw_index_exception(JavaThread* thread, int index);
   static void throw_div0_exception(JavaThread* thread);
   static void throw_null_pointer_exception(JavaThread* thread);
-  static void throw_class_cast_exception(JavaThread* thread, oopDesc* obect);
+  static void throw_class_cast_exception(JavaThread* thread, oopDesc* object);
   static void throw_incompatible_class_change_error(JavaThread* thread);
-  static void throw_array_store_exception(JavaThread* thread);
+  static void throw_array_store_exception(JavaThread* thread, oopDesc* object);
 
   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock);
   static void monitorexit (JavaThread* thread, BasicObjectLock* lock);