173 bool inline_unsafe_access(bool is_native_ptr, bool is_store, BasicType type, bool is_volatile); |
173 bool inline_unsafe_access(bool is_native_ptr, bool is_store, BasicType type, bool is_volatile); |
174 bool inline_unsafe_prefetch(bool is_native_ptr, bool is_store, bool is_static); |
174 bool inline_unsafe_prefetch(bool is_native_ptr, bool is_store, bool is_static); |
175 bool inline_unsafe_allocate(); |
175 bool inline_unsafe_allocate(); |
176 bool inline_unsafe_copyMemory(); |
176 bool inline_unsafe_copyMemory(); |
177 bool inline_native_currentThread(); |
177 bool inline_native_currentThread(); |
178 bool inline_native_time_funcs(bool isNano); |
178 #ifdef TRACE_HAVE_INTRINSICS |
|
179 bool inline_native_classID(); |
|
180 bool inline_native_threadID(); |
|
181 #endif |
|
182 bool inline_native_time_funcs(address method, const char* funcName); |
179 bool inline_native_isInterrupted(); |
183 bool inline_native_isInterrupted(); |
180 bool inline_native_Class_query(vmIntrinsics::ID id); |
184 bool inline_native_Class_query(vmIntrinsics::ID id); |
181 bool inline_native_subtype_check(); |
185 bool inline_native_subtype_check(); |
182 |
186 |
183 bool inline_native_newArray(); |
187 bool inline_native_newArray(); |
636 case vmIntrinsics::_currentThread: |
640 case vmIntrinsics::_currentThread: |
637 return inline_native_currentThread(); |
641 return inline_native_currentThread(); |
638 case vmIntrinsics::_isInterrupted: |
642 case vmIntrinsics::_isInterrupted: |
639 return inline_native_isInterrupted(); |
643 return inline_native_isInterrupted(); |
640 |
644 |
|
645 #ifdef TRACE_HAVE_INTRINSICS |
|
646 case vmIntrinsics::_classID: |
|
647 return inline_native_classID(); |
|
648 case vmIntrinsics::_threadID: |
|
649 return inline_native_threadID(); |
|
650 case vmIntrinsics::_counterTime: |
|
651 return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime"); |
|
652 #endif |
641 case vmIntrinsics::_currentTimeMillis: |
653 case vmIntrinsics::_currentTimeMillis: |
642 return inline_native_time_funcs(false); |
654 return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis"); |
643 case vmIntrinsics::_nanoTime: |
655 case vmIntrinsics::_nanoTime: |
644 return inline_native_time_funcs(true); |
656 return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeNanos), "nanoTime"); |
645 case vmIntrinsics::_allocateInstance: |
657 case vmIntrinsics::_allocateInstance: |
646 return inline_unsafe_allocate(); |
658 return inline_unsafe_allocate(); |
647 case vmIntrinsics::_copyMemory: |
659 case vmIntrinsics::_copyMemory: |
648 return inline_unsafe_copyMemory(); |
660 return inline_unsafe_copyMemory(); |
649 case vmIntrinsics::_newArray: |
661 case vmIntrinsics::_newArray: |
2838 push(obj); |
2850 push(obj); |
2839 |
2851 |
2840 return true; |
2852 return true; |
2841 } |
2853 } |
2842 |
2854 |
|
2855 #ifdef TRACE_HAVE_INTRINSICS |
|
2856 /* |
|
2857 * oop -> myklass |
|
2858 * myklass->trace_id |= USED |
|
2859 * return myklass->trace_id & ~0x3 |
|
2860 */ |
|
2861 bool LibraryCallKit::inline_native_classID() { |
|
2862 int nargs = 1 + 1; |
|
2863 null_check_receiver(callee()); // check then ignore argument(0) |
|
2864 _sp += nargs; |
|
2865 Node* cls = do_null_check(argument(1), T_OBJECT); |
|
2866 _sp -= nargs; |
|
2867 Node* kls = load_klass_from_mirror(cls, false, nargs, NULL, 0); |
|
2868 _sp += nargs; |
|
2869 kls = do_null_check(kls, T_OBJECT); |
|
2870 _sp -= nargs; |
|
2871 ByteSize offset = TRACE_ID_OFFSET; |
|
2872 Node* insp = basic_plus_adr(kls, in_bytes(offset)); |
|
2873 Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG); |
|
2874 Node* bits = longcon(~0x03l); // ignore bit 0 & 1 |
|
2875 Node* andl = _gvn.transform(new (C, 3) AndLNode(tvalue, bits)); |
|
2876 Node* clsused = longcon(0x01l); // set the class bit |
|
2877 Node* orl = _gvn.transform(new (C, 3) OrLNode(tvalue, clsused)); |
|
2878 |
|
2879 const TypePtr *adr_type = _gvn.type(insp)->isa_ptr(); |
|
2880 store_to_memory(control(), insp, orl, T_LONG, adr_type); |
|
2881 push_pair(andl); |
|
2882 return true; |
|
2883 } |
|
2884 |
|
2885 bool LibraryCallKit::inline_native_threadID() { |
|
2886 Node* tls_ptr = NULL; |
|
2887 Node* cur_thr = generate_current_thread(tls_ptr); |
|
2888 Node* p = basic_plus_adr(top()/*!oop*/, tls_ptr, in_bytes(JavaThread::osthread_offset())); |
|
2889 Node* osthread = make_load(NULL, p, TypeRawPtr::NOTNULL, T_ADDRESS); |
|
2890 p = basic_plus_adr(top()/*!oop*/, osthread, in_bytes(OSThread::thread_id_offset())); |
|
2891 |
|
2892 Node* threadid = NULL; |
|
2893 size_t thread_id_size = OSThread::thread_id_size(); |
|
2894 if (thread_id_size == (size_t) BytesPerLong) { |
|
2895 threadid = ConvL2I(make_load(control(), p, TypeLong::LONG, T_LONG)); |
|
2896 push(threadid); |
|
2897 } else if (thread_id_size == (size_t) BytesPerInt) { |
|
2898 threadid = make_load(control(), p, TypeInt::INT, T_INT); |
|
2899 push(threadid); |
|
2900 } else { |
|
2901 ShouldNotReachHere(); |
|
2902 } |
|
2903 return true; |
|
2904 } |
|
2905 #endif |
|
2906 |
2843 //------------------------inline_native_time_funcs-------------- |
2907 //------------------------inline_native_time_funcs-------------- |
2844 // inline code for System.currentTimeMillis() and System.nanoTime() |
2908 // inline code for System.currentTimeMillis() and System.nanoTime() |
2845 // these have the same type and signature |
2909 // these have the same type and signature |
2846 bool LibraryCallKit::inline_native_time_funcs(bool isNano) { |
2910 bool LibraryCallKit::inline_native_time_funcs(address funcAddr, const char* funcName) { |
2847 address funcAddr = isNano ? CAST_FROM_FN_PTR(address, os::javaTimeNanos) : |
2911 const TypeFunc *tf = OptoRuntime::void_long_Type(); |
2848 CAST_FROM_FN_PTR(address, os::javaTimeMillis); |
|
2849 const char * funcName = isNano ? "nanoTime" : "currentTimeMillis"; |
|
2850 const TypeFunc *tf = OptoRuntime::current_time_millis_Type(); |
|
2851 const TypePtr* no_memory_effects = NULL; |
2912 const TypePtr* no_memory_effects = NULL; |
2852 Node* time = make_runtime_call(RC_LEAF, tf, funcAddr, funcName, no_memory_effects); |
2913 Node* time = make_runtime_call(RC_LEAF, tf, funcAddr, funcName, no_memory_effects); |
2853 Node* value = _gvn.transform(new (C, 1) ProjNode(time, TypeFunc::Parms+0)); |
2914 Node* value = _gvn.transform(new (C, 1) ProjNode(time, TypeFunc::Parms+0)); |
2854 #ifdef ASSERT |
2915 #ifdef ASSERT |
2855 Node* value_top = _gvn.transform(new (C, 1) ProjNode(time, TypeFunc::Parms + 1)); |
2916 Node* value_top = _gvn.transform(new (C, 1) ProjNode(time, TypeFunc::Parms + 1)); |