< prev index next >

src/share/vm/interpreter/rewriter.cpp

Print this page




 527 
 528   for (int i = len-1; i >= 0; i--) {
 529     Method* method = _methods->at(i);
 530     scan_method(method, false, &invokespecial_error);
 531     if (invokespecial_error) {
 532       // If you get an error here, there is no reversing bytecodes
 533       // This exception is stored for this class and no further attempt is
 534       // made at verifying or rewriting.
 535       THROW_MSG(vmSymbols::java_lang_InternalError(),
 536                 "This classfile overflows invokespecial for interfaces "
 537                 "and cannot be loaded");
 538       return;
 539      }
 540   }
 541 
 542   // May have to fix invokedynamic bytecodes if invokestatic/InterfaceMethodref
 543   // entries had to be added.
 544   patch_invokedynamic_bytecodes();
 545 }
 546 
 547 void Rewriter::rewrite(instanceKlassHandle klass, TRAPS) {
 548   if (!DumpSharedSpaces) {
 549     assert(!MetaspaceShared::is_in_shared_space(klass()), "archive methods must not be rewritten at run time");
 550   }
 551   ResourceMark rm(THREAD);
 552   Rewriter     rw(klass, klass->constants(), klass->methods(), CHECK);
 553   // (That's all, folks.)
 554 }
 555 
 556 Rewriter::Rewriter(instanceKlassHandle klass, const constantPoolHandle& cpool, Array<Method*>* methods, TRAPS)
 557   : _klass(klass),
 558     _pool(cpool),
 559     _methods(methods),
 560     _cp_map(cpool->length()),
 561     _cp_cache_map(cpool->length() / 2),
 562     _reference_map(cpool->length()),
 563     _resolved_references_map(cpool->length() / 2),
 564     _invokedynamic_references_map(cpool->length() / 2),
 565     _method_handle_invokers(cpool->length()),
 566     _invokedynamic_cp_cache_map(cpool->length() / 4)
 567 {
 568 
 569   // Rewrite bytecodes - exception here exits.
 570   rewrite_bytecodes(CHECK);
 571 
 572   // Stress restoring bytecodes
 573   if (StressRewriter) {
 574     restore_bytecodes();
 575     rewrite_bytecodes(CHECK);
 576   }




 527 
 528   for (int i = len-1; i >= 0; i--) {
 529     Method* method = _methods->at(i);
 530     scan_method(method, false, &invokespecial_error);
 531     if (invokespecial_error) {
 532       // If you get an error here, there is no reversing bytecodes
 533       // This exception is stored for this class and no further attempt is
 534       // made at verifying or rewriting.
 535       THROW_MSG(vmSymbols::java_lang_InternalError(),
 536                 "This classfile overflows invokespecial for interfaces "
 537                 "and cannot be loaded");
 538       return;
 539      }
 540   }
 541 
 542   // May have to fix invokedynamic bytecodes if invokestatic/InterfaceMethodref
 543   // entries had to be added.
 544   patch_invokedynamic_bytecodes();
 545 }
 546 
 547 void Rewriter::rewrite(InstanceKlass* klass, TRAPS) {
 548   if (!DumpSharedSpaces) {
 549     assert(!MetaspaceShared::is_in_shared_space(klass), "archive methods must not be rewritten at run time");
 550   }
 551   ResourceMark rm(THREAD);
 552   Rewriter     rw(klass, klass->constants(), klass->methods(), CHECK);
 553   // (That's all, folks.)
 554 }
 555 
 556 Rewriter::Rewriter(InstanceKlass* klass, const constantPoolHandle& cpool, Array<Method*>* methods, TRAPS)
 557   : _klass(klass),
 558     _pool(cpool),
 559     _methods(methods),
 560     _cp_map(cpool->length()),
 561     _cp_cache_map(cpool->length() / 2),
 562     _reference_map(cpool->length()),
 563     _resolved_references_map(cpool->length() / 2),
 564     _invokedynamic_references_map(cpool->length() / 2),
 565     _method_handle_invokers(cpool->length()),
 566     _invokedynamic_cp_cache_map(cpool->length() / 4)
 567 {
 568 
 569   // Rewrite bytecodes - exception here exits.
 570   rewrite_bytecodes(CHECK);
 571 
 572   // Stress restoring bytecodes
 573   if (StressRewriter) {
 574     restore_bytecodes();
 575     rewrite_bytecodes(CHECK);
 576   }


< prev index next >