comparison src/share/vm/opto/runtime.cpp @ 14422:2b8e28fdf503

Merge
author kvn
date Tue, 05 Nov 2013 17:38:04 -0800
parents cfd05ec74089 469216acdb28
children abec000618bf
comparison
equal deleted inserted replaced
14421:3068270ba476 14422:2b8e28fdf503
139 } 139 }
140 #endif // ASSERT 140 #endif // ASSERT
141 141
142 142
143 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \ 143 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \
144 var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc) 144 var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc); \
145 145 if (var == NULL) { return false; }
146 void OptoRuntime::generate(ciEnv* env) { 146
147 bool OptoRuntime::generate(ciEnv* env) {
147 148
148 generate_exception_blob(); 149 generate_exception_blob();
149 150
150 // Note: tls: Means fetching the return oop out of the thread-local storage 151 // Note: tls: Means fetching the return oop out of the thread-local storage
151 // 152 //
159 gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false); 160 gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false);
160 gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true , false, false); 161 gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true , false, false);
161 gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false); 162 gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false);
162 gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false); 163 gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false);
163 gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false); 164 gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false);
164 gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C , 0 , false, false, false); 165 gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C, 0, false, false, false);
165 gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true ); 166 gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true );
166 167
167 gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false, false); 168 gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false, false);
168 gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false, false); 169 gen(env, _register_finalizer_Java , register_finalizer_Type , register_finalizer , 0 , false, false, false);
169 170
170 # ifdef ENABLE_ZAP_DEAD_LOCALS 171 # ifdef ENABLE_ZAP_DEAD_LOCALS
171 gen(env, _zap_dead_Java_locals_Java , zap_dead_locals_Type , zap_dead_Java_locals_C , 0 , false, true , false ); 172 gen(env, _zap_dead_Java_locals_Java , zap_dead_locals_Type , zap_dead_Java_locals_C , 0 , false, true , false );
172 gen(env, _zap_dead_native_locals_Java , zap_dead_locals_Type , zap_dead_native_locals_C , 0 , false, true , false ); 173 gen(env, _zap_dead_native_locals_Java , zap_dead_locals_Type , zap_dead_native_locals_C , 0 , false, true , false );
173 # endif 174 # endif
174 175 return true;
175 } 176 }
176 177
177 #undef gen 178 #undef gen
178 179
179 180
986 // the runtime stubs checks this on exit. 987 // the runtime stubs checks this on exit.
987 assert(thread->exception_oop() != NULL, "exception oop is found"); 988 assert(thread->exception_oop() != NULL, "exception oop is found");
988 address handler_address = NULL; 989 address handler_address = NULL;
989 990
990 Handle exception(thread, thread->exception_oop()); 991 Handle exception(thread, thread->exception_oop());
992 address pc = thread->exception_pc();
993
994 // Clear out the exception oop and pc since looking up an
995 // exception handler can cause class loading, which might throw an
996 // exception and those fields are expected to be clear during
997 // normal bytecode execution.
998 thread->clear_exception_oop_and_pc();
991 999
992 if (TraceExceptions) { 1000 if (TraceExceptions) {
993 trace_exception(exception(), thread->exception_pc(), ""); 1001 trace_exception(exception(), pc, "");
994 } 1002 }
1003
995 // for AbortVMOnException flag 1004 // for AbortVMOnException flag
996 NOT_PRODUCT(Exceptions::debug_check_abort(exception)); 1005 NOT_PRODUCT(Exceptions::debug_check_abort(exception));
997 1006
998 #ifdef ASSERT 1007 #ifdef ASSERT
999 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { 1008 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
1000 // should throw an exception here 1009 // should throw an exception here
1001 ShouldNotReachHere(); 1010 ShouldNotReachHere();
1002 } 1011 }
1003 #endif 1012 #endif
1004
1005 1013
1006 // new exception handling: this method is entered only from adapters 1014 // new exception handling: this method is entered only from adapters
1007 // exceptions from compiled java methods are handled in compiled code 1015 // exceptions from compiled java methods are handled in compiled code
1008 // using rethrow node 1016 // using rethrow node
1009 1017
1010 address pc = thread->exception_pc();
1011 nm = CodeCache::find_nmethod(pc); 1018 nm = CodeCache::find_nmethod(pc);
1012 assert(nm != NULL, "No NMethod found"); 1019 assert(nm != NULL, "No NMethod found");
1013 if (nm->is_native_method()) { 1020 if (nm->is_native_method()) {
1014 fatal("Native method should not have path to exception handling"); 1021 fatal("Native method should not have path to exception handling");
1015 } else { 1022 } else {
1356 tty->print("%d [Exception (%s): ", trace_exception_counter, msg); 1363 tty->print("%d [Exception (%s): ", trace_exception_counter, msg);
1357 exception_oop->print_value(); 1364 exception_oop->print_value();
1358 tty->print(" in "); 1365 tty->print(" in ");
1359 CodeBlob* blob = CodeCache::find_blob(exception_pc); 1366 CodeBlob* blob = CodeCache::find_blob(exception_pc);
1360 if (blob->is_nmethod()) { 1367 if (blob->is_nmethod()) {
1361 ((nmethod*)blob)->method()->print_value(); 1368 nmethod* nm = blob->as_nmethod_or_null();
1369 nm->method()->print_value();
1362 } else if (blob->is_runtime_stub()) { 1370 } else if (blob->is_runtime_stub()) {
1363 tty->print("<runtime-stub>"); 1371 tty->print("<runtime-stub>");
1364 } else { 1372 } else {
1365 tty->print("<unknown>"); 1373 tty->print("<unknown>");
1366 } 1374 }