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/codeBlob.hpp"
27 #include "code/codeCache.hpp"
28 #include "code/nmethod.hpp"
29 #include "code/scopeDesc.hpp"
30 #include "compiler/oopMap.hpp"
31 #include "gc/shared/collectedHeap.hpp"
32 #include "memory/allocation.inline.hpp"
33 #include "memory/resourceArea.hpp"
34 #include "runtime/frame.inline.hpp"
35 #include "runtime/signature.hpp"
36 #include "utilities/align.hpp"
37 #ifdef COMPILER1
38 #include "c1/c1_Defs.hpp"
39 #endif
40 #ifdef COMPILER2
41 #include "opto/optoreg.hpp"
42 #endif
43 #ifdef SPARC
44 #include "vmreg_sparc.inline.hpp"
45 #endif
46
47 // OopMapStream
48
49 OopMapStream::OopMapStream(OopMap* oop_map, int oop_types_mask) {
50 _stream = new CompressedReadStream(oop_map->write_stream()->buffer());
51 _mask = oop_types_mask;
52 _size = oop_map->omv_count();
53 _position = 0;
351 omv = oms.current();
352 oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
353 guarantee(loc != NULL, "missing saved register");
354 oop *derived_loc = loc;
355 oop *base_loc = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
356 // Ignore NULL oops and decoded NULL narrow oops which
357 // equal to Universe::narrow_oop_base when a narrow oop
358 // implicit null check is used in compiled code.
359 // The narrow_oop_base could be NULL or be the address
360 // of the page below heap depending on compressed oops mode.
361 if (base_loc != NULL && *base_loc != (oop)NULL && !Universe::is_narrow_oop_base(*base_loc)) {
362 derived_oop_fn(base_loc, derived_loc);
363 }
364 oms.next();
365 } while (!oms.is_done());
366 }
367 }
368
369 // We want coop and oop oop_types
370 int mask = OopMapValue::oop_value | OopMapValue::narrowoop_value;
371 {
372 for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) {
373 omv = oms.current();
374 oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
375 // It should be an error if no location can be found for a
376 // register mentioned as contained an oop of some kind. Maybe
377 // this was allowed previously because value_value items might
378 // be missing?
379 guarantee(loc != NULL, "missing saved register");
380 if ( omv.type() == OopMapValue::oop_value ) {
381 oop val = *loc;
382 if (val == (oop)NULL || Universe::is_narrow_oop_base(val)) {
383 // Ignore NULL oops and decoded NULL narrow oops which
384 // equal to Universe::narrow_oop_base when a narrow oop
385 // implicit null check is used in compiled code.
386 // The narrow_oop_base could be NULL or be the address
387 // of the page below heap depending on compressed oops mode.
388 continue;
389 }
390 #ifdef ASSERT
391 if ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) ||
392 !Universe::heap()->is_in_or_null(*loc)) {
393 tty->print_cr("# Found non oop pointer. Dumping state at failure");
394 // try to dump out some helpful debugging information
395 trace_codeblob_maps(fr, reg_map);
396 omv.print();
397 tty->print_cr("register r");
398 omv.reg()->print();
399 tty->print_cr("loc = %p *loc = %p\n", loc, (address)*loc);
400 // do the real assert.
401 assert(Universe::heap()->is_in_or_null(*loc), "found non oop pointer");
402 }
403 #endif // ASSERT
404 oop_fn->do_oop(loc);
405 } else if ( omv.type() == OopMapValue::narrowoop_value ) {
406 narrowOop *nl = (narrowOop*)loc;
407 #ifndef VM_LITTLE_ENDIAN
408 VMReg vmReg = omv.reg();
409 // Don't do this on SPARC float registers as they can be individually addressed
410 if (!vmReg->is_stack() SPARC_ONLY(&& !vmReg->is_FloatRegister())) {
411 // compressed oops in registers only take up 4 bytes of an
412 // 8 byte register but they are in the wrong part of the
413 // word so adjust loc to point at the right place.
414 nl = (narrowOop*)((address)nl + 4);
415 }
416 #endif
417 oop_fn->do_oop(nl);
418 }
419 }
420 }
421 }
422
423
424 // Update callee-saved register info for the following frame
|
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/codeBlob.hpp"
27 #include "code/codeCache.hpp"
28 #include "code/nmethod.hpp"
29 #include "code/scopeDesc.hpp"
30 #include "compiler/oopMap.hpp"
31 #include "gc/shared/collectedHeap.hpp"
32 #include "memory/allocation.inline.hpp"
33 #include "memory/resourceArea.hpp"
34 #include "oops/valueKlass.hpp"
35 #include "runtime/frame.inline.hpp"
36 #include "runtime/signature.hpp"
37 #include "utilities/align.hpp"
38 #ifdef COMPILER1
39 #include "c1/c1_Defs.hpp"
40 #endif
41 #ifdef COMPILER2
42 #include "opto/optoreg.hpp"
43 #endif
44 #ifdef SPARC
45 #include "vmreg_sparc.inline.hpp"
46 #endif
47
48 // OopMapStream
49
50 OopMapStream::OopMapStream(OopMap* oop_map, int oop_types_mask) {
51 _stream = new CompressedReadStream(oop_map->write_stream()->buffer());
52 _mask = oop_types_mask;
53 _size = oop_map->omv_count();
54 _position = 0;
352 omv = oms.current();
353 oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
354 guarantee(loc != NULL, "missing saved register");
355 oop *derived_loc = loc;
356 oop *base_loc = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
357 // Ignore NULL oops and decoded NULL narrow oops which
358 // equal to Universe::narrow_oop_base when a narrow oop
359 // implicit null check is used in compiled code.
360 // The narrow_oop_base could be NULL or be the address
361 // of the page below heap depending on compressed oops mode.
362 if (base_loc != NULL && *base_loc != (oop)NULL && !Universe::is_narrow_oop_base(*base_loc)) {
363 derived_oop_fn(base_loc, derived_loc);
364 }
365 oms.next();
366 } while (!oms.is_done());
367 }
368 }
369
370 // We want coop and oop oop_types
371 int mask = OopMapValue::oop_value | OopMapValue::narrowoop_value;
372 BufferedValuesDealiaser* dealiaser = NULL;
373 {
374 for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) {
375 omv = oms.current();
376 oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
377 // It should be an error if no location can be found for a
378 // register mentioned as contained an oop of some kind. Maybe
379 // this was allowed previously because value_value items might
380 // be missing?
381 guarantee(loc != NULL, "missing saved register");
382 if ( omv.type() == OopMapValue::oop_value ) {
383 oop val = *loc;
384 if (val == (oop)NULL || Universe::is_narrow_oop_base(val)) {
385 // Ignore NULL oops and decoded NULL narrow oops which
386 // equal to Universe::narrow_oop_base when a narrow oop
387 // implicit null check is used in compiled code.
388 // The narrow_oop_base could be NULL or be the address
389 // of the page below heap depending on compressed oops mode.
390 continue;
391 }
392 #ifdef ASSERT
393 if ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) ||
394 (!Universe::heap()->is_in_or_null(*loc)
395 && !VTBuffer::is_in_vt_buffer(*loc))) {
396 tty->print_cr("# Found non oop pointer. Dumping state at failure");
397 // try to dump out some helpful debugging information
398 trace_codeblob_maps(fr, reg_map);
399 omv.print();
400 tty->print_cr("register r");
401 omv.reg()->print();
402 tty->print_cr("loc = %p *loc = %p\n", loc, (address)*loc);
403 // do the real assert.
404 assert(Universe::heap()->is_in_or_null(*loc) || VTBuffer::is_in_vt_buffer(*loc),
405 "found non oop pointer");
406 }
407 #endif // ASSERT
408 if (!VTBuffer::is_in_vt_buffer(*loc)) {
409 oop_fn->do_oop(loc);
410 } else {
411 assert((*loc)->is_value(), "Sanity check");
412 if (dealiaser == NULL) {
413 dealiaser = Thread::current()->buffered_values_dealiaser();
414 }
415 dealiaser->oops_do(oop_fn, *loc);
416 }
417 } else if ( omv.type() == OopMapValue::narrowoop_value ) {
418 narrowOop *nl = (narrowOop*)loc;
419 #ifndef VM_LITTLE_ENDIAN
420 VMReg vmReg = omv.reg();
421 // Don't do this on SPARC float registers as they can be individually addressed
422 if (!vmReg->is_stack() SPARC_ONLY(&& !vmReg->is_FloatRegister())) {
423 // compressed oops in registers only take up 4 bytes of an
424 // 8 byte register but they are in the wrong part of the
425 // word so adjust loc to point at the right place.
426 nl = (narrowOop*)((address)nl + 4);
427 }
428 #endif
429 oop_fn->do_oop(nl);
430 }
431 }
432 }
433 }
434
435
436 // Update callee-saved register info for the following frame
|