< prev index next >

src/hotspot/share/code/debugInfo.cpp

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/debugInfo.hpp"
  27 #include "code/debugInfoRec.hpp"
  28 #include "code/nmethod.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/interfaceSupport.hpp"
  32 #include "runtime/jniHandles.inline.hpp"
  33 #include "runtime/thread.hpp"
  34 
  35 // Constructors
  36 
  37 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
  38 : CompressedWriteStream(initial_size) {
  39   _recorder = recorder;
  40 }
  41 
  42 // Serializing oops
  43 
  44 void DebugInfoWriteStream::write_handle(jobject h) {
  45   write_int(recorder()->oop_recorder()->find_index(h));
  46 }
  47 
  48 void DebugInfoWriteStream::write_metadata(Metadata* h) {
  49   write_int(recorder()->oop_recorder()->find_index(h));
  50 }
  51 


 103   }
 104   return result;
 105 }
 106 
 107 // LocationValue
 108 
 109 LocationValue::LocationValue(DebugInfoReadStream* stream) {
 110   _location = Location(stream);
 111 }
 112 
 113 void LocationValue::write_on(DebugInfoWriteStream* stream) {
 114   stream->write_int(LOCATION_CODE);
 115   location().write_on(stream);
 116 }
 117 
 118 void LocationValue::print_on(outputStream* st) const {
 119   location().print_on(st);
 120 }
 121 
 122 // ObjectValue




 123 
 124 void ObjectValue::read_object(DebugInfoReadStream* stream) {
 125   _klass = read_from(stream);
 126   assert(_klass->is_constant_oop(), "should be constant java mirror oop");
 127   int length = stream->read_int();
 128   for (int i = 0; i < length; i++) {
 129     ScopeValue* val = read_from(stream);
 130     _field_values.append(val);
 131   }
 132 }
 133 
 134 void ObjectValue::write_on(DebugInfoWriteStream* stream) {
 135   if (_visited) {
 136     stream->write_int(OBJECT_ID_CODE);
 137     stream->write_int(_id);
 138   } else {
 139     _visited = true;
 140     stream->write_int(OBJECT_CODE);
 141     stream->write_int(_id);
 142     _klass->write_on(stream);




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/debugInfo.hpp"
  27 #include "code/debugInfoRec.hpp"
  28 #include "code/nmethod.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/interfaceSupport.inline.hpp"
  32 #include "runtime/jniHandles.inline.hpp"
  33 #include "runtime/thread.hpp"
  34 
  35 // Constructors
  36 
  37 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
  38 : CompressedWriteStream(initial_size) {
  39   _recorder = recorder;
  40 }
  41 
  42 // Serializing oops
  43 
  44 void DebugInfoWriteStream::write_handle(jobject h) {
  45   write_int(recorder()->oop_recorder()->find_index(h));
  46 }
  47 
  48 void DebugInfoWriteStream::write_metadata(Metadata* h) {
  49   write_int(recorder()->oop_recorder()->find_index(h));
  50 }
  51 


 103   }
 104   return result;
 105 }
 106 
 107 // LocationValue
 108 
 109 LocationValue::LocationValue(DebugInfoReadStream* stream) {
 110   _location = Location(stream);
 111 }
 112 
 113 void LocationValue::write_on(DebugInfoWriteStream* stream) {
 114   stream->write_int(LOCATION_CODE);
 115   location().write_on(stream);
 116 }
 117 
 118 void LocationValue::print_on(outputStream* st) const {
 119   location().print_on(st);
 120 }
 121 
 122 // ObjectValue
 123 
 124 void ObjectValue::set_value(oop value) {
 125   _value = Handle(Thread::current(), value);
 126 }
 127 
 128 void ObjectValue::read_object(DebugInfoReadStream* stream) {
 129   _klass = read_from(stream);
 130   assert(_klass->is_constant_oop(), "should be constant java mirror oop");
 131   int length = stream->read_int();
 132   for (int i = 0; i < length; i++) {
 133     ScopeValue* val = read_from(stream);
 134     _field_values.append(val);
 135   }
 136 }
 137 
 138 void ObjectValue::write_on(DebugInfoWriteStream* stream) {
 139   if (_visited) {
 140     stream->write_int(OBJECT_ID_CODE);
 141     stream->write_int(_id);
 142   } else {
 143     _visited = true;
 144     stream->write_int(OBJECT_CODE);
 145     stream->write_int(_id);
 146     _klass->write_on(stream);


< prev index next >