summaryrefslogtreecommitdiff
path: root/rts/include
diff options
context:
space:
mode:
authorLuite Stegeman <stegeman@gmail.com>2023-01-03 12:06:48 +0900
committerLuite Stegeman <stegeman@gmail.com>2023-01-06 18:16:24 +0900
commit28f8c0ebbfe623784988745af75dcf3fdbdd3ca5 (patch)
treea9461a0de296bdd2dbe6cba66db866235ce2cba9 /rts/include
parentb2a2db04b24a4654261db8e0db6ad7bac1b3d7cf (diff)
downloadhaskell-28f8c0ebbfe623784988745af75dcf3fdbdd3ca5.tar.gz
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
Diffstat (limited to 'rts/include')
-rw-r--r--rts/include/rts/Bytecodes.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/rts/include/rts/Bytecodes.h b/rts/include/rts/Bytecodes.h
index b97d4d4f60..960fc454ee 100644
--- a/rts/include/rts/Bytecodes.h
+++ b/rts/include/rts/Bytecodes.h
@@ -94,6 +94,24 @@
#define bci_RETURN_T 69
#define bci_PUSH_ALTS_T 70
+
+#define bci_TESTLT_I64 71
+#define bci_TESTEQ_I64 72
+#define bci_TESTLT_I32 73
+#define bci_TESTEQ_I32 74
+#define bci_TESTLT_I16 75
+#define bci_TESTEQ_I16 76
+#define bci_TESTLT_I8 77
+#define bci_TESTEQ_I8 78
+#define bci_TESTLT_W64 79
+#define bci_TESTEQ_W64 80
+#define bci_TESTLT_W32 81
+#define bci_TESTEQ_W32 82
+#define bci_TESTLT_W16 83
+#define bci_TESTEQ_W16 84
+#define bci_TESTLT_W8 85
+#define bci_TESTEQ_W8 86
+
/* If you need to go past 255 then you will run into the flags */
/* If you need to go below 0x0100 then you will run into the instructions */