[Python-Dev] vmgen based python interpretter

Michal Revucky michal at yogi.htu.tuwien.ac.at
Thu May 22 13:45:04 CEST 2008


hello everyone,

i'm working on the branch:

http://svn.python.org/projects/python/branches/release25-maint/

i'm trying to build a vmgen based interpreter for python:

http://www.complang.tuwien.ac.at/anton/vmgen

from vmgen's input file, which specifies the python's opcodes a c source is
generated which may be included in ceval.c.

when i include that generated source in ceval.c the whole interpreter crashes
with this error:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1209710912 (LWP 28223)]
PyObject_Malloc (nbytes=32) at Objects/obmalloc.c:747
747                             if ((pool->freeblock = *(block **)bp) != NULL) {
(gdb)

so far i implemented only 4 opcodes (LOAD_CONST, PRINT_ITEM, PRINT_NEWLINE,
RETURN_VALUE) 

on the other hand when i leave these 4 opcodes, as provided by ceval.c within
the switch(opcode) statement every thing works well, the interpreter exits with
an uknown opcode error, when an unknown opcode is executed.

my question is, why does this segfault appear? as far as i know the
PyObject_Malloc is only called by the compiler related code, and i changed code
only in ceval.c 

it would would also be helpfull if someone could tell me, how to locate the
code, which causes this SEG fault

hopefully somebody can help me with that

-- michal



More information about the Python-Dev mailing list