
Rodrigo Mesquita pushed to branch wip/romes/26325 at Glasgow Haskell Compiler / GHC Commits: f19a8daf by Rodrigo Mesquita at 2025-08-20T11:34:18+01:00 bytecode: Use 32bits for breakpoint index Fixes #26325 - - - - - 3 changed files: - compiler/GHC/ByteCode/Asm.hs - rts/Disassembler.c - rts/Interpreter.c Changes: ===================================== compiler/GHC/ByteCode/Asm.hs ===================================== @@ -843,16 +843,18 @@ assembleI platform i = case i of BRK_FUN ibi@(InternalBreakpointId info_mod infox) -> do p1 <- ptr $ BCOPtrBreakArray info_mod - let -- cast that checks that round-tripping through Word16 doesn't change the value - toW16 x = let r = fromIntegral x :: Word16 - in if fromIntegral r == x + let -- cast that checks that round-tripping through Word32 doesn't change the value + infoW32 = let r = fromIntegral infox :: Word32 + in if fromIntegral r == infox then r - else pprPanic "schemeER_wrk: breakpoint tick/info index too large!" (ppr x) + else pprPanic "schemeER_wrk: breakpoint tick/info index too large!" (ppr infox) + ix_hi = fromIntegral (infoW32 `shiftR` 16) + ix_lo = fromIntegral (infoW32 .&. 0xffff) info_addr <- lit1 $ BCONPtrFS $ moduleNameFS $ moduleName info_mod info_unitid_addr <- lit1 $ BCONPtrFS $ unitIdFS $ moduleUnitId info_mod np <- lit1 $ BCONPtrCostCentre ibi emit_ bci_BRK_FUN [ Op p1, Op info_addr, Op info_unitid_addr - , SmallOp (toW16 infox), Op np ] + , SmallOp ix_hi, SmallOp ix_lo, Op np ] BRK_ALTS active -> emit_ bci_BRK_ALTS [SmallOp (if active then 1 else 0)] ===================================== rts/Disassembler.c ===================================== @@ -89,7 +89,7 @@ disInstr ( StgBCO *bco, int pc ) p1 = BCO_GET_LARGE_ARG; info_mod = BCO_GET_LARGE_ARG; info_unit_id = BCO_GET_LARGE_ARG; - info_wix = BCO_NEXT; + info_wix = BCO_READ_NEXT_32; np = BCO_GET_LARGE_ARG; debugBelch ("BRK_FUN " ); printPtr( ptrs[p1] ); debugBelch("%" FMT_Word, literals[info_mod] ); ===================================== rts/Interpreter.c ===================================== @@ -720,7 +720,7 @@ interpretBCO (Capability* cap) arg1_brk_array = BCO_GET_LARGE_ARG; /* info_mod_name = */ BCO_GET_LARGE_ARG; /* info_mod_id = */ BCO_GET_LARGE_ARG; - arg4_info_index = BCO_NEXT; + arg4_info_index = BCO_READ_NEXT_32; StgPtr* ptrs = (StgPtr*)(&bco->ptrs->payload[0]); StgArrBytes* breakPoints = (StgArrBytes *) BCO_PTR(arg1_brk_array); @@ -1542,7 +1542,7 @@ run_BCO: arg1_brk_array = BCO_GET_LARGE_ARG; arg2_info_mod_name = BCO_GET_LARGE_ARG; arg3_info_mod_id = BCO_GET_LARGE_ARG; - arg4_info_index = BCO_NEXT; + arg4_info_index = BCO_READ_NEXT_32; #if defined(PROFILING) arg5_cc = BCO_GET_LARGE_ARG; #else View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f19a8daf9983f38d8be41a0ec3664625... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f19a8daf9983f38d8be41a0ec3664625... You're receiving this email because of your account on gitlab.haskell.org.