81 // adds an oopmap at a specific offset 82 void add_oopmap(int pc_offset, OopMap* map); 83 84 // adds a jvm mapping at pc-offset, for a safepoint only 85 void add_safepoint(int pc_offset, OopMap* map); 86 87 // adds a jvm mapping at pc-offset, for a non-safepoint (profile point) 88 void add_non_safepoint(int pc_offset); 89 90 // Describes debugging information for a scope at the given pc_offset. 91 // Calls must be in non-decreasing order of pc_offset. 92 // If there are several calls at a single pc_offset, 93 // then they occur in the same order as they were performed by the JVM, 94 // with the most recent (innermost) call being described last. 95 // For a safepoint, the pc_offset must have been mentioned 96 // previously by add_safepoint. 97 // Otherwise, the pc_offset must have been mentioned previously 98 // by add_non_safepoint, and the locals, expressions, and monitors 99 // must all be null. 100 void describe_scope(int pc_offset, 101 ciMethod* method, 102 int bci, 103 bool reexecute, 104 bool is_method_handle_invoke = false, 105 bool return_oop = false, 106 DebugToken* locals = NULL, 107 DebugToken* expressions = NULL, 108 DebugToken* monitors = NULL); 109 110 111 void dump_object_pool(GrowableArray<ScopeValue*>* objects); 112 113 // This call must follow every add_safepoint, 114 // after any intervening describe_scope calls. 115 void end_safepoint(int pc_offset) { end_scopes(pc_offset, true); } 116 void end_non_safepoint(int pc_offset) { end_scopes(pc_offset, false); } 117 118 // helper fuctions for describe_scope to enable sharing 119 DebugToken* create_scope_values(GrowableArray<ScopeValue*>* values); 120 DebugToken* create_monitor_values(GrowableArray<MonitorValue*>* monitors); 121 122 // returns the size of the generated scopeDescs. 123 int data_size(); 126 int metadata_size() { return oop_recorder()->metadata_size(); } 127 128 // copy the generated debugging information to nmethod 129 void copy_to(nmethod* nm); 130 131 // verifies the debug information 132 void verify(const nmethod* code); 133 134 static void print_statistics() PRODUCT_RETURN; 135 136 // Method for setting oopmaps to temporarily preserve old handling of oopmaps 137 OopMapSet *_oopmaps; 138 void set_oopmaps(OopMapSet *oopmaps) { _oopmaps = oopmaps; } 139 140 OopRecorder* oop_recorder() { return _oop_recorder; } 141 142 int last_pc_offset() { return last_pc()->pc_offset(); } 143 144 bool recording_non_safepoints() { return _recording_non_safepoints; } 145 146 private: 147 friend class ScopeDesc; 148 friend class vframeStreamCommon; 149 friend class DIR_Chunk; 150 151 // True if we are recording non-safepoint scopes. 152 // This flag is set if DebugNonSafepoints is true, or if 153 // JVMTI post_compiled_method_load events are enabled. 154 const bool _recording_non_safepoints; 155 156 DebugInfoWriteStream* _stream; 157 158 DebugInfoWriteStream* stream() const { return _stream; } 159 160 OopRecorder* _oop_recorder; 161 162 // Scopes that have been described so far. 163 GrowableArray<DIR_Chunk*>* _all_chunks; 164 GrowableArray<DIR_Chunk*>* _shared_chunks; 165 DIR_Chunk* _next_chunk; 166 DIR_Chunk* _next_chunk_limit; 167 168 #ifdef ASSERT 169 enum { rs_null, rs_safepoint, rs_non_safepoint }; 170 int _recording_state; 171 #endif 172 173 PcDesc* _pcs; 174 int _pcs_size; 175 int _pcs_length; 176 // Note: Would use GrowableArray<PcDesc>, but structs are not supported. 177 178 // PC of most recent real safepoint before the current one, 179 // updated after end_scopes. 180 int _prev_safepoint_pc; 181 182 PcDesc* last_pc() { 183 guarantee(_pcs_length > 0, "a safepoint must be declared already"); 184 return &_pcs[_pcs_length-1]; | 81 // adds an oopmap at a specific offset 82 void add_oopmap(int pc_offset, OopMap* map); 83 84 // adds a jvm mapping at pc-offset, for a safepoint only 85 void add_safepoint(int pc_offset, OopMap* map); 86 87 // adds a jvm mapping at pc-offset, for a non-safepoint (profile point) 88 void add_non_safepoint(int pc_offset); 89 90 // Describes debugging information for a scope at the given pc_offset. 91 // Calls must be in non-decreasing order of pc_offset. 92 // If there are several calls at a single pc_offset, 93 // then they occur in the same order as they were performed by the JVM, 94 // with the most recent (innermost) call being described last. 95 // For a safepoint, the pc_offset must have been mentioned 96 // previously by add_safepoint. 97 // Otherwise, the pc_offset must have been mentioned previously 98 // by add_non_safepoint, and the locals, expressions, and monitors 99 // must all be null. 100 void describe_scope(int pc_offset, 101 methodHandle methodH, 102 ciMethod* method, 103 int bci, 104 bool reexecute, 105 bool rethrow_exception = false, 106 bool is_method_handle_invoke = false, 107 bool return_oop = false, 108 DebugToken* locals = NULL, 109 DebugToken* expressions = NULL, 110 DebugToken* monitors = NULL); 111 112 113 void dump_object_pool(GrowableArray<ScopeValue*>* objects); 114 115 // This call must follow every add_safepoint, 116 // after any intervening describe_scope calls. 117 void end_safepoint(int pc_offset) { end_scopes(pc_offset, true); } 118 void end_non_safepoint(int pc_offset) { end_scopes(pc_offset, false); } 119 120 // helper fuctions for describe_scope to enable sharing 121 DebugToken* create_scope_values(GrowableArray<ScopeValue*>* values); 122 DebugToken* create_monitor_values(GrowableArray<MonitorValue*>* monitors); 123 124 // returns the size of the generated scopeDescs. 125 int data_size(); 128 int metadata_size() { return oop_recorder()->metadata_size(); } 129 130 // copy the generated debugging information to nmethod 131 void copy_to(nmethod* nm); 132 133 // verifies the debug information 134 void verify(const nmethod* code); 135 136 static void print_statistics() PRODUCT_RETURN; 137 138 // Method for setting oopmaps to temporarily preserve old handling of oopmaps 139 OopMapSet *_oopmaps; 140 void set_oopmaps(OopMapSet *oopmaps) { _oopmaps = oopmaps; } 141 142 OopRecorder* oop_recorder() { return _oop_recorder; } 143 144 int last_pc_offset() { return last_pc()->pc_offset(); } 145 146 bool recording_non_safepoints() { return _recording_non_safepoints; } 147 148 PcDesc* pcs() const { return _pcs; } 149 int pcs_length() const { return _pcs_length; } 150 151 DebugInfoWriteStream* stream() const { return _stream; } 152 153 154 private: 155 friend class ScopeDesc; 156 friend class vframeStreamCommon; 157 friend class DIR_Chunk; 158 159 // True if we are recording non-safepoint scopes. 160 // This flag is set if DebugNonSafepoints is true, or if 161 // JVMTI post_compiled_method_load events are enabled. 162 const bool _recording_non_safepoints; 163 164 DebugInfoWriteStream* _stream; 165 166 OopRecorder* _oop_recorder; 167 168 // Scopes that have been described so far. 169 GrowableArray<DIR_Chunk*>* _all_chunks; 170 #if !INCLUDE_JVMCI 171 GrowableArray<DIR_Chunk*>* _shared_chunks; 172 #endif 173 DIR_Chunk* _next_chunk; 174 DIR_Chunk* _next_chunk_limit; 175 176 #ifdef ASSERT 177 enum { rs_null, rs_safepoint, rs_non_safepoint }; 178 int _recording_state; 179 #endif 180 181 PcDesc* _pcs; 182 int _pcs_size; 183 int _pcs_length; 184 // Note: Would use GrowableArray<PcDesc>, but structs are not supported. 185 186 // PC of most recent real safepoint before the current one, 187 // updated after end_scopes. 188 int _prev_safepoint_pc; 189 190 PcDesc* last_pc() { 191 guarantee(_pcs_length > 0, "a safepoint must be declared already"); 192 return &_pcs[_pcs_length-1]; |