hotspot/src/share/vm/code/debugInfo.cpp
author ant
Fri, 04 Dec 2009 15:07:15 +0300
changeset 4369 18b883ed2b58
parent 670 ddf3e9583f2f
child 5547 f4b087cbb361
permissions -rw-r--r--
6903354: deadlock involving Component.show & SunToolkit.getImageFromHash Reviewed-by: art, bae
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/_debugInfo.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// Comstructors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
: CompressedWriteStream(initial_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  _recorder = recorder;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// Serializing oops
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
void DebugInfoWriteStream::write_handle(jobject h) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  write_int(recorder()->oop_recorder()->find_index(h));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
ScopeValue* DebugInfoReadStream::read_object_value() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  int id = read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  assert(_obj_pool != NULL, "object pool does not exist");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  for (int i = _obj_pool->length() - 1; i >= 0; i--) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    assert(((ObjectValue*) _obj_pool->at(i))->id() != id, "should not be read twice");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  ObjectValue* result = new ObjectValue(id);
217
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    50
  // Cache the object since an object field could reference it.
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    51
  _obj_pool->push(result);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  result->read_object(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
ScopeValue* DebugInfoReadStream::get_cached_object() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  int id = read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  assert(_obj_pool != NULL, "object pool does not exist");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  for (int i = _obj_pool->length() - 1; i >= 0; i--) {
217
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    60
    ObjectValue* ov = (ObjectValue*) _obj_pool->at(i);
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    61
    if (ov->id() == id) {
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    62
      return ov;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// Serializing scope values
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1,  CONSTANT_OOP_CODE = 2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
                          CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
                          OBJECT_CODE = 5,        OBJECT_ID_CODE = 6 };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  ScopeValue* result = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  switch(stream->read_int()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
   case LOCATION_CODE:        result = new LocationValue(stream);        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
   case CONSTANT_INT_CODE:    result = new ConstantIntValue(stream);     break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
   case CONSTANT_OOP_CODE:    result = new ConstantOopReadValue(stream); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
   case CONSTANT_LONG_CODE:   result = new ConstantLongValue(stream);    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
   case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream);  break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
   case OBJECT_CODE:          result = stream->read_object_value();      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
   case OBJECT_ID_CODE:       result = stream->get_cached_object();      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
   default: ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
// LocationValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
LocationValue::LocationValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  _location = Location(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
void LocationValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  stream->write_int(LOCATION_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  location().write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
void LocationValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  location().print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
// ObjectValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
void ObjectValue::read_object(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  _klass = read_from(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  assert(_klass->is_constant_oop(), "should be constant klass oop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  int length = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  for (int i = 0; i < length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    ScopeValue* val = read_from(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    _field_values.append(val);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
void ObjectValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  if (_visited) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    stream->write_int(OBJECT_ID_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    stream->write_int(_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    _visited = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    stream->write_int(OBJECT_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    stream->write_int(_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    _klass->write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    int length = _field_values.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    stream->write_int(length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    for (int i = 0; i < length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
      _field_values.at(i)->write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
void ObjectValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  st->print("obj[%d]", _id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
void ObjectValue::print_fields_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  if (_field_values.length() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
    _field_values.at(0)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  for (int i = 1; i < _field_values.length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    st->print(", ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    _field_values.at(i)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
// ConstantIntValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
ConstantIntValue::ConstantIntValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  _value = stream->read_signed_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
void ConstantIntValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  stream->write_int(CONSTANT_INT_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  stream->write_signed_int(value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
void ConstantIntValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  st->print("%d", value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
// ConstantLongValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
ConstantLongValue::ConstantLongValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  _value = stream->read_long();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
void ConstantLongValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  stream->write_int(CONSTANT_LONG_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  stream->write_long(value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
void ConstantLongValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  st->print(INT64_FORMAT, value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
// ConstantDoubleValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
ConstantDoubleValue::ConstantDoubleValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  _value = stream->read_double();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
void ConstantDoubleValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  stream->write_int(CONSTANT_DOUBLE_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  stream->write_double(value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
void ConstantDoubleValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  st->print("%f", value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
// ConstantOopWriteValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  stream->write_int(CONSTANT_OOP_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  stream->write_handle(value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
void ConstantOopWriteValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  JNIHandles::resolve(value())->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
// ConstantOopReadValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  _value = Handle(stream->read_oop());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
void ConstantOopReadValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
void ConstantOopReadValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  value()()->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
// MonitorValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
MonitorValue::MonitorValue(ScopeValue* owner, Location basic_lock, bool eliminated) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  _owner       = owner;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  _basic_lock  = basic_lock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  _eliminated  = eliminated;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
MonitorValue::MonitorValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  _basic_lock  = Location(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  _owner       = ScopeValue::read_from(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  _eliminated  = (stream->read_bool() != 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
void MonitorValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  _basic_lock.write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  _owner->write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  stream->write_bool(_eliminated);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
void MonitorValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  st->print("monitor{");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  owner()->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  st->print(",");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  basic_lock().print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  st->print("}");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  if (_eliminated) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    st->print(" (eliminated)");
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