These are chat archives for dropbox/pyston

21st
Aug 2015
Kevin Modzelewski
@kmod
Aug 21 2015 08:03
you can check out getCalledFuncAddr in codegen/opt/util.cpp
which extracts an integer value from an llvm Value
if it's a constant pointer
(well, specifically it does that for the function address, but that part could be changed)
I was thinking that this might be too hacky to use the llvm representation like that
but after running into a couple other cases I think it'd be good
for instance, we currently spend a bunch of time boxing up things like the tuple in except (KeyError, AttributeError):
we don't currently speculate that the builtins didn't get overridden (we'll just fetch them each time), but if we did then we could handle that case as well
without having to encode that speculation into the type system
Sun
@Daetalus
Aug 21 2015 08:22
Thanks @kmod!
BTW, would you mind to take a look to #853, please?
Marius Wachtler
@undingen
Aug 21 2015 12:34
I looked today a little bit into our type speculation. Looks like we miss a lot of cases..
Marius Wachtler
@undingen
Aug 21 2015 12:41

for example I tried it on this loop:

for i in xrange(100000000):
    add(1, 2)

and I thought we would speculate on the what hasnext and next calls but it looks like we don't. (I also tried it with different loops etc while loop with int counter which didn't help)

Kevin do you know what's missing?
Marius Wachtler
@undingen
Aug 21 2015 12:58
Oh I think I figured it out now, it looks like we do a OSR and pass the iterator as argument, and all arguments are automatic of unknown type.
Sun
@Daetalus
Aug 21 2015 20:42

Hi, what function does the unary operator -(USub) will call? PyNumber_Negative?

I write complex.__neg__. It could work now, but -(1+6j) return (-1+6j). I also add complex_cls->tp_as_number->nb_negative = (unaryfunc)complex_neg;. No helps.

Kevin Modzelewski
@kmod
Aug 21 2015 21:02
I think it will try to call __neg__
it might be a parsing issue
can you try with -x?
(as a flag to pyston_dbg)
Sun
@Daetalus
Aug 21 2015 21:03
Not yet, but I verify it use libpypa.
The libpypa output was correct.
Kevin Modzelewski
@kmod
Aug 21 2015 21:04
oh hmm
not sure then
it should call into unaryop(), which I think should then do a callattr on __neg__
not sure where in that process it goes wrong
Sun
@Daetalus
Aug 21 2015 21:10
Thanks, I will continue to debug.
Sun
@Daetalus
Aug 21 2015 21:29
Hi @kmod , I just create an experimental commit. I want to verify this way is correct or not. Would you mind to give your professional advices, please?
Daetalus/pyston@b0bef34
Kevin Modzelewski
@kmod
Aug 21 2015 21:51
ok took a look, let me know if my comment helps :)