hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
author never
Sat, 10 Sep 2011 00:11:04 -0700
changeset 10545 fec876499aae
parent 7397 5b173b4ca846
child 10565 dc90c239f4ec
permissions -rw-r--r--
7088020: SEGV in JNIHandleBlock::release_block Reviewed-by: kvn, twisti
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
5335
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
     3
 * Copyright 2007, 2008, 2010 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: 5424
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5424
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: 5424
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"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "asm/assembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "assembler_zero.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "interpreter/interpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "nativeInst_zero.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "oops/instanceOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "oops/methodOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "oops/objArrayKlass.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#include "prims/methodHandles.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
#include "runtime/frame.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    37
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    38
#include "runtime/sharedRuntime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    39
#include "runtime/stubCodeGenerator.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    40
#include "runtime/stubRoutines.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    41
#include "stack_zero.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    42
#include "utilities/top.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    43
#ifdef TARGET_OS_FAMILY_linux
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    44
# include "thread_linux.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    45
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    46
#ifdef COMPILER2
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    47
#include "opto/runtime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    48
#endif
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    49
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    50
// Declaration and definition of StubGenerator (no .hpp file).
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    51
// For a more detailed description of the stub routine structure
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    52
// see the comment in stubRoutines.hpp
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    53
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    54
class StubGenerator: public StubCodeGenerator {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    55
 private:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    56
  // The call stub is used to call Java from C
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    57
  static void call_stub(
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    58
    JavaCallWrapper *call_wrapper,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    59
    intptr_t*        result,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    60
    BasicType        result_type,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    61
    methodOop        method,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    62
    address          entry_point,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    63
    intptr_t*        parameters,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    64
    int              parameter_words,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    65
    TRAPS) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    66
    JavaThread *thread = (JavaThread *) THREAD;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    67
    ZeroStack *stack = thread->zero_stack();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    68
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    69
    // Make sure we have no pending exceptions
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    70
    assert(!HAS_PENDING_EXCEPTION, "call_stub called with pending exception");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    71
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    72
    // Set up the stack if necessary
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    73
    bool stack_needs_teardown = false;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    74
    if (stack->needs_setup()) {
5424
fc1c380199b0 6950178: Zero stack improvements
twisti
parents: 5335
diff changeset
    75
      size_t zero_stack_size = stack->suggest_size(thread);
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    76
      stack->setup(alloca(zero_stack_size), zero_stack_size);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    77
      stack_needs_teardown = true;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    78
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    79
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    80
    // Allocate and initialize our frame
5335
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    81
    EntryFrame *frame =
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    82
      EntryFrame::build(parameters, parameter_words, call_wrapper, THREAD);
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    83
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    84
    if (!HAS_PENDING_EXCEPTION) {
5335
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    85
      // Push the frame
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    86
      thread->push_zero_frame(frame);
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    87
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    88
      // Make the call
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    89
      Interpreter::invoke_method(method, entry_point, THREAD);
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    90
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    91
      // Store the result
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    92
      if (!HAS_PENDING_EXCEPTION) {
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    93
        switch (result_type) {
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    94
        case T_INT:
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    95
          *(jint *) result = *(jint *) stack->sp();
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    96
          break;
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    97
        case T_LONG:
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    98
          *(jlong *) result = *(jlong *) stack->sp();
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
    99
          break;
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   100
        case T_FLOAT:
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   101
          *(jfloat *) result = *(jfloat *) stack->sp();
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   102
          break;
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   103
        case T_DOUBLE:
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   104
          *(jdouble *) result = *(jdouble *) stack->sp();
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   105
          break;
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   106
        case T_OBJECT:
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   107
          *(oop *) result = *(oop *) stack->sp();
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   108
          break;
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   109
        default:
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   110
          ShouldNotReachHere();
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   111
        }
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   112
      }
5335
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   113
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   114
      // Unwind the frame
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   115
      thread->pop_zero_frame();
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   116
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   117
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   118
    // Tear down the stack if necessary
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   119
    if (stack_needs_teardown)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   120
      stack->teardown();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   121
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   122
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   123
  // These stubs get called from some dumb test routine.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   124
  // I'll write them properly when they're called from
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   125
  // something that's actually doing something.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   126
  static void fake_arraycopy_stub(address src, address dst, int count) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   127
    assert(count == 0, "huh?");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   128
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   129
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   130
  void generate_arraycopy_stubs() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   131
    // Call the conjoint generation methods immediately after
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   132
    // the disjoint ones so that short branches from the former
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   133
    // to the latter can be generated.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   134
    StubRoutines::_jbyte_disjoint_arraycopy  = (address) fake_arraycopy_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   135
    StubRoutines::_jbyte_arraycopy           = (address) fake_arraycopy_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   136
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   137
    StubRoutines::_jshort_disjoint_arraycopy = (address) fake_arraycopy_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   138
    StubRoutines::_jshort_arraycopy          = (address) fake_arraycopy_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   139
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   140
    StubRoutines::_jint_disjoint_arraycopy   = (address) fake_arraycopy_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   141
    StubRoutines::_jint_arraycopy            = (address) fake_arraycopy_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   142
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   143
    StubRoutines::_jlong_disjoint_arraycopy  = (address) fake_arraycopy_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   144
    StubRoutines::_jlong_arraycopy           = (address) fake_arraycopy_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   145
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   146
    StubRoutines::_oop_disjoint_arraycopy    = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   147
    StubRoutines::_oop_arraycopy             = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   148
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   149
    StubRoutines::_checkcast_arraycopy       = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   150
    StubRoutines::_unsafe_arraycopy          = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   151
    StubRoutines::_generic_arraycopy         = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   152
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   153
    // We don't generate specialized code for HeapWord-aligned source
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   154
    // arrays, so just use the code we've already generated
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   155
    StubRoutines::_arrayof_jbyte_disjoint_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   156
      StubRoutines::_jbyte_disjoint_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   157
    StubRoutines::_arrayof_jbyte_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   158
      StubRoutines::_jbyte_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   159
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   160
    StubRoutines::_arrayof_jshort_disjoint_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   161
      StubRoutines::_jshort_disjoint_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   162
    StubRoutines::_arrayof_jshort_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   163
      StubRoutines::_jshort_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   164
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   165
    StubRoutines::_arrayof_jint_disjoint_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   166
      StubRoutines::_jint_disjoint_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   167
    StubRoutines::_arrayof_jint_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   168
      StubRoutines::_jint_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   169
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   170
    StubRoutines::_arrayof_jlong_disjoint_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   171
      StubRoutines::_jlong_disjoint_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   172
    StubRoutines::_arrayof_jlong_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   173
      StubRoutines::_jlong_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   174
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   175
    StubRoutines::_arrayof_oop_disjoint_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   176
      StubRoutines::_oop_disjoint_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   177
    StubRoutines::_arrayof_oop_arraycopy =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   178
      StubRoutines::_oop_arraycopy;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   179
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   180
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   181
  void generate_initial() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   182
    // Generates all stubs and initializes the entry points
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   183
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   184
    // entry points that exist in all platforms Note: This is code
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   185
    // that could be shared among different platforms - however the
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   186
    // benefit seems to be smaller than the disadvantage of having a
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   187
    // much more complicated generator structure. See also comment in
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   188
    // stubRoutines.hpp.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   189
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   190
    StubRoutines::_forward_exception_entry   = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   191
    StubRoutines::_call_stub_entry           = (address) call_stub;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   192
    StubRoutines::_catch_exception_entry     = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   193
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   194
    // atomic calls
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   195
    StubRoutines::_atomic_xchg_entry         = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   196
    StubRoutines::_atomic_xchg_ptr_entry     = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   197
    StubRoutines::_atomic_cmpxchg_entry      = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   198
    StubRoutines::_atomic_cmpxchg_ptr_entry  = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   199
    StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   200
    StubRoutines::_atomic_add_entry          = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   201
    StubRoutines::_atomic_add_ptr_entry      = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   202
    StubRoutines::_fence_entry               = ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   203
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   204
    // amd64 does this here, sparc does it in generate_all()
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   205
    StubRoutines::_handler_for_unsafe_access_entry =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   206
      ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   207
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   208
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   209
  void generate_all() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   210
    // Generates all stubs and initializes the entry points
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   211
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   212
    // These entry points require SharedInfo::stack0 to be set up in
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   213
    // non-core builds and need to be relocatable, so they each
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   214
    // fabricate a RuntimeStub internally.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   215
    StubRoutines::_throw_AbstractMethodError_entry =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   216
      ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   217
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   218
    StubRoutines::_throw_NullPointerException_at_call_entry =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   219
      ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   220
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   221
    StubRoutines::_throw_StackOverflowError_entry =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   222
      ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   223
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   224
    // support for verify_oop (must happen after universe_init)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   225
    StubRoutines::_verify_oop_subroutine_entry =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   226
      ShouldNotCallThisStub();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   227
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   228
    // arraycopy stubs used by compilers
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   229
    generate_arraycopy_stubs();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   230
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   231
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   232
 public:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   233
  StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   234
    if (all) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   235
      generate_all();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   236
    } else {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   237
      generate_initial();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   238
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   239
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   240
};
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   241
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   242
void StubGenerator_generate(CodeBuffer* code, bool all) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   243
  StubGenerator g(code, all);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   244
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   245
5335
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   246
EntryFrame *EntryFrame::build(const intptr_t*  parameters,
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   247
                              int              parameter_words,
5335
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   248
                              JavaCallWrapper* call_wrapper,
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   249
                              TRAPS) {
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   250
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   251
  ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack();
4319cb12ddfe 6941224: Improved stack overflow handling for Zero
twisti
parents: 4013
diff changeset
   252
  stack->overflow_check(header_words + parameter_words, CHECK_NULL);
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   253
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   254
  stack->push(0); // next_frame, filled in later
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   255
  intptr_t *fp = stack->sp();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   256
  assert(fp - stack->sp() == next_frame_off, "should be");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   257
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   258
  stack->push(ENTRY_FRAME);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   259
  assert(fp - stack->sp() == frame_type_off, "should be");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   260
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   261
  stack->push((intptr_t) call_wrapper);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   262
  assert(fp - stack->sp() == call_wrapper_off, "should be");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   263
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   264
  for (int i = 0; i < parameter_words; i++)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   265
    stack->push(parameters[i]);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   266
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   267
  return (EntryFrame *) fp;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   268
}