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 *
23 */
24
25 #ifndef SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
26 #define SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
27
28 #include "memory/referenceType.hpp"
29 #include "runtime/handles.inline.hpp"
30 #include "oops/constantPool.hpp"
31 #include "oops/typeArrayOop.hpp"
32 #include "utilities/accessFlags.hpp"
33
34 class Annotations;
35 template <typename T>
36 class Array;
37 class ClassFileStream;
38 class ClassLoaderData;
39 class CompressedLineNumberWriteStream;
40 class ConstMethod;
41 class FieldInfo;
42 template <typename T>
43 class GrowableArray;
44 class InstanceKlass;
45 class Symbol;
46 class TempNewSymbol;
47
48 // Parser for for .class files
49 //
417 const Symbol* name,
418 TRAPS) const;
419
420 const char* skip_over_field_signature(const char* signature,
421 bool void_ok,
422 unsigned int length,
423 TRAPS) const;
424
425 bool has_cp_patch_at(int index) const {
426 assert(index >= 0, "oob");
427 return (_cp_patches != NULL
428 && index < _cp_patches->length()
429 && _cp_patches->adr_at(index)->not_null());
430 }
431
432 Handle cp_patch_at(int index) const {
433 assert(has_cp_patch_at(index), "oob");
434 return _cp_patches->at(index);
435 }
436
437 Handle clear_cp_patch_at(int index) {
438 Handle patch = cp_patch_at(index);
439 _cp_patches->at_put(index, Handle());
440 assert(!has_cp_patch_at(index), "");
441 return patch;
442 }
443
444 void patch_class(ConstantPool* cp, int class_index, Klass* k, Symbol* name);
445 void patch_constant_pool(ConstantPool* cp,
446 int index,
447 Handle patch,
448 TRAPS);
449
450 // Wrapper for constantTag.is_klass_[or_]reference.
451 // In older versions of the VM, Klass*s cannot sneak into early phases of
452 // constant pool construction, but in later versions they can.
453 // %%% Let's phase out the old is_klass_reference.
454 bool valid_klass_reference_at(int index) const {
455 return _cp->is_within_bounds(index) &&
456 _cp->tag_at(index).is_klass_or_reference();
457 }
458
459 // Checks that the cpool index is in range and is a utf8
460 bool valid_symbol_at(int cpool_index) const {
461 return _cp->is_within_bounds(cpool_index) &&
462 _cp->tag_at(cpool_index).is_utf8();
513
514 void set_klass_to_deallocate(InstanceKlass* klass);
515
516 int static_field_size() const;
517 int total_oop_map_count() const;
518 jint layout_size() const;
519
520 int vtable_size() const { return _vtable_size; }
521 int itable_size() const { return _itable_size; }
522
523 u2 this_class_index() const { return _this_class_index; }
524 u2 super_class_index() const { return _super_class_index; }
525
526 bool is_anonymous() const { return _host_klass != NULL; }
527 bool is_interface() const { return _access_flags.is_interface(); }
528
529 const InstanceKlass* host_klass() const { return _host_klass; }
530 const GrowableArray<Handle>* cp_patches() const { return _cp_patches; }
531 ClassLoaderData* loader_data() const { return _loader_data; }
532 const Symbol* class_name() const { return _class_name; }
533 const Klass* super_klass() const { return _super_klass; }
534
535 ReferenceType reference_type() const { return _rt; }
536 AccessFlags access_flags() const { return _access_flags; }
537
538 bool is_internal() const { return INTERNAL == _pub_level; }
539
540 static bool verify_unqualified_name(const char* name, unsigned int length, int type);
541
542 #ifdef ASSERT
543 static bool is_internal_format(Symbol* class_name);
544 #endif
545
546 };
547
548 #endif // SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
|
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 *
23 */
24
25 #ifndef SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
26 #define SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
27
28 #include "memory/referenceType.hpp"
29 #include "oops/annotations.hpp"
30 #include "oops/constantPool.hpp"
31 #include "oops/typeArrayOop.hpp"
32 #include "utilities/accessFlags.hpp"
33
34 class Annotations;
35 template <typename T>
36 class Array;
37 class ClassFileStream;
38 class ClassLoaderData;
39 class CompressedLineNumberWriteStream;
40 class ConstMethod;
41 class FieldInfo;
42 template <typename T>
43 class GrowableArray;
44 class InstanceKlass;
45 class Symbol;
46 class TempNewSymbol;
47
48 // Parser for for .class files
49 //
417 const Symbol* name,
418 TRAPS) const;
419
420 const char* skip_over_field_signature(const char* signature,
421 bool void_ok,
422 unsigned int length,
423 TRAPS) const;
424
425 bool has_cp_patch_at(int index) const {
426 assert(index >= 0, "oob");
427 return (_cp_patches != NULL
428 && index < _cp_patches->length()
429 && _cp_patches->adr_at(index)->not_null());
430 }
431
432 Handle cp_patch_at(int index) const {
433 assert(has_cp_patch_at(index), "oob");
434 return _cp_patches->at(index);
435 }
436
437 Handle clear_cp_patch_at(int index);
438
439 void patch_class(ConstantPool* cp, int class_index, Klass* k, Symbol* name);
440 void patch_constant_pool(ConstantPool* cp,
441 int index,
442 Handle patch,
443 TRAPS);
444
445 // Wrapper for constantTag.is_klass_[or_]reference.
446 // In older versions of the VM, Klass*s cannot sneak into early phases of
447 // constant pool construction, but in later versions they can.
448 // %%% Let's phase out the old is_klass_reference.
449 bool valid_klass_reference_at(int index) const {
450 return _cp->is_within_bounds(index) &&
451 _cp->tag_at(index).is_klass_or_reference();
452 }
453
454 // Checks that the cpool index is in range and is a utf8
455 bool valid_symbol_at(int cpool_index) const {
456 return _cp->is_within_bounds(cpool_index) &&
457 _cp->tag_at(cpool_index).is_utf8();
508
509 void set_klass_to_deallocate(InstanceKlass* klass);
510
511 int static_field_size() const;
512 int total_oop_map_count() const;
513 jint layout_size() const;
514
515 int vtable_size() const { return _vtable_size; }
516 int itable_size() const { return _itable_size; }
517
518 u2 this_class_index() const { return _this_class_index; }
519 u2 super_class_index() const { return _super_class_index; }
520
521 bool is_anonymous() const { return _host_klass != NULL; }
522 bool is_interface() const { return _access_flags.is_interface(); }
523
524 const InstanceKlass* host_klass() const { return _host_klass; }
525 const GrowableArray<Handle>* cp_patches() const { return _cp_patches; }
526 ClassLoaderData* loader_data() const { return _loader_data; }
527 const Symbol* class_name() const { return _class_name; }
528 const InstanceKlass* super_klass() const { return _super_klass; }
529
530 ReferenceType reference_type() const { return _rt; }
531 AccessFlags access_flags() const { return _access_flags; }
532
533 bool is_internal() const { return INTERNAL == _pub_level; }
534
535 static bool verify_unqualified_name(const char* name, unsigned int length, int type);
536
537 #ifdef ASSERT
538 static bool is_internal_format(Symbol* class_name);
539 #endif
540
541 };
542
543 #endif // SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
|