Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/generateOptoStub.cpp @ 14429:2113136690bc
8024921: PPC64 (part 113): Extend Load and Store nodes to know about memory ordering
Summary: Add a field to C2 LoadNode and StoreNode classes which indicates whether the load/store should do an acquire/release on platforms which support it.
Reviewed-by: kvn
author | goetz |
---|---|
date | Fri, 15 Nov 2013 11:05:32 -0800 |
parents | 2b8e28fdf503 |
children | abec000618bf |
comparison
equal
deleted
inserted
replaced
14427:eb178e97560c | 14429:2113136690bc |
---|---|
102 // as soon as last_Java_sp != NULL the has_last_Java_frame is true and | 102 // as soon as last_Java_sp != NULL the has_last_Java_frame is true and |
103 // users will look at the other fields. | 103 // users will look at the other fields. |
104 // | 104 // |
105 Node *adr_sp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_sp_offset())); | 105 Node *adr_sp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_sp_offset())); |
106 Node *last_sp = basic_plus_adr(top(), frameptr(), (intptr_t) STACK_BIAS); | 106 Node *last_sp = basic_plus_adr(top(), frameptr(), (intptr_t) STACK_BIAS); |
107 store_to_memory(NULL, adr_sp, last_sp, T_ADDRESS, NoAlias); | 107 store_to_memory(NULL, adr_sp, last_sp, T_ADDRESS, NoAlias, MemNode::unordered); |
108 | 108 |
109 // Set _thread_in_native | 109 // Set _thread_in_native |
110 // The order of stores into TLS is critical! Setting _thread_in_native MUST | 110 // The order of stores into TLS is critical! Setting _thread_in_native MUST |
111 // be last, because a GC is allowed at any time after setting it and the GC | 111 // be last, because a GC is allowed at any time after setting it and the GC |
112 // will require last_Java_pc and last_Java_sp. | 112 // will require last_Java_pc and last_Java_sp. |
113 Node* adr_state = basic_plus_adr(top(), thread, in_bytes(JavaThread::thread_state_offset())); | |
114 | 113 |
115 //----------------------------- | 114 //----------------------------- |
116 // Compute signature for C call. Varies from the Java signature! | 115 // Compute signature for C call. Varies from the Java signature! |
117 const Type **fields = TypeTuple::fields(2*parm_cnt+2); | 116 const Type **fields = TypeTuple::fields(2*parm_cnt+2); |
118 uint cnt = TypeFunc::Parms; | 117 uint cnt = TypeFunc::Parms; |
223 } | 222 } |
224 | 223 |
225 //----------------------------- | 224 //----------------------------- |
226 | 225 |
227 // Clear last_Java_sp | 226 // Clear last_Java_sp |
228 store_to_memory(NULL, adr_sp, null(), T_ADDRESS, NoAlias); | 227 store_to_memory(NULL, adr_sp, null(), T_ADDRESS, NoAlias, MemNode::unordered); |
229 // Clear last_Java_pc and (optionally)_flags | 228 // Clear last_Java_pc and (optionally)_flags |
230 store_to_memory(NULL, adr_last_Java_pc, null(), T_ADDRESS, NoAlias); | 229 store_to_memory(NULL, adr_last_Java_pc, null(), T_ADDRESS, NoAlias, MemNode::unordered); |
231 #if defined(SPARC) | 230 #if defined(SPARC) |
232 store_to_memory(NULL, adr_flags, intcon(0), T_INT, NoAlias); | 231 store_to_memory(NULL, adr_flags, intcon(0), T_INT, NoAlias, MemNode::unordered); |
233 #endif /* defined(SPARC) */ | 232 #endif /* defined(SPARC) */ |
234 #if (defined(IA64) && !defined(AIX)) | 233 #if (defined(IA64) && !defined(AIX)) |
235 Node* adr_last_Java_fp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_fp_offset())); | 234 Node* adr_last_Java_fp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_fp_offset())); |
236 if( os::is_MP() ) insert_mem_bar(Op_MemBarRelease); | 235 store_to_memory(NULL, adr_last_Java_fp, null(), T_ADDRESS, NoAlias, MemNode::unordered); |
237 store_to_memory(NULL, adr_last_Java_fp, null(), T_ADDRESS, NoAlias); | |
238 #endif | 236 #endif |
239 | 237 |
240 // For is-fancy-jump, the C-return value is also the branch target | 238 // For is-fancy-jump, the C-return value is also the branch target |
241 Node* target = map()->in(TypeFunc::Parms); | 239 Node* target = map()->in(TypeFunc::Parms); |
242 // Runtime call returning oop in TLS? Fetch it out | 240 // Runtime call returning oop in TLS? Fetch it out |
243 if( pass_tls ) { | 241 if( pass_tls ) { |
244 Node* adr = basic_plus_adr(top(), thread, in_bytes(JavaThread::vm_result_offset())); | 242 Node* adr = basic_plus_adr(top(), thread, in_bytes(JavaThread::vm_result_offset())); |
245 Node* vm_result = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, false); | 243 Node* vm_result = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, MemNode::unordered); |
246 map()->set_req(TypeFunc::Parms, vm_result); // vm_result passed as result | 244 map()->set_req(TypeFunc::Parms, vm_result); // vm_result passed as result |
247 // clear thread-local-storage(tls) | 245 // clear thread-local-storage(tls) |
248 store_to_memory(NULL, adr, null(), T_ADDRESS, NoAlias); | 246 store_to_memory(NULL, adr, null(), T_ADDRESS, NoAlias, MemNode::unordered); |
249 } | 247 } |
250 | 248 |
251 //----------------------------- | 249 //----------------------------- |
252 // check exception | 250 // check exception |
253 Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset())); | 251 Node* adr = basic_plus_adr(top(), thread, in_bytes(Thread::pending_exception_offset())); |
254 Node* pending = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, false); | 252 Node* pending = make_load(NULL, adr, TypeOopPtr::BOTTOM, T_OBJECT, NoAlias, MemNode::unordered); |
255 | 253 |
256 Node* exit_memory = reset_memory(); | 254 Node* exit_memory = reset_memory(); |
257 | 255 |
258 Node* cmp = _gvn.transform( new (C) CmpPNode(pending, null()) ); | 256 Node* cmp = _gvn.transform( new (C) CmpPNode(pending, null()) ); |
259 Node* bo = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) ); | 257 Node* bo = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) ); |