Skip to content

Commit cdc3d36

Browse files
committed
android: Actually fix the kAccCompileDontBother constant
Turns out its value changed in Android 8.1. Also, the constant didn't exist before 7.0.
1 parent 632ca77 commit cdc3d36

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lib/android.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const kAccSkipAccessChecks = 0x00080000;
3030
const kAccSingleImplementation = 0x08000000;
3131
const kAccNterpEntryPointFastPathFlag = 0x00100000;
3232
const kAccNterpInvokeFastPathFlag = 0x00200000;
33-
const kAccCompileDontBother = 0x02000000;
3433
const kAccPublicApi = 0x10000000;
3534
const kAccXposedHookedMethod = 0x10000000;
3635

@@ -435,6 +434,18 @@ function _getApi () {
435434
temporaryApi.vm = vms.readPointer();
436435

437436
if (isArt) {
437+
const apiLevel = getAndroidApiLevel();
438+
439+
let kAccCompileDontBother;
440+
if (apiLevel >= 27) {
441+
kAccCompileDontBother = 0x02000000;
442+
} else if (apiLevel >= 24) {
443+
kAccCompileDontBother = 0x01000000;
444+
} else {
445+
kAccCompileDontBother = 0;
446+
}
447+
temporaryApi.kAccCompileDontBother = kAccCompileDontBother;
448+
438449
const artRuntime = temporaryApi.vm.add(pointerSize).readPointer();
439450
temporaryApi.artRuntime = artRuntime;
440451
const runtimeOffset = getArtRuntimeSpec(temporaryApi).offset;
@@ -3314,6 +3325,8 @@ class ArtMethodMangler {
33143325
}
33153326

33163327
replace (impl, isInstanceMethod, argTypes, vm, api) {
3328+
const { kAccCompileDontBother, artNterpEntryPoint } = api;
3329+
33173330
this.originalMethod = fetchArtMethod(this.methodId, vm);
33183331

33193332
const originalFlags = this.originalMethod.accessFlags;
@@ -3351,8 +3364,6 @@ class ArtMethodMangler {
33513364

33523365
// Replace Nterp quick entrypoints with art_quick_to_interpreter_bridge to force stepping out
33533366
// of ART's next-generation interpreter and use the quick stub instead.
3354-
const { artNterpEntryPoint } = api;
3355-
33563367
if (artNterpEntryPoint !== undefined && quickCode.equals(artNterpEntryPoint)) {
33573368
patchArtMethod(hookedMethodId, {
33583369
quickCode: api.artQuickToInterpreterBridge

0 commit comments

Comments
 (0)