Mon, 24 Jan 2011 13:34:18 -0800
7008809: should report the class in ArrayStoreExceptions from compiled code
Reviewed-by: iveresov, twisti
1.1 --- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp Fri Jan 21 13:03:13 2011 -0800 1.2 +++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp Mon Jan 24 13:34:18 2011 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -129,27 +129,6 @@ 1.11 } 1.12 1.13 1.14 -// Implementation of ArrayStoreExceptionStub 1.15 - 1.16 -ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info): 1.17 - _info(info) { 1.18 -} 1.19 - 1.20 - 1.21 -void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) { 1.22 - __ bind(_entry); 1.23 - __ call(Runtime1::entry_for(Runtime1::throw_array_store_exception_id), relocInfo::runtime_call_type); 1.24 - __ delayed()->nop(); 1.25 - ce->add_call_info_here(_info); 1.26 - ce->verify_oop_map(_info); 1.27 -#ifdef ASSERT 1.28 - __ should_not_reach_here(); 1.29 -#endif 1.30 -} 1.31 - 1.32 - 1.33 - 1.34 - 1.35 // Implementation of NewInstanceStub 1.36 1.37 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
2.1 --- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Fri Jan 21 13:03:13 2011 -0800 2.2 +++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Mon Jan 24 13:34:18 2011 -0800 2.3 @@ -709,7 +709,7 @@ 2.4 case throw_array_store_exception_id: 2.5 { 2.6 __ set_info("throw_array_store_exception", dont_gc_arguments); 2.7 - oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), false); 2.8 + oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true); 2.9 } 2.10 break; 2.11
3.1 --- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp Fri Jan 21 13:03:13 2011 -0800 3.2 +++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp Mon Jan 24 13:34:18 2011 -0800 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -411,20 +411,6 @@ 3.11 } 3.12 3.13 3.14 -ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info): 3.15 - _info(info) { 3.16 -} 3.17 - 3.18 - 3.19 -void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) { 3.20 - assert(__ rsp_offset() == 0, "frame size should be fixed"); 3.21 - __ bind(_entry); 3.22 - __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::throw_array_store_exception_id))); 3.23 - ce->add_call_info_here(_info); 3.24 - debug_only(__ should_not_reach_here()); 3.25 -} 3.26 - 3.27 - 3.28 void ArrayCopyStub::emit_code(LIR_Assembler* ce) { 3.29 //---------------slow case: call to native----------------- 3.30 __ bind(_entry);
4.1 --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp Fri Jan 21 13:03:13 2011 -0800 4.2 +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp Mon Jan 24 13:34:18 2011 -0800 4.3 @@ -1337,7 +1337,7 @@ 4.4 { StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments); 4.5 // tos + 0: link 4.6 // + 1: return address 4.7 - oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), false); 4.8 + oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true); 4.9 } 4.10 break; 4.11
5.1 --- a/src/share/vm/c1/c1_CodeStubs.hpp Fri Jan 21 13:03:13 2011 -0800 5.2 +++ b/src/share/vm/c1/c1_CodeStubs.hpp Mon Jan 24 13:34:18 2011 -0800 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -476,18 +476,12 @@ 5.11 5.12 5.13 5.14 -class ArrayStoreExceptionStub: public CodeStub { 5.15 +class ArrayStoreExceptionStub: public SimpleExceptionStub { 5.16 private: 5.17 CodeEmitInfo* _info; 5.18 5.19 public: 5.20 - ArrayStoreExceptionStub(CodeEmitInfo* info); 5.21 - virtual void emit_code(LIR_Assembler* emit); 5.22 - virtual CodeEmitInfo* info() const { return _info; } 5.23 - virtual bool is_exception_throw_stub() const { return true; } 5.24 - virtual void visit(LIR_OpVisitState* visitor) { 5.25 - visitor->do_slow_case(_info); 5.26 - } 5.27 + ArrayStoreExceptionStub(LIR_Opr obj, CodeEmitInfo* info): SimpleExceptionStub(Runtime1::throw_array_store_exception_id, obj, info) {} 5.28 #ifndef PRODUCT 5.29 virtual void print_name(outputStream* out) const { out->print("ArrayStoreExceptionStub"); } 5.30 #endif // PRODUCT
6.1 --- a/src/share/vm/c1/c1_LIR.cpp Fri Jan 21 13:03:13 2011 -0800 6.2 +++ b/src/share/vm/c1/c1_LIR.cpp Mon Jan 24 13:34:18 2011 -0800 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -396,7 +396,7 @@ 6.11 , _should_profile(false) 6.12 { 6.13 if (code == lir_store_check) { 6.14 - _stub = new ArrayStoreExceptionStub(info_for_exception); 6.15 + _stub = new ArrayStoreExceptionStub(object, info_for_exception); 6.16 assert(info_for_exception != NULL, "store_check throws exceptions"); 6.17 } else { 6.18 ShouldNotReachHere();
7.1 --- a/src/share/vm/c1/c1_Runtime1.cpp Fri Jan 21 13:03:13 2011 -0800 7.2 +++ b/src/share/vm/c1/c1_Runtime1.cpp Mon Jan 24 13:34:18 2011 -0800 7.3 @@ -339,8 +339,10 @@ 7.4 JRT_END 7.5 7.6 7.7 -JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread)) 7.8 - THROW(vmSymbolHandles::java_lang_ArrayStoreException()); 7.9 +JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj)) 7.10 + ResourceMark rm(thread); 7.11 + const char* klass_name = Klass::cast(obj->klass())->external_name(); 7.12 + SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name); 7.13 JRT_END 7.14 7.15
8.1 --- a/src/share/vm/c1/c1_Runtime1.hpp Fri Jan 21 13:03:13 2011 -0800 8.2 +++ b/src/share/vm/c1/c1_Runtime1.hpp Mon Jan 24 13:34:18 2011 -0800 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -143,9 +143,9 @@ 8.11 static void throw_index_exception(JavaThread* thread, int index); 8.12 static void throw_div0_exception(JavaThread* thread); 8.13 static void throw_null_pointer_exception(JavaThread* thread); 8.14 - static void throw_class_cast_exception(JavaThread* thread, oopDesc* obect); 8.15 + static void throw_class_cast_exception(JavaThread* thread, oopDesc* object); 8.16 static void throw_incompatible_class_change_error(JavaThread* thread); 8.17 - static void throw_array_store_exception(JavaThread* thread); 8.18 + static void throw_array_store_exception(JavaThread* thread, oopDesc* object); 8.19 8.20 static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock); 8.21 static void monitorexit (JavaThread* thread, BasicObjectLock* lock);