[pypy-svn] r35622 - in pypy/dist/pypy/translator: c c/src llvm/module llvm/test

mwh at codespeak.net mwh at codespeak.net
Tue Dec 12 12:34:53 CET 2006


Author: mwh
Date: Tue Dec 12 12:34:50 2006
New Revision: 35622

Modified:
   pypy/dist/pypy/translator/c/extfunc.py
   pypy/dist/pypy/translator/c/src/ll_os.h
   pypy/dist/pypy/translator/llvm/module/genexterns.c
   pypy/dist/pypy/translator/llvm/module/protos.h
   pypy/dist/pypy/translator/llvm/test/test_extfunc.py
Log:
add some more support functions so LL_os_execv can work entirely with 
incomplete pointer types.  rewrite LL_os_execv in this style.
add support to llvm for these helpers, a little as-per-usual-for-llvm hacking
and unskip the two exec tests that now pass (the raising on error one doesn't
pass yet, haven't tried to find out why yet).


Modified: pypy/dist/pypy/translator/c/extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/extfunc.py	(original)
+++ pypy/dist/pypy/translator/c/extfunc.py	Tue Dec 12 12:34:50 2006
@@ -143,11 +143,21 @@
         def _RPyListOfString_New(length=lltype.Signed):
             return LIST_OF_STR.ll_newlist(length)
 
+        def _RPyListOfString_New(length=lltype.Signed):
+            return LIST_OF_STR.ll_newlist(length)
+
         def _RPyListOfString_SetItem(l=p,
                                     index=lltype.Signed,
                                     newstring=lltype.Ptr(STR)):
             rlist.ll_setitem_nonneg(rlist.dum_nocheck, l, index, newstring)
 
+        def _RPyListOfString_GetItem(l=p,
+                                    index=lltype.Signed):
+            return rlist.ll_getitem_fast(l, index)
+
+        def _RPyListOfString_Length(l=p):
+            return rlist.ll_length(l)
+
     for fname, f in locals().items():
         if isinstance(f, types.FunctionType):
             # XXX this is painful :(

Modified: pypy/dist/pypy/translator/c/src/ll_os.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_os.h	(original)
+++ pypy/dist/pypy/translator/c/src/ll_os.h	Tue Dec 12 12:34:50 2006
@@ -396,11 +396,11 @@
 #if defined(HAVE_EXECV) && defined(HAVE_RPY_LIST_OF_STRING)
 char** get_slist(RPyListOfString *args)
 {
-	int i, nargs = args->l_length;
+	int i, nargs = _RPyListOfString_Length(args);
   char **slist = malloc((nargs+1) * sizeof(char*));
 	if (slist) {
 		for (i=0; i<nargs; i++)
-			slist[i] = RPyString_AsString(args->l_items->items[i]);
+			slist[i] = RPyString_AsString(_RPyListOfString_GetItem(args, i));
 		slist[nargs] = NULL;
     return slist;
   } else {

Modified: pypy/dist/pypy/translator/llvm/module/genexterns.c
==============================================================================
--- pypy/dist/pypy/translator/llvm/module/genexterns.c	(original)
+++ pypy/dist/pypy/translator/llvm/module/genexterns.c	Tue Dec 12 12:34:50 2006
@@ -1,5 +1,9 @@
 
 // append some genc files here manually from python
+//#include "c/src/support.h"
+#ifdef _RPyListOfString_New     /*  :-(  */
+#  define HAVE_RPY_LIST_OF_STRING
+#endif
 #include "c/src/thread.h"
 #include "c/src/ll_os.h"
 #include "c/src/ll_math.h"

Modified: pypy/dist/pypy/translator/llvm/module/protos.h
==============================================================================
--- pypy/dist/pypy/translator/llvm/module/protos.h	(original)
+++ pypy/dist/pypy/translator/llvm/module/protos.h	Tue Dec 12 12:34:50 2006
@@ -19,6 +19,8 @@
 #ifdef RPyListOfString
   RPyListOfString *_RPyListOfString_New(long);
   void _RPyListOfString_SetItem(RPyListOfString *, int, RPyString *);
+  RPyString *_RPyListOfString_GetItem(RPyListOfString *, int);
+  int _RPyListOfString_Length(RPyListOfString *);
 #endif
 
 // XXX end of proto hacks

Modified: pypy/dist/pypy/translator/llvm/test/test_extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/test/test_extfunc.py	(original)
+++ pypy/dist/pypy/translator/llvm/test/test_extfunc.py	Tue Dec 12 12:34:50 2006
@@ -594,7 +594,6 @@
 
 if hasattr(posix, 'execv'):
     def test_execv():
-        py.test.skip("fails to link")
         filename = str(udir.join('test_execv.txt'))
         executable = sys.executable
         def does_stuff():
@@ -614,7 +613,7 @@
         assert open(filename).read() == "1"
 
     def test_execv_raising():
-        py.test.skip("fails to link")
+        py.test.skip("does not raise")
         def does_stuff():
             l = []
             l.append("asddsadw32eewdfwqdqwdqwd")
@@ -624,7 +623,6 @@
         py.test.raises(OSError, "func()")
 
     def test_execve():
-        py.test.skip("fails to link")
         filename = str(udir.join('test_execve.txt'))
         executable = sys.executable
         def does_stuff():



More information about the Pypy-commit mailing list