[pypy-svn] r35070 - in pypy/dist/pypy: config translator/c translator/c/src translator/goal

ale at codespeak.net ale at codespeak.net
Tue Nov 28 13:19:46 CET 2006


Author: ale
Date: Tue Nov 28 13:19:44 2006
New Revision: 35070

Added:
   pypy/dist/pypy/translator/goal/targetreallynopstandalone.py
      - copied unchanged from r35069, pypy/branch/mininal-c-backend/pypy/translator/goal/targetreallynopstandalone.py
Modified:
   pypy/dist/pypy/config/pypyoption.py
   pypy/dist/pypy/translator/c/genc.py
   pypy/dist/pypy/translator/c/src/g_include.h
   pypy/dist/pypy/translator/c/src/g_prerequisite.h
   pypy/dist/pypy/translator/c/src/ll_math.h
   pypy/dist/pypy/translator/c/src/main.h
   pypy/dist/pypy/translator/c/src/standalone.h
Log:
Merge the minimal-c-backend to trunk:
   svn merge -r 34901:head ~/branch-pypy/pypy
The changes seems quite small and pypy still compiles.

The merge allows for simple things to compile to AVR architectures (allthough you have to have at least 16k of memory even to have a nop target working).

To be really useful work has to go into specialising external functions (there seems to be an assumption that there will always be an OS availlable, which is not the case for small devices) 


Modified: pypy/dist/pypy/config/pypyoption.py
==============================================================================
--- pypy/dist/pypy/config/pypyoption.py	(original)
+++ pypy/dist/pypy/config/pypyoption.py	Tue Nov 28 13:19:44 2006
@@ -177,6 +177,10 @@
         BoolOption("no__thread",
                    "don't use __thread for implementing TLS",
                    default=False, cmdline="--no__thread", negation=False),
+        StrOption("compilerflags", "Specify flags for the compiler", 
+                   cmdline="--cflags"),
+        StrOption("linkerflags", "Specify flags for the linker", 
+                   cmdline="--ldflags"),
 
         # Flags of the TranslationContext:
         BoolOption("simplifying", "Simplify flow graphs", default=True),

Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py	(original)
+++ pypy/dist/pypy/translator/c/genc.py	Tue Nov 28 13:19:44 2006
@@ -245,6 +245,10 @@
         assert self.c_source_filename
         assert not self._compiled
         compiler = self.getccompiler(extra_includes=[str(self.targetdir)])
+        if self.config.translation.compilerflags:
+            compiler.compile_extra.append(self.config.translation.compilerflags)
+        if self.config.translation.linkerflags:
+            compiler.link_extra.append(self.config.translation.linkerflags)
         compiler.build()
         self.executable_name = str(compiler.outputfilename)
         self._compiled = True
@@ -265,6 +269,10 @@
                 prefix = ' ' * len(prefix)
 
         compiler = self.getccompiler(extra_includes=['.'])
+        if self.config.translation.compilerflags:
+            compiler.compile_extra.append(self.config.translation.compilerflags)
+        if self.config.translation.linkerflags:
+            compiler.link_extra.append(self.config.translation.linkerflags)
         cfiles = []
         ofiles = []
         for fn in compiler.cfilenames:
@@ -277,7 +285,6 @@
             cc = self.config.translation.cc
         else:
             cc = 'gcc'
-
         if self.config.translation.profopt:
             profopt = self.config.translation.profopt
         else:

Modified: pypy/dist/pypy/translator/c/src/g_include.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/g_include.h	(original)
+++ pypy/dist/pypy/translator/c/src/g_include.h	Tue Nov 28 13:19:44 2006
@@ -16,8 +16,12 @@
 
 #include "src/mem.h"
 #include "src/exception.h"
-#include "src/trace.h"
 #include "src/support.h"
+#ifndef AVR
+#include "src/trace.h"
+#else
+    #define PY_LONG_LONG long long
+#endif
 
 #ifndef PYPY_STANDALONE
 #  include "src/module.h"
@@ -26,9 +30,11 @@
 
 #include "src/int.h"
 #include "src/char.h"
-#include "src/unichar.h"
 #include "src/float.h"
+#ifndef AVR
+#include "src/unichar.h"
 #include "src/address.h"
+#endif
 
 #include "src/instrument.h"
 
@@ -40,6 +46,7 @@
 /*** modules ***/
 #ifdef HAVE_RTYPER      /* only if we have an RTyper */
 #  include "src/rtyper.h"
+#ifndef AVR
 #  include "src/ll_os.h"
 #  include "src/ll_time.h"
 #  include "src/ll_math.h"
@@ -48,8 +55,11 @@
 #    include "src/ll_thread.h"
 #  endif
 #endif
+#endif
 
+#ifndef AVR
 #include "src/stack.h"
+#endif
 
 #ifdef PYPY_STANDALONE
 #  include "src/main.h"

Modified: pypy/dist/pypy/translator/c/src/g_prerequisite.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/g_prerequisite.h	(original)
+++ pypy/dist/pypy/translator/c/src/g_prerequisite.h	Tue Nov 28 13:19:44 2006
@@ -6,10 +6,12 @@
  * executables (which are *not* linked against CPython then),
  * to get the convenient macro definitions
  */
+#ifndef AVR
 #include "Python.h"
 
 
 #include "thread.h"   /* needs to be included early to define the
                          struct RPyOpaque_ThreadLock */
+#endif
 
 #include <stddef.h>

Modified: pypy/dist/pypy/translator/c/src/ll_math.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_math.h	(original)
+++ pypy/dist/pypy/translator/c/src/ll_math.h	Tue Nov 28 13:19:44 2006
@@ -9,6 +9,7 @@
 
 /* xxx macro from pyport.h, at some point define our owns */
 /* xxx this 2.3 name is later deprecated  */
+#include <errno.h>
 #define LL_MATH_SET_ERANGE_IF_MATH_ERROR Py_SET_ERANGE_IF_OVERFLOW
 
 #define LL_MATH_ERROR_RESET errno = 0

Modified: pypy/dist/pypy/translator/c/src/main.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/main.h	(original)
+++ pypy/dist/pypy/translator/c/src/main.h	Tue Nov 28 13:19:44 2006
@@ -37,8 +37,10 @@
     exitcode = STANDALONE_ENTRY_POINT(list);
     if (RPyExceptionOccurred()) {
         /* fish for the exception type, at least */
+#ifndef AVR
         fprintf(stderr, "Fatal PyPy error: %s\n",
                 RPyFetchExceptionType()->ov_name->items);
+#endif
         exitcode = 1;
     }
     return exitcode;
@@ -46,7 +48,9 @@
  memory_out:
     errmsg = "out of memory";
  error:
+#ifndef AVR
     fprintf(stderr, "Fatal error during initialization: %s\n", errmsg);
+#endif
     return 1;
 }
 

Modified: pypy/dist/pypy/translator/c/src/standalone.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/standalone.h	(original)
+++ pypy/dist/pypy/translator/c/src/standalone.h	Tue Nov 28 13:19:44 2006
@@ -5,7 +5,11 @@
 #include <math.h>
 
 #ifndef PYPY_NOT_MAIN_FILE
-
+#ifdef AVR
+   #ifndef NO_OBMALLOC
+     #define NO_OBMALLOC
+   #endif
+#endif
 #ifdef NO_OBMALLOC
 void *PyObject_Malloc(size_t n) { return malloc(n); }
 void *PyObject_Realloc(void *p, size_t n) { return realloc(p, n); }



More information about the Pypy-commit mailing list