2 % (c) The University of Glasgow 2000
4 \section[ByteCodeLink]{Bytecode assembler and linker}
8 {-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
10 module ByteCodeLink ( UnlinkedBCO, UnlinkedBCOExpr, assembleBCO,
11 ClosureEnv, HValue, filterNameMap,
12 linkIModules, linkIExpr, linkFail,
13 iNTERP_STACK_CHECK_THRESH
16 #include "HsVersions.h"
19 import Name ( Name, getName, nameModule, toRdrName, isGlobalName )
20 import RdrName ( rdrNameOcc, rdrNameModule )
21 import OccName ( occNameString )
22 import FiniteMap ( FiniteMap, addListToFM, filterFM,
23 addToFM, lookupFM, emptyFM )
25 import Literal ( Literal(..) )
26 import PrimOp ( PrimOp, primOpOcc )
27 import PrimRep ( PrimRep(..) )
28 import Constants ( wORD_SIZE )
29 import Module ( ModuleName, moduleName, moduleNameFS )
30 import Linker ( lookupSymbol )
31 import FastString ( FastString(..) )
32 import ByteCodeInstr ( BCInstr(..), ProtoBCO(..) )
33 import ByteCodeItbls ( ItblEnv, ItblPtr )
36 import Monad ( when, foldM )
38 import IArray ( array )
39 import MArray ( castSTUArray,
40 newInt64Array, writeInt64Array,
41 newFloatArray, writeFloatArray,
42 newDoubleArray, writeDoubleArray,
43 newIntArray, writeIntArray,
44 newAddrArray, writeAddrArray,
46 import Foreign ( Word16, Ptr(..), free )
47 import Addr ( Word, Addr(..), nullAddr )
48 import Weak ( addFinalizer )
51 import PrelBase ( Int(..) )
52 import PrelGHC ( BCO#, newBCO#, unsafeCoerce#,
53 ByteArray#, Array#, addrToHValue#, mkApUpd0# )
54 import IOExts ( fixIO )
55 import Exception ( throwDyn )
56 import Panic ( GhcException(..) )
57 import PrelArr ( Array(..) )
58 import ArrayBase ( UArray(..) )
59 import PrelIOBase ( IO(..) )
64 %************************************************************************
66 \subsection{Top-level stuff}
68 %************************************************************************
72 linkIModules :: ItblEnv -- incoming global itbl env; returned updated
73 -> ClosureEnv -- incoming global closure env; returned updated
74 -> [([UnlinkedBCO], ItblEnv)]
75 -> IO ([HValue], ItblEnv, ClosureEnv)
76 linkIModules gie gce mods
77 = do let (bcoss, ies) = unzip mods
79 final_gie = foldr plusFM gie ies
80 (final_gce, linked_bcos) <- linkSomeBCOs True final_gie gce bcos
81 return (linked_bcos, final_gie, final_gce)
84 linkIExpr :: ItblEnv -> ClosureEnv -> UnlinkedBCOExpr
85 -> IO HValue -- IO BCO# really
86 linkIExpr ie ce (root_ul_bco, aux_ul_bcos)
87 = do (aux_ce, _) <- linkSomeBCOs False ie ce aux_ul_bcos
88 (_, [root_bco]) <- linkSomeBCOs False ie aux_ce [root_ul_bco]
91 -- Link a bunch of BCOs and return them + updated closure env.
92 linkSomeBCOs :: Bool -- False <=> add _all_ BCOs to returned closure env
93 -- True <=> add only toplevel BCOs to closure env
97 -> IO (ClosureEnv, [HValue])
98 linkSomeBCOs toplevs_only ie ce_in ul_bcos
99 = do let nms = map nameOfUnlinkedBCO ul_bcos
101 ( \ hvs -> let ce_out = addListToFM ce_in (zipLazily nms hvs)
102 in mapM (linkBCO ie ce_out) ul_bcos )
104 let ce_all_additions = zip nms hvals
105 ce_top_additions = filter (isGlobalName.fst) ce_all_additions
106 ce_additions = if toplevs_only then ce_top_additions
107 else ce_all_additions
108 ce_out = -- make sure we're not inserting duplicate names into the
109 -- closure environment, which leads to trouble.
110 ASSERT (all (not . (`elemFM` ce_in)) (map fst ce_additions))
111 addListToFM ce_in ce_additions
112 return (ce_out, hvals)
114 -- A lazier zip, in which no demand is propagated to the second
115 -- list unless some demand is propagated to the snd of one of the
116 -- result list elems.
118 zipLazily (x:xs) ys = (x, head ys) : zipLazily xs (tail ys)
123 (SizedSeq Word16) -- insns
124 (SizedSeq Word) -- literals
125 (SizedSeq (Either Name PrimOp)) -- ptrs
126 (SizedSeq Name) -- itbl refs
128 nameOfUnlinkedBCO (UnlinkedBCO nm _ _ _ _) = nm
130 -- When translating expressions, we need to distinguish the root
131 -- BCO for the expression
132 type UnlinkedBCOExpr = (UnlinkedBCO, [UnlinkedBCO])
134 instance Outputable UnlinkedBCO where
135 ppr (UnlinkedBCO nm insns lits ptrs itbls)
136 = sep [text "BCO", ppr nm, text "with",
137 int (sizeSS insns), text "insns",
138 int (sizeSS lits), text "lits",
139 int (sizeSS ptrs), text "ptrs",
140 int (sizeSS itbls), text "itbls"]
143 -- these need a proper home
144 type ClosureEnv = FiniteMap Name HValue
145 data HValue = HValue -- dummy type, actually a pointer to some Real Code.
147 -- remove all entries for a given set of modules from the environment;
148 -- note that this removes all local names too (ie. temporary bindings from
149 -- the command line).
150 filterNameMap :: [ModuleName] -> FiniteMap Name a -> FiniteMap Name a
151 filterNameMap mods env
152 = filterFM (\n _ -> isGlobalName n &&
153 moduleName (nameModule n) `elem` mods) env
156 %************************************************************************
158 \subsection{The bytecode assembler}
160 %************************************************************************
162 The object format for bytecodes is: 16 bits for the opcode, and 16 for
163 each field -- so the code can be considered a sequence of 16-bit ints.
164 Each field denotes either a stack offset or number of items on the
165 stack (eg SLIDE), and index into the pointer table (eg PUSH_G), an
166 index into the literal table (eg PUSH_I/D/L), or a bytecode address in
170 -- Top level assembler fn.
171 assembleBCO :: ProtoBCO Name -> IO UnlinkedBCO
173 assembleBCO (ProtoBCO nm instrs origin malloced)
175 -- pass 1: collect up the offsets of the local labels.
176 -- Remember that the first insn starts at offset 1 since offset 0
177 -- (eventually) will hold the total # of insns.
178 label_env = mkLabelEnv emptyFM 1 instrs
180 mkLabelEnv env i_offset [] = env
181 mkLabelEnv env i_offset (i:is)
183 = case i of LABEL n -> addToFM env n i_offset ; _ -> env
184 in mkLabelEnv new_env (i_offset + instrSize16s i) is
187 = case lookupFM label_env lab of
188 Just bco_offset -> bco_offset
189 Nothing -> pprPanic "assembleBCO.findLabel" (int lab)
191 do -- pass 2: generate the instruction, ptr and nonptr bits
192 insns <- return emptySS :: IO (SizedSeq Word16)
193 lits <- return emptySS :: IO (SizedSeq Word)
194 ptrs <- return emptySS :: IO (SizedSeq (Either Name PrimOp))
195 itbls <- return emptySS :: IO (SizedSeq Name)
196 let init_asm_state = (insns,lits,ptrs,itbls)
197 (final_insns, final_lits, final_ptrs, final_itbls)
198 <- mkBits findLabel init_asm_state instrs
200 let ul_bco = UnlinkedBCO nm final_insns final_lits final_ptrs final_itbls
202 -- 8 Aug 01: Finalisers aren't safe when attached to non-primitive
203 -- objects, since they might get run too early. Disable this until
204 -- we figure out what to do.
205 -- when (not (null malloced)) (addFinalizer ul_bco (mapM_ zonk malloced))
209 zonk (A# a#) = do -- putStrLn ("freeing malloc'd block at " ++ show (A# a#))
212 -- instrs nonptrs ptrs itbls
213 type AsmState = (SizedSeq Word16, SizedSeq Word,
214 SizedSeq (Either Name PrimOp), SizedSeq Name)
216 data SizedSeq a = SizedSeq !Int [a]
217 emptySS = SizedSeq 0 []
218 addToSS (SizedSeq n r_xs) x = return (SizedSeq (n+1) (x:r_xs))
219 addListToSS (SizedSeq n r_xs) xs
220 = return (SizedSeq (n + length xs) (reverse xs ++ r_xs))
221 sizeSS (SizedSeq n r_xs) = n
222 listFromSS (SizedSeq n r_xs) = return (reverse r_xs)
225 -- This is where all the action is (pass 2 of the assembler)
226 mkBits :: (Int -> Int) -- label finder
228 -> [BCInstr] -- instructions (in)
231 mkBits findLabel st proto_insns
232 = foldM doInstr st proto_insns
234 doInstr :: AsmState -> BCInstr -> IO AsmState
237 SWIZZLE stkoff n -> instr3 st i_SWIZZLE stkoff n
238 ARGCHECK n -> instr2 st i_ARGCHECK n
239 STKCHECK n -> instr2 st i_STKCHECK n
240 PUSH_L o1 -> instr2 st i_PUSH_L o1
241 PUSH_LL o1 o2 -> instr3 st i_PUSH_LL o1 o2
242 PUSH_LLL o1 o2 o3 -> instr4 st i_PUSH_LLL o1 o2 o3
243 PUSH_G nm -> do (p, st2) <- ptr st nm
244 instr2 st2 i_PUSH_G p
245 PUSH_AS nm pk -> do (p, st2) <- ptr st (Left nm)
246 (np, st3) <- ctoi_itbl st2 pk
247 instr3 st3 i_PUSH_AS p np
248 PUSH_UBX (Left lit) nws
249 -> do (np, st2) <- literal st lit
250 instr3 st2 i_PUSH_UBX np nws
251 PUSH_UBX (Right aa) nws
252 -> do (np, st2) <- addr st aa
253 instr3 st2 i_PUSH_UBX np nws
255 PUSH_TAG tag -> instr2 st i_PUSH_TAG tag
256 SLIDE n by -> instr3 st i_SLIDE n by
257 ALLOC n -> instr2 st i_ALLOC n
258 MKAP off sz -> instr3 st i_MKAP off sz
259 UNPACK n -> instr2 st i_UNPACK n
260 UPK_TAG n m k -> instr4 st i_UPK_TAG n m k
261 PACK dcon sz -> do (itbl_no,st2) <- itbl st dcon
262 instr3 st2 i_PACK itbl_no sz
263 LABEL lab -> return st
264 TESTLT_I i l -> do (np, st2) <- int st i
265 instr3 st2 i_TESTLT_I np (findLabel l)
266 TESTEQ_I i l -> do (np, st2) <- int st i
267 instr3 st2 i_TESTEQ_I np (findLabel l)
268 TESTLT_F f l -> do (np, st2) <- float st f
269 instr3 st2 i_TESTLT_F np (findLabel l)
270 TESTEQ_F f l -> do (np, st2) <- float st f
271 instr3 st2 i_TESTEQ_F np (findLabel l)
272 TESTLT_D d l -> do (np, st2) <- double st d
273 instr3 st2 i_TESTLT_D np (findLabel l)
274 TESTEQ_D d l -> do (np, st2) <- double st d
275 instr3 st2 i_TESTEQ_D np (findLabel l)
276 TESTLT_P i l -> instr3 st i_TESTLT_P i (findLabel l)
277 TESTEQ_P i l -> instr3 st i_TESTEQ_P i (findLabel l)
278 CASEFAIL -> instr1 st i_CASEFAIL
279 JMP l -> instr2 st i_JMP (findLabel l)
280 ENTER -> instr1 st i_ENTER
281 RETURN rep -> do (itbl_no,st2) <- itoc_itbl st rep
282 instr2 st2 i_RETURN itbl_no
283 CCALL m_addr -> do (np, st2) <- addr st m_addr
284 instr2 st2 i_CCALL np
289 instr1 (st_i0,st_l0,st_p0,st_I0) i1
290 = do st_i1 <- addToSS st_i0 (i2s i1)
291 return (st_i1,st_l0,st_p0,st_I0)
293 instr2 (st_i0,st_l0,st_p0,st_I0) i1 i2
294 = do st_i1 <- addToSS st_i0 (i2s i1)
295 st_i2 <- addToSS st_i1 (i2s i2)
296 return (st_i2,st_l0,st_p0,st_I0)
298 instr3 (st_i0,st_l0,st_p0,st_I0) i1 i2 i3
299 = do st_i1 <- addToSS st_i0 (i2s i1)
300 st_i2 <- addToSS st_i1 (i2s i2)
301 st_i3 <- addToSS st_i2 (i2s i3)
302 return (st_i3,st_l0,st_p0,st_I0)
304 instr4 (st_i0,st_l0,st_p0,st_I0) i1 i2 i3 i4
305 = do st_i1 <- addToSS st_i0 (i2s i1)
306 st_i2 <- addToSS st_i1 (i2s i2)
307 st_i3 <- addToSS st_i2 (i2s i3)
308 st_i4 <- addToSS st_i3 (i2s i4)
309 return (st_i4,st_l0,st_p0,st_I0)
311 float (st_i0,st_l0,st_p0,st_I0) f
312 = do let ws = mkLitF f
313 st_l1 <- addListToSS st_l0 ws
314 return (sizeSS st_l0, (st_i0,st_l1,st_p0,st_I0))
316 double (st_i0,st_l0,st_p0,st_I0) d
317 = do let ws = mkLitD d
318 st_l1 <- addListToSS st_l0 ws
319 return (sizeSS st_l0, (st_i0,st_l1,st_p0,st_I0))
321 int (st_i0,st_l0,st_p0,st_I0) i
322 = do let ws = mkLitI i
323 st_l1 <- addListToSS st_l0 ws
324 return (sizeSS st_l0, (st_i0,st_l1,st_p0,st_I0))
326 int64 (st_i0,st_l0,st_p0,st_I0) i
327 = do let ws = mkLitI64 i
328 st_l1 <- addListToSS st_l0 ws
329 return (sizeSS st_l0, (st_i0,st_l1,st_p0,st_I0))
331 addr (st_i0,st_l0,st_p0,st_I0) a
332 = do let ws = mkLitA a
333 st_l1 <- addListToSS st_l0 ws
334 return (sizeSS st_l0, (st_i0,st_l1,st_p0,st_I0))
336 ptr (st_i0,st_l0,st_p0,st_I0) p
337 = do st_p1 <- addToSS st_p0 p
338 return (sizeSS st_p0, (st_i0,st_l0,st_p1,st_I0))
340 itbl (st_i0,st_l0,st_p0,st_I0) dcon
341 = do st_I1 <- addToSS st_I0 (getName dcon)
342 return (sizeSS st_I0, (st_i0,st_l0,st_p0,st_I1))
344 literal st (MachWord w) = int st (fromIntegral w)
345 literal st (MachInt j) = int st (fromIntegral j)
346 literal st (MachFloat r) = float st (fromRational r)
347 literal st (MachDouble r) = double st (fromRational r)
348 literal st (MachChar c) = int st c
349 literal st (MachInt64 ii) = int64 st (fromIntegral ii)
350 literal st (MachWord64 ii) = int64 st (fromIntegral ii)
351 literal st other = pprPanic "ByteCodeLink.literal" (ppr other)
354 = addr st ret_itbl_addr
358 PtrRep -> stg_ctoi_ret_R1p_info
359 WordRep -> stg_ctoi_ret_R1n_info
360 IntRep -> stg_ctoi_ret_R1n_info
361 AddrRep -> stg_ctoi_ret_R1n_info
362 CharRep -> stg_ctoi_ret_R1n_info
363 FloatRep -> stg_ctoi_ret_F1_info
364 DoubleRep -> stg_ctoi_ret_D1_info
365 VoidRep -> stg_ctoi_ret_V_info
366 other -> pprPanic "ByteCodeLink.ctoi_itbl" (ppr pk)
369 = addr st ret_itbl_addr
373 CharRep -> stg_gc_unbx_r1_ret_info
374 IntRep -> stg_gc_unbx_r1_ret_info
375 WordRep -> stg_gc_unbx_r1_ret_info
376 AddrRep -> stg_gc_unbx_r1_ret_info
377 FloatRep -> stg_gc_f1_ret_info
378 DoubleRep -> stg_gc_d1_ret_info
380 -- Interpreter.c spots this special case
381 other -> pprPanic "ByteCodeLink.itoc_itbl" (ppr pk)
383 foreign label "stg_ctoi_ret_R1p_info" stg_ctoi_ret_R1p_info :: Addr
384 foreign label "stg_ctoi_ret_R1n_info" stg_ctoi_ret_R1n_info :: Addr
385 foreign label "stg_ctoi_ret_F1_info" stg_ctoi_ret_F1_info :: Addr
386 foreign label "stg_ctoi_ret_D1_info" stg_ctoi_ret_D1_info :: Addr
387 foreign label "stg_ctoi_ret_V_info" stg_ctoi_ret_V_info :: Addr
389 foreign label "stg_gc_unbx_r1_ret_info" stg_gc_unbx_r1_ret_info :: Addr
390 foreign label "stg_gc_f1_ret_info" stg_gc_f1_ret_info :: Addr
391 foreign label "stg_gc_d1_ret_info" stg_gc_d1_ret_info :: Addr
393 -- The size in 16-bit entities of an instruction.
394 instrSize16s :: BCInstr -> Int
427 -- Make lists of host-sized words for literals, so that when the
428 -- words are placed in memory at increasing addresses, the
429 -- bit pattern is correct for the host's word size and endianness.
430 mkLitI :: Int -> [Word]
431 mkLitF :: Float -> [Word]
432 mkLitD :: Double -> [Word]
433 mkLitA :: Addr -> [Word]
434 mkLitI64 :: Int64 -> [Word]
438 arr <- newFloatArray ((0::Int),0)
439 writeFloatArray arr 0 f
440 f_arr <- castSTUArray arr
441 w0 <- readWordArray f_arr 0
448 arr <- newDoubleArray ((0::Int),1)
449 writeDoubleArray arr 0 d
450 d_arr <- castSTUArray arr
451 w0 <- readWordArray d_arr 0
452 w1 <- readWordArray d_arr 1
457 arr <- newDoubleArray ((0::Int),0)
458 writeDoubleArray arr 0 d
459 d_arr <- castSTUArray arr
460 w0 <- readWordArray d_arr 0
467 arr <- newInt64Array ((0::Int),1)
468 writeInt64Array arr 0 ii
469 d_arr <- castSTUArray arr
470 w0 <- readWordArray d_arr 0
471 w1 <- readWordArray d_arr 1
476 arr <- newInt64Array ((0::Int),0)
477 writeInt64Array arr 0 ii
478 d_arr <- castSTUArray arr
479 w0 <- readWordArray d_arr 0
485 arr <- newIntArray ((0::Int),0)
486 writeIntArray arr 0 i
487 i_arr <- castSTUArray arr
488 w0 <- readWordArray i_arr 0
494 arr <- newAddrArray ((0::Int),0)
495 writeAddrArray arr 0 a
496 a_arr <- castSTUArray arr
497 w0 <- readWordArray a_arr 0
503 %************************************************************************
505 \subsection{Linking interpretables into something we can run}
507 %************************************************************************
512 data BCO# = BCO# ByteArray# -- instrs :: Array Word16#
513 ByteArray# -- literals :: Array Word32#
514 PtrArray# -- ptrs :: Array HValue
515 ByteArray# -- itbls :: Array Addr#
518 linkBCO ie ce (UnlinkedBCO nm insnsSS literalsSS ptrsSS itblsSS)
519 = do insns <- listFromSS insnsSS
520 literals <- listFromSS literalsSS
521 ptrs <- listFromSS ptrsSS
522 itbls <- listFromSS itblsSS
524 linked_ptrs <- mapM (lookupCE ce) ptrs
525 linked_itbls <- mapM (lookupIE ie) itbls
527 let n_insns = sizeSS insnsSS
528 n_literals = sizeSS literalsSS
529 n_ptrs = sizeSS ptrsSS
530 n_itbls = sizeSS itblsSS
532 let ptrs_arr = array (0, n_ptrs-1) (indexify linked_ptrs)
534 ptrs_parr = case ptrs_arr of Array lo hi parr -> parr
536 itbls_arr = array (0, n_itbls-1) (indexify linked_itbls)
537 :: UArray Int ItblPtr
538 itbls_barr = case itbls_arr of UArray lo hi barr -> barr
540 insns_arr | n_insns > 65535
541 = panic "linkBCO: >= 64k insns in BCO"
544 (indexify (fromIntegral n_insns:insns))
546 insns_barr = case insns_arr of UArray lo hi barr -> barr
548 literals_arr = array (0, n_literals-1) (indexify literals)
550 literals_barr = case literals_arr of UArray lo hi barr -> barr
552 indexify :: [a] -> [(Int, a)]
553 indexify xs = zip [0..] xs
555 BCO bco# <- newBCO insns_barr literals_barr ptrs_parr itbls_barr
557 -- WAS: return (unsafeCoerce# bco#)
558 case mkApUpd0# (unsafeCoerce# bco#) of
559 (# final_bco #) -> return final_bco
564 newBCO :: ByteArray# -> ByteArray# -> Array# a -> ByteArray# -> IO BCO
566 = IO (\s -> case newBCO# a b c d s of (# s1, bco #) -> (# s1, BCO bco #))
569 lookupCE :: ClosureEnv -> Either Name PrimOp -> IO HValue
570 lookupCE ce (Right primop)
571 = do let sym_to_find = primopToCLabel primop "closure"
572 m <- lookupSymbol sym_to_find
574 Just (Ptr addr) -> case addrToHValue# addr of
575 (# hval #) -> return hval
576 Nothing -> linkFail "ByteCodeLink.lookupCE(primop)" sym_to_find
577 lookupCE ce (Left nm)
578 = case lookupFM ce nm of
581 -> ASSERT2(isGlobalName nm, ppr nm)
582 do let sym_to_find = nameToCLabel nm "closure"
583 m <- lookupSymbol sym_to_find
585 Just (Ptr addr) -> case addrToHValue# addr of
586 (# hval #) -> return hval
587 Nothing -> linkFail "ByteCodeLink.lookupCE" sym_to_find
589 lookupIE :: ItblEnv -> Name -> IO (Ptr a)
591 = case lookupFM ie con_nm of
592 Just (Ptr a) -> return (Ptr a)
594 -> do -- try looking up in the object files.
595 let sym_to_find1 = nameToCLabel con_nm "con_info"
596 m <- lookupSymbol sym_to_find1
598 Just addr -> return addr
600 -> do -- perhaps a nullary constructor?
601 let sym_to_find2 = nameToCLabel con_nm "static_info"
602 n <- lookupSymbol sym_to_find2
604 Just addr -> return addr
605 Nothing -> linkFail "ByteCodeLink.lookupIE"
606 (sym_to_find1 ++ " or " ++ sym_to_find2)
608 linkFail :: String -> String -> IO a
610 = throwDyn (ProgramError $
612 , "During interactive linking, GHCi couldn't find the following symbol:"
614 , "This may be due to you not asking GHCi to load extra object files,"
615 , "archives or DLLs needed by your current session. Restart GHCi, specifying"
616 , "the missing library using the -L/path/to/object/dir and -lmissinglibname"
617 , "flags, or simply by naming the relevant files on the GHCi command line."
618 , "Alternatively, this link failure might indicate a bug in GHCi."
619 , "If you suspect the latter, please send a bug report to:"
620 , " glasgow-haskell-bugs@haskell.org"
623 -- HACKS!!! ToDo: cleaner
624 nameToCLabel :: Name -> String{-suffix-} -> String
625 nameToCLabel n suffix
626 = _UNPK_(moduleNameFS (rdrNameModule rn))
627 ++ '_':occNameString(rdrNameOcc rn) ++ '_':suffix
628 where rn = toRdrName n
630 primopToCLabel :: PrimOp -> String{-suffix-} -> String
631 primopToCLabel primop suffix
632 = let str = "PrelPrimopWrappers_" ++ occNameString (primOpOcc primop) ++ '_':suffix
633 in --trace ("primopToCLabel: " ++ str)
638 %************************************************************************
640 \subsection{Connect to actual values for bytecode opcodes}
642 %************************************************************************
646 #include "Bytecodes.h"
648 i_ARGCHECK = (bci_ARGCHECK :: Int)
649 i_PUSH_L = (bci_PUSH_L :: Int)
650 i_PUSH_LL = (bci_PUSH_LL :: Int)
651 i_PUSH_LLL = (bci_PUSH_LLL :: Int)
652 i_PUSH_G = (bci_PUSH_G :: Int)
653 i_PUSH_AS = (bci_PUSH_AS :: Int)
654 i_PUSH_UBX = (bci_PUSH_UBX :: Int)
655 i_PUSH_TAG = (bci_PUSH_TAG :: Int)
656 i_SLIDE = (bci_SLIDE :: Int)
657 i_ALLOC = (bci_ALLOC :: Int)
658 i_MKAP = (bci_MKAP :: Int)
659 i_UNPACK = (bci_UNPACK :: Int)
660 i_UPK_TAG = (bci_UPK_TAG :: Int)
661 i_PACK = (bci_PACK :: Int)
662 i_TESTLT_I = (bci_TESTLT_I :: Int)
663 i_TESTEQ_I = (bci_TESTEQ_I :: Int)
664 i_TESTLT_F = (bci_TESTLT_F :: Int)
665 i_TESTEQ_F = (bci_TESTEQ_F :: Int)
666 i_TESTLT_D = (bci_TESTLT_D :: Int)
667 i_TESTEQ_D = (bci_TESTEQ_D :: Int)
668 i_TESTLT_P = (bci_TESTLT_P :: Int)
669 i_TESTEQ_P = (bci_TESTEQ_P :: Int)
670 i_CASEFAIL = (bci_CASEFAIL :: Int)
671 i_ENTER = (bci_ENTER :: Int)
672 i_RETURN = (bci_RETURN :: Int)
673 i_STKCHECK = (bci_STKCHECK :: Int)
674 i_JMP = (bci_JMP :: Int)
676 i_CCALL = (bci_CCALL :: Int)
677 i_SWIZZLE = (bci_SWIZZLE :: Int)
679 i_CCALL = error "Sorry pal, you need to bootstrap to use i_CCALL."
680 i_SWIZZLE = error "Sorry pal, you need to bootstrap to use i_SWIZZLE."
683 iNTERP_STACK_CHECK_THRESH = (INTERP_STACK_CHECK_THRESH :: Int)