These are chat archives for dropbox/pyston

1st
Sep 2015
lanyuesl
@lanyuesl
Sep 01 2015 06:58

#883

Is there anyone who can answer my question?
Thanks

Marius Wachtler
@undingen
Sep 01 2015 08:09
generally you can't directly retrieve the CFG from the LLVM IR we generate. That't why we call into the runtimeCall binop etc functions. they do the dynamic lookup to figure out what really needs to get called.
lanyuesl
@lanyuesl
Sep 01 2015 09:39
so that mean I can not know the real callee from IR?
Is there any way to know what is the callee?
Marius Wachtler
@undingen
Sep 01 2015 09:46
In general I think this is not possible. It will only be possible to resolve the calls statically for very trivial cases and if you know what exactly get's executed.

just something very simple like

def foo():
    print "foo"
    global foo
    foo = bar
def bar():
    print "bar"
foo()
foo()

shows that it's non trivial

Marius Wachtler
@undingen
Sep 01 2015 09:52
or did I misunderstand your question?
lanyuesl
@lanyuesl
Sep 01 2015 10:57
OK, I got it. Thanks
lanyuesl
@lanyuesl
Sep 01 2015 11:38
Is there any possible not to run my python script but only analyze it and get CFG?
Marius Wachtler
@undingen
Sep 01 2015 11:44
I don't think so, AFAIK we create the CFG lazily so we will only output it when the function is called for the first time / maybe a little bit early during executing the FunctionDef node...
what do you plan todo with the CFG?
lanyuesl
@lanyuesl
Sep 01 2015 11:46
I want to get the function-call map.
Marius Wachtler
@undingen
Sep 01 2015 11:46
our CFG nodes are very similar to the AST Nodes (just lower level) maybe you only need the parser output?
mmh ok than the parser AST output wont be enough...
lanyuesl
@lanyuesl
Sep 01 2015 11:47
Our python run on other platform ,no Ubuntu
Marius Wachtler
@undingen
Sep 01 2015 11:48
but linux x86 64bit?
lanyuesl
@lanyuesl
Sep 01 2015 11:48
yes
Marius Wachtler
@undingen
Sep 01 2015 11:49
do you want to create the function call map statically or while executing the python code?
Kevin Modzelewski
@kmod
Sep 01 2015 11:49
hi lanyuesl, I think it's becoming clear that Pyston is not quite what you are looking for
have you had a chance to check out some of the Python static compilers?
we're happy to keep answering questions though
lanyuesl
@lanyuesl
Sep 01 2015 11:52
dynamic , if possible
Sun
@Daetalus
Sep 01 2015 21:13
Hi @kmod Would you mind to review the latest #817 if you have time, please?
Kevin Modzelewski
@kmod
Sep 01 2015 21:28
oh whoops thought I had already merged it :)
Sun
@Daetalus
Sep 01 2015 21:32
That's OK, thanks for your patiently reivew!!! :smile: