Commit 9ab57b60 authored by swift_gan's avatar swift_gan

[DeOpt]pre add

parent c17f756a
//
// Created by SwiftGan on 2019/2/28.
//
#include "../includes/art_instrumentation.h"
using namespace art;
using namespace instrumentation;
bool Instrumentation::deOptimizeMethod(mirror::ArtMethod *method) {
}
\ No newline at end of file
//
// Created by SwiftGan on 2019/2/28.
//
#include "../includes/art_runtime.h"
using namespace art;
instrumentation::Instrumentation* Runtime::getInstrumentation() {
}
//
// Created by SwiftGan on 2019/2/28.
//
#ifndef SANDHOOK_ART_INSTRUMENTATION_H
#define SANDHOOK_ART_INSTRUMENTATION_H
#include "art_method.h"
namespace art {
namespace instrumentation {
class Instrumentation {
public:
bool deOptimizeMethod(mirror::ArtMethod* method);
};
}
}
#endif //SANDHOOK_ART_INSTRUMENTATION_H
......@@ -6,12 +6,12 @@
#define SANDHOOK_ART_RUNTIME_H
#include "art_jit.h"
#include "art_instrumentation.h"
namespace art {
class Runtime {
public:
jit::Jit* getJit();
instrumentation::Instrumentation* getInstrumentation();
};
}
......
//
// Created by SwiftGan on 2019/2/28.
//
#ifndef SANDHOOK_CAST_RUNTIME_H
#define SANDHOOK_CAST_RUNTIME_H
#include "art_runtime.h"
#include "art_instrumentation.h"
#include "cast.h"
namespace SandHook {
class CastRuntime {
static void init(JNIEnv *jniEnv);
static IMember<art::Runtime, art::instrumentation::Instrumentation*>* instrumentation;
};
}
#endif //SANDHOOK_CAST_RUNTIME_H
......@@ -11,6 +11,7 @@
#include <memory>
#include "../includes/art_compiler_options.h"
#include "../includes/art_jit.h"
#include "../includes/art_runtime.h"
extern "C" {
......@@ -31,6 +32,8 @@ extern "C" {
bool disableJitInline(art::CompilerOptions* compilerOptions);
art::Runtime* getRuntime();
}
#endif //SANDHOOK_HIDE_API_H
......@@ -19,6 +19,7 @@ extern "C" {
jobject (*addWeakGlobalRef)(JavaVM *, void *, void *) = nullptr;
art::jit::JitCompiler** globalJitCompileHandlerAddr = nullptr;
art::Runtime** globalRuntimeAddr = nullptr;
......@@ -76,14 +77,16 @@ extern "C" {
} else {
handle = fake_dlopen("/system/lib/libart.so", RTLD_NOW);
}
const char *addWeakGloablReferenceSymbol = SDK_INT <= 25
const char *addWeakReferenceSymbol = SDK_INT <= 25
? "_ZN3art9JavaVMExt16AddWeakGlobalRefEPNS_6ThreadEPNS_6mirror6ObjectE"
: "_ZN3art9JavaVMExt16AddWeakGlobalRefEPNS_6ThreadENS_6ObjPtrINS_6mirror6ObjectEEE";
addWeakGlobalRef = (jobject (*)(JavaVM *, void *, void *)) fake_dlsym(handle,
addWeakGloablReferenceSymbol);
addWeakReferenceSymbol);
//try disable inline !
globalJitCompileHandlerAddr = reinterpret_cast<art::jit::JitCompiler **>(fake_dlsym(handle, "_ZN3art3jit3Jit20jit_compiler_handle_E"));
globalRuntimeAddr = reinterpret_cast<art::Runtime **>(fake_dlsym(handle, "_ZN3art7Runtime9instance_E"));
}
}
......@@ -161,5 +164,11 @@ extern "C" {
}
}
art::Runtime* getRuntime() {
if (globalRuntimeAddr == nullptr || globalRuntimeAddr <= 0)
return nullptr;
return *globalRuntimeAddr;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment