Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matbrik committed Jul 11, 2024
1 parent 1979b1e commit f59496b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function _getApi () {
getInstances(instance, scope, hClass, useIsAssignableFrom, maxCount, instances);
};
},

_ZN3art12StackVisitorC2EPNS_6ThreadEPNS_7ContextENS0_13StackWalkKindEjb: ['art::StackVisitor::StackVisitor', 'void', ['pointer', 'pointer', 'pointer', 'uint', 'uint', 'bool']],
_ZN3art12StackVisitorC2EPNS_6ThreadEPNS_7ContextENS0_13StackWalkKindEmb: ['art::StackVisitor::StackVisitor', 'void', ['pointer', 'pointer', 'pointer', 'uint', 'size_t', 'bool']],
_ZN3art12StackVisitor9WalkStackILNS0_16CountTransitionsE0EEEvb: ['art::StackVisitor::WalkStack', 'void', ['pointer', 'bool']],
Expand Down Expand Up @@ -1672,7 +1672,7 @@ find_replacement_method_from_quick_code (gpointer method,
gpointer top_quick_frame;
gpointer link_managed_stack;
gpointer * link_top_quick_frame;
replacement_method = get_replacement_method (method);
if (replacement_method == NULL)
return NULL;
Expand Down Expand Up @@ -1886,18 +1886,17 @@ function ensureArtKnowsHowToHandleReplacementMethods (vm) {

let exportName = null;

const api = getApi();
const kCollectorTypeCMC = 3;
let mayUseCollector = new NativeFunction(Module.findExportByName('libart.so', "_ZNK3art2gc4Heap15MayUseCollectorENS0_13CollectorTypeE"), "int", ["pointer", "int"])
if (mayUseCollector(api.artHeap, kCollectorTypeCMC)){
exportName = '_ZN3art2gc9collector11MarkCompact15CompactionPhaseEv';
} else if (apiLevel > 28) {
if (apiLevel > 28) {
exportName = '_ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv';
} else if (apiLevel > 22) {
exportName = '_ZN3art2gc9collector17ConcurrentCopying12MarkingPhaseEv';
}

if (exportName !== null) {
let collectorCMC = Module.getExportByName('libart.so', '_ZN3art2gc9collector11MarkCompact15CompactionPhaseEv');
if(collectorCMC !== null){
Interceptor.attach(collectorCMC, artController.hooks.Gc.copyingPhase);
}
Interceptor.attach(Module.getExportByName('libart.so', exportName), artController.hooks.Gc.copyingPhase);
}
}
Expand Down Expand Up @@ -3619,7 +3618,7 @@ function computeDalvikJniArgInfo (methodId) {

function cloneArtMethod (method, vm) {
const api = getApi();

if (getAndroidApiLevel() < 23) {
const thread = api['art::Thread::CurrentFromGdb']();
return api['art::mirror::Object::Clone'](method, thread);
Expand Down

0 comments on commit f59496b

Please sign in to comment.