[PyPy-issue] [issue687] Patch to make the generated C filenames reflect the RPython source filenames

Dave Malcolm pypy-dev-issue at codespeak.net
Tue Apr 19 00:59:10 CEST 2011


New submission from Dave Malcolm <dmalcolm at redhat.com>:

Rationale: I'm trying to make the generated C "sources" for PyPy be more amenable to debugging at the C level, 
when debugging low level crashes, or e.g. when valgrinding pypy.

Currently, the bulk of the generated C sources are of the form:
  implement.c, implement1.c, implement2.c, etc

I'm attaching a patch which tries to make the generated C sources reflect that of the RPython sources, and 
adds testing for this.

With this is place:
  pypy/translator/c/test/test_standalone.py:TestStandalone.test_hello_world
has these generated C files:
  [c:writing] structdef.h
  [c:writing] forwarddecl.h
  [c:writing] structimpl.c
  [c:writing] nonfuncnodes.c
  [c:writing] rpython_memory_gctransform_refcounting.c
  [c:writing] rpython_exceptiondata.c
  [c:writing] rlib_rposix.c
  [c:writing] translator_c_test_test_standalone.c
  [c:writing] rpython_lltypesystem_rclass.c
  [c:writing] rpython_lltypesystem_llmemory.c
  [c:writing] translator_c_extfunc.c
  [c:writing] rpython_memory_gctransform_transform.c
  [c:writing] implement.c
  [c:writing] translator_exceptiontransform.c
  [c:writing] rpython_lltypesystem_ll_str.c
  [c:writing] rpython_lltypesystem_rffi.c
  [c:writing] rpython_module_ll_os.c
  [c:writing] rpython_lltypesystem_rrange.c
  [c:writing] rpython_lltypesystem_rlist.c
  [c:writing] rpython_rlist.c
  [c:writing] rlib_rgc.c
  [c:writing] rpython_rrange.c
  [c:writing] rpython_lltypesystem_rstr.c
  [c:writing] rpython_rstr.c

rather than merely lots of implement([0-9]+).c files.

Note that all generated files are still within the same directory, which I believe is a requirement (to be 
amenable to easy grepping).

With this patch, test_genc.py and test_standalone.py fully pass; am about to try a full translation.

Notes:
I showed a variant of this to arigo at PyCon US last month, in which I attempted to subdivide the FuncNode 
instances based on  heir names.  Doing so required introducing a rather ugly and arbitrary naming policy into 
the translator, which IIRC arigo greatly disliked.  This new approach is purely based on the RPython 
filenames, and is hopefully therefore more acceptable.

----------
effort: ???
files: pypy-make-c-filenames-reflect-rpython-filenames.patch
messages: 2378
nosy: dmalcolm, pypy-issue
priority: wish
release: ???
status: unread
title: Patch to make the generated C filenames reflect the RPython source filenames

_______________________________________________________
PyPy development tracker <pypy-dev-issue at codespeak.net>
<https://codespeak.net/issue/pypy-dev/issue687>
_______________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pypy-make-c-filenames-reflect-rpython-filenames.patch
Type: text/x-patch
Size: 3893 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pypy-issue/attachments/20110418/fa45fd4c/attachment.bin>


More information about the Pypy-issue mailing list