-
Notifications
You must be signed in to change notification settings - Fork 1k
Make internal classloader instrumentation indy compatible #12242
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
Changes from 6 commits
0fd0e09
d28efde
18b9029
87f7d42
116daaa
106904e
f351043
e8a5ef2
67b1d40
57d73cd
b46acad
e54d881
393e3ef
cd7c0f9
7fc8277
33b6130
2456716
dc26c83
0154cd3
5f3f166
b01f387
712c70d
85beb7a
3e03153
05bc99f
492c968
6662850
1173824
43a4ae0
03932e4
add664a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,9 +52,17 @@ public static DefineClassContext onEnter( | |
| classLoader, className, classBytes, offset, length); | ||
| } | ||
|
|
||
| // TODO: the ToReturened does nothing except for signaling the AdviceTransformer that it must | ||
JonasKunz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // not touch this advice | ||
| // this is done to ensure that ClassLoaderInstrumentationModule.loadAdviceClassesEagerly works | ||
| // correctly | ||
| // we can therfore remove it, as soon as the AdviceTransformer is not applied anymore | ||
|
||
| @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) | ||
| public static void onExit(@Advice.Enter DefineClassContext context) { | ||
| @Advice.AssignReturned.ToReturned | ||
| public static Class<?> onExit( | ||
| @Advice.Enter DefineClassContext context, @Advice.Return Class<?> returned) { | ||
| DefineClassHelper.afterDefineClass(context); | ||
| return returned; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -68,9 +76,17 @@ public static DefineClassContext onEnter( | |
| return DefineClassHelper.beforeDefineClass(classLoader, className, classBytes); | ||
| } | ||
|
|
||
| // TODO: the ToReturened does nothing except for signaling the AdviceTransformer that it must | ||
| // not touch this advice | ||
| // this is done to ensure that ClassLoaderInstrumentationModule.loadAdviceClassesEagerly works | ||
| // correctly | ||
| // we can therfore remove it, as soon as the AdviceTransformer is not applied anymore | ||
JonasKunz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) | ||
| public static void onExit(@Advice.Enter DefineClassContext context) { | ||
| @Advice.AssignReturned.ToReturned | ||
| public static Class<?> onExit( | ||
| @Advice.Enter DefineClassContext context, @Advice.Return Class<?> returned) { | ||
| DefineClassHelper.afterDefineClass(context); | ||
| return returned; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,9 @@ static byte[] transform(byte[] bytes) { | |
| })); | ||
|
|
||
| TransformationContext context = new TransformationContext(); | ||
| if (justDelegateAdvice) { | ||
| context.disableReturnTypeChange(); | ||
| } | ||
|
Comment on lines
+70
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [for reviewer] without this the advice return type is assumed to be an array, which means |
||
| ClassVisitor cv = | ||
| new ClassVisitor(AsmApi.VERSION, cw) { | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,6 +92,12 @@ public class IndyBootstrap { | |
|
|
||
| IndyBootstrapDispatcher.init( | ||
| MethodHandles.lookup().findStatic(IndyBootstrap.class, "bootstrap", bootstrapMethodType)); | ||
|
|
||
| // Ensure that CallDepth is already loaded in case of bootstrapAdvice recursions with | ||
| // ClassLoader.loadClass | ||
| // This is required because CallDepth is a bootstrap class and therefore triggers our | ||
| // ClassLoader.loadClass instrumentations | ||
| Class.forName(CallDepth.class.getName()); | ||
|
||
| } catch (Exception e) { | ||
| throw new IllegalStateException(e); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.