< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page
@@ -723,10 +723,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) {

@@ -7643,17 +7652,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);

@@ -7769,14 +7789,39 @@
  bool LibraryCallKit::inline_blackhole() {
    assert(callee()->is_static(), "Should have been checked before: only static methods here");
    assert(callee()->is_empty(), "Should have been checked before: only empty methods here");
    assert(callee()->holder()->is_loaded(), "Should have been checked before: only methods for loaded classes here");
  
+   // Blackhole node pinches only the control, not memory. This allows
+   // the blackhole to be pinned in the loop that computes blackholed
+   // values, but have no other side effects, like breaking the optimizations
+   // across the blackhole.
+ 
+   Node* bh = _gvn.transform(new BlackholeNode(control()));
+   set_control(_gvn.transform(new ProjNode(bh, TypeFunc::Control)));
+ 
    // Bind call arguments as blackhole arguments to keep them alive
-   Node* bh = insert_mem_bar(Op_Blackhole);
    uint nargs = callee()->arg_size();
    for (uint i = 0; i < nargs; i++) {
      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 >