src/hotspot/share/code/scopeDesc.cpp
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 53065 2f41e4935c34
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 33198
diff changeset
     2
 * Copyright (c) 1997, 2016, 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: 4894
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4894
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: 4894
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: 6418
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    26
#include "code/debugInfoRec.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    27
#include "code/pcDesc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    28
#include "code/scopeDesc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    29
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    30
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    31
#include "runtime/handles.inline.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 33198
diff changeset
    33
ScopeDesc::ScopeDesc(const CompiledMethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  _code          = code;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  _decode_offset = decode_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  _objects       = decode_object_values(obj_decode_offset);
3686
69c1b5228547 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents: 3600
diff changeset
    37
  _reexecute     = reexecute;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 30186
diff changeset
    38
  _rethrow_exception = rethrow_exception;
4894
8a76fd3d098d 6910618: C2: Error: assert(d->is_oop(),"JVM_ArrayCopy: dst not an oop")
kvn
parents: 3686
diff changeset
    39
  _return_oop    = return_oop;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  decode_body();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
38133
78b95467b9f1 8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents: 33198
diff changeset
    43
ScopeDesc::ScopeDesc(const CompiledMethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  _code          = code;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  _decode_offset = decode_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  _objects       = decode_object_values(DebugInformationRecorder::serialized_null);
3686
69c1b5228547 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents: 3600
diff changeset
    47
  _reexecute     = reexecute;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 30186
diff changeset
    48
  _rethrow_exception = rethrow_exception;
4894
8a76fd3d098d 6910618: C2: Error: assert(d->is_oop(),"JVM_ArrayCopy: dst not an oop")
kvn
parents: 3686
diff changeset
    49
  _return_oop    = return_oop;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  decode_body();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    54
void ScopeDesc::initialize(const ScopeDesc* parent, int decode_offset) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  _code          = parent->_code;
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    56
  _decode_offset = decode_offset;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  _objects       = parent->_objects;
3686
69c1b5228547 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents: 3600
diff changeset
    58
  _reexecute     = false; //reexecute only applies to the first scope
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 30186
diff changeset
    59
  _rethrow_exception = false;
4894
8a76fd3d098d 6910618: C2: Error: assert(d->is_oop(),"JVM_ArrayCopy: dst not an oop")
kvn
parents: 3686
diff changeset
    60
  _return_oop    = false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  decode_body();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
53065
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    64
ScopeDesc::ScopeDesc(const ScopeDesc* parent) {
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    65
  initialize(parent, parent->_sender_decode_offset);
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    66
}
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    67
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    68
ScopeDesc::ScopeDesc(const ScopeDesc* parent, int decode_offset) {
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    69
  initialize(parent, decode_offset);
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    70
}
2f41e4935c34 8215205: javaVFrame much slower than vframeStream
dlong
parents: 47799
diff changeset
    71
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
void ScopeDesc::decode_body() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  if (decode_offset() == DebugInformationRecorder::serialized_null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    // This is a sentinel record, which is only relevant to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    // approximate queries.  Decode a reasonable frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    _sender_decode_offset = DebugInformationRecorder::serialized_null;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    78
    _method = _code->method();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    _bci = InvocationEntryBci;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    _locals_decode_offset = DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    _expressions_decode_offset = DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    _monitors_decode_offset = DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    // decode header
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    DebugInfoReadStream* stream  = stream_at(decode_offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    _sender_decode_offset = stream->read_int();
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    88
    _method = stream->read_method();
3686
69c1b5228547 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents: 3600
diff changeset
    89
    _bci    = stream->read_bci();
3600
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 670
diff changeset
    90
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    // decode offsets for body and sender
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    _locals_decode_offset      = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    _expressions_decode_offset = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    _monitors_decode_offset    = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
GrowableArray<ScopeValue*>* ScopeDesc::decode_scope_values(int decode_offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  DebugInfoReadStream* stream = stream_at(decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  int length = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  GrowableArray<ScopeValue*>* result = new GrowableArray<ScopeValue*> (length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  for (int index = 0; index < length; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    result->push(ScopeValue::read_from(stream));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
GrowableArray<ScopeValue*>* ScopeDesc::decode_object_values(int decode_offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  GrowableArray<ScopeValue*>* result = new GrowableArray<ScopeValue*>();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  DebugInfoReadStream* stream = new DebugInfoReadStream(_code, decode_offset, result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  int length = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  for (int index = 0; index < length; index++) {
217
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
   116
    // Objects values are pushed to 'result' array during read so that
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
   117
    // object's fields could reference it (OBJECT_ID_CODE).
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
   118
    (void)ScopeValue::read_from(stream);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  assert(result->length() == length, "inconsistent debug information");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
GrowableArray<MonitorValue*>* ScopeDesc::decode_monitor_values(int decode_offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  DebugInfoReadStream* stream  = stream_at(decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  int length = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  GrowableArray<MonitorValue*>* result = new GrowableArray<MonitorValue*> (length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  for (int index = 0; index < length; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    result->push(new MonitorValue(stream));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
DebugInfoReadStream* ScopeDesc::stream_at(int decode_offset) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  return new DebugInfoReadStream(_code, decode_offset, _objects);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
GrowableArray<ScopeValue*>* ScopeDesc::locals() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  return decode_scope_values(_locals_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
GrowableArray<ScopeValue*>* ScopeDesc::expressions() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  return decode_scope_values(_expressions_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
GrowableArray<MonitorValue*>* ScopeDesc::monitors() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  return decode_monitor_values(_monitors_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
GrowableArray<ScopeValue*>* ScopeDesc::objects() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  return _objects;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
bool ScopeDesc::is_top() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
 return _sender_decode_offset == DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
ScopeDesc* ScopeDesc::sender() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  if (is_top()) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  return new ScopeDesc(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
void ScopeDesc::print_value_on(outputStream* st) const {
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   169
  st->print("  ");
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   170
  method()->print_short_name(st);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  int lineno = method()->line_number_from_bci(bci());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  if (lineno != -1) {
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   173
    st->print("@%d (line %d)", bci(), lineno);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  } else {
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   175
    st->print("@%d", bci());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  }
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   177
  if (should_reexecute()) {
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   178
    st->print("  reexecute=true");
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   179
  }
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   180
  st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
void ScopeDesc::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  print_on(st, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
void ScopeDesc::print_on(outputStream* st, PcDesc* pd) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  // header
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  if (pd != NULL) {
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 30186
diff changeset
   190
    st->print_cr("ScopeDesc(pc=" PTR_FORMAT " offset=%x):", p2i(pd->real_pc(_code)), pd->pc_offset());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  // decode offsets
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  if (WizardMode) {
33148
68fa8b6c4340 8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents: 30186
diff changeset
   196
    st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, p2i(_code->content_begin()));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    st->print_cr(" offset:     %d",    _decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    st->print_cr(" bci:        %d",    bci());
3600
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 670
diff changeset
   199
    st->print_cr(" reexecute:  %s",    should_reexecute() ? "true" : "false");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
    st->print_cr(" locals:     %d",    _locals_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    st->print_cr(" stack:      %d",    _expressions_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    st->print_cr(" monitor:    %d",    _monitors_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
    st->print_cr(" sender:     %d",    _sender_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  // locals
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  { GrowableArray<ScopeValue*>* l = ((ScopeDesc*) this)->locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    if (l != NULL) {
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   208
      st->print_cr("   Locals");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
      for (int index = 0; index < l->length(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
        st->print("    - l%d: ", index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
        l->at(index)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
        st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  // expressions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  { GrowableArray<ScopeValue*>* l = ((ScopeDesc*) this)->expressions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    if (l != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
      st->print_cr("   Expression stack");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
      for (int index = 0; index < l->length(); index++) {
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   221
        st->print("    - @%d: ", index);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
        l->at(index)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
        st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  // monitors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  { GrowableArray<MonitorValue*>* l = ((ScopeDesc*) this)->monitors();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    if (l != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
      st->print_cr("   Monitor stack");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
      for (int index = 0; index < l->length(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
        st->print("    - @%d: ", index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
        l->at(index)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
        st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
47799
1772ebf07d1f 8152470: Add COMPILER2_OR_JVMCI definition
jcm
parents: 47216
diff changeset
   239
#if COMPILER2_OR_JVMCI
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 30186
diff changeset
   240
  if (NOT_JVMCI(DoEscapeAnalysis &&) is_top() && _objects != NULL) {
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   241
    st->print_cr("   Objects");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
    for (int i = 0; i < _objects->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
      ObjectValue* sv = (ObjectValue*) _objects->at(i);
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   244
      st->print("    - %d: ", sv->id());
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 30186
diff changeset
   245
      st->print("%s ", java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()())->external_name());
30186
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   246
      sv->print_fields_on(st);
a416fa6a0fe7 8075270: Print locals & stack slots location for PcDescs
vlivanov
parents: 24424
diff changeset
   247
      st->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  }
47799
1772ebf07d1f 8152470: Add COMPILER2_OR_JVMCI definition
jcm
parents: 47216
diff changeset
   250
#endif // COMPILER2_OR_JVMCI
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
void ScopeDesc::verify() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  guarantee(method()->is_method(), "type check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  // check if we have any illegal elements on the expression stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  { GrowableArray<ScopeValue*>* l = expressions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    if (l != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
      for (int index = 0; index < l->length(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
       //guarantee(!l->at(index)->is_illegal(), "expression element cannot be illegal");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
}