hotspot/src/share/vm/code/debugInfoRec.cpp
changeset 13728 882756847a04
parent 13391 30245956af37
child 19696 bd5a0131bde1
equal deleted inserted replaced
13727:caf5eb7dd4a7 13728:882756847a04
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   303 
   303 
   304   // serialize sender stream offest
   304   // serialize sender stream offest
   305   stream()->write_int(sender_stream_offset);
   305   stream()->write_int(sender_stream_offset);
   306 
   306 
   307   // serialize scope
   307   // serialize scope
   308   jobject method_enc = (method == NULL)? NULL: method->constant_encoding();
   308   Metadata* method_enc = (method == NULL)? NULL: method->constant_encoding();
   309   stream()->write_int(oop_recorder()->find_index(method_enc));
   309   stream()->write_int(oop_recorder()->find_index(method_enc));
   310   stream()->write_bci(bci);
   310   stream()->write_bci(bci);
   311   assert(method == NULL ||
   311   assert(method == NULL ||
   312          (method->is_native() && bci == 0) ||
   312          (method->is_native() && bci == 0) ||
   313          (!method->is_native() && 0 <= bci && bci < method->code_size()) ||
   313          (!method->is_native() && 0 <= bci && bci < method->code_size()) ||
   376   if (is_safepoint) {
   376   if (is_safepoint) {
   377     _prev_safepoint_pc = pc_offset;
   377     _prev_safepoint_pc = pc_offset;
   378   }
   378   }
   379 }
   379 }
   380 
   380 
       
   381 #ifdef ASSERT
       
   382 bool DebugInformationRecorder::recorders_frozen() {
       
   383   return _oop_recorder->is_complete() || _oop_recorder->is_complete();
       
   384 }
       
   385 
       
   386 void DebugInformationRecorder::mark_recorders_frozen() {
       
   387   _oop_recorder->freeze();
       
   388 }
       
   389 #endif // PRODUCT
       
   390 
   381 DebugToken* DebugInformationRecorder::create_scope_values(GrowableArray<ScopeValue*>* values) {
   391 DebugToken* DebugInformationRecorder::create_scope_values(GrowableArray<ScopeValue*>* values) {
   382   assert(!_oop_recorder->is_complete(), "not frozen yet");
   392   assert(!recorders_frozen(), "not frozen yet");
   383   return (DebugToken*) (intptr_t) serialize_scope_values(values);
   393   return (DebugToken*) (intptr_t) serialize_scope_values(values);
   384 }
   394 }
   385 
   395 
   386 
   396 
   387 DebugToken* DebugInformationRecorder::create_monitor_values(GrowableArray<MonitorValue*>* monitors) {
   397 DebugToken* DebugInformationRecorder::create_monitor_values(GrowableArray<MonitorValue*>* monitors) {
   388   assert(!_oop_recorder->is_complete(), "not frozen yet");
   398   assert(!recorders_frozen(), "not frozen yet");
   389   return (DebugToken*) (intptr_t) serialize_monitor_values(monitors);
   399   return (DebugToken*) (intptr_t) serialize_monitor_values(monitors);
   390 }
   400 }
   391 
   401 
   392 
   402 
   393 int DebugInformationRecorder::data_size() {
   403 int DebugInformationRecorder::data_size() {
   394   debug_only(_oop_recorder->oop_size());  // mark it "frozen" for asserts
   404   debug_only(mark_recorders_frozen());  // mark it "frozen" for asserts
   395   return _stream->position();
   405   return _stream->position();
   396 }
   406 }
   397 
   407 
   398 
   408 
   399 int DebugInformationRecorder::pcs_size() {
   409 int DebugInformationRecorder::pcs_size() {
   400   debug_only(_oop_recorder->oop_size());  // mark it "frozen" for asserts
   410   debug_only(mark_recorders_frozen());  // mark it "frozen" for asserts
   401   if (last_pc()->pc_offset() != PcDesc::upper_offset_limit)
   411   if (last_pc()->pc_offset() != PcDesc::upper_offset_limit)
   402     add_new_pc_offset(PcDesc::upper_offset_limit);
   412     add_new_pc_offset(PcDesc::upper_offset_limit);
   403   return _pcs_length * sizeof(PcDesc);
   413   return _pcs_length * sizeof(PcDesc);
   404 }
   414 }
   405 
   415