< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page
@@ -720,10 +720,19 @@
      return inline_getObjectSize();
  
    case vmIntrinsics::_blackhole:
      return inline_blackhole();
  
+   case vmIntrinsics::_shipilev_magic_timestamp:
+     return inline_timestamp(false);
+   case vmIntrinsics::_shipilev_magic_timestamp_serial:
+     return inline_timestamp(true);
+   case vmIntrinsics::_shipilev_magic_sizeOf:
+     return inline_sizeOf();
+   case vmIntrinsics::_shipilev_magic_addressOf:
+     return inline_addressOf();
+ 
    default:
      // If you get here, it may be that someone has added a new intrinsic
      // to the list in vmIntrinsics.hpp without implementing it here.
  #ifndef PRODUCT
      if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {

@@ -7639,17 +7648,28 @@
    Node* n = argument(0);
    set_result(n->is_Con() ? intcon(1) : intcon(0));
    return true;
  }
  
- //------------------------------- inline_getObjectSize --------------------------------------
+ //------------------------------- inline_getObjectSize/sizeOf --------------------------------------
  //
  // Calculate the runtime size of the object/array.
+ //
+ //   long java.lang.Runtime.sizeOf(Object obj)
  //   native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
  //
+ bool LibraryCallKit::inline_sizeOf() {
+   Node* obj = argument(0);
+   return inline_sizeOf_impl(obj);
+ }
+ 
  bool LibraryCallKit::inline_getObjectSize() {
    Node* obj = argument(3);
+   return inline_sizeOf_impl(obj);
+ }
+ 
+ bool LibraryCallKit::inline_sizeOf_impl(Node* obj) {
    Node* klass_node = load_object_klass(obj);
  
    jint  layout_con = Klass::_lh_neutral_value;
    Node* layout_val = get_layout_helper(klass_node, layout_con);
    int   layout_is_con = (layout_val == NULL);

@@ -7774,5 +7794,23 @@
      bh->add_req(argument(i));
    }
  
    return true;
  }
+ 
+ bool LibraryCallKit::inline_timestamp(bool serial) {
+   insert_mem_bar(Op_MemBarCPUOrder);
+   Node* node = serial ?
+           _gvn.transform(new TimestampSerialNode(control())) :
+           _gvn.transform(new TimestampNode(control()));
+   set_result(node);
+   insert_mem_bar(Op_MemBarCPUOrder);
+   return true;
+ }
+ 
+ bool LibraryCallKit::inline_addressOf() {
+   Node* obj = argument(0);
+   Node* raw_val = _gvn.transform(new CastP2XNode(NULL, obj));
+   Node* long_val = ConvX2L(raw_val);
+   set_result(long_val);
+   return true;
+ }
< prev index next >