hotspot/src/share/vm/code/scopeDesc.cpp
author cfang
Fri, 31 Jul 2009 17:12:33 -0700
changeset 3600 27aa4477d039
parent 670 ddf3e9583f2f
child 3686 69c1b5228547
permissions -rw-r--r--
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot Summary: developed a reexecute logic for the interpreter to reexecute the bytecode when deopt happens Reviewed-by: kvn, never, jrose, twisti
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
670
ddf3e9583f2f 6719955: Update copyright year
xdono
parents: 217
diff changeset
     2
 * Copyright 1997-2008 Sun Microsystems, Inc.  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
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
# include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
# include "incls/_scopeDesc.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
  _code          = code;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  _decode_offset = decode_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  _objects       = decode_object_values(obj_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  decode_body();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  _code          = code;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  _decode_offset = decode_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  _objects       = decode_object_values(DebugInformationRecorder::serialized_null);
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
ScopeDesc::ScopeDesc(const ScopeDesc* parent) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  _code          = parent->_code;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  _decode_offset = parent->_sender_decode_offset;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  _objects       = parent->_objects;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  decode_body();
3600
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 670
diff changeset
    49
  assert(_reexecute == false, "reexecute not allowed");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
void ScopeDesc::decode_body() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  if (decode_offset() == DebugInformationRecorder::serialized_null) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    // This is a sentinel record, which is only relevant to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    // approximate queries.  Decode a reasonable frame.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    _sender_decode_offset = DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    _method = methodHandle(_code->method());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    _bci = InvocationEntryBci;
3600
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 670
diff changeset
    60
    _reexecute = false;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    _locals_decode_offset = DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    _expressions_decode_offset = DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    _monitors_decode_offset = DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    // decode header
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    DebugInfoReadStream* stream  = stream_at(decode_offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    _sender_decode_offset = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    _method = methodHandle((methodOop) stream->read_oop());
3600
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 670
diff changeset
    70
    _bci    = stream->read_bci_and_reexecute(_reexecute);
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 670
diff changeset
    71
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    // decode offsets for body and sender
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    _locals_decode_offset      = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    _expressions_decode_offset = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    _monitors_decode_offset    = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
GrowableArray<ScopeValue*>* ScopeDesc::decode_scope_values(int decode_offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  DebugInfoReadStream* stream = stream_at(decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  int length = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  GrowableArray<ScopeValue*>* result = new GrowableArray<ScopeValue*> (length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  for (int index = 0; index < length; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    result->push(ScopeValue::read_from(stream));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
GrowableArray<ScopeValue*>* ScopeDesc::decode_object_values(int decode_offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  GrowableArray<ScopeValue*>* result = new GrowableArray<ScopeValue*>();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  DebugInfoReadStream* stream = new DebugInfoReadStream(_code, decode_offset, result);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  int length = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  for (int index = 0; index < length; index++) {
217
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    97
    // 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
    98
    // object's fields could reference it (OBJECT_ID_CODE).
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    99
    (void)ScopeValue::read_from(stream);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  assert(result->length() == length, "inconsistent debug information");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
GrowableArray<MonitorValue*>* ScopeDesc::decode_monitor_values(int decode_offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  if (decode_offset == DebugInformationRecorder::serialized_null) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  DebugInfoReadStream* stream  = stream_at(decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  int length = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  GrowableArray<MonitorValue*>* result = new GrowableArray<MonitorValue*> (length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  for (int index = 0; index < length; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    result->push(new MonitorValue(stream));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
DebugInfoReadStream* ScopeDesc::stream_at(int decode_offset) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  return new DebugInfoReadStream(_code, decode_offset, _objects);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
GrowableArray<ScopeValue*>* ScopeDesc::locals() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  return decode_scope_values(_locals_decode_offset);
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<ScopeValue*>* ScopeDesc::expressions() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  return decode_scope_values(_expressions_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
GrowableArray<MonitorValue*>* ScopeDesc::monitors() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  return decode_monitor_values(_monitors_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
GrowableArray<ScopeValue*>* ScopeDesc::objects() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  return _objects;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
bool ScopeDesc::is_top() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
 return _sender_decode_offset == DebugInformationRecorder::serialized_null;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
ScopeDesc* ScopeDesc::sender() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  if (is_top()) return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  return new ScopeDesc(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
void ScopeDesc::print_value_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  tty->print("   ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  method()()->print_short_name(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  int lineno = method()->line_number_from_bci(bci());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  if (lineno != -1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    st->print_cr("@%d (line %d)", bci(), lineno);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    st->print_cr("@%d", bci());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
void ScopeDesc::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  print_on(st, NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
void ScopeDesc::print_on(outputStream* st, PcDesc* pd) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  // header
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  if (pd != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    tty->print_cr("ScopeDesc(pc=" PTR_FORMAT " offset=%x):", pd->real_pc(_code), pd->pc_offset());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  // decode offsets
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  if (WizardMode) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, _code->instructions_begin());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
    st->print_cr(" offset:     %d",    _decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    st->print_cr(" bci:        %d",    bci());
3600
27aa4477d039 6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents: 670
diff changeset
   176
    st->print_cr(" reexecute:  %s",    should_reexecute() ? "true" : "false");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
    st->print_cr(" locals:     %d",    _locals_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    st->print_cr(" stack:      %d",    _expressions_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    st->print_cr(" monitor:    %d",    _monitors_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    st->print_cr(" sender:     %d",    _sender_decode_offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  // locals
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  { GrowableArray<ScopeValue*>* l = ((ScopeDesc*) this)->locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    if (l != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
      tty->print_cr("   Locals");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
      for (int index = 0; index < l->length(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
        st->print("    - l%d: ", index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
        l->at(index)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
        st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  // expressions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  { GrowableArray<ScopeValue*>* l = ((ScopeDesc*) this)->expressions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    if (l != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
      st->print_cr("   Expression stack");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
      for (int index = 0; index < l->length(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
        st->print("   - @%d: ", index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
        l->at(index)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
        st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  // monitors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  { GrowableArray<MonitorValue*>* l = ((ScopeDesc*) this)->monitors();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    if (l != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
      st->print_cr("   Monitor stack");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
      for (int index = 0; index < l->length(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
        st->print("    - @%d: ", index);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
        l->at(index)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
        st->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
      }
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
#ifdef COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  if (DoEscapeAnalysis && is_top() && _objects != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    tty->print_cr("Objects");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    for (int i = 0; i < _objects->length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
      ObjectValue* sv = (ObjectValue*) _objects->at(i);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
      tty->print(" - %d: ", sv->id());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
      sv->print_fields_on(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
      tty->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
#endif // COMPILER2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
void ScopeDesc::verify() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  guarantee(method()->is_method(), "type check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  // check if we have any illegal elements on the expression stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  { GrowableArray<ScopeValue*>* l = expressions();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    if (l != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
      for (int index = 0; index < l->length(); index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
       //guarantee(!l->at(index)->is_illegal(), "expression element cannot be illegal");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
}