duke@435: /* mikael@6198: * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #include "precompiled.hpp" stefank@2314: #include "classfile/javaClasses.hpp" stefank@2314: #include "classfile/systemDictionary.hpp" stefank@2314: #include "classfile/vmSymbols.hpp" stefank@2314: #include "code/codeCache.hpp" stefank@2314: #include "code/debugInfoRec.hpp" stefank@2314: #include "code/nmethod.hpp" stefank@2314: #include "code/pcDesc.hpp" stefank@2314: #include "code/scopeDesc.hpp" stefank@2314: #include "interpreter/interpreter.hpp" stefank@2314: #include "interpreter/oopMapCache.hpp" stefank@2314: #include "memory/resourceArea.hpp" stefank@2314: #include "oops/instanceKlass.hpp" stefank@2314: #include "oops/oop.inline.hpp" stefank@2314: #include "runtime/handles.inline.hpp" stefank@2314: #include "runtime/objectMonitor.hpp" stefank@2314: #include "runtime/objectMonitor.inline.hpp" stefank@2314: #include "runtime/signature.hpp" stefank@2314: #include "runtime/stubRoutines.hpp" stefank@2314: #include "runtime/synchronizer.hpp" stefank@2314: #include "runtime/vframe.hpp" stefank@2314: #include "runtime/vframeArray.hpp" stefank@2314: #include "runtime/vframe_hp.hpp" duke@435: duke@435: vframe::vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread) duke@435: : _reg_map(reg_map), _thread(thread) { duke@435: assert(fr != NULL, "must have frame"); duke@435: _fr = *fr; duke@435: } duke@435: duke@435: vframe::vframe(const frame* fr, JavaThread* thread) duke@435: : _reg_map(thread), _thread(thread) { duke@435: assert(fr != NULL, "must have frame"); duke@435: _fr = *fr; duke@435: } duke@435: duke@435: vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThread* thread) { duke@435: // Interpreter frame duke@435: if (f->is_interpreted_frame()) { duke@435: return new interpretedVFrame(f, reg_map, thread); duke@435: } duke@435: duke@435: // Compiled frame duke@435: CodeBlob* cb = f->cb(); duke@435: if (cb != NULL) { duke@435: if (cb->is_nmethod()) { duke@435: nmethod* nm = (nmethod*)cb; duke@435: return new compiledVFrame(f, reg_map, thread, nm); duke@435: } duke@435: duke@435: if (f->is_runtime_frame()) { duke@435: // Skip this frame and try again. duke@435: RegisterMap temp_map = *reg_map; duke@435: frame s = f->sender(&temp_map); duke@435: return new_vframe(&s, &temp_map, thread); duke@435: } duke@435: } duke@435: duke@435: // External frame duke@435: return new externalVFrame(f, reg_map, thread); duke@435: } duke@435: duke@435: vframe* vframe::sender() const { duke@435: RegisterMap temp_map = *register_map(); duke@435: assert(is_top(), "just checking"); duke@435: if (_fr.is_entry_frame() && _fr.is_first_frame()) return NULL; duke@435: frame s = _fr.real_sender(&temp_map); duke@435: if (s.is_first_frame()) return NULL; duke@435: return vframe::new_vframe(&s, &temp_map, thread()); duke@435: } duke@435: duke@435: vframe* vframe::top() const { duke@435: vframe* vf = (vframe*) this; duke@435: while (!vf->is_top()) vf = vf->sender(); duke@435: return vf; duke@435: } duke@435: duke@435: duke@435: javaVFrame* vframe::java_sender() const { duke@435: vframe* f = sender(); duke@435: while (f != NULL) { duke@435: if (f->is_java_frame()) return javaVFrame::cast(f); duke@435: f = f->sender(); duke@435: } duke@435: return NULL; duke@435: } duke@435: duke@435: // ------------- javaVFrame -------------- duke@435: duke@435: GrowableArray* javaVFrame::locked_monitors() { duke@435: assert(SafepointSynchronize::is_at_safepoint() || JavaThread::current() == thread(), duke@435: "must be at safepoint or it's a java frame of the current thread"); duke@435: duke@435: GrowableArray* mons = monitors(); duke@435: GrowableArray* result = new GrowableArray(mons->length()); duke@435: if (mons->is_empty()) return result; duke@435: duke@435: bool found_first_monitor = false; duke@435: ObjectMonitor *pending_monitor = thread()->current_pending_monitor(); duke@435: ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor(); jcoomes@1902: oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : (oop) NULL); jcoomes@1902: oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : (oop) NULL); duke@435: duke@435: for (int index = (mons->length()-1); index >= 0; index--) { duke@435: MonitorInfo* monitor = mons->at(index); kvn@1253: if (monitor->eliminated() && is_compiled_frame()) continue; // skip eliminated monitor duke@435: oop obj = monitor->owner(); duke@435: if (obj == NULL) continue; // skip unowned monitor duke@435: // duke@435: // Skip the monitor that the thread is blocked to enter or waiting on duke@435: // duke@435: if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) { duke@435: continue; duke@435: } duke@435: found_first_monitor = true; duke@435: result->append(monitor); duke@435: } duke@435: return result; duke@435: } duke@435: duke@435: static void print_locked_object_class_name(outputStream* st, Handle obj, const char* lock_state) { duke@435: if (obj.not_null()) { duke@435: st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, (address)obj()); never@1577: if (obj->klass() == SystemDictionary::Class_klass()) { coleenp@4037: Klass* target_klass = java_lang_Class::as_Klass(obj()); coleenp@4037: st->print_cr("(a java.lang.Class for %s)", InstanceKlass::cast(target_klass)->external_name()); duke@435: } else { hseigel@4278: Klass* k = obj->klass(); duke@435: st->print_cr("(a %s)", k->external_name()); duke@435: } duke@435: } duke@435: } duke@435: duke@435: void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) { duke@435: ResourceMark rm; duke@435: duke@435: // If this is the first frame, and java.lang.Object.wait(...) then print out the receiver. duke@435: if (frame_count == 0) { duke@435: if (method()->name() == vmSymbols::wait_name() && coleenp@4251: method()->method_holder()->name() == vmSymbols::java_lang_Object()) { duke@435: StackValueCollection* locs = locals(); duke@435: if (!locs->is_empty()) { duke@435: StackValue* sv = locs->at(0); duke@435: if (sv->type() == T_OBJECT) { duke@435: Handle o = locs->at(0)->get_obj(); duke@435: print_locked_object_class_name(st, o, "waiting on"); duke@435: } duke@435: } duke@435: } else if (thread()->current_park_blocker() != NULL) { duke@435: oop obj = thread()->current_park_blocker(); hseigel@4278: Klass* k = obj->klass(); duke@435: st->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", "parking to wait for ", (address)obj, k->external_name()); duke@435: } duke@435: } duke@435: duke@435: duke@435: // Print out all monitors that we have locked or are trying to lock duke@435: GrowableArray* mons = monitors(); duke@435: if (!mons->is_empty()) { duke@435: bool found_first_monitor = false; duke@435: for (int index = (mons->length()-1); index >= 0; index--) { duke@435: MonitorInfo* monitor = mons->at(index); kvn@1253: if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code kvn@1253: if (monitor->owner_is_scalar_replaced()) { coleenp@4037: Klass* k = java_lang_Class::as_Klass(monitor->owner_klass()); kvn@1253: st->print("\t- eliminated (a %s)", k->external_name()); kvn@1253: } else { kvn@1253: oop obj = monitor->owner(); kvn@1253: if (obj != NULL) { kvn@1253: print_locked_object_class_name(st, obj, "eliminated"); kvn@1253: } kvn@1253: } kvn@1253: continue; kvn@1253: } duke@435: if (monitor->owner() != NULL) { duke@435: duke@435: // First, assume we have the monitor locked. If we haven't found an duke@435: // owned monitor before and this is the first frame, then we need to duke@435: // see if we have completed the lock or we are blocked trying to duke@435: // acquire it - we can only be blocked if the monitor is inflated duke@435: duke@435: const char *lock_state = "locked"; // assume we have the monitor locked duke@435: if (!found_first_monitor && frame_count == 0) { kvn@1253: markOop mark = monitor->owner()->mark(); kvn@1253: if (mark->has_monitor() && kvn@1253: mark->monitor() == thread()->current_pending_monitor()) { duke@435: lock_state = "waiting to lock"; kvn@1253: } duke@435: } duke@435: duke@435: found_first_monitor = true; duke@435: print_locked_object_class_name(st, monitor->owner(), lock_state); duke@435: } duke@435: } duke@435: } duke@435: } duke@435: duke@435: // ------------- interpretedVFrame -------------- duke@435: duke@435: u_char* interpretedVFrame::bcp() const { duke@435: return fr().interpreter_frame_bcp(); duke@435: } duke@435: duke@435: void interpretedVFrame::set_bcp(u_char* bcp) { duke@435: fr().interpreter_frame_set_bcp(bcp); duke@435: } duke@435: duke@435: intptr_t* interpretedVFrame::locals_addr_at(int offset) const { duke@435: assert(fr().is_interpreted_frame(), "frame should be an interpreted frame"); duke@435: return fr().interpreter_frame_local_at(offset); duke@435: } duke@435: duke@435: duke@435: GrowableArray* interpretedVFrame::monitors() const { duke@435: GrowableArray* result = new GrowableArray(5); duke@435: for (BasicObjectLock* current = (fr().previous_monitor_in_interpreter_frame(fr().interpreter_frame_monitor_begin())); duke@435: current >= fr().interpreter_frame_monitor_end(); duke@435: current = fr().previous_monitor_in_interpreter_frame(current)) { kvn@1253: result->push(new MonitorInfo(current->obj(), current->lock(), false, false)); duke@435: } duke@435: return result; duke@435: } duke@435: duke@435: int interpretedVFrame::bci() const { duke@435: return method()->bci_from(bcp()); duke@435: } duke@435: coleenp@4037: Method* interpretedVFrame::method() const { duke@435: return fr().interpreter_frame_method(); duke@435: } duke@435: duke@435: StackValueCollection* interpretedVFrame::locals() const { duke@435: int length = method()->max_locals(); duke@435: duke@435: if (method()->is_native()) { duke@435: // If the method is native, max_locals is not telling the truth. duke@435: // maxlocals then equals the size of parameters duke@435: length = method()->size_of_parameters(); duke@435: } duke@435: duke@435: StackValueCollection* result = new StackValueCollection(length); duke@435: duke@435: // Get oopmap describing oops and int for current bci twisti@1861: InterpreterOopMap oop_mask; twisti@1861: if (TraceDeoptimization && Verbose) { twisti@1861: methodHandle m_h(thread(), method()); twisti@1861: OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); twisti@1861: } else { twisti@1861: method()->mask_for(bci(), &oop_mask); twisti@1861: } twisti@1861: // handle locals twisti@1861: for(int i=0; i < length; i++) { twisti@1861: // Find stack location twisti@1861: intptr_t *addr = locals_addr_at(i); duke@435: twisti@1861: // Depending on oop/int put it in the right package twisti@1861: StackValue *sv; twisti@1861: if (oop_mask.is_oop(i)) { twisti@1861: // oop value twisti@1861: Handle h(*(oop *)addr); twisti@1861: sv = new StackValue(h); twisti@1861: } else { twisti@1861: // integer twisti@1861: sv = new StackValue(*addr); duke@435: } twisti@1861: assert(sv != NULL, "sanity check"); twisti@1861: result->add(sv); duke@435: } duke@435: return result; duke@435: } duke@435: duke@435: void interpretedVFrame::set_locals(StackValueCollection* values) const { duke@435: if (values == NULL || values->size() == 0) return; duke@435: duke@435: int length = method()->max_locals(); duke@435: if (method()->is_native()) { duke@435: // If the method is native, max_locals is not telling the truth. duke@435: // maxlocals then equals the size of parameters duke@435: length = method()->size_of_parameters(); duke@435: } duke@435: duke@435: assert(length == values->size(), "Mismatch between actual stack format and supplied data"); duke@435: duke@435: // handle locals duke@435: for (int i = 0; i < length; i++) { duke@435: // Find stack location duke@435: intptr_t *addr = locals_addr_at(i); duke@435: duke@435: // Depending on oop/int put it in the right package duke@435: StackValue *sv = values->at(i); duke@435: assert(sv != NULL, "sanity check"); duke@435: if (sv->type() == T_OBJECT) { duke@435: *(oop *) addr = (sv->get_obj())(); duke@435: } else { // integer duke@435: *addr = sv->get_int(); duke@435: } duke@435: } duke@435: } duke@435: duke@435: StackValueCollection* interpretedVFrame::expressions() const { duke@435: int length = fr().interpreter_frame_expression_stack_size(); duke@435: if (method()->is_native()) { duke@435: // If the method is native, there is no expression stack duke@435: length = 0; duke@435: } duke@435: duke@435: int nof_locals = method()->max_locals(); duke@435: StackValueCollection* result = new StackValueCollection(length); duke@435: twisti@1861: InterpreterOopMap oop_mask; twisti@1861: // Get oopmap describing oops and int for current bci twisti@1861: if (TraceDeoptimization && Verbose) { twisti@1861: methodHandle m_h(method()); twisti@1861: OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); twisti@1861: } else { twisti@1861: method()->mask_for(bci(), &oop_mask); twisti@1861: } twisti@1861: // handle expressions twisti@1861: for(int i=0; i < length; i++) { twisti@1861: // Find stack location twisti@1861: intptr_t *addr = fr().interpreter_frame_expression_stack_at(i); duke@435: twisti@1861: // Depending on oop/int put it in the right package twisti@1861: StackValue *sv; twisti@1861: if (oop_mask.is_oop(i + nof_locals)) { twisti@1861: // oop value twisti@1861: Handle h(*(oop *)addr); twisti@1861: sv = new StackValue(h); twisti@1861: } else { twisti@1861: // integer twisti@1861: sv = new StackValue(*addr); duke@435: } twisti@1861: assert(sv != NULL, "sanity check"); twisti@1861: result->add(sv); duke@435: } duke@435: return result; duke@435: } duke@435: duke@435: duke@435: // ------------- cChunk -------------- duke@435: duke@435: entryVFrame::entryVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread) duke@435: : externalVFrame(fr, reg_map, thread) {} duke@435: duke@435: duke@435: void vframeStreamCommon::found_bad_method_frame() { duke@435: // 6379830 Cut point for an assertion that occasionally fires when duke@435: // we are using the performance analyzer. duke@435: // Disable this assert when testing the analyzer with fastdebug. duke@435: // -XX:SuppressErrorAt=vframe.cpp:XXX (XXX=following line number) duke@435: assert(false, "invalid bci or invalid scope desc"); duke@435: } duke@435: duke@435: // top-frame will be skipped duke@435: vframeStream::vframeStream(JavaThread* thread, frame top_frame, duke@435: bool stop_at_java_call_stub) : vframeStreamCommon(thread) { duke@435: _stop_at_java_call_stub = stop_at_java_call_stub; duke@435: duke@435: // skip top frame, as it may not be at safepoint duke@435: _frame = top_frame.sender(&_reg_map); duke@435: while (!fill_from_frame()) { duke@435: _frame = _frame.sender(&_reg_map); duke@435: } duke@435: } duke@435: duke@435: duke@435: // Step back n frames, skip any pseudo frames in between. duke@435: // This function is used in Class.forName, Class.newInstance, Method.Invoke, duke@435: // AccessController.doPrivileged. duke@435: void vframeStreamCommon::security_get_caller_frame(int depth) { twisti@4866: assert(depth >= 0, err_msg("invalid depth: %d", depth)); twisti@4866: for (int n = 0; !at_end(); security_next()) { twisti@4866: if (!method()->is_ignored_by_security_stack_walk()) { twisti@4866: if (n == depth) { twisti@4866: // We have reached the desired depth; return. twisti@4866: return; twisti@4866: } twisti@4866: n++; // this is a non-skipped frame; count it against the depth twisti@4866: } twisti@4866: } twisti@4866: // NOTE: At this point there were not enough frames on the stack twisti@4866: // to walk to depth. Callers of this method have to check for at_end. twisti@4866: } duke@435: twisti@4866: twisti@4866: void vframeStreamCommon::security_next() { twisti@4866: if (method()->is_prefixed_native()) { twisti@4866: skip_prefixed_method_and_wrappers(); // calls next() twisti@4866: } else { twisti@4866: next(); duke@435: } duke@435: } duke@435: duke@435: duke@435: void vframeStreamCommon::skip_prefixed_method_and_wrappers() { duke@435: ResourceMark rm; duke@435: HandleMark hm; duke@435: duke@435: int method_prefix_count = 0; duke@435: char** method_prefixes = JvmtiExport::get_all_native_method_prefixes(&method_prefix_count); duke@435: KlassHandle prefixed_klass(method()->method_holder()); duke@435: const char* prefixed_name = method()->name()->as_C_string(); duke@435: size_t prefixed_name_len = strlen(prefixed_name); duke@435: int prefix_index = method_prefix_count-1; duke@435: duke@435: while (!at_end()) { duke@435: next(); duke@435: if (method()->method_holder() != prefixed_klass()) { duke@435: break; // classes don't match, can't be a wrapper duke@435: } duke@435: const char* name = method()->name()->as_C_string(); duke@435: size_t name_len = strlen(name); duke@435: size_t prefix_len = prefixed_name_len - name_len; duke@435: if (prefix_len <= 0 || strcmp(name, prefixed_name + prefix_len) != 0) { duke@435: break; // prefixed name isn't prefixed version of method name, can't be a wrapper duke@435: } duke@435: for (; prefix_index >= 0; --prefix_index) { duke@435: const char* possible_prefix = method_prefixes[prefix_index]; duke@435: size_t possible_prefix_len = strlen(possible_prefix); duke@435: if (possible_prefix_len == prefix_len && duke@435: strncmp(possible_prefix, prefixed_name, prefix_len) == 0) { duke@435: break; // matching prefix found duke@435: } duke@435: } duke@435: if (prefix_index < 0) { duke@435: break; // didn't find the prefix, can't be a wrapper duke@435: } duke@435: prefixed_name = name; duke@435: prefixed_name_len = name_len; duke@435: } duke@435: } duke@435: duke@435: duke@435: void vframeStreamCommon::skip_reflection_related_frames() { duke@435: while (!at_end() && duke@435: (JDK_Version::is_gte_jdk14x_version() && UseNewReflection && coleenp@4251: (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) || coleenp@4251: method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) { duke@435: next(); duke@435: } duke@435: } duke@435: duke@435: duke@435: #ifndef PRODUCT duke@435: void vframe::print() { duke@435: if (WizardMode) _fr.print_value_on(tty,NULL); duke@435: } duke@435: duke@435: duke@435: void vframe::print_value() const { duke@435: ((vframe*)this)->print(); duke@435: } duke@435: duke@435: duke@435: void entryVFrame::print_value() const { duke@435: ((entryVFrame*)this)->print(); duke@435: } duke@435: duke@435: void entryVFrame::print() { duke@435: vframe::print(); duke@435: tty->print_cr("C Chunk inbetween Java"); duke@435: tty->print_cr("C link " INTPTR_FORMAT, _fr.link()); duke@435: } duke@435: duke@435: duke@435: // ------------- javaVFrame -------------- duke@435: duke@435: static void print_stack_values(const char* title, StackValueCollection* values) { duke@435: if (values->is_empty()) return; duke@435: tty->print_cr("\t%s:", title); duke@435: values->print(); duke@435: } duke@435: duke@435: duke@435: void javaVFrame::print() { duke@435: ResourceMark rm; duke@435: vframe::print(); duke@435: tty->print("\t"); duke@435: method()->print_value(); duke@435: tty->cr(); duke@435: tty->print_cr("\tbci: %d", bci()); duke@435: duke@435: print_stack_values("locals", locals()); duke@435: print_stack_values("expressions", expressions()); duke@435: duke@435: GrowableArray* list = monitors(); duke@435: if (list->is_empty()) return; duke@435: tty->print_cr("\tmonitor list:"); duke@435: for (int index = (list->length()-1); index >= 0; index--) { duke@435: MonitorInfo* monitor = list->at(index); kvn@1253: tty->print("\t obj\t"); kvn@1253: if (monitor->owner_is_scalar_replaced()) { coleenp@4037: Klass* k = java_lang_Class::as_Klass(monitor->owner_klass()); kvn@1253: tty->print("( is scalar replaced %s)", k->external_name()); kvn@1253: } else if (monitor->owner() == NULL) { kvn@1253: tty->print("( null )"); kvn@1253: } else { kvn@1253: monitor->owner()->print_value(); kvn@1253: tty->print("(" INTPTR_FORMAT ")", (address)monitor->owner()); kvn@1253: } kvn@1253: if (monitor->eliminated() && is_compiled_frame()) kvn@1253: tty->print(" ( lock is eliminated )"); duke@435: tty->cr(); duke@435: tty->print("\t "); duke@435: monitor->lock()->print_on(tty); duke@435: tty->cr(); duke@435: } duke@435: } duke@435: duke@435: duke@435: void javaVFrame::print_value() const { coleenp@4037: Method* m = method(); coleenp@4251: InstanceKlass* k = m->method_holder(); duke@435: tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")", duke@435: _fr.sp(), _fr.unextended_sp(), _fr.fp(), _fr.pc()); hseigel@4278: tty->print("%s.%s", k->internal_name(), m->name()->as_C_string()); duke@435: duke@435: if (!m->is_native()) { coleenp@4251: Symbol* source_name = k->source_file_name(); duke@435: int line_number = m->line_number_from_bci(bci()); duke@435: if (source_name != NULL && (line_number != -1)) { duke@435: tty->print("(%s:%d)", source_name->as_C_string(), line_number); duke@435: } duke@435: } else { duke@435: tty->print("(Native Method)"); duke@435: } duke@435: // Check frame size and print warning if it looks suspiciously large duke@435: if (fr().sp() != NULL) { cfang@1228: RegisterMap map = *register_map(); cfang@1228: uint size = fr().frame_size(&map); duke@435: #ifdef _LP64 duke@435: if (size > 8*K) warning("SUSPICIOUSLY LARGE FRAME (%d)", size); duke@435: #else duke@435: if (size > 4*K) warning("SUSPICIOUSLY LARGE FRAME (%d)", size); duke@435: #endif duke@435: } duke@435: } duke@435: duke@435: duke@435: bool javaVFrame::structural_compare(javaVFrame* other) { duke@435: // Check static part duke@435: if (method() != other->method()) return false; duke@435: if (bci() != other->bci()) return false; duke@435: duke@435: // Check locals duke@435: StackValueCollection *locs = locals(); duke@435: StackValueCollection *other_locs = other->locals(); duke@435: assert(locs->size() == other_locs->size(), "sanity check"); duke@435: int i; duke@435: for(i = 0; i < locs->size(); i++) { duke@435: // it might happen the compiler reports a conflict and duke@435: // the interpreter reports a bogus int. duke@435: if ( is_compiled_frame() && locs->at(i)->type() == T_CONFLICT) continue; duke@435: if (other->is_compiled_frame() && other_locs->at(i)->type() == T_CONFLICT) continue; duke@435: duke@435: if (!locs->at(i)->equal(other_locs->at(i))) duke@435: return false; duke@435: } duke@435: duke@435: // Check expressions duke@435: StackValueCollection* exprs = expressions(); duke@435: StackValueCollection* other_exprs = other->expressions(); duke@435: assert(exprs->size() == other_exprs->size(), "sanity check"); duke@435: for(i = 0; i < exprs->size(); i++) { duke@435: if (!exprs->at(i)->equal(other_exprs->at(i))) duke@435: return false; duke@435: } duke@435: duke@435: return true; duke@435: } duke@435: duke@435: duke@435: void javaVFrame::print_activation(int index) const { duke@435: // frame number and method duke@435: tty->print("%2d - ", index); duke@435: ((vframe*)this)->print_value(); duke@435: tty->cr(); duke@435: duke@435: if (WizardMode) { duke@435: ((vframe*)this)->print(); duke@435: tty->cr(); duke@435: } duke@435: } duke@435: duke@435: duke@435: void javaVFrame::verify() const { duke@435: } duke@435: duke@435: duke@435: void interpretedVFrame::verify() const { duke@435: } duke@435: duke@435: duke@435: // ------------- externalVFrame -------------- duke@435: duke@435: void externalVFrame::print() { duke@435: _fr.print_value_on(tty,NULL); duke@435: } duke@435: duke@435: duke@435: void externalVFrame::print_value() const { duke@435: ((vframe*)this)->print(); duke@435: } duke@435: #endif // PRODUCT