1 /*
2 * Copyright (c) 1998, 2015, 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 *
270 assert(ns+1 == _next_chunk, "");
271 _next_chunk = ns;
272 return match->offset();
273 } else {
274 // Inserted this chunk, so nothing to do
275 return serialized_null;
276 }
277 }
278
279
280 // must call add_safepoint before: it sets PcDesc and this routine uses
281 // the last PcDesc set
282 void DebugInformationRecorder::describe_scope(int pc_offset,
283 const methodHandle& methodH,
284 ciMethod* method,
285 int bci,
286 bool reexecute,
287 bool rethrow_exception,
288 bool is_method_handle_invoke,
289 bool return_oop,
290 DebugToken* locals,
291 DebugToken* expressions,
292 DebugToken* monitors) {
293 assert(_recording_state != rs_null, "nesting of recording calls");
294 PcDesc* last_pd = last_pc();
295 assert(last_pd->pc_offset() == pc_offset, "must be last pc");
296 int sender_stream_offset = last_pd->scope_decode_offset();
297 // update the stream offset of current pc desc
298 int stream_offset = stream()->position();
299 last_pd->set_scope_decode_offset(stream_offset);
300
301 // Record flags into pcDesc.
302 last_pd->set_should_reexecute(reexecute);
303 last_pd->set_rethrow_exception(rethrow_exception);
304 last_pd->set_is_method_handle_invoke(is_method_handle_invoke);
305 last_pd->set_return_oop(return_oop);
306
307 // serialize sender stream offest
308 stream()->write_int(sender_stream_offset);
309
310 // serialize scope
311 Metadata* method_enc;
312 if (method != NULL) {
313 method_enc = method->constant_encoding();
314 } else if (methodH.not_null()) {
315 method_enc = methodH();
316 } else {
317 method_enc = NULL;
318 }
319 int method_enc_index = oop_recorder()->find_index(method_enc);
320 stream()->write_int(method_enc_index);
321 stream()->write_bci(bci);
322 assert(method == NULL ||
323 (method->is_native() && bci == 0) ||
324 (!method->is_native() && 0 <= bci && bci < method->code_size()) ||
325 bci == -1, "illegal bci");
|
1 /*
2 * Copyright (c) 1998, 2020, 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 *
270 assert(ns+1 == _next_chunk, "");
271 _next_chunk = ns;
272 return match->offset();
273 } else {
274 // Inserted this chunk, so nothing to do
275 return serialized_null;
276 }
277 }
278
279
280 // must call add_safepoint before: it sets PcDesc and this routine uses
281 // the last PcDesc set
282 void DebugInformationRecorder::describe_scope(int pc_offset,
283 const methodHandle& methodH,
284 ciMethod* method,
285 int bci,
286 bool reexecute,
287 bool rethrow_exception,
288 bool is_method_handle_invoke,
289 bool return_oop,
290 bool not_global_escape_in_scope,
291 bool arg_escape,
292 DebugToken* locals,
293 DebugToken* expressions,
294 DebugToken* monitors) {
295 assert(_recording_state != rs_null, "nesting of recording calls");
296 PcDesc* last_pd = last_pc();
297 assert(last_pd->pc_offset() == pc_offset, "must be last pc");
298 int sender_stream_offset = last_pd->scope_decode_offset();
299 // update the stream offset of current pc desc
300 int stream_offset = stream()->position();
301 last_pd->set_scope_decode_offset(stream_offset);
302
303 // Record flags into pcDesc.
304 last_pd->set_should_reexecute(reexecute);
305 last_pd->set_rethrow_exception(rethrow_exception);
306 last_pd->set_is_method_handle_invoke(is_method_handle_invoke);
307 last_pd->set_return_oop(return_oop);
308 last_pd->set_not_global_escape_in_scope(not_global_escape_in_scope);
309 last_pd->set_arg_escape(arg_escape);
310
311 // serialize sender stream offest
312 stream()->write_int(sender_stream_offset);
313
314 // serialize scope
315 Metadata* method_enc;
316 if (method != NULL) {
317 method_enc = method->constant_encoding();
318 } else if (methodH.not_null()) {
319 method_enc = methodH();
320 } else {
321 method_enc = NULL;
322 }
323 int method_enc_index = oop_recorder()->find_index(method_enc);
324 stream()->write_int(method_enc_index);
325 stream()->write_bci(bci);
326 assert(method == NULL ||
327 (method->is_native() && bci == 0) ||
328 (!method->is_native() && 0 <= bci && bci < method->code_size()) ||
329 bci == -1, "illegal bci");
|