Re: [pypy-dev] Freelist in PyPy? Reuse short lived objects?

2021-01-14 Thread Timothy Baldridge
Well if you write this in pure Python and run it via PyPy I imagine that most of the time the Point objects won't be created at all, as the JIT will detect that the are created and don't escape the scope of the JIT loop, so they can be ripped apart and stored in locals. But also these sort of optim

Re: [pypy-dev] Running a JIT in a Python interpreter

2018-12-06 Thread Timothy Baldridge
Ah! Found it in the rtyper test code. Timothy On Thu, Dec 6, 2018 at 5:07 PM Timothy Baldridge wrote: > I'm debugging a JIT that's aborting during tracing for some strange > reason. I remember several years ago someone here pointed me to a file in > the code repo that

[pypy-dev] Running a JIT in a Python interpreter

2018-12-06 Thread Timothy Baldridge
I'm debugging a JIT that's aborting during tracing for some strange reason. I remember several years ago someone here pointed me to a file in the code repo that showed how to run a RPython JIT in interpreted mode, so you can place a breakpoint in the jit hooks. I remember this being a great help la

[pypy-dev] no list() support for

2018-12-03 Thread Timothy Baldridge
@6[self_0...] with 1 exits .. v134 = simple_call((type list), iterable_0) [translation] start debugger... > /home/tbaldrid/oss/pypy/rpython/rtyper/rmodel.py(176)rtype_bltn_list() -> raise TyperError('no list() support for %r' % self) I've never seen this error before...what should

Re: [pypy-dev] Best way to inline a primitive array in RPython?

2018-10-30 Thread Timothy Baldridge
Thanks, I'll check it out. On Tue, Oct 30, 2018 at 1:58 AM Armin Rigo wrote: > Hi Timothy, > > On Tue, 30 Oct 2018 at 00:42, Timothy Baldridge > wrote: > > typedef struct foo_t { > > int a, b; > > int _data[0]; > > } > > > > foo_t tmp = m

[pypy-dev] Best way to inline a primitive array in RPython?

2018-10-29 Thread Timothy Baldridge
Looking at rbuffer, rgc, and the lltype namespaces, it's not completely clear to me how I would go about writing a struct with a resizable primitive array inlined. Something like: typedef struct foo_t { int a, b; int _data[0]; } foo_t tmp = malloc(sizeof(foo_t) + 64); I can see that the GC has

Re: [pypy-dev] RPython translation error on generated code

2018-05-01 Thread Timothy Baldridge
Well, I switched to using sourcetools.compile_template and the error went away, so I was probably doing something wrong with how I compiled the template. Timothy On Tue, May 1, 2018 at 4:21 PM, Timothy Baldridge wrote: > I have a strange error, I'm generating code for a RPython program

[pypy-dev] RPython translation error on generated code

2018-05-01 Thread Timothy Baldridge
I have a strange error, I'm generating code for a RPython program and get this error: [translation:ERROR] AttributeError: 'FrozenDesc' object has no attribute 'pycall' Processing block: block@9[fn_0...] is a in (?:10)make_thunk containing the following operations: v2 = simple_call((type

[pypy-dev] Returning a "default value" for a Rtyped function

2018-04-19 Thread Timothy Baldridge
I have a function in RPython that returns a tuple, and based on different situations, one value or the other may "null": def decide(x): if x: return 42, None else: return 0, Object("some value") Here's the issue, this function is part of some meta-programming and is auto generated. S

Re: [pypy-dev] Not sure what lltype to use in this case

2018-03-10 Thread Timothy Baldridge
=float} > > From what I can tell I can't create lltypes on-the-fly at runtime, so I'm > left laying out the memory for this by hand, and making a custom GC hook. > But I'm still figuring out how to do that. > > Timothy > > On Sat, Mar 10, 2018 at 12:26 AM, Armin R

Re: [pypy-dev] Not sure what lltype to use in this case

2018-03-10 Thread Timothy Baldridge
eate lltypes on-the-fly at runtime, so I'm left laying out the memory for this by hand, and making a custom GC hook. But I'm still figuring out how to do that. Timothy On Sat, Mar 10, 2018 at 12:26 AM, Armin Rigo wrote: > Hi Timothy, > > On 10 March 2018 at 01:26, Timothy Bal

[pypy-dev] Not sure what lltype to use in this case

2018-03-09 Thread Timothy Baldridge
I have a rather strange use-case for a data type in a rpython interpreter. What I need is a raw malloc, but with a custom GC hook. I understand how to setup the GC hook, but what I can't figure out is what lltype to use with malloc. This type will inherit directly from object so I don't need any po

[pypy-dev] Status of "remove the gil"

2018-03-01 Thread Timothy Baldridge
immutable or share-nothing semantics? Thanks, Timothy Baldridge ___ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev

[pypy-dev] Custom scanning methods?

2017-09-15 Thread Timothy Baldridge
I have a rather complicated structure I'd like to create in RPython. The structure consists of a heterogeneous array of RPython classes laid out in a single "byte array". The problem is these structures will contain GC'd pointers. Is there a way (and can someone point me to the place) to tell the

[pypy-dev] Delimited Continuations in PyPy?

2017-08-03 Thread Timothy Baldridge
ying my hand at using their library via rffi, and copying what I need from _stacklet_shadowstack.py. But perhaps there's something I'm missing that makes this a no-go from the start. Thanks, Timothy Baldridge ___ pypy-dev mailing list

[pypy-dev] Don't release GIL in jit_libffi?

2015-08-17 Thread Timothy Baldridge
My calls into C are pretty fast in my custom RPython VM, but jit_libffi is trying to release the GIL on every single call to a FFI function. Is there a way to disable this if I know that a function call is going to be super fast? Timothy ___ pypy-dev mai

[pypy-dev] Mod typing error

2015-03-27 Thread Timothy Baldridge
I have some RPython that does this: return a % b while in another function I'm calling the same, but the two functions differ in the types of a and b (mix of ints and floats). However, during translation I'm getting a blocked block exception. translation:ERROR] AnnotatorError: [translation:ERRO

[pypy-dev] Specialization for app level types

2015-03-20 Thread Timothy Baldridge
evel objects in Pixie are just a wrapper around a object array. The type then holds the lookups for name->slot_idx. Thanks in advance. Timothy Baldridge ___ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev

Re: [pypy-dev] Sudden failures during compile-c

2015-01-20 Thread Timothy Baldridge
I fixed both of those now, but to no avail. The build still fails. But looking at the error it's interesting to note that "do_yield_thread" does exist, but "do_yield_thread_reload" does not. From what I can figure out, this "_reload" function is generated by asmgcroot. My OSX build is defaulting to

[pypy-dev] Sudden failures during compile-c

2015-01-20 Thread Timothy Baldridge
Recently my builds on linux with --opt=jit have started failing with the following error: [translation:info] Error: [translation:info]File "/home/travis/build/pixie-lang/externals/pypy/rpython/translator/goal/translate.py", line 316, in main [translation:info] drv.proceed(goals) [trans

Re: [pypy-dev] How do I get better jit_libffi traces?

2014-12-30 Thread Timothy Baldridge
not a constant). Simple promote should do the trick? > > On Tue, Dec 30, 2014 at 9:22 PM, Timothy Baldridge > wrote: > > I'm trying to optimize the FFI functionality in Pixie, and I'm not sure > how > > to proceed. From what I understand, the JIT generator i

[pypy-dev] How do I get better jit_libffi traces?

2014-12-30 Thread Timothy Baldridge
I'm trying to optimize the FFI functionality in Pixie, and I'm not sure how to proceed. From what I understand, the JIT generator is able to optimize away calls to jit_libffi and simply replace them with bare calls to the c functions. However, not matter how I hint or mark things as immutable, I se

[pypy-dev] Getting rid of "prebuilt instance X has no attribute Y" warnings

2014-12-08 Thread Timothy Baldridge
I'm getting a ton of these sort of warnings. They seem to go away when I either a) type hint the object via assert (gross) or b) access the attribute via a getter method. Is there a better way? Would there be a problem with somehow just turning this warning off? Thanks, Timothy __

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Timothy Baldridge
runs without a problem. Could this just be an issue with ffi and CPython? Timothy On Mon, Nov 10, 2014 at 1:16 PM, Timothy Baldridge wrote: > So I hacked on this more over my lunch break and am still completely > stumped, I've removed all deallocation in order to make sure I

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Timothy Baldridge
uld be awesome, I've been hacking on this for about half a week now and I'm completely stumped. Timothy On Mon, Nov 10, 2014 at 7:55 AM, Timothy Baldridge wrote: > That could be true for uv_fs_read, but in the minimal test case (in my > last email) I'm only opening a file

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Timothy Baldridge
That could be true for uv_fs_read, but in the minimal test case (in my last email) I'm only opening a file 10 times, after the first few iterations of opening the file (2-3 times) that test crashes. Timothy On Mon, Nov 10, 2014 at 7:52 AM, Armin Rigo wrote: > Hi Timothy, > > We're talking past

Re: [pypy-dev] Crashes with rffi

2014-11-10 Thread Timothy Baldridge
So I think I've narrowed it down a bit to this: it seems to only happen when I can one of these libuv functions for the second time. The second test in this file throws the exception: https://github.com/pixie-lang/pixie/blob/async-io-file/pixie/vm/libs/test/test_uv_file.py#L20 " https://github.com

[pypy-dev] Crashes with rffi

2014-11-09 Thread Timothy Baldridge
So I'm trying to integrate libuv into Pixie, and all was going well, but I'm hitting a bit of a snag when it comes to opening files. I've tried several things, but my latest iteration is this: https://github.com/pixie-lang/pixie/blob/async-io-file/pixie/vm/libs/uv_file.py#L104 When running this i

Re: [pypy-dev] lltype.malloc with opaque structs

2014-11-04 Thread Timothy Baldridge
Exactly what I was looking for, thanks! On Tue, Nov 4, 2014 at 5:45 PM, Ryan Gonzalez wrote: > I think last time I checked, I used rffi.COpaquePtr("MyType") to refer to > a pointer to MyType. > > On Tue, Nov 4, 2014 at 6:30 PM, Timothy Baldridge > wrote: > >

[pypy-dev] lltype.malloc with opaque structs

2014-11-04 Thread Timothy Baldridge
There seem to be many ways to define rffi structs, rffi.Struct CStruct, rffi_platform.Struct, lltype.Struct, what I need is this: There's a struct defined in a c header I'm including via rffi. I want to malloc it, but I don't want to define what the contents are, it's just a blob that this library

Re: [pypy-dev] translation error on jit.unroll_safe with jit_libffi

2014-10-25 Thread Timothy Baldridge
If you get latest, you should be able to get the PBC error on linux now. I mostly develop on OSX so that was an error I needed to fix for the Linux people. Timothy On Sat, Oct 25, 2014 at 7:06 AM, Armin Rigo wrote: > Hi Carl Friedrich, > > On 25 October 2014 15:00, Carl Friedrich Bolz wrote: >

[pypy-dev] translation error on jit.unroll_safe with jit_libffi

2014-10-24 Thread Timothy Baldridge
I'm in the process of adding FFI to pixie. It translates and runs fine (I'm sure there's still bugs). But the trace is a bit verbose, so I decided I'd unroll the loop that packs the arguments in the exchange buffer. However then I get this error: [translation:info]File "<388-codegen /Users/tim

Re: [pypy-dev] Weird Unicode errors

2014-10-19 Thread Timothy Baldridge
BTW, to reproduce, you can go pull source from: https://github.com/pixie-lang/pixie Then run ./make-with-jit The build script assumes that above the pixie directory you have pypy checkout in a directory named "pypy". On Sat, Oct 18, 2014 at 5:11 PM, Timothy Baldridge wrote: > Wh

Re: [pypy-dev] Weird Unicode errors

2014-10-18 Thread Timothy Baldridge
What's also odd, is that there is something non-deterministic about these errors, sometimes I get the one error, but if I translate again (without changing any code) I'll get the other. On Sat, Oct 18, 2014 at 2:08 PM, Timothy Baldridge wrote: > My interpreter is built using mostl

[pypy-dev] Weird Unicode errors

2014-10-18 Thread Timothy Baldridge
My interpreter is built using mostly unicode for symbols and strings, but recently I've been getting some really weird translation errors. The first is this: https://gist.github.com/halgari/0d57dd87434968561705 I tracked this error down to being caused whenever I try an isinstance of unicode like

[pypy-dev] Status of SSE support?

2014-10-14 Thread Timothy Baldridge
I've read a few older articles about SIMD support in PyPy, what is the status of this? If I wanted to add something like a Vector3 type to my language (like mono did here http://tirania.org/blog/archive/2008/Nov-03.html) and wanted to take advantage of SSE are there primitives for this? Thanks, T

Re: [pypy-dev] GCArray vs list

2014-10-11 Thread Timothy Baldridge
ically if you never call a method that can resize it, such > as append. Basically for it to be a GcArray you should allocate it with > [None] * n, and then only use __setitem__ and __getitem__. > > Cheers, > Alex > > On Sat, Oct 11, 2014 at 8:08 AM, Timothy Baldridge > wrote:

[pypy-dev] GCArray vs list

2014-10-11 Thread Timothy Baldridge
st on every invocation of an interpreter function. Thanks for all the help this far, my interpreter is coming along nicely. Timothy Baldridge ___ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev

Re: [pypy-dev] Stacklet problems

2014-10-02 Thread Timothy Baldridge
For the reference, my interpreter stacklet code is here: https://github.com/pixie-lang/pixie/blob/master/pixie/vm/stacklet.py And these tests pass just fine: https://github.com/pixie-lang/pixie/blob/master/pixie/vm/test/test_stacklet.py On Thu, Oct 2, 2014 at 9:51 PM, Timothy Baldridge wrote

[pypy-dev] Stacklet problems

2014-10-02 Thread Timothy Baldridge
I have an interpreter that takes advantage of the rstacklet api. My tests pass fine when running untranslated in CPython, but after translating via rpython I get a "Segmentation fault: 11", are there any major differences between cpython and rpython stacklets? Thanks, Timothy

[pypy-dev] JITing non looping interpreted functions

2014-09-28 Thread Timothy Baldridge
Let's say I have a bit of interpreter level code code that does something as simple as reduce: acc = None for x in range(1): acc = interpret(func, wrap(x)) return acc The problem I seem to be hitting is that since there isn't a loop inside the code (in the func variable) interpret is runn

Re: [pypy-dev] What is ABORT_ESCAPE?

2014-09-26 Thread Timothy Baldridge
; at the trace up to that point, it should be relatively obvious what's > happening (e.g. something is a call and not inlined). The trace is an > argument to the JIT hook. > > On Fri, Sep 26, 2014 at 6:22 PM, Timothy Baldridge > wrote: > > I have a JIT I've been work

[pypy-dev] What is ABORT_ESCAPE?

2014-09-26 Thread Timothy Baldridge
I have a JIT I've been working on for a few days now, and initial results were awesome, the JIT log showed just a few assembly ops to execute each iteration of a simple "count to 1" loop. However, then I changed something and the traces stopped being generated. I hooked up the JIT hooks and no

Re: [pypy-dev] Virtualizable Frames getting half removed in trace

2014-02-25 Thread Timothy Baldridge
correction on my last email "but that list was never used" On Tue, Feb 25, 2014 at 7:06 AM, Timothy Baldridge wrote: > So I spent two more hours on this this morning and finally got some good > results. > > a) I turned on _immutable_ = True on the Code object. Should h

Re: [pypy-dev] Virtualizable Frames getting half removed in trace

2014-02-25 Thread Timothy Baldridge
Token(4302275472)) Which is exactly what I was looking for, an add and an eq. Thanks for the help everyone! Timothy On Tue, Feb 25, 2014 at 2:56 AM, Armin Rigo wrote: > Hi Maciej, > > On 25 February 2014 09:09, Maciej Fijalkowski wrote: > > ugh that looks really odd, why is p

[pypy-dev] Virtualizable Frames getting half removed in trace

2014-02-24 Thread Timothy Baldridge
This may be a bit of a long post, but I'm trying to provide as much information as possible. I'm attempting to work on a minimalistic Clojure friendly VM. The bytecode is quite a bit like Python and the program I'm testing looks something like this: add-fn (make-code :bytecode [ADD

Re: [pypy-dev] Telling the JIT to remove a stack array

2014-02-24 Thread Timothy Baldridge
ml > > On Mon, Feb 24, 2014 at 9:37 PM, Timothy Baldridge > wrote: > > That did the trick. My "count up" program now consists of int_eq, a guard > > and int_add, that's what I wanted to see. Thanks! > > > > Timothy > > > > > &g

Re: [pypy-dev] Easy way to get access to cmpxchg?

2014-02-24 Thread Timothy Baldridge
On Mon, Feb 24, 2014 at 1:41 PM, Timothy Baldridge wrote: > What's the best way to tell rpython not to release the GIL during a given > block of code? I haven't been able to find any code that describes when the > GIL is acquired or when control could switch over to another thre

Re: [pypy-dev] Easy way to get access to cmpxchg?

2014-02-24 Thread Timothy Baldridge
n 22 February 2014 01:39, Timothy Baldridge wrote: > > compare_and_swap(foo.bar, oldval, newval) > > At some point we added a way to do it (basically you can do it > yourself, by writing a one-line function in C and calling it). We no > longer do that: it's too much of a me

Re: [pypy-dev] Telling the JIT to remove a stack array

2014-02-24 Thread Timothy Baldridge
That did the trick. My "count up" program now consists of int_eq, a guard and int_add, that's what I wanted to see. Thanks! Timothy On Sun, Feb 23, 2014 at 1:06 AM, Armin Rigo wrote: > Hi Timothy, > > On 23 February 2014 01:24, Timothy Baldridge wrote: > >

[pypy-dev] Telling the JIT to remove a stack array

2014-02-22 Thread Timothy Baldridge
I have an interpreter inner loop that looks something like this: jitdriver = JitDriver(greens=['ip', 'tos', 'bytecodes', 'consts'], reds=['locals', 'stack']) def interpret(code, args): assert isinstance(code, Code) bytecodes = code.bytecodes consts = code.consts vars = code.vars

[pypy-dev] Easy way to get access to cmpxchg?

2014-02-21 Thread Timothy Baldridge
It'd be nice to be able to do something like this in rpython: compare_and_swap(foo.bar, oldval, newval) Or basically the cmpxchg. How hard would it be to get this in? Timothy -- "One of the main causes of the fall of the Roman Empire was that-lacking zero-they had no way to indicate successful

[pypy-dev] Debugging Blocked Block exceptions

2014-02-21 Thread Timothy Baldridge
In an interpreter I'm writing I'm often running into Blocked block exceptions. I've been able to solve several of these errors but the problem is always figuring out what exactly I've done to cause the error. Most of the time it seems to come down to some sort of missing assertions that cause the t

[pypy-dev] Best FFI interface

2013-06-03 Thread Timothy Baldridge
only ever be access via gmp functions. Thanks for the help, Timothy Baldridge ___ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev

Re: [pypy-dev] Locals clearing in RPython

2012-09-06 Thread Timothy Baldridge
On Thu, Sep 6, 2012 at 1:30 PM, Benjamin Peterson wrote: > 2012/9/6 Timothy Baldridge : > > Let's imagine that I have some code like the following in RPython: > > > > > > def wrapper_func(arg1, arg2): > > return inner_func(arg2) > > &g

[pypy-dev] Locals clearing in RPython

2012-09-06 Thread Timothy Baldridge
Let's imagine that I have some code like the following in RPython: def wrapper_func(arg1, arg2): return inner_func(arg2) def inner_func(x): for y in range(x): # do something here pass return -1 bigint = 100 wrapper_func(list(range(bigint)), bigint) The problem here i

Re: [pypy-dev] graph not in self.fixed_graphs

2012-08-25 Thread Timothy Baldridge
Here's the complete traceback: [translation:ERROR] Error: [translation:ERROR] Traceback (most recent call last): [translation:ERROR]File "/home/tim/pypy/pypy/translator/goal/translate.py", line 308, in main [translation:ERROR] drv.proceed(goals) [translation:ERROR]File "/home/tim/pypy

[pypy-dev] graph not in self.fixed_graphs

2012-08-25 Thread Timothy Baldridge
I'm back ;-) [translation:ERROR]File "/home/tim/pypy/pypy/annotation/classdef.py", line 176, in setup [translation:ERROR] self.add_source_for_attribute(name, source) [translation:ERROR]File "/home/tim/pypy/pypy/annotation/classdef.py", line 193, in add_source_for_attribute [translation

[pypy-dev] "Don't know how to convert" error

2012-08-24 Thread Timothy Baldridge
I hit this bug this evening while translating my code: [translation:ERROR] return self.call('simple_call', hop) [translation:ERROR]File "/home/tim/pypy/pypy/rpython/lltypesystem/rpbc.py", line 245, in call [translation:ERROR] return hop.llops.convertvar(v_result, rresult, hop.r_result)

Re: [pypy-dev] Need some pointers on my interpreter

2012-08-14 Thread Timothy Baldridge
> > > From a quick glimpse it looks like you might be forced to use > virtualziables here. this is just a very quick glimpse though > So I've been playing around with this for about a day now, and I guess I don't understand the "vritualizable" requirements. When I try to mark a something as virtu

[pypy-dev] Translator error on Windows: error C2036: 'void *' : unknown size

2012-08-14 Thread Timothy Baldridge
I get the following error during translation on Windows: error C2036: 'void *' : unknown size I'm using 32 bit python to do my translation. Is there a known fix for this error? Thanks, Timothy ___ pypy-dev mailing list pypy-dev@python.org http://mail

Re: [pypy-dev] Need some pointers on my interpreter

2012-08-14 Thread Timothy Baldridge
Here is my jitlog: > > https://gist.github.com/3341474 > > > I updated my jitlog after the work I did last night. I was able to pull about 50+ ops out of the jitted code, but still, I'm dealing with the fact that the JIT doesn't realize it can optimize away my data stack. Around line 55 in the sta

[pypy-dev] Need some pointers on my interpreter

2012-08-13 Thread Timothy Baldridge
I'm in the process of writing a interpreter in pypy and I'd like some pointers on how to optimize my inner loop for better jit optimization. My interpreter code is here: https://github.com/halgari/cljvm/blob/master/system/interpreter.py And the wrapper/unwrapper bits are here: https://github.co

[pypy-dev] custom interpreter split_block error

2012-08-10 Thread Timothy Baldridge
nction()).main_loop(W_Int(0), W_Int(2147483648)) value = Interpreter(f.toFunction()).main_loop(W_Int(0), W_Int(int(times))) return value Could it be that the translator is propagating my function through as a constant? I.e. I'm basically hard-coding my

[pypy-dev] PyPy build bots?

2012-06-01 Thread Timothy Baldridge
I'm at the point where I'd like to start somewhat regular builds of my pypy branch complete with JIT optimization. I tried downloading the build bot but ran into some errors. Does pypy have a build farm that branches can use? Any suggestions on the path-of-least resistance to fire off nightly build

[pypy-dev] Can someone review my RPython code?

2012-05-26 Thread Timothy Baldridge
So here's the current status of my Polymorphic functions in as a pypy module: https://bitbucket.org/halgari/pypy/src/d9e7191d13df/pypy/module/clojure/functions.py I have a question about the way "space" is handled. My problem is this, I'd like to create several instances of PolymorphicFn on the i

[pypy-dev] Differences between app and interp level calling methods

2012-05-25 Thread Timothy Baldridge
For my clojure module, I'm trying to figure out if I should go with app level or interp level code. Many of my classes will do dispatching on __call__ or the equivalent. Are interpreter level variadic functions going to be faster (via call_args) vs an app level __call__(self, args_w) ? A bit more

Re: [pypy-dev] Jit hints from python

2012-05-24 Thread Timothy Baldridge
> Note that already nowadays you can hack (maybe we should just make > such hacks more explicit): if you use not a general-purpose dictionary > but instead a namespace like a module or a class, then reads are > constant-folded with an out-of-line guard.  This means you could > rewrite your code for

Re: [pypy-dev] Translating just the parser for JVM [was: Faster PyPy translation (for debugging)]

2012-05-24 Thread Timothy Baldridge
> I've been meaning to dip a toe in PyPy but had trouble getting the JVM > translator to work the last time I tried. How hard would it be to use > a fake space (or some other technique) to just spit out a parser for > the JVM? Side note, I would really love to see the JVM backend more maintained.

[pypy-dev] Faster PyPy translation (for debugging)

2012-05-24 Thread Timothy Baldridge
I'm working on writing a module for PyPy, the code runs fine via py.py, but I'm still debugging the RTyping errors. What can I do to speed up the translation process. Currently I'm running pypy translate.py --opt=0 targetpypystandalone.py On my machine that takes about 800sec before it starts rt

[pypy-dev] Jit hints from python

2012-05-23 Thread Timothy Baldridge
While looking at ways to optimize the Clojure-Py code (http://github.com/halgari/clojure-py) for pypy, I'm noticing that much of Clojure-Py could benefit greatly from giving purefunction hints to the JIT. For example, let's look at the polymorphic Clojure functions known as "protocols": def Proto

[pypy-dev] Profiling pypy code

2012-03-28 Thread Timothy Baldridge
I've been trying to find ways to optimize my clojure-on-python project. And I've been running through my code in jitviewer. However it seems that jitviewer only displays the number of times a given loop was run. What should I look into for benchmarking actual times spent in each loop? It seems that

[pypy-dev] libgmp

2012-02-23 Thread Timothy Baldridge
For a project I'm working on, I'd like to have support for gmp in pypy. I have a ctypes pypy module, but from what I understand, pypy's ctypes are a bit slow compared to CPython. What's the best way to get access to get access to libgmp from python? Would you be against a pull request that added li

Re: [pypy-dev] STM status

2012-02-17 Thread Timothy Baldridge
>"this read/write needs not be tracked", so it has to record everything in > these few kilobytes. On that subject, how do I do this in the pypy STM? From what I understand, all read/writes inside a transaction.add() function are tracked, and the entire function is restarted if anything fails. Howe

Re: [pypy-dev] question re: ancient SSL requirement of pypy

2012-02-17 Thread Timothy Baldridge
>> Anyone can either install PyPy from his own distribution, or translate >> it from sources; or attempt to get one of our nightly binary packages, >> which may or may not work because it's Linux.  I think that this is >> what you get on Linux, and we will not try to find obscure workarounds >> (li

Re: [pypy-dev] Poor performance with custom bytecode

2012-02-17 Thread Timothy Baldridge
>It's factorial(), so it's handling large "longs".  So it's about 2x as >slow as CPython.  End of the story. Funny enough, had just thought of that and given it a try. I switched it to calculating (fact 20) and (times 20) and PyPy is now 3x faster than CPython. Thanks for the help! Timothy

Re: [pypy-dev] Poor performance with custom bytecode

2012-02-17 Thread Timothy Baldridge
> A more generally targeted question, besides the sample rpython tutorial for > brainfuck, what are the recommended readings (parts of the pypy code, > papers, etc), tools and/or magic for working at rpython on an interpreter? Now, most of this code is more or less crap, but I do suggest taking a

Re: [pypy-dev] Poor performance with custom bytecode

2012-02-17 Thread Timothy Baldridge
Oh yeah, I forgot. The other nice thing about doing clojure-py in Python is that I should be able to write RPython code in Clojure. Lisp macros FTW! Timothy -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of the

Re: [pypy-dev] Poor performance with custom bytecode

2012-02-17 Thread Timothy Baldridge
> First question - why did you choose to implement this as a compiler to > python bytecode? It does sound like an interpreter written in rpython > would have both a much better performance and a much easier > implementation (compiler vs interpreter). A few reasons for this. Mostly I didn't want to

[pypy-dev] Poor performance with custom bytecode

2012-02-17 Thread Timothy Baldridge
179 RAISE_VARARGS 1 None Thanks, Timothy Baldridge -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) ___ pypy-

[pypy-dev] replacing/modifying __import__

2012-02-13 Thread Timothy Baldridge
I'm in the process of writing a Clojure->Python bytecode compiler (http://github.com/halgari/clojure-py). The project is going quite well and runs great on PyPy and CPython. However there is one feature I'm not quite sure how to implement in PyPy. What I would like, is to extend 'import' so that it

[pypy-dev] Status of LLVM backend

2012-02-06 Thread Timothy Baldridge
I haven't heard much about using PyPy with LLVM recently, and just wanted to know what the status of it was. Was there ever much of an improvement in using PyPy with LLVM for code generation? Does the binary install of PyPy use LLVM? Thanks for the info, Timothy -- “One of the main causes of th

[pypy-dev] How will STM actually integrate with normal Python code

2012-01-31 Thread Timothy Baldridge
As Armin stated in a recent mailing list thread: "In PyPy, we look at STM like we would look at the GC. It may be replaced in a week by a different one, but for the "end user" writing pure Python code, it essentially doesn't make a difference. " So, my question is, how exactly will STM integrat

Re: [pypy-dev] GIL hacks in pypy

2012-01-13 Thread Timothy Baldridge
x27;t have bytecodes, so what is the level of cooperation there? Is the jitted code littered with cooperative "release-lock" instructions? Thanks, Timothy On Fri, Jan 13, 2012 at 11:35 AM, Armin Rigo wrote: > Hi Timothy, > > On Fri, Jan 13, 2012 at 16:37, Timothy Baldridge wrote

[pypy-dev] GIL hacks in pypy

2012-01-13 Thread Timothy Baldridge
I'm in the process of writing some semi-multithreaded code in PyPy. Now I know that PyPy and CPython both have GILs, but what I need is a CompareAndSwap operation in Python code. So basically I want my python code to grab the GIL, execute a small block of code, then hand the GIL back. Python doesn'

Re: [pypy-dev] C interpreter written in Python, and running CPython on top of PyPy

2012-01-06 Thread Timothy Baldridge
> OK ... I know the restrictions of TCC. Just an off topic question:  is there> > a comparable library interface for gcc or other C compilers ? You might look into clang(llvm)'s bindings. I know tons of people are hooking into that these days. For isntance, the people working on the Qt IDE use c

Re: [pypy-dev] C interpreter written in Python, and running CPython on top of PyPy

2012-01-06 Thread Timothy Baldridge
On Fri, Jan 6, 2012 at 10:27 AM, Celil wrote: > So if I understand correctly, the flow graph is simply there to help deduce > low level types for the high level python objects so that rpython can be > translated into C, and they play no role in the interpreter? Correct. When pypy loads .py module

Re: [pypy-dev] STM

2012-01-05 Thread Timothy Baldridge
> I'm not sure how > that plays into lexical structure, but intuitively it seems like the > with-statement style plays nicely. The lexical scoping method also helps with general sanity of the programmer. The idea behind STM is that certain failed transactions need to be re-startable. That is, if t

Re: [pypy-dev] Non standard ASTs

2011-12-13 Thread Timothy Baldridge
One last question then. What bytecodes in Python are strictly unsupported in rPython. I assume YIELD is the major one...are there any others? Timothy -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C pro

[pypy-dev] Non standard ASTs

2011-12-13 Thread Timothy Baldridge
For some time now, I've been working on my Clojure/pypy implementation. However, I'm starting to wish I had a few Clojure facilities while writing my rpython clojure interpreter. Basically I would love to have macros, protocols, symbol resolution, and a ton of other little features for helping with

[pypy-dev] Optimizing Append Only structures

2011-11-29 Thread Timothy Baldridge
I have a dictionary (in RPython) that looks something like this: class MyDict(Obj): def add(self, k, v): newdict = self.dict.copy() newdict[k] = v self.dict = newdict def get(self, k): d = self.dict return MyDict._static_get(d, k) @staticmetho

[pypy-dev] Bytecode-less pypy languages

2011-11-23 Thread Timothy Baldridge
So I've started work on my Clojure(lisp) in pypy interpreter again. This time I've decided to take a very materialistic approach to the design. As such my interpreter does not run off of bytecode, instead it directly interprets the Clojure structures, truely treating data as code. The idea is that

Re: [pypy-dev] Arrays in rpython

2011-06-07 Thread Timothy Baldridge
>> Actually, there is also a module by name "Array" >> >> import array >> t=array.array(I,size) And if you notice, it doesn't support arrays of objects, which was what my original problem was Timothy ___ pypy-dev mailing list pypy-dev@python.org http://

Re: [pypy-dev] Arrays in rpython

2011-06-06 Thread Timothy Baldridge
> In case you don't already know: in Python (and RPython), lists are > implemented as > resizeable arrays, i.e. they look more like a C++ std::vector and not > a std::list. > > This said, IIRC RPython has special code for fixed-size lists. > I think you just have to avoid all resizing functions. >

[pypy-dev] Arrays in rpython

2011-06-06 Thread Timothy Baldridge
Is there a way in rpython to specify that a given list should be implemented as an array? I want to create a list of objects exactly 32 entries long. I could use [] but it seems like that would be slower than using an array. In CPython I can create an array of primitive types, but I'm looking to cr

Re: [pypy-dev] [translation:ERROR] AttributeError': 'FrozenDesc' object has no attribute 'rowkey'

2011-06-02 Thread Timothy Baldridge
> > There's no dict() type in RPython. Use {}. (Yes, obscure). > > I would have never guessed. On the plus side, your explanation did give me a good laugh. Timothy ___ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy

[pypy-dev] [translation:ERROR] AttributeError': 'FrozenDesc' object has no attribute 'rowkey'

2011-06-02 Thread Timothy Baldridge
What does error mean, when running the translator against my rpython code? [translation:ERROR]  AttributeError': 'FrozenDesc' object has no attribute 'rowkey' Can anyone give me some insight? Thanks. Timothy The code: class Runtime(Obj): def __init__(self): Obj.__init__(self)    

Re: [pypy-dev] JIT for scripts

2011-06-01 Thread Timothy Baldridge
We don't particularly care about fibonacci (which is the worst-case > scenario here, recursion works better in cases where functions are > bigger). However there is a plan how to go about it (without > reimplementing the JIT). It's even relatively simple. It's just that > fibonacci wasn't our majo