summaryrefslogtreecommitdiff
path: root/includes/rts/Bytecodes.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-08-02 21:32:04 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-08-02 21:32:04 +0000
commita2a67cd520b9841114d69a87a423dabcb3b4368e (patch)
tree3dc6bbf53dff5421c14fbeb2d812c1424f2718c0 /includes/rts/Bytecodes.h
parent5d379cbe65e406d5c3a848fe7fcd090cafbfeb78 (diff)
downloadhaskell-a2a67cd520b9841114d69a87a423dabcb3b4368e.tar.gz
RTS tidyup sweep, first phase
The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
Diffstat (limited to 'includes/rts/Bytecodes.h')
-rw-r--r--includes/rts/Bytecodes.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/includes/rts/Bytecodes.h b/includes/rts/Bytecodes.h
new file mode 100644
index 0000000000..4aff907cfd
--- /dev/null
+++ b/includes/rts/Bytecodes.h
@@ -0,0 +1,92 @@
+/* -----------------------------------------------------------------------------
+ *
+ * (c) The GHC Team, 1998-2002
+ *
+ * Bytecode definitions.
+ *
+ * ---------------------------------------------------------------------------*/
+
+/* --------------------------------------------------------------------------
+ * Instructions
+ *
+ * Notes:
+ * o CASEFAIL is generated by the compiler whenever it tests an "irrefutable"
+ * pattern which fails. If we don't see too many of these, we could
+ * optimise out the redundant test.
+ * ------------------------------------------------------------------------*/
+
+/* NOTE:
+
+ THIS FILE IS INCLUDED IN HASKELL SOURCES (ghc/compiler/ghci/ByteCodeGen.lhs).
+ DO NOT PUT C-SPECIFIC STUFF IN HERE!
+
+ I hope that's clear :-)
+*/
+
+#define bci_STKCHECK 1
+#define bci_PUSH_L 2
+#define bci_PUSH_LL 3
+#define bci_PUSH_LLL 4
+#define bci_PUSH_G 5
+#define bci_PUSH_ALTS 6
+#define bci_PUSH_ALTS_P 7
+#define bci_PUSH_ALTS_N 8
+#define bci_PUSH_ALTS_F 9
+#define bci_PUSH_ALTS_D 10
+#define bci_PUSH_ALTS_L 11
+#define bci_PUSH_ALTS_V 12
+#define bci_PUSH_UBX 13
+#define bci_PUSH_APPLY_N 14
+#define bci_PUSH_APPLY_F 15
+#define bci_PUSH_APPLY_D 16
+#define bci_PUSH_APPLY_L 17
+#define bci_PUSH_APPLY_V 18
+#define bci_PUSH_APPLY_P 19
+#define bci_PUSH_APPLY_PP 20
+#define bci_PUSH_APPLY_PPP 21
+#define bci_PUSH_APPLY_PPPP 22
+#define bci_PUSH_APPLY_PPPPP 23
+#define bci_PUSH_APPLY_PPPPPP 24
+/* #define bci_PUSH_APPLY_PPPPPPP 25 */
+#define bci_SLIDE 26
+#define bci_ALLOC_AP 27
+#define bci_ALLOC_AP_NOUPD 28
+#define bci_ALLOC_PAP 29
+#define bci_MKAP 30
+#define bci_MKPAP 31
+#define bci_UNPACK 32
+#define bci_PACK 33
+#define bci_TESTLT_I 34
+#define bci_TESTEQ_I 35
+#define bci_TESTLT_F 36
+#define bci_TESTEQ_F 37
+#define bci_TESTLT_D 38
+#define bci_TESTEQ_D 39
+#define bci_TESTLT_P 40
+#define bci_TESTEQ_P 41
+#define bci_CASEFAIL 42
+#define bci_JMP 43
+#define bci_CCALL 44
+#define bci_SWIZZLE 45
+#define bci_ENTER 46
+#define bci_RETURN 47
+#define bci_RETURN_P 48
+#define bci_RETURN_N 49
+#define bci_RETURN_F 50
+#define bci_RETURN_D 51
+#define bci_RETURN_L 52
+#define bci_RETURN_V 53
+#define bci_BRK_FUN 54
+/* 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 */
+#define bci_FLAG_LARGE_ARGS 0x8000
+
+/* If a BCO definitely requires less than this many words of stack,
+ don't include an explicit STKCHECK insn in it. The interpreter
+ will check for this many words of stack before running each BCO,
+ rendering an explicit check unnecessary in the majority of
+ cases. */
+#define INTERP_STACK_CHECK_THRESH 50
+
+/*-------------------------------------------------------------------------*/