Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new loadClassFromTCCL method #22928

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public void run() {
FieldDescriptor fd = convertersByType.get(type);
if (fd == null) {
// it's an unknown
final ResultHandle clazzHandle = converterSetup.loadClass(additionalType);
final ResultHandle clazzHandle = converterSetup.loadClassFromTCCL(additionalType);
fd = FieldDescriptor.of(cc.getClassName(), "conv$" + converterIndex++, Converter.class);
ResultHandle converter = converterSetup.invokeVirtualMethod(SRC_GET_CONVERTER, clinitConfig, clazzHandle);
cc.getFieldCreator(fd).setModifiers(Opcodes.ACC_STATIC | Opcodes.ACC_FINAL);
Expand All @@ -664,10 +664,10 @@ public void run() {
final Class<?> type = entry.getValue();
if (bootstrapConfigSetupNeeded()) {
readBootstrapConfig.invokeVirtualMethod(SRCB_WITH_CONVERTER, bootstrapBuilder,
readBootstrapConfig.loadClass(type),
readBootstrapConfig.loadClassFromTCCL(type),
readBootstrapConfig.load(100), readBootstrapConfig.readStaticField(descriptor));
}
readConfig.invokeVirtualMethod(SRCB_WITH_CONVERTER, runTimeBuilder, readConfig.loadClass(type),
readConfig.invokeVirtualMethod(SRCB_WITH_CONVERTER, runTimeBuilder, readConfig.loadClassFromTCCL(type),
readConfig.load(100), readConfig.readStaticField(descriptor));
}
}
Expand Down Expand Up @@ -1596,12 +1596,12 @@ private FieldDescriptor getOrCreateConverterInstance(Field field, ConverterType
// TODO: temporary until type param inference is in
if (convertWith == HyphenateEnumConverter.class.asSubclass(Converter.class)) {
converter = converterSetup.newInstance(MethodDescriptor.ofConstructor(convertWith, Class.class),
converterSetup.loadClass(type.getLeafType()));
converterSetup.loadClassFromTCCL(type.getLeafType()));
} else {
converter = converterSetup.newInstance(MethodDescriptor.ofConstructor(convertWith));
}
} else {
final ResultHandle clazzHandle = converterSetup.loadClass(leaf.getLeafType());
final ResultHandle clazzHandle = converterSetup.loadClassFromTCCL(leaf.getLeafType());
converter = converterSetup.invokeVirtualMethod(SRC_GET_CONVERTER, clinitConfig, clazzHandle);
storeConverter = true;
}
Expand All @@ -1610,7 +1610,7 @@ private FieldDescriptor getOrCreateConverterInstance(Field field, ConverterType
final ResultHandle nestedConv = instanceCache
.get(getOrCreateConverterInstance(field, arrayOf.getElementType()));
converter = converterSetup.invokeStaticMethod(CONVS_NEW_ARRAY_CONVERTER, nestedConv,
converterSetup.loadClass(arrayOf.getArrayType()));
converterSetup.loadClassFromTCCL(arrayOf.getArrayType()));
} else if (type instanceof CollectionOf) {
final CollectionOf collectionOf = (CollectionOf) type;
final ResultHandle nestedConv = instanceCache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ public boolean doScan(boolean userInitiated, boolean forceRestart) {
for (Path i : changedClassResults.changedClasses) {
byte[] bytes = Files.readAllBytes(i);
String name = indexer.index(new ByteArrayInputStream(bytes)).name().toString();
defs[index++] = new ClassDefinition(Thread.currentThread().getContextClassLoader().loadClass(name),
defs[index++] = new ClassDefinition(
Thread.currentThread().getContextClassLoader().loadClass(name),
classTransformers.apply(name, bytes));
}
Index current = indexer.complete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,14 @@ private void doDefineClass() {
if (methodInfo.getParameterCount() > 0) {
Parameter[] methodInfoParameters = methodInfo.getParameters();
for (int i = 0; i < methodInfo.getParameterCount(); i++) {
ResultHandle paramClass = mc.loadClass(methodInfoParameters[i].getType());
ResultHandle paramClass = mc.loadClassFromTCCL(methodInfoParameters[i].getType());
mc.writeArrayValue(getDeclaredMethodParamsArray, i, paramClass);
}
}
ResultHandle method = mc.invokeVirtualMethod(
MethodDescriptor.ofMethod(Class.class, "getDeclaredMethod", Method.class, String.class,
Class[].class),
mc.loadClass(methodInfo.getDeclaringClass()), mc.load(methodInfo.getName()),
mc.loadClassFromTCCL(methodInfo.getDeclaringClass()), mc.load(methodInfo.getName()),
getDeclaredMethodParamsArray);

// result = invocationHandler.invoke(...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ ResultHandle doLoad(MethodContext context, MethodCreator method, ResultHandle ar
return new DeferredParameter() {
@Override
ResultHandle doLoad(MethodContext context, MethodCreator method, ResultHandle array) {
return method.loadClass((Class) param);
return method.loadClassFromTCCL((Class) param);
}
};
}
Expand Down Expand Up @@ -1766,7 +1766,7 @@ ResultHandle doLoad(MethodContext context, MethodCreator valueMethod, ResultHand
retValue = valueMethod.load(value.asChar());
break;
case CLASS:
retValue = valueMethod.loadClass(value.asClass().toString());
retValue = valueMethod.loadClassFromTCCL(value.asClass().toString());
break;
case ARRAY:
retValue = arrayValue(value, valueMethod, method, annotationClass);
Expand All @@ -1793,7 +1793,7 @@ static ResultHandle arrayValue(AnnotationValue value, BytecodeCreator valueMetho
Type[] classArray = value.asClassArray();
retValue = valueMethod.newArray(componentType(method), valueMethod.load(classArray.length));
for (int i = 0; i < classArray.length; i++) {
valueMethod.writeArrayValue(retValue, i, valueMethod.loadClass(classArray[i].name().toString()));
valueMethod.writeArrayValue(retValue, i, valueMethod.loadClassFromTCCL(classArray[i].name().toString()));
}
break;
case STRING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ private void generateMainForQuarkusApplication(String quarkusApplicationClassNam
MethodCreator mv = file.getMethodCreator("main", void.class, String[].class);
mv.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
mv.invokeStaticMethod(MethodDescriptor.ofMethod(Quarkus.class, "run", void.class, Class.class, String[].class),
mv.loadClass(quarkusApplicationClassName),
mv.loadClassFromTCCL(quarkusApplicationClassName),
mv.getMethodParam(0));
mv.returnValue(null);
file.close();
Expand Down
Loading