comparison src/share/vm/c1/c1_Runtime1.cpp @ 1339:09ac706c2623

Merge
author asaha
date Wed, 24 Mar 2010 17:16:33 -0700
parents 230fac611b50
children abc670a709dc c18cbe5936b8
comparison
equal deleted inserted replaced
1338:f5dd08ad65df 1339:09ac706c2623
1 /* 1 /*
2 * Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
108 if ( !caller_is_deopted()) { 108 if ( !caller_is_deopted()) {
109 JavaThread* thread = JavaThread::current(); 109 JavaThread* thread = JavaThread::current();
110 RegisterMap reg_map(thread, false); 110 RegisterMap reg_map(thread, false);
111 frame runtime_frame = thread->last_frame(); 111 frame runtime_frame = thread->last_frame();
112 frame caller_frame = runtime_frame.sender(&reg_map); 112 frame caller_frame = runtime_frame.sender(&reg_map);
113 VM_DeoptimizeFrame deopt(thread, caller_frame.id()); 113 // bypass VM_DeoptimizeFrame and deoptimize the frame directly
114 VMThread::execute(&deopt); 114 Deoptimization::deoptimize_frame(thread, caller_frame.id());
115 assert(caller_is_deopted(), "Must be deoptimized"); 115 assert(caller_is_deopted(), "Must be deoptimized");
116 } 116 }
117 } 117 }
118 118
119 119
352 THROW(vmSymbolHandles::java_lang_ArrayStoreException()); 352 THROW(vmSymbolHandles::java_lang_ArrayStoreException());
353 JRT_END 353 JRT_END
354 354
355 355
356 JRT_ENTRY(void, Runtime1::post_jvmti_exception_throw(JavaThread* thread)) 356 JRT_ENTRY(void, Runtime1::post_jvmti_exception_throw(JavaThread* thread))
357 if (JvmtiExport::can_post_exceptions()) { 357 if (JvmtiExport::can_post_on_exceptions()) {
358 vframeStream vfst(thread, true); 358 vframeStream vfst(thread, true);
359 address bcp = vfst.method()->bcp_from(vfst.bci()); 359 address bcp = vfst.method()->bcp_from(vfst.bci());
360 JvmtiExport::post_exception_throw(thread, vfst.method(), bcp, thread->exception_oop()); 360 JvmtiExport::post_exception_throw(thread, vfst.method(), bcp, thread->exception_oop());
361 } 361 }
362 JRT_END 362 JRT_END
423 } 423 }
424 #ifdef ASSERT 424 #ifdef ASSERT
425 assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); 425 assert(exception.not_null(), "NULL exceptions should be handled by throw_exception");
426 assert(exception->is_oop(), "just checking"); 426 assert(exception->is_oop(), "just checking");
427 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError 427 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
428 if (!(exception->is_a(SystemDictionary::throwable_klass()))) { 428 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
429 if (ExitVMOnVerifyError) vm_exit(-1); 429 if (ExitVMOnVerifyError) vm_exit(-1);
430 ShouldNotReachHere(); 430 ShouldNotReachHere();
431 } 431 }
432 #endif 432 #endif
433 433
435 // enough space on the stack to do so. Use fast exceptions only if the guard 435 // enough space on the stack to do so. Use fast exceptions only if the guard
436 // pages are enabled. 436 // pages are enabled.
437 bool guard_pages_enabled = thread->stack_yellow_zone_enabled(); 437 bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
438 if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack(); 438 if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
439 439
440 if (JvmtiExport::can_post_exceptions()) { 440 if (JvmtiExport::can_post_on_exceptions()) {
441 // To ensure correct notification of exception catches and throws 441 // To ensure correct notification of exception catches and throws
442 // we have to deoptimize here. If we attempted to notify the 442 // we have to deoptimize here. If we attempted to notify the
443 // catches and throws during this exception lookup it's possible 443 // catches and throws during this exception lookup it's possible
444 // we could deoptimize on the way out of the VM and end back in 444 // we could deoptimize on the way out of the VM and end back in
445 // the interpreter at the throw site. This would result in double 445 // the interpreter at the throw site. This would result in double
1073 ac_failed = -1, // arraycopy failed 1073 ac_failed = -1, // arraycopy failed
1074 ac_ok = 0 // arraycopy succeeded 1074 ac_ok = 0 // arraycopy succeeded
1075 }; 1075 };
1076 1076
1077 1077
1078 // Below length is the # elements copied.
1078 template <class T> int obj_arraycopy_work(oopDesc* src, T* src_addr, 1079 template <class T> int obj_arraycopy_work(oopDesc* src, T* src_addr,
1079 oopDesc* dst, T* dst_addr, 1080 oopDesc* dst, T* dst_addr,
1080 int length) { 1081 int length) {
1081 1082
1082 // For performance reasons, we assume we are using a card marking write 1083 // For performance reasons, we assume we are using a card marking write
1083 // barrier. The assert will fail if this is not the case. 1084 // barrier. The assert will fail if this is not the case.
1084 // Note that we use the non-virtual inlineable variant of write_ref_array. 1085 // Note that we use the non-virtual inlineable variant of write_ref_array.
1085 BarrierSet* bs = Universe::heap()->barrier_set(); 1086 BarrierSet* bs = Universe::heap()->barrier_set();
1086 assert(bs->has_write_ref_array_opt(), 1087 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt");
1087 "Barrier set must have ref array opt"); 1088 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well.");
1088 if (src == dst) { 1089 if (src == dst) {
1089 // same object, no check 1090 // same object, no check
1091 bs->write_ref_array_pre(dst_addr, length);
1090 Copy::conjoint_oops_atomic(src_addr, dst_addr, length); 1092 Copy::conjoint_oops_atomic(src_addr, dst_addr, length);
1091 bs->write_ref_array(MemRegion((HeapWord*)dst_addr, 1093 bs->write_ref_array((HeapWord*)dst_addr, length);
1092 (HeapWord*)(dst_addr + length)));
1093 return ac_ok; 1094 return ac_ok;
1094 } else { 1095 } else {
1095 klassOop bound = objArrayKlass::cast(dst->klass())->element_klass(); 1096 klassOop bound = objArrayKlass::cast(dst->klass())->element_klass();
1096 klassOop stype = objArrayKlass::cast(src->klass())->element_klass(); 1097 klassOop stype = objArrayKlass::cast(src->klass())->element_klass();
1097 if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) { 1098 if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) {
1098 // Elements are guaranteed to be subtypes, so no check necessary 1099 // Elements are guaranteed to be subtypes, so no check necessary
1100 bs->write_ref_array_pre(dst_addr, length);
1099 Copy::conjoint_oops_atomic(src_addr, dst_addr, length); 1101 Copy::conjoint_oops_atomic(src_addr, dst_addr, length);
1100 bs->write_ref_array(MemRegion((HeapWord*)dst_addr, 1102 bs->write_ref_array((HeapWord*)dst_addr, length);
1101 (HeapWord*)(dst_addr + length)));
1102 return ac_ok; 1103 return ac_ok;
1103 } 1104 }
1104 } 1105 }
1105 return ac_failed; 1106 return ac_failed;
1106 } 1107 }
1160 #ifndef PRODUCT 1161 #ifndef PRODUCT
1161 _oop_arraycopy_cnt++; 1162 _oop_arraycopy_cnt++;
1162 #endif 1163 #endif
1163 1164
1164 if (num == 0) return; 1165 if (num == 0) return;
1166 BarrierSet* bs = Universe::heap()->barrier_set();
1167 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt");
1168 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well.");
1169 if (UseCompressedOops) {
1170 bs->write_ref_array_pre((narrowOop*)dst, num);
1171 } else {
1172 bs->write_ref_array_pre((oop*)dst, num);
1173 }
1165 Copy::conjoint_oops_atomic((oop*) src, (oop*) dst, num); 1174 Copy::conjoint_oops_atomic((oop*) src, (oop*) dst, num);
1166 BarrierSet* bs = Universe::heap()->barrier_set(); 1175 bs->write_ref_array(dst, num);
1167 bs->write_ref_array(MemRegion(dst, dst + num));
1168 JRT_END 1176 JRT_END
1169 1177
1170 1178
1171 #ifndef PRODUCT 1179 #ifndef PRODUCT
1172 void Runtime1::print_statistics() { 1180 void Runtime1::print_statistics() {