< prev index next >

src/share/vm/interpreter/interpreterRuntime.cpp

Print this page




 191 
 192   // We must create an array of jints to pass to multi_allocate.
 193   ResourceMark rm(thread);
 194   const int small_dims = 10;
 195   jint dim_array[small_dims];
 196   jint *dims = &dim_array[0];
 197   if (nof_dims > small_dims) {
 198     dims = (jint*) NEW_RESOURCE_ARRAY(jint, nof_dims);
 199   }
 200   for (int index = 0; index < nof_dims; index++) {
 201     // offset from first_size_address is addressed as local[index]
 202     int n = Interpreter::local_offset_in_bytes(index)/jintSize;
 203     dims[index] = first_size_address[n];
 204   }
 205   oop obj = ArrayKlass::cast(klass)->multi_allocate(nof_dims, dims, CHECK);
 206   thread->set_vm_result(obj);
 207 IRT_END
 208 
 209 
 210 IRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
 211   assert(obj->is_oop(), "must be a valid oop");
 212   assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
 213   InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
 214 IRT_END
 215 
 216 
 217 // Quicken instance-of and check-cast bytecodes
 218 IRT_ENTRY(void, InterpreterRuntime::quicken_io_cc(JavaThread* thread))
 219   // Force resolving; quicken the bytecode
 220   int which = get_index_u2(thread, Bytecodes::_checkcast);
 221   ConstantPool* cpool = method(thread)->constants();
 222   // We'd expect to assert that we're only here to quicken bytecodes, but in a multithreaded
 223   // program we might have seen an unquick'd bytecode in the interpreter but have another
 224   // thread quicken the bytecode before we get here.
 225   // assert( cpool->tag_at(which).is_unresolved_klass(), "should only come here to quicken bytecodes" );
 226   Klass* klass = cpool->klass_at(which, CHECK);
 227   thread->set_vm_result_2(klass);
 228 IRT_END
 229 
 230 
 231 //------------------------------------------------------------------------------------------------------------------------


 418   // is set, we don't want to trigger any classloading which may make calls
 419   // into java, or surprisingly find a matching exception handler for bci 0
 420   // since at this moment the method hasn't been "officially" entered yet.
 421   if (thread->do_not_unlock_if_synchronized()) {
 422     ResourceMark rm;
 423     assert(current_bci == 0,  "bci isn't zero for do_not_unlock_if_synchronized");
 424     thread->set_vm_result(exception);
 425 #ifdef CC_INTERP
 426     return (address) -1;
 427 #else
 428     return Interpreter::remove_activation_entry();
 429 #endif
 430   }
 431 
 432   do {
 433     should_repeat = false;
 434 
 435     // assertions
 436 #ifdef ASSERT
 437     assert(h_exception.not_null(), "NULL exceptions should be handled by athrow");
 438     assert(h_exception->is_oop(), "just checking");
 439     // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
 440     if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
 441       if (ExitVMOnVerifyError) vm_exit(-1);
 442       ShouldNotReachHere();
 443     }
 444 #endif
 445 
 446     // tracing
 447     if (log_is_enabled(Info, exceptions)) {
 448       ResourceMark rm(thread);
 449       stringStream tempst;
 450       tempst.print("interpreter method <%s>\n"
 451                    " at bci %d for thread " INTPTR_FORMAT,
 452                    h_method->print_value_string(), current_bci, p2i(thread));
 453       Exceptions::log_exception(h_exception, tempst);
 454     }
 455 // Don't go paging in something which won't be used.
 456 //     else if (extable->length() == 0) {
 457 //       // disabled for now - interpreter is not using shortcut yet
 458 //       // (shortcut is not to call runtime if we have no exception handlers)




 191 
 192   // We must create an array of jints to pass to multi_allocate.
 193   ResourceMark rm(thread);
 194   const int small_dims = 10;
 195   jint dim_array[small_dims];
 196   jint *dims = &dim_array[0];
 197   if (nof_dims > small_dims) {
 198     dims = (jint*) NEW_RESOURCE_ARRAY(jint, nof_dims);
 199   }
 200   for (int index = 0; index < nof_dims; index++) {
 201     // offset from first_size_address is addressed as local[index]
 202     int n = Interpreter::local_offset_in_bytes(index)/jintSize;
 203     dims[index] = first_size_address[n];
 204   }
 205   oop obj = ArrayKlass::cast(klass)->multi_allocate(nof_dims, dims, CHECK);
 206   thread->set_vm_result(obj);
 207 IRT_END
 208 
 209 
 210 IRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
 211   assert(oopDesc::is_oop(obj), "must be a valid oop");
 212   assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
 213   InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
 214 IRT_END
 215 
 216 
 217 // Quicken instance-of and check-cast bytecodes
 218 IRT_ENTRY(void, InterpreterRuntime::quicken_io_cc(JavaThread* thread))
 219   // Force resolving; quicken the bytecode
 220   int which = get_index_u2(thread, Bytecodes::_checkcast);
 221   ConstantPool* cpool = method(thread)->constants();
 222   // We'd expect to assert that we're only here to quicken bytecodes, but in a multithreaded
 223   // program we might have seen an unquick'd bytecode in the interpreter but have another
 224   // thread quicken the bytecode before we get here.
 225   // assert( cpool->tag_at(which).is_unresolved_klass(), "should only come here to quicken bytecodes" );
 226   Klass* klass = cpool->klass_at(which, CHECK);
 227   thread->set_vm_result_2(klass);
 228 IRT_END
 229 
 230 
 231 //------------------------------------------------------------------------------------------------------------------------


 418   // is set, we don't want to trigger any classloading which may make calls
 419   // into java, or surprisingly find a matching exception handler for bci 0
 420   // since at this moment the method hasn't been "officially" entered yet.
 421   if (thread->do_not_unlock_if_synchronized()) {
 422     ResourceMark rm;
 423     assert(current_bci == 0,  "bci isn't zero for do_not_unlock_if_synchronized");
 424     thread->set_vm_result(exception);
 425 #ifdef CC_INTERP
 426     return (address) -1;
 427 #else
 428     return Interpreter::remove_activation_entry();
 429 #endif
 430   }
 431 
 432   do {
 433     should_repeat = false;
 434 
 435     // assertions
 436 #ifdef ASSERT
 437     assert(h_exception.not_null(), "NULL exceptions should be handled by athrow");

 438     // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
 439     if (!(h_exception->is_a(SystemDictionary::Throwable_klass()))) {
 440       if (ExitVMOnVerifyError) vm_exit(-1);
 441       ShouldNotReachHere();
 442     }
 443 #endif
 444 
 445     // tracing
 446     if (log_is_enabled(Info, exceptions)) {
 447       ResourceMark rm(thread);
 448       stringStream tempst;
 449       tempst.print("interpreter method <%s>\n"
 450                    " at bci %d for thread " INTPTR_FORMAT,
 451                    h_method->print_value_string(), current_bci, p2i(thread));
 452       Exceptions::log_exception(h_exception, tempst);
 453     }
 454 // Don't go paging in something which won't be used.
 455 //     else if (extable->length() == 0) {
 456 //       // disabled for now - interpreter is not using shortcut yet
 457 //       // (shortcut is not to call runtime if we have no exception handlers)


< prev index next >