summaryrefslogtreecommitdiff
path: root/rts/Interpreter.c
diff options
context:
space:
mode:
authorLuite Stegeman <stegeman@gmail.com>2023-01-10 14:48:01 +0900
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-18 14:21:42 -0500
commitb4c14c4ba17b3abf3e7b88e1201ac7ba89fd56c9 (patch)
tree3b215192329190d3aa077fe464930a414da76b39 /rts/Interpreter.c
parentc45a5fffef2c76efbf5d3a009c3f6d0244a63f0d (diff)
downloadhaskell-b4c14c4ba17b3abf3e7b88e1201ac7ba89fd56c9.tar.gz
Add PrimCallConv support to GHCi
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.c6
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;