src/share/vm/prims/methodHandleWalk.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
7042122 Cdiff src/share/vm/prims/methodHandleWalk.cpp
src/share/vm/prims/methodHandleWalk.cpp
Print this page
*** 614,626 ****
// -----------------------------------------------------------------------------
// MethodHandleCompiler
! MethodHandleCompiler::MethodHandleCompiler(Handle root, methodHandle callee, bool is_invokedynamic, TRAPS)
: MethodHandleWalker(root, is_invokedynamic, THREAD),
_callee(callee),
_thread(THREAD),
_bytecode(THREAD, 50),
_constants(THREAD, 10),
_cur_stack(0),
_max_stack(0),
--- 614,627 ----
// -----------------------------------------------------------------------------
// MethodHandleCompiler
! MethodHandleCompiler::MethodHandleCompiler(Handle root, methodHandle callee, int invoke_count, bool is_invokedynamic, TRAPS)
: MethodHandleWalker(root, is_invokedynamic, THREAD),
_callee(callee),
+ _invoke_count(invoke_count),
_thread(THREAD),
_bytecode(THREAD, 50),
_constants(THREAD, 10),
_cur_stack(0),
_max_stack(0),
*** 1180,1205 ****
return cpool;
}
methodHandle MethodHandleCompiler::get_method_oop(TRAPS) const {
! methodHandle nullHandle;
// Create a method that holds the generated bytecode. invokedynamic
// has no receiver, normal MH calls do.
int flags_bits;
if (for_invokedynamic())
flags_bits = (/*JVM_MH_INVOKE_BITS |*/ JVM_ACC_PUBLIC | JVM_ACC_FINAL | JVM_ACC_SYNTHETIC | JVM_ACC_STATIC);
else
flags_bits = (/*JVM_MH_INVOKE_BITS |*/ JVM_ACC_PUBLIC | JVM_ACC_FINAL | JVM_ACC_SYNTHETIC);
methodOop m_oop = oopFactory::new_method(bytecode_length(),
accessFlags_from(flags_bits),
! 0, 0, 0, oopDesc::IsSafeConc, CHECK_(nullHandle));
! methodHandle m(THREAD, m_oop);
! m_oop = NULL; // oop not GC safe
! constantPoolHandle cpool = get_constant_pool(CHECK_(nullHandle));
m->set_constants(cpool());
m->set_name_index(_name_index);
m->set_signature_index(_signature_index);
--- 1181,1209 ----
return cpool;
}
methodHandle MethodHandleCompiler::get_method_oop(TRAPS) const {
! methodHandle empty;
// Create a method that holds the generated bytecode. invokedynamic
// has no receiver, normal MH calls do.
int flags_bits;
if (for_invokedynamic())
flags_bits = (/*JVM_MH_INVOKE_BITS |*/ JVM_ACC_PUBLIC | JVM_ACC_FINAL | JVM_ACC_SYNTHETIC | JVM_ACC_STATIC);
else
flags_bits = (/*JVM_MH_INVOKE_BITS |*/ JVM_ACC_PUBLIC | JVM_ACC_FINAL | JVM_ACC_SYNTHETIC);
+ // Create a new method
+ methodHandle m;
+ {
methodOop m_oop = oopFactory::new_method(bytecode_length(),
accessFlags_from(flags_bits),
! 0, 0, 0, oopDesc::IsSafeConc, CHECK_(empty));
! m = methodHandle(THREAD, m_oop);
! }
! constantPoolHandle cpool = get_constant_pool(CHECK_(empty));
m->set_constants(cpool());
m->set_name_index(_name_index);
m->set_signature_index(_signature_index);
*** 1210,1229 ****
m->set_size_of_parameters(_num_params);
typeArrayHandle exception_handlers(THREAD, Universe::the_empty_int_array());
m->set_exception_table(exception_handlers());
! // Set the carry bit of the invocation counter to force inlining of
! // the adapter.
InvocationCounter* ic = m->invocation_counter();
! ic->set_carry_flag();
// Rewrite the method and set up the constant pool cache.
! objArrayOop m_array = oopFactory::new_system_objArray(1, CHECK_(nullHandle));
objArrayHandle methods(THREAD, m_array);
methods->obj_at_put(0, m());
! Rewriter::rewrite(_target_klass(), cpool, methods, CHECK_(nullHandle)); // Use fake class.
#ifndef PRODUCT
if (TraceMethodHandles) {
m->print();
m->print_codes();
--- 1214,1249 ----
m->set_size_of_parameters(_num_params);
typeArrayHandle exception_handlers(THREAD, Universe::the_empty_int_array());
m->set_exception_table(exception_handlers());
! // Set the invocation counter's count to the invoke count of the
! // original call site.
InvocationCounter* ic = m->invocation_counter();
! ic->set(InvocationCounter::wait_for_compile, _invoke_count);
// Rewrite the method and set up the constant pool cache.
! objArrayOop m_array = oopFactory::new_system_objArray(1, CHECK_(empty));
objArrayHandle methods(THREAD, m_array);
methods->obj_at_put(0, m());
! Rewriter::rewrite(_target_klass(), cpool, methods, CHECK_(empty)); // Use fake class.
!
! // Create a new MDO
! {
! methodDataOop mdo = oopFactory::new_methodData(m, CHECK_(empty));
! assert(m->method_data() == NULL, "there should not be an MDO yet");
! m->set_method_data(mdo);
!
! // Iterate over all profile data and set the count of the counter
! // data entries to the original call site counter.
! for (ProfileData* pd = mdo->first_data(); mdo->is_valid(pd); pd = mdo->next_data(pd)) {
! if (pd->is_CounterData()) {
! CounterData* cd = pd->as_CounterData();
! cd->set_count(_invoke_count);
! }
! }
! }
#ifndef PRODUCT
if (TraceMethodHandles) {
m->print();
m->print_codes();
src/share/vm/prims/methodHandleWalk.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File