src/hotspot/cpu/zero/methodHandles_zero.cpp
author ihse
Mon, 26 Nov 2018 14:18:22 +0100
branchihse-manpages-branch
changeset 57043 23d7457ca4c6
parent 50736 f703d45c5687
permissions -rw-r--r--
Clean up login in when running which kind of man page creation.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     1
/*
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49390
diff changeset
     2
 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
9136
94ebba447157 7035870: JSR 292: Zero support
twisti
parents: 7397
diff changeset
     3
 * Copyright 2009, 2010, 2011 Red Hat, Inc.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     5
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     8
 * published by the Free Software Foundation.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     9
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    14
 * accompanied this code).
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    15
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    19
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5423
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5423
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5423
diff changeset
    22
 * questions.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    23
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    24
 */
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    25
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "precompiled.hpp"
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 30282
diff changeset
    27
#include "interpreter/cppInterpreterGenerator.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "interpreter/interpreter.hpp"
50736
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    29
#include "interpreter/interpreterRuntime.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "memory/allocation.inline.hpp"
37248
11a660dbbb8e 8132524: Missing includes to resourceArea.hpp
jprovino
parents: 35214
diff changeset
    31
#include "memory/resourceArea.hpp"
49390
95f0b54a3024 8199220: Zero build broken after 8195103, 8191102 and 8189871
enevill
parents: 48706
diff changeset
    32
#include "oops/method.inline.hpp"
30282
6bc6bcda7c91 8078504: Zero fails to build
sgehwolf
parents: 30118
diff changeset
    33
#include "oops/oop.inline.hpp"
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49390
diff changeset
    34
#include "runtime/frame.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#include "prims/methodHandles.hpp"
5230
6eae8e0ade26 6939731: JSR 292 Zero build fix after 6934494
twisti
parents: 4013
diff changeset
    36
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    37
void MethodHandles::invoke_target(Method* method, TRAPS) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    38
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    39
  JavaThread *thread = (JavaThread *) THREAD;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    40
  ZeroStack *stack = thread->zero_stack();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    41
  InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    42
  interpreterState istate = frame->interpreter_state();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    43
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    44
  // Trim back the stack to put the parameters at the top
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    45
  stack->set_sp(istate->stack() + 1);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    46
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    47
  Interpreter::invoke_method(method, method->from_interpreted_entry(), THREAD);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    48
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    49
  // Convert the result
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    50
  istate->set_stack(stack->sp() - 1);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    51
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    52
}
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    53
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    54
oop MethodHandles::popFromStack(TRAPS) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    55
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    56
  JavaThread *thread = (JavaThread *) THREAD;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    57
  InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    58
  interpreterState istate = frame->interpreter_state();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    59
  intptr_t* topOfStack = istate->stack();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    60
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    61
  oop top = STACK_OBJECT(-1);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    62
  MORE_STACK(-1);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    63
  istate->set_stack(topOfStack);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    64
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    65
  return top;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    66
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    67
}
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
    68
50736
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    69
void MethodHandles::throw_AME(Klass* rcvr, Method* interface_method, TRAPS) {
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    70
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    71
  JavaThread *thread = (JavaThread *) THREAD;
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    72
  // Set up the frame anchor if it isn't already
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    73
  bool has_last_Java_frame = thread->has_last_Java_frame();
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    74
  if (!has_last_Java_frame) {
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    75
    intptr_t *sp = thread->zero_stack()->sp();
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    76
    ZeroFrame *frame = thread->top_zero_frame();
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    77
    while (frame) {
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    78
      if (frame->is_interpreter_frame()) {
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    79
        interpreterState istate =
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    80
          frame->as_interpreter_frame()->interpreter_state();
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    81
        if (istate->self_link() == istate)
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    82
          break;
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    83
      }
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    84
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    85
      sp = ((intptr_t *) frame) + 1;
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    86
      frame = frame->next();
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    87
    }
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    88
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    89
    assert(frame != NULL, "must be");
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    90
    thread->set_last_Java_frame(frame, sp);
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    91
  }
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    92
  InterpreterRuntime::throw_AbstractMethodErrorVerbose(thread, rcvr, interface_method);
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    93
  // Reset the frame anchor if necessary
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    94
  if (!has_last_Java_frame) {
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    95
    thread->reset_last_Java_frame();
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    96
  }
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    97
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    98
}
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
    99
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   100
int MethodHandles::method_handle_entry_invokeBasic(Method* method, intptr_t UNUSED, TRAPS) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   101
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   102
  JavaThread *thread = (JavaThread *) THREAD;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   103
  InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   104
  interpreterState istate = frame->interpreter_state();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   105
  intptr_t* topOfStack = istate->stack();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   106
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   107
  // 'this' is a MethodHandle. We resolve the target method by accessing this.form.vmentry.vmtarget.
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   108
  int numArgs = method->size_of_parameters();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   109
  oop lform1 = java_lang_invoke_MethodHandle::form(STACK_OBJECT(-numArgs)); // this.form
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   110
  oop vmEntry1 = java_lang_invoke_LambdaForm::vmentry(lform1);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   111
  Method* vmtarget = (Method*) java_lang_invoke_MemberName::vmtarget(vmEntry1);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   112
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   113
  invoke_target(vmtarget, THREAD);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   114
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   115
  // No deoptimized frames on the stack
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   116
  return 0;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   117
}
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   118
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   119
int MethodHandles::method_handle_entry_linkToStaticOrSpecial(Method* method, intptr_t UNUSED, TRAPS) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   120
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   121
  // Pop appendix argument from stack. This is a MemberName which we resolve to the
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   122
  // target method.
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   123
  oop vmentry = popFromStack(THREAD);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   124
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   125
  Method* vmtarget = (Method*) java_lang_invoke_MemberName::vmtarget(vmentry);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   126
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   127
  invoke_target(vmtarget, THREAD);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   128
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   129
  return 0;
5423
e137714b888e 6949830: 6939134 broke Zero
twisti
parents: 5230
diff changeset
   130
}
e137714b888e 6949830: 6939134 broke Zero
twisti
parents: 5230
diff changeset
   131
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   132
int MethodHandles::method_handle_entry_linkToInterface(Method* method, intptr_t UNUSED, TRAPS) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   133
  JavaThread *thread = (JavaThread *) THREAD;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   134
  InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   135
  interpreterState istate = frame->interpreter_state();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   136
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   137
  // Pop appendix argument from stack. This is a MemberName which we resolve to the
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   138
  // target method.
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   139
  oop vmentry = popFromStack(THREAD);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   140
  intptr_t* topOfStack = istate->stack();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   141
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   142
  // Resolve target method by looking up in the receiver object's itable.
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   143
  Klass* clazz = java_lang_Class::as_Klass(java_lang_invoke_MemberName::clazz(vmentry));
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   144
  intptr_t vmindex = java_lang_invoke_MemberName::vmindex(vmentry);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   145
  Method* target = (Method*) java_lang_invoke_MemberName::vmtarget(vmentry);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   146
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   147
  int numArgs = target->size_of_parameters();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   148
  oop recv = STACK_OBJECT(-numArgs);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   149
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   150
  InstanceKlass* klass_part = InstanceKlass::cast(recv->klass());
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   151
  itableOffsetEntry* ki = (itableOffsetEntry*) klass_part->start_of_itable();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   152
  int i;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   153
  for ( i = 0 ; i < klass_part->itable_length() ; i++, ki++ ) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   154
    if (ki->interface_klass() == clazz) break;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   155
  }
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   156
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   157
  itableMethodEntry* im = ki->first_method_entry(recv->klass());
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   158
  Method* vmtarget = im[vmindex].method();
50736
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   159
  // Check that the vmtarget entry is non-null.  A null entry means
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   160
  // that the method no longer exists (got deleted) or is private.
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   161
  // Private class methods can never be an implementation of an
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   162
  // interface method. In those cases, throw AME.
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   163
  if (vmtarget != NULL) {
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   164
    invoke_target(vmtarget, THREAD);
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   165
  } else {
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   166
    throw_AME(recv->klass(), target, THREAD);
f703d45c5687 8203188: Add JEP-181 support to the Zero interpreter
sgehwolf
parents: 49480
diff changeset
   167
  }
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   168
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   169
  return 0;
5230
6eae8e0ade26 6939731: JSR 292 Zero build fix after 6934494
twisti
parents: 4013
diff changeset
   170
}
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   171
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   172
int MethodHandles::method_handle_entry_linkToVirtual(Method* method, intptr_t UNUSED, TRAPS) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   173
  JavaThread *thread = (JavaThread *) THREAD;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   174
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   175
  InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   176
  interpreterState istate = frame->interpreter_state();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   177
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   178
  // Pop appendix argument from stack. This is a MemberName which we resolve to the
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   179
  // target method.
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   180
  oop vmentry = popFromStack(THREAD);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   181
  intptr_t* topOfStack = istate->stack();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   182
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   183
  // Resolve target method by looking up in the receiver object's vtable.
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   184
  intptr_t vmindex = java_lang_invoke_MemberName::vmindex(vmentry);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   185
  Method* target = (Method*) java_lang_invoke_MemberName::vmtarget(vmentry);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   186
  int numArgs = target->size_of_parameters();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   187
  oop recv = STACK_OBJECT(-numArgs);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   188
  Klass* clazz = recv->klass();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   189
  Klass* klass_part = InstanceKlass::cast(clazz);
30118
dadad0daaab4 8075967: Zero interpreter asserts for SafeFetch<32,N> calls in ObjectMonitor
coleenp
parents: 14294
diff changeset
   190
  ResourceMark rm(THREAD);
46724
a4653c2a4e65 8185263: Fix zero build after 8169881, 8175318, 8178350
stuefe
parents: 37248
diff changeset
   191
  klassVtable vtable = klass_part->vtable();
a4653c2a4e65 8185263: Fix zero build after 8169881, 8175318, 8178350
stuefe
parents: 37248
diff changeset
   192
  Method* vmtarget = vtable.method_at(vmindex);
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   193
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   194
  invoke_target(vmtarget, THREAD);
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   195
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   196
  return 0;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   197
}
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   198
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   199
int MethodHandles::method_handle_entry_invalid(Method* method, intptr_t UNUSED, TRAPS) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   200
  ShouldNotReachHere();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   201
  return 0;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   202
}
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   203
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   204
address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* masm,
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   205
                                                                vmIntrinsics::ID iid) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   206
  switch (iid) {
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   207
  case vmIntrinsics::_invokeGeneric:
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   208
  case vmIntrinsics::_compiledLambdaForm:
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   209
    // Perhaps surprisingly, the symbolic references visible to Java are not directly used.
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   210
    // They are linked to Java-generated adapters via MethodHandleNatives.linkMethod.
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   211
    // They all allow an appendix argument.
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 30282
diff changeset
   212
    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invalid);
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   213
  case vmIntrinsics::_invokeBasic:
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 30282
diff changeset
   214
    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_invokeBasic);
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   215
  case vmIntrinsics::_linkToStatic:
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   216
  case vmIntrinsics::_linkToSpecial:
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 30282
diff changeset
   217
    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToStaticOrSpecial);
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   218
  case vmIntrinsics::_linkToInterface:
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 30282
diff changeset
   219
    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToInterface);
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   220
  case vmIntrinsics::_linkToVirtual:
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 30282
diff changeset
   221
    return CppInterpreterGenerator::generate_entry_impl(masm, (address) MethodHandles::method_handle_entry_linkToVirtual);
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   222
  default:
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   223
    ShouldNotReachHere();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   224
    return NULL;
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   225
  }
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9136
diff changeset
   226
}
48706
69d1a1590485 8194739: Zero port of 8174962: Better interface invocations
aph
parents: 47216
diff changeset
   227
69d1a1590485 8194739: Zero port of 8174962: Better interface invocations
aph
parents: 47216
diff changeset
   228
#ifndef PRODUCT
69d1a1590485 8194739: Zero port of 8174962: Better interface invocations
aph
parents: 47216
diff changeset
   229
void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) {
69d1a1590485 8194739: Zero port of 8174962: Better interface invocations
aph
parents: 47216
diff changeset
   230
  // This is just a stub.
69d1a1590485 8194739: Zero port of 8174962: Better interface invocations
aph
parents: 47216
diff changeset
   231
}
69d1a1590485 8194739: Zero port of 8174962: Better interface invocations
aph
parents: 47216
diff changeset
   232
#endif //PRODUCT