[pypy-svn] r68554 - in pypy/branch/msvc-asmgcroot/pypy/translator/c: . src

afa at codespeak.net afa at codespeak.net
Fri Oct 16 23:58:51 CEST 2009


Author: afa
Date: Fri Oct 16 23:58:51 2009
New Revision: 68554

Modified:
   pypy/branch/msvc-asmgcroot/pypy/translator/c/genc.py
   pypy/branch/msvc-asmgcroot/pypy/translator/c/src/mem.h
Log:
Adapt Makefile for ms nmake format.
Start playing with __asm code


Modified: pypy/branch/msvc-asmgcroot/pypy/translator/c/genc.py
==============================================================================
--- pypy/branch/msvc-asmgcroot/pypy/translator/c/genc.py	(original)
+++ pypy/branch/msvc-asmgcroot/pypy/translator/c/genc.py	Fri Oct 16 23:58:51 2009
@@ -494,15 +494,25 @@
             mk.definition('GCMAPFILES', gcmapfiles)
             mk.definition('DEBUGFLAGS', '-O2 -fomit-frame-pointer -g')
             mk.definition('OBJECTS', '$(ASMLBLFILES) gcmaptable.s')
-            mk.rule('%.s', '%.c', '$(CC) $(CFLAGS) -frandom-seed=$< -o $@ -S $< $(INCLUDEDIRS)')
+
             if sys.platform == 'win32':
                 python = sys.executable.replace('\\', '/') + ' '
             else:
-                python = ""
-            mk.rule('%.lbl.s %.gcmap', '%.s',
-                    python + '$(PYPYDIR)/translator/c/gcc/trackgcroot.py -t $< > $*.gcmap')
-            mk.rule('gcmaptable.s', '$(GCMAPFILES)',
-                    python + '$(PYPYDIR)/translator/c/gcc/trackgcroot.py $(GCMAPFILES) > $@')
+                python = ''
+
+            if self.translator.platform.name == 'msvc':
+                mk.rule('.c.gcmap', '',
+                        ['$(CC) $(CFLAGS) /c /FAs /Fa$*.s $< $(INCLUDEDIRS)',
+                         python + '$(PYPYDIR)/translator/c/gcc/trackgcroot.py -t $*.s > $@']
+                        )
+                mk.rule('gcmaptable.s', '$(GCMAPFILES)',
+                        python + '$(PYPYDIR)/translator/c/gcc/trackgcroot.py $(GCMAPFILES) > $@')
+            else:
+                mk.rule('%.s', '%.c', '$(CC) $(CFLAGS) -frandom-seed=$< -o $@ -S $< $(INCLUDEDIRS)')
+                mk.rule('%.lbl.s %.gcmap', '%.s',
+                        python + '$(PYPYDIR)/translator/c/gcc/trackgcroot.py -t $< > $*.gcmap')
+                mk.rule('gcmaptable.s', '$(GCMAPFILES)',
+                        python + '$(PYPYDIR)/translator/c/gcc/trackgcroot.py $(GCMAPFILES) > $@')
 
         else:
             mk.definition('DEBUGFLAGS', '-O1 -g')

Modified: pypy/branch/msvc-asmgcroot/pypy/translator/c/src/mem.h
==============================================================================
--- pypy/branch/msvc-asmgcroot/pypy/translator/c/src/mem.h	(original)
+++ pypy/branch/msvc-asmgcroot/pypy/translator/c/src/mem.h	Fri Oct 16 23:58:51 2009
@@ -25,6 +25,8 @@
    __gcnoreorderhack input argument.  Any memory input argument would
    have this effect: as far as gcc knows the call instruction can modify
    arbitrary memory, thus creating the order dependency that we want. */
+#ifndef _MSC_VER
+
 #define pypy_asm_gcroot(p) ({void*_r; \
                asm ("/* GCROOT %0 */" : "=g" (_r) : \
                     "0" (p), "m" (__gcnoreorderhack)); \
@@ -36,6 +38,21 @@
 /* marker for trackgcroot.py */
 #define pypy_asm_stack_bottom()  asm volatile ("/* GC_STACK_BOTTOM */" : : )
 
+#else
+/* Microsoft Compiler */
+static __forceinline
+void* pypy_asm_gcroot(void* _r1)
+{
+    __asm test _r1, 0
+    return _r1;
+}
+#define pypy_asm_keepalive(v)    __asm { }
+#define pypy_asm_stack_bottom()  /* GC_STACK_BOTTOM */
+
+#endif
+
+
+
 #define OP_GC_ASMGCROOT_STATIC(i, r)   r =      \
                i == 0 ? (void*)&__gcmapstart :         \
                i == 1 ? (void*)&__gcmapend :           \



More information about the Pypy-commit mailing list