hotspot/src/share/vm/compiler/oopMap.cpp

Print this page
rev 611 : Merge

*** 1,10 **** #ifdef USE_PRAGMA_IDENT_SRC #pragma ident "@(#)oopMap.cpp 1.153 07/09/28 10:23:20 JVM" #endif /* ! * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,10 ---- #ifdef USE_PRAGMA_IDENT_SRC #pragma ident "@(#)oopMap.cpp 1.153 07/09/28 10:23:20 JVM" #endif /* ! * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 170,184 **** if (ZapDeadCompiledLocals) set_xxx(reg, OopMapValue::value_value, VMRegImpl::Bad()); } ! void OopMap::set_dead(VMReg reg) { ! // At this time, we only need dead entries in our OopMap when ZapDeadCompiledLocals is active. ! if (ZapDeadCompiledLocals) { ! set_xxx(reg, OopMapValue::dead_value, VMRegImpl::Bad()); ! } } void OopMap::set_callee_saved(VMReg reg, VMReg caller_machine_register ) { set_xxx(reg, OopMapValue::callee_saved_value, caller_machine_register); --- 170,181 ---- if (ZapDeadCompiledLocals) set_xxx(reg, OopMapValue::value_value, VMRegImpl::Bad()); } ! void OopMap::set_narrowoop(VMReg reg) { ! set_xxx(reg, OopMapValue::narrowoop_value, VMRegImpl::Bad()); } void OopMap::set_callee_saved(VMReg reg, VMReg caller_machine_register ) { set_xxx(reg, OopMapValue::callee_saved_value, caller_machine_register);
*** 192,205 **** } else { set_xxx(reg, OopMapValue::derived_oop_value, derived_from_local_register); } } - void OopMap::set_stack_obj(VMReg reg) { - set_xxx(reg, OopMapValue::stack_obj, VMRegImpl::Bad()); - } - // OopMapSet OopMapSet::OopMapSet() { set_om_size(MinOopMapAllocation); set_om_count(0); --- 189,198 ----
*** 306,316 **** assert( m->offset() == pc_offset, "oopmap not found" ); return m; } class DoNothingClosure: public OopClosure { ! public: void do_oop(oop* p) {} }; static DoNothingClosure do_nothing; static void add_derived_oop(oop* base, oop* derived) { #ifndef TIERED --- 299,311 ---- assert( m->offset() == pc_offset, "oopmap not found" ); return m; } class DoNothingClosure: public OopClosure { ! public: ! void do_oop(oop* p) {} ! void do_oop(narrowOop* p) {} }; static DoNothingClosure do_nothing; static void add_derived_oop(oop* base, oop* derived) { #ifndef TIERED
*** 350,376 **** } #endif // PRODUCT void OopMapSet::oops_do(const frame *fr, const RegisterMap* reg_map, OopClosure* f) { // add derived oops to a table ! all_do(fr, reg_map, f, add_derived_oop, &do_nothing, &do_nothing); } void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map, OopClosure* oop_fn, void derived_oop_fn(oop*, oop*), ! OopClosure* value_fn, OopClosure* dead_fn) { CodeBlob* cb = fr->cb(); - { assert(cb != NULL, "no codeblob"); - } NOT_PRODUCT(if (TraceCodeBlobStacks) trace_codeblob_maps(fr, reg_map);) OopMapSet* maps = cb->oop_maps(); OopMap* map = cb->oop_map_for_return_address(fr->pc()); ! assert(map != NULL, " no ptr map found"); // handle derived pointers first (otherwise base pointer may be // changed before derived pointer offset has been collected) OopMapValue omv; { --- 345,369 ---- } #endif // PRODUCT void OopMapSet::oops_do(const frame *fr, const RegisterMap* reg_map, OopClosure* f) { // add derived oops to a table ! all_do(fr, reg_map, f, add_derived_oop, &do_nothing); } void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map, OopClosure* oop_fn, void derived_oop_fn(oop*, oop*), ! OopClosure* value_fn) { CodeBlob* cb = fr->cb(); assert(cb != NULL, "no codeblob"); NOT_PRODUCT(if (TraceCodeBlobStacks) trace_codeblob_maps(fr, reg_map);) OopMapSet* maps = cb->oop_maps(); OopMap* map = cb->oop_map_for_return_address(fr->pc()); ! assert(map != NULL, "no ptr map found"); // handle derived pointers first (otherwise base pointer may be // changed before derived pointer offset has been collected) OopMapValue omv; {
*** 394,442 **** oms.next(); } while (!oms.is_done()); } } ! // We want dead, value and oop oop_types ! int mask = OopMapValue::oop_value | OopMapValue::value_value | OopMapValue::dead_value; { for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) { omv = oms.current(); oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map); if ( loc != NULL ) { if ( omv.type() == OopMapValue::oop_value ) { #ifdef ASSERT ! if (COMPILER2_PRESENT(!DoEscapeAnalysis &&) !Universe::heap()->is_in_or_null(*loc)) { tty->print_cr("# Found non oop pointer. Dumping state at failure"); // try to dump out some helpful debugging information trace_codeblob_maps(fr, reg_map); omv.print(); tty->print_cr("loc = %p *loc = %p\n", loc, (address)*loc); // do the real assert. assert(Universe::heap()->is_in_or_null(*loc), "found non oop pointer"); } #endif // ASSERT oop_fn->do_oop(loc); } else if ( omv.type() == OopMapValue::value_value ) { value_fn->do_oop(loc); ! } else if ( omv.type() == OopMapValue::dead_value ) { ! dead_fn->do_oop(loc); } } } } - - #ifdef COMPILER2 - if (DoEscapeAnalysis) { - for (OopMapStream oms(map, OopMapValue::stack_obj); !oms.is_done(); oms.next()) { - omv = oms.current(); - assert(omv.is_stack_loc(), "should refer to stack location"); - oop loc = (oop) fr->oopmapreg_to_location(omv.reg(),reg_map); - oop_fn->do_oop(&loc); } - } - #endif // COMPILER2 } // Update callee-saved register info for the following frame void OopMapSet::update_register_map(const frame *fr, RegisterMap *reg_map) { --- 387,436 ---- oms.next(); } while (!oms.is_done()); } } ! // We want coop, value and oop oop_types ! int mask = OopMapValue::oop_value | OopMapValue::value_value | OopMapValue::narrowoop_value; { for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) { omv = oms.current(); oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map); if ( loc != NULL ) { if ( omv.type() == OopMapValue::oop_value ) { #ifdef ASSERT ! if ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) || ! !Universe::heap()->is_in_or_null(*loc)) { tty->print_cr("# Found non oop pointer. Dumping state at failure"); // try to dump out some helpful debugging information trace_codeblob_maps(fr, reg_map); omv.print(); + tty->print_cr("register r"); + omv.reg()->print(); tty->print_cr("loc = %p *loc = %p\n", loc, (address)*loc); // do the real assert. assert(Universe::heap()->is_in_or_null(*loc), "found non oop pointer"); } #endif // ASSERT oop_fn->do_oop(loc); } else if ( omv.type() == OopMapValue::value_value ) { value_fn->do_oop(loc); ! } else if ( omv.type() == OopMapValue::narrowoop_value ) { ! narrowOop *nl = (narrowOop*)loc; ! #ifndef VM_LITTLE_ENDIAN ! if (!omv.reg()->is_stack()) { ! // compressed oops in registers only take up 4 bytes of an ! // 8 byte register but they are in the wrong part of the ! // word so adjust loc to point at the right place. ! nl = (narrowOop*)((address)nl + 4); } + #endif + oop_fn->do_oop(nl); } } } } } // Update callee-saved register info for the following frame void OopMapSet::update_register_map(const frame *fr, RegisterMap *reg_map) {
*** 506,574 **** #else return false; #endif // COMPILER2 } ! void print_register_type(OopMapValue::oop_types x, VMReg optional) { switch( x ) { case OopMapValue::oop_value: ! tty->print("Oop"); break; case OopMapValue::value_value: ! tty->print("Value" ); break; ! case OopMapValue::dead_value: ! tty->print("Dead" ); break; case OopMapValue::callee_saved_value: ! tty->print("Callers_" ); ! optional->print(); break; case OopMapValue::derived_oop_value: ! tty->print("Derived_oop_" ); ! optional->print(); ! break; ! case OopMapValue::stack_obj: ! tty->print("Stack"); break; default: ShouldNotReachHere(); } } ! void OopMapValue::print() const { ! reg()->print(); ! tty->print("="); ! print_register_type(type(),content_reg()); ! tty->print(" "); } void OopMap::print_on(outputStream* st) const { OopMapValue omv; for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) { omv = oms.current(); omv.print_on(st); } } void OopMapSet::print_on(outputStream* st) const { int i, len = om_count(); st->print_cr("OopMapSet contains %d OopMaps\n",len); for( i = 0; i < len; i++) { OopMap* m = at(i); ! st->print_cr("OopMap #%d offset:%p",i,m->offset()); m->print_on(st); ! st->print_cr("\n"); } } ! #endif // !PRODUCT //------------------------------DerivedPointerTable--------------------------- #ifdef COMPILER2 --- 500,572 ---- #else return false; #endif // COMPILER2 } + #endif //PRODUCT ! // Printing code is present in product build for -XX:+PrintAssembly. ! ! static ! void print_register_type(OopMapValue::oop_types x, VMReg optional, ! outputStream* st) { switch( x ) { case OopMapValue::oop_value: ! st->print("Oop"); break; case OopMapValue::value_value: ! st->print("Value" ); break; ! case OopMapValue::narrowoop_value: ! tty->print("NarrowOop" ); break; case OopMapValue::callee_saved_value: ! st->print("Callers_" ); ! optional->print_on(st); break; case OopMapValue::derived_oop_value: ! st->print("Derived_oop_" ); ! optional->print_on(st); break; default: ShouldNotReachHere(); } } ! void OopMapValue::print_on(outputStream* st) const { ! reg()->print_on(st); ! st->print("="); ! print_register_type(type(),content_reg(),st); ! st->print(" "); } void OopMap::print_on(outputStream* st) const { OopMapValue omv; + st->print("OopMap{"); for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) { omv = oms.current(); omv.print_on(st); } + st->print("off=%d}", (int) offset()); } void OopMapSet::print_on(outputStream* st) const { int i, len = om_count(); st->print_cr("OopMapSet contains %d OopMaps\n",len); for( i = 0; i < len; i++) { OopMap* m = at(i); ! st->print_cr("#%d ",i); m->print_on(st); ! st->cr(); } } ! //------------------------------DerivedPointerTable--------------------------- #ifdef COMPILER2