classFileParser.hpp revision 710
/*
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// Parser for for .class files
//
// The bytes describing the class file structure is read from a Stream object
class ClassFileParser VALUE_OBJ_CLASS_SPEC {
private:
bool _need_verify;
bool _relax_verify;
bool _has_finalizer;
bool _has_empty_finalizer;
bool _has_vanilla_constructor;
enum { fixed_buffer_size = 128 };
// Accessors
// Constant pool parsing
// Interface parsing
int length,
TRAPS);
// Field parsing
bool* is_synthetic_addr,
struct FieldAllocationCount *fac,
// Method parsing
TRAPS);
bool* has_final_method,
TRAPS);
TRAPS);
void parse_linenumber_table(
// Classfile attribute parsing
instanceKlassHandle k, TRAPS);
// Annotations handling
// Final setup
void set_precomputed_flags(instanceKlassHandle k);
// Special handling for certain classes.
// Add the "discovered" field to java.lang.ref.Reference if
// it does not exist.
// Adjust the field allocation counts for java.lang.Class to add
// fake fields.
// Adjust the next_nonstatic_oop_offset to place the fake fields
// before any Java fields.
void java_lang_Class_fix_post(int* next_nonstatic_oop_offset);
// Adjust the field allocation counts for java.dyn.MethodHandle to add
// a fake address (void*) field.
// Format checker methods
}
#ifdef ASSERT
#endif
}
if (_need_verify) {
} else {
}
}
if (_need_verify) {
} else {
}
}
}
}
}
void verify_constantvalue(int constantvalue_index, int signature_index, constantPoolHandle cp, TRAPS);
bool is_anonymous() {
return _host_klass.not_null();
}
bool has_cp_patch_at(int index) {
return (_cp_patches != NULL
}
}
return patch;
}
// 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.
return ((LinkWellKnownClasses || AnonymousClasses)
}
public:
// Constructor
// Parse .class file and return new klassOop. The klassOop is not hooked up
// to the system dictionary or any other structures, so a .class file can
// be loaded several times if desired.
// The system dictionary hookup is done by the caller.
//
// "parsed_name" is updated by this method, and is the name found
// while parsing the stream.
TRAPS) {
return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, THREAD);
}
TRAPS);
// Verifier checks
};