Mercurial > hg > graal-compiler
comparison src/share/vm/interpreter/bytecodeInterpreter.cpp @ 14446:b4e19a1e459f
8029957: PPC64 (part 213): cppInterpreter: memory ordering for object initialization
Summary: Add StoreStore barriers after object initialization and after constructor calls in the C++ interpreter.
Reviewed-by: kvn
author | goetz |
---|---|
date | Wed, 11 Dec 2013 12:28:09 +0100 |
parents | 018b357638aa |
children | c6d7e7406136 |
comparison
equal
deleted
inserted
replaced
14445:67fa91961822 | 14446:b4e19a1e459f |
---|---|
2238 } else { | 2238 } else { |
2239 result->set_mark(markOopDesc::prototype()); | 2239 result->set_mark(markOopDesc::prototype()); |
2240 } | 2240 } |
2241 result->set_klass_gap(0); | 2241 result->set_klass_gap(0); |
2242 result->set_klass(k_entry); | 2242 result->set_klass(k_entry); |
2243 // Must prevent reordering of stores for object initialization | |
2244 // with stores that publish the new object. | |
2245 OrderAccess::storestore(); | |
2243 SET_STACK_OBJECT(result, 0); | 2246 SET_STACK_OBJECT(result, 0); |
2244 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1); | 2247 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1); |
2245 } | 2248 } |
2246 } | 2249 } |
2247 } | 2250 } |
2248 // Slow case allocation | 2251 // Slow case allocation |
2249 CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index), | 2252 CALL_VM(InterpreterRuntime::_new(THREAD, METHOD->constants(), index), |
2250 handle_exception); | 2253 handle_exception); |
2254 // Must prevent reordering of stores for object initialization | |
2255 // with stores that publish the new object. | |
2256 OrderAccess::storestore(); | |
2251 SET_STACK_OBJECT(THREAD->vm_result(), 0); | 2257 SET_STACK_OBJECT(THREAD->vm_result(), 0); |
2252 THREAD->set_vm_result(NULL); | 2258 THREAD->set_vm_result(NULL); |
2253 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1); | 2259 UPDATE_PC_AND_TOS_AND_CONTINUE(3, 1); |
2254 } | 2260 } |
2255 CASE(_anewarray): { | 2261 CASE(_anewarray): { |
2256 u2 index = Bytes::get_Java_u2(pc+1); | 2262 u2 index = Bytes::get_Java_u2(pc+1); |
2257 jint size = STACK_INT(-1); | 2263 jint size = STACK_INT(-1); |
2258 CALL_VM(InterpreterRuntime::anewarray(THREAD, METHOD->constants(), index, size), | 2264 CALL_VM(InterpreterRuntime::anewarray(THREAD, METHOD->constants(), index, size), |
2259 handle_exception); | 2265 handle_exception); |
2266 // Must prevent reordering of stores for object initialization | |
2267 // with stores that publish the new object. | |
2268 OrderAccess::storestore(); | |
2260 SET_STACK_OBJECT(THREAD->vm_result(), -1); | 2269 SET_STACK_OBJECT(THREAD->vm_result(), -1); |
2261 THREAD->set_vm_result(NULL); | 2270 THREAD->set_vm_result(NULL); |
2262 UPDATE_PC_AND_CONTINUE(3); | 2271 UPDATE_PC_AND_CONTINUE(3); |
2263 } | 2272 } |
2264 CASE(_multianewarray): { | 2273 CASE(_multianewarray): { |
2269 (jint*)&topOfStack[dims * Interpreter::stackElementWords+ | 2278 (jint*)&topOfStack[dims * Interpreter::stackElementWords+ |
2270 Interpreter::stackElementWords-1]; | 2279 Interpreter::stackElementWords-1]; |
2271 //adjust pointer to start of stack element | 2280 //adjust pointer to start of stack element |
2272 CALL_VM(InterpreterRuntime::multianewarray(THREAD, dimarray), | 2281 CALL_VM(InterpreterRuntime::multianewarray(THREAD, dimarray), |
2273 handle_exception); | 2282 handle_exception); |
2283 // Must prevent reordering of stores for object initialization | |
2284 // with stores that publish the new object. | |
2285 OrderAccess::storestore(); | |
2274 SET_STACK_OBJECT(THREAD->vm_result(), -dims); | 2286 SET_STACK_OBJECT(THREAD->vm_result(), -dims); |
2275 THREAD->set_vm_result(NULL); | 2287 THREAD->set_vm_result(NULL); |
2276 UPDATE_PC_AND_TOS_AND_CONTINUE(4, -(dims-1)); | 2288 UPDATE_PC_AND_TOS_AND_CONTINUE(4, -(dims-1)); |
2277 } | 2289 } |
2278 CASE(_checkcast): | 2290 CASE(_checkcast): |
2691 CASE(_newarray): { | 2703 CASE(_newarray): { |
2692 BasicType atype = (BasicType) *(pc+1); | 2704 BasicType atype = (BasicType) *(pc+1); |
2693 jint size = STACK_INT(-1); | 2705 jint size = STACK_INT(-1); |
2694 CALL_VM(InterpreterRuntime::newarray(THREAD, atype, size), | 2706 CALL_VM(InterpreterRuntime::newarray(THREAD, atype, size), |
2695 handle_exception); | 2707 handle_exception); |
2708 // Must prevent reordering of stores for object initialization | |
2709 // with stores that publish the new object. | |
2710 OrderAccess::storestore(); | |
2696 SET_STACK_OBJECT(THREAD->vm_result(), -1); | 2711 SET_STACK_OBJECT(THREAD->vm_result(), -1); |
2697 THREAD->set_vm_result(NULL); | 2712 THREAD->set_vm_result(NULL); |
2698 | 2713 |
2699 UPDATE_PC_AND_CONTINUE(2); | 2714 UPDATE_PC_AND_CONTINUE(2); |
2700 } | 2715 } |
2924 // Fall through to handle_return. | 2939 // Fall through to handle_return. |
2925 | 2940 |
2926 } // handle_Early_Return | 2941 } // handle_Early_Return |
2927 | 2942 |
2928 handle_return: { | 2943 handle_return: { |
2944 // A storestore barrier is required to order initialization of | |
2945 // final fields with publishing the reference to the object that | |
2946 // holds the field. Without the barrier the value of final fields | |
2947 // can be observed to change. | |
2948 OrderAccess::storestore(); | |
2949 | |
2929 DECACHE_STATE(); | 2950 DECACHE_STATE(); |
2930 | 2951 |
2931 bool suppress_error = istate->msg() == popping_frame || istate->msg() == early_return; | 2952 bool suppress_error = istate->msg() == popping_frame || istate->msg() == early_return; |
2932 bool suppress_exit_event = THREAD->has_pending_exception() || istate->msg() == popping_frame; | 2953 bool suppress_exit_event = THREAD->has_pending_exception() || istate->msg() == popping_frame; |
2933 Handle original_exception(THREAD, THREAD->pending_exception()); | 2954 Handle original_exception(THREAD, THREAD->pending_exception()); |