diff options
author | Luite Stegeman <stegeman@gmail.com> | 2023-01-10 14:48:01 +0900 |
---|---|---|
committer | Luite Stegeman <stegeman@gmail.com> | 2023-01-18 16:17:17 +0900 |
commit | e48eb9761e78695d2d072dfb78c76120a5a27ae8 (patch) | |
tree | 2656e717d197e5415830f9f166d1f38f8c43d997 /rts/Interpreter.c | |
parent | 4efee43db5090aac4dde1293357bdb548ae71c24 (diff) | |
download | haskell-wip/ghci-primcall.tar.gz |
Add PrimCallConv support to GHCiwip/ghci-primcall
This adds support for calling Cmm code from bytecode using the native
calling convention, allowing modules that use `foreign import prim`
to be loaded and debugged in GHCi.
This patch introduces a new `PRIMCALL` bytecode instruction and
a helper stack frame `stg_primcall`. The code is based on the
existing functionality for dealing with unboxed tuples in bytecode,
which has been generalised to handle arbitrary calls.
Fixes #22051
Diffstat (limited to 'rts/Interpreter.c')
-rw-r--r-- | rts/Interpreter.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rts/Interpreter.c b/rts/Interpreter.c index 1108ca8ed0..f8885cdbce 100644 --- a/rts/Interpreter.c +++ b/rts/Interpreter.c @@ -2038,6 +2038,12 @@ run_BCO: goto nextInsn; } + case bci_PRIMCALL: { + Sp_subW(1); + SpW(0) = (W_)&stg_primcall_info; + RETURN_TO_SCHEDULER_NO_PAUSE(ThreadRunGHC, ThreadYielding); + } + case bci_CCALL: { void *tok; int stk_offset = BCO_NEXT; |