This commit is contained in:
Jim Wu 2020-12-19 17:20:40 +08:00
commit 979b51bcbc
1 changed files with 4 additions and 4 deletions

View File

@ -131,10 +131,10 @@ void *genTrampoline(void *toMethod, void *entrypoint) {
size_t size = entrypoint == NULL ? sizeof(trampoline) : sizeof(trampolineForBackup); size_t size = entrypoint == NULL ? sizeof(trampoline) : sizeof(trampolineForBackup);
// TODO: make use of thread_local to avoid frequent memory allocate // TODO: make use of thread_local to avoid frequent memory allocate
char *targetAddr = doInitHookCap(size + 8); char *targetAddr = doInitHookCap(size + 4);
// 8 bytes for AOT header. // 4 bytes for AOT header, then copy code_size_.
memset(targetAddr, 0, 8); memcpy(targetAddr, toMethod - 4, 4);
targetAddr += 8; targetAddr += 4;
if (targetAddr == NULL) return NULL; if (targetAddr == NULL) return NULL;