# HG changeset patch # User stuefe # Date 1454940990 -3600 # Mon Feb 08 15:16:30 2016 +0100 # Node ID c781589cab603987d07ba963416736484e06c1bb # Parent 3472ec7733c2763ac323386aa697f0653d66bf3a 8149096: Remove unused code in methodComparator Reviewed-by: diff --git a/src/share/vm/prims/methodComparator.cpp b/src/share/vm/prims/methodComparator.cpp --- a/src/share/vm/prims/methodComparator.cpp +++ b/src/share/vm/prims/methodComparator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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 @@ -68,64 +68,6 @@ return true; } - -bool MethodComparator::methods_switchable(Method* old_method, Method* 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 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; -} - - bool MethodComparator::args_same(Bytecodes::Code c_old, Bytecodes::Code c_new) { // BytecodeStream returns the correct standard Java bytecodes for various "fast" // bytecode versions, so we don't have to bother about them here.. diff --git a/src/share/vm/prims/methodComparator.hpp b/src/share/vm/prims/methodComparator.hpp --- a/src/share/vm/prims/methodComparator.hpp +++ b/src/share/vm/prims/methodComparator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. 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 @@ -55,7 +55,6 @@ // these indices eventually point to the same constants for both method versions. static bool methods_EMCP(Method* old_method, Method* new_method); - static bool methods_switchable(Method* old_method, Method* new_method, BciMap &bci_map); }; @@ -84,33 +83,6 @@ free(_new_end_bci); } - // Store the position of an added fragment, e.g. - // - // |<- old_bci - // ----------------------------------------- - // Old method |invokevirtual 5|aload 1|... - // ----------------------------------------- - // - // |<- new_st_bci |<- new_end_bci - // -------------------------------------------------------------------- - // New method |invokevirual 5|aload 2|invokevirtual 6|aload 1|... - // -------------------------------------------------------------------- - // ^^^^^^^^^^^^^^^^^^^^^^^^ - // Added fragment - - void store_fragment_location(int old_bci, int new_st_bci, int new_end_bci) { - if (_cur_pos == _cur_size) { - _cur_size += 10; - _old_bci = (int*) realloc(_old_bci, sizeof(int) * _cur_size); - _new_st_bci = (int*) realloc(_new_st_bci, sizeof(int) * _cur_size); - _new_end_bci = (int*) realloc(_new_end_bci, sizeof(int) * _cur_size); - } - _old_bci[_cur_pos] = old_bci; - _new_st_bci[_cur_pos] = new_st_bci; - _new_end_bci[_cur_pos] = new_end_bci; - _cur_pos++; - } - int new_bci_for_old(int old_bci) { if (_cur_pos == 0 || old_bci < _old_bci[0]) return old_bci; _pos = 1;