bool MethodComparator::methods_EMCP(methodOop old_method, methodOop new_method) { if (old_method->code_size() != new_method->code_size()) return false; if (check_stack_and_locals_size(old_method, new_method) != 0) { // RC_TRACE macro has an embedded ResourceMark RC_TRACE(0x00800000, ("Methods %s non-comparable with diagnosis %d", old_method->name()->as_C_string(), check_stack_and_locals_size(old_method, new_method))); return false; } _old_cp = old_method->constants(); _new_cp = new_method->constants(); BytecodeStream s_old(old_method); BytecodeStream s_new(new_method); _s_old = &s_old; _s_new = &s_new; _switchable_test = false; Bytecodes::Code c_old, c_new; while ((c_old = s_old.next()) >= 0) { if ((c_new = s_new.next()) < 0 || c_old != c_new) return false; if (! args_same(c_old, c_new)) return false; } return true; }
bool MethodComparator::methods_switchable(methodOop old_method, methodOop new_method, BciMap &bci_map) { if (old_method->code_size() > new_method->code_size()) // Something has definitely been deleted in the new method, compared to the old one. return false; if (! check_stack_and_locals_size(old_method, new_method)) return false; _old_cp = old_method->constants(); _new_cp = new_method->constants(); BytecodeStream s_old(old_method); BytecodeStream s_new(new_method); _s_old = &s_old; _s_new = &s_new; _bci_map = &bci_map; _switchable_test = true; GrowableArray<int> fwd_jmps(16); _fwd_jmps = &fwd_jmps; Bytecodes::Code c_old, c_new; while ((c_old = s_old.next()) >= 0) { if ((c_new = s_new.next()) < 0) return false; if (! (c_old == c_new && args_same(c_old, c_new))) { int old_bci = s_old.bci(); int new_st_bci = s_new.bci(); bool found_match = false; do { c_new = s_new.next(); if (c_new == c_old && args_same(c_old, c_new)) { found_match = true; break; } } while (c_new >= 0); if (! found_match) return false; int new_end_bci = s_new.bci(); bci_map.store_fragment_location(old_bci, new_st_bci, new_end_bci); } } // Now we can test all forward jumps for (int i = 0; i < fwd_jmps.length() / 2; i++) { if (! bci_map.old_and_new_locations_same(fwd_jmps.at(i*2), fwd_jmps.at(i*2+1))) { RC_TRACE(0x00800000, ("Fwd jump miss: old dest = %d, calc new dest = %d, act new dest = %d", fwd_jmps.at(i*2), bci_map.new_bci_for_old(fwd_jmps.at(i*2)), fwd_jmps.at(i*2+1))); return false; } } return true; }
// old, plus void WindowSize::draw_calculation(const int y, const int o, const int p) { const int base = (hex.get_checked() ? 16 : 10); std::string s_old(4, ' '); std::string s_add(4, ' '); std::string s_new(4, ' '); std::string s_pls(p < 0 ? "-" : "+"); std::string s_eql("="); Torbit& tb = get_torbit(); BITMAP* bp = tb.get_al_bitmap(); // Alte Zahl wegputzen rectfill(bp, x_offset, y, this_xl-2,y+19,color[COL_API_M]); for (int i = 3, temp = o; i >= 0 && temp > 0; --i) { s_old[i] = digit_to_character(temp % base); temp /= base; if (temp == 0 && base == 16 && i > 0) s_old[i-1] = 'x'; } for (int i = 3, temp = o+p; i >= 0 && temp > 0; --i) { s_new[i] = digit_to_character(temp % base); temp /= base; if (temp == 0 && base == 16 && i > 0) s_new[i-1] = 'x'; } s_add[3] = '0'; for (int i = 3, temp = (p < 0) ? -p : p; i >= 0 && temp > 0; --i) { s_add[i] = digit_to_character(temp % base); temp /= base; if (temp == 0 && base == 16 && i > 0) s_add[i-1] = 'x'; } const int x_here = get_x_here() + x_offset; Help::draw_shadow_fixed_text(tb, font_med, s_old, x_here+ 0, y, color[COL_TEXT]); Help::draw_shadow_fixed_text(tb, font_med, s_pls, x_here+ 55, y, color[COL_TEXT]); Help::draw_shadow_fixed_text(tb, font_med, s_add, x_here+ 85, y, color[COL_TEXT]); Help::draw_shadow_fixed_text(tb, font_med, s_eql, x_here+135, y, color[COL_TEXT]); Help::draw_shadow_fixed_text(tb, font_med, s_new, x_here+160, y, color[COL_TEXT_ON]); }