hotspot/src/cpu/zero/vm/frame_zero.cpp
author jiangli
Wed, 06 Jun 2012 14:33:43 -0400
changeset 12937 0032fb2caff6
parent 11571 23f825a42a85
child 13728 882756847a04
permissions -rw-r--r--
7172967: Eliminate constMethod's _method backpointer to methodOop. Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod. Reviewed-by: roland, bdelsart, kamg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
10260
b7007c4de557 7071823: Zero: zero/shark doesn't build after b147-fcs
twisti
parents: 7397
diff changeset
     3
 * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     5
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     8
 * published by the Free Software Foundation.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
     9
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    14
 * accompanied this code).
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    15
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    19
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5425
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5425
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5425
diff changeset
    22
 * questions.
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    23
 *
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    24
 */
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    25
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "code/scopeDesc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "interpreter/interpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "interpreter/interpreterRuntime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "oops/markOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "oops/methodOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#include "runtime/frame.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    35
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
#include "runtime/javaCalls.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    37
#include "runtime/monitorChunk.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    38
#include "runtime/signature.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    39
#include "runtime/stubCodeGenerator.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    40
#include "runtime/stubRoutines.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    41
#include "vmreg_zero.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    42
#ifdef COMPILER1
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    43
#include "c1/c1_Runtime1.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    44
#include "runtime/vframeArray.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    45
#endif
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    46
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    47
#ifdef ASSERT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    48
void RegisterMap::check_location_valid() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    49
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    50
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    51
#endif
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    52
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    53
bool frame::is_interpreted_frame() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    54
  return zeroframe()->is_interpreter_frame();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    55
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    56
5425
3f8de5a243d2 6950617: Zero/Shark interface updates
twisti
parents: 5418
diff changeset
    57
bool frame::is_fake_stub_frame() const {
3f8de5a243d2 6950617: Zero/Shark interface updates
twisti
parents: 5418
diff changeset
    58
  return zeroframe()->is_fake_stub_frame();
3f8de5a243d2 6950617: Zero/Shark interface updates
twisti
parents: 5418
diff changeset
    59
}
3f8de5a243d2 6950617: Zero/Shark interface updates
twisti
parents: 5418
diff changeset
    60
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    61
frame frame::sender_for_entry_frame(RegisterMap *map) const {
4448
d6ec2737186c 6896043: first round of zero fixes
twisti
parents: 4013
diff changeset
    62
  assert(zeroframe()->is_entry_frame(), "wrong type of frame");
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    63
  assert(map != NULL, "map must be set");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    64
  assert(!entry_frame_is_first(), "next Java fp must be non zero");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    65
  assert(entry_frame_call_wrapper()->anchor()->last_Java_sp() == sender_sp(),
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    66
         "sender should be next Java frame");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    67
  map->clear();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    68
  assert(map->include_argument_oops(), "should be set by clear");
5418
c4955cb6ed33 6939182: Zero JNI handles fix
twisti
parents: 4448
diff changeset
    69
  return frame(zeroframe()->next(), sender_sp());
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    70
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    71
4448
d6ec2737186c 6896043: first round of zero fixes
twisti
parents: 4013
diff changeset
    72
frame frame::sender_for_nonentry_frame(RegisterMap *map) const {
d6ec2737186c 6896043: first round of zero fixes
twisti
parents: 4013
diff changeset
    73
  assert(zeroframe()->is_interpreter_frame() ||
d6ec2737186c 6896043: first round of zero fixes
twisti
parents: 4013
diff changeset
    74
         zeroframe()->is_shark_frame() ||
d6ec2737186c 6896043: first round of zero fixes
twisti
parents: 4013
diff changeset
    75
         zeroframe()->is_fake_stub_frame(), "wrong type of frame");
5418
c4955cb6ed33 6939182: Zero JNI handles fix
twisti
parents: 4448
diff changeset
    76
  return frame(zeroframe()->next(), sender_sp());
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    77
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    78
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    79
frame frame::sender(RegisterMap* map) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    80
  // Default is not to follow arguments; the various
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    81
  // sender_for_xxx methods update this accordingly.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    82
  map->set_include_argument_oops(false);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    83
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    84
  if (is_entry_frame())
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    85
    return sender_for_entry_frame(map);
4448
d6ec2737186c 6896043: first round of zero fixes
twisti
parents: 4013
diff changeset
    86
  else
d6ec2737186c 6896043: first round of zero fixes
twisti
parents: 4013
diff changeset
    87
    return sender_for_nonentry_frame(map);
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    88
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    89
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    90
#ifdef CC_INTERP
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    91
BasicObjectLock* frame::interpreter_frame_monitor_begin() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    92
  return get_interpreterState()->monitor_base();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    93
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    94
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    95
BasicObjectLock* frame::interpreter_frame_monitor_end() const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    96
  return (BasicObjectLock*) get_interpreterState()->stack_base();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    97
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    98
#endif // CC_INTERP
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
    99
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   100
void frame::patch_pc(Thread* thread, address pc) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   101
  // We borrow this call to set the thread pointer in the interpreter
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   102
  // state; the hook to set up deoptimized frames isn't supplied it.
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   103
  assert(pc == NULL, "should be");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   104
  get_interpreterState()->set_thread((JavaThread *) thread);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   105
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   106
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   107
bool frame::safe_for_sender(JavaThread *thread) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   108
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   109
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   110
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   111
void frame::pd_gc_epilog() {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   112
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   113
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   114
bool frame::is_interpreted_frame_valid(JavaThread *thread) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   115
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   116
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   117
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   118
BasicType frame::interpreter_frame_result(oop* oop_result,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   119
                                          jvalue* value_result) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   120
  assert(is_interpreted_frame(), "interpreted frame expected");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   121
  methodOop method = interpreter_frame_method();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   122
  BasicType type = method->result_type();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   123
  intptr_t* tos_addr = (intptr_t *) interpreter_frame_tos_address();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   124
  oop obj;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   125
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   126
  switch (type) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   127
  case T_VOID:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   128
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   129
  case T_BOOLEAN:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   130
    value_result->z = *(jboolean *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   131
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   132
  case T_BYTE:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   133
    value_result->b = *(jbyte *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   134
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   135
  case T_CHAR:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   136
    value_result->c = *(jchar *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   137
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   138
  case T_SHORT:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   139
    value_result->s = *(jshort *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   140
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   141
  case T_INT:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   142
    value_result->i = *(jint *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   143
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   144
  case T_LONG:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   145
    value_result->j = *(jlong *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   146
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   147
  case T_FLOAT:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   148
    value_result->f = *(jfloat *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   149
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   150
  case T_DOUBLE:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   151
    value_result->d = *(jdouble *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   152
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   153
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   154
  case T_OBJECT:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   155
  case T_ARRAY:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   156
    if (method->is_native()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   157
      obj = get_interpreterState()->oop_temp();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   158
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   159
    else {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   160
      oop* obj_p = (oop *) tos_addr;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   161
      obj = (obj_p == NULL) ? (oop) NULL : *obj_p;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   162
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   163
    assert(obj == NULL || Universe::heap()->is_in(obj), "sanity check");
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   164
    *oop_result = obj;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   165
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   166
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   167
  default:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   168
    ShouldNotReachHere();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   169
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   170
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   171
  return type;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   172
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   173
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   174
int frame::frame_size(RegisterMap* map) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   175
#ifdef PRODUCT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   176
  ShouldNotCallThis();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   177
#else
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   178
  return 0; // make javaVFrame::print_value work
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   179
#endif // PRODUCT
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   180
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   181
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   182
intptr_t* frame::interpreter_frame_tos_at(jint offset) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   183
  int index = (Interpreter::expr_offset_in_bytes(offset) / wordSize);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   184
  return &interpreter_frame_tos_address()[index];
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   185
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   186
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   187
void frame::zero_print_on_error(int           frame_index,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   188
                                outputStream* st,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   189
                                char*         buf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   190
                                int           buflen) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   191
  // Divide the buffer between the field and the value
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   192
  buflen >>= 1;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   193
  char *fieldbuf = buf;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   194
  char *valuebuf = buf + buflen;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   195
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   196
  // Print each word of the frame
5418
c4955cb6ed33 6939182: Zero JNI handles fix
twisti
parents: 4448
diff changeset
   197
  for (intptr_t *addr = sp(); addr <= fp(); addr++) {
c4955cb6ed33 6939182: Zero JNI handles fix
twisti
parents: 4448
diff changeset
   198
    int offset = fp() - addr;
4013
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   199
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   200
    // Fill in default values, then try and improve them
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   201
    snprintf(fieldbuf, buflen, "word[%d]", offset);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   202
    snprintf(valuebuf, buflen, PTR_FORMAT, *addr);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   203
    zeroframe()->identify_word(frame_index, offset, fieldbuf, valuebuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   204
    fieldbuf[buflen - 1] = '\0';
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   205
    valuebuf[buflen - 1] = '\0';
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   206
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   207
    // Print the result
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   208
    st->print_cr(" " PTR_FORMAT ": %-21s = %s", addr, fieldbuf, valuebuf);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   209
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   210
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   211
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   212
void ZeroFrame::identify_word(int   frame_index,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   213
                              int   offset,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   214
                              char* fieldbuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   215
                              char* valuebuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   216
                              int   buflen) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   217
  switch (offset) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   218
  case next_frame_off:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   219
    strncpy(fieldbuf, "next_frame", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   220
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   221
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   222
  case frame_type_off:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   223
    strncpy(fieldbuf, "frame_type", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   224
    if (is_entry_frame())
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   225
      strncpy(valuebuf, "ENTRY_FRAME", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   226
    else if (is_interpreter_frame())
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   227
      strncpy(valuebuf, "INTERPRETER_FRAME", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   228
    else if (is_shark_frame())
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   229
      strncpy(valuebuf, "SHARK_FRAME", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   230
    else if (is_fake_stub_frame())
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   231
      strncpy(valuebuf, "FAKE_STUB_FRAME", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   232
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   233
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   234
  default:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   235
    if (is_entry_frame()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   236
      as_entry_frame()->identify_word(
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   237
        frame_index, offset, fieldbuf, valuebuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   238
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   239
    else if (is_interpreter_frame()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   240
      as_interpreter_frame()->identify_word(
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   241
        frame_index, offset, fieldbuf, valuebuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   242
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   243
    else if (is_shark_frame()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   244
      as_shark_frame()->identify_word(
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   245
        frame_index, offset, fieldbuf, valuebuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   246
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   247
    else if (is_fake_stub_frame()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   248
      as_fake_stub_frame()->identify_word(
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   249
        frame_index, offset, fieldbuf, valuebuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   250
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   251
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   252
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   253
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   254
void EntryFrame::identify_word(int   frame_index,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   255
                               int   offset,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   256
                               char* fieldbuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   257
                               char* valuebuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   258
                               int   buflen) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   259
  switch (offset) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   260
  case call_wrapper_off:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   261
    strncpy(fieldbuf, "call_wrapper", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   262
    break;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   263
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   264
  default:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   265
    snprintf(fieldbuf, buflen, "local[%d]", offset - 3);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   266
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   267
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   268
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   269
void InterpreterFrame::identify_word(int   frame_index,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   270
                                     int   offset,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   271
                                     char* fieldbuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   272
                                     char* valuebuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   273
                                     int   buflen) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   274
  interpreterState istate = interpreter_state();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   275
  bool is_valid = istate->self_link() == istate;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   276
  intptr_t *addr = addr_of_word(offset);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   277
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   278
  // Fixed part
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   279
  if (addr >= (intptr_t *) istate) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   280
    const char *field = istate->name_of_field_at_address((address) addr);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   281
    if (field) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   282
      if (is_valid && !strcmp(field, "_method")) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   283
        istate->method()->name_and_sig_as_C_string(valuebuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   284
      }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   285
      else if (is_valid && !strcmp(field, "_bcp") && istate->bcp()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   286
        snprintf(valuebuf, buflen, PTR_FORMAT " (bci %d)",
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   287
                 (intptr_t) istate->bcp(),
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   288
                 istate->method()->bci_from(istate->bcp()));
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   289
      }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   290
      snprintf(fieldbuf, buflen, "%sistate->%s",
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   291
               field[strlen(field) - 1] == ')' ? "(": "", field);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   292
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   293
    else if (addr == (intptr_t *) istate) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   294
      strncpy(fieldbuf, "(vtable for istate)", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   295
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   296
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   297
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   298
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   299
  // Variable part
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   300
  if (!is_valid)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   301
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   302
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   303
  // JNI stuff
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   304
  if (istate->method()->is_native() && addr < istate->stack_base()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   305
    address hA = istate->method()->signature_handler();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   306
    if (hA != NULL) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   307
      if (hA != (address) InterpreterRuntime::slow_signature_handler) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   308
        InterpreterRuntime::SignatureHandler *handler =
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   309
          InterpreterRuntime::SignatureHandler::from_handlerAddr(hA);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   310
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   311
        intptr_t *params = istate->stack_base() - handler->argument_count();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   312
        if (addr >= params) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   313
          int param = addr - params;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   314
          const char *desc = "";
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   315
          if (param == 0)
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   316
            desc = " (JNIEnv)";
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   317
          else if (param == 1) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   318
            if (istate->method()->is_static())
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   319
              desc = " (mirror)";
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   320
            else
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   321
              desc = " (this)";
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   322
          }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   323
          snprintf(fieldbuf, buflen, "parameter[%d]%s", param, desc);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   324
          return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   325
        }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   326
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   327
        for (int i = 0; i < handler->argument_count(); i++) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   328
          if (params[i] == (intptr_t) addr) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   329
            snprintf(fieldbuf, buflen, "unboxed parameter[%d]", i);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   330
            return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   331
          }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   332
        }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   333
      }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   334
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   335
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   336
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   337
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   338
  // Monitors and stack
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   339
  identify_vp_word(frame_index, addr,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   340
                   (intptr_t *) istate->monitor_base(),
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   341
                   istate->stack_base(),
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   342
                   fieldbuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   343
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   344
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   345
void SharkFrame::identify_word(int   frame_index,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   346
                               int   offset,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   347
                               char* fieldbuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   348
                               char* valuebuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   349
                               int   buflen) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   350
  // Fixed part
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   351
  switch (offset) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   352
  case pc_off:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   353
    strncpy(fieldbuf, "pc", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   354
    if (method()->is_oop()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   355
      nmethod *code = method()->code();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   356
      if (code && code->pc_desc_at(pc())) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   357
        SimpleScopeDesc ssd(code, pc());
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   358
        snprintf(valuebuf, buflen, PTR_FORMAT " (bci %d)",
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   359
                 (intptr_t) pc(), ssd.bci());
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   360
      }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   361
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   362
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   363
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   364
  case unextended_sp_off:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   365
    strncpy(fieldbuf, "unextended_sp", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   366
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   367
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   368
  case method_off:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   369
    strncpy(fieldbuf, "method", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   370
    if (method()->is_oop()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   371
      method()->name_and_sig_as_C_string(valuebuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   372
    }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   373
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   374
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   375
  case oop_tmp_off:
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   376
    strncpy(fieldbuf, "oop_tmp", buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   377
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   378
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   379
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   380
  // Variable part
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   381
  if (method()->is_oop()) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   382
    identify_vp_word(frame_index, addr_of_word(offset),
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   383
                     addr_of_word(header_words + 1),
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   384
                     unextended_sp() + method()->max_stack(),
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   385
                     fieldbuf, buflen);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   386
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   387
}
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   388
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   389
void ZeroFrame::identify_vp_word(int       frame_index,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   390
                                 intptr_t* addr,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   391
                                 intptr_t* monitor_base,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   392
                                 intptr_t* stack_base,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   393
                                 char*     fieldbuf,
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   394
                                 int       buflen) const {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   395
  // Monitors
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   396
  if (addr >= stack_base && addr < monitor_base) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   397
    int monitor_size = frame::interpreter_frame_monitor_size();
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   398
    int last_index = (monitor_base - stack_base) / monitor_size - 1;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   399
    int index = last_index - (addr - stack_base) / monitor_size;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   400
    intptr_t monitor = (intptr_t) (
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   401
      (BasicObjectLock *) monitor_base - 1 - index);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   402
    intptr_t offset = (intptr_t) addr - monitor;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   403
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   404
    if (offset == BasicObjectLock::obj_offset_in_bytes())
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   405
      snprintf(fieldbuf, buflen, "monitor[%d]->_obj", index);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   406
    else if (offset ==  BasicObjectLock::lock_offset_in_bytes())
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   407
      snprintf(fieldbuf, buflen, "monitor[%d]->_lock", index);
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   408
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   409
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   410
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   411
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   412
  // Expression stack
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   413
  if (addr < stack_base) {
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   414
    snprintf(fieldbuf, buflen, "%s[%d]",
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   415
             frame_index == 0 ? "stack_word" : "local",
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   416
             (int) (stack_base - addr - 1));
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   417
    return;
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   418
  }
b154310845de 6890308: integrate zero assembler hotspot changes
never
parents:
diff changeset
   419
}
10260
b7007c4de557 7071823: Zero: zero/shark doesn't build after b147-fcs
twisti
parents: 7397
diff changeset
   420
11571
23f825a42a85 7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents: 10539
diff changeset
   421
#ifndef PRODUCT
10260
b7007c4de557 7071823: Zero: zero/shark doesn't build after b147-fcs
twisti
parents: 7397
diff changeset
   422
b7007c4de557 7071823: Zero: zero/shark doesn't build after b147-fcs
twisti
parents: 7397
diff changeset
   423
void frame::describe_pd(FrameValues& values, int frame_no) {
b7007c4de557 7071823: Zero: zero/shark doesn't build after b147-fcs
twisti
parents: 7397
diff changeset
   424
b7007c4de557 7071823: Zero: zero/shark doesn't build after b147-fcs
twisti
parents: 7397
diff changeset
   425
}
b7007c4de557 7071823: Zero: zero/shark doesn't build after b147-fcs
twisti
parents: 7397
diff changeset
   426
b7007c4de557 7071823: Zero: zero/shark doesn't build after b147-fcs
twisti
parents: 7397
diff changeset
   427
#endif
10539
f87cedf7983c 7087445: Improve platform independence of JSR292 shared code
bdelsart
parents: 10260
diff changeset
   428
f87cedf7983c 7087445: Improve platform independence of JSR292 shared code
bdelsart
parents: 10260
diff changeset
   429
intptr_t *frame::initial_deoptimization_info() {
f87cedf7983c 7087445: Improve platform independence of JSR292 shared code
bdelsart
parents: 10260
diff changeset
   430
  // unused... but returns fp() to minimize changes introduced by 7087445
f87cedf7983c 7087445: Improve platform independence of JSR292 shared code
bdelsart
parents: 10260
diff changeset
   431
  return fp();
f87cedf7983c 7087445: Improve platform independence of JSR292 shared code
bdelsart
parents: 10260
diff changeset
   432
}
f87cedf7983c 7087445: Improve platform independence of JSR292 shared code
bdelsart
parents: 10260
diff changeset
   433