summaryrefslogtreecommitdiff
path: root/compiler/ghci/ByteCodeGen.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-06-27 10:26:01 -0400
committerBen Gamari <ben@smart-cactus.org>2017-06-27 12:55:06 -0400
commit9ef909db5ed3dc45fc1acdb608ad3f1896362966 (patch)
tree142e728dfb0c0a3a5519bb045d95f0e02dacc1e3 /compiler/ghci/ByteCodeGen.hs
parent914962ca23e407efdd3429dc89adcca7bee15f28 (diff)
downloadhaskell-9ef909db5ed3dc45fc1acdb608ad3f1896362966.tar.gz
Allow bytecode interpreter to make unsafe foreign calls
Reviewers: austin, hvr, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #8281, #13730. Differential Revision: https://phabricator.haskell.org/D3619
Diffstat (limited to 'compiler/ghci/ByteCodeGen.hs')
-rw-r--r--compiler/ghci/ByteCodeGen.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/ghci/ByteCodeGen.hs b/compiler/ghci/ByteCodeGen.hs
index 7ad51a7138..a7cd6da0e7 100644
--- a/compiler/ghci/ByteCodeGen.hs
+++ b/compiler/ghci/ByteCodeGen.hs
@@ -1164,8 +1164,12 @@ generateCCall d0 s p (CCallSpec target cconv safety) fn args_r_to_l
let
-- do the call
- do_call = unitOL (CCALL stk_offset token
- (fromIntegral (fromEnum (playInterruptible safety))))
+ do_call = unitOL (CCALL stk_offset token flags)
+ where flags = case safety of
+ PlaySafe -> 0x0
+ PlayInterruptible -> 0x1
+ PlayRisky -> 0x2
+
-- slide and return
wrapup = mkSLIDE r_sizeW (d_after_r - fromIntegral r_sizeW - s)
`snocOL` RETURN_UBX (toArgRep r_rep)