comparison src/share/vm/classfile/vmSymbols.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 1d7922586cf6
children 65d07d9ee446
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
179 for (int i = 0; i < T_VOID+1; i++) { 179 for (int i = 0; i < T_VOID+1; i++) {
180 f->do_symbol(&_type_signatures[i]); 180 f->do_symbol(&_type_signatures[i]);
181 } 181 }
182 } 182 }
183 183
184 void vmSymbols::serialize(SerializeOopClosure* soc) { 184 void vmSymbols::serialize(SerializeClosure* soc) {
185 soc->do_region((u_char*)&_symbols[FIRST_SID], 185 soc->do_region((u_char*)&_symbols[FIRST_SID],
186 (SID_LIMIT - FIRST_SID) * sizeof(_symbols[0])); 186 (SID_LIMIT - FIRST_SID) * sizeof(_symbols[0]));
187 soc->do_region((u_char*)_type_signatures, sizeof(_type_signatures)); 187 soc->do_region((u_char*)_type_signatures, sizeof(_type_signatures));
188 } 188 }
189 189
209 vmSymbols::SID vmSymbols::find_sid(Symbol* symbol) { 209 vmSymbols::SID vmSymbols::find_sid(Symbol* symbol) {
210 // Handle the majority of misses by a bounds check. 210 // Handle the majority of misses by a bounds check.
211 // Then, use a binary search over the index. 211 // Then, use a binary search over the index.
212 // Expected trip count is less than log2_SID_LIMIT, about eight. 212 // Expected trip count is less than log2_SID_LIMIT, about eight.
213 // This is slow but acceptable, given that calls are not 213 // This is slow but acceptable, given that calls are not
214 // dynamically common. (methodOop::intrinsic_id has a cache.) 214 // dynamically common. (Method*::intrinsic_id has a cache.)
215 NOT_PRODUCT(find_sid_calls++); 215 NOT_PRODUCT(find_sid_calls++);
216 int min = (int)FIRST_SID, max = (int)SID_LIMIT - 1; 216 int min = (int)FIRST_SID, max = (int)SID_LIMIT - 1;
217 SID sid = NO_SID, sid1; 217 SID sid = NO_SID, sid1;
218 int cmp1; 218 int cmp1;
219 sid1 = vm_symbol_index[min]; 219 sid1 = vm_symbol_index[min];
322 #undef SRC_DEST 322 #undef SRC_DEST
323 323
324 return vmIntrinsics::_none; 324 return vmIntrinsics::_none;
325 } 325 }
326 326
327 methodOop vmIntrinsics::method_for(vmIntrinsics::ID id) { 327 Method* vmIntrinsics::method_for(vmIntrinsics::ID id) {
328 if (id == _none) return NULL; 328 if (id == _none) return NULL;
329 Symbol* cname = vmSymbols::symbol_at(class_for(id)); 329 Symbol* cname = vmSymbols::symbol_at(class_for(id));
330 Symbol* mname = vmSymbols::symbol_at(name_for(id)); 330 Symbol* mname = vmSymbols::symbol_at(name_for(id));
331 Symbol* msig = vmSymbols::symbol_at(signature_for(id)); 331 Symbol* msig = vmSymbols::symbol_at(signature_for(id));
332 if (cname == NULL || mname == NULL || msig == NULL) return NULL; 332 if (cname == NULL || mname == NULL || msig == NULL) return NULL;
333 klassOop k = SystemDictionary::find_well_known_klass(cname); 333 Klass* k = SystemDictionary::find_well_known_klass(cname);
334 if (k == NULL) return NULL; 334 if (k == NULL) return NULL;
335 methodOop m = instanceKlass::cast(k)->find_method(mname, msig); 335 Method* m = InstanceKlass::cast(k)->find_method(mname, msig);
336 if (m == NULL && 336 if (m == NULL &&
337 cname == vmSymbols::java_lang_invoke_MethodHandle() && 337 cname == vmSymbols::java_lang_invoke_MethodHandle() &&
338 msig == vmSymbols::star_name()) { 338 msig == vmSymbols::star_name()) {
339 // Any signature polymorphic method is represented by a fixed concrete signature: 339 // Any signature polymorphic method is represented by a fixed concrete signature:
340 m = instanceKlass::cast(k)->find_method(mname, vmSymbols::object_array_object_signature()); 340 m = InstanceKlass::cast(k)->find_method(mname, vmSymbols::object_array_object_signature());
341 } 341 }
342 return m; 342 return m;
343 } 343 }
344 344
345 345
502 502
503 503
504 #ifndef PRODUCT 504 #ifndef PRODUCT
505 // verify_method performs an extra check on a matched intrinsic method 505 // verify_method performs an extra check on a matched intrinsic method
506 506
507 static bool match_method(methodOop m, Symbol* n, Symbol* s) { 507 static bool match_method(Method* m, Symbol* n, Symbol* s) {
508 return (m->name() == n && 508 return (m->name() == n &&
509 m->signature() == s); 509 m->signature() == s);
510 } 510 }
511 511
512 static vmIntrinsics::ID match_method_with_klass(methodOop m, Symbol* mk) { 512 static vmIntrinsics::ID match_method_with_klass(Method* m, Symbol* mk) {
513 #define VM_INTRINSIC_MATCH(id, klassname, namepart, sigpart, flags) \ 513 #define VM_INTRINSIC_MATCH(id, klassname, namepart, sigpart, flags) \
514 { Symbol* k = vmSymbols::klassname(); \ 514 { Symbol* k = vmSymbols::klassname(); \
515 if (mk == k) { \ 515 if (mk == k) { \
516 Symbol* n = vmSymbols::namepart(); \ 516 Symbol* n = vmSymbols::namepart(); \
517 Symbol* s = vmSymbols::sigpart(); \ 517 Symbol* s = vmSymbols::sigpart(); \
522 VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); 522 VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
523 return vmIntrinsics::_none; 523 return vmIntrinsics::_none;
524 #undef VM_INTRINSIC_MATCH 524 #undef VM_INTRINSIC_MATCH
525 } 525 }
526 526
527 void vmIntrinsics::verify_method(ID actual_id, methodOop m) { 527 void vmIntrinsics::verify_method(ID actual_id, Method* m) {
528 Symbol* mk = Klass::cast(m->method_holder())->name(); 528 Symbol* mk = Klass::cast(m->method_holder())->name();
529 ID declared_id = match_method_with_klass(m, mk); 529 ID declared_id = match_method_with_klass(m, mk);
530 530
531 if (declared_id == actual_id) return; // success 531 if (declared_id == actual_id) return; // success
532 532