Add support for sized literals in the bytecode interpreter.
The bytecode interpreter only has branching instructions for word-sized values. These are used for pattern matching. Branching instructions for other types (e.g. Int16# or Word8#) weren't needed, since unoptimized Core or STG never requires branching on types like this. It's now possible for optimized STG to reach the bytecode generator (e.g. fat interface files or certain compiler flag combinations), which requires dealing with various sized literals in branches. This patch improves support for generating bytecode from optimized STG by adding the following new bytecode instructions: TESTLT_I64 TESTEQ_I64 TESTLT_I32 TESTEQ_I32 TESTLT_I16 TESTEQ_I16 TESTLT_I8 TESTEQ_I8 TESTLT_W64 TESTEQ_W64 TESTLT_W32 TESTEQ_W32 TESTLT_W16 TESTEQ_W16 TESTLT_W8 TESTEQ_W8 Fixes #21945
Showing
- compiler/GHC/ByteCode/Asm.hs 43 additions, 4 deletionscompiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs 50 additions, 0 deletionscompiler/GHC/ByteCode/Instr.hs
- compiler/GHC/StgToByteCode.hs 60 additions, 6 deletionscompiler/GHC/StgToByteCode.hs
- compiler/GHC/Utils/Outputable.hs 9 additions, 0 deletionscompiler/GHC/Utils/Outputable.hs
- rts/Disassembler.c 113 additions, 4 deletionsrts/Disassembler.c
- rts/Interpreter.c 172 additions, 2 deletionsrts/Interpreter.c
- rts/include/rts/Bytecodes.h 18 additions, 0 deletionsrts/include/rts/Bytecodes.h
- testsuite/tests/ghci/should_run/SizedLiterals.hs 117 additions, 0 deletionstestsuite/tests/ghci/should_run/SizedLiterals.hs
- testsuite/tests/ghci/should_run/SizedLiterals.stdout 10 additions, 0 deletionstestsuite/tests/ghci/should_run/SizedLiterals.stdout
- testsuite/tests/ghci/should_run/SizedLiteralsA.hs 139 additions, 0 deletionstestsuite/tests/ghci/should_run/SizedLiteralsA.hs
- testsuite/tests/ghci/should_run/all.T 2 additions, 0 deletionstestsuite/tests/ghci/should_run/all.T
Loading
Please register or sign in to comment