< prev index next >

src/share/vm/oops/cpCache.cpp

Print this page




 291          "a resolved_references array should have been created for this class");
 292   ObjectLocker ol(resolved_references, Thread::current());
 293   if (!is_f1_null()) {
 294     return;
 295   }
 296 
 297   const methodHandle adapter = call_info.resolved_method();
 298   const Handle appendix      = call_info.resolved_appendix();
 299   const Handle method_type   = call_info.resolved_method_type();
 300   const bool has_appendix    = appendix.not_null();
 301   const bool has_method_type = method_type.not_null();
 302 
 303   // Write the flags.
 304   set_method_flags(as_TosState(adapter->result_type()),
 305                    ((has_appendix    ? 1 : 0) << has_appendix_shift   ) |
 306                    ((has_method_type ? 1 : 0) << has_method_type_shift) |
 307                    (                   1      << is_final_shift       ),
 308                    adapter->size_of_parameters());
 309 
 310   if (TraceInvokeDynamic) {
 311     tty->print_cr("set_method_handle bc=%d appendix="PTR_FORMAT"%s method_type="PTR_FORMAT"%s method="PTR_FORMAT" ",
 312                   invoke_code,
 313                   (void *)appendix(),    (has_appendix    ? "" : " (unused)"),
 314                   (void *)method_type(), (has_method_type ? "" : " (unused)"),
 315                   (intptr_t)adapter());
 316     adapter->print();
 317     if (has_appendix)  appendix()->print();
 318   }
 319 
 320   // Method handle invokes and invokedynamic sites use both cp cache words.
 321   // refs[f2], if not null, contains a value passed as a trailing argument to the adapter.
 322   // In the general case, this could be the call site's MethodType,
 323   // for use with java.lang.Invokers.checkExactType, or else a CallSite object.
 324   // f1 contains the adapter method which manages the actual call.
 325   // In the general case, this is a compiled LambdaForm.
 326   // (The Java code is free to optimize these calls by binding other
 327   // sorts of methods and appendices to call sites.)
 328   // JVM-level linking is via f1, as if for invokespecial, and signatures are erased.
 329   // The appendix argument (if any) is added to the signature, and is counted in the parameter_size bits.
 330   // Even with the appendix, the method will never take more than 255 parameter slots.
 331   //


 521       // _f1 can also contain a Klass* for an interface
 522       return NULL;
 523     }
 524     m = f1_as_method();
 525   }
 526   assert(m != NULL && m->is_method(), "sanity check");
 527   if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) {
 528     // robustness for above sanity checks or method is not in
 529     // the interesting class
 530     return NULL;
 531   }
 532   // the method is in the interesting class so the entry is interesting
 533   return m;
 534 }
 535 #endif // INCLUDE_JVMTI
 536 
 537 void ConstantPoolCacheEntry::print(outputStream* st, int index) const {
 538   // print separator
 539   if (index == 0) st->print_cr("                 -------------");
 540   // print entry
 541   st->print("%3d  ("PTR_FORMAT")  ", index, (intptr_t)this);
 542   st->print_cr("[%02x|%02x|%5d]", bytecode_2(), bytecode_1(),
 543                constant_pool_index());
 544   st->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)_f1);
 545   st->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)_f2);
 546   st->print_cr("                 [   "PTR_FORMAT"]", (intptr_t)_flags);
 547   st->print_cr("                 -------------");
 548 }
 549 
 550 void ConstantPoolCacheEntry::verify(outputStream* st) const {
 551   // not implemented yet
 552 }
 553 
 554 // Implementation of ConstantPoolCache
 555 
 556 ConstantPoolCache* ConstantPoolCache::allocate(ClassLoaderData* loader_data,
 557                                      const intStack& index_map,
 558                                      const intStack& invokedynamic_index_map,
 559                                      const intStack& invokedynamic_map, TRAPS) {
 560 
 561   const int length = index_map.length() + invokedynamic_index_map.length();
 562   int size = ConstantPoolCache::size(length);
 563 
 564   return new (loader_data, size, false, MetaspaceObj::ConstantPoolCacheType, THREAD)
 565     ConstantPoolCache(length, index_map, invokedynamic_index_map, invokedynamic_map);
 566 }




 291          "a resolved_references array should have been created for this class");
 292   ObjectLocker ol(resolved_references, Thread::current());
 293   if (!is_f1_null()) {
 294     return;
 295   }
 296 
 297   const methodHandle adapter = call_info.resolved_method();
 298   const Handle appendix      = call_info.resolved_appendix();
 299   const Handle method_type   = call_info.resolved_method_type();
 300   const bool has_appendix    = appendix.not_null();
 301   const bool has_method_type = method_type.not_null();
 302 
 303   // Write the flags.
 304   set_method_flags(as_TosState(adapter->result_type()),
 305                    ((has_appendix    ? 1 : 0) << has_appendix_shift   ) |
 306                    ((has_method_type ? 1 : 0) << has_method_type_shift) |
 307                    (                   1      << is_final_shift       ),
 308                    adapter->size_of_parameters());
 309 
 310   if (TraceInvokeDynamic) {
 311     tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method_type=" PTR_FORMAT "%s method=" PTR_FORMAT " ",
 312                   invoke_code,
 313                   (void *)appendix(),    (has_appendix    ? "" : " (unused)"),
 314                   (void *)method_type(), (has_method_type ? "" : " (unused)"),
 315                   (intptr_t)adapter());
 316     adapter->print();
 317     if (has_appendix)  appendix()->print();
 318   }
 319 
 320   // Method handle invokes and invokedynamic sites use both cp cache words.
 321   // refs[f2], if not null, contains a value passed as a trailing argument to the adapter.
 322   // In the general case, this could be the call site's MethodType,
 323   // for use with java.lang.Invokers.checkExactType, or else a CallSite object.
 324   // f1 contains the adapter method which manages the actual call.
 325   // In the general case, this is a compiled LambdaForm.
 326   // (The Java code is free to optimize these calls by binding other
 327   // sorts of methods and appendices to call sites.)
 328   // JVM-level linking is via f1, as if for invokespecial, and signatures are erased.
 329   // The appendix argument (if any) is added to the signature, and is counted in the parameter_size bits.
 330   // Even with the appendix, the method will never take more than 255 parameter slots.
 331   //


 521       // _f1 can also contain a Klass* for an interface
 522       return NULL;
 523     }
 524     m = f1_as_method();
 525   }
 526   assert(m != NULL && m->is_method(), "sanity check");
 527   if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) {
 528     // robustness for above sanity checks or method is not in
 529     // the interesting class
 530     return NULL;
 531   }
 532   // the method is in the interesting class so the entry is interesting
 533   return m;
 534 }
 535 #endif // INCLUDE_JVMTI
 536 
 537 void ConstantPoolCacheEntry::print(outputStream* st, int index) const {
 538   // print separator
 539   if (index == 0) st->print_cr("                 -------------");
 540   // print entry
 541   st->print("%3d  (" PTR_FORMAT ")  ", index, (intptr_t)this);
 542   st->print_cr("[%02x|%02x|%5d]", bytecode_2(), bytecode_1(),
 543                constant_pool_index());
 544   st->print_cr("                 [   " PTR_FORMAT "]", (intptr_t)_f1);
 545   st->print_cr("                 [   " PTR_FORMAT "]", (intptr_t)_f2);
 546   st->print_cr("                 [   " PTR_FORMAT "]", (intptr_t)_flags);
 547   st->print_cr("                 -------------");
 548 }
 549 
 550 void ConstantPoolCacheEntry::verify(outputStream* st) const {
 551   // not implemented yet
 552 }
 553 
 554 // Implementation of ConstantPoolCache
 555 
 556 ConstantPoolCache* ConstantPoolCache::allocate(ClassLoaderData* loader_data,
 557                                      const intStack& index_map,
 558                                      const intStack& invokedynamic_index_map,
 559                                      const intStack& invokedynamic_map, TRAPS) {
 560 
 561   const int length = index_map.length() + invokedynamic_index_map.length();
 562   int size = ConstantPoolCache::size(length);
 563 
 564   return new (loader_data, size, false, MetaspaceObj::ConstantPoolCacheType, THREAD)
 565     ConstantPoolCache(length, index_map, invokedynamic_index_map, invokedynamic_map);
 566 }


< prev index next >