< prev index next >

src/hotspot/share/c1/c1_LIRGenerator.cpp

Print this page
rev 63810 : Merge


1306     info = state_for(x);
1307   }
1308 
1309   __ move(new LIR_Address(rcvr.result(), java_lang_Class::klass_offset(), T_ADDRESS), temp, info);
1310   __ cmp(lir_cond_notEqual, temp, LIR_OprFact::metadataConst(0));
1311   __ cmove(lir_cond_notEqual, LIR_OprFact::intConst(0), LIR_OprFact::intConst(1), result, T_BOOLEAN);
1312 }
1313 
1314 
1315 // Example: Thread.currentThread()
1316 void LIRGenerator::do_currentThread(Intrinsic* x) {
1317   assert(x->number_of_arguments() == 0, "wrong type");
1318   LIR_Opr temp = new_register(T_ADDRESS);
1319   LIR_Opr reg = rlock_result(x);
1320   __ move(new LIR_Address(getThreadPointer(), in_bytes(JavaThread::threadObj_offset()), T_ADDRESS), temp);
1321   // threadObj = ((OopHandle)_threadObj)->resolve();
1322   access_load(IN_NATIVE, T_OBJECT,
1323               LIR_OprFact::address(new LIR_Address(temp, T_OBJECT)), reg);
1324 }
1325 





















































1326 
1327 void LIRGenerator::do_RegisterFinalizer(Intrinsic* x) {
1328   assert(x->number_of_arguments() == 1, "wrong type");
1329   LIRItem receiver(x->argument_at(0), this);
1330 
1331   receiver.load_item();
1332   BasicTypeList signature;
1333   signature.append(T_OBJECT); // receiver
1334   LIR_OprList* args = new LIR_OprList();
1335   args->append(receiver.result());
1336   CodeEmitInfo* info = state_for(x, x->state());
1337   call_runtime(&signature, args,
1338                CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::register_finalizer_id)),
1339                voidType, info);
1340 
1341   set_no_result(x);
1342 }
1343 
1344 
1345 //------------------------local access--------------------------------------


3031     do_getEventWriter(x);
3032     break;
3033   case vmIntrinsics::_counterTime:
3034     do_RuntimeCall(CAST_FROM_FN_PTR(address, JFR_TIME_FUNCTION), x);
3035     break;
3036 #endif
3037 
3038   case vmIntrinsics::_currentTimeMillis:
3039     do_RuntimeCall(CAST_FROM_FN_PTR(address, os::javaTimeMillis), x);
3040     break;
3041 
3042   case vmIntrinsics::_nanoTime:
3043     do_RuntimeCall(CAST_FROM_FN_PTR(address, os::javaTimeNanos), x);
3044     break;
3045 
3046   case vmIntrinsics::_Object_init:    do_RegisterFinalizer(x); break;
3047   case vmIntrinsics::_isInstance:     do_isInstance(x);    break;
3048   case vmIntrinsics::_isPrimitive:    do_isPrimitive(x);   break;
3049   case vmIntrinsics::_getClass:       do_getClass(x);      break;
3050   case vmIntrinsics::_currentThread:  do_currentThread(x); break;



3051 
3052   case vmIntrinsics::_dlog:           // fall through
3053   case vmIntrinsics::_dlog10:         // fall through
3054   case vmIntrinsics::_dabs:           // fall through
3055   case vmIntrinsics::_dsqrt:          // fall through
3056   case vmIntrinsics::_dtan:           // fall through
3057   case vmIntrinsics::_dsin :          // fall through
3058   case vmIntrinsics::_dcos :          // fall through
3059   case vmIntrinsics::_dexp :          // fall through
3060   case vmIntrinsics::_dpow :          do_MathIntrinsic(x); break;
3061   case vmIntrinsics::_arraycopy:      do_ArrayCopy(x);     break;
3062 
3063   case vmIntrinsics::_fmaD:           do_FmaIntrinsic(x); break;
3064   case vmIntrinsics::_fmaF:           do_FmaIntrinsic(x); break;
3065 
3066   // java.nio.Buffer.checkIndex
3067   case vmIntrinsics::_checkIndex:     do_NIOCheckIndex(x); break;
3068 
3069   case vmIntrinsics::_compareAndSetReference:
3070     do_CompareAndSwap(x, objectType);




1306     info = state_for(x);
1307   }
1308 
1309   __ move(new LIR_Address(rcvr.result(), java_lang_Class::klass_offset(), T_ADDRESS), temp, info);
1310   __ cmp(lir_cond_notEqual, temp, LIR_OprFact::metadataConst(0));
1311   __ cmove(lir_cond_notEqual, LIR_OprFact::intConst(0), LIR_OprFact::intConst(1), result, T_BOOLEAN);
1312 }
1313 
1314 
1315 // Example: Thread.currentThread()
1316 void LIRGenerator::do_currentThread(Intrinsic* x) {
1317   assert(x->number_of_arguments() == 0, "wrong type");
1318   LIR_Opr temp = new_register(T_ADDRESS);
1319   LIR_Opr reg = rlock_result(x);
1320   __ move(new LIR_Address(getThreadPointer(), in_bytes(JavaThread::threadObj_offset()), T_ADDRESS), temp);
1321   // threadObj = ((OopHandle)_threadObj)->resolve();
1322   access_load(IN_NATIVE, T_OBJECT,
1323               LIR_OprFact::address(new LIR_Address(temp, T_OBJECT)), reg);
1324 }
1325 
1326 void LIRGenerator::do_getReferencedObjects(Intrinsic* x) {
1327   BasicTypeList signature;
1328   signature.append(T_OBJECT); // obj
1329   signature.append(T_ARRAY);  // reference buffer
1330 
1331   LIRItem a0(x->argument_at(0), this);
1332   LIRItem a1(x->argument_at(1), this);
1333   a0.load_item();
1334   a1.load_item();
1335 
1336   LIR_OprList* args = new LIR_OprList();
1337   args->append(a0.result());
1338   args->append(a1.result());
1339 
1340   LIR_Opr result = call_runtime(&signature, args, CAST_FROM_FN_PTR(address, SharedRuntime::get_referenced_objects), intType, NULL);
1341   __ move(result, rlock_result(x), NULL);
1342 }
1343 
1344 void LIRGenerator::do_addressOf(Intrinsic* x) {
1345   assert(x->number_of_arguments() == 1, "wrong type");
1346   LIR_Opr reg = rlock_result(x);
1347 
1348   if (!RuntimeAddressOf) {
1349     __ move(LIR_OprFact::longConst(-1), reg, NULL);
1350     return;
1351   }
1352 
1353   LIRItem value(x->argument_at(0), this);
1354   value.load_item();
1355 
1356 #ifdef _LP64
1357   __ move(value.result(), reg, NULL);
1358 #else
1359   LIR_Opr res = new_register(T_LONG);
1360   __ convert(Bytecodes::_i2l, value.result(), res);
1361   __ move(res, reg, NULL);
1362 #endif
1363 }
1364 
1365 void LIRGenerator::do_sizeOf(Intrinsic* x) {
1366   assert(x->number_of_arguments() == 1, "wrong type");
1367   LIRItem value(x->argument_at(0), this);
1368   value.load_item();
1369   LIR_Opr reg = rlock_result(x);
1370 
1371   LIR_Opr klass = new_register(T_METADATA);
1372   __ move(new LIR_Address(value.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), klass, NULL);
1373   LIR_Opr layout = new_register(T_INT);
1374   __ move(new LIR_Address(klass, in_bytes(Klass::layout_helper_offset()), T_INT), layout);
1375 
1376   // TODO: Is not really correct if layout helper contains slow_path bit.
1377   __ convert(Bytecodes::_i2l, layout, reg);
1378 }
1379 
1380 void LIRGenerator::do_RegisterFinalizer(Intrinsic* x) {
1381   assert(x->number_of_arguments() == 1, "wrong type");
1382   LIRItem receiver(x->argument_at(0), this);
1383 
1384   receiver.load_item();
1385   BasicTypeList signature;
1386   signature.append(T_OBJECT); // receiver
1387   LIR_OprList* args = new LIR_OprList();
1388   args->append(receiver.result());
1389   CodeEmitInfo* info = state_for(x, x->state());
1390   call_runtime(&signature, args,
1391                CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::register_finalizer_id)),
1392                voidType, info);
1393 
1394   set_no_result(x);
1395 }
1396 
1397 
1398 //------------------------local access--------------------------------------


3084     do_getEventWriter(x);
3085     break;
3086   case vmIntrinsics::_counterTime:
3087     do_RuntimeCall(CAST_FROM_FN_PTR(address, JFR_TIME_FUNCTION), x);
3088     break;
3089 #endif
3090 
3091   case vmIntrinsics::_currentTimeMillis:
3092     do_RuntimeCall(CAST_FROM_FN_PTR(address, os::javaTimeMillis), x);
3093     break;
3094 
3095   case vmIntrinsics::_nanoTime:
3096     do_RuntimeCall(CAST_FROM_FN_PTR(address, os::javaTimeNanos), x);
3097     break;
3098 
3099   case vmIntrinsics::_Object_init:    do_RegisterFinalizer(x); break;
3100   case vmIntrinsics::_isInstance:     do_isInstance(x);    break;
3101   case vmIntrinsics::_isPrimitive:    do_isPrimitive(x);   break;
3102   case vmIntrinsics::_getClass:       do_getClass(x);      break;
3103   case vmIntrinsics::_currentThread:  do_currentThread(x); break;
3104   case vmIntrinsics::_addressOf:      do_addressOf(x);     break;
3105   case vmIntrinsics::_sizeOf:         do_sizeOf(x);        break;
3106   case vmIntrinsics::_getReferencedObjects: do_getReferencedObjects(x); break;
3107 
3108   case vmIntrinsics::_dlog:           // fall through
3109   case vmIntrinsics::_dlog10:         // fall through
3110   case vmIntrinsics::_dabs:           // fall through
3111   case vmIntrinsics::_dsqrt:          // fall through
3112   case vmIntrinsics::_dtan:           // fall through
3113   case vmIntrinsics::_dsin :          // fall through
3114   case vmIntrinsics::_dcos :          // fall through
3115   case vmIntrinsics::_dexp :          // fall through
3116   case vmIntrinsics::_dpow :          do_MathIntrinsic(x); break;
3117   case vmIntrinsics::_arraycopy:      do_ArrayCopy(x);     break;
3118 
3119   case vmIntrinsics::_fmaD:           do_FmaIntrinsic(x); break;
3120   case vmIntrinsics::_fmaF:           do_FmaIntrinsic(x); break;
3121 
3122   // java.nio.Buffer.checkIndex
3123   case vmIntrinsics::_checkIndex:     do_NIOCheckIndex(x); break;
3124 
3125   case vmIntrinsics::_compareAndSetReference:
3126     do_CompareAndSwap(x, objectType);


< prev index next >