< prev index next >

src/hotspot/share/c1/c1_LIRGenerator.cpp

Print this page
rev 63810 : Merge

@@ -1321,10 +1321,63 @@
   // threadObj = ((OopHandle)_threadObj)->resolve();
   access_load(IN_NATIVE, T_OBJECT,
               LIR_OprFact::address(new LIR_Address(temp, T_OBJECT)), reg);
 }
 
+void LIRGenerator::do_getReferencedObjects(Intrinsic* x) {
+  BasicTypeList signature;
+  signature.append(T_OBJECT); // obj
+  signature.append(T_ARRAY);  // reference buffer
+
+  LIRItem a0(x->argument_at(0), this);
+  LIRItem a1(x->argument_at(1), this);
+  a0.load_item();
+  a1.load_item();
+
+  LIR_OprList* args = new LIR_OprList();
+  args->append(a0.result());
+  args->append(a1.result());
+
+  LIR_Opr result = call_runtime(&signature, args, CAST_FROM_FN_PTR(address, SharedRuntime::get_referenced_objects), intType, NULL);
+  __ move(result, rlock_result(x), NULL);
+}
+
+void LIRGenerator::do_addressOf(Intrinsic* x) {
+  assert(x->number_of_arguments() == 1, "wrong type");
+  LIR_Opr reg = rlock_result(x);
+
+  if (!RuntimeAddressOf) {
+    __ move(LIR_OprFact::longConst(-1), reg, NULL);
+    return;
+  }
+
+  LIRItem value(x->argument_at(0), this);
+  value.load_item();
+
+#ifdef _LP64
+  __ move(value.result(), reg, NULL);
+#else
+  LIR_Opr res = new_register(T_LONG);
+  __ convert(Bytecodes::_i2l, value.result(), res);
+  __ move(res, reg, NULL);
+#endif
+}
+
+void LIRGenerator::do_sizeOf(Intrinsic* x) {
+  assert(x->number_of_arguments() == 1, "wrong type");
+  LIRItem value(x->argument_at(0), this);
+  value.load_item();
+  LIR_Opr reg = rlock_result(x);
+
+  LIR_Opr klass = new_register(T_METADATA);
+  __ move(new LIR_Address(value.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), klass, NULL);
+  LIR_Opr layout = new_register(T_INT);
+  __ move(new LIR_Address(klass, in_bytes(Klass::layout_helper_offset()), T_INT), layout);
+
+  // TODO: Is not really correct if layout helper contains slow_path bit.
+  __ convert(Bytecodes::_i2l, layout, reg);
+}
 
 void LIRGenerator::do_RegisterFinalizer(Intrinsic* x) {
   assert(x->number_of_arguments() == 1, "wrong type");
   LIRItem receiver(x->argument_at(0), this);
 

@@ -3046,10 +3099,13 @@
   case vmIntrinsics::_Object_init:    do_RegisterFinalizer(x); break;
   case vmIntrinsics::_isInstance:     do_isInstance(x);    break;
   case vmIntrinsics::_isPrimitive:    do_isPrimitive(x);   break;
   case vmIntrinsics::_getClass:       do_getClass(x);      break;
   case vmIntrinsics::_currentThread:  do_currentThread(x); break;
+  case vmIntrinsics::_addressOf:      do_addressOf(x);     break;
+  case vmIntrinsics::_sizeOf:         do_sizeOf(x);        break;
+  case vmIntrinsics::_getReferencedObjects: do_getReferencedObjects(x); break;
 
   case vmIntrinsics::_dlog:           // fall through
   case vmIntrinsics::_dlog10:         // fall through
   case vmIntrinsics::_dabs:           // fall through
   case vmIntrinsics::_dsqrt:          // fall through
< prev index next >