-lookupLiteral :: Either Word FastString -> IO Word
-lookupLiteral (Left lit) = return lit
-lookupLiteral (Right sym) = do Ptr addr <- lookupStaticPtr sym
- return (W# (unsafeCoerce# addr))
- -- Can't be bothered to find the official way to convert Addr# to Word#;
- -- the FFI/Foreign designers make it too damn difficult
- -- Hence we apply the Blunt Instrument, which works correctly
- -- on all reasonable architectures anyway
+lookupLiteral :: ItblEnv -> BCONPtr -> IO Word
+lookupLiteral ie (BCONPtrWord lit) = return lit
+lookupLiteral ie (BCONPtrLbl sym) = do Ptr a# <- lookupStaticPtr sym
+ return (W# (int2Word# (addr2Int# a#)))
+lookupLiteral ie (BCONPtrItbl nm) = do Ptr a# <- lookupIE ie nm
+ return (W# (int2Word# (addr2Int# a#)))