Skip to content

Commit

Permalink
FFI: Don't load PC from non-function object in FFI continuation.
Browse files Browse the repository at this point in the history
Reported by Yichun Zhang. LuaJIT#743
  • Loading branch information
Mike Pall committed Sep 20, 2021
1 parent 98b7d9a commit 003f685
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vm_arm64.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,12 @@ static void build_subroutines(BuildCtx *ctx)
| cmp CARG1, #1
|.endif
| ldr PC, [CARG4, #-24] // Restore PC from [cont|PC].
| ldr CARG3, LFUNC:CARG3->pc
| add TMP0, RA, RC
| str TISNIL, [TMP0, #-8] // Ensure one valid arg.
|.if FFI
| bls >1
|.endif
| ldr CARG3, LFUNC:CARG3->pc
| ldr KBASE, [CARG3, #PC2PROTO(k)]
| // BASE = base, RA = resultptr, CARG4 = meta base
| br CARG1
Expand Down
2 changes: 1 addition & 1 deletion src/vm_mips64.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -728,11 +728,11 @@ static void build_subroutines(BuildCtx *ctx)
| ld PC, -24(RB) // Restore PC from [cont|PC].
| cleartp LFUNC:TMP1
| daddu TMP2, RA, RD
| ld TMP1, LFUNC:TMP1->pc
|.if FFI
| bnez AT, >1
|.endif
|. sd TISNIL, -8(TMP2) // Ensure one valid arg.
| ld TMP1, LFUNC:TMP1->pc
| // BASE = base, RA = resultptr, RB = meta base
| jr TMP0 // Jump to continuation.
|. ld KBASE, PC2PROTO(k)(TMP1)
Expand Down

0 comments on commit 003f685

Please sign in to comment.