1 /*
2 * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
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 *
867 m->set_constants(NULL); // This will get filled in later
868 m->set_name_index(cp->utf8(name));
869 m->set_signature_index(cp->utf8(sig));
870 ResultTypeFinder rtf(sig);
871 m->constMethod()->set_result_type(rtf.type());
872 m->set_size_of_parameters(params);
873 m->set_max_stack(max_stack);
874 m->set_max_locals(params);
875 m->constMethod()->set_stackmap_data(NULL);
876 m->set_code(code_start);
877
878 return m;
879 }
880
881 static void switchover_constant_pool(BytecodeConstantPool* bpool,
882 InstanceKlass* klass, GrowableArray<Method*>* new_methods, TRAPS) {
883
884 if (new_methods->length() > 0) {
885 ConstantPool* cp = bpool->create_constant_pool(CHECK);
886 if (cp != klass->constants()) {
887 klass->class_loader_data()->add_to_deallocate_list(klass->constants());
888 klass->set_constants(cp);
889 cp->set_pool_holder(klass);
890
891 for (int i = 0; i < new_methods->length(); ++i) {
892 new_methods->at(i)->set_constants(cp);
893 }
894 for (int i = 0; i < klass->methods()->length(); ++i) {
895 Method* mo = klass->methods()->at(i);
896 mo->set_constants(cp);
897 }
898 }
899 }
900 }
901
902 // Create default_methods list for the current class.
903 // With the VM only processing erased signatures, the VM only
904 // creates an overpass in a conflict case or a case with no candidates.
905 // This allows virtual methods to override the overpass, but ensures
906 // that a local method search will find the exception rather than an abstract
|
1 /*
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
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 *
867 m->set_constants(NULL); // This will get filled in later
868 m->set_name_index(cp->utf8(name));
869 m->set_signature_index(cp->utf8(sig));
870 ResultTypeFinder rtf(sig);
871 m->constMethod()->set_result_type(rtf.type());
872 m->set_size_of_parameters(params);
873 m->set_max_stack(max_stack);
874 m->set_max_locals(params);
875 m->constMethod()->set_stackmap_data(NULL);
876 m->set_code(code_start);
877
878 return m;
879 }
880
881 static void switchover_constant_pool(BytecodeConstantPool* bpool,
882 InstanceKlass* klass, GrowableArray<Method*>* new_methods, TRAPS) {
883
884 if (new_methods->length() > 0) {
885 ConstantPool* cp = bpool->create_constant_pool(CHECK);
886 if (cp != klass->constants()) {
887 // Copy resolved anonymous class into new constant pool.
888 if (klass->is_anonymous()) {
889 cp->klass_at_put(klass->this_class_index(), klass);
890 }
891 klass->class_loader_data()->add_to_deallocate_list(klass->constants());
892 klass->set_constants(cp);
893 cp->set_pool_holder(klass);
894
895 for (int i = 0; i < new_methods->length(); ++i) {
896 new_methods->at(i)->set_constants(cp);
897 }
898 for (int i = 0; i < klass->methods()->length(); ++i) {
899 Method* mo = klass->methods()->at(i);
900 mo->set_constants(cp);
901 }
902 }
903 }
904 }
905
906 // Create default_methods list for the current class.
907 // With the VM only processing erased signatures, the VM only
908 // creates an overpass in a conflict case or a case with no candidates.
909 // This allows virtual methods to override the overpass, but ensures
910 // that a local method search will find the exception rather than an abstract
|