< prev index next >

src/hotspot/share/opto/graphKit.cpp

Print this page
*** 2586,26 ***
    return _gvn.transform(new RShiftINode(tmp, _gvn.intcon(16)));
  }
  
  //-----------------------------make_native_call-------------------------------
  Node* GraphKit::make_native_call(address call_addr, const TypeFunc* call_type, uint nargs, ciNativeEntryPoint* nep) {
    // Select just the actual call args to pass on
!   // [MethodHandle fallback, long addr, HALF addr, ... args , NativeEntryPoint nep]
!   //                                             |          |
!   //                                             V          V
!   //                                             [ ... args ]
!   uint n_filtered_args = nargs - 4; // -fallback, -addr (2), -nep;
    ResourceMark rm;
    Node** argument_nodes = NEW_RESOURCE_ARRAY(Node*, n_filtered_args);
    const Type** arg_types = TypeTuple::fields(n_filtered_args);
    GrowableArray<VMReg> arg_regs(C->comp_arena(), n_filtered_args, n_filtered_args, VMRegImpl::Bad());
  
    VMReg* argRegs = nep->argMoves();
    {
      for (uint vm_arg_pos = 0, java_arg_read_pos = 0;
          vm_arg_pos < n_filtered_args; vm_arg_pos++) {
!       uint vm_unfiltered_arg_pos = vm_arg_pos + 3; // +3 to skip fallback handle argument and addr (2 since long)
        Node* node = argument(vm_unfiltered_arg_pos);
        const Type* type = call_type->domain()->field_at(TypeFunc::Parms + vm_unfiltered_arg_pos);
        VMReg reg = type == Type::HALF
          ? VMRegImpl::Bad()
          : argRegs[java_arg_read_pos++];
--- 2586,28 ---
    return _gvn.transform(new RShiftINode(tmp, _gvn.intcon(16)));
  }
  
  //-----------------------------make_native_call-------------------------------
  Node* GraphKit::make_native_call(address call_addr, const TypeFunc* call_type, uint nargs, ciNativeEntryPoint* nep) {
+   assert(!nep->need_transition(), "only trivial calls");
+ 
    // Select just the actual call args to pass on
!   // [long addr, HALF addr, ... args , NativeEntryPoint nep]
!   //                      |          |
!   //                      V          V
!   //                      [ ... args ]
!   uint n_filtered_args = nargs - 3; // -addr (2), -nep;
    ResourceMark rm;
    Node** argument_nodes = NEW_RESOURCE_ARRAY(Node*, n_filtered_args);
    const Type** arg_types = TypeTuple::fields(n_filtered_args);
    GrowableArray<VMReg> arg_regs(C->comp_arena(), n_filtered_args, n_filtered_args, VMRegImpl::Bad());
  
    VMReg* argRegs = nep->argMoves();
    {
      for (uint vm_arg_pos = 0, java_arg_read_pos = 0;
          vm_arg_pos < n_filtered_args; vm_arg_pos++) {
!       uint vm_unfiltered_arg_pos = vm_arg_pos + 2; // +2 to skip addr (2 since long)
        Node* node = argument(vm_unfiltered_arg_pos);
        const Type* type = call_type->domain()->field_at(TypeFunc::Parms + vm_unfiltered_arg_pos);
        VMReg reg = type == Type::HALF
          ? VMRegImpl::Bad()
          : argRegs[java_arg_read_pos++];

*** 2637,32 ***
    const TypeFunc* new_call_type = TypeFunc::make(
      TypeTuple::make(TypeFunc::Parms + n_filtered_args, arg_types),
      TypeTuple::make(TypeFunc::Parms + n_returns, ret_types)
    );
  
!   if (nep->need_transition()) {
!     RuntimeStub* invoker = SharedRuntime::make_native_invoker(call_addr,
!                                                               nep->shadow_space(),
!                                                               arg_regs, ret_regs);
-     if (invoker == NULL) {
-       C->record_failure("native invoker not implemented on this platform");
-       return NULL;
-     }
-     C->add_native_invoker(invoker);
-     call_addr = invoker->code_begin();
-   }
-   assert(call_addr != NULL, "sanity");
  
!   CallNativeNode* call = new CallNativeNode(new_call_type, call_addr, nep->name(), TypePtr::BOTTOM,
-                                             arg_regs,
-                                             ret_regs,
-                                             nep->shadow_space(),
-                                             nep->need_transition());
- 
-   if (call->_need_transition) {
-     add_safepoint_edges(call);
-   }
  
    set_predefined_input_for_runtime_call(call);
  
    for (uint i = 0; i < n_filtered_args; i++) {
      call->init_req(i + TypeFunc::Parms, argument_nodes[i]);
--- 2639,16 ---
    const TypeFunc* new_call_type = TypeFunc::make(
      TypeTuple::make(TypeFunc::Parms + n_filtered_args, arg_types),
      TypeTuple::make(TypeFunc::Parms + n_returns, ret_types)
    );
  
!   CallNode* call = new CallNativeNode(new_call_type, call_addr, nep->name(), TypePtr::BOTTOM,
!                             arg_regs,
!                             ret_regs,
!                             nep->shadow_space());
  
!   assert(call != nullptr, "'call' was not set");
  
    set_predefined_input_for_runtime_call(call);
  
    for (uint i = 0; i < n_filtered_args; i++) {
      call->init_req(i + TypeFunc::Parms, argument_nodes[i]);
< prev index next >