hotspot/src/share/vm/classfile/classFileParser.hpp
Print this page
rev 611 : Merge
@@ -1,10 +1,10 @@
#ifdef USE_PRAGMA_IDENT_HDR
#pragma ident "@(#)classFileParser.hpp 1.85 07/07/09 11:19:50 JVM"
#endif
/*
- * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1997-2008 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -34,10 +34,11 @@
bool _need_verify;
bool _relax_verify;
u2 _major_version;
u2 _minor_version;
symbolHandle _class_name;
+ GrowableArray<Handle>* _cp_patches; // overrides for CP entries
bool _has_finalizer;
bool _has_empty_finalizer;
bool _has_vanilla_constructor;
@@ -204,10 +205,39 @@
void verify_legal_method_modifiers(jint flags, bool is_interface, symbolHandle name, TRAPS);
bool verify_unqualified_name(char* name, unsigned int length, int type);
char* skip_over_field_name(char* name, bool slash_ok, unsigned int length);
char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS);
+ bool has_cp_patch_at(int index) {
+ assert(AnonymousClasses, "");
+ assert(index >= 0, "oob");
+ return (_cp_patches != NULL
+ && index < _cp_patches->length()
+ && _cp_patches->adr_at(index)->not_null());
+ }
+ Handle cp_patch_at(int index) {
+ assert(has_cp_patch_at(index), "oob");
+ return _cp_patches->at(index);
+ }
+ Handle clear_cp_patch_at(int index) {
+ Handle patch = cp_patch_at(index);
+ _cp_patches->at_put(index, Handle());
+ assert(!has_cp_patch_at(index), "");
+ return patch;
+ }
+ void patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS);
+
+ // Wrapper for constantTag.is_klass_[or_]reference.
+ // In older versions of the VM, klassOops cannot sneak into early phases of
+ // constant pool construction, but in later versions they can.
+ // %%% Let's phase out the old is_klass_reference.
+ bool is_klass_reference(constantPoolHandle cp, int index) {
+ return ((LinkWellKnownClasses || AnonymousClasses)
+ ? cp->tag_at(index).is_klass_or_reference()
+ : cp->tag_at(index).is_klass_reference());
+ }
+
public:
// Constructor
ClassFileParser(ClassFileStream* st) { set_stream(st); }
// Parse .class file and return new klassOop. The klassOop is not hooked up
@@ -219,10 +249,18 @@
// while parsing the stream.
instanceKlassHandle parseClassFile(symbolHandle name,
Handle class_loader,
Handle protection_domain,
symbolHandle& parsed_name,
+ TRAPS) {
+ return parseClassFile(name, class_loader, protection_domain, NULL, parsed_name, THREAD);
+ }
+ instanceKlassHandle parseClassFile(symbolHandle name,
+ Handle class_loader,
+ Handle protection_domain,
+ GrowableArray<Handle>* cp_patches,
+ symbolHandle& parsed_name,
TRAPS);
// Verifier checks
static void check_super_class_access(instanceKlassHandle this_klass, TRAPS);
static void check_super_interface_access(instanceKlassHandle this_klass, TRAPS);