Skip to content

Commit e9a2455

Browse files
committed
android: Prevent ART from compiling replaced methods
As that means our inline hook gets reverted. Kudos to @s1341 for figuring this one out.
1 parent 0e0aa78 commit e9a2455

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/android.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const kAccSkipAccessChecks = 0x00080000;
3030
const kAccSingleImplementation = 0x08000000;
3131
const kAccNterpEntryPointFastPathFlag = 0x00100000;
3232
const kAccNterpInvokeFastPathFlag = 0x00200000;
33+
const kAccCompileDontBother = 0x01000000;
3334
const kAccPublicApi = 0x10000000;
3435
const kAccXposedHookedMethod = 0x10000000;
3536

@@ -3330,7 +3331,7 @@ class ArtMethodMangler {
33303331

33313332
patchArtMethod(replacementMethodId, {
33323333
jniCode: impl,
3333-
accessFlags: ((originalFlags & ~(kAccCriticalNative | kAccFastNative | kAccNterpEntryPointFastPathFlag)) | kAccNative) >>> 0,
3334+
accessFlags: ((originalFlags & ~(kAccCriticalNative | kAccFastNative | kAccNterpEntryPointFastPathFlag)) | kAccNative | kAccCompileDontBother) >>> 0,
33343335
quickCode: api.artClassLinker.quickGenericJniTrampoline,
33353336
interpreterCode: api.artInterpreterToCompiledCodeBridge
33363337
}, vm);
@@ -3343,7 +3344,7 @@ class ArtMethodMangler {
33433344
}
33443345

33453346
patchArtMethod(hookedMethodId, {
3346-
accessFlags: (originalFlags & ~(hookedMethodRemovedFlags)) >>> 0
3347+
accessFlags: ((originalFlags & ~(hookedMethodRemovedFlags)) | kAccCompileDontBother) >>> 0
33473348
}, vm);
33483349

33493350
const quickCode = this.originalMethod.quickCode;

0 commit comments

Comments
 (0)