Mercurial > hg > truffle
comparison src/share/vm/classfile/classFileParser.hpp @ 710:e5b0439ef4ae
6655638: dynamic languages need method handles
Summary: initial implementation, with known omissions (x86/64, sparc, compiler optim., c-oops, C++ interp.)
Reviewed-by: kvn, twisti, never
author | jrose |
---|---|
date | Wed, 08 Apr 2009 10:56:49 -0700 |
parents | ad8c8ca4ab0f |
children | 6a93908f268f |
comparison
equal
deleted
inserted
replaced
709:1d037ecd7960 | 710:e5b0439ef4ae |
---|---|
1 /* | 1 /* |
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
31 bool _need_verify; | 31 bool _need_verify; |
32 bool _relax_verify; | 32 bool _relax_verify; |
33 u2 _major_version; | 33 u2 _major_version; |
34 u2 _minor_version; | 34 u2 _minor_version; |
35 symbolHandle _class_name; | 35 symbolHandle _class_name; |
36 KlassHandle _host_klass; | |
36 GrowableArray<Handle>* _cp_patches; // overrides for CP entries | 37 GrowableArray<Handle>* _cp_patches; // overrides for CP entries |
37 | 38 |
38 bool _has_finalizer; | 39 bool _has_finalizer; |
39 bool _has_empty_finalizer; | 40 bool _has_empty_finalizer; |
40 bool _has_vanilla_constructor; | 41 bool _has_vanilla_constructor; |
143 void java_lang_Class_fix_pre(objArrayHandle* methods_ptr, | 144 void java_lang_Class_fix_pre(objArrayHandle* methods_ptr, |
144 FieldAllocationCount *fac_ptr, TRAPS); | 145 FieldAllocationCount *fac_ptr, TRAPS); |
145 // Adjust the next_nonstatic_oop_offset to place the fake fields | 146 // Adjust the next_nonstatic_oop_offset to place the fake fields |
146 // before any Java fields. | 147 // before any Java fields. |
147 void java_lang_Class_fix_post(int* next_nonstatic_oop_offset); | 148 void java_lang_Class_fix_post(int* next_nonstatic_oop_offset); |
149 // Adjust the field allocation counts for java.dyn.MethodHandle to add | |
150 // a fake address (void*) field. | |
151 void java_dyn_MethodHandle_fix_pre(constantPoolHandle cp, | |
152 typeArrayHandle* fields_ptr, | |
153 FieldAllocationCount *fac_ptr, TRAPS); | |
148 | 154 |
149 // Format checker methods | 155 // Format checker methods |
150 void classfile_parse_error(const char* msg, TRAPS); | 156 void classfile_parse_error(const char* msg, TRAPS); |
151 void classfile_parse_error(const char* msg, int index, TRAPS); | 157 void classfile_parse_error(const char* msg, int index, TRAPS); |
152 void classfile_parse_error(const char* msg, const char *name, TRAPS); | 158 void classfile_parse_error(const char* msg, const char *name, TRAPS); |
202 void verify_legal_method_modifiers(jint flags, bool is_interface, symbolHandle name, TRAPS); | 208 void verify_legal_method_modifiers(jint flags, bool is_interface, symbolHandle name, TRAPS); |
203 bool verify_unqualified_name(char* name, unsigned int length, int type); | 209 bool verify_unqualified_name(char* name, unsigned int length, int type); |
204 char* skip_over_field_name(char* name, bool slash_ok, unsigned int length); | 210 char* skip_over_field_name(char* name, bool slash_ok, unsigned int length); |
205 char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS); | 211 char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS); |
206 | 212 |
213 bool is_anonymous() { | |
214 assert(AnonymousClasses || _host_klass.is_null(), ""); | |
215 return _host_klass.not_null(); | |
216 } | |
207 bool has_cp_patch_at(int index) { | 217 bool has_cp_patch_at(int index) { |
208 assert(AnonymousClasses, ""); | 218 assert(AnonymousClasses, ""); |
209 assert(index >= 0, "oob"); | 219 assert(index >= 0, "oob"); |
210 return (_cp_patches != NULL | 220 return (_cp_patches != NULL |
211 && index < _cp_patches->length() | 221 && index < _cp_patches->length() |
247 instanceKlassHandle parseClassFile(symbolHandle name, | 257 instanceKlassHandle parseClassFile(symbolHandle name, |
248 Handle class_loader, | 258 Handle class_loader, |
249 Handle protection_domain, | 259 Handle protection_domain, |
250 symbolHandle& parsed_name, | 260 symbolHandle& parsed_name, |
251 TRAPS) { | 261 TRAPS) { |
252 return parseClassFile(name, class_loader, protection_domain, NULL, parsed_name, THREAD); | 262 KlassHandle no_host_klass; |
263 return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, THREAD); | |
253 } | 264 } |
254 instanceKlassHandle parseClassFile(symbolHandle name, | 265 instanceKlassHandle parseClassFile(symbolHandle name, |
255 Handle class_loader, | 266 Handle class_loader, |
256 Handle protection_domain, | 267 Handle protection_domain, |
268 KlassHandle host_klass, | |
257 GrowableArray<Handle>* cp_patches, | 269 GrowableArray<Handle>* cp_patches, |
258 symbolHandle& parsed_name, | 270 symbolHandle& parsed_name, |
259 TRAPS); | 271 TRAPS); |
260 | 272 |
261 // Verifier checks | 273 // Verifier checks |