1 /*
2 * Copyright (c) 2015, 2019, 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 *
271 objArrayOop array_oop = oopFactory::new_objArray(SystemDictionary::Object_klass(),
272 length, CHECK_(objArrayHandle()));
273 objArrayHandle array_h(THREAD, array_oop);
274 for (int i = 0; i < length; i++) {
275 MonitorInfo* monitor = monitors->at(i);
276 array_h->obj_at_put(i, monitor->owner());
277 }
278 return array_h;
279 }
280
281 // Fill StackFrameInfo with bci and initialize memberName
282 void BaseFrameStream::fill_stackframe(Handle stackFrame, const methodHandle& method, TRAPS) {
283 java_lang_StackFrameInfo::set_method_and_bci(stackFrame, method, bci(), THREAD);
284 }
285
286 // Fill LiveStackFrameInfo with locals, monitors, and expressions
287 void LiveFrameStream::fill_live_stackframe(Handle stackFrame,
288 const methodHandle& method, TRAPS) {
289 fill_stackframe(stackFrame, method, CHECK);
290 if (_jvf != NULL) {
291 StackValueCollection* locals = _jvf->locals();
292 StackValueCollection* expressions = _jvf->expressions();
293 GrowableArray<MonitorInfo*>* monitors = _jvf->monitors();
294
295 int mode = 0;
296 if (_jvf->is_interpreted_frame()) {
297 mode = MODE_INTERPRETED;
298 } else if (_jvf->is_compiled_frame()) {
299 mode = MODE_COMPILED;
300 }
301
302 if (!locals->is_empty()) {
303 objArrayHandle locals_h = values_to_object_array(locals, CHECK);
304 java_lang_LiveStackFrameInfo::set_locals(stackFrame(), locals_h());
305 }
306 if (!expressions->is_empty()) {
307 objArrayHandle expressions_h = values_to_object_array(expressions, CHECK);
308 java_lang_LiveStackFrameInfo::set_operands(stackFrame(), expressions_h());
309 }
310 if (monitors->length() > 0) {
|
1 /*
2 * Copyright (c) 2015, 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 *
271 objArrayOop array_oop = oopFactory::new_objArray(SystemDictionary::Object_klass(),
272 length, CHECK_(objArrayHandle()));
273 objArrayHandle array_h(THREAD, array_oop);
274 for (int i = 0; i < length; i++) {
275 MonitorInfo* monitor = monitors->at(i);
276 array_h->obj_at_put(i, monitor->owner());
277 }
278 return array_h;
279 }
280
281 // Fill StackFrameInfo with bci and initialize memberName
282 void BaseFrameStream::fill_stackframe(Handle stackFrame, const methodHandle& method, TRAPS) {
283 java_lang_StackFrameInfo::set_method_and_bci(stackFrame, method, bci(), THREAD);
284 }
285
286 // Fill LiveStackFrameInfo with locals, monitors, and expressions
287 void LiveFrameStream::fill_live_stackframe(Handle stackFrame,
288 const methodHandle& method, TRAPS) {
289 fill_stackframe(stackFrame, method, CHECK);
290 if (_jvf != NULL) {
291 ResourceMark rm(THREAD);
292 HandleMark hm(THREAD);
293
294 StackValueCollection* locals = _jvf->locals();
295 StackValueCollection* expressions = _jvf->expressions();
296 GrowableArray<MonitorInfo*>* monitors = _jvf->monitors();
297
298 int mode = 0;
299 if (_jvf->is_interpreted_frame()) {
300 mode = MODE_INTERPRETED;
301 } else if (_jvf->is_compiled_frame()) {
302 mode = MODE_COMPILED;
303 }
304
305 if (!locals->is_empty()) {
306 objArrayHandle locals_h = values_to_object_array(locals, CHECK);
307 java_lang_LiveStackFrameInfo::set_locals(stackFrame(), locals_h());
308 }
309 if (!expressions->is_empty()) {
310 objArrayHandle expressions_h = values_to_object_array(expressions, CHECK);
311 java_lang_LiveStackFrameInfo::set_operands(stackFrame(), expressions_h());
312 }
313 if (monitors->length() > 0) {
|