Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SandHook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SandHook
Commits
4192be5a
Commit
4192be5a
authored
Feb 19, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compile callOriginMethod to avoid CheckIncompatibleClassChange after JIT
parent
a4fc9bec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
sandhook.cpp
hooklib/src/main/cpp/sandhook.cpp
+15
-0
SandHook.java
hooklib/src/main/java/com/swift/sandhook/SandHook.java
+3
-1
No files found.
hooklib/src/main/cpp/sandhook.cpp
View file @
4192be5a
...
...
@@ -269,6 +269,21 @@ Java_com_swift_sandhook_SandHook_ensureMethodDeclaringClass(JNIEnv *env, jclass
ensureMethodDeclaringClass
(
origin
,
backup
);
}
extern
"C"
JNIEXPORT
void
JNICALL
Java_com_swift_sandhook_SandHook_compileMethod
(
JNIEnv
*
env
,
jclass
type
,
jobject
member
)
{
if
(
member
==
NULL
)
return
;
art
::
mirror
::
ArtMethod
*
method
=
reinterpret_cast
<
art
::
mirror
::
ArtMethod
*>
(
env
->
FromReflectedMethod
(
member
));
if
(
method
!=
nullptr
&&
!
method
->
isCompiled
())
{
SandHook
::
StopTheWorld
stopTheWorld
;
method
->
compile
(
env
);
}
}
extern
"C"
JNIEXPORT
void
JNICALL
Java_com_swift_sandhook_SandHook_setHookMode
(
JNIEnv
*
env
,
jclass
type
,
jint
mode
)
{
...
...
hooklib/src/main/java/com/swift/sandhook/SandHook.java
View file @
4192be5a
...
...
@@ -176,7 +176,7 @@ public class SandHook {
p
rivate
static
void
resolveStaticMethod
(
Member
method
)
{
p
ublic
static
void
resolveStaticMethod
(
Member
method
)
{
//ignore result, just call to trigger resolve
try
{
if
(
method
instanceof
Method
&&
Modifier
.
isStatic
(
method
.
getModifiers
()))
{
...
...
@@ -288,6 +288,8 @@ public class SandHook {
public
static
native
void
ensureMethodDeclaringClass
(
Member
originMethod
,
Method
backupMethod
);
public
static
native
void
compileMethod
(
Member
member
);
@FunctionalInterface
public
interface
HookModeCallBack
{
int
hookMode
(
Member
originMethod
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment