[MLton-commit] r4600

Matthew Fluet MLton@mlton.org
Thu, 25 May 2006 05:01:59 -0700


Follow up to r4599: add "basis-ffi.h" to "c-chunk.h" and revise the
MLTON_CODEGEN_WORDSQUOTREM macro.


----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c
U   mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.h
U   mlton/branches/on-20050822-x86_64-branch/include/c-chunk.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/basis/Word/Word-ops.h

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c	2006-05-25 10:52:45 UTC (rev 4599)
+++ mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c	2006-05-25 12:01:55 UTC (rev 4600)
@@ -9,6 +9,10 @@
 #ifndef MLTON_CODEGEN_STATIC_INLINE
 #define MLTON_CODEGEN_STATIC_INLINE static inline
 #endif
+#include "platform.h"
+
+#include "interpret.h"
+
 /* No need to declare inlined math functions, since <math.h> comes
  * with "platform.h".
  */
@@ -20,11 +24,8 @@
  * arguments are variables.
  */
 #ifndef MLTON_CODEGEN_WORDSQUOTREM
-#define MLTON_CODEGEN_WORDSQUOTREM(decl, func) func
+#define MLTON_CODEGEN_WORDSQUOTREM(func) func
 #endif
-#include "platform.h"
-
-#include "interpret.h"
 #include "c-chunk.h"    // c-chunk.h must come before opcode.h because it
                         // redefines some opcode symbols
 #include "opcode.h"

Modified: mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.h	2006-05-25 10:52:45 UTC (rev 4599)
+++ mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.h	2006-05-25 12:01:55 UTC (rev 4600)
@@ -10,6 +10,7 @@
 
 #include <stdio.h>
 #include "ml-types.h"
+#include "c-types.h"
 #include "assert.h"
 
 #define regs(ty)                                \

Modified: mlton/branches/on-20050822-x86_64-branch/include/c-chunk.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/include/c-chunk.h	2006-05-25 10:52:45 UTC (rev 4599)
+++ mlton/branches/on-20050822-x86_64-branch/include/c-chunk.h	2006-05-25 12:01:55 UTC (rev 4600)
@@ -204,12 +204,11 @@
 /* WordS<N>_quot and WordS<N>_rem can't be inlined with the C-codegen,
  * because the gcc optimizer sometimes produces incorrect results when
  * one of the arguments is a constant.  
- * However, we need the declarations for Word-check.h
  */
 #ifndef MLTON_CODEGEN_WORDSQUOTREM
-#define MLTON_CODEGEN_WORDSQUOTREM(decl, func) decl
+#define MLTON_CODEGEN_WORDSQUOTREM(func) 
 #endif
-// #include "basis-ffi.h"
+#include "basis-ffi.h"
 #include "basis/coerce.h"
 #include "basis/Real/Real-ops.h"
 #include "basis/Real/Math-fns.h"

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Word/Word-ops.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Word/Word-ops.h	2006-05-25 10:52:45 UTC (rev 4599)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Word/Word-ops.h	2006-05-25 12:01:55 UTC (rev 4600)
@@ -1,11 +1,8 @@
 
 #ifndef MLTON_CODEGEN_WORDSQUOTREM
-#define MLTON_CODEGEN_WORDSQUOTREM(decl, func) func
+#define MLTON_CODEGEN_WORDSQUOTREM(func) func
 #endif
 
-#define binaryDecl(kind, name)                                          \
-  Word##kind Word##kind##_##name (Word##kind w1, Word##kind w2);
-
 #define binary(kind, name, op)                                          \
   MLTON_CODEGEN_STATIC_INLINE                                           \
   Word##kind Word##kind##_##name (Word##kind w1, Word##kind w2) {       \
@@ -62,24 +59,23 @@
 bothBinary (size, mul, *)                       \
 unary (size, neg, -)                            \
 unary (size, notb, ~)                           \
-/* WordS<N>_quot and WordS<N>_rem can't be inlined with the C-codegen,   \ 
- * because the gcc optimizer sometimes produces incorrect results        \
- * when one of the arguments is a constant.                              \
- * However, we need the declarations for Word-check.h                    \
- * WordS<N>_quot and WordS<N>_rem can be inlined with the                \
- * bytecode-codegen, since they will be used in a context where the      \
- * arguments are variables.                                              \
- */                                                                      \
-MLTON_CODEGEN_WORDSQUOTREM(binaryDecl (S##size, quot), binary (S##size, quot, /)) \
-MLTON_CODEGEN_WORDSQUOTREM(binaryDecl (S##size, rem), binary (S##size, rem, %))   \
+/* WordS<N>_quot and WordS<N>_rem can't be inlined with the C-codegen,  \ 
+ * because the gcc optimizer sometimes produces incorrect results       \
+ * when one of the arguments is a constant.                             \
+ * WordS<N>_quot and WordS<N>_rem can be inlined with the               \
+ * bytecode-codegen, since they will be used in a context where the     \
+ * arguments are variables.                                             \
+ */                                                                     \
+MLTON_CODEGEN_WORDSQUOTREM(binary (S##size, quot, /))                   \
+MLTON_CODEGEN_WORDSQUOTREM(binary (S##size, rem, %))                    \
 binary (U##size, quot, /)                       \
 binary (U##size, rem, %)                        \
 binary (size, orb, |)                           \
 rol(size)                                       \
 ror(size)                                       \
-/* WordS<N>_rshift isn't ANSI C, because ANSI doesn't guarantee sign     \
- * extension.  We use it anyway cause it always seems to work.           \
- */                                                                      \
+/* WordS<N>_rshift isn't ANSI C, because ANSI doesn't guarantee sign    \
+ * extension.  We use it anyway cause it always seems to work.          \
+ */                                                                     \
 shift (S##size, rshift, >>)                     \
 shift (U##size, rshift, >>)                     \
 binary (size, sub, -)                           \