< prev index next >

src/share/vm/code/debugInfo.cpp

Print this page




   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 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  32 
  33 // Constructors
  34 
  35 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
  36 : CompressedWriteStream(initial_size) {
  37   _recorder = recorder;
  38 }
  39 
  40 // Serializing oops
  41 
  42 void DebugInfoWriteStream::write_handle(jobject h) {
  43   write_int(recorder()->oop_recorder()->find_index(h));
  44 }
  45 


 187 }
 188 
 189 // ConstantDoubleValue
 190 
 191 ConstantDoubleValue::ConstantDoubleValue(DebugInfoReadStream* stream) {
 192   _value = stream->read_double();
 193 }
 194 
 195 void ConstantDoubleValue::write_on(DebugInfoWriteStream* stream) {
 196   stream->write_int(CONSTANT_DOUBLE_CODE);
 197   stream->write_double(value());
 198 }
 199 
 200 void ConstantDoubleValue::print_on(outputStream* st) const {
 201   st->print("%f", value());
 202 }
 203 
 204 // ConstantOopWriteValue
 205 
 206 void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) {












 207   assert(JNIHandles::resolve(value()) == NULL ||
 208          Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
 209          "Should be in heap");
 210   stream->write_int(CONSTANT_OOP_CODE);
 211   stream->write_handle(value());
 212 }
 213 
 214 void ConstantOopWriteValue::print_on(outputStream* st) const {
 215   JNIHandles::resolve(value())->print_value_on(st);
 216 }
 217 
 218 
 219 // ConstantOopReadValue
 220 
 221 ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) {
 222   _value = Handle(stream->read_oop());
 223   assert(_value() == NULL ||
 224          Universe::heap()->is_in_reserved(_value()), "Should be in heap");
 225 }
 226 




   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 "ci/ciUtilities.hpp"
  27 #include "code/debugInfo.hpp"
  28 #include "code/debugInfoRec.hpp"
  29 #include "code/nmethod.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 
  32 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  33 
  34 // Constructors
  35 
  36 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
  37 : CompressedWriteStream(initial_size) {
  38   _recorder = recorder;
  39 }
  40 
  41 // Serializing oops
  42 
  43 void DebugInfoWriteStream::write_handle(jobject h) {
  44   write_int(recorder()->oop_recorder()->find_index(h));
  45 }
  46 


 188 }
 189 
 190 // ConstantDoubleValue
 191 
 192 ConstantDoubleValue::ConstantDoubleValue(DebugInfoReadStream* stream) {
 193   _value = stream->read_double();
 194 }
 195 
 196 void ConstantDoubleValue::write_on(DebugInfoWriteStream* stream) {
 197   stream->write_int(CONSTANT_DOUBLE_CODE);
 198   stream->write_double(value());
 199 }
 200 
 201 void ConstantDoubleValue::print_on(outputStream* st) const {
 202   st->print("%f", value());
 203 }
 204 
 205 // ConstantOopWriteValue
 206 
 207 void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) {
 208   if (UseShenandoahGC) {
 209     // Work around the compiler bug: we cannot touch JNIHandles when Shenandoah Full GC
 210     // is running. Doing so would invoke obj_equals, which would dereference via broken
 211     // fwdptr, and crash the VM. Solve that by forcing compiler thread to enter VM here.
 212     VM_ENTRY_MARK;
 213     write_on_impl(stream);
 214   } else {
 215     write_on_impl(stream);
 216   }
 217 }
 218 
 219 void ConstantOopWriteValue::write_on_impl(DebugInfoWriteStream* stream) {
 220   assert(JNIHandles::resolve(value()) == NULL ||
 221          Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
 222          "Should be in heap");
 223   stream->write_int(CONSTANT_OOP_CODE);
 224   stream->write_handle(value());
 225 }
 226 
 227 void ConstantOopWriteValue::print_on(outputStream* st) const {
 228   JNIHandles::resolve(value())->print_value_on(st);
 229 }
 230 
 231 
 232 // ConstantOopReadValue
 233 
 234 ConstantOopReadValue::ConstantOopReadValue(DebugInfoReadStream* stream) {
 235   _value = Handle(stream->read_oop());
 236   assert(_value() == NULL ||
 237          Universe::heap()->is_in_reserved(_value()), "Should be in heap");
 238 }
 239 


< prev index next >