Skip to content

Commit

Permalink
nterp from android 11
Browse files Browse the repository at this point in the history
  • Loading branch information
matbrik committed Oct 30, 2024
1 parent ce9e0ee commit 9636722
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ function _getApi () {
if (temporaryApi['art::interpreter::GetNterpEntryPoint'] !== undefined) {
temporaryApi.artNterpEntryPoint = temporaryApi['art::interpreter::GetNterpEntryPoint']();
} else {
if (Process.arch === 'arm64') {
if (Process.arch === 'arm64' && getAndroidApiLevel() >= 30) {
temporaryApi.artNterpEntryPoint = findExecuteNterpImpl();
}
}
Expand Down Expand Up @@ -631,7 +631,7 @@ function tryGetEnvJvmti (vm, runtime) {
let ensurePluginLoaded;
if (Module.findExportByName('libart.so', '_ZN3art7Runtime18EnsurePluginLoadedEPKcPNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE') === null) {
// on some devices calling the ensurePluginLoaded make the app really slow so for is commented
if (env !== null & Process.arch === 'arm64') {
if (env !== null && Process.arch === 'arm64') {
const candidates = findEnsurePlugIn();
ensurePluginLoaded = new NativeFunction(candidates[0],
'bool',
Expand Down Expand Up @@ -1989,7 +1989,7 @@ function instrumentArtMethodInvocationFromInterpreter () {
docallFound = false;
Interceptor.attach(exp.address, artController.hooks.Interpreter.doCall);
}
if (docallFound & Process.arch === 'arm64') {
if (docallFound && Process.arch === 'arm64') {
const doCallsCandidates = findDoCalls();
for (const address of doCallsCandidates) {
Interceptor.attach(address, artController.hooks.Interpreter.doCall);
Expand Down Expand Up @@ -3536,7 +3536,7 @@ class ArtMethodMangler {

// Replace Nterp quick entrypoints with art_quick_to_interpreter_bridge to force stepping out
// of ART's next-generation interpreter and use the quick stub instead.
if (artNterpEntryPoint !== undefined && quickCode.equals(artNterpEntryPoint)) {
if (artNterpEntryPoint !== undefined && artNterpEntryPoint !== 0 && quickCode.equals(artNterpEntryPoint)) {
patchArtMethod(hookedMethodId, {
quickCode: api.artQuickToInterpreterBridge
}, vm);
Expand Down

0 comments on commit 9636722

Please sign in to comment.