Niko Matsakis | 1 Apr 2007 07:48
Picon
Favicon
Gravatar

Re: Towards pypy-jvm

> The last time I checked what java's Hasttable offers and I saw you  
> can't pass to it custom hashing and equality functions, but maybe  
> there is a simple way to do it that I don't know.

No, there isn't, but it shouldn't be too hard to cook up some kind of  
Hashtable substitute that uses small wrapper classes to handle that.   
I think that's what you did for C#, right?

Niko
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Antonio Cuni | 1 Apr 2007 13:46
Picon
Gravatar

Re: Towards pypy-jvm

Niko Matsakis wrote:
>> The last time I checked what java's Hasttable offers and I saw you 
>> can't pass to it custom hashing and equality functions, but maybe 
>> there is a simple way to do it that I don't know.
> 
> No, there isn't, but it shouldn't be too hard to cook up some kind of 
> Hashtable substitute that uses small wrapper classes to handle that.  I 
> think that's what you did for C#, right?

No, for .NET it was simpler because the standard Dictionary type also 
accepts an optional class that implements the custom functions, so all I 
need to do is to create a class for each unique pair of equality and 
hashing functions (see cli/comparer.py).

ciao Anto
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Favicon

Re: Paul Fernhout wants edit-and-continue in python

integration with leo - http://leo.sf.net - would be a good start.

that would give you the GUI part, and context-sensitive execution.

you _might_ have to do something similar to what gcc currently
do, which is to hook in to eevvvveerryyything via __blahblah__
functions, for memory access eevveryyyything, in the "profiling".

but that shouldn't be too hard (but would result in a performance
hit - oh well, can't have everything).

execution itself (from leo) could be performed via "yield".

ok.  you can obtain a list of all variables (global etc.)
that a particular function modifies, right?

so, before you go into any function, right, you record the
previous "state".

in fact, you might be able to record "state" on a per-line
basis (bit extreme i know) and basically have an "undo" stack

yeh.  it's very simple.   look up how "undo" is implemented,
in editors, and then treat all variables like that.

then, you can keep a record (using Leo) of which lines were
modified, and use that to calculate which bits need JIT
recompilation and how far back the "undo" stack you need to
roll.

(Continue reading)

Paul deGrandis | 3 Apr 2007 18:45
Picon
Gravatar

Re: Towards pypy-jvm

Hey guys, (and everyone else)

I was working on an autonomic computing project using JDK6, and in the middle decided to switch up to hacking on PyPy and seeing if I could get a semi-functioning JSR-223 bindings by the end of the week.  I svn uped, and wanted know if this release has any of the work the at you guys did?

If not, let me know, and i'll get working so we can get a JVM translated PyPy

Paul

On 4/1/07, Antonio Cuni < anto.cuni <at> gmail.com> wrote:
Niko Matsakis wrote:
>> The last time I checked what java's Hasttable offers and I saw you
>> can't pass to it custom hashing and equality functions, but maybe
>> there is a simple way to do it that I don't know.
>
> No, there isn't, but it shouldn't be too hard to cook up some kind of
> Hashtable substitute that uses small wrapper classes to handle that.  I
> think that's what you did for C#, right?

No, for .NET it was simpler because the standard Dictionary type also
accepts an optional class that implements the custom functions, so all I
need to do is to create a class for each unique pair of equality and
hashing functions (see cli/comparer.py).

ciao Anto
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev
Niko Matsakis | 3 Apr 2007 20:06
Picon
Favicon
Gravatar

Re: Towards pypy-jvm

> No, for .NET it was simpler because the standard Dictionary type  
> also accepts an optional class that implements the custom  
> functions, so all I need to do is to create a class for each unique  
> pair of equality and hashing functions (see cli/comparer.py).

So, on a whim I implemented a "RDict" class for the JVM that does the  
necessary adaptation.  (It consists almost entirely of generic type  
declarations and no actual code ;)  I haven't integrated it into the  
Python code yet, looking to see where best to do that.

Are most of the tests for custom dicts in test_objectmodel?  Also,  
why are they called "rdicts" in some places, and "custom dicts" in  
others?  Or is there a distinction I am missing?

Niko
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Niko Matsakis | 4 Apr 2007 09:54
Picon
Favicon
Gravatar

Re: Towards pypy-jvm

> Some weeks ago I also tried to translate pypy-jvm; it seems that  
> the two most important missing features are r_dict and weakrefs.

Ok, I implemented r_dicts now and checked it in.  Not too much work,  
actually, ended up fitting fairly naturally into the existing code.   
I guess I'll look at weakrefs next, though no promises as to when  
that will be. :)

Niko
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Antonio Cuni | 4 Apr 2007 14:39
Picon
Gravatar

Re: Towards pypy-jvm

Niko Matsakis wrote:
>> Some weeks ago I also tried to translate pypy-jvm; it seems that the 
>> two most important missing features are r_dict and weakrefs.
> 
> Ok, I implemented r_dicts now and checked it in.  Not too much work, 
> actually, ended up fitting fairly naturally into the existing code.  I 

Hi Niko!
This is very cool!  :-)
Most of r_dict tests are in test_objectmodel, though you may want to 
have also a look at rpython/test/test_rconstantdict.

About the distinction between r_dict and "custom dict": do you find any 
place where they are used interchangeably?
I would say that r_dict referes so the rpython-level type 
(objectmodel.r_dict), while "custom dict" should refer to the low level 
type used by the rtyper (ootype.CustomDict). Also, probably CustomDict 
would be a better name than RDict for your java class, I guess.

 > guess I'll look at weakrefs next, though no promises as to when that
 > will be. :)

Adding weakrefs to gencli was very simple: I just needed to map 
lltypesystem.llmemory.WeakGcAddress to 'System.WeakReference', add the 
straightforward support for constants to cli/constant.py and add the 
also straightforward 'cast_ptr_to_weakadr' and 'cast_weakadr_to_ptr' 
operations in opcodes.py.
I don't know for jvm, but I guess it would not be much more complicate.

ciao Anto
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Niko Matsakis | 4 Apr 2007 15:05
Picon
Favicon
Gravatar

Re: Towards pypy-jvm

> Most of r_dict tests are in test_objectmodel, though you may want  
> to have also a look at rpython/test/test_rconstantdict.

Ah, ok.

> About the distinction between r_dict and "custom dict": do you find  
> any place where they are used interchangeably?

I guess not.  I just wasn't clear if they should be usable  
interchangeably or not.  As it happens, I renamed my Java class to  
CustomDict anyhow, because it was an implementation of the  
ootype.CustomDict, so it seemed right.

> Adding weakrefs to gencli was very simple: I just needed to map  
> lltypesystem.llmemory.WeakGcAddress to 'System.WeakReference', add  
> the straightforward support for constants to cli/constant.py and  
> add the also straightforward 'cast_ptr_to_weakadr' and  
> 'cast_weakadr_to_ptr' operations in opcodes.py.
> I don't know for jvm, but I guess it would not be much more  
> complicate.

Cool, I'll check it out.

Niko
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Gary Robinson | 5 Apr 2007 22:03

Releasing the GIL in CPython extensions?

Hello,

In PyPy's facilities for writing a CPython extension, would it be conceivable to have an option to release
the CPython GIL when the extension is entered and grab it back upon exit?

That would enable multiprocessing and could be extremely useful when the programmer knows he's not going
to modifying shared items during the execution of the extension.

Thanks,
Gary

--

-- 

Gary Robinson
CTO
Emergent Music, LLC
grobinson <at> goombah.com
207-942-3463
Company: http://www.goombah.com
Blog:    http://www.garyrobinson.net
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Simon Burton | 5 Apr 2007 22:16

Re: Releasing the GIL in CPython extensions?

On Thu, 5 Apr 2007 16:03:25 -0400
Gary Robinson <grobinson <at> goombah.com> wrote:

> 
> Hello,
> 
> In PyPy's facilities for writing a CPython extension, would it be conceivable to have an option to release
the CPython GIL when the extension is entered and grab it back upon exit?

It's easy enough to call the PyGIL_ functions manually from rpython..

Simon.
_______________________________________________
pypy-dev <at> codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev


Gmane