From benjamin at python.org Fri May 8 02:17:25 2009 From: benjamin at python.org (Benjamin Peterson) Date: Thu, 7 May 2009 19:17:25 -0500 Subject: [pypy-dev] removing stablecompiler Message-ID: <1afaf6160905071717h1948e1d9v901c8a4bb7c6b7cc@mail.gmail.com> A while ago, fijal and I were discussing how annoying it is to have to update stablecompiler every time one touches the AST of PyPy's compiler. He suggested that it had served its purpose and can now be deleted. That makes sense to me. Opinions? -- Regards, Benjamin From cfbolz at gmx.de Sun May 10 21:08:26 2009 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Sun, 10 May 2009 21:08:26 +0200 Subject: [pypy-dev] removing stablecompiler In-Reply-To: <1afaf6160905071717h1948e1d9v901c8a4bb7c6b7cc@mail.gmail.com> References: <1afaf6160905071717h1948e1d9v901c8a4bb7c6b7cc@mail.gmail.com> Message-ID: <4A07262A.3020204@gmx.de> Benjamin Peterson wrote: > A while ago, fijal and I were discussing how annoying it is to have to > update stablecompiler every time one touches the AST of PyPy's > compiler. He suggested that it had served its purpose and can now be > deleted. That makes sense to me. Opinions? I agree, although obviously the remaining uses of the stablecompiler in tests need to be killed before. Cheers, Carl Friedrich From anto.cuni at gmail.com Tue May 12 22:45:00 2009 From: anto.cuni at gmail.com (Antonio Cuni) Date: Tue, 12 May 2009 22:45:00 +0200 Subject: [pypy-dev] EP sprints Message-ID: <4A09DFCC.6030202@gmail.com> Hi all, the early bid deadline for europython is on may 14th: together with the fee you can also reserve the hotel room, but for doing that we need to know when we plan to do the sprint. IIRC, the idea was to do it before the conference, and maybe also after. Am I right? In this case, until when? I also see on the website that the hotel rooms are for three people: who is interested in sharing? ciao, Anto From pedronis at openend.se Wed May 13 09:31:40 2009 From: pedronis at openend.se (Samuele Pedroni) Date: Wed, 13 May 2009 09:31:40 +0200 Subject: [pypy-dev] EP sprints In-Reply-To: <4A09DFCC.6030202@gmail.com> References: <4A09DFCC.6030202@gmail.com> Message-ID: <4A0A775C.8040303@openend.se> Antonio Cuni wrote: > Hi all, > > the early bid deadline for europython is on may 14th: together with the fee > you can also reserve the hotel room, but for doing that we need to know when > we plan to do the sprint. > > IIRC, the idea was to do it before the conference, and maybe also after. Am I > right? In this case, until when? > > I think Armin wanted to sprint both before and after. I think as long as there are at least two-three PyPy core people around at both points it makes some sense. At least for me it seems a bit inconvenient to be there at the first pre-conference sprint day (the sunday 28th). I would likely travel that day. > I also see on the website that the hotel rooms are for three people: who is > interested in sharing? > > ciao, > Anto > _______________________________________________ > pypy-dev at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-dev > From anto.cuni at gmail.com Thu May 14 11:24:37 2009 From: anto.cuni at gmail.com (Antonio Cuni) Date: Thu, 14 May 2009 11:24:37 +0200 Subject: [pypy-dev] EP sprints In-Reply-To: <4A0A775C.8040303@openend.se> References: <4A09DFCC.6030202@gmail.com> <4A0A775C.8040303@openend.se> Message-ID: <4A0BE355.9080005@gmail.com> Samuele Pedroni wrote: > I think Armin wanted to sprint both before and after. I think as long as > there are at least two-three PyPy core people around at both points it > makes some sense. +1 > At least for me it seems a bit inconvenient to be there at the first > pre-conference sprint day (the sunday 28th). > I would likely travel that day. now that I look closer at the calendar, I think I also would like to travel on 28th. So, I propose to do sprints on 29-3-4 (and book rooms accordingly). If there is anyone that plans to sprint on 28th, we can also put that day on the sprint announcement. ciao, Anto From lvsoft at gmail.com Wed May 20 02:43:27 2009 From: lvsoft at gmail.com (LvQi) Date: Wed, 20 May 2009 08:43:27 +0800 Subject: [pypy-dev] How to store RPython object in external c? Message-ID: Hi all, I'm learning how to use rffi and lltype system to access external C library in RPython. And in some case, I need to store RPython object in external C array. For example: class RPythonObj: def test(): return 1 .... .... c_source=py.code.Source(" void*store=NULL; void c_call_set(???){ store=???; } ??? c_call_get(){ return store; }") _c_call_set=llexternal("c_call_set", [???], lltype.Void, ...) _c_call_get=llexternal("c_call_get", [], ???, ...) def test(): o=RPythonObj() _c_call_set(o) o2=_c_call_get() o2.test() Is that possible? If so, what should I put in ??? Thanks very much~ -- Lv Qi Ph.D Candidate CS Department Nanjing University Nanjing 210093 China Tel: 86-138-5228-2381 -------------- next part -------------- An HTML attachment was scrubbed... URL: From fijall at gmail.com Wed May 20 03:01:09 2009 From: fijall at gmail.com (Maciej Fijalkowski) Date: Tue, 19 May 2009 19:01:09 -0600 Subject: [pypy-dev] How to store RPython object in external c? In-Reply-To: References: Message-ID: <693bc9ab0905191801s4c1cdf73i2b68685a7fbe29ef@mail.gmail.com> The answer is - you should not. You cannot safely cast rpython object to pointer, because it can move at any point in time. The way to do it is to store in external array an index to internal array, which really stores an object. On Tue, May 19, 2009 at 6:43 PM, LvQi wrote: > Hi all, > > ? I'm learning how to use rffi and lltype system to access external C > library in RPython. And in some case, I need to store RPython object in > external C array. For example: > > class RPythonObj: > ??? def test(): return 1 > ??? .... .... > c_source=py.code.Source(" > void*store=NULL; > > void c_call_set(???){ > ?? store=???; > } > ??? c_call_get(){ > ??? return store; > }") > > _c_call_set=llexternal("c_call_set", [???], lltype.Void, ...) > _c_call_get=llexternal("c_call_get", [], ???, ...) > > def test(): > ??? o=RPythonObj() > ??? _c_call_set(o) > ??? o2=_c_call_get() > ??? o2.test() > > Is that possible? If so, what should I put in ??? > Thanks very much~ > > -- > Lv Qi > Ph.D Candidate > CS Department > Nanjing University > Nanjing 210093 > China > Tel: 86-138-5228-2381 > > _______________________________________________ > pypy-dev at codespeak.net > http://codespeak.net/mailman/listinfo/pypy-dev > From fijall at gmail.com Wed May 20 03:50:54 2009 From: fijall at gmail.com (Maciej Fijalkowski) Date: Tue, 19 May 2009 19:50:54 -0600 Subject: [pypy-dev] How to store RPython object in external c? In-Reply-To: References: <693bc9ab0905191801s4c1cdf73i2b68685a7fbe29ef@mail.gmail.com> <693bc9ab0905191828xe9685c1meaab8668f66e92a2@mail.gmail.com> Message-ID: <693bc9ab0905191850j204df3b1oe1568ab4fe53b7f1@mail.gmail.com> On Tue, May 19, 2009 at 7:33 PM, LvQi wrote: > OK, Thanks~ I'm pretty new to this. I'm not sure I can do this tricks very > easily~~ > I'll store it internal first, and leave performance improvement later. > > Thanks~~ > Out of curiosity, what are you doing? We would like to know a bit more, especially if it's open source :-) cheers, fijal From lac at openend.se Wed May 20 17:24:42 2009 From: lac at openend.se (Laura Creighton) Date: Wed, 20 May 2009 17:24:42 +0200 Subject: [pypy-dev] PyPy Sprint Message-ID: <200905201524.n4KFOgkK003955@theraft.openend.se> Can people edit http://wiki.europython.eu/Sprints or make something on codespeak and then link to it there. Not enough people are signed up for sprinting, and John wonders if it is worth it to rent the rooms -- he is considering cancelling. Laura From pedronis at openend.se Fri May 22 11:56:50 2009 From: pedronis at openend.se (Samuele Pedroni) Date: Fri, 22 May 2009 11:56:50 +0200 Subject: [pypy-dev] PyPy Sprint In-Reply-To: <200905201524.n4KFOgkK003955@theraft.openend.se> References: <200905201524.n4KFOgkK003955@theraft.openend.se> Message-ID: <4A1676E2.6000401@openend.se> Laura Creighton wrote: > Can people edit > http://wiki.europython.eu/Sprints > > or make something on codespeak and then link to it there. > Not enough people are signed up for sprinting, and John wonders if > it is worth it to rent the rooms -- he is considering cancelling. > > I wanted to put a link to our drafted sprint announcement, but is seems it is not republished on codespeak even if it is in the repo, someone with root on codespeak needs to investigate. I was waiting for Armin to be back around to discuss/fill in the topics part. FWIW I already booked my flights and conference assuming to sprint one day before and two after. Samuele From pedronis at openend.se Fri May 22 13:33:22 2009 From: pedronis at openend.se (Samuele Pedroni) Date: Fri, 22 May 2009 13:33:22 +0200 Subject: [pypy-dev] Let's help the EP organizers with sprint planning Message-ID: <4A168D82.4080806@openend.se> Hi, it would be nice if at least people with commit access and who plan to be at the EP sprints this year would put in their dates in the usual planning file by next week: extradoc/sprintinfo/ep2009/people.txt Also we should really think of finalizing the announcement next week with some topics. Thanks, Samuele From lac at openend.se Sun May 24 14:56:12 2009 From: lac at openend.se (Laura Creighton) Date: Sun, 24 May 2009 14:56:12 +0200 Subject: [pypy-dev] speaking at Europython Message-ID: <200905241256.n4OCuCHq014438@theraft.openend.se> John would like a Bio from Carl Friedrich, and Armin, and a better Bio from Samuele. Pictures for the website, too. 'you've been herded' :) Laura From yung2.alan at gmail.com Thu May 28 05:46:24 2009 From: yung2.alan at gmail.com (alan yung) Date: Wed, 27 May 2009 20:46:24 -0700 Subject: [pypy-dev] question on rpython stack reconstruction feature Message-ID: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> I tried to use rstack's functions to reconstruct interpreter level stack like following.. http://sourceforge.net/tracker/?func=browse&group_id=58965&atid=489447&status=2 I've implemented them as interpreter level functions. In freeze(), I captured python level frame objects, and try to unwind the stack with stack_unwind, and in resume() I try to reconstruct the c frame stack with resume_state_create/invoke and python frame with cloned frames. But it seems like it doesn't take effect at all (I tested it under stackless enabled translated version of pypy) What am I doing wrong? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From arigo at tunes.org Thu May 28 21:57:25 2009 From: arigo at tunes.org (Armin Rigo) Date: Thu, 28 May 2009 21:57:25 +0200 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> Message-ID: <20090528195725.GA3640@code0.codespeak.net> Hi, On Wed, May 27, 2009 at 08:46:24PM -0700, alan yung wrote: > I tried to use rstack's functions to reconstruct interpreter level stack > like following.. > > http://sourceforge.net/tracker/?func=browse&group_id=58965&atid=489447&status=2 Sorry, your e-mail is hard to understand, probably because the link above seems to be wrong. It just points to the list of bugs for the Supybot project. Can you fix it and also explain a bit more what you are trying to achieve and why? Thanks! A bientot, Armin. From yung2.alan at gmail.com Thu May 28 22:10:15 2009 From: yung2.alan at gmail.com (alan yung) Date: Thu, 28 May 2009 13:10:15 -0700 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <20090528195725.GA3640@code0.codespeak.net> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> Message-ID: <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> Hi, Thanks and sorry about the link. The right link is http://paste.pocoo.org/show/119296/ this. What I'm trying to do there is this: In the freeze() function, I want to stop executing the current python function, and copy the (python) frame stack, and unroll the python frame stack *and* interpreter level stack frame. In the resume() function, I want to continue executing the python function copied in freeze() function and reconstruct interpreter level stack using resume_state_create() and resume_state_invoke() function. On Thu, May 28, 2009 at 12:57 PM, Armin Rigo wrote: > Hi, > > On Wed, May 27, 2009 at 08:46:24PM -0700, alan yung wrote: > > I tried to use rstack's functions to reconstruct interpreter level stack > > like following.. > > > > > http://sourceforge.net/tracker/?func=browse&group_id=58965&atid=489447&status=2 > > Sorry, your e-mail is hard to understand, probably because the link > above seems to be wrong. It just points to the list of bugs for the > Supybot project. Can you fix it and also explain a bit more what you > are trying to achieve and why? Thanks! > > > A bientot, > > Armin. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From santagada at gmail.com Thu May 28 23:12:39 2009 From: santagada at gmail.com (Leonardo Santagada) Date: Thu, 28 May 2009 18:12:39 -0300 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> Message-ID: <63865CD3-448B-441E-BAEF-E5F8663F4143@gmail.com> On May 28, 2009, at 5:10 PM, alan yung wrote: > Hi, > > Thanks and sorry about the link. > > The right link is http://paste.pocoo.org/show/119296/ this. > > What I'm trying to do there is this: > > In the freeze() function, I want to stop executing the current > python function, and copy the (python) frame stack, and unroll the > python frame stack *and* interpreter level stack frame. > > In the resume() function, I want to continue executing the python > function copied in freeze() function and reconstruct interpreter > level stack using resume_state_create() and resume_state_invoke() > function. > On Thu, May 28, 2009 at 12:57 PM, Armin Rigo wrote: > Hi, > Sorry, your e-mail is hard to understand, probably because the link > above seems to be wrong. It just points to the list of bugs for the > Supybot project. Can you fix it and also explain a bit more what you > are trying to achieve and why? Thanks! I think you forgot to answer why are you doing it? I don't know much about stackless but this seems very similar to what stackless does on pypy (which has stackless at the rpython/interpreter level). -- Leonardo Santagada santagada at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From yung2.alan at gmail.com Thu May 28 23:36:51 2009 From: yung2.alan at gmail.com (alan yung) Date: Thu, 28 May 2009 14:36:51 -0700 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <63865CD3-448B-441E-BAEF-E5F8663F4143@gmail.com> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <63865CD3-448B-441E-BAEF-E5F8663F4143@gmail.com> Message-ID: <6b6a329a0905281436w31693618r482557e738306b90@mail.gmail.com> > > What I'm trying to do there is this: > > In the freeze() function, I want to stop executing the current python > function, and copy the (python) frame stack, and unroll the python frame > stack *and* interpreter level stack frame. > > In the resume() function, I want to continue executing the python function > copied in freeze() function and reconstruct interpreter level stack using > resume_state_create() and resume_state_invoke() function. > > I think you forgot to answer why are you doing it? > > > I don't know much about stackless but this seems very similar to what > stackless does on pypy (which has stackless at the rpython/interpreter > level). > Except that I'm playing with the main thread stack. I'm just playing with stackless feature, and I see no reason this should not work... > > -- > Leonardo Santagada > santagada at gmail.com > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfbolz at gmx.de Fri May 29 11:44:32 2009 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Fri, 29 May 2009 11:44:32 +0200 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> Message-ID: <4A1FAE80.6060701@gmx.de> alan yung wrote: > Thanks and sorry about the link. > > The right link is http://paste.pocoo.org/show/119296/ this. > > What I'm trying to do there is this: > > In the freeze() function, I want to stop executing the current python > function, and copy the (python) frame stack, and unroll the python frame > stack *and* interpreter level stack frame. > > In the resume() function, I want to continue executing the python > function copied in freeze() function and reconstruct interpreter level > stack using resume_state_create() and resume_state_invoke() function. Where do you actually put those functions? How do you call them? What's the error/behaviour you get? Cheers, Carl Friedrich From yung2.alan at gmail.com Fri May 29 17:19:27 2009 From: yung2.alan at gmail.com (alan yung) Date: Fri, 29 May 2009 08:19:27 -0700 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <4A1FAE80.6060701@gmx.de> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <4A1FAE80.6060701@gmx.de> Message-ID: <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> On Fri, May 29, 2009 at 2:44 AM, Carl Friedrich Bolz wrote: > alan yung wrote: > >> Thanks and sorry about the link. >> The right link is http://paste.pocoo.org/show/119296/ this. >> >> What I'm trying to do there is this: >> In the freeze() function, I want to stop executing the current python >> function, and copy the (python) frame stack, and unroll the python frame >> stack *and* interpreter level stack frame. >> In the resume() function, I want to continue executing the python >> function copied in freeze() function and reconstruct interpreter level stack >> using resume_state_create() and resume_state_invoke() function. >> > > Where do you actually put those functions? How do you call them? What's the > error/behaviour you get? > I implemented a (mixed) module, and implemented those functions as interpreter level functions, and made them callable from application level. I called them from normal Python application (in stackless translated pypy vm) and the behaviour is that they don't have any effect. There's no (interpreter level/application level) stack unwinding or resuming. thanks. > > Cheers, > > Carl Friedrich > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfbolz at gmx.de Fri May 29 18:04:51 2009 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Fri, 29 May 2009 18:04:51 +0200 Subject: [pypy-dev] Europython Sprint Announcement Message-ID: <4A2007A3.7020903@gmx.de> ================================================================== Birmingham (UK) EuroPython PyPy Sprints 28-29 June/ 3-4 July 2009 ================================================================== The PyPy team is sprinting at EuroPython again. This year there are `sprint days`_ before (28-29 June) and after (3-4 July) the conference. Some PyPy core people should be present during both periods. .. _`sprint days`: http://wiki.europython.eu/Sprints If you plan to attend the sprints after the conference we recommend you to listen to the PyPy technical talk (`EuroPython schedule`_) during the conference since it will give you a good overview of the status of development. Goals and topics of the sprint ------------------------------ There are many possible and interesting sprint topics to work on - here we list some possible task areas: - trying out software on PyPy's Python interpreter: the CPython test suite is not all that complete, therefore the fact that we pass most tests is no real indication of bug-freeness. We have tried and know that frameworks like Django and Twisted work with PyPy. Therefore we would like to try running more "real applications" on top of the Python interpreter (ideally ones that have a good test suite themselves and that don't need unusual extension modules). Running things on Windows is also interesting, we know our coverage there is not as good as on Linux. - check and improve Mac OS X support - starting to work on porting 2.6 features to PyPy's Python interpreter - ongoing JIT generator work - of course we are open to other ideas for what to work on. Examples could be working on other language interpreters, sandboxing, ... ------------ Registration ------------ If you'd like to come, please subscribe to the `pypy-sprint mailing list`_ and drop a note about your interests and post any questions. More organisational information will be sent to that list. Please register by adding yourself on the following list (via svn): http://codespeak.net/svn/pypy/extradoc/sprintinfo/ep2009/people.txt or on the pypy-sprint mailing list if you do not yet have check-in rights: http://codespeak.net/mailman/listinfo/pypy-sprint --------------------------------------- Preparation (if you feel it is needed): --------------------------------------- - read the `getting-started`_ pages on http://codespeak.net/pypy, especially also the `development of PyPy itself part`_ . - for inspiration, overview and technical status you are welcome to read `the technical reports available and other relevant documentation`_ - please direct any technical and/or development oriented questions to pypy-dev at codespeak.net and any sprint organizing/logistical questions to pypy-sprint at codespeak.net - if you need information about the conference, potential hotels, directions etc we recommend to look at http://www.europython.eu. We are looking forward to meet you at the EuroPython PyPy sprints! The PyPy team .. See also .. .. _getting-started: http://codespeak.net/pypy/dist/pypy/doc/getting-started.html .. _`development of PyPy itself part`: http://codespeak.net/pypy/dist/pypy/doc/getting-started-dev.html .. _`pypy-sprint mailing list`: http://codespeak.net/mailman/listinfo/pypy-sprint .. _`the technical reports available and other relevant documentation`: http://codespeak.net/pypy/dist/pypy/doc/docindex.html .. _`EuroPython schedule`: http://europython.eu/talks/timetable From arigo at tunes.org Fri May 29 18:13:16 2009 From: arigo at tunes.org (Armin Rigo) Date: Fri, 29 May 2009 18:13:16 +0200 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <4A1FAE80.6060701@gmx.de> <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> Message-ID: <20090529161316.GA8754@code0.codespeak.net> Hi Alan, On Fri, May 29, 2009 at 08:19:27AM -0700, alan yung wrote: > I called them from normal Python application (in stackless translated pypy > vm) and the behaviour is that they don't have any effect. There's no > (interpreter level/application level) stack unwinding or resuming. Ah, that's step 1. I see. As this is RPython code, it means that you cannot use some constructs -- in this case, the problem is that "if not freezed_executioncontext:" is constant-folded, so it is always True (which is of course not the case in a normal Python program). You don't have varying global lists in RPython, so you need to create a small class, create a global instance of it, and then you can read/write an attribute "freeze_executioncontext" on it. A bientot, Armin. From yung2.alan at gmail.com Sat May 30 05:23:52 2009 From: yung2.alan at gmail.com (alan yung) Date: Fri, 29 May 2009 20:23:52 -0700 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <20090529161316.GA8754@code0.codespeak.net> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <4A1FAE80.6060701@gmx.de> <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> <20090529161316.GA8754@code0.codespeak.net> Message-ID: <6b6a329a0905292023r62a9c13bqb4b5e79acdfd6d6b@mail.gmail.com> Thanks Armin. I fixed the code accordingly, and resume() function seems to be (somehow) working. However, freeze() function does not work the way I wanted. Following is how I fixed it. http://paste.pocoo.org/show/119851/ After translating pypy with stackless option with above code, I ran following python code def foo(): def foo2(): freeze() print "foo" foo2() def bar(): print "bar" resume() if __name__ == '__main__': foo() bar() resume() function needs to be fixed alittle bit, but when I run above code, I wanted it to print out "bar" first, and not "foo" but it prints out "foo" first. So, it seems like rstack.stack_unwind() function does not seems to work. Any thought? On Fri, May 29, 2009 at 9:13 AM, Armin Rigo wrote: > Hi Alan, > > On Fri, May 29, 2009 at 08:19:27AM -0700, alan yung wrote: > > I called them from normal Python application (in stackless translated > pypy > > vm) and the behaviour is that they don't have any effect. There's no > > (interpreter level/application level) stack unwinding or resuming. > > Ah, that's step 1. I see. As this is RPython code, it means that you > cannot use some constructs -- in this case, the problem is that "if not > freezed_executioncontext:" is constant-folded, so it is always True > (which is of course not the case in a normal Python program). You don't > have varying global lists in RPython, so you need to create a small > class, create a global instance of it, and then you can read/write an > attribute "freeze_executioncontext" on it. > > > A bientot, > > Armin. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arigo at tunes.org Sat May 30 09:00:58 2009 From: arigo at tunes.org (Armin Rigo) Date: Sat, 30 May 2009 09:00:58 +0200 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <6b6a329a0905292023r62a9c13bqb4b5e79acdfd6d6b@mail.gmail.com> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <4A1FAE80.6060701@gmx.de> <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> <20090529161316.GA8754@code0.codespeak.net> <6b6a329a0905292023r62a9c13bqb4b5e79acdfd6d6b@mail.gmail.com> Message-ID: <20090530070058.GA28057@code0.codespeak.net> Hi Alan, On Fri, May 29, 2009 at 08:23:52PM -0700, alan yung wrote: > So, it seems like rstack.stack_unwind() function does not seems to work. It seems you misunderstood what rstack.stack_unwind() does. It flushes the C stack, but it has no visible effect apart from reducing the consumption of the C stack. A bientot, Armin. From yung2.alan at gmail.com Sat May 30 09:10:55 2009 From: yung2.alan at gmail.com (alan yung) Date: Sat, 30 May 2009 00:10:55 -0700 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <20090530070058.GA28057@code0.codespeak.net> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <4A1FAE80.6060701@gmx.de> <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> <20090529161316.GA8754@code0.codespeak.net> <6b6a329a0905292023r62a9c13bqb4b5e79acdfd6d6b@mail.gmail.com> <20090530070058.GA28057@code0.codespeak.net> Message-ID: <6b6a329a0905300010p35b6726w8026fe461c7d1d91@mail.gmail.com> On Sat, May 30, 2009 at 12:00 AM, Armin Rigo wrote: > Hi Alan, > > On Fri, May 29, 2009 at 08:23:52PM -0700, alan yung wrote: > > So, it seems like rstack.stack_unwind() function does not seems to work. > > It seems you misunderstood what rstack.stack_unwind() does. It flushes > the C stack, but it has no visible effect apart from reducing the > consumption of the C stack. > But in the freeze() function, I also cleared app level frames like following... while len(ec.framestack.items) > 1: ec.framestack.pop() stack_unwind() In that case, I thought this should stop executing the (app-level) function, shouldn't it? > > > A bientot, > > Armin. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arigo at tunes.org Sat May 30 12:26:47 2009 From: arigo at tunes.org (Armin Rigo) Date: Sat, 30 May 2009 12:26:47 +0200 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <6b6a329a0905300010p35b6726w8026fe461c7d1d91@mail.gmail.com> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <4A1FAE80.6060701@gmx.de> <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> <20090529161316.GA8754@code0.codespeak.net> <6b6a329a0905292023r62a9c13bqb4b5e79acdfd6d6b@mail.gmail.com> <20090530070058.GA28057@code0.codespeak.net> <6b6a329a0905300010p35b6726w8026fe461c7d1d91@mail.gmail.com> Message-ID: <20090530102647.GA23188@code0.codespeak.net> Hi Alan, On Sat, May 30, 2009 at 12:10:55AM -0700, alan yung wrote: > But in the freeze() function, I also cleared app level frames like > following... > > while len(ec.framestack.items) > 1: > ec.framestack.pop() > > stack_unwind() > > In that case, I thought this should stop executing the (app-level) function, > shouldn't it? No: as I said, stack_unwind() has no effect apart from keeping the usage of the C stack under control, so we can ignore it for the purpose of understanding how this code works. It just empties ec.framestack, but the real stack of interp-level calls is still there. So this code just creates a discrepancy between ec.framestack and the call stack -- and the call stack wins, as PyPy's interpreter is implemented using the call stack (like CPython's interpreter). Enabling stackless in this code changes this fact but at another level. It's like stack_unwind(): calling it has no visible effect from RPython code; it just temporary reduces the C stack depth. Similarly, Stackless in PyPy is implemented by calling stack_unwind() internally as needed, so that the C stack depth can be reduced -- but the PyPy interpreter is still written in a recursive style. "Reducing the C stack depth" mostly means copying a part of the C stack away into the heap, where it can be re-read later. A bientot, Armin. From yung2.alan at gmail.com Sat May 30 23:15:06 2009 From: yung2.alan at gmail.com (alan yung) Date: Sat, 30 May 2009 14:15:06 -0700 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <20090530102647.GA23188@code0.codespeak.net> References: <6b6a329a0905272046p5ae48472r3a02a3dbb04e8c0e@mail.gmail.com> <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <4A1FAE80.6060701@gmx.de> <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> <20090529161316.GA8754@code0.codespeak.net> <6b6a329a0905292023r62a9c13bqb4b5e79acdfd6d6b@mail.gmail.com> <20090530070058.GA28057@code0.codespeak.net> <6b6a329a0905300010p35b6726w8026fe461c7d1d91@mail.gmail.com> <20090530102647.GA23188@code0.codespeak.net> Message-ID: <6b6a329a0905301415n371120deqe5fea22b4e992148@mail.gmail.com> > > On Sat, May 30, 2009 at 12:10:55AM -0700, alan yung wrote: > > But in the freeze() function, I also cleared app level frames like > > following... > > > > while len(ec.framestack.items) > 1: > > ec.framestack.pop() > > > > stack_unwind() > > > > In that case, I thought this should stop executing the (app-level) > function, > > shouldn't it? > > No: as I said, stack_unwind() has no effect apart from keeping the usage > of the C stack under control, so we can ignore it for the purpose of > understanding how this code works. It just empties ec.framestack, but > the real stack of interp-level calls is still there. So this code just > creates a discrepancy between ec.framestack and the call stack -- and > the call stack wins, as PyPy's interpreter is implemented using the call > stack (like CPython's interpreter). > > Enabling stackless in this code changes this fact but at another level. > It's like stack_unwind(): calling it has no visible effect from RPython > code; it just temporary reduces the C stack depth. Similarly, Stackless > in PyPy is implemented by calling stack_unwind() internally as needed, > so that the C stack depth can be reduced -- but the PyPy interpreter is > still written in a recursive style. "Reducing the C stack depth" mostly > means copying a part of the C stack away into the heap, where it can be > re-read later. > Oh I see. This is interesting. If I do something like following (raising UnwindException in the freeze function) from pypy.translator.stackless.code import UnwindException def freeze(space): global storedExecutionContext ec = space.getexecutioncontext() storedExecutionContext.copy(ec) while len(ec.framestack.items) > 1: ec.framestack.pop() raise UnwindException() freeze.unwrap_spec = [ObjSpace] Now I guess it should stop executing the current python level functions, shouldn't it? > > > A bientot, > > Armin. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arigo at tunes.org Sun May 31 17:31:14 2009 From: arigo at tunes.org (Armin Rigo) Date: Sun, 31 May 2009 17:31:14 +0200 Subject: [pypy-dev] question on rpython stack reconstruction feature In-Reply-To: <6b6a329a0905301415n371120deqe5fea22b4e992148@mail.gmail.com> References: <20090528195725.GA3640@code0.codespeak.net> <6b6a329a0905281310p3c50f3b0v2bd3767e59a36ca9@mail.gmail.com> <4A1FAE80.6060701@gmx.de> <6b6a329a0905290819o70d21a36yca1f17a8656e35fe@mail.gmail.com> <20090529161316.GA8754@code0.codespeak.net> <6b6a329a0905292023r62a9c13bqb4b5e79acdfd6d6b@mail.gmail.com> <20090530070058.GA28057@code0.codespeak.net> <6b6a329a0905300010p35b6726w8026fe461c7d1d91@mail.gmail.com> <20090530102647.GA23188@code0.codespeak.net> <6b6a329a0905301415n371120deqe5fea22b4e992148@mail.gmail.com> Message-ID: <20090531153114.GA3087@code0.codespeak.net> Hi Alan, On Sat, May 30, 2009 at 02:15:06PM -0700, alan yung wrote: > raise UnwindException() All you're archieving this way is confuse the system (and me). However, I think I get the idea. You want to interrupt the current thread completely, in the idea that later it can be restarted by your resume() function. You should not do that by raising UnwindException; just raise another exception you define locally. Of course you must then also catch it somewhere. A bientot, Armin.