Skip to content

Commit

Permalink
Merge pull request #4325 from 0dvictor/unresolved32
Browse files Browse the repository at this point in the history
Respect resolving static method low-tag on X86-32
  • Loading branch information
andrewcraik committed Jan 17, 2019
2 parents c1d6f09 + 8544e39 commit a848031
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 6 additions & 2 deletions runtime/compiler/x/runtime/X86Unresolveds.nasm
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,12 @@ interpreterUnresolvedStaticGlue:
push edi ; The RET will mispredict anyway so we can get away with pushing
; the adjusted RA back on the stack.

; The interpreter may low-tag the result to avoid populating the constant pool--whack it.
; The interpreter may low-tag the result to avoid populating the constant pool -- whack it and record in CF.
;
and eax, -2
btr eax, 0

; Skip code patching if the interpreter low-tag the RAM mathod
jc .fin

; Patch the call that brought us here into a load of the resolved RAM method into EDI.
;
Expand All @@ -201,6 +204,7 @@ interpreterUnresolvedStaticGlue:
movdqu xmm0, [esp+8]
add esp, 24 ; 24 = 16 + 4*2 (for two pushes)

.fin:
; Load the resolved RAM method into EDI so that the caller doesn't have to re-run patched code
mov edi, eax
ret
Expand Down
16 changes: 14 additions & 2 deletions runtime/compiler/x/runtime/X86Unresolveds.pasm
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,16 @@ interpreterUnresolvedStaticGlue proc near
push edi ; The RET will mispredict anyway so we can get away with pushing
; the adjusted RA back on the stack.

; The interpreter may low-tag the result to avoid populating the constant pool--whack it.
; The interpreter may low-tag the result to avoid populating the constant pool -- whack it and record in CF.
;
and eax, -2
btr eax, 0

; Skip code patching if the interpreter low-tag the RAM mathod
ifdef WINDOWS
jc @@fin
else
jc 0f
endif

; Patch the call that brought us here into a load of the resolved RAM method into EDI.
;
Expand All @@ -209,6 +216,11 @@ interpreterUnresolvedStaticGlue proc near
movdqu xmm0, [esp+8]
add esp, 24 ; 24 = 16 + 4*2 (for two pushes)

ifdef WINDOWS
@@fin:
else
0:
endif
; Load the resolved RAM method into EDI so that the caller doesn't have to re-run patched code
mov edi, eax
ret
Expand Down

0 comments on commit a848031

Please sign in to comment.