src/share/vm/code/debugInfo.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, 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 // Classes used for serializing debugging information.
  26 // These abstractions are introducted to provide symmetric
  27 // read and write operations.
  28 
  29 // ScopeValue        describes the value of a variable/expression in a scope
  30 // - LocationValue   describes a value in a given location (in frame or register)
  31 // - ConstantValue   describes a constant
  32 
  33 class ScopeValue: public ResourceObj {
  34  public:
  35   // Testers
  36   virtual bool is_location() const { return false; }
  37   virtual bool is_object() const { return false; }
  38   virtual bool is_constant_int() const { return false; }
  39   virtual bool is_constant_double() const { return false; }
  40   virtual bool is_constant_long() const { return false; }
  41   virtual bool is_constant_oop() const { return false; }
  42   virtual bool equals(ScopeValue* other) const { return false; }
  43 
  44   // Serialization of debugging information


 253     return code()->oop_at(read_int());
 254   }
 255   ScopeValue* read_object_value();
 256   ScopeValue* get_cached_object();
 257   // BCI encoding is mostly unsigned, but -1 is a distinguished value
 258   int read_bci() { return read_int() + InvocationEntryBci; }
 259 };
 260 
 261 // DebugInfoWriteStream specializes CompressedWriteStream for
 262 // writing debugging information. Used by ScopeDescRecorder.
 263 
 264 class DebugInfoWriteStream : public CompressedWriteStream {
 265  private:
 266   DebugInformationRecorder* _recorder;
 267   DebugInformationRecorder* recorder() const { return _recorder; }
 268  public:
 269   DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size);
 270   void write_handle(jobject h);
 271   void write_bci(int bci) { write_int(bci - InvocationEntryBci); }
 272 };


   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 #ifndef SHARE_VM_CODE_DEBUGINFO_HPP
  26 #define SHARE_VM_CODE_DEBUGINFO_HPP
  27 
  28 #include "code/compressedStream.hpp"
  29 #include "code/location.hpp"
  30 #include "code/nmethod.hpp"
  31 #include "code/oopRecorder.hpp"
  32 #include "runtime/stackValue.hpp"
  33 #include "utilities/growableArray.hpp"
  34 
  35 // Classes used for serializing debugging information.
  36 // These abstractions are introducted to provide symmetric
  37 // read and write operations.
  38 
  39 // ScopeValue        describes the value of a variable/expression in a scope
  40 // - LocationValue   describes a value in a given location (in frame or register)
  41 // - ConstantValue   describes a constant
  42 
  43 class ScopeValue: public ResourceObj {
  44  public:
  45   // Testers
  46   virtual bool is_location() const { return false; }
  47   virtual bool is_object() const { return false; }
  48   virtual bool is_constant_int() const { return false; }
  49   virtual bool is_constant_double() const { return false; }
  50   virtual bool is_constant_long() const { return false; }
  51   virtual bool is_constant_oop() const { return false; }
  52   virtual bool equals(ScopeValue* other) const { return false; }
  53 
  54   // Serialization of debugging information


 263     return code()->oop_at(read_int());
 264   }
 265   ScopeValue* read_object_value();
 266   ScopeValue* get_cached_object();
 267   // BCI encoding is mostly unsigned, but -1 is a distinguished value
 268   int read_bci() { return read_int() + InvocationEntryBci; }
 269 };
 270 
 271 // DebugInfoWriteStream specializes CompressedWriteStream for
 272 // writing debugging information. Used by ScopeDescRecorder.
 273 
 274 class DebugInfoWriteStream : public CompressedWriteStream {
 275  private:
 276   DebugInformationRecorder* _recorder;
 277   DebugInformationRecorder* recorder() const { return _recorder; }
 278  public:
 279   DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size);
 280   void write_handle(jobject h);
 281   void write_bci(int bci) { write_int(bci - InvocationEntryBci); }
 282 };
 283 
 284 #endif // SHARE_VM_CODE_DEBUGINFO_HPP