src/share/vm/code/debugInfo.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 "incls/_precompiled.incl"
  26 # include "incls/_debugInfo.cpp.incl"



  27 
  28 // Comstructors
  29 
  30 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
  31 : CompressedWriteStream(initial_size) {
  32   _recorder = recorder;
  33 }
  34 
  35 // Serializing oops
  36 
  37 void DebugInfoWriteStream::write_handle(jobject h) {
  38   write_int(recorder()->oop_recorder()->find_index(h));
  39 }
  40 
  41 ScopeValue* DebugInfoReadStream::read_object_value() {
  42   int id = read_int();
  43 #ifdef ASSERT
  44   assert(_obj_pool != NULL, "object pool does not exist");
  45   for (int i = _obj_pool->length() - 1; i >= 0; i--) {
  46     assert(((ObjectValue*) _obj_pool->at(i))->id() != id, "should not be read twice");


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 "runtime/handles.inline.hpp"
  30 
  31 // Comstructors
  32 
  33 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
  34 : CompressedWriteStream(initial_size) {
  35   _recorder = recorder;
  36 }
  37 
  38 // Serializing oops
  39 
  40 void DebugInfoWriteStream::write_handle(jobject h) {
  41   write_int(recorder()->oop_recorder()->find_index(h));
  42 }
  43 
  44 ScopeValue* DebugInfoReadStream::read_object_value() {
  45   int id = read_int();
  46 #ifdef ASSERT
  47   assert(_obj_pool != NULL, "object pool does not exist");
  48   for (int i = _obj_pool->length() - 1; i >= 0; i--) {
  49     assert(((ObjectValue*) _obj_pool->at(i))->id() != id, "should not be read twice");