mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8261030: Avoid loading GenerateJLIClassesHelper at runtime
Reviewed-by: mchung
This commit is contained in:
parent
992b50087d
commit
83357b1196
4 changed files with 42 additions and 37 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -25,7 +25,6 @@
|
|||
|
||||
package java.lang.invoke;
|
||||
|
||||
import jdk.internal.misc.CDS;
|
||||
import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.Opcodes;
|
||||
import sun.invoke.util.Wrapper;
|
||||
|
@ -39,10 +38,7 @@ import java.util.TreeMap;
|
|||
import java.util.TreeSet;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.lang.invoke.LambdaForm.basicTypeSignature;
|
||||
import static java.lang.invoke.LambdaForm.shortenSignature;
|
||||
import static java.lang.invoke.LambdaForm.BasicType.*;
|
||||
import static java.lang.invoke.MethodHandleStatics.TRACE_RESOLVE;
|
||||
import static java.lang.invoke.MethodTypeForm.*;
|
||||
import static java.lang.invoke.LambdaForm.Kind.*;
|
||||
|
||||
|
@ -51,29 +47,6 @@ import static java.lang.invoke.LambdaForm.Kind.*;
|
|||
* generate classes ahead of time.
|
||||
*/
|
||||
class GenerateJLIClassesHelper {
|
||||
private static final String LF_RESOLVE = "[LF_RESOLVE]";
|
||||
private static final String SPECIES_RESOLVE = "[SPECIES_RESOLVE]";
|
||||
|
||||
static void traceLambdaForm(String name, MethodType type, Class<?> holder, MemberName resolvedMember) {
|
||||
if (TRACE_RESOLVE) {
|
||||
System.out.println(LF_RESOLVE + " " + holder.getName() + " " + name + " " +
|
||||
shortenSignature(basicTypeSignature(type)) +
|
||||
(resolvedMember != null ? " (success)" : " (fail)"));
|
||||
}
|
||||
if (CDS.isDumpingClassList()) {
|
||||
CDS.traceLambdaFormInvoker(LF_RESOLVE, holder.getName(), name, shortenSignature(basicTypeSignature(type)));
|
||||
}
|
||||
}
|
||||
|
||||
static void traceSpeciesType(String cn, Class<?> salvage) {
|
||||
if (TRACE_RESOLVE) {
|
||||
System.out.println(SPECIES_RESOLVE + " " + cn + (salvage != null ? " (salvaged)" : " (generated)"));
|
||||
}
|
||||
if (CDS.isDumpingClassList()) {
|
||||
CDS.traceSpeciesType(SPECIES_RESOLVE, cn);
|
||||
}
|
||||
}
|
||||
|
||||
// Map from DirectMethodHandle method type name to index to LambdForms
|
||||
static final Map<String, Integer> DMH_METHOD_TYPE_MAP =
|
||||
Map.of(
|
||||
|
@ -323,7 +296,7 @@ class GenerateJLIClassesHelper {
|
|||
traces.map(line -> line.split(" "))
|
||||
.forEach(parts -> {
|
||||
switch (parts[0]) {
|
||||
case SPECIES_RESOLVE:
|
||||
case "[SPECIES_RESOLVE]":
|
||||
// Allow for new types of species data classes being resolved here
|
||||
assert parts.length >= 2;
|
||||
if (parts[1].startsWith(BMH_SPECIES_PREFIX)) {
|
||||
|
@ -333,7 +306,7 @@ class GenerateJLIClassesHelper {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case LF_RESOLVE:
|
||||
case "[LF_RESOLVE]":
|
||||
assert parts.length > 3;
|
||||
String methodType = parts[3];
|
||||
if (parts[1].equals(INVOKERS_HOLDER_CLASS_NAME)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue