src/share/vm/prims/methodHandles.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/prims/methodHandles.cpp Wed Oct 28 20:02:38 2009
--- new/src/share/vm/prims/methodHandles.cpp Wed Oct 28 20:02:38 2009
*** 130,141 ****
--- 130,142 ----
} else {
assert(vmindex == methodOopDesc::invalid_vtable_index, "random vmindex?");
}
return m;
} else {
decode_flags_result |= MethodHandles::_dmf_does_dispatch;
assert(vmtarget->is_klass(), "must be class or interface");
+ decode_flags_result |= MethodHandles::_dmf_does_dispatch;
+ decode_flags_result |= MethodHandles::_dmf_has_receiver;
receiver_limit_result = (klassOop)vmtarget;
Klass* tk = Klass::cast((klassOop)vmtarget);
if (tk->is_interface()) {
// an itable linkage is <interface, itable index>
decode_flags_result |= MethodHandles::_dmf_from_interface;
*** 177,188 ****
--- 178,191 ----
} else {
// Optimized case: binding a receiver to a non-dispatched DMH
// short-circuits directly to the methodOop.
// (It might be another argument besides a receiver also.)
assert(target->is_method(), "must be a simple method");
methodOop m = (methodOop) target;
decode_flags_result |= MethodHandles::_dmf_binds_method;
+ methodOop m = (methodOop) target;
+ if (!m->is_static())
+ decode_flags_result |= MethodHandles::_dmf_has_receiver;
return m;
}
}
}
}
*** 231,242 ****
--- 234,245 ----
// check that signature begins '(L' or '([' (not '(I', '()', etc.)
symbolOop sig = m->signature();
BasicType recv_bt = char2type(sig->byte_at(1));
// Note: recv_bt might be T_ILLEGAL if byte_at(2) is ')'
assert(sig->byte_at(0) == '(', "must be method sig");
! // if (recv_bt == T_OBJECT || recv_bt == T_ARRAY)
! // decode_flags_result |= _dmf_has_receiver;
} else {
// non-static method
decode_flags_result |= _dmf_has_receiver;
if (!m->can_be_statically_bound() && !m->is_initializer()) {
decode_flags_result |= _dmf_does_dispatch;
*** 1485,1496 ****
--- 1488,1500 ----
assert(slots_pushed <= MethodHandlePushLimit, "");
} else {
int target_pushes = decode_MethodHandle_stack_pushes(target());
assert(this_pushes == slots_pushed + target_pushes, "BMH stack motion must be correct");
// do not blow the stack; use a Java-based adapter if this limit is exceeded
if (slots_pushed + target_pushes > MethodHandlePushLimit)
err = "too many bound parameters";
+ // FIXME
+ // if (slots_pushed + target_pushes > MethodHandlePushLimit)
+ // err = "too many bound parameters";
}
}
if (err == NULL) {
// Verify the rest of the method type.
*** 1516,1525 ****
--- 1520,1534 ----
int insert_after = argnum - 1;
verify_vmargslot(mh, insert_after, sun_dyn_BoundMethodHandle::vmargslot(mh()), CHECK);
verify_vmslots(mh, CHECK);
}
+ // Get bound type and required slots.
+ oop ptype_oop = java_dyn_MethodType::ptype(java_dyn_MethodHandle::type(target()), argnum);
+ BasicType ptype = java_lang_Class::as_BasicType(ptype_oop);
+ int slots_pushed = type2size[ptype];
+
// If (a) the target is a direct non-dispatched method handle,
// or (b) the target is a dispatched direct method handle and we
// are binding the receiver, cut out the middle-man.
// Do this by decoding the DMH and using its methodOop directly as vmtarget.
bool direct_to_method = false;
*** 1527,1537 ****
--- 1536,1546 ----
target->klass() == SystemDictionary::DirectMethodHandle_klass() &&
(argnum == 0 || sun_dyn_DirectMethodHandle::vmindex(target()) < 0)) {
int decode_flags = 0; klassOop receiver_limit_oop = NULL;
methodHandle m(THREAD, decode_method(target(), receiver_limit_oop, decode_flags));
if (m.is_null()) { THROW_MSG(vmSymbols::java_lang_InternalError(), "DMH failed to decode"); }
! DEBUG_ONLY(int m_vmslots = m->size_of_parameters() - 1); // pos. of 1st arg.
! DEBUG_ONLY(int m_vmslots = m->size_of_parameters() - slots_pushed); // pos. of 1st arg.
assert(sun_dyn_BoundMethodHandle::vmslots(mh()) == m_vmslots, "type w/ m sig");
if (argnum == 0 && (decode_flags & _dmf_has_receiver) != 0) {
KlassHandle receiver_limit(THREAD, receiver_limit_oop);
init_BoundMethodHandle_with_receiver(mh, m,
receiver_limit, decode_flags,
*** 1552,1565 ****
--- 1561,1570 ----
if (VerifyMethodHandles) {
verify_BoundMethodHandle(mh, target, argnum, direct_to_method, CHECK);
}
// Next question: Is this a ref, int, or long bound value?
oop ptype_oop = java_dyn_MethodType::ptype(java_dyn_MethodHandle::type(target()), argnum);
BasicType ptype = java_lang_Class::as_BasicType(ptype_oop);
int slots_pushed = type2size[ptype];
MethodHandleEntry* me = NULL;
if (ptype == T_OBJECT) {
if (direct_to_method) me = MethodHandles::entry(_bound_ref_direct_mh);
else me = MethodHandles::entry(_bound_ref_mh);
} else if (slots_pushed == 2) {
src/share/vm/prims/methodHandles.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File