comparison src/share/vm/classfile/classFileParser.hpp @ 2177:3582bf76420e

6990754: Use native memory and reference counting to implement SymbolTable Summary: move symbols from permgen into C heap and reference count them Reviewed-by: never, acorn, jmasa, stefank
author coleenp
date Thu, 27 Jan 2011 16:11:27 -0800
parents dad31fc330cd
children 8033953d67ff
comparison
equal deleted inserted replaced
2176:27e4ea99855d 2177:3582bf76420e
30 #include "oops/oop.inline.hpp" 30 #include "oops/oop.inline.hpp"
31 #include "oops/typeArrayOop.hpp" 31 #include "oops/typeArrayOop.hpp"
32 #include "runtime/handles.inline.hpp" 32 #include "runtime/handles.inline.hpp"
33 #include "utilities/accessFlags.hpp" 33 #include "utilities/accessFlags.hpp"
34 34
35 class TempNewSymbol;
35 // Parser for for .class files 36 // Parser for for .class files
36 // 37 //
37 // The bytes describing the class file structure is read from a Stream object 38 // The bytes describing the class file structure is read from a Stream object
38 39
39 class ClassFileParser VALUE_OBJ_CLASS_SPEC { 40 class ClassFileParser VALUE_OBJ_CLASS_SPEC {
40 private: 41 private:
41 bool _need_verify; 42 bool _need_verify;
42 bool _relax_verify; 43 bool _relax_verify;
43 u2 _major_version; 44 u2 _major_version;
44 u2 _minor_version; 45 u2 _minor_version;
45 symbolHandle _class_name; 46 Symbol* _class_name;
46 KlassHandle _host_klass; 47 KlassHandle _host_klass;
47 GrowableArray<Handle>* _cp_patches; // overrides for CP entries 48 GrowableArray<Handle>* _cp_patches; // overrides for CP entries
48 49
49 bool _has_finalizer; 50 bool _has_finalizer;
50 bool _has_empty_finalizer; 51 bool _has_empty_finalizer;
71 // Interface parsing 72 // Interface parsing
72 objArrayHandle parse_interfaces(constantPoolHandle cp, 73 objArrayHandle parse_interfaces(constantPoolHandle cp,
73 int length, 74 int length,
74 Handle class_loader, 75 Handle class_loader,
75 Handle protection_domain, 76 Handle protection_domain,
76 symbolHandle class_name, 77 Symbol* class_name,
77 TRAPS); 78 TRAPS);
78 79
79 // Field parsing 80 // Field parsing
80 void parse_field_attributes(constantPoolHandle cp, u2 attributes_count, 81 void parse_field_attributes(constantPoolHandle cp, u2 attributes_count,
81 bool is_static, u2 signature_index, 82 bool is_static, u2 signature_index,
207 inline void guarantee_property(bool b, const char* msg, int index, const char *name, TRAPS) { 208 inline void guarantee_property(bool b, const char* msg, int index, const char *name, TRAPS) {
208 if (!b) { classfile_parse_error(msg, index, name, CHECK); } 209 if (!b) { classfile_parse_error(msg, index, name, CHECK); }
209 } 210 }
210 211
211 void throwIllegalSignature( 212 void throwIllegalSignature(
212 const char* type, symbolHandle name, symbolHandle sig, TRAPS); 213 const char* type, Symbol* name, Symbol* sig, TRAPS);
213 214
214 bool is_supported_version(u2 major, u2 minor); 215 bool is_supported_version(u2 major, u2 minor);
215 bool has_illegal_visibility(jint flags); 216 bool has_illegal_visibility(jint flags);
216 217
217 void verify_constantvalue(int constantvalue_index, int signature_index, constantPoolHandle cp, TRAPS); 218 void verify_constantvalue(int constantvalue_index, int signature_index, constantPoolHandle cp, TRAPS);
218 void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS); 219 void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS);
219 void verify_legal_class_name(symbolHandle name, TRAPS); 220 void verify_legal_class_name(Symbol* name, TRAPS);
220 void verify_legal_field_name(symbolHandle name, TRAPS); 221 void verify_legal_field_name(Symbol* name, TRAPS);
221 void verify_legal_method_name(symbolHandle name, TRAPS); 222 void verify_legal_method_name(Symbol* name, TRAPS);
222 void verify_legal_field_signature(symbolHandle fieldname, symbolHandle signature, TRAPS); 223 void verify_legal_field_signature(Symbol* fieldname, Symbol* signature, TRAPS);
223 int verify_legal_method_signature(symbolHandle methodname, symbolHandle signature, TRAPS); 224 int verify_legal_method_signature(Symbol* methodname, Symbol* signature, TRAPS);
224 void verify_legal_class_modifiers(jint flags, TRAPS); 225 void verify_legal_class_modifiers(jint flags, TRAPS);
225 void verify_legal_field_modifiers(jint flags, bool is_interface, TRAPS); 226 void verify_legal_field_modifiers(jint flags, bool is_interface, TRAPS);
226 void verify_legal_method_modifiers(jint flags, bool is_interface, symbolHandle name, TRAPS); 227 void verify_legal_method_modifiers(jint flags, bool is_interface, Symbol* name, TRAPS);
227 bool verify_unqualified_name(char* name, unsigned int length, int type); 228 bool verify_unqualified_name(char* name, unsigned int length, int type);
228 char* skip_over_field_name(char* name, bool slash_ok, unsigned int length); 229 char* skip_over_field_name(char* name, bool slash_ok, unsigned int length);
229 char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS); 230 char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS);
230 231
231 bool is_anonymous() { 232 bool is_anonymous() {
270 // be loaded several times if desired. 271 // be loaded several times if desired.
271 // The system dictionary hookup is done by the caller. 272 // The system dictionary hookup is done by the caller.
272 // 273 //
273 // "parsed_name" is updated by this method, and is the name found 274 // "parsed_name" is updated by this method, and is the name found
274 // while parsing the stream. 275 // while parsing the stream.
275 instanceKlassHandle parseClassFile(symbolHandle name, 276 instanceKlassHandle parseClassFile(Symbol* name,
276 Handle class_loader, 277 Handle class_loader,
277 Handle protection_domain, 278 Handle protection_domain,
278 symbolHandle& parsed_name, 279 TempNewSymbol& parsed_name,
279 bool verify, 280 bool verify,
280 TRAPS) { 281 TRAPS) {
281 KlassHandle no_host_klass; 282 KlassHandle no_host_klass;
282 return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, verify, THREAD); 283 return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, verify, THREAD);
283 } 284 }
284 instanceKlassHandle parseClassFile(symbolHandle name, 285 instanceKlassHandle parseClassFile(Symbol* name,
285 Handle class_loader, 286 Handle class_loader,
286 Handle protection_domain, 287 Handle protection_domain,
287 KlassHandle host_klass, 288 KlassHandle host_klass,
288 GrowableArray<Handle>* cp_patches, 289 GrowableArray<Handle>* cp_patches,
289 symbolHandle& parsed_name, 290 TempNewSymbol& parsed_name,
290 bool verify, 291 bool verify,
291 TRAPS); 292 TRAPS);
292 293
293 // Verifier checks 294 // Verifier checks
294 static void check_super_class_access(instanceKlassHandle this_klass, TRAPS); 295 static void check_super_class_access(instanceKlassHandle this_klass, TRAPS);