hotspot/src/share/vm/code/debugInfo.hpp
author ant
Fri, 04 Dec 2009 15:07:15 +0300
changeset 4369 18b883ed2b58
parent 3686 69c1b5228547
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
/*
3686
69c1b5228547 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents: 3600
diff changeset
     2
 * Copyright 1997-2009 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
// Classes used for serializing debugging information.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
// These abstractions are introducted to provide symmetric
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
// read and write operations.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
// ScopeValue        describes the value of a variable/expression in a scope
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// - LocationValue   describes a value in a given location (in frame or register)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// - ConstantValue   describes a constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class ScopeValue: public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  // Testers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  virtual bool is_location() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  virtual bool is_object() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  virtual bool is_constant_int() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  virtual bool is_constant_double() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  virtual bool is_constant_long() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  virtual bool is_constant_oop() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  virtual bool equals(ScopeValue* other) const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  virtual void write_on(DebugInfoWriteStream* stream) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  static ScopeValue* read_from(DebugInfoReadStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// A Location value describes a value in a given location; i.e. the corresponding
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// logical entity (e.g., a method temporary) lives in this location.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
class LocationValue: public ScopeValue {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  Location  _location;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  LocationValue(Location location)           { _location = location; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  bool      is_location() const              { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  Location  location() const                 { return _location; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  LocationValue(DebugInfoReadStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  void write_on(DebugInfoWriteStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// An ObjectValue describes an object eliminated by escape analysis.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
class ObjectValue: public ScopeValue {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  int                        _id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  ScopeValue*                _klass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  GrowableArray<ScopeValue*> _field_values;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  Handle                     _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  bool                       _visited;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  ObjectValue(int id, ScopeValue* klass)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
     : _id(id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
     , _klass(klass)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
     , _field_values()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
     , _value()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
     , _visited(false) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    assert(klass->is_constant_oop(), "should be constant klass oop");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  ObjectValue(int id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
     : _id(id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
     , _klass(NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
     , _field_values()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
     , _value()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
     , _visited(false) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  // Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  bool                        is_object() const         { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  int                         id() const                { return _id; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  ScopeValue*                 klass() const             { return _klass; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  GrowableArray<ScopeValue*>* field_values()            { return &_field_values; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  ScopeValue*                 field_at(int i) const     { return _field_values.at(i); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  int                         field_size()              { return _field_values.length(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  Handle                      value() const             { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  bool                        is_visited() const        { return _visited; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  void                        set_value(oop value)      { _value = Handle(value); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  void                        set_visited(bool visited) { _visited = false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  void read_object(DebugInfoReadStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  void write_on(DebugInfoWriteStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  void print_fields_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
// A ConstantIntValue describes a constant int; i.e., the corresponding logical entity
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
// is either a source constant or its computation has been constant-folded.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
class ConstantIntValue: public ScopeValue {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  jint _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  ConstantIntValue(jint value)         { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  jint value() const                   { return _value;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  bool is_constant_int() const         { return true;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  bool equals(ScopeValue* other) const { return false;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  ConstantIntValue(DebugInfoReadStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  void write_on(DebugInfoWriteStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
class ConstantLongValue: public ScopeValue {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  jlong _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  ConstantLongValue(jlong value)       { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  jlong value() const                  { return _value;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  bool is_constant_long() const        { return true;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  bool equals(ScopeValue* other) const { return false;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  ConstantLongValue(DebugInfoReadStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  void write_on(DebugInfoWriteStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
class ConstantDoubleValue: public ScopeValue {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  jdouble _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  ConstantDoubleValue(jdouble value)   { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  jdouble value() const                { return _value;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  bool is_constant_double() const      { return true;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  bool equals(ScopeValue* other) const { return false;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  ConstantDoubleValue(DebugInfoReadStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  void write_on(DebugInfoWriteStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
// A ConstantOopWriteValue is created by the compiler to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
// be written as debugging information.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
class ConstantOopWriteValue: public ScopeValue {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  jobject _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  ConstantOopWriteValue(jobject value) { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  jobject value() const                { return _value;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  bool is_constant_oop() const         { return true;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  bool equals(ScopeValue* other) const { return false;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  void write_on(DebugInfoWriteStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
// A ConstantOopReadValue is created by the VM when reading
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
// debug information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
class ConstantOopReadValue: public ScopeValue {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  Handle _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  Handle value() const                 { return _value;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  bool is_constant_oop() const         { return true;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  bool equals(ScopeValue* other) const { return false;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  ConstantOopReadValue(DebugInfoReadStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  void write_on(DebugInfoWriteStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
// MonitorValue describes the pair used for monitor_enter and monitor_exit.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
class MonitorValue: public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  ScopeValue* _owner;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  Location    _basic_lock;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  bool        _eliminated;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  // Constructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  MonitorValue(ScopeValue* owner, Location basic_lock, bool eliminated = false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  // Accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  ScopeValue*  owner()      const { return _owner; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  Location     basic_lock() const { return _basic_lock;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  bool         eliminated() const { return _eliminated; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  // Serialization of debugging information
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  MonitorValue(DebugInfoReadStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  void write_on(DebugInfoWriteStream* stream);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  // Printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  void print_on(outputStream* st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
// DebugInfoReadStream specializes CompressedReadStream for reading
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
// debugging information. Used by ScopeDesc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
class DebugInfoReadStream : public CompressedReadStream {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  const nmethod* _code;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  const nmethod* code() const { return _code; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  GrowableArray<ScopeValue*>* _obj_pool;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  DebugInfoReadStream(const nmethod* code, int offset, GrowableArray<ScopeValue*>* obj_pool = NULL) :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
    CompressedReadStream(code->scopes_data_begin(), offset) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
    _code = code;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    _obj_pool = obj_pool;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  } ;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  oop read_oop() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    return code()->oop_at(read_int());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  ScopeValue* read_object_value();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  ScopeValue* get_cached_object();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  // BCI encoding is mostly unsigned, but -1 is a distinguished value
3686
69c1b5228547 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents: 3600
diff changeset
   258
  int read_bci() { return read_int() + InvocationEntryBci; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
// DebugInfoWriteStream specializes CompressedWriteStream for
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
// writing debugging information. Used by ScopeDescRecorder.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
class DebugInfoWriteStream : public CompressedWriteStream {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  DebugInformationRecorder* _recorder;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  DebugInformationRecorder* recorder() const { return _recorder; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  void write_handle(jobject h);
3686
69c1b5228547 6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
cfang
parents: 3600
diff changeset
   271
  void write_bci(int bci) { write_int(bci - InvocationEntryBci); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
};