Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/library_call.cpp @ 7425:1e41b0bc58a0
8004318: JEP-171: Support Unsafe fences intrinsics
Summary: Add three memory-ordering intrinsics to the sun.misc.Unsafe class.
Reviewed-by: twisti, kvn
Contributed-by: Aleksey Shipilev <aleksey.shipilev@oracle.com>
author | kvn |
---|---|
date | Tue, 18 Dec 2012 17:37:44 -0800 |
parents | 620e502e3f47 |
children | c52660592f37 |
comparison
equal
deleted
inserted
replaced
7424:c4bd2eccea46 | 7425:1e41b0bc58a0 |
---|---|
280 Node* dest, Node* dest_offset, | 280 Node* dest, Node* dest_offset, |
281 Node* copy_length, bool dest_uninitialized); | 281 Node* copy_length, bool dest_uninitialized); |
282 typedef enum { LS_xadd, LS_xchg, LS_cmpxchg } LoadStoreKind; | 282 typedef enum { LS_xadd, LS_xchg, LS_cmpxchg } LoadStoreKind; |
283 bool inline_unsafe_load_store(BasicType type, LoadStoreKind kind); | 283 bool inline_unsafe_load_store(BasicType type, LoadStoreKind kind); |
284 bool inline_unsafe_ordered_store(BasicType type); | 284 bool inline_unsafe_ordered_store(BasicType type); |
285 bool inline_unsafe_fence(vmIntrinsics::ID id); | |
285 bool inline_fp_conversions(vmIntrinsics::ID id); | 286 bool inline_fp_conversions(vmIntrinsics::ID id); |
286 bool inline_number_methods(vmIntrinsics::ID id); | 287 bool inline_number_methods(vmIntrinsics::ID id); |
287 bool inline_reference_get(); | 288 bool inline_reference_get(); |
288 bool inline_aescrypt_Block(vmIntrinsics::ID id); | 289 bool inline_aescrypt_Block(vmIntrinsics::ID id); |
289 bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id); | 290 bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id); |
332 case vmIntrinsics::_getAndAddInt: | 333 case vmIntrinsics::_getAndAddInt: |
333 case vmIntrinsics::_getAndAddLong: | 334 case vmIntrinsics::_getAndAddLong: |
334 case vmIntrinsics::_getAndSetInt: | 335 case vmIntrinsics::_getAndSetInt: |
335 case vmIntrinsics::_getAndSetLong: | 336 case vmIntrinsics::_getAndSetLong: |
336 case vmIntrinsics::_getAndSetObject: | 337 case vmIntrinsics::_getAndSetObject: |
338 case vmIntrinsics::_loadFence: | |
339 case vmIntrinsics::_storeFence: | |
340 case vmIntrinsics::_fullFence: | |
337 break; // InlineNatives does not control String.compareTo | 341 break; // InlineNatives does not control String.compareTo |
338 case vmIntrinsics::_Reference_get: | 342 case vmIntrinsics::_Reference_get: |
339 break; // InlineNatives does not control Reference.get | 343 break; // InlineNatives does not control Reference.get |
340 default: | 344 default: |
341 return NULL; | 345 return NULL; |
729 case vmIntrinsics::_getAndAddInt: return inline_unsafe_load_store(T_INT, LS_xadd); | 733 case vmIntrinsics::_getAndAddInt: return inline_unsafe_load_store(T_INT, LS_xadd); |
730 case vmIntrinsics::_getAndAddLong: return inline_unsafe_load_store(T_LONG, LS_xadd); | 734 case vmIntrinsics::_getAndAddLong: return inline_unsafe_load_store(T_LONG, LS_xadd); |
731 case vmIntrinsics::_getAndSetInt: return inline_unsafe_load_store(T_INT, LS_xchg); | 735 case vmIntrinsics::_getAndSetInt: return inline_unsafe_load_store(T_INT, LS_xchg); |
732 case vmIntrinsics::_getAndSetLong: return inline_unsafe_load_store(T_LONG, LS_xchg); | 736 case vmIntrinsics::_getAndSetLong: return inline_unsafe_load_store(T_LONG, LS_xchg); |
733 case vmIntrinsics::_getAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_xchg); | 737 case vmIntrinsics::_getAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_xchg); |
738 | |
739 case vmIntrinsics::_loadFence: | |
740 case vmIntrinsics::_storeFence: | |
741 case vmIntrinsics::_fullFence: return inline_unsafe_fence(intrinsic_id()); | |
734 | 742 |
735 case vmIntrinsics::_currentThread: return inline_native_currentThread(); | 743 case vmIntrinsics::_currentThread: return inline_native_currentThread(); |
736 case vmIntrinsics::_isInterrupted: return inline_native_isInterrupted(); | 744 case vmIntrinsics::_isInterrupted: return inline_native_isInterrupted(); |
737 | 745 |
738 #ifdef TRACE_HAVE_INTRINSICS | 746 #ifdef TRACE_HAVE_INTRINSICS |
2838 } | 2846 } |
2839 insert_mem_bar(Op_MemBarCPUOrder); | 2847 insert_mem_bar(Op_MemBarCPUOrder); |
2840 return true; | 2848 return true; |
2841 } | 2849 } |
2842 | 2850 |
2851 bool LibraryCallKit::inline_unsafe_fence(vmIntrinsics::ID id) { | |
2852 // Regardless of form, don't allow previous ld/st to move down, | |
2853 // then issue acquire, release, or volatile mem_bar. | |
2854 insert_mem_bar(Op_MemBarCPUOrder); | |
2855 switch(id) { | |
2856 case vmIntrinsics::_loadFence: | |
2857 insert_mem_bar(Op_MemBarAcquire); | |
2858 return true; | |
2859 case vmIntrinsics::_storeFence: | |
2860 insert_mem_bar(Op_MemBarRelease); | |
2861 return true; | |
2862 case vmIntrinsics::_fullFence: | |
2863 insert_mem_bar(Op_MemBarVolatile); | |
2864 return true; | |
2865 default: | |
2866 fatal_unexpected_iid(id); | |
2867 return false; | |
2868 } | |
2869 } | |
2870 | |
2843 //----------------------------inline_unsafe_allocate--------------------------- | 2871 //----------------------------inline_unsafe_allocate--------------------------- |
2844 // public native Object sun.mics.Unsafe.allocateInstance(Class<?> cls); | 2872 // public native Object sun.mics.Unsafe.allocateInstance(Class<?> cls); |
2845 bool LibraryCallKit::inline_unsafe_allocate() { | 2873 bool LibraryCallKit::inline_unsafe_allocate() { |
2846 if (callee()->is_static()) return false; // caller must have the capability! | 2874 if (callee()->is_static()) return false; // caller must have the capability! |
2847 | 2875 |