src/share/vm/prims/methodHandles.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7047961 Cdiff src/share/vm/prims/methodHandles.cpp

src/share/vm/prims/methodHandles.cpp

Print this page

        

*** 1303,1312 **** --- 1303,1313 ---- void MethodHandles::verify_vmargslot(Handle mh, int argnum, int argslot, TRAPS) { // Verify that argslot points at the given argnum. int check_slot = argument_slot(java_lang_invoke_MethodHandle::type(mh()), argnum); if (argslot != check_slot || argslot < 0) { + ResourceMark rm; const char* fmt = "for argnum of %d, vmargslot is %d, should be %d"; size_t msglen = strlen(fmt) + 3*11 + 1; char* msg = NEW_RESOURCE_ARRAY(char, msglen); jio_snprintf(msg, msglen, fmt, argnum, argslot, check_slot); THROW_MSG(vmSymbols::java_lang_InternalError(), msg);
*** 1978,1988 **** { if (!src || src != dest) { err = "adapter requires src/dest conversion subfields for swap"; break; } int swap_size = type2size[src]; - int slot_limit = java_lang_invoke_MethodHandle::vmslots(target()); int src_slot = argslot; int dest_slot = vminfo; bool rotate_up = (src_slot > dest_slot); // upward rotation int src_arg = argnum; int dest_arg = argument_slot_to_argnum(dst_mtype(), dest_slot); --- 1979,1988 ----
*** 2331,2341 **** case _adapter_swap_args: case _adapter_rot_args: { int swap_slots = type2size[src]; - int slot_limit = java_lang_invoke_AdapterMethodHandle::vmslots(mh()); int src_slot = argslot; int dest_slot = vminfo; int rotate = (ek_orig == _adapter_swap_args) ? 0 : (src_slot > dest_slot) ? 1 : -1; switch (swap_slots) { case 1: --- 2331,2340 ----
*** 2659,2676 **** JVM_ENTRY(void, MHN_init_DMH(JNIEnv *env, jobject igcls, jobject mh_jh, jobject target_jh, jboolean do_dispatch, jobject caller_jh)) { ResourceMark rm; // for error messages // This is the guy we are initializing: ! if (mh_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); } Handle mh(THREAD, JNIHandles::resolve_non_null(mh_jh)); // Early returns out of this method leave the DMH in an unfinished state. assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null"); // which method are we really talking about? ! if (target_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); } Handle target(THREAD, JNIHandles::resolve_non_null(target_jh)); if (java_lang_invoke_MemberName::is_instance(target()) && java_lang_invoke_MemberName::vmindex(target()) == VM_INDEX_UNINITIALIZED) { MethodHandles::resolve_MemberName(target, CHECK); } --- 2658,2675 ---- JVM_ENTRY(void, MHN_init_DMH(JNIEnv *env, jobject igcls, jobject mh_jh, jobject target_jh, jboolean do_dispatch, jobject caller_jh)) { ResourceMark rm; // for error messages // This is the guy we are initializing: ! if (mh_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "self is null"); } Handle mh(THREAD, JNIHandles::resolve_non_null(mh_jh)); // Early returns out of this method leave the DMH in an unfinished state. assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null"); // which method are we really talking about? ! if (target_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "target is null"); } Handle target(THREAD, JNIHandles::resolve_non_null(target_jh)); if (java_lang_invoke_MemberName::is_instance(target()) && java_lang_invoke_MemberName::vmindex(target()) == VM_INDEX_UNINITIALIZED) { MethodHandles::resolve_MemberName(target, CHECK); }
*** 2720,2736 **** JVM_ENTRY(void, MHN_init_BMH(JNIEnv *env, jobject igcls, jobject mh_jh, jobject target_jh, int argnum)) { ResourceMark rm; // for error messages // This is the guy we are initializing: ! if (mh_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); } Handle mh(THREAD, JNIHandles::resolve_non_null(mh_jh)); // Early returns out of this method leave the BMH in an unfinished state. assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null"); ! if (target_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); } Handle target(THREAD, JNIHandles::resolve_non_null(target_jh)); if (!java_lang_invoke_MethodHandle::is_instance(target())) { // Target object is a reflective method. (%%% Do we need this alternate path?) Untested("init_BMH of non-MH"); --- 2719,2735 ---- JVM_ENTRY(void, MHN_init_BMH(JNIEnv *env, jobject igcls, jobject mh_jh, jobject target_jh, int argnum)) { ResourceMark rm; // for error messages // This is the guy we are initializing: ! if (mh_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "self is null"); } Handle mh(THREAD, JNIHandles::resolve_non_null(mh_jh)); // Early returns out of this method leave the BMH in an unfinished state. assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null"); ! if (target_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "target is null"); } Handle target(THREAD, JNIHandles::resolve_non_null(target_jh)); if (!java_lang_invoke_MethodHandle::is_instance(target())) { // Target object is a reflective method. (%%% Do we need this alternate path?) Untested("init_BMH of non-MH");
*** 2751,2763 **** // adapter method handles JVM_ENTRY(void, MHN_init_AMH(JNIEnv *env, jobject igcls, jobject mh_jh, jobject target_jh, int argnum)) { // This is the guy we are initializing: ! if (mh_jh == NULL || target_jh == NULL) { ! THROW(vmSymbols::java_lang_InternalError()); ! } Handle mh(THREAD, JNIHandles::resolve_non_null(mh_jh)); Handle target(THREAD, JNIHandles::resolve_non_null(target_jh)); // Early returns out of this method leave the AMH in an unfinished state. assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null"); --- 2750,2761 ---- // adapter method handles JVM_ENTRY(void, MHN_init_AMH(JNIEnv *env, jobject igcls, jobject mh_jh, jobject target_jh, int argnum)) { // This is the guy we are initializing: ! if (mh_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "self is null"); } ! if (target_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "target is null"); } Handle mh(THREAD, JNIHandles::resolve_non_null(mh_jh)); Handle target(THREAD, JNIHandles::resolve_non_null(target_jh)); // Early returns out of this method leave the AMH in an unfinished state. assert(java_lang_invoke_MethodHandle::vmentry(mh()) == NULL, "must be safely null");
*** 2888,2915 **** } JVM_END // void init(MemberName self, AccessibleObject ref) JVM_ENTRY(void, MHN_init_Mem(JNIEnv *env, jobject igcls, jobject mname_jh, jobject target_jh)) { ! if (mname_jh == NULL || target_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); } Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh)); oop target_oop = JNIHandles::resolve_non_null(target_jh); MethodHandles::init_MemberName(mname(), target_oop); } JVM_END // void expand(MemberName self) JVM_ENTRY(void, MHN_expand_Mem(JNIEnv *env, jobject igcls, jobject mname_jh)) { ! if (mname_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); } Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh)); MethodHandles::expand_MemberName(mname, 0, CHECK); } JVM_END // void resolve(MemberName self, Class<?> caller) JVM_ENTRY(void, MHN_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh, jclass caller_jh)) { ! if (mname_jh == NULL) { THROW(vmSymbols::java_lang_InternalError()); } Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh)); // The trusted Java code that calls this method should already have performed // access checks on behalf of the given caller. But, we can verify this. if (VerifyMethodHandles && caller_jh != NULL) { --- 2886,2914 ---- } JVM_END // void init(MemberName self, AccessibleObject ref) JVM_ENTRY(void, MHN_init_Mem(JNIEnv *env, jobject igcls, jobject mname_jh, jobject target_jh)) { ! if (mname_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "mname is null"); } ! if (target_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "target is null"); } Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh)); oop target_oop = JNIHandles::resolve_non_null(target_jh); MethodHandles::init_MemberName(mname(), target_oop); } JVM_END // void expand(MemberName self) JVM_ENTRY(void, MHN_expand_Mem(JNIEnv *env, jobject igcls, jobject mname_jh)) { ! if (mname_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "mname is null"); } Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh)); MethodHandles::expand_MemberName(mname, 0, CHECK); } JVM_END // void resolve(MemberName self, Class<?> caller) JVM_ENTRY(void, MHN_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh, jclass caller_jh)) { ! if (mname_jh == NULL) { THROW_MSG(vmSymbols::java_lang_InternalError(), "mname is null"); } Handle mname(THREAD, JNIHandles::resolve_non_null(mname_jh)); // The trusted Java code that calls this method should already have performed // access checks on behalf of the given caller. But, we can verify this. if (VerifyMethodHandles && caller_jh != NULL) {
src/share/vm/prims/methodHandles.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File