hotspot/src/share/vm/asm/assembler.cpp
author twisti
Tue, 24 Jul 2012 10:51:00 -0700
changeset 13391 30245956af37
parent 11434 c50976508b6b
child 13963 e5b53c306fb5
permissions -rw-r--r--
7023639: JSR 292 method handle invocation needs a fast path for compiled code 6984705: JSR 292 method handle creation should not go through JNI Summary: remove assembly code for JDK 7 chained method handles Reviewed-by: jrose, twisti, kvn, mhaupt Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
8921
14bfe81f2a9d 7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents: 8107
diff changeset
     2
 * Copyright (c) 1997, 2011, 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: 5403
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5403
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: 5403
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: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "asm/assembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "asm/assembler.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "asm/codeBuffer.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "runtime/icache.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "runtime/os.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#ifdef TARGET_ARCH_x86
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
# include "assembler_x86.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#ifdef TARGET_ARCH_sparc
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
# include "assembler_sparc.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    37
#ifdef TARGET_ARCH_zero
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    38
# include "assembler_zero.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    39
#endif
8107
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    40
#ifdef TARGET_ARCH_arm
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    41
# include "assembler_arm.inline.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    42
#endif
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    43
#ifdef TARGET_ARCH_ppc
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    44
# include "assembler_ppc.inline.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
    45
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
// Implementation of AbstractAssembler
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// The AbstractAssembler is generating code into a CodeBuffer. To make code generation faster,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// the assembler keeps a copy of the code buffers boundaries & modifies them when
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// emitting bytes rather than using the code buffers accessor functions all the time.
2131
98f9cef66a34 6810672: Comment typos
twisti
parents: 1412
diff changeset
    53
// The code buffer is updated via set_code_end(...) after emitting a whole instruction.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
AbstractAssembler::AbstractAssembler(CodeBuffer* code) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  if (code == NULL)  return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  CodeSection* cs = code->insts();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  cs->clear_mark();   // new assembler kills old mark
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  _code_section = cs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  _code_begin  = cs->start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  _code_limit  = cs->limit();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  _code_pos    = cs->end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  _oop_recorder= code->oop_recorder();
11434
c50976508b6b 7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
kvn
parents: 8921
diff changeset
    64
  DEBUG_ONLY( _short_branch_delta = 0; )
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  if (_code_begin == NULL)  {
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents: 3261
diff changeset
    66
    vm_exit_out_of_memory(0, err_msg("CodeCache: no room for %s",
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents: 3261
diff changeset
    67
                                     code->name()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
void AbstractAssembler::set_code_section(CodeSection* cs) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  assert(cs->outer() == code_section()->outer(), "sanity");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  assert(cs->is_allocated(), "need to pre-allocate this section");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  cs->clear_mark();  // new assembly into this section kills old mark
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  _code_section = cs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  _code_begin  = cs->start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  _code_limit  = cs->limit();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  _code_pos    = cs->end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
// Inform CodeBuffer that incoming code and relocation will be for stubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
address AbstractAssembler::start_a_stub(int required_space) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  CodeBuffer*  cb = code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  CodeSection* cs = cb->stubs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  assert(_code_section == cb->insts(), "not in insts?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  sync();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  if (cs->maybe_expand_to_ensure_remaining(required_space)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
      && cb->blob() == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  set_code_section(cs);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  return pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// Inform CodeBuffer that incoming code and relocation will be code
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
// Should not be called if start_a_stub() returned NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
void AbstractAssembler::end_a_stub() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  assert(_code_section == code()->stubs(), "not in stubs?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  sync();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  set_code_section(code()->insts());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
// Inform CodeBuffer that incoming code and relocation will be for stubs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
address AbstractAssembler::start_a_const(int required_space, int required_align) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  CodeBuffer*  cb = code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  CodeSection* cs = cb->consts();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  assert(_code_section == cb->insts(), "not in insts?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  sync();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  address end = cs->end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  int pad = -(intptr_t)end & (required_align-1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  if (cs->maybe_expand_to_ensure_remaining(pad + required_space)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    if (cb->blob() == NULL)  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    end = cs->end();  // refresh pointer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  if (pad > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    while (--pad >= 0) { *end++ = 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    cs->set_end(end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  set_code_section(cs);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  return end;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
// Inform CodeBuffer that incoming code and relocation will be code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
// Should not be called if start_a_const() returned NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
void AbstractAssembler::end_a_const() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  assert(_code_section == code()->consts(), "not in consts?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  sync();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  set_code_section(code()->insts());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
void AbstractAssembler::flush() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  sync();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  ICache::invalidate_range(addr_at(0), offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
void AbstractAssembler::a_byte(int x) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  emit_byte(x);
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
void AbstractAssembler::a_long(jint x) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  emit_long(x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
// Labels refer to positions in the (to be) generated code.  There are bound
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
// and unbound
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
// Bound labels refer to known positions in the already generated code.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
// offset() is the position the label refers to.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
// Unbound labels refer to unknown positions in the code to be generated; it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
// may contain a list of unresolved displacements that refer to it
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
void AbstractAssembler::print(Label& L) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  if (L.is_bound()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    tty->print_cr("bound label to %d|%d", L.loc_pos(), L.loc_sect());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  } else if (L.is_unbound()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    L.print_instructions((MacroAssembler*)this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    tty->print_cr("label in inconsistent state (loc = %d)", L.loc());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
#endif // PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
void AbstractAssembler::bind(Label& L) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  if (L.is_bound()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
    // Assembler can bind a label more than once to the same place.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
    guarantee(L.loc() == locator(), "attempt to redefine label");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  L.bind_loc(locator());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  L.patch_instructions((MacroAssembler*)this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  if (UseStackBanging) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    // Each code entry causes one stack bang n pages down the stack where n
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    // is configurable by StackBangPages.  The setting depends on the maximum
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    // depth of VM call stack or native before going back into java code,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    // since only java code can raise a stack overflow exception using the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    // stack banging mechanism.  The VM and native code does not detect stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    // overflow.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    // The code in JavaCalls::call() checks that there is at least n pages
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    // available, so all entry code needs to do is bang once for the end of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    // this shadow zone.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    // The entry code may need to bang additional pages if the framesize
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
    // is greater than a page.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
    const int page_size = os::vm_page_size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
    int bang_end = StackShadowPages*page_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    // This is how far the previous frame's stack banging extended.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    const int bang_end_safe = bang_end;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    if (frame_size_in_bytes > page_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
      bang_end += frame_size_in_bytes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    int bang_offset = bang_end_safe;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
    while (bang_offset <= bang_end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
      // Need at least one stack bang at end of shadow zone.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
      bang_stack_with_offset(bang_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
      bang_offset += page_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  } // end (UseStackBanging)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
void Label::add_patch_at(CodeBuffer* cb, int branch_loc) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  assert(_loc == -1, "Label is unbound");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  if (_patch_index < PatchCacheSize) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    _patches[_patch_index] = branch_loc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    if (_patch_overflow == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
      _patch_overflow = cb->create_patch_overflow();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    _patch_overflow->push(branch_loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  ++_patch_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
void Label::patch_instructions(MacroAssembler* masm) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  assert(is_bound(), "Label is bound");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  CodeBuffer* cb = masm->code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  int target_sect = CodeBuffer::locator_sect(loc());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  address target = cb->locator_address(loc());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  while (_patch_index > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    --_patch_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    int branch_loc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    if (_patch_index >= PatchCacheSize) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
      branch_loc = _patch_overflow->pop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
      branch_loc = _patches[_patch_index];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    int branch_sect = CodeBuffer::locator_sect(branch_loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    address branch = cb->locator_address(branch_loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
    if (branch_sect == CodeBuffer::SECT_CONSTS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
      // The thing to patch is a constant word.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
      *(address*)branch = target;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
      continue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
    // Cross-section branches only work if the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
    // intermediate section boundaries are frozen.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    if (target_sect != branch_sect) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
      for (int n = MIN2(target_sect, branch_sect),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
               nlimit = (target_sect + branch_sect) - n;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
           n < nlimit; n++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
        CodeSection* cs = cb->code_section(n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
        assert(cs->is_frozen(), "cross-section branch needs stable offsets");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
#endif //ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
    // Push the target offset into the branch instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
    masm->pd_patch_instruction(branch, target);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
2148
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   263
struct DelayedConstant {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   264
  typedef void (*value_fn_t)();
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   265
  BasicType type;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   266
  intptr_t value;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   267
  value_fn_t value_fn;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   268
  // This limit of 20 is generous for initial uses.
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   269
  // The limit needs to be large enough to store the field offsets
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   270
  // into classes which do not have statically fixed layouts.
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   271
  // (Initial use is for method handle object offsets.)
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   272
  // Look for uses of "delayed_value" in the source code
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   273
  // and make sure this number is generous enough to handle all of them.
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   274
  enum { DC_LIMIT = 20 };
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   275
  static DelayedConstant delayed_constants[DC_LIMIT];
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   276
  static DelayedConstant* add(BasicType type, value_fn_t value_fn);
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   277
  bool match(BasicType t, value_fn_t cfn) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   278
    return type == t && value_fn == cfn;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   279
  }
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   280
  static void update_all();
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   281
};
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   282
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   283
DelayedConstant DelayedConstant::delayed_constants[DC_LIMIT];
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   284
// Default C structure initialization rules have the following effect here:
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   285
// = { { (BasicType)0, (intptr_t)NULL }, ... };
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   286
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   287
DelayedConstant* DelayedConstant::add(BasicType type,
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   288
                                      DelayedConstant::value_fn_t cfn) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   289
  for (int i = 0; i < DC_LIMIT; i++) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   290
    DelayedConstant* dcon = &delayed_constants[i];
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   291
    if (dcon->match(type, cfn))
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   292
      return dcon;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   293
    if (dcon->value_fn == NULL) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   294
      // (cmpxchg not because this is multi-threaded but because I'm paranoid)
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   295
      if (Atomic::cmpxchg_ptr(CAST_FROM_FN_PTR(void*, cfn), &dcon->value_fn, NULL) == NULL) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   296
        dcon->type = type;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   297
        return dcon;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   298
      }
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   299
    }
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   300
  }
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   301
  // If this assert is hit (in pre-integration testing!) then re-evaluate
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   302
  // the comment on the definition of DC_LIMIT.
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   303
  guarantee(false, "too many delayed constants");
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   304
  return NULL;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   305
}
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   306
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   307
void DelayedConstant::update_all() {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   308
  for (int i = 0; i < DC_LIMIT; i++) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   309
    DelayedConstant* dcon = &delayed_constants[i];
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   310
    if (dcon->value_fn != NULL && dcon->value == 0) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   311
      typedef int     (*int_fn_t)();
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   312
      typedef address (*address_fn_t)();
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   313
      switch (dcon->type) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   314
      case T_INT:     dcon->value = (intptr_t) ((int_fn_t)    dcon->value_fn)(); break;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   315
      case T_ADDRESS: dcon->value = (intptr_t) ((address_fn_t)dcon->value_fn)(); break;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   316
      }
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   317
    }
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   318
  }
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   319
}
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   320
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   321
RegisterOrConstant AbstractAssembler::delayed_value(int(*value_fn)(), Register tmp, int offset) {
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   322
  intptr_t val = (intptr_t) (*value_fn)();
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   323
  if (val != 0)  return val + offset;
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   324
  return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset);
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   325
}
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   326
RegisterOrConstant AbstractAssembler::delayed_value(address(*value_fn)(), Register tmp, int offset) {
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   327
  intptr_t val = (intptr_t) (*value_fn)();
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   328
  if (val != 0)  return val + offset;
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   329
  return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset);
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 11434
diff changeset
   330
}
2148
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   331
intptr_t* AbstractAssembler::delayed_value_addr(int(*value_fn)()) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   332
  DelayedConstant* dcon = DelayedConstant::add(T_INT, (DelayedConstant::value_fn_t) value_fn);
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   333
  return &dcon->value;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   334
}
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   335
intptr_t* AbstractAssembler::delayed_value_addr(address(*value_fn)()) {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   336
  DelayedConstant* dcon = DelayedConstant::add(T_ADDRESS, (DelayedConstant::value_fn_t) value_fn);
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   337
  return &dcon->value;
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   338
}
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   339
void AbstractAssembler::update_delayed_values() {
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   340
  DelayedConstant::update_all();
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   341
}
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   342
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   343
09c7f703773b 6812678: macro assembler needs delayed binding of a few constants (for 6655638)
jrose
parents: 2131
diff changeset
   344
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
void AbstractAssembler::block_comment(const char* comment) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  if (sect() == CodeBuffer::SECT_INSTS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
    code_section()->outer()->block_comment(offset(), comment);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
823
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   352
bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   353
  // Exception handler checks the nmethod's implicit null checks table
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   354
  // only when this method returns false.
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2148
diff changeset
   355
#ifdef _LP64
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2148
diff changeset
   356
  if (UseCompressedOops && Universe::narrow_oop_base() != NULL) {
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2148
diff changeset
   357
    assert (Universe::heap() != NULL, "java heap should be initialized");
823
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   358
    // The first page after heap_base is unmapped and
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   359
    // the 'offset' is equal to [heap_base + offset] for
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   360
    // narrow oop implicit null checks.
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2148
diff changeset
   361
    uintptr_t base = (uintptr_t)Universe::narrow_oop_base();
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2148
diff changeset
   362
    if ((uintptr_t)offset >= base) {
823
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   363
      // Normalize offset for the next check.
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2148
diff changeset
   364
      offset = (intptr_t)(pointer_delta((void*)offset, (void*)base, 1));
823
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   365
    }
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   366
  }
2254
f13dda645a4b 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 2148
diff changeset
   367
#endif
823
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   368
  return offset < 0 || os::vm_page_size() <= offset;
9a5271881bc0 6716785: implicit null checks not triggering with CompressedOops
coleenp
parents: 1
diff changeset
   369
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
void Label::print_instructions(MacroAssembler* masm) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  CodeBuffer* cb = masm->code();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  for (int i = 0; i < _patch_index; ++i) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
    int branch_loc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
    if (i >= PatchCacheSize) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
      branch_loc = _patch_overflow->at(i - PatchCacheSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
      branch_loc = _patches[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    int branch_pos  = CodeBuffer::locator_pos(branch_loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
    int branch_sect = CodeBuffer::locator_sect(branch_loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
    address branch = cb->locator_address(branch_loc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    tty->print_cr("unbound label");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    tty->print("@ %d|%d ", branch_pos, branch_sect);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    if (branch_sect == CodeBuffer::SECT_CONSTS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
      tty->print_cr(PTR_FORMAT, *(address*)branch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
      continue;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
    masm->pd_print_patched_instruction(branch);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
    tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
#endif // ndef PRODUCT