cfbolz changed the topic of #pypy to: PyPy, the flexible snake (IRC logs: https://botbot.me/freenode/pypy/ ) | use cffi for calling C | the secret reason for us trying to get PyPy users: to test the JIT well enough that we're somewhat confident about it
adamholmberg has joined #pypy
stevenja_ has joined #pypy
stevenja_ has quit [Ping timeout: 264 seconds]
adamholmberg has quit [Ping timeout: 260 seconds]
DIRT has joined #pypy
wleslie has quit [Quit: ~~~ Crash in JIT!]
dddddd has quit [Remote host closed the connection]
<catern>
the casts are because of the suggestions to use int() and cast()
<catern>
but it doesn't help
adamholmberg has quit [Remote host closed the connection]
adamholmberg has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
<LarstiQ>
and int(lib.rsyscall_server)?
<LarstiQ>
guessing somewhat, but the line above looks convoluted to me
antocuni has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
redj_ is now known as redj
<fijal>
catern:
<fijal>
>>> int(ffi.cast('long', lib.printf))
<fijal>
140736412885376
<fijal>
this is using dlopen
<fijal>
so it's presumably not a wrapper
<arigato>
catern: even ffi.addressof(lib, 'rsyscall_server') gives you the address of a cffi wrapper, but this wrapper usually does nothing but jumps to the original function
<arigato>
that's because cffi doesn't know that 'rsyscall_server' is really a function at all; it could be a macro
<arigato>
as fijal says, you can use the ABI-mode dlopen('name-of-the-.so') instead, although it's a hack;
<arigato>
a cleaner hack is to declare ``ffi.cdef("int (*const foo)(int, int);")``
<arigato>
then ``lib.foo`` will return the address of ``foo``, even if ``foo`` is actually a function (and not a function pointer)
<catern>
so in my case that would be int "(*const rsyscall_server)(int, int);"?
<catern>
not sure I understand why cffi doesn't know this is really a function; I already declared it as a function
<catern>
ffibuilder.cdef("void rsyscall_server(const int infd, const int outfd);")
<arigato>
catern: yes, but cffi doesn't *assume* this is a function: it may be the case that actually some ".h" declares it as a macro
<arigato>
and cffi still works in that case
<arigato>
also, maybe the exact arguments are not "const int" but "long", which might be important in some ABIs
<catern>
okay, fair enough. so how can I get it as both a function pointer and actually call the function? I can't declare both "void rsyscall_server(const int infd, const int outfd);" and "void (*const rsyscall_server)(const int infd, const int outfd);" I assume
<arigato>
you can just call the function pointer version, too
<arigato>
if you really want both, you can do "void (* const my_function)(int, int);"
<arigato>
and then add ffi.set_source("static void (* const my_fonction)(int, int) = &rsyscall_server;")
<arigato>
or more simply ffi.set_source("#define my_function rsyscall_server")
<catern>
oh, if I can call the function pointer version then I don't need both yeah
<catern>
hmm, I'm not sure this is right
<catern>
I cdef'd "void (*rsyscall_server)(const int infd, const int outfd);"
<catern>
and now print(lib.rsyscall_server) gives me <cdata 'void(*)(int, int)' 0x41c9314556415741>
<catern>
which is some crazy pointer that certainly doesn't point to a function
<catern>
(and segfaults when I pass it to my function pointer thingy)
<arigato>
catern: right, this is wrong because you're saying "rsyscall_server is a read-write pointer to function"
<arigato>
that's why I suggested to try "void (*const rsyscall_server)(etc)"
<catern>
ah, sorry - yeah, it works now! thanks!
<arigato>
cool :-)
<arigato>
I think that 0x41c9314556415741 is the first 8 bytes of the function's executable machine code
<arigato>
ideally, it should have given you a warning when compiling
<arigato>
(why not an error? because it's C)
mattip has joined #pypy
<mattip>
ronan: I think there is something wrong with the the errorhandler test added in this commit
<mattip>
in the test it adds an errorhandler for codecs that returns three values
<mattip>
which doesn't seem to be standard, see comment in the commit
<ronan>
mattip: app-level error handlers can return either bytes or unicode, but RPython functions can't do that
<ronan>
that's why we return both ru and rs, but one of them is always None
<mattip>
ok. Where is the code that turns the app-level return value into a triplet?
<mattip>
in _codecs/interp_codec.py ?
<arigato>
mattip: seems that _codecs/interp_codec.py:74 always returns a unicode and None as string
<mattip>
in py3.5?
<arigato>
ah sorry, in 2.7
<ronan>
returning bytes is py3-only
<arigato>
but decode() seems to use 3-tuples in pypy2 too
<arigato>
in pypy3, it's interp_codecs.py:107
<arigato>
and :106
<arigato>
which indeed make the correct 3-tuple according to the app-level type
<arigato>
and in encode() only
<mattip>
ok, thanks. It is different in unicode-utf8
<arigato>
ah, I see
<mattip>
utf8 everywhere, no unicode return value, so the test needs to change
<mattip>
correct?
<arigato>
you mean that it returns always 2-tuples now?
<arigato>
is that correct, or do we still need to distinguish between a rpython string that came from an app-level bytes (and can contain any bytes) and a rpython string that is utf8-encoded unicode?
<ronan>
we need to make the distinction, the semantics are different
<mattip>
yes, exactly my question as well
<mattip>
there is W_Unicode and W_Bytes
<mattip>
but I think the current code is not making the distinction
<arigato>
looks wrong indeed
<mattip>
thanks, gives me more to chew on. I keep going back and forth whether the failing tests are incorrect or the code
mattip has quit [Ping timeout: 260 seconds]
stevenja_ has joined #pypy
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
mattip has joined #pypy
stevenja_ has quit [Read error: Connection reset by peer]
stevenj__ has joined #pypy
stevenj__ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
ebarrett has joined #pypy
ebarrett has quit [Client Quit]
ebarrett has joined #pypy
realitix has joined #pypy
asmeurer_ has joined #pypy
mattip has quit [Ping timeout: 244 seconds]
tayfun26 has quit [Remote host closed the connection]
altendky has joined #pypy
adamholmberg has quit [Ping timeout: 264 seconds]
adamholmberg has joined #pypy
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
<_aegis_>
is pypy3-stm still unfinished?
stevenj__ has joined #pypy
asmeurer_ has quit [Quit: asmeurer_]
stevenja_ has quit [Ping timeout: 265 seconds]
<simpson>
_aegis_: Yes. Would you like to contribute?
<_aegis_>
I want to use it, so yeah
<simpson>
arigato is the resident expert on what needs to be done, I think.
<_aegis_>
the stmgc-c7 page says only 64-bit linux, is that true too?
adamholmberg has quit [Remote host closed the connection]
<simpson>
Probably.
adamholmberg has joined #pypy
adamholmberg has quit [Read error: Connection reset by peer]
adamholmberg has joined #pypy
<_aegis_>
is that just due to stmgc?
<simpson>
I think so, yeah, it's GC changes.
asmeurer_ has joined #pypy
<_aegis_>
so for pypy3-stm on mac I'll maybe need to port stmgc to macos (which at a glance doesn't seem super obnoxious) and figure out what needs to be done on the pypy side
<simpson>
I think so. You'll definitely want to talk to arigato too.
<_aegis_>
(I've been pushing pypy pretty hard in an interactive desktop app, and there's a slight edge case where I don't want to wait for the GIL for latency reasons)
stevenj__ has quit [Read error: Connection reset by peer]
stevenja_ has joined #pypy
<_aegis_>
I guess maybe I can look into building a lower latency version of pypy that releases the gil more often
<_aegis_>
but stm sounds nicer :)
Hornwitser has quit [Remote host closed the connection]
adamholmberg has quit [Remote host closed the connection]
lesshaste has quit [Ping timeout: 260 seconds]
adamholmberg has joined #pypy
lesshaste has joined #pypy
lesshaste is now known as Guest11000
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
stevenja_ has quit [Ping timeout: 240 seconds]
realitix has quit [Ping timeout: 240 seconds]
stevenja_ has joined #pypy
<fijal>
_aegis_: stm is generally abandoned as an approach
realitix has joined #pypy
realitix has quit [Remote host closed the connection]
<_aegis_>
oh, I didn't know that
<_aegis_>
so I shouldn't abandon my idea of starting a second pypy interpreter and invisibly moving low latency user code onto it D:
<_aegis_>
is there anything with similar goals in the pipeline?
asmeurer_ has quit [Quit: asmeurer_]
antocuni has quit [Read error: Connection reset by peer]
asmeurer_ has joined #pypy
antocuni has joined #pypy
asmeurer_ has quit [Client Quit]
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
asmeurer__ has joined #pypy
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
raynold has joined #pypy
asmeurer__ has quit [Quit: asmeurer__]
stevenja_ has quit [Ping timeout: 240 seconds]
stevenja_ has joined #pypy
<fijal>
_aegis_: just use pypy
<fijal>
or does that not work?
stevenja_ has quit [Ping timeout: 260 seconds]
asmeurer__ has joined #pypy
asmeurer__ has quit [Client Quit]
asmeurer has joined #pypy
stevenja_ has joined #pypy
Hasimir has joined #pypy
antocuni has quit [Ping timeout: 240 seconds]
TheAdversary has joined #pypy
stevenja_ has quit [Remote host closed the connection]
<idnar>
what does it mean when a function is labelled "undefined" in a vmprof profile?
stevenja_ has joined #pypy
asmeurer has quit [Ping timeout: 240 seconds]
adamholmberg has quit [Remote host closed the connection]
stevenja_ has quit [Ping timeout: 256 seconds]
adamholmberg has joined #pypy
adamholmberg has quit [Ping timeout: 244 seconds]
dmalcolm_ has quit [Read error: Connection reset by peer]
dmalcolm has joined #pypy
adamholmberg has joined #pypy
adamholm_ has joined #pypy
adamholmberg has quit [Ping timeout: 240 seconds]
stevenja_ has joined #pypy
adamholm_ has quit [Remote host closed the connection]
stevenja_ has quit [Ping timeout: 260 seconds]
adamholmberg has joined #pypy
stevenja_ has joined #pypy
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
stevenja_ has quit [Ping timeout: 244 seconds]
asmeurer has joined #pypy
asmeurer has quit [Quit: asmeurer]
asmeurer_ has joined #pypy
stevenja_ has joined #pypy
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
stevenja_ has quit [Ping timeout: 264 seconds]
stevenja_ has joined #pypy
asmeurer_ has quit [Quit: asmeurer_]
t3chn0punk has quit [Ping timeout: 240 seconds]
asmeurer_ has joined #pypy
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
stevenja_ has quit [Ping timeout: 244 seconds]
t3chn0punk has joined #pypy
asmeurer_ has quit [Quit: asmeurer_]
stevenja_ has joined #pypy
marky1991 has quit [Remote host closed the connection]
asmeurer__ has joined #pypy
marky1991 has joined #pypy
asmeurer__ has quit [Client Quit]
marky1991 has quit [Remote host closed the connection]
marky1991 has joined #pypy
asmeurer has joined #pypy
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
stevenja_ has quit [Ping timeout: 240 seconds]
jamesaxl has joined #pypy
stevenja_ has joined #pypy
t3chn0punk has quit [Ping timeout: 260 seconds]
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
stevenja_ has quit [Ping timeout: 268 seconds]
asmeurer has quit [Quit: asmeurer]
stevenja_ has joined #pypy
t3chn0punk has joined #pypy
marky1991 has quit [Read error: Connection reset by peer]
marky1991 has joined #pypy
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
stevenja_ has quit [Ping timeout: 256 seconds]
jamesaxl has quit [Ping timeout: 240 seconds]
stevenja_ has joined #pypy
t3chn0punk has quit [Ping timeout: 256 seconds]
asmeurer_ has joined #pypy
asmeurer_ has quit [Client Quit]
asmeurer has joined #pypy
asmeurer has quit [Client Quit]
t3chn0punk has joined #pypy
toaderas has joined #pypy
<toaderas>
Hello everyone
asmeurer_ has joined #pypy
voidsec has joined #pypy
voidsec has quit [Remote host closed the connection]
voidsec has joined #pypy
asmeurer_ has quit [Ping timeout: 240 seconds]
jamesaxl has joined #pypy
<simpson>
Hi.
voidsec has quit [Remote host closed the connection]
stevenja_ has quit [Remote host closed the connection]
stevenja_ has joined #pypy
shunning has joined #pypy
shunning has quit [Client Quit]
stevenja_ has quit [Ping timeout: 268 seconds]
windy has joined #pypy
<windy>
Hi folks, I wanted to play around with RPython using a random toy language with an ANTLR g4 file. How could I directly or easily import the file into the format that RPython recognizes?
adamholmberg has quit [Remote host closed the connection]
<mdash>
I don't think antlr generates rpython code.
<windy>
Yeah, it shouldn't generate RPython code, but is there any parser facility in RPython that accepts a syntax specificatin?
<windy>
simpson: Thanks very much for the suggestions! In the pyrolog example where is the generated code in parser.py from? The RPly thing looks cool. I'll play around with it.