hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp
author stefank
Tue, 04 Jul 2017 15:58:10 +0200
changeset 46619 a3919f5e8d2b
parent 46381 020219e46c86
child 46620 750c6edff33b
permissions -rw-r--r--
8178499: Remove _ptr_ and _size_ infixes from align functions Reviewed-by: rehn, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
43449
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
     2
 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5046
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    26
#include "c1/c1_Defs.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    27
#include "c1/c1_MacroAssembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    28
#include "c1/c1_Runtime1.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    29
#include "interpreter/interpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    30
#include "nativeInst_sparc.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
    31
#include "oops/compiledICHolder.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    32
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    33
#include "prims/jvmtiExport.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    34
#include "runtime/sharedRuntime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    35
#include "runtime/signature.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    36
#include "runtime/vframeArray.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13728
diff changeset
    37
#include "utilities/macros.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    38
#include "vmreg_sparc.inline.hpp"
20403
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
    39
#if INCLUDE_ALL_GCS
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 29325
diff changeset
    40
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
20403
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
    41
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// Implementation of StubAssembler
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
    45
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // for sparc changing the number of arguments doesn't change
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  // anything about the frame size so we'll always lie and claim that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  // we are only passing 1 argument.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  set_num_rt_args(1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  assert_not_delayed();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  // bang stack before going to runtime
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  set(-os::vm_page_size() + STACK_BIAS, G3_scratch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  st(G0, SP, G3_scratch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // debugging support
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  assert(number_of_arguments >= 0   , "cannot have negative number of arguments");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  set_last_Java_frame(SP, noreg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  if (VerifyThread)  mov(G2_thread, O0); // about to be smashed; pass early
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  save_thread(L7_thread_cache);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // do the call
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  call(entry_point, relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  if (!VerifyThread) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    delayed()->mov(G2_thread, O0);  // pass thread as first argument
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    delayed()->nop();             // (thread already passed)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  int call_offset = offset();  // offset of return address
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  restore_thread(L7_thread_cache);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  reset_last_Java_frame();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  // check for pending exceptions
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  { Label L;
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
    75
    Address exception_addr(G2_thread, Thread::pending_exception_offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    ld_ptr(exception_addr, Gtemp);
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8495
diff changeset
    77
    br_null_short(Gtemp, pt, L);
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
    78
    Address vm_result_addr(G2_thread, JavaThread::vm_result_offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    st_ptr(G0, vm_result_addr);
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
    80
    Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    st_ptr(G0, vm_result_addr_2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    if (frame_size() == no_frame_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
      // we use O7 linkage so that forward_exception_entry has the issuing PC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
      call(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
      delayed()->restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    } else if (_stub_id == Runtime1::forward_exception_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
      should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    } else {
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
    90
      AddressLiteral exc(Runtime1::entry_for(Runtime1::forward_exception_id));
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
    91
      jump_to(exc, G4);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
      delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    bind(L);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  // get oop result if there is one and reset the value in the thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  if (oop_result1->is_valid()) {                    // get oop result if there is one and reset it in the thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    get_vm_result  (oop_result1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    // be a little paranoid and clear the result
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
   102
    Address vm_result_addr(G2_thread, JavaThread::vm_result_offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    st_ptr(G0, vm_result_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   106
  // get second result if there is one and reset the value in the thread
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   107
  if (metadata_result->is_valid()) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   108
    get_vm_result_2  (metadata_result);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    // be a little paranoid and clear the result
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
   111
    Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    st_ptr(G0, vm_result_addr_2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  return call_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   119
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  // O0 is reserved for the thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  mov(arg1, O1);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   122
  return call_RT(oop_result1, metadata_result, entry, 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   126
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  // O0 is reserved for the thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  mov(arg1, O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  mov(arg2, O2); assert(arg2 != O1, "smashed argument");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   130
  return call_RT(oop_result1, metadata_result, entry, 2);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   134
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  // O0 is reserved for the thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  mov(arg1, O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  mov(arg2, O2); assert(arg2 != O1,               "smashed argument");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  mov(arg3, O3); assert(arg3 != O1 && arg3 != O2, "smashed argument");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   139
  return call_RT(oop_result1, metadata_result, entry, 3);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
// Implementation of Runtime1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
#define __ sasm->
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
static int cpu_reg_save_offsets[FrameMap::nof_cpu_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
static int fpu_reg_save_offsets[FrameMap::nof_fpu_regs];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
static int reg_save_size_in_words;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
static int frame_size_in_bytes = -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
static OopMap* generate_oop_map(StubAssembler* sasm, bool save_fpu_registers) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words),
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   154
         "mismatch in calculation");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  int frame_size_in_slots = frame_size_in_bytes / sizeof(jint);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  OopMap* oop_map = new OopMap(frame_size_in_slots, 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  int i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  for (i = 0; i < FrameMap::nof_cpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    Register r = as_Register(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    if (r == G1 || r == G3 || r == G4 || r == G5) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
      int sp_offset = cpu_reg_save_offsets[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
      oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
                                r->as_VMReg());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  if (save_fpu_registers) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    for (i = 0; i < FrameMap::nof_fpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
      FloatRegister r = as_FloatRegister(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
      int sp_offset = fpu_reg_save_offsets[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
      oop_map->set_callee_saved(VMRegImpl::stack2reg(sp_offset),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
                                r->as_VMReg());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  return oop_map;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers = true) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  assert(frame_size_in_bytes == __ total_frame_size_in_bytes(reg_save_size_in_words),
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   182
         "mismatch in calculation");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  __ save_frame_c1(frame_size_in_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  // Record volatile registers as callee-save values in an OopMap so their save locations will be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  // propagated to the caller frame's RegisterMap during StackFrameStream construction (needed for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  // deoptimization; see compiledVFrame::create_stack_value).  The caller's I, L and O registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  // are saved in register windows - I's and L's in the caller's frame and O's in the stub frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  // (as the stub's I's) when the runtime routine called by the stub creates its frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  // OopMap frame sizes are in c2 stack slot sizes (sizeof(jint))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  int i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  for (i = 0; i < FrameMap::nof_cpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    Register r = as_Register(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    if (r == G1 || r == G3 || r == G4 || r == G5) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
      int sp_offset = cpu_reg_save_offsets[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
      __ st_ptr(r, SP, (sp_offset * BytesPerWord) + STACK_BIAS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  if (save_fpu_registers) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    for (i = 0; i < FrameMap::nof_fpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
      FloatRegister r = as_FloatRegister(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
      int sp_offset = fpu_reg_save_offsets[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
      __ stf(FloatRegisterImpl::S, r, SP, (sp_offset * BytesPerWord) + STACK_BIAS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  return generate_oop_map(sasm, save_fpu_registers);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
static void restore_live_registers(StubAssembler* sasm, bool restore_fpu_registers = true) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  for (int i = 0; i < FrameMap::nof_cpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    Register r = as_Register(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    if (r == G1 || r == G3 || r == G4 || r == G5) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
      __ ld_ptr(SP, (cpu_reg_save_offsets[i] * BytesPerWord) + STACK_BIAS, r);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  if (restore_fpu_registers) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
    for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
      FloatRegister r = as_FloatRegister(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
      __ ldf(FloatRegisterImpl::S, SP, (fpu_reg_save_offsets[i] * BytesPerWord) + STACK_BIAS, r);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
void Runtime1::initialize_pd() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  // compute word offsets from SP at which live (non-windowed) registers are captured by stub routines
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  // A stub routine will have a frame that is at least large enough to hold
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  // a register window save area (obviously) and the volatile g registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  // and floating registers. A user of save_live_registers can have a frame
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  // that has more scratch area in it (although typically they will use L-regs).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  // in that case the frame will look like this (stack growing down)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  // FP -> |             |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  //       | scratch mem |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  //       |   "      "  |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  //       --------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  //       | float regs  |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  //       |   "    "    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  //       ---------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  //       | G regs      |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  //       | "  "        |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  //       ---------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  //       | abi reg.    |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  //       | window save |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  //       | area        |
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  // SP -> ---------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  int i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  int sp_offset = round_to(frame::register_save_words, 2); //  start doubleword aligned
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  // only G int registers are saved explicitly; others are found in register windows
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  for (i = 0; i < FrameMap::nof_cpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
    Register r = as_Register(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
    if (r == G1 || r == G3 || r == G4 || r == G5) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
      cpu_reg_save_offsets[i] = sp_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
      sp_offset++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  // all float registers are saved explicitly
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  assert(FrameMap::nof_fpu_regs == 32, "double registers not handled here");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  for (i = 0; i < FrameMap::nof_fpu_regs; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
    fpu_reg_save_offsets[i] = sp_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
    sp_offset++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  reg_save_size_in_words = sp_offset - frame::memory_parameter_word_sp_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  // this should match assembler::total_frame_size_in_bytes, which
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  // isn't callable from this context.  It's checked by an assert when
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  // it's used though.
46619
a3919f5e8d2b 8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents: 46381
diff changeset
   275
  frame_size_in_bytes = align_up(sp_offset * wordSize, 8);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
OopMapSet* Runtime1::generate_exception_throw(StubAssembler* sasm, address target, bool has_argument) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  // make a frame and preserve the caller's caller-save registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  OopMap* oop_map = save_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  int call_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  if (!has_argument) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
    call_offset = __ call_RT(noreg, noreg, target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
    call_offset = __ call_RT(noreg, noreg, target, G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  OopMapSet* oop_maps = new OopMapSet();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  oop_maps->add_gc_map(call_offset, oop_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  return oop_maps;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
OopMapSet* Runtime1::generate_stub_call(StubAssembler* sasm, Register result, address target,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
                                        Register arg1, Register arg2, Register arg3) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  // make a frame and preserve the caller's caller-save registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  OopMap* oop_map = save_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  int call_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  if (arg1 == noreg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
    call_offset = __ call_RT(result, noreg, target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  } else if (arg2 == noreg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
    call_offset = __ call_RT(result, noreg, target, arg1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  } else if (arg3 == noreg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
    call_offset = __ call_RT(result, noreg, target, arg1, arg2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
    call_offset = __ call_RT(result, noreg, target, arg1, arg2, arg3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  OopMapSet* oop_maps = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  oop_maps = new OopMapSet();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  oop_maps->add_gc_map(call_offset, oop_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  restore_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  __ ret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  __ delayed()->restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  return oop_maps;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  // make a frame and preserve the caller's caller-save registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  OopMap* oop_map = save_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  // call the runtime patching routine, returns non-zero if nmethod got deopted.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  int call_offset = __ call_RT(noreg, noreg, target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  OopMapSet* oop_maps = new OopMapSet();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  oop_maps->add_gc_map(call_offset, oop_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  // re-execute the patched instruction or, if the nmethod was deoptmized, return to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  // deoptimization handler entry that will cause re-execution of the current bytecode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  assert(deopt_blob != NULL, "deoptimization blob must have been created");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  Label no_deopt;
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8495
diff changeset
   339
  __ br_null_short(O0, Assembler::pt, no_deopt);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  // return to the deoptimization handler entry for unpacking and rexecute
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  // if we simply returned the we'd deopt as if any call we patched had just
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  // returned.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  restore_live_registers(sasm);
7927
553d29e6d40c 7013812: C1: deopt blob too far from patching stub
iveresov
parents: 7898
diff changeset
   346
553d29e6d40c 7013812: C1: deopt blob too far from patching stub
iveresov
parents: 7898
diff changeset
   347
  AddressLiteral dest(deopt_blob->unpack_with_reexecution());
553d29e6d40c 7013812: C1: deopt blob too far from patching stub
iveresov
parents: 7898
diff changeset
   348
  __ jump_to(dest, O0);
553d29e6d40c 7013812: C1: deopt blob too far from patching stub
iveresov
parents: 7898
diff changeset
   349
  __ delayed()->restore();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  __ bind(no_deopt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
  restore_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
  __ ret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  __ delayed()->restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  return oop_maps;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  OopMapSet* oop_maps = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
  // for better readability
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
  const bool must_gc_arguments = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
  const bool dont_gc_arguments = false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  // stub code & info for the different stubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
  switch (id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
    case forward_exception_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
      {
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   370
        oop_maps = generate_handle_exception(id, sasm);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
    case new_instance_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    case fast_new_instance_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
    case fast_new_instance_init_check_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
        Register G5_klass = G5; // Incoming
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
        Register O0_obj   = O0; // Outgoing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
        if (id == new_instance_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
          __ set_info("new_instance", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
        } else if (id == fast_new_instance_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
          __ set_info("fast new_instance", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
          assert(id == fast_new_instance_init_check_id, "bad StubID");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
          __ set_info("fast new_instance init check", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
        if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
            UseTLAB && FastTLABRefill) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
          Label slow_path;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
          Register G1_obj_size = G1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
          Register G3_t1 = G3;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
          Register G4_t2 = G4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
          assert_different_registers(G5_klass, G1_obj_size, G3_t1, G4_t2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
          // Push a frame since we may do dtrace notification for the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
          // allocation which requires calling out and we don't want
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
          // to stomp the real return address.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
          __ save_frame(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
          if (id == fast_new_instance_init_check_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
            // make sure the klass is initialized
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   405
            __ ldub(G5_klass, in_bytes(InstanceKlass::init_state_offset()), G3_t1);
21088
4f0ada6dcace 8008242: VerifyOops is broken on SPARC
morris
parents: 20710
diff changeset
   406
            __ cmp(G3_t1, InstanceKlass::fully_initialized);
4f0ada6dcace 8008242: VerifyOops is broken on SPARC
morris
parents: 20710
diff changeset
   407
            __ br(Assembler::notEqual, false, Assembler::pn, slow_path);
4f0ada6dcace 8008242: VerifyOops is broken on SPARC
morris
parents: 20710
diff changeset
   408
            __ delayed()->nop();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
          // assert object can be fast path allocated
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
          {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
            Label ok, not_ok;
11430
718fc06da49a 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 10972
diff changeset
   414
          __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8495
diff changeset
   415
          // make sure it's an instance (LH > 0)
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8495
diff changeset
   416
          __ cmp_and_br_short(G1_obj_size, 0, Assembler::lessEqual, Assembler::pn, not_ok);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
          __ btst(Klass::_lh_instance_slow_path_bit, G1_obj_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
          __ br(Assembler::zero, false, Assembler::pn, ok);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
          __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
          __ bind(not_ok);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
          __ stop("assert(can be fast path allocated)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
          __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
          __ bind(ok);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
          }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
          // if we got here then the TLAB allocation failed, so try
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
          // refilling the TLAB or allocating directly from eden.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
          Label retry_tlab, try_eden;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
          __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G5_klass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
          __ bind(retry_tlab);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
          // get the instance size
11430
718fc06da49a 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 10972
diff changeset
   434
          __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7427
diff changeset
   435
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
          __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7427
diff changeset
   437
35548
8d3afe96ffea 8086053: Address inconsistencies regarding ZeroTLAB
zmajo
parents: 34148
diff changeset
   438
          __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2, /* is_tlab_allocated */ true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
          __ verify_oop(O0_obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
          __ mov(O0, I0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
          __ ret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
          __ delayed()->restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
          __ bind(try_eden);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
          // get the instance size
11430
718fc06da49a 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 10972
diff changeset
   446
          __ ld(G5_klass, in_bytes(Klass::layout_helper_offset()), G1_obj_size);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
          __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path);
7898
729a02451b8a 7011463: Sparc MacroAssembler::incr_allocated_bytes() needs a RegisterOrConstant argument
phh
parents: 7724
diff changeset
   448
          __ incr_allocated_bytes(G1_obj_size, G3_t1, G4_t2);
7724
a92d706dbdd5 7003271: Hotspot should track cumulative Java heap bytes allocated on a per-thread basis
phh
parents: 7427
diff changeset
   449
35548
8d3afe96ffea 8086053: Address inconsistencies regarding ZeroTLAB
zmajo
parents: 34148
diff changeset
   450
          __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2, /* is_tlab_allocated */ false);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
          __ verify_oop(O0_obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
          __ mov(O0, I0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
          __ ret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
          __ delayed()->restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
          __ bind(slow_path);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
          // pop this frame so generate_stub_call can push it's own
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
          __ restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
        oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_instance), G5_klass);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
        // I0->O0: new instance
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
    case counter_overflow_id:
6453
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   469
        // G4 contains bci, G5 contains method
970dc585ab63 6953144: Tiered compilation
iveresov
parents: 6176
diff changeset
   470
      oop_maps = generate_stub_call(sasm, noreg, CAST_FROM_FN_PTR(address, counter_overflow), G4, G5);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
    case new_type_array_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
    case new_object_array_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
        Register G5_klass = G5; // Incoming
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
        Register G4_length = G4; // Incoming
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
        Register O0_obj   = O0; // Outgoing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
11430
718fc06da49a 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 10972
diff changeset
   480
        Address klass_lh(G5_klass, Klass::layout_helper_offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
        assert(Klass::_lh_header_size_shift % BitsPerByte == 0, "bytewise");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
        assert(Klass::_lh_header_size_mask == 0xFF, "bytewise");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
        // Use this offset to pick out an individual byte of the layout_helper:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
        const int klass_lh_header_size_offset = ((BytesPerInt - 1)  // 3 - 2 selects byte {0,1,0,0}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
                                                 - Klass::_lh_header_size_shift / BitsPerByte);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
        if (id == new_type_array_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
          __ set_info("new_type_array", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
          __ set_info("new_object_array", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
        // assert object type is really an array of the proper kind
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
        {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
          Label ok;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
          Register G3_t1 = G3;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
          __ ld(klass_lh, G3_t1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
          __ sra(G3_t1, Klass::_lh_array_tag_shift, G3_t1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
          int tag = ((id == new_type_array_id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
                     ? Klass::_lh_array_tag_type_value
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
                     : Klass::_lh_array_tag_obj_value);
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8495
diff changeset
   503
          __ cmp_and_brx_short(G3_t1, tag, Assembler::equal, Assembler::pt, ok);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
          __ stop("assert(is an array klass)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
          __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
          __ bind(ok);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
        if (UseTLAB && FastTLABRefill) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
          Label slow_path;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
          Register G1_arr_size = G1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
          Register G3_t1 = G3;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
          Register O1_t2 = O1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
          assert_different_registers(G5_klass, G4_length, G1_arr_size, G3_t1, O1_t2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
          // check that array length is small enough for fast path
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
          __ set(C1_MacroAssembler::max_array_allocation_length, G3_t1);
21088
4f0ada6dcace 8008242: VerifyOops is broken on SPARC
morris
parents: 20710
diff changeset
   519
          __ cmp(G4_length, G3_t1);
4f0ada6dcace 8008242: VerifyOops is broken on SPARC
morris
parents: 20710
diff changeset
   520
          __ br(Assembler::greaterUnsigned, false, Assembler::pn, slow_path);
4f0ada6dcace 8008242: VerifyOops is broken on SPARC
morris
parents: 20710
diff changeset
   521
          __ delayed()->nop();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
          // if we got here then the TLAB allocation failed, so try
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
          // refilling the TLAB or allocating directly from eden.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
          Label retry_tlab, try_eden;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
          __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G4_length and G5_klass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
          __ bind(retry_tlab);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
          // get the allocation size: (length << (layout_helper & 0x1F)) + header_size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
          __ ld(klass_lh, G3_t1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
          __ sll(G4_length, G3_t1, G1_arr_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
          __ srl(G3_t1, Klass::_lh_header_size_shift, G3_t1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
          __ and3(G3_t1, Klass::_lh_header_size_mask, G3_t1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
          __ add(G1_arr_size, G3_t1, G1_arr_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
          __ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size);  // align up
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
          __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
          __ tlab_allocate(O0_obj, G1_arr_size, 0, G3_t1, slow_path);  // preserves G1_arr_size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
          __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
          __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
          __ sub(G1_arr_size, G3_t1, O1_t2);  // body length
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
          __ add(O0_obj, G3_t1, G3_t1);       // body start
35548
8d3afe96ffea 8086053: Address inconsistencies regarding ZeroTLAB
zmajo
parents: 34148
diff changeset
   545
          if (!ZeroTLAB) {
8d3afe96ffea 8086053: Address inconsistencies regarding ZeroTLAB
zmajo
parents: 34148
diff changeset
   546
            __ initialize_body(G3_t1, O1_t2);
8d3afe96ffea 8086053: Address inconsistencies regarding ZeroTLAB
zmajo
parents: 34148
diff changeset
   547
          }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
          __ verify_oop(O0_obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
          __ retl();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
          __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
          __ bind(try_eden);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
          // get the allocation size: (length << (layout_helper & 0x1F)) + header_size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
          __ ld(klass_lh, G3_t1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
          __ sll(G4_length, G3_t1, G1_arr_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
          __ srl(G3_t1, Klass::_lh_header_size_shift, G3_t1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
          __ and3(G3_t1, Klass::_lh_header_size_mask, G3_t1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
          __ add(G1_arr_size, G3_t1, G1_arr_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
          __ add(G1_arr_size, MinObjAlignmentInBytesMask, G1_arr_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
          __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
          __ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path);  // preserves G1_arr_size
7898
729a02451b8a 7011463: Sparc MacroAssembler::incr_allocated_bytes() needs a RegisterOrConstant argument
phh
parents: 7724
diff changeset
   563
          __ incr_allocated_bytes(G1_arr_size, G3_t1, O1_t2);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
          __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
          __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
          __ sub(G1_arr_size, G3_t1, O1_t2);  // body length
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
          __ add(O0_obj, G3_t1, G3_t1);       // body start
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
          __ initialize_body(G3_t1, O1_t2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
          __ verify_oop(O0_obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
          __ retl();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
          __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
          __ bind(slow_path);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
        if (id == new_type_array_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
          oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_type_array), G5_klass, G4_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
        } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
          oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_object_array), G5_klass, G4_length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
        // I0 -> O0: new array
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
    case new_multi_array_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
      { // O0: klass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
        // O1: rank
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
        // O2: address of 1st dimension
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
        __ set_info("new_multi_array", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
        oop_maps = generate_stub_call(sasm, I0, CAST_FROM_FN_PTR(address, new_multi_array), I0, I1, I2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
        // I0 -> O0: new multi array
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
    case register_finalizer_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
        __ set_info("register_finalizer", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
        // load the klass and check the has finalizer flag
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
        Label register_finalizer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
        Register t = O1;
7427
d7b79a367474 6985015: C1 needs to support compressed oops
iveresov
parents: 7397
diff changeset
   603
        __ load_klass(O0, t);
11430
718fc06da49a 7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents: 10972
diff changeset
   604
        __ ld(t, in_bytes(Klass::access_flags_offset()), t);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
        __ set(JVM_ACC_HAS_FINALIZER, G3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
        __ andcc(G3, t, G0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
        __ br(Assembler::notZero, false, Assembler::pt, register_finalizer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
        __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
        // do a leaf return
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
        __ retl();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
        __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
        __ bind(register_finalizer);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
        OopMap* oop_map = save_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
        int call_offset = __ call_RT(noreg, noreg,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
                                     CAST_FROM_FN_PTR(address, SharedRuntime::register_finalizer), I0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
        oop_maps = new OopMapSet();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
        oop_maps->add_gc_map(call_offset, oop_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
        // Now restore all the live registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
        restore_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
        __ ret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
        __ delayed()->restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
    case throw_range_check_failed_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
      { __ set_info("range_check_failed", dont_gc_arguments); // arguments will be discarded
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
        // G4: index
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_range_check_exception), true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
    case throw_index_exception_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
      { __ set_info("index_range_check_failed", dont_gc_arguments); // arguments will be discarded
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
        // G4: index
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_index_exception), true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
    case throw_div0_exception_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
      { __ set_info("throw_div0_exception", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_div0_exception), false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
    case throw_null_pointer_exception_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
      { __ set_info("throw_null_pointer_exception", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_null_pointer_exception), false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
    case handle_exception_id:
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   656
      { __ set_info("handle_exception", dont_gc_arguments);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   657
        oop_maps = generate_handle_exception(id, sasm);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   658
      }
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   659
      break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   661
    case handle_exception_from_callee_id:
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   662
      { __ set_info("handle_exception_from_callee", dont_gc_arguments);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   663
        oop_maps = generate_handle_exception(id, sasm);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
    case unwind_exception_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
        // O0: exception
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
        // I7: address of call to this method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
        __ set_info("unwind_exception", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
        __ mov(Oexception, Oexception->after_save());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
        __ add(I7, frame::pc_return_offset, Oissuing_pc->after_save());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
        __ call_VM_leaf(L7_thread_cache, CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address),
5046
27e801a857cb 6919934: JSR 292 needs to support x86 C1
twisti
parents: 2571
diff changeset
   677
                        G2_thread, Oissuing_pc->after_save());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
        __ verify_not_null_oop(Oexception->after_save());
5687
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 5046
diff changeset
   679
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
   680
        // Restore SP from L7 if the exception PC is a method handle call site.
5687
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 5046
diff changeset
   681
        __ mov(O0, G5);  // Save the target address.
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 5046
diff changeset
   682
        __ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0);
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 5046
diff changeset
   683
        __ tst(L0);  // Condition codes are preserved over the restore.
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 5046
diff changeset
   684
        __ restore();
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 5046
diff changeset
   685
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 5046
diff changeset
   686
        __ jmp(G5, 0);
b862d1f189bd 6930772: JSR 292 needs to support SPARC C1
twisti
parents: 5046
diff changeset
   687
        __ delayed()->movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP);  // Restore SP if required.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
    case throw_array_store_exception_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
        __ set_info("throw_array_store_exception", dont_gc_arguments);
8067
f5f4eac4c48f 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 7898
diff changeset
   694
        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
    case throw_class_cast_exception_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
        // G4: object
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
        __ set_info("throw_class_cast_exception", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_class_cast_exception), true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
    case throw_incompatible_class_change_error_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
      {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
        __ set_info("throw_incompatible_class_cast_exception", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_incompatible_class_change_error), false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
    case slow_subtype_check_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
      { // Support for uint StubRoutine::partial_subtype_check( Klass sub, Klass super );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
        // Arguments :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
        //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
        //      ret  : G3
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
        //      sub  : G3, argument, destroyed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
        //      super: G1, argument, not changed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
        //      raddr: O7, blown by call
2256
82d4e10b7c6b 6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents: 1374
diff changeset
   721
        Label miss;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
        __ save_frame(0);               // Blow no registers!
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
2256
82d4e10b7c6b 6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents: 1374
diff changeset
   725
        __ check_klass_subtype_slow_path(G3, G1, L0, L1, L2, L4, NULL, &miss);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
        __ mov(1, G3);
2256
82d4e10b7c6b 6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents: 1374
diff changeset
   728
        __ ret();                       // Result in G5 is 'true'
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
        __ delayed()->restore();        // free copy or add can go here
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
        __ bind(miss);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
        __ mov(0, G3);
2256
82d4e10b7c6b 6813212: factor duplicated assembly code for general subclass check (for 6655638)
jrose
parents: 1374
diff changeset
   733
        __ ret();                       // Result in G5 is 'false'
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
        __ delayed()->restore();        // free copy or add can go here
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
    case monitorenter_nofpu_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
    case monitorenter_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
      { // G4: object
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
        // G5: lock address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
        __ set_info("monitorenter", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
        int save_fpu_registers = (id == monitorenter_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
        // make a frame and preserve the caller's caller-save registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
        OopMap* oop_map = save_live_registers(sasm, save_fpu_registers);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorenter), G4, G5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
        oop_maps = new OopMapSet();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
        oop_maps->add_gc_map(call_offset, oop_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
        restore_live_registers(sasm, save_fpu_registers);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
        __ ret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
        __ delayed()->restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   756
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
    case monitorexit_nofpu_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
    case monitorexit_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
      { // G4: lock address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
        // note: really a leaf routine but must setup last java sp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
        //       => use call_RT for now (speed can be improved by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
        //       doing last java sp setup manually)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
        __ set_info("monitorexit", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
        int save_fpu_registers = (id == monitorexit_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
        // make a frame and preserve the caller's caller-save registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
        OopMap* oop_map = save_live_registers(sasm, save_fpu_registers);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, monitorexit), G4);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
        oop_maps = new OopMapSet();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
        oop_maps->add_gc_map(call_offset, oop_map);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
        restore_live_registers(sasm, save_fpu_registers);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
        __ ret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
        __ delayed()->restore();
10972
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   778
      }
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   779
      break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
10972
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   781
    case deoptimize_id:
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   782
      {
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   783
        __ set_info("deoptimize", dont_gc_arguments);
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   784
        OopMap* oop_map = save_live_registers(sasm);
24442
4d4ae31dea26 8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents: 22234
diff changeset
   785
        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), G4);
10972
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   786
        oop_maps = new OopMapSet();
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   787
        oop_maps->add_gc_map(call_offset, oop_map);
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   788
        restore_live_registers(sasm);
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   789
        DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   790
        assert(deopt_blob != NULL, "deoptimization blob must have been created");
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   791
        AddressLiteral dest(deopt_blob->unpack_with_reexecution());
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   792
        __ jump_to(dest, O0);
ef164805934c 7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents: 10519
diff changeset
   793
        __ delayed()->restore();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
    case access_field_patching_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
      { __ set_info("access_field_patching", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
        oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, access_field_patching));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
489c9b5090e2 Initial load
duke
parents:
diff changeset
   803
    case load_klass_patching_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
      { __ set_info("load_klass_patching", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
        oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_klass_patching));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   809
    case load_mirror_patching_id:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   810
      { __ set_info("load_mirror_patching", dont_gc_arguments);
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   811
        oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_mirror_patching));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   812
      }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   813
      break;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 11439
diff changeset
   814
19710
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 17009
diff changeset
   815
    case load_appendix_patching_id:
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 17009
diff changeset
   816
      { __ set_info("load_appendix_patching", dont_gc_arguments);
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 17009
diff changeset
   817
        oop_maps = generate_patching(sasm, CAST_FROM_FN_PTR(address, move_appendix_patching));
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 17009
diff changeset
   818
      }
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 17009
diff changeset
   819
      break;
2f8ca425504e 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 17009
diff changeset
   820
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
    case dtrace_object_alloc_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
      { // O0: object
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
        __ set_info("dtrace_object_alloc", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
        // we can't gc here so skip the oopmap but make sure that all
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
        // the live registers get saved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
        save_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
        __ save_thread(L7_thread_cache);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
        __ call(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_object_alloc),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
                relocInfo::runtime_call_type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
        __ delayed()->mov(I0, O0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
        __ restore_thread(L7_thread_cache);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
489c9b5090e2 Initial load
duke
parents:
diff changeset
   834
        restore_live_registers(sasm);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   835
        __ ret();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
        __ delayed()->restore();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   837
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13728
diff changeset
   840
#if INCLUDE_ALL_GCS
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   841
    case g1_pre_barrier_slow_id:
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   842
      { // G4: previous value of memory
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   843
        BarrierSet* bs = Universe::heap()->barrier_set();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   844
        if (bs->kind() != BarrierSet::G1SATBCTLogging) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   845
          __ save_frame(0);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   846
          __ set((int)id, O1);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   847
          __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   848
          __ should_not_reach_here();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   849
          break;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   850
        }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   851
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   852
        __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   853
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   854
        Register pre_val = G4;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   855
        Register tmp  = G1_scratch;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   856
        Register tmp2 = G3_scratch;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   857
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   858
        Label refill, restart;
43449
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   859
        int satb_q_active_byte_offset =
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   860
          in_bytes(JavaThread::satb_mark_queue_offset() +
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   861
                   SATBMarkQueue::byte_offset_of_active());
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   862
        int satb_q_index_byte_offset =
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   863
          in_bytes(JavaThread::satb_mark_queue_offset() +
34148
6efbc7ffd767 8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents: 30764
diff changeset
   864
                   SATBMarkQueue::byte_offset_of_index());
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   865
        int satb_q_buf_byte_offset =
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   866
          in_bytes(JavaThread::satb_mark_queue_offset() +
34148
6efbc7ffd767 8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents: 30764
diff changeset
   867
                   SATBMarkQueue::byte_offset_of_buf());
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   868
43449
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   869
        // Is marking still active?
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   870
        if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   871
          __ ld(G2_thread, satb_q_active_byte_offset, tmp);
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   872
        } else {
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   873
          assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   874
          __ ldsb(G2_thread, satb_q_active_byte_offset, tmp);
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   875
        }
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   876
        __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, restart);
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   877
        __ retl();
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   878
        __ delayed()->nop();
21041ea7c0fe 8140588: Internal Error: gc/g1/ptrQueue.hpp:126 assert(_index == _sz) failed: invariant: queues are empty when activated
aharlap
parents: 41336
diff changeset
   879
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   880
        __ bind(restart);
34148
6efbc7ffd767 8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents: 30764
diff changeset
   881
        // Load the index into the SATB buffer. SATBMarkQueue::_index is a
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   882
        // size_t so ld_ptr is appropriate
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   883
        __ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   884
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   885
        // index == 0?
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   886
        __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pn, refill);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   887
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   888
        __ ld_ptr(G2_thread, satb_q_buf_byte_offset, tmp2);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   889
        __ sub(tmp, oopSize, tmp);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   890
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   891
        __ st_ptr(pre_val, tmp2, tmp);  // [_buf + index] := <address_of_card>
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   892
        // Use return-from-leaf
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   893
        __ retl();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   894
        __ delayed()->st_ptr(tmp, G2_thread, satb_q_index_byte_offset);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   895
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   896
        __ bind(refill);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   897
41336
b1fe5872f8f0 8161085: PreserveFPRegistersTest fails with 'AssertionError: Final value has changed'
thartmann
parents: 35548
diff changeset
   898
        save_live_registers(sasm);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   899
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   900
        __ call_VM_leaf(L7_thread_cache,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   901
                        CAST_FROM_FN_PTR(address,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   902
                                         SATBMarkQueueSet::handle_zero_index_for_thread),
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   903
                                         G2_thread);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   904
41336
b1fe5872f8f0 8161085: PreserveFPRegistersTest fails with 'AssertionError: Final value has changed'
thartmann
parents: 35548
diff changeset
   905
        restore_live_registers(sasm);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   906
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   907
        __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   908
        __ delayed()->restore();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   909
      }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   910
      break;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   911
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   912
    case g1_post_barrier_slow_id:
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   913
      {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   914
        BarrierSet* bs = Universe::heap()->barrier_set();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   915
        if (bs->kind() != BarrierSet::G1SATBCTLogging) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   916
          __ save_frame(0);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   917
          __ set((int)id, O1);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   918
          __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   919
          __ should_not_reach_here();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   920
          break;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   921
        }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   922
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   923
        __ set_info("g1_post_barrier_slow_id", dont_gc_arguments);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   924
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   925
        Register addr = G4;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   926
        Register cardtable = G5;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   927
        Register tmp  = G1_scratch;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   928
        Register tmp2 = G3_scratch;
29325
0e86e64c66e5 8069016: Add BarrierSet downcast support
kbarrett
parents: 25715
diff changeset
   929
        jbyte* byte_map_base = barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   930
20403
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
   931
        Label not_already_dirty, restart, refill, young_card;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   932
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   933
        __ srlx(addr, CardTableModRefBS::card_shift, addr);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   934
2571
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
   935
        AddressLiteral rs(byte_map_base);
d602ad6538bd 6822110: Add AddressLiteral class on SPARC
twisti
parents: 2256
diff changeset
   936
        __ set(rs, cardtable);         // cardtable := <card table base>
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   937
        __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable]
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   938
20403
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
   939
        __ cmp_and_br_short(tmp, G1SATBCardTableModRefBS::g1_young_card_val(), Assembler::equal, Assembler::pt, young_card);
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
   940
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
   941
        __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
   942
        __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable]
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
   943
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   944
        assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code");
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   945
        __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, not_already_dirty);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   946
20403
45a89fbcd8f7 8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents: 19710
diff changeset
   947
        __ bind(young_card);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   948
        // We didn't take the branch, so we're already dirty: return.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   949
        // Use return-from-leaf
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   950
        __ retl();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   951
        __ delayed()->nop();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   952
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   953
        // Not dirty.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   954
        __ bind(not_already_dirty);
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   955
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   956
        // Get cardtable + tmp into a reg by itself
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   957
        __ add(addr, cardtable, tmp2);
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   958
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   959
        // First, dirty it.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   960
        __ stb(G0, tmp2, 0);  // [cardPtr] := 0  (i.e., dirty).
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   961
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   962
        Register tmp3 = cardtable;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   963
        Register tmp4 = tmp;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   964
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   965
        // these registers are now dead
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   966
        addr = cardtable = tmp = noreg;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   967
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   968
        int dirty_card_q_index_byte_offset =
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   969
          in_bytes(JavaThread::dirty_card_queue_offset() +
34148
6efbc7ffd767 8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents: 30764
diff changeset
   970
                   DirtyCardQueue::byte_offset_of_index());
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   971
        int dirty_card_q_buf_byte_offset =
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   972
          in_bytes(JavaThread::dirty_card_queue_offset() +
34148
6efbc7ffd767 8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents: 30764
diff changeset
   973
                   DirtyCardQueue::byte_offset_of_buf());
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   974
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   975
        __ bind(restart);
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   976
34148
6efbc7ffd767 8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents: 30764
diff changeset
   977
        // Get the index into the update buffer. DirtyCardQueue::_index is
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   978
        // a size_t so ld_ptr is appropriate here.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   979
        __ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, tmp3);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   980
10497
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   981
        // index == 0?
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   982
        __ cmp_and_brx_short(tmp3, G0, Assembler::equal,  Assembler::pn, refill);
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   983
1bcff72a4b82 7066841: remove MacroAssembler::br_on_reg_cond() on sparc
johnc
parents: 10252
diff changeset
   984
        __ ld_ptr(G2_thread, dirty_card_q_buf_byte_offset, tmp4);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   985
        __ sub(tmp3, oopSize, tmp3);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   986
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   987
        __ st_ptr(tmp2, tmp4, tmp3);  // [_buf + index] := <address_of_card>
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   988
        // Use return-from-leaf
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   989
        __ retl();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   990
        __ delayed()->st_ptr(tmp3, G2_thread, dirty_card_q_index_byte_offset);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   991
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   992
        __ bind(refill);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   993
41336
b1fe5872f8f0 8161085: PreserveFPRegistersTest fails with 'AssertionError: Final value has changed'
thartmann
parents: 35548
diff changeset
   994
        save_live_registers(sasm);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   995
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   996
        __ call_VM_leaf(L7_thread_cache,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   997
                        CAST_FROM_FN_PTR(address,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   998
                                         DirtyCardQueueSet::handle_zero_index_for_thread),
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
   999
                                         G2_thread);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
  1000
41336
b1fe5872f8f0 8161085: PreserveFPRegistersTest fails with 'AssertionError: Final value has changed'
thartmann
parents: 35548
diff changeset
  1001
        restore_live_registers(sasm);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
  1002
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
  1003
        __ br(Assembler::always, /*annul*/false, Assembler::pt, restart);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
  1004
        __ delayed()->restore();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
  1005
      }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
  1006
      break;
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13728
diff changeset
  1007
#endif // INCLUDE_ALL_GCS
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
  1008
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1009
    case predicate_failed_trap_id:
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1010
      {
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1011
        __ set_info("predicate_failed_trap", dont_gc_arguments);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1012
        OopMap* oop_map = save_live_registers(sasm);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1013
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1014
        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, predicate_failed_trap));
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1015
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1016
        oop_maps = new OopMapSet();
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1017
        oop_maps->add_gc_map(call_offset, oop_map);
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1018
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1019
        DeoptimizationBlob* deopt_blob = SharedRuntime::deopt_blob();
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1020
        assert(deopt_blob != NULL, "deoptimization blob must have been created");
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1021
        restore_live_registers(sasm);
17009
f5fe7861d135 8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents: 16611
diff changeset
  1022
f5fe7861d135 8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents: 16611
diff changeset
  1023
        AddressLiteral dest(deopt_blob->unpack_with_reexecution());
f5fe7861d135 8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents: 16611
diff changeset
  1024
        __ jump_to(dest, O0);
f5fe7861d135 8011582: assert(nbits == 32 || (-(1 << nbits-1) <= x && x < ( 1 << nbits-1))) failed: value out of range
roland
parents: 16611
diff changeset
  1025
        __ delayed()->restore();
16611
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1026
      }
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1027
      break;
6807a703dd6b 7153771: array bound check elimination for c1
roland
parents: 15482
diff changeset
  1028
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1029
    default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1030
      { __ set_info("unimplemented entry", dont_gc_arguments);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1031
        __ save_frame(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1032
        __ set((int)id, O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1033
        __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), O1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1034
        __ should_not_reach_here();
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1035
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1036
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1037
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1038
  return oop_maps;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1039
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1040
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1041
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1042
OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1043
  __ block_comment("generate_handle_exception");
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1044
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1045
  // Save registers, if required.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1046
  OopMapSet* oop_maps = new OopMapSet();
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1047
  OopMap* oop_map = NULL;
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1048
  switch (id) {
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1049
  case forward_exception_id:
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1050
    // We're handling an exception in the context of a compiled frame.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1051
    // The registers have been saved in the standard places.  Perform
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1052
    // an exception lookup in the caller and dispatch to the handler
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1053
    // if found.  Otherwise unwind and dispatch to the callers
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1054
    // exception handler.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1055
     oop_map = generate_oop_map(sasm, true);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1056
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1057
     // transfer the pending exception to the exception_oop
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1058
     __ ld_ptr(G2_thread, in_bytes(JavaThread::pending_exception_offset()), Oexception);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1059
     __ ld_ptr(Oexception, 0, G0);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1060
     __ st_ptr(G0, G2_thread, in_bytes(JavaThread::pending_exception_offset()));
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1061
     __ add(I7, frame::pc_return_offset, Oissuing_pc);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1062
    break;
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1063
  case handle_exception_id:
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1064
    // At this point all registers MAY be live.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1065
    oop_map = save_live_registers(sasm);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1066
    __ mov(Oexception->after_save(),  Oexception);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1067
    __ mov(Oissuing_pc->after_save(), Oissuing_pc);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1068
    break;
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1069
  case handle_exception_from_callee_id:
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1070
    // At this point all registers except exception oop (Oexception)
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1071
    // and exception pc (Oissuing_pc) are dead.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1072
    oop_map = new OopMap(frame_size_in_bytes / sizeof(jint), 0);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1073
    sasm->set_frame_size(frame_size_in_bytes / BytesPerWord);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1074
    __ save_frame_c1(frame_size_in_bytes);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1075
    __ mov(Oexception->after_save(),  Oexception);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1076
    __ mov(Oissuing_pc->after_save(), Oissuing_pc);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1077
    break;
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1078
  default:  ShouldNotReachHere();
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1079
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1080
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1081
  __ verify_not_null_oop(Oexception);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1082
20703
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1083
#ifdef ASSERT
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1084
  // check that fields in JavaThread for exception oop and issuing pc are
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1085
  // empty before writing to them
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1086
  Label oop_empty;
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1087
  Register scratch = I7;  // We can use I7 here because it's overwritten later anyway.
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1088
  __ ld_ptr(Address(G2_thread, JavaThread::exception_oop_offset()), scratch);
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1089
  __ br_null(scratch, false, Assembler::pt, oop_empty);
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1090
  __ delayed()->nop();
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1091
  __ stop("exception oop already set");
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1092
  __ bind(oop_empty);
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1093
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1094
  Label pc_empty;
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1095
  __ ld_ptr(Address(G2_thread, JavaThread::exception_pc_offset()), scratch);
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1096
  __ br_null(scratch, false, Assembler::pt, pc_empty);
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1097
  __ delayed()->nop();
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1098
  __ stop("exception pc already set");
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1099
  __ bind(pc_empty);
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1100
#endif
2de7fe0e9693 8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents: 19710
diff changeset
  1101
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1102
  // save the exception and issuing pc in the thread
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1103
  __ st_ptr(Oexception,  G2_thread, in_bytes(JavaThread::exception_oop_offset()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1104
  __ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1105
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1106
  // use the throwing pc as the return address to lookup (has bci & oop map)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1107
  __ mov(Oissuing_pc, I7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1108
  __ sub(I7, frame::pc_return_offset, I7);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1109
  int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, exception_handler_for_pc));
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1110
  oop_maps->add_gc_map(call_offset, oop_map);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1111
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1112
  // Note: if nmethod has been deoptimized then regardless of
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1113
  // whether it had a handler or not we will deoptimize
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1114
  // by entering the deopt blob with a pending exception.
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1115
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1116
  // Restore the registers that were saved at the beginning, remove
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1117
  // the frame and jump to the exception handler.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1118
  switch (id) {
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1119
  case forward_exception_id:
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1120
  case handle_exception_id:
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1121
    restore_live_registers(sasm);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1122
    __ jmp(O0, 0);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1123
    __ delayed()->restore();
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1124
    break;
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1125
  case handle_exception_from_callee_id:
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1126
    // Restore SP from L7 if the exception PC is a method handle call site.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1127
    __ mov(O0, G5);  // Save the target address.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1128
    __ lduw(Address(G2_thread, JavaThread::is_method_handle_return_offset()), L0);
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1129
    __ tst(L0);  // Condition codes are preserved over the restore.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1130
    __ restore();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1131
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1132
    __ jmp(G5, 0);  // jump to the exception handler
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1133
    __ delayed()->movcc(Assembler::notZero, false, Assembler::icc, L7_mh_SP_save, SP);  // Restore SP if required.
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1134
    break;
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1135
  default:  ShouldNotReachHere();
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1136
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1137
8495
a4959965eaa3 7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents: 8069
diff changeset
  1138
  return oop_maps;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1139
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1140
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1141
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1142
#undef __
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1143
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5702
diff changeset
  1144
const char *Runtime1::pd_name_for_address(address entry) {
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5702
diff changeset
  1145
  return "<unknown function>";
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5702
diff changeset
  1146
}