src/hotspot/share/code/debugInfo.cpp
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58015 dd84de796f2c
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
49192
6734eeef4283 8198474: Move JNIHandles::resolve into jniHandles.inline.hpp
kbarrett
parents: 48120
diff changeset
     2
 * Copyright (c) 1997, 2018, 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: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
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: 670
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "code/debugInfo.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "code/debugInfoRec.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "code/nmethod.hpp"
54786
ebf733a324d4 8223624: Cleanup includes of universe.hpp
stefank
parents: 51268
diff changeset
    29
#include "memory/universe.hpp"
31406
4121166054b6 8087183: Fix call to inline function is_oop in header debugInfo.hpp.
goetz
parents: 24424
diff changeset
    30
#include "oops/oop.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "runtime/handles.inline.hpp"
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49192
diff changeset
    32
#include "runtime/interfaceSupport.inline.hpp"
49192
6734eeef4283 8198474: Move JNIHandles::resolve into jniHandles.inline.hpp
kbarrett
parents: 48120
diff changeset
    33
#include "runtime/jniHandles.inline.hpp"
48120
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
    34
#include "runtime/thread.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 13728
diff changeset
    36
// Constructors
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
: CompressedWriteStream(initial_size) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  _recorder = recorder;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// Serializing oops
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
void DebugInfoWriteStream::write_handle(jobject h) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  write_int(recorder()->oop_recorder()->find_index(h));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    49
void DebugInfoWriteStream::write_metadata(Metadata* h) {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    50
  write_int(recorder()->oop_recorder()->find_index(h));
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    51
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    52
31406
4121166054b6 8087183: Fix call to inline function is_oop in header debugInfo.hpp.
goetz
parents: 24424
diff changeset
    53
oop DebugInfoReadStream::read_oop() {
4121166054b6 8087183: Fix call to inline function is_oop in header debugInfo.hpp.
goetz
parents: 24424
diff changeset
    54
  oop o = code()->oop_at(read_int());
46968
9119841280f4 8160399: is_oop_or_null involves undefined behavior
coleenp
parents: 46630
diff changeset
    55
  assert(oopDesc::is_oop_or_null(o), "oop only");
31406
4121166054b6 8087183: Fix call to inline function is_oop in header debugInfo.hpp.
goetz
parents: 24424
diff changeset
    56
  return o;
4121166054b6 8087183: Fix call to inline function is_oop in header debugInfo.hpp.
goetz
parents: 24424
diff changeset
    57
}
4121166054b6 8087183: Fix call to inline function is_oop in header debugInfo.hpp.
goetz
parents: 24424
diff changeset
    58
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
    59
ScopeValue* DebugInfoReadStream::read_object_value(bool is_auto_box) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  int id = read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  assert(_obj_pool != NULL, "object pool does not exist");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  for (int i = _obj_pool->length() - 1; i >= 0; i--) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 31406
diff changeset
    64
    assert(_obj_pool->at(i)->as_ObjectValue()->id() != id, "should not be read twice");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
#endif
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
    67
  ObjectValue* result = is_auto_box ? new AutoBoxObjectValue(id) : new ObjectValue(id);
217
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    68
  // 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
    69
  _obj_pool->push(result);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  result->read_object(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  return result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
ScopeValue* DebugInfoReadStream::get_cached_object() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  int id = read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  assert(_obj_pool != NULL, "object pool does not exist");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  for (int i = _obj_pool->length() - 1; i >= 0; i--) {
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 31406
diff changeset
    78
    ObjectValue* ov = _obj_pool->at(i)->as_ObjectValue();
217
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    79
    if (ov->id() == id) {
c646ef2f5d58 6667620: (Escape Analysis) fix deoptimization for scalar replaced objects
kvn
parents: 1
diff changeset
    80
      return ov;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  return NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
// Serializing scope values
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
enum { LOCATION_CODE = 0, CONSTANT_INT_CODE = 1,  CONSTANT_OOP_CODE = 2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
                          CONSTANT_LONG_CODE = 3, CONSTANT_DOUBLE_CODE = 4,
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
    91
                          OBJECT_CODE = 5,        OBJECT_ID_CODE = 6,
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
    92
                          AUTO_BOX_OBJECT_CODE = 7 };
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
ScopeValue* ScopeValue::read_from(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  ScopeValue* result = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  switch(stream->read_int()) {
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
    97
   case LOCATION_CODE:        result = new LocationValue(stream);                        break;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
    98
   case CONSTANT_INT_CODE:    result = new ConstantIntValue(stream);                     break;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
    99
   case CONSTANT_OOP_CODE:    result = new ConstantOopReadValue(stream);                 break;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
   100
   case CONSTANT_LONG_CODE:   result = new ConstantLongValue(stream);                    break;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
   101
   case CONSTANT_DOUBLE_CODE: result = new ConstantDoubleValue(stream);                  break;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
   102
   case OBJECT_CODE:          result = stream->read_object_value(false /*is_auto_box*/); break;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
   103
   case AUTO_BOX_OBJECT_CODE: result = stream->read_object_value(true /*is_auto_box*/);  break;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
   104
   case OBJECT_ID_CODE:       result = stream->get_cached_object();                      break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
   default: ShouldNotReachHere();
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
// LocationValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
LocationValue::LocationValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  _location = Location(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
void LocationValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  stream->write_int(LOCATION_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  location().write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
void LocationValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  location().print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
// ObjectValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49192
diff changeset
   127
void ObjectValue::set_value(oop value) {
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49192
diff changeset
   128
  _value = Handle(Thread::current(), value);
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49192
diff changeset
   129
}
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49192
diff changeset
   130
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
void ObjectValue::read_object(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  _klass = read_from(stream);
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   133
  assert(_klass->is_constant_oop(), "should be constant java mirror oop");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  int length = stream->read_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  for (int i = 0; i < length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    ScopeValue* val = read_from(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    _field_values.append(val);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
void ObjectValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  if (_visited) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    stream->write_int(OBJECT_ID_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    stream->write_int(_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
    _visited = true;
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
   147
    stream->write_int(is_auto_box() ? AUTO_BOX_OBJECT_CODE : OBJECT_CODE);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    stream->write_int(_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    _klass->write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    int length = _field_values.length();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    stream->write_int(length);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    for (int i = 0; i < length; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
      _field_values.at(i)->write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
void ObjectValue::print_on(outputStream* st) const {
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents: 54786
diff changeset
   159
  st->print("%s[%d]", is_auto_box() ? "box_obj" : "obj", _id);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
void ObjectValue::print_fields_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  if (_field_values.length() > 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
    _field_values.at(0)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  for (int i = 1; i < _field_values.length(); i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    st->print(", ");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
    _field_values.at(i)->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
// ConstantIntValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
ConstantIntValue::ConstantIntValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  _value = stream->read_signed_int();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
void ConstantIntValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  stream->write_int(CONSTANT_INT_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  stream->write_signed_int(value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
void ConstantIntValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  st->print("%d", value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
// ConstantLongValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
ConstantLongValue::ConstantLongValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  _value = stream->read_long();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
void ConstantLongValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  stream->write_int(CONSTANT_LONG_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  stream->write_long(value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
void ConstantLongValue::print_on(outputStream* st) const {
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 46271
diff changeset
   201
  st->print(JLONG_FORMAT, value());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
// ConstantDoubleValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
ConstantDoubleValue::ConstantDoubleValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  _value = stream->read_double();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
void ConstantDoubleValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  stream->write_int(CONSTANT_DOUBLE_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  stream->write_double(value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
void ConstantDoubleValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  st->print("%f", value());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
// ConstantOopWriteValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) {
48120
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   222
#ifdef ASSERT
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   223
  {
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   224
    // cannot use ThreadInVMfromNative here since in case of JVMCI compiler,
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   225
    // thread is already in VM state.
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   226
    ThreadInVMfromUnknown tiv;
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   227
    assert(JNIHandles::resolve(value()) == NULL ||
58015
dd84de796f2c 8224815: Remove non-GC uses of CollectedHeap::is_in_reserved()
eosterlund
parents: 55159
diff changeset
   228
           Universe::heap()->is_in(JNIHandles::resolve(value())),
48120
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   229
           "Should be in heap");
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   230
 }
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   231
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  stream->write_int(CONSTANT_OOP_CODE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  stream->write_handle(value());
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 ConstantOopWriteValue::print_on(outputStream* st) const {
48120
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   237
  // using ThreadInVMfromUnknown here since in case of JVMCI compiler,
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   238
  // thread is already in VM state.
bb957f109a1f 8191227: issues with unsafe handle resolution
rraghavan
parents: 47216
diff changeset
   239
  ThreadInVMfromUnknown tiv;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  JNIHandles::resolve(value())->print_value_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
// ConstantOopReadValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) {
46271
979ebd346ecf 8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents: 33198
diff changeset
   247
  _value = Handle(Thread::current(), stream->read_oop());
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   248
  assert(_value() == NULL ||
58015
dd84de796f2c 8224815: Remove non-GC uses of CollectedHeap::is_in_reserved()
eosterlund
parents: 55159
diff changeset
   249
         Universe::heap()->is_in(_value()), "Should be in heap");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
void ConstantOopReadValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
void ConstantOopReadValue::print_on(outputStream* st) const {
51268
4ac20e5f96ce 8202171: Some oopDesc functions compare this with NULL
hseigel
parents: 49449
diff changeset
   257
  if (value()() != NULL) {
4ac20e5f96ce 8202171: Some oopDesc functions compare this with NULL
hseigel
parents: 49449
diff changeset
   258
    value()()->print_value_on(st);
4ac20e5f96ce 8202171: Some oopDesc functions compare this with NULL
hseigel
parents: 49449
diff changeset
   259
  } else {
4ac20e5f96ce 8202171: Some oopDesc functions compare this with NULL
hseigel
parents: 49449
diff changeset
   260
    st->print_cr("NULL");
4ac20e5f96ce 8202171: Some oopDesc functions compare this with NULL
hseigel
parents: 49449
diff changeset
   261
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
// MonitorValue
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
MonitorValue::MonitorValue(ScopeValue* owner, Location basic_lock, bool eliminated) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  _owner       = owner;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  _basic_lock  = basic_lock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  _eliminated  = eliminated;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
MonitorValue::MonitorValue(DebugInfoReadStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  _basic_lock  = Location(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  _owner       = ScopeValue::read_from(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  _eliminated  = (stream->read_bool() != 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
void MonitorValue::write_on(DebugInfoWriteStream* stream) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  _basic_lock.write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  _owner->write_on(stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  stream->write_bool(_eliminated);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
void MonitorValue::print_on(outputStream* st) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  st->print("monitor{");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  owner()->print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  st->print(",");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  basic_lock().print_on(st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  st->print("}");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  if (_eliminated) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
    st->print(" (eliminated)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
#endif