--- a/hotspot/src/share/vm/classfile/classFileParser.hpp Wed Jul 05 23:44:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp Thu Jun 22 00:51:07 2017 +0200
@@ -75,12 +75,19 @@
enum { LegalClass, LegalField, LegalMethod }; // used to verify unqualified names
private:
+ // Potentially unaligned pointer to various 16-bit entries in the class file
+ typedef void unsafe_u2;
+
const ClassFileStream* _stream; // Actual input stream
const Symbol* _requested_name;
Symbol* _class_name;
mutable ClassLoaderData* _loader_data;
const InstanceKlass* _host_klass;
GrowableArray<Handle>* _cp_patches; // overrides for CP entries
+ int _num_patched_klasses;
+ int _max_num_patched_klasses;
+ int _orig_cp_size;
+ int _first_patched_klass_resolved_index;
// Metadata created before the instance klass is created. Must be deallocated
// if not transferred to the InstanceKlass upon successful class loading
@@ -238,28 +245,28 @@
bool* const declares_nonstatic_concrete_methods,
TRAPS);
- const u2* parse_exception_table(const ClassFileStream* const stream,
- u4 code_length,
- u4 exception_table_length,
- TRAPS);
+ const unsafe_u2* parse_exception_table(const ClassFileStream* const stream,
+ u4 code_length,
+ u4 exception_table_length,
+ TRAPS);
void parse_linenumber_table(u4 code_attribute_length,
u4 code_length,
CompressedLineNumberWriteStream**const write_stream,
TRAPS);
- const u2* parse_localvariable_table(const ClassFileStream* const cfs,
- u4 code_length,
- u2 max_locals,
- u4 code_attribute_length,
- u2* const localvariable_table_length,
- bool isLVTT,
- TRAPS);
+ const unsafe_u2* parse_localvariable_table(const ClassFileStream* const cfs,
+ u4 code_length,
+ u2 max_locals,
+ u4 code_attribute_length,
+ u2* const localvariable_table_length,
+ bool isLVTT,
+ TRAPS);
- const u2* parse_checked_exceptions(const ClassFileStream* const cfs,
- u2* const checked_exceptions_length,
- u4 method_attribute_length,
- TRAPS);
+ const unsafe_u2* parse_checked_exceptions(const ClassFileStream* const cfs,
+ u2* const checked_exceptions_length,
+ u4 method_attribute_length,
+ TRAPS);
void parse_type_array(u2 array_length,
u4 code_length,
@@ -312,6 +319,10 @@
int index,
const char *name,
TRAPS) const;
+ void classfile_parse_error(const char* msg,
+ const char* name,
+ const char* signature,
+ TRAPS) const;
inline void guarantee_property(bool b, const char* msg, TRAPS) const {
if (!b) { classfile_parse_error(msg, CHECK); }
@@ -430,6 +441,7 @@
return patch;
}
+ void patch_class(ConstantPool* cp, int class_index, Klass* k, Symbol* name);
void patch_constant_pool(ConstantPool* cp,
int index,
Handle patch,
@@ -453,10 +465,10 @@
void copy_localvariable_table(const ConstMethod* cm,
int lvt_cnt,
u2* const localvariable_table_length,
- const u2**const localvariable_table_start,
+ const unsafe_u2** const localvariable_table_start,
int lvtt_cnt,
u2* const localvariable_type_table_length,
- const u2** const localvariable_type_table_start,
+ const unsafe_u2** const localvariable_type_table_start,
TRAPS);
void copy_method_annotations(ConstMethod* cm,