mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8260605: Various java.lang.invoke cleanups
Reviewed-by: mchung
This commit is contained in:
parent
9cd21b687e
commit
63eae8fac2
4 changed files with 118 additions and 246 deletions
|
@ -212,26 +212,6 @@ class LambdaForm {
|
|||
if (!type.isPrimitive()) return L_TYPE;
|
||||
return basicType(Wrapper.forPrimitiveType(type));
|
||||
}
|
||||
static BasicType[] basicTypes(String types) {
|
||||
BasicType[] btypes = new BasicType[types.length()];
|
||||
for (int i = 0; i < btypes.length; i++) {
|
||||
btypes[i] = basicType(types.charAt(i));
|
||||
}
|
||||
return btypes;
|
||||
}
|
||||
static String basicTypeDesc(BasicType[] types) {
|
||||
if (types == null) {
|
||||
return null;
|
||||
}
|
||||
if (types.length == 0) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (BasicType bt : types) {
|
||||
sb.append(bt.basicTypeChar());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
static int[] basicTypeOrds(BasicType[] types) {
|
||||
if (types == null) {
|
||||
return null;
|
||||
|
@ -388,18 +368,9 @@ class LambdaForm {
|
|||
LambdaForm(int arity, Name[] names, Kind kind) {
|
||||
this(arity, names, LAST_RESULT, /*forceInline=*/true, /*customized=*/null, kind);
|
||||
}
|
||||
LambdaForm(int arity, Name[] names, boolean forceInline) {
|
||||
this(arity, names, LAST_RESULT, forceInline, /*customized=*/null, Kind.GENERIC);
|
||||
}
|
||||
LambdaForm(int arity, Name[] names, boolean forceInline, Kind kind) {
|
||||
this(arity, names, LAST_RESULT, forceInline, /*customized=*/null, kind);
|
||||
}
|
||||
LambdaForm(Name[] formals, Name[] temps, Name result) {
|
||||
this(formals.length, buildNames(formals, temps, result), LAST_RESULT, /*forceInline=*/true, /*customized=*/null);
|
||||
}
|
||||
LambdaForm(Name[] formals, Name[] temps, Name result, boolean forceInline) {
|
||||
this(formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline, /*customized=*/null);
|
||||
}
|
||||
|
||||
private static Name[] buildNames(Name[] formals, Name[] temps, Name result) {
|
||||
int arity = formals.length;
|
||||
|
@ -629,9 +600,8 @@ class LambdaForm {
|
|||
|
||||
/** Report the N-th argument name. */
|
||||
Name parameter(int n) {
|
||||
assert(n < arity);
|
||||
Name param = names[n];
|
||||
assert(param.isParam());
|
||||
assert(n < arity && param.isParam());
|
||||
return param;
|
||||
}
|
||||
|
||||
|
@ -670,9 +640,6 @@ class LambdaForm {
|
|||
assert(isValidSignature(sig));
|
||||
return sig.indexOf('_');
|
||||
}
|
||||
static BasicType signatureReturn(String sig) {
|
||||
return basicType(sig.charAt(signatureArity(sig) + 1));
|
||||
}
|
||||
static boolean isValidSignature(String sig) {
|
||||
int arity = sig.indexOf('_');
|
||||
if (arity < 0) return false; // must be of the form *_*
|
||||
|
@ -687,16 +654,6 @@ class LambdaForm {
|
|||
}
|
||||
return true; // [LIJFD]*_[LIJFDV]
|
||||
}
|
||||
static MethodType signatureType(String sig) {
|
||||
Class<?>[] ptypes = new Class<?>[signatureArity(sig)];
|
||||
for (int i = 0; i < ptypes.length; i++)
|
||||
ptypes[i] = basicType(sig.charAt(i)).btClass;
|
||||
Class<?> rtype = signatureReturn(sig).btClass;
|
||||
return MethodType.makeImpl(rtype, ptypes, true);
|
||||
}
|
||||
static MethodType basicMethodType(MethodType mt) {
|
||||
return signatureType(basicTypeSignature(mt));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if i-th name is a call to MethodHandleImpl.selectAlternative.
|
||||
|
@ -1327,7 +1284,7 @@ class LambdaForm {
|
|||
if (c1 != NO_CHAR && !('A' <= c1 && c1 <= 'Z')) {
|
||||
// wrong kind of char; bail out here
|
||||
if (buf != null) {
|
||||
buf.append(signature.substring(i - c1reps, len));
|
||||
buf.append(signature, i - c1reps, len);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1410,11 +1367,6 @@ class LambdaForm {
|
|||
return type.btChar;
|
||||
}
|
||||
|
||||
void resolve() {
|
||||
if (function != null)
|
||||
function.resolve();
|
||||
}
|
||||
|
||||
Name newIndex(int i) {
|
||||
if (initIndex(i)) return this;
|
||||
return cloneWithIndex(i);
|
||||
|
@ -1609,10 +1561,6 @@ class LambdaForm {
|
|||
return count;
|
||||
}
|
||||
|
||||
boolean contains(Name n) {
|
||||
return this == n || lastUseIndex(n) >= 0;
|
||||
}
|
||||
|
||||
public boolean equals(Name that) {
|
||||
if (this == that) return true;
|
||||
if (isParam())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue