- -- Remember that the first insn starts at offset 1 since offset 0
- -- (eventually) will hold the total # of insns.
- label_env = mkLabelEnv emptyFM 1 instrs
-
+ -- Remember that the first insn starts at offset
+ -- sizeOf Word / sizeOf Word16
+ -- since offset 0 (eventually) will hold the total # of insns.
+ lableInitialOffset
+ | wORD_SIZE_IN_BITS == 64 = 4
+ | wORD_SIZE_IN_BITS == 32 = 2
+ | otherwise = error "wORD_SIZE_IN_BITS not 32 or 64?"
+ label_env = mkLabelEnv Map.empty lableInitialOffset instrs
+
+ mkLabelEnv :: Map Word16 Word -> Word -> [BCInstr]
+ -> Map Word16 Word