96 static LambdaForm makeReinvokerForm(MethodHandle target, |
96 static LambdaForm makeReinvokerForm(MethodHandle target, |
97 int whichCache, |
97 int whichCache, |
98 Object constraint, |
98 Object constraint, |
99 NamedFunction getTargetFn) { |
99 NamedFunction getTargetFn) { |
100 // No pre-action needed. |
100 // No pre-action needed. |
101 return makeReinvokerForm(target, whichCache, constraint, null, true, getTargetFn, null); |
101 return makeReinvokerForm(target, whichCache, constraint, true, getTargetFn, null); |
102 } |
102 } |
103 /** Create a LF which simply reinvokes a target of the given basic type. */ |
103 /** Create a LF which simply reinvokes a target of the given basic type. */ |
104 static LambdaForm makeReinvokerForm(MethodHandle target, |
104 static LambdaForm makeReinvokerForm(MethodHandle target, |
105 int whichCache, |
105 int whichCache, |
106 Object constraint, |
106 Object constraint, |
107 String debugString, |
|
108 boolean forceInline, |
107 boolean forceInline, |
109 NamedFunction getTargetFn, |
108 NamedFunction getTargetFn, |
110 NamedFunction preActionFn) { |
109 NamedFunction preActionFn) { |
111 MethodType mtype = target.type().basicType(); |
110 MethodType mtype = target.type().basicType(); |
112 Kind kind = whichKind(whichCache); |
111 Kind kind = whichKind(whichCache); |
113 if (debugString == null) { |
|
114 debugString = kind.defaultLambdaName; |
|
115 } |
|
116 boolean customized = (whichCache < 0 || |
112 boolean customized = (whichCache < 0 || |
117 mtype.parameterSlotCount() > MethodType.MAX_MH_INVOKER_ARITY); |
113 mtype.parameterSlotCount() > MethodType.MAX_MH_INVOKER_ARITY); |
118 boolean hasPreAction = (preActionFn != null); |
114 boolean hasPreAction = (preActionFn != null); |
119 LambdaForm form; |
115 LambdaForm form; |
120 if (!customized) { |
116 if (!customized) { |
142 names[NEXT_MH] = new LambdaForm.Name(getTargetFn, names[THIS_DMH]); |
138 names[NEXT_MH] = new LambdaForm.Name(getTargetFn, names[THIS_DMH]); |
143 targetArgs = Arrays.copyOfRange(names, THIS_DMH, ARG_LIMIT, Object[].class); |
139 targetArgs = Arrays.copyOfRange(names, THIS_DMH, ARG_LIMIT, Object[].class); |
144 targetArgs[0] = names[NEXT_MH]; // overwrite this MH with next MH |
140 targetArgs[0] = names[NEXT_MH]; // overwrite this MH with next MH |
145 names[REINVOKE] = new LambdaForm.Name(mtype, targetArgs); |
141 names[REINVOKE] = new LambdaForm.Name(mtype, targetArgs); |
146 } |
142 } |
147 form = new LambdaForm(debugString, ARG_LIMIT, names, forceInline, kind); |
143 form = new LambdaForm(ARG_LIMIT, names, forceInline, kind); |
148 if (!customized) { |
144 if (!customized) { |
149 form = mtype.form().setCachedLambdaForm(whichCache, form); |
145 form = mtype.form().setCachedLambdaForm(whichCache, form); |
150 } |
146 } |
151 return form; |
147 return form; |
152 } |
148 } |