From dfbd571af6f232ce084df0ad11472ee8a2373039 Mon Sep 17 00:00:00 2001 From: never Date: Mon, 24 Jan 2011 13:34:18 -0800 Subject: [PATCH] 7008809: should report the class in ArrayStoreExceptions from compiled code Reviewed-by: iveresov, twisti --- src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp | 23 +---------------------- src/cpu/sparc/vm/c1_Runtime1_sparc.cpp | 2 +- src/cpu/x86/vm/c1_CodeStubs_x86.cpp | 16 +--------------- src/cpu/x86/vm/c1_Runtime1_x86.cpp | 2 +- src/share/vm/c1/c1_CodeStubs.hpp | 12 +++--------- src/share/vm/c1/c1_LIR.cpp | 4 ++-- src/share/vm/c1/c1_Runtime1.cpp | 6 ++++-- src/share/vm/c1/c1_Runtime1.hpp | 6 +++--- 8 files changed, 16 insertions(+), 55 deletions(-) diff --git a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp index ee5f6afb5..049b75144 100644 --- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp +++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp @@ -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 @@ void SimpleExceptionStub::emit_code(LIR_Assembler* ce) { } -// 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) { diff --git a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp index d968c4e30..383ec2a7c 100644 --- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp +++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @@ -709,7 +709,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { 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; diff --git a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp index 62088bd10..745337535 100644 --- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp +++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp @@ -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 @@ void SimpleExceptionStub::emit_code(LIR_Assembler* ce) { } -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); diff --git a/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/src/cpu/x86/vm/c1_Runtime1_x86.cpp index 0a5680425..eede111be 100644 --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp @@ -1337,7 +1337,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { { 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; diff --git a/src/share/vm/c1/c1_CodeStubs.hpp b/src/share/vm/c1/c1_CodeStubs.hpp index 7579b0cfe..1367f080d 100644 --- a/src/share/vm/c1/c1_CodeStubs.hpp +++ b/src/share/vm/c1/c1_CodeStubs.hpp @@ -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 SimpleExceptionStub: public CodeStub { -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 diff --git a/src/share/vm/c1/c1_LIR.cpp b/src/share/vm/c1/c1_LIR.cpp index bce59a55d..f6e10ec6f 100644 --- a/src/share/vm/c1/c1_LIR.cpp +++ b/src/share/vm/c1/c1_LIR.cpp @@ -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 @@ LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array, L , _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(); diff --git a/src/share/vm/c1/c1_Runtime1.cpp b/src/share/vm/c1/c1_Runtime1.cpp index 205d49b52..f939f1d76 100644 --- a/src/share/vm/c1/c1_Runtime1.cpp +++ b/src/share/vm/c1/c1_Runtime1.cpp @@ -339,8 +339,10 @@ JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id)) 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 diff --git a/src/share/vm/c1/c1_Runtime1.hpp b/src/share/vm/c1/c1_Runtime1.hpp index c6ef0d516..84f839fbf 100644 --- a/src/share/vm/c1/c1_Runtime1.hpp +++ b/src/share/vm/c1/c1_Runtime1.hpp @@ -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 @@ class Runtime1: public AllStatic { 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); -- GitLab