1 /*
2 * Copyright (c) 2003, 2023, 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 *
454 bool rewrite_cp_refs_in_annotations_typeArray(
455 AnnotationArray* annotations_typeArray, int &byte_i_ref);
456 bool rewrite_cp_refs_in_class_annotations(InstanceKlass* scratch_class);
457 bool rewrite_cp_refs_in_element_value(
458 AnnotationArray* class_annotations, int &byte_i_ref);
459 bool rewrite_cp_refs_in_type_annotations_typeArray(
460 AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
461 const char * location_mesg);
462 bool rewrite_cp_refs_in_type_annotation_struct(
463 AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
464 const char * location_mesg);
465 bool skip_type_annotation_target(
466 AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
467 const char * location_mesg);
468 bool skip_type_annotation_type_path(
469 AnnotationArray* type_annotations_typeArray, int &byte_i_ref);
470 bool rewrite_cp_refs_in_fields_annotations(InstanceKlass* scratch_class);
471 bool rewrite_cp_refs_in_nest_attributes(InstanceKlass* scratch_class);
472 bool rewrite_cp_refs_in_record_attribute(InstanceKlass* scratch_class);
473 bool rewrite_cp_refs_in_permitted_subclasses_attribute(InstanceKlass* scratch_class);
474
475 void rewrite_cp_refs_in_method(methodHandle method,
476 methodHandle * new_method_p, TRAPS);
477 bool rewrite_cp_refs_in_methods(InstanceKlass* scratch_class);
478
479 bool rewrite_cp_refs_in_methods_annotations(InstanceKlass* scratch_class);
480 bool rewrite_cp_refs_in_methods_default_annotations(InstanceKlass* scratch_class);
481 bool rewrite_cp_refs_in_methods_parameter_annotations(InstanceKlass* scratch_class);
482 bool rewrite_cp_refs_in_class_type_annotations(InstanceKlass* scratch_class);
483 bool rewrite_cp_refs_in_fields_type_annotations(InstanceKlass* scratch_class);
484 bool rewrite_cp_refs_in_methods_type_annotations(InstanceKlass* scratch_class);
485
486 void rewrite_cp_refs_in_stack_map_table(const methodHandle& method);
487 void rewrite_cp_refs_in_verification_type_info(
488 address& stackmap_addr_ref, address stackmap_end, u2 frame_i,
489 u1 frame_size);
490 void set_new_constant_pool(ClassLoaderData* loader_data,
491 InstanceKlass* scratch_class,
492 constantPoolHandle scratch_cp, int scratch_cp_length, TRAPS);
493
494 void flush_dependent_code();
495
496 // lock classes to redefine since constant pool merging isn't thread safe.
497 void lock_classes();
498 void unlock_classes();
499
500 u8 next_id();
501
502 static void dump_methods();
503
504 // Check that there are no old or obsolete methods
505 class CheckClass : public KlassClosure {
506 Thread* _thread;
507 public:
508 CheckClass(Thread* t) : _thread(t) {}
509 void do_klass(Klass* k);
|
1 /*
2 * Copyright (c) 2003, 2025, 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 *
454 bool rewrite_cp_refs_in_annotations_typeArray(
455 AnnotationArray* annotations_typeArray, int &byte_i_ref);
456 bool rewrite_cp_refs_in_class_annotations(InstanceKlass* scratch_class);
457 bool rewrite_cp_refs_in_element_value(
458 AnnotationArray* class_annotations, int &byte_i_ref);
459 bool rewrite_cp_refs_in_type_annotations_typeArray(
460 AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
461 const char * location_mesg);
462 bool rewrite_cp_refs_in_type_annotation_struct(
463 AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
464 const char * location_mesg);
465 bool skip_type_annotation_target(
466 AnnotationArray* type_annotations_typeArray, int &byte_i_ref,
467 const char * location_mesg);
468 bool skip_type_annotation_type_path(
469 AnnotationArray* type_annotations_typeArray, int &byte_i_ref);
470 bool rewrite_cp_refs_in_fields_annotations(InstanceKlass* scratch_class);
471 bool rewrite_cp_refs_in_nest_attributes(InstanceKlass* scratch_class);
472 bool rewrite_cp_refs_in_record_attribute(InstanceKlass* scratch_class);
473 bool rewrite_cp_refs_in_permitted_subclasses_attribute(InstanceKlass* scratch_class);
474 bool rewrite_cp_refs_in_loadable_descriptors_attribute(InstanceKlass* scratch_class);
475
476 void rewrite_cp_refs_in_method(methodHandle method,
477 methodHandle * new_method_p, TRAPS);
478 bool rewrite_cp_refs_in_methods(InstanceKlass* scratch_class);
479
480 bool rewrite_cp_refs_in_methods_annotations(InstanceKlass* scratch_class);
481 bool rewrite_cp_refs_in_methods_default_annotations(InstanceKlass* scratch_class);
482 bool rewrite_cp_refs_in_methods_parameter_annotations(InstanceKlass* scratch_class);
483 bool rewrite_cp_refs_in_class_type_annotations(InstanceKlass* scratch_class);
484 bool rewrite_cp_refs_in_fields_type_annotations(InstanceKlass* scratch_class);
485 bool rewrite_cp_refs_in_methods_type_annotations(InstanceKlass* scratch_class);
486
487 void rewrite_cp_refs_in_stack_map_table(const methodHandle& method);
488 void rewrite_cp_refs_in_verification_type_info(
489 address& stackmap_addr_ref, address stackmap_end, u2 frame_i,
490 u1 frame_size);
491 void rewrite_cp_refs_in_early_larval_stackmaps(
492 address& stackmap_p_ref, address stackmap_end, u2 frame_i,
493 u1 frame_type);
494
495 void set_new_constant_pool(ClassLoaderData* loader_data,
496 InstanceKlass* scratch_class,
497 constantPoolHandle scratch_cp, int scratch_cp_length, TRAPS);
498
499 void flush_dependent_code();
500
501 // lock classes to redefine since constant pool merging isn't thread safe.
502 void lock_classes();
503 void unlock_classes();
504
505 u8 next_id();
506
507 static void dump_methods();
508
509 // Check that there are no old or obsolete methods
510 class CheckClass : public KlassClosure {
511 Thread* _thread;
512 public:
513 CheckClass(Thread* t) : _thread(t) {}
514 void do_klass(Klass* k);
|