hotspot/src/share/vm/opto/library_call.cpp
changeset 40899 d7140c75c2c6
parent 40881 a4955213b573
child 41066 e8c366069761
equal deleted inserted replaced
40898:1c147e5e2b71 40899:d7140c75c2c6
   252   bool inline_unsafe_newArray(bool uninitialized);
   252   bool inline_unsafe_newArray(bool uninitialized);
   253   bool inline_unsafe_copyMemory();
   253   bool inline_unsafe_copyMemory();
   254   bool inline_native_currentThread();
   254   bool inline_native_currentThread();
   255 
   255 
   256   bool inline_native_time_funcs(address method, const char* funcName);
   256   bool inline_native_time_funcs(address method, const char* funcName);
       
   257 #ifdef TRACE_HAVE_INTRINSICS
       
   258   bool inline_native_classID();
       
   259 #endif
   257   bool inline_native_isInterrupted();
   260   bool inline_native_isInterrupted();
   258   bool inline_native_Class_query(vmIntrinsics::ID id);
   261   bool inline_native_Class_query(vmIntrinsics::ID id);
   259   bool inline_native_subtype_check();
   262   bool inline_native_subtype_check();
   260   bool inline_native_getLength();
   263   bool inline_native_getLength();
   261   bool inline_array_copyOf(bool is_copyOfRange);
   264   bool inline_array_copyOf(bool is_copyOfRange);
   706   case vmIntrinsics::_currentThread:            return inline_native_currentThread();
   709   case vmIntrinsics::_currentThread:            return inline_native_currentThread();
   707   case vmIntrinsics::_isInterrupted:            return inline_native_isInterrupted();
   710   case vmIntrinsics::_isInterrupted:            return inline_native_isInterrupted();
   708 
   711 
   709 #ifdef TRACE_HAVE_INTRINSICS
   712 #ifdef TRACE_HAVE_INTRINSICS
   710   case vmIntrinsics::_counterTime:              return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime");
   713   case vmIntrinsics::_counterTime:              return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime");
       
   714   case vmIntrinsics::_getClassId:               return inline_native_classID();
   711 #endif
   715 #endif
   712   case vmIntrinsics::_currentTimeMillis:        return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis");
   716   case vmIntrinsics::_currentTimeMillis:        return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis");
   713   case vmIntrinsics::_nanoTime:                 return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeNanos), "nanoTime");
   717   case vmIntrinsics::_nanoTime:                 return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeNanos), "nanoTime");
   714   case vmIntrinsics::_allocateInstance:         return inline_unsafe_allocate();
   718   case vmIntrinsics::_allocateInstance:         return inline_unsafe_allocate();
   715   case vmIntrinsics::_copyMemory:               return inline_unsafe_copyMemory();
   719   case vmIntrinsics::_copyMemory:               return inline_unsafe_copyMemory();
  3130 #endif
  3134 #endif
  3131   set_result(value);
  3135   set_result(value);
  3132   return true;
  3136   return true;
  3133 }
  3137 }
  3134 
  3138 
       
  3139 #ifdef TRACE_HAVE_INTRINSICS
       
  3140 
       
  3141 /*
       
  3142 * oop -> myklass
       
  3143 * myklass->trace_id |= USED
       
  3144 * return myklass->trace_id & ~0x3
       
  3145 */
       
  3146 bool LibraryCallKit::inline_native_classID() {
       
  3147   Node* cls = null_check(argument(0), T_OBJECT);
       
  3148   Node* kls = load_klass_from_mirror(cls, false, NULL, 0);
       
  3149   kls = null_check(kls, T_OBJECT);
       
  3150 
       
  3151   ByteSize offset = TRACE_KLASS_TRACE_ID_OFFSET;
       
  3152   Node* insp = basic_plus_adr(kls, in_bytes(offset));
       
  3153   Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG, MemNode::unordered);
       
  3154 
       
  3155   Node* clsused = longcon(0x01l); // set the class bit
       
  3156   Node* orl = _gvn.transform(new OrLNode(tvalue, clsused));
       
  3157   const TypePtr *adr_type = _gvn.type(insp)->isa_ptr();
       
  3158   store_to_memory(control(), insp, orl, T_LONG, adr_type, MemNode::unordered);
       
  3159 
       
  3160 #ifdef TRACE_ID_META_BITS
       
  3161   Node* mbits = longcon(~TRACE_ID_META_BITS);
       
  3162   tvalue = _gvn.transform(new AndLNode(tvalue, mbits));
       
  3163 #endif
       
  3164 #ifdef TRACE_ID_CLASS_SHIFT
       
  3165   Node* cbits = intcon(TRACE_ID_CLASS_SHIFT);
       
  3166   tvalue = _gvn.transform(new URShiftLNode(tvalue, cbits));
       
  3167 #endif
       
  3168 
       
  3169   set_result(tvalue);
       
  3170   return true;
       
  3171 
       
  3172 }
       
  3173 
       
  3174 #endif
       
  3175 
  3135 //------------------------inline_native_currentThread------------------
  3176 //------------------------inline_native_currentThread------------------
  3136 bool LibraryCallKit::inline_native_currentThread() {
  3177 bool LibraryCallKit::inline_native_currentThread() {
  3137   Node* junk = NULL;
  3178   Node* junk = NULL;
  3138   set_result(generate_current_thread(junk));
  3179   set_result(generate_current_thread(junk));
  3139   return true;
  3180   return true;