src/java.base/share/classes/java/lang/invoke/LambdaForm.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
jdk Cdiff src/java.base/share/classes/java/lang/invoke/LambdaForm.java
src/java.base/share/classes/java/lang/invoke/LambdaForm.java
Print this page
rev 11011 : 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
Reviewed-by: ?
*** 118,127 ****
--- 118,128 ----
*/
class LambdaForm {
final int arity;
final int result;
final boolean forceInline;
+ final boolean isGWT;
@Stable final Name[] names;
final String debugName;
MemberName vmentry; // low-level behavior, or null if not yet prepared
private boolean isCompiled;
*** 242,285 ****
}
}
LambdaForm(String debugName,
int arity, Name[] names, int result) {
! this(debugName, arity, names, result, true);
}
LambdaForm(String debugName,
! int arity, Name[] names, int result, boolean forceInline) {
assert(namesOK(arity, names));
this.arity = arity;
this.result = fixResult(result, names);
this.names = names.clone();
this.debugName = fixDebugName(debugName);
this.forceInline = forceInline;
int maxOutArity = normalize();
if (maxOutArity > MethodType.MAX_MH_INVOKER_ARITY) {
// Cannot use LF interpreter on very high arity expressions.
assert(maxOutArity <= MethodType.MAX_JVM_ARITY);
compileToBytecode();
}
}
LambdaForm(String debugName,
int arity, Name[] names) {
! this(debugName, arity, names, LAST_RESULT, true);
}
LambdaForm(String debugName,
! int arity, Name[] names, boolean forceInline) {
! this(debugName, arity, names, LAST_RESULT, forceInline);
}
LambdaForm(String debugName,
Name[] formals, Name[] temps, Name result) {
this(debugName,
! formals.length, buildNames(formals, temps, result), LAST_RESULT, true);
}
LambdaForm(String debugName,
Name[] formals, Name[] temps, Name result, boolean forceInline) {
this(debugName,
! formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline);
}
private static Name[] buildNames(Name[] formals, Name[] temps, Name result) {
int arity = formals.length;
int length = arity + temps.length + (result == null ? 0 : 1);
--- 243,291 ----
}
}
LambdaForm(String debugName,
int arity, Name[] names, int result) {
! this(debugName, arity, names, result, /*forceInline=*/true, /*isGWT=*/false);
}
LambdaForm(String debugName,
! int arity, Name[] names, int result, boolean forceInline, boolean isGWT) {
assert(namesOK(arity, names));
this.arity = arity;
this.result = fixResult(result, names);
this.names = names.clone();
this.debugName = fixDebugName(debugName);
this.forceInline = forceInline;
+ this.isGWT = isGWT;
int maxOutArity = normalize();
if (maxOutArity > MethodType.MAX_MH_INVOKER_ARITY) {
// Cannot use LF interpreter on very high arity expressions.
assert(maxOutArity <= MethodType.MAX_JVM_ARITY);
compileToBytecode();
}
}
LambdaForm(String debugName,
int arity, Name[] names) {
! this(debugName, arity, names, LAST_RESULT, /*forceInline=*/true, /*isGWT=*/false);
}
LambdaForm(String debugName,
! int arity, Name[] names, boolean forceInline, boolean isGWT) {
! this(debugName, arity, names, LAST_RESULT, forceInline, isGWT);
}
LambdaForm(String debugName,
Name[] formals, Name[] temps, Name result) {
this(debugName,
! formals.length, buildNames(formals, temps, result), LAST_RESULT, /*forceInline=*/true, /*isGWT=*/false);
}
LambdaForm(String debugName,
Name[] formals, Name[] temps, Name result, boolean forceInline) {
this(debugName,
! formals.length, buildNames(formals, temps, result), LAST_RESULT, forceInline, /*isGWT=*/false);
! }
!
! static LambdaForm makeGuardWithTestForm(int paramCount, Name[] names) {
! return new LambdaForm("guard", paramCount, names, /*forceInline=*/true, /*isGWT=*/true);
}
private static Name[] buildNames(Name[] formals, Name[] temps, Name result) {
int arity = formals.length;
int length = arity + temps.length + (result == null ? 0 : 1);
*** 289,311 ****
names[length - 1] = result;
return names;
}
private LambdaForm(String sig) {
- this(sig, true);
- }
-
- private LambdaForm(String sig, boolean forceInline) {
// Make a blank lambda form, which returns a constant zero or null.
// It is used as a template for managing the invocation of similar forms that are non-empty.
// Called only from getPreparedForm.
assert(isValidSignature(sig));
this.arity = signatureArity(sig);
this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity);
this.names = buildEmptyNames(arity, sig);
this.debugName = "LF.zero";
! this.forceInline = forceInline;
assert(nameRefsAreLegal());
assert(isEmpty());
assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature();
}
--- 295,314 ----
names[length - 1] = result;
return names;
}
private LambdaForm(String sig) {
// Make a blank lambda form, which returns a constant zero or null.
// It is used as a template for managing the invocation of similar forms that are non-empty.
// Called only from getPreparedForm.
assert(isValidSignature(sig));
this.arity = signatureArity(sig);
this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity);
this.names = buildEmptyNames(arity, sig);
this.debugName = "LF.zero";
! this.forceInline = true;
! this.isGWT = false;
assert(nameRefsAreLegal());
assert(isEmpty());
assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature();
}
*** 1793,1802 ****
--- 1796,1814 ----
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@interface Hidden {
}
+ /**
+ * Internal marker which signals JIT that gathered profile is useless.
+ */
+ /*non-public*/
+ @Target(ElementType.METHOD)
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface IgnoreProfile {
+ }
+
private static final HashMap<String,Integer> DEBUG_NAME_COUNTERS;
static {
if (debugEnabled())
DEBUG_NAME_COUNTERS = new HashMap<>();
else
src/java.base/share/classes/java/lang/invoke/LambdaForm.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File