Skip to content

Commit d1ae658

Browse files
committed
fix exit hook reg
1 parent 7bffe06 commit d1ae658

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

jtik/src/main/cpp/dexter/instrumentation.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,14 +504,13 @@ bool ExitHook::Apply(lir::CodeIr* code_ir) {
504504
}
505505

506506
dex::u2 regIndexMethodId;
507-
auto nonePareRegCount = regThisObjIndex;
508-
bool isVRegEnough = nonePareRegCount - reg_count >= 2; //can use v1 and v2 to store jmethod id?
507+
bool isVRegEnough = regThisObjIndex >= (reg + reg_count -1 ) + 3;
509508
if (isVRegEnough) {
510509
regIndexMethodId = reg+reg_count;
511510
} else {
512511
// try reuse param
513512
int paramBegin = std::max(regThisObjIndex + (isStatic ? 0 : 1), int(reg + reg_count));
514-
if (paramBegin > ir_method->code->registers-2) {// pram not enough,then scratch
513+
if (paramBegin > (int)(ir_method->code->registers)-2) {// pram not enough,then scratch
515514
auto scratch = paramBegin + 1 - (ir_method->code->registers-1);
516515
slicer::AllocateScratchRegs alloc_regs(scratch, false);
517516
alloc_regs.Apply(code_ir);

jtik/src/main/cpp/jtik.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ static bool SetDebuggableRelease(bool allowDebug) {
5252
SetJdwpAllowedFn(allowDebug);
5353
}
5454

55-
auto (*setJavaDebuggableFn)(void *, bool) = reinterpret_cast<void (*)(void *, bool)>(
56-
::dlsym(dlHandler.GetHandle(), "_ZN3art7Runtime17SetJavaDebuggableEb"));
57-
CHECK_NULL_RETURN_BOOL(setJavaDebuggableFn,"setJavaDebuggableFn get fail");
58-
void **runtimeInstance_ = static_cast<void **>(
59-
::dlsym(dlHandler.GetHandle(), "_ZN3art7Runtime9instance_E"));
60-
CHECK_NULL_RETURN_BOOL(runtimeInstance_,"runtime instance get fail");
61-
setJavaDebuggableFn(*runtimeInstance_, allowDebug);
55+
// auto (*setJavaDebuggableFn)(void *, bool) = reinterpret_cast<void (*)(void *, bool)>(
56+
// ::dlsym(dlHandler.GetHandle(), "_ZN3art7Runtime17SetJavaDebuggableEb"));
57+
// CHECK_NULL_RETURN_BOOL(setJavaDebuggableFn,"setJavaDebuggableFn get fail");
58+
// void **runtimeInstance_ = static_cast<void **>(
59+
// ::dlsym(dlHandler.GetHandle(), "_ZN3art7Runtime9instance_E"));
60+
// CHECK_NULL_RETURN_BOOL(runtimeInstance_,"runtime instance get fail");
61+
// setJavaDebuggableFn(*runtimeInstance_, allowDebug);
6262
return true;
6363
}
6464

0 commit comments

Comments
 (0)