Re: The new Perl 6 compiler pumpking
Dan Sugalski sent the following bits through the ether: I'd like everyone to give a welcome to Patrick Michaud, who's volunteered to officially take charge of getting the Perl 6 compiler module written. Welcome Patrick! What's your plan of attack? Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Taglines not comprehensible are
Re: ICU Outdated - Ideas
Dan Sugalski sent the following bits through the ether: If someone's tempted to do 3) Write our own Unicode system, I'm OK with that too. The string internals doc needs writing, and I can get that done. IIRC the mono people wrote their own, but with the ICU data files. Apart from license issues, this might be an interesting thing to look at. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Better to understand a little than to misunderstand a lot
[PATCH] remove unused parameter from pbc.c
Removes a warning. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... We're not worthy! We're not worthy! Index: imcc/pbc.c === RCS file: /cvs/public/parrot/imcc/pbc.c,v retrieving revision 1.69 diff -u -r1.69 pbc.c --- imcc/pbc.c 18 Mar 2004 08:56:58 - 1.69 +++ imcc/pbc.c 31 Mar 2004 09:56:29 - @@ -214,7 +214,7 @@ /* allocate a new globals.cs-subs structure */ static void -make_new_sub(struct Parrot_Interp *interpreter, IMC_Unit * unit) +make_new_sub(struct Parrot_Interp *interpreter) { struct subs *s = mem_sys_allocate_zeroed(sizeof(struct subs)); if (!s) @@ -846,7 +846,7 @@ if (!unit-instructions) return 0; -make_new_sub(interpreter, unit); /* we start a new compilation unit */ +make_new_sub(interpreter); /* we start a new compilation unit */ return 0; }
[PATCH] longness in pf_items.c
On our shiny 64-bit Opteron box I get a warning here. This silences the warning. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Borg? Where? I don't se*(#$#..NO CARRIER Index: pf/pf_items.c === RCS file: /cvs/public/parrot/pf/pf_items.c,v retrieving revision 1.13 diff -u -r1.13 pf_items.c --- pf/pf_items.c 4 Mar 2004 11:15:52 - 1.13 +++ pf/pf_items.c 31 Mar 2004 09:59:19 - @@ -572,7 +572,7 @@ } } } -assert( ((int)charcursor 3) == 0); +assert( ((long)charcursor 3) == 0); LVALUE_CAST(char *, cursor) = charcursor; return cursor; }
Re: [PATCH] signals under x86_64
Leopold Toetsch sent the following bits through the ether: Is this available on e.g. Windows? Possibly, it's just POSIX. I have no way to test this however. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Bother, said Pooh as the brakes went out!
Re: [PATCH] remove unused parameter from pbc.c
Leopold Toetsch sent the following bits through the ether: Both interpreter and unit aren't unused, if JIT is enabled. Changed a bit. Ooh. Oops. Anyway, warnings bad. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Always remember you're unique, just like everyone else
Re: Fwd: TALK:4-5-04 A (Grand?) Unified Theory of Storage Reclamation
Dan Sugalski sent the following bits through the ether: A (Grand?) Unified Theory of Storage Reclamation Slides here: http://www.research.ibm.com/people/d/dfb/talks/Bacon04Grand.ppt Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... A living example of Artificial Intelligence
Re: Objects and time
Dan Sugalski sent the following bits through the ether: So, the question--shall we do objects and maybe miss the Feb 29th release, or do the Feb 29th release and do objects for the next release? Objects please! Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... That's Ren and Stimpy - they're way existential
Re: The Great Renaming
Brent Dax sent the following bits through the ether: Are there any objections to this? Sounds good. For embedding (eg Ponie), we're going to have to make sure that all symbols start with parrot_ / Parrot_... Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Press any key...NO, NO, NO, NOT THAT ONE!!
Re: Missing Ops
Leopold Toetsch sent the following bits through the ether: 1) should these ops just be implemented or At this point we want to make it really easy to target parrot. I know it's not hard to work around these exceptions, but I reckon implementing the complete set of ops for now would be a good idea. We can always move the logic into the assembler later if we decide to prune ops. ObLeonBrocard: he just be restin', arrr -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... I was young, I needed the money
Re: Approaching m4
Bernhard Schmalhofer sent the following bits through the ether: Is there already a testing framework in PIR or PASM? For now I've just tweaked the Makefile from bf. This looks excellent. First, may I be the first to say that I'm happy that BF is the inspiration for so many Parrot projects ;-) We've used the Perl testing framework (Test::Harness, eg: 1..1\nok 1) in the main parrot test suite. It's working well for Perl and a Parrot version of it might be nice idea... Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... I'm not smart enough to lie
Re: subroutines and python status
K Stol sent the following bits through the ether: Actually, I named my little project pirate (s. http://members.home.nl/joeijoei/parrot for this) already, but it's a bit of a dead end already (although I learnt much of it), so I don't mind. Quick, we need more parrot jokes... I don't like things becoming dead-ends. How much work do you think it'd be to extend it some more and update it to latest Lua? Would it be worth checking this into parrot CVS? Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Dang this hobby is expensive!
Re: [perl #23085] [PATCH] Off by one error in exceptions.c
J?rgen B?mmels sent the following bits through the ether: The offending line is exceptions.c:123 if (m[strlen(m-1)] != '\n') Thanks, applied. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... It said, Insert disk #3, but only two will fit!
Re: [perl #23005] [PATCH] Parrot_sprintf not recognizing 7 in precision
mrnobo1024 sent the following bits through the ether: Parrot_sprintf isn't recognizing 7 as a number in the precision field, so trying to use that results in a '7' is not a valid sprintf format error. Thanks, patch applied. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Corrupt REALITY.SYS: Reboot Universe (Y/n)?
ponie
I just noticed that nobody had emailed perl6-internals about ponie, which was announced yesterday as OSCON. Ponie is perl 5 on parrot. For more info: http://use.perl.org/article.pl?sid=03/07/09/0237202 Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... C++ should have been called D
Re: [perl #22873] gentoo ebuild ... problem..
Leopold Toetsch sent the following bits through the ether: Unknown option: U perldoc [options] PageName|ModuleName|ProgramName... (perldoc is very likely from 5.005; version 1.14) I was a little hasty with the previous patch, sorry. I blame perldoc's man page for not sorting options alphabetically. I've reverted -U back to -u. We'll need to check the perldoc version and if it's a recent one with the annoying Superuser must not run /usr/bin/perldoc without security audit and taint checks. message then run it with -U as well as -u. Apologies, Leon ps and I was so proud of my first CVS commit too :-( -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... 668 - Neighbor of the Beast
Re: [perl #22873] gentoo ebuild ... problem..
raptor sent the following bits through the ether: As u may see the problem is when docs-generation is done ... the perldoc -U has to be used in docs/Makefile so the generation pass successfully.. At the moment it is perldoc -u Could u correct this thanx alot in advance. Thanks for the bug report. I've patched parrot in CVS to use perldoc -U. To be honest, I'm not entirely sure that any of us actually install parrot at the moment, but it is a great area to investigate. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... And now for something completely different...
Re: About RT/Perl
Alberto Sim?es/EPL sent the following bits through the ether: Anybody can tell me the address for RT/perl software? http://rt.perl.org/ is what you should be using to submit bugs (and patches!) HTH, Leon ps it runs http://www.bestpractical.com/rt/ -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Hackito ergo sum.
Re: A couple easy questions...
David sent the following bits through the ether: how can I test to determine the datatype of the object in P1? You'd be wanting typeof. The following prints out PerlString, for example: new P0, .PerlArray set P0[1], cat set P0[2], 123 set P0[3], 456.789 set P1, P0[1] typeof S0, P1 print S0 print \n end Leon ps i fixed your code -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Useless invention no. 404: Inflatable anchor
0.1.0
David sent the following bits through the ether: Thanks. I better upgrade my version, I'm not seeing it in 0.0.9. It's been a while since 0.0.9 (errr, 20th Dec). A lot has changed since then. Maybe it's time for a 0.1.0 release. What are we waiting for? And why do we have so many version numbers? It'd be nice to have objects, otherwise we're restricted to toy languages. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Komputors nefer maik erers
Re: 0.1.0
Dan Sugalski sent the following bits through the ether: While I'll call C many things (not all of them repeatable) I'm not sure toy is one of them. Nor Forth, Fortran, APL, COBOL, Lisp, or Basic... :) Granted, but those aren't the languages we're interested in. Parrot is for dynamic languages, and that gives away the fact that objects would help in their implementation. Objects are coming, though I've been too pressed for time recently. String rework first, then objects. Excellent. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... What's brown and sticky? A stick!
Parrot developer world map
Last week I collected your data. This week I bring you pretty pictures: http://www.astray.com/parrot/worldmap/ So London would seem a good place for a Parrot developer day, as would California. I guess most people will be meeting up at Perl conferences anyway. What do people have in mind for such a thing? A room, at least one computer, an internet connection and a Plan? Are you looking to learn more about Parrot or do you have something more specific in mind? Leon ps feel free to send in your location if you've forgotten to: -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Famous last words - Don't worry, I can handle it
Re: Parrot Developer Day(s)?
Dan Sugalski sent the following bits through the ether: Also, I know that we do have people scattered all over the world, but if someone wants to try and get a list of who's where, we may find it's worth it to get groups of people together. (I don't, after all, have to be involved... :) Right, I'm going to organise a sort of world map of Parrot developers. If you consider yourself a Parrot developer (ie write Parrot code, patches, assembler, whatever, the more the merrier!) please email me *privately* filling in the following form: Name: Email: Nickname: City: County/State: Country: Latitude: Longitude: The longitude and latitude should be +-DDD.DDD, that is decimal degrees. For example London, UK would be (51.500, -0.083). Useful resources for finding your longitude, latitude: http://www.getty.edu/research/tools/vocabulary/tgn/ http://www.ckdhr.com/dns-loc/finding.html Thanks! Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Famous last words - You and what army?
Re: Compiling to Parrot
K Stol sent the following bits through the ether: A few weeks ago I posted something about a Tcl-parrot compiler, but Will Coleda already was working on such a project. It would be a as a final project for my bachelor's. But because such already exists, I'm looking for something else. An interesting project to do would be to do a Java-Parrot compiler. Basing it on an existing Java compiler such as Jikes is probably the best way to do this: http://oss.software.ibm.com/developerworks/opensource/jikes/ You'd also probably use GNU Classpath: http://www.gnu.org/software/classpath/classpath.html HTH, Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Hmm... How *did* they finally kill Frosty?
Re: [perl #20400] [PATCH] ook.pasm eval
Leopold Toetsch sent the following bits through the ether: No PASM1 is the one-line assembler PDB_compile in debug.c. If you want the whole thing, you have to run imcc instead of parrot and with the PASM compiler, just as the comment states. Oops, I was confused. ook's 'make test' runs with parrot, so it doesn't work. I've attached a patch to config/gen/makefiles/ook.in to make it work with imcc, although I assume we'd want $(IMCC) to work at some point. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... Freedom defined is freedom denied Index: config/gen/makefiles/ook.in === RCS file: /cvs/public/parrot/config/gen/makefiles/ook.in,v retrieving revision 1.1 diff -u -r1.1 ook.in --- config/gen/makefiles/ook.in 1 Jan 2003 00:34:15 - 1.1 +++ config/gen/makefiles/ook.in 19 Jan 2003 18:02:38 - @@ -7,9 +7,7 @@ all: build test: build - $(PARROT) ook.pbc hello.ook foo.pasm - $(ASSEMBLE) foo.pasm foo.pbc - $(PARROT) foo.pbc + ../imcc/imcc -r ook.pasm test.ook build: ook.pasm $(ASSEMBLE) ook.pasm ook.pbc
Re: A work list! (Coming soon)
Nicholas Clark sent the following bits through the ether: This is possibly a big stuff wish list. I'm not sure how many are on the maybe never list. I'm a bear of very little brain, errr, a man of few wishes. I wish for: o objects o a make install which does something sensible Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ ... You're in a maze of twisty little Java VMs, all different
Curses Life
Leon Brocard sent the following bits through the ether: Now to get the hand of the signatures... Ah, well, I gave up on SDL as it was a little complicated. Instead, I played with curses. Please find attached a cute little curses life program loading and calling curses at runtime with dlfunc. Oh, and I made the shape a small spaceship as it's more interesting. [It's a bit of the pain the way it stomps over registers all the time, though ;-] Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ 43rd Law of Computing: Anything that can go wr... # # life.pasm # # Play conway's (no, not *him*. The other conway) game # of life # # Hacked by Leon Brocard [EMAIL PROTECTED] to use curses loadlib P1, libcurses.so dlfunc P0, P1, initscr, i invoke dlfunc P0, P1, curs_set, ii set I5, 0 invoke # First the generation count set I2, 5000 # Note the time time N5 # If true, we don't print set I12, 0 set S0, set S1, set S2, set S3, set S4, ** set S5, ** set S6, * set S7, * * set S8,** set S9, set S10, set S11, set S12, set S13, set S14, set S15, concat S15, S0 concat S15, S1 concat S15, S2 concat S15, S3 concat S15, S4 concat S15, S5 concat S15, S6 concat S15, S7 concat S15, S8 concat S15, S9 concat S15, S10 concat S15, S11 concat S15, S12 concat S15, S13 concat S15, S14 bsr dump set I0, 0 loop: ge I0, I2, getout inc I0 mod I31,I0,100 if I31, skip skip: bsr generate bsr dump branch loop getout: dlfunc P0, P1, curs_set, ii set I5, 1 invoke dlfunc P0, P1, endwin, i invoke end # S15 has the incoming string, S0 is scratch, S1 is scratch, S2 is scratch # # I0 is the length of the string # I1 is the current cell we're checking # I2 is the count for that cell # I3 is the offset to the neighbor generate: pushi length I0, S15 set S1, set I1, 0 genloop: set I2, 0 NW: set I3, -16 add I3, I3, I0 add I3, I3, I1 mod I3, I3, I0 substr S0, S15, I3, 1 ne S0, *, North inc I2 North: set I3, -15 add I3, I3, I0 add I3, I3, I1 mod I3, I3, I0 substr S0, S15, I3, 1 ne S0, *, NE inc I2 NE: set I3, -14 add I3, I3, I0 add I3, I3, I1 mod I3, I3, I0 substr S0, S15, I3, 1 ne S0, *, West inc I2 West: set I3, -1 add I3, I3, I0 add I3, I3, I1 mod I3, I3, I0 substr S0, S15, I3, 1 ne S0, *, East inc I2 East: set I3, 1 add I3, I3, I0 add I3, I3, I1 mod I3, I3, I0 substr S0, S15, I3, 1 ne S0, *, SW inc I2 SW: set I3, 14 add I3, I3, I0 add I3, I3, I1 mod I3, I3, I0 substr S0, S15, I3, 1 ne S0, *, South inc I2 South: set I3, 15 add I3, I3, I0 add I3, I3, I1 mod I3, I3, I0 substr S0, S15, I3, 1 ne S0, *, SE inc I2 SE: set I3, 16 add I3, I3, I0 add I3, I3, I1 mod I3, I3, I0 substr S0, S15, I3, 1 ne S0, *, check inc I2 check: substr S0, S15, I1, 1 eq S0, *, check_alive # If eq 3, put a star in else a space check_dead: eq I2, 3, star branch space check_alive: lt I2, 2, space gt I2, 3, space branch star space: concat S1, branch iter_done star: concat S1, * iter_done: inc I1 lt I1, I0, genloop done: set S15, S1 popi ret # S15 has the incoming string, S0 is scratch dump: saveall dlfunc P0, P1, move, iii set I5, 0 set I6, 0 invoke restoreall if I12, dumpend save I0 save I1 saveall save I0 dlfunc P0, P1, addstr, it set S5, Generation: invoke restore I0 dlfunc P0, P1, addstr, it set S5, I0 invoke dlfunc P0, P1, refresh, i invoke restoreall set I0, 0 set I1, 14 printloop: substr S0, S15, I0, 15 saveall dlfunc P0, P1, addstr, it set S5, S0 invoke
Re: Adding new function signatures to parrot's NCI call list
Dan Sugalski sent the following bits through the ether: pthreads tends to want to be part of the initial program load. FYI adding -lpthreads to C_LIBS and rebuilding parrot makes it work for me. Now to get the hand of the signatures... Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Help! Police! That guy stole my .sig! STOP!!! THIEF!!!
Re: Adding new function signatures to parrot's NCI call list
Dan Sugalski sent the following bits through the ether: Also, at the moment I can't test this OK, I've had a go. I'm basing the following on the code you mentioned at http://use.perl.org/~Elian/journal/9147 (of course, you should know better than to use exit in parrot assembler ;-) and basic code at http://www.libsdl.org/intro/usinginit.html: loadlib P1, libSDL-1.2.so.0 print Loaded...\n dlfunc P0, P1, SDL_Init, i print dlfunced...\n set I5, 48 # SDL_INIT_AUDIO|SDL_INIT_VIDEO invoke unless I5, OK print SDL_Init failed!\n end OK: print SDL_Init worked just fine\n end I get: Loaded... dlfunced... ../parrot: relocation error: /usr/lib/libSDL-1.2.so.0: undefined symbol: pthread_mutexattr_init Well, the C code on the page works fine, but of course you have to link it with -lpthread. How would I do this for the parrot code? Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ (Tagline 3 of 12) - Collect them all!
Re: C# and Parrot
Bryan C. Warnock sent the following bits through the ether: Interesting read. Dan skimmed over this, but what do .NET (and JVM) doe for floating point numbers? For the JVM: http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#19511 The floating-point types are float and double, which are conceptually associated with the 32-bit single-precision and 64-bit double-precision IEEE 754 values and operations as specified in IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Standard 754-1985 (IEEE, New York). More details at: http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#33377 HTH, Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Cryptonomicon: The girl's guide to geek guys
Re: C# and Parrot
Leon Brocard sent the following bits through the ether: It looks like the DotGNU weekly IRC meeting will be discussing Parrot. Could be interesting: It was quite interesting. I managed to make it to the early one and Dan to the later one. An annotated and abridged chatlog is available: http://dotgnu.info/pipermail/developers/2002-October/008380.html It looks like we're going to need 8,16,32,64 bit types... Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ 43rd Law of Computing: Anything that can go wr...
Re: C# and Parrot
Rhys Weatherley sent the following bits through the ether: The Portable.NET C# compiler, cscc, is very extensive, and is capable of generating output for multiple bytecode formats (IL and JVM are currently supported, more or less). Oh, excellent. If you're already targeting both then it should be fairly easy to target Parrot too (still-to-be-developed-features not withstanding. This is quite interesting indeed, especially if you have a good test suite ;-) I'll try and have a look at it over the weekend. Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Dyslexics of the world, untie!
Re: C# and Parrot
Rhys Weatherley sent the following bits through the ether: DotGNU is currently reaching out to other projects in the OSS/FS world to see how we can help you and how you might be able to help us. It looks like the DotGNU weekly IRC meeting will be discussing Parrot. Could be interesting: http://www.dotgnu.org/pipermail/developers/2002-October/008345.html Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Drive A: format failure, formatting C: instead...
Perl 6 summary for week beginning 2002-10-07
name from attr to has. There was also some talk on the module versioning system, which could be done with a slice-like notation: use Acme[1.0]; # like so use Acme[ (1;17..) | (2;0..) ]; # or perhaps use Acme[1;17..] | Acme[2;0..]; # or even I'm pretty sure he was joking, but Larry considered alternatives to the ..., which issues a warning (or maybe an exception) if you try to execute it. ??? would never complain and !!! would always throw an exception. Or the other way around. Or one is fatal. Or more likely, stick with ... and make its behaviour pragmatically controllable. ... is useful for abstract method declaration. There definitely wasn't any talk about and |||. Perl6 OO Cookbook Michael Lazzaro made good on his promise last week and produced a comprehensive Perl 6 OO cookbook describing stuff that hasn't yet been designed, for a language that doesn't yet exist. It is a great piece of work and tries to examine real life Perl 6 examples. There was some discussion of the recipes and the Michael announced that he wanted to work on an online system for adding new data and many other changes. Worried about Perl 6 OO? Then check this out: http://cog.cognitivity.com/perl6/ In brief Some of the Parrot tests still don't work under Win32. Some bugs in various bits of the Parrot JITs were found, and some fixed. Dakkar found a bug in the Perl 6 compiler which basically boiled down to checking for truth instead of definedness. Hopefully Perl 6 will remove this particular problem for us ;-) We probably need more tinderboxes. Brent Dax promises to fit a pony into his next patch. Simon Glover added quite a few tests and pieces of documentation. C structs need to be padded for the more exotic architectures and compilers. There are still some DOD / GC bugs. Who's Who in Perl6 Once more we get to meet people involved in the development of Perl 6. Who are you? Jerome Quelin. What do you do for/with Perl 6? I wrote a Befunge interpreter in Parrot assembly. Now I'm waiting for Parrot to handle multiarrays and objects in order to implement the Befunge-98 specs. Where are you coming from? Some Perl Golf rumors have said that I'm an alien coming from Mars. When do you think Perl 6 will be released? Some day. Why are you doing this? In order to have a chance to understand Perl 6 sources. And because Befunge is a fun language, that deserves to be supported by Parrot. You have 5 words. Describe yourself. Perl Golf and Befunge addicted. Do you have anything to declare? Befunge rocks. Acknowledgements This summary was brought to you with slightly less distraction from Super Mario Sunshine and more recognition of the sterling work that Piers does every week. As Piers says: One more, if you think this summary has value send money to the Perl Foundation http://donate.perl-foundation.org and feed back and/or T?iBooks to me, mailto:[EMAIL PROTECTED]. As usual, the fee paid for publication of this summary on perl.com has been donated directly to the Perl Foundation. Enjoy, Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng
Re: Hi - Regarding JVM - parrot compatibility
Karthik Kumar sent the following bits through the ether: Can you please let me know if any work going on relative to this or any src code tree that you would me to look into. Hiya. I've have worked on the past on trying to get JVM bytecodes working inside Parrot, but mostly that hasn't got very far due to lack of free time or motivation. It's very easy to get simple stuff working due to the low number of JVM bytecodes. You can emulate iinc quite easily ;-) However, it's getting the classes and object system to work which is a little harder. This may help: http://search.cpan.org/dist/Java-JVM-Classfile/ In the past couple of weeks I've been wondering whether a hybrid scheme a la Inline::Java where we dispatch stuff to a real JVM may be a faster approach to get running. Why, what exactly did you have in mind? Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Holy Smoke Batman, it's the Joker!
Re: [INFO] New array base: list.c
Leopold Toetsch sent the following bits through the ether: So I rewrote the base routines almost from scratch and have currently a file named list.c I for one am confused as to the number of array-like classes in Parrot. What is the difference between list and array? Or intlist? Or multiarray? Perhaps replacing one of these would be better? Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Useless invention no. 404: Breathable space suit
Perl 6 summary for week beginning 2002-09-30
informed us that it looks like the full name of classes will include their version number, ie Acme::N-1.1. In fact, a lot of the discussion is a bit in the air: as Dan Sugalski pointed out, things like object attributes aren't until Apocalypse 12 and it may be a little early to worry about such things. http://makeashorterlink.com/?Q19B21502 http://makeashorterlink.com/?H5AB54502 Subject-Oriented Programming Schwern also asked about subject-oriented programming, which looked interesting but which he couldn't quite understand. Andy Wardley explained that all these advanced programming techniques are all attempting a clear separation of concerns, and went on to describe and give pointers to more info. http://makeashorterlink.com/?K1BB21502 Matching Someone mysteriously known only as Ed asked what the favoured syntax would be to match negative multi-byte strings in Perl 6. It wasn't entirely clear what the question was, but one thing is sure: the Perl 6 pattern matching engine will have a lot of scope for optimisation. http://makeashorterlink.com/?S5CB11502 In brief Tim Bunce asked if there were any good tools for static code analysis around. None, apparently. Brent Dax reminded Andy Dougherty and others about /Parrot_v?sn?printf(_[sc])?/ in misc.c - a reimplementation of the printf functions for portability reasons. Simon Glover added tests for the assign opcode. It looks like Michael Lazzaro will be writing a list of issues with OO as well as a tutorial so that everyone is clear what exactly we are talking about. Larry cringes every time someone says Parens construct lists in Perl 6. Who's Who in Perl6 Once more we get to meet people involved in the development of Perl 6. Who are you? Simon Cozens What do you do for/with Perl 6? I was the Parrot pumpking up until 0.0.4, and wrote much of the PMC and string infrastructure. I then escaped to get a life, play more Go and be a nicer person. As perl.com editor and occasional author, I pop in from time to time just to check on the correctness of things I'm writing about and make sure Parrot compiles on at least one platform I possess so I can test code for articles. Rumours of my return to development have been greatly exaggerated. :) Where are you coming from? I'm not, I'm already here! When do you think Perl 6 will be released? I don't think Perl 6 - as we understand it - ever will be released. How's that for a Delphic pronouncement? Why are you doing this? Because I like food. You have 5 words. Describe yourself. Less vehemently obnoxious than before. Do you have anything to declare? Watch out for some surprises in the near future. Acknowledgements This summary was brought to you with much distraction indeed from Super Mario Sunshine. Thanks to Kate Pugh and #london.pm for proofreading. As Piers says: One more, if you think this summary has value send money to the Perl Foundation http://donate.perl-foundation.org and feed back and/or T?iBooks to me, mailto:[EMAIL PROTECTED]. As usual, the fee paid for publication of this summary on perl.com has been donated directly to the Perl Foundation. Enjoy, Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Bioengineers wear designer genes
Re: [perl #17159] imcc / Mac OS X problem
Leopold Toetsch sent the following bits through the ether: Could you try my second proposal? Sure. The patch I tried is attached, which fixes up a lot of the warnings. However, I now get: cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o imcparser.o -c imcparser.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o imclexer.o -c imclexer.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o imc.o -c imc.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o stacks.o -c stacks.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o symreg.o -c symreg.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o instructions.o -c instructions.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o cfg.o -c cfg.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o sets.o -c sets.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o debug.o -c debug.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o anyop.o -c anyop.c cc -o imcc imcparser.o imclexer.o imc.o stacks.o symreg.o instructions.o cfg.osets.o debug.o anyop.o ../../platform.o -lm ld: multiple definitions of symbol _n_spilled imcparser.o definition of _n_spilled in section (__DATA,__common) imc.o definition of _n_spilled in section (__DATA,__common) make: *** [imcc] Error 1 If only I knew more C / linker foo... Cheers, Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ According to my calculations the problem doesn't exist Index: cfg.h === RCS file: /cvs/public/parrot/languages/imcc/cfg.h,v retrieving revision 1.4 diff -u -r1.4 cfg.h --- cfg.h 27 Aug 2002 06:48:44 - 1.4 +++ cfg.h 12 Sep 2002 08:53:47 - -1,6 +1,12 /* Data structures: */ +#ifdef MAIN +#define EXTERN +#else +#define EXTERN extern +#endif + /* Two-way linked list of predecessors and successors */ typedef struct _edge { struct _basic_block *from; -22,9 +28,9 } Basic_block; /* Globals: */ -Basic_block **bb_list; -int n_basic_blocks; -Set** dominators; +EXTERN Basic_block **bb_list; +EXTERN int n_basic_blocks; +EXTERN Set** dominators; /* Functions: */ Index: imc.h === RCS file: /cvs/public/parrot/languages/imcc/imc.h,v retrieving revision 1.12 diff -u -r1.12 imc.h --- imc.h 27 Aug 2002 06:48:44 - 1.12 +++ imc.h 12 Sep 2002 08:53:47 - -13,6 +13,12 # define EX_UNAVAILABLE 1 #endif +#ifdef MAIN +#define EXTERN +#else +#define EXTERN extern +#endif + #include symreg.h #include instructions.h #include sets.h -47,11 +53,11 char *str_dup(const char *); char *str_cat(const char *, const char *); -int IMCC_DEBUG; -int IMCC_LIFE_INFO; -int IMCC_VERBOSE; -int n_spilled; -SymReg** interference_graph; +EXTERN int IMCC_DEBUG; +EXTERN int IMCC_LIFE_INFO; +EXTERN int IMCC_VERBOSE; +EXTERN int n_spilled; +EXTERN SymReg** interference_graph; Index: imcc.y === RCS file: /cvs/public/parrot/languages/imcc/imcc.y,v retrieving revision 1.21 diff -u -r1.21 imcc.y --- imcc.y 6 Sep 2002 07:13:52 - 1.21 +++ imcc.y 12 Sep 2002 08:53:47 - -13,8 +13,10 #include stdio.h #include stdlib.h #include assert.h -#include imc.h #include anyop.h + +#define MAIN +#include imc.h #define YYDEBUG 1 Index: instructions.h === RCS file: /cvs/public/parrot/languages/imcc/instructions.h,v retrieving revision 1.6 diff -u -r1.6 instructions.h --- instructions.h 27 Aug 2002 06:48:44 - 1.6 +++ instructions.h 12 Sep 2002 08:53:47 - -1,3 +1,8 +#ifdef MAIN +#define EXTERN +#else +#define EXTERN extern +#endif /* Types */ -58,5 +63,5 /* Globals */ -Instruction* instructions; +EXTERN Instruction* instructions; Index: symreg.h === RCS file: /cvs/public/parrot/languages/imcc/symreg.h,v retrieving revision 1.4 diff -u -r1.4 symreg.h --- symreg.h27 Aug 2002 06:48:44 - 1.4 +++ symreg.h12 Sep 2002 08:53:47 - -1,3 +1,8 +#ifdef MAIN +#define EXTERN +#else +#define EXTERN extern +#endif /* constants */ -61,5 +66,5 /* globals */ -SymReg * hash[HASH_SIZE]; -int n_symbols; +EXTERN SymReg * hash[HASH_SIZE]; +EXTERN int n_symbols;
Re: [perl #17159] imcc / Mac OS X problem
Leopold Toetsch sent the following bits through the ether: And finally, in imc.c there is another »int n_spilled;«, please delete this line. Cool, I've done the past two patches and it compiles but then fails to compile parrot shared: cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o imcparser.o -c imcparser.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o imclexer.o -c imclexer.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o imc.o -c imc.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o stacks.o -c stacks.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o symreg.o -c symreg.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o instructions.o -c instructions.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o cfg.o -c cfg.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o sets.o -c sets.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o debug.o -c debug.c cc -pipe -fno-common -no-cpp-precomp -fno-strict-aliasing -pipe -fno-common -g-I../../include -o anyop.o -c anyop.c cc -o imcc imcparser.o imclexer.o imc.o stacks.o symreg.o instructions.o cfg.osets.o debug.o anyop.o ../../platform.o -lm cd ../.. make shared rm -f parrot make cd classes make cd .. make[2]: Nothing to be done for `all'. cc -shared -L/usr/local/lib -flat_namespace -o blib/lib/libparrot.so exceptions.o global_setup.o interpreter.o parrot.o register.o core_ops.o core_ops_prederef.o memory.o packfile.o stacks.o string.o sub.o encoding.o chartype.o runops_cores.o trace.o pmc.o key.o hash.o core_pmcs.o platform.o jit.o jit_cpu.o resources.o rx.o rxstacks.o intlist.o embed.o warnings.o misc.o core_ops_cg.o packout.obyteorder.o debug.o smallobject.o headers.o dod.o method_util.o io/io.o io/io_buf.o io/io_unix.o io/io_win32.o io/io_stdio.o classes/array.o classes/boolean.o classes/continuation.o classes/coroutine.o classes/csub.o classes/default.o classes/intlist.o classes/intqueue.o classes/key.o classes/multiarray.o classes/perlarray.o classes/perlhash.o classes/perlint.o classes/perlnum.o classes/perlstring.o classes/perlundef.o classes/pointer.o classes/sub.o encodings/singlebyte.o encodings/utf8.o encodings/utf16.o encodings/utf32.o chartypes/unicode.o chartypes/usascii.o -lm cc: unrecognized option `-shared' ld: Undefined symbols: _main make[1]: *** [blib/lib/libparrot.so] Error 1 make: *** [all] Error 2 Thanks, Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Borderline psychotic with hermit-like tendencies
Re: [perl #17159] imcc / Mac OS X problem
Andy Dougherty sent the following bits through the ether: Yup, That's a long-standing bug. Here, again, is the correct fix for it. Cool, finally imcc works. Now, what's the best way to roll in all the patches? Are they the correct fixes? Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ SYSTEM ERROR: press F13 to continue...
Re: [perl #16874] [BUG] Concatenation failing
Leon Brocard sent the following bits through the ether: I have a weird bug where concatenation is sometimes failing Well, this bug is still here. I saw some patches fly by but which of them is the right patch and can it be applied please? ;-) Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ It's not in the manual!
Targeting Parrot slides
The slides for the talk I presented at the O'Reilly Open Source conference last week in Sad Diego are now available: http://www.astray.com/targeting_parrot/ Note that more Parrot talks are at http://www.parrotcode.org/talks/ FYI The conference went well and I'm sure Dan will get his slides up soon. BTW anyone want to work on getting Parrot to use less memory so it can run on palmtops? ;-) Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ Try? Try not. Do, or do not. There is no try
Re: [miguel@ximian.com: parrot/mops/mops.cs]
Simon Cozens sent the following bits through the ether: The mops test for C# in the parrot distribution uses long-integers, which are 64-bit values, instead of the 32-bit integers used by the other tests in the directory. Cool. How do we fix it? Change long to int? Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ The sun ain't yellow, its chicken
Re: PARROT QUESTIONS: Keyed access
Ashley Winters sent the following bits through the ether: Err, is this a bad time to ask where ParrotTuple is? :) I think ParrotTuple would make a great first project for anyone who wants to learn more about PMCs. It will also be fairly simple and small, so if lots of docs were also included it would make an ideal PMC to learn from in future. Any takers? ;-) Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ If this were an actual tagline, it would be funny
Re: RFC - Hashing PMC's albie@alfarrabio.di.uminho.pt
Alberto Manuel Brandão Simões sent the following bits through the ether: This means one more function to the vtable! FWIW every object in Java must implement a hashCode method: http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#hashCode() Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ If I were you, who'd be me?
Re: pmc RECALL command for preprocessor
Tanton Gibbs sent the following bits through the ether: I implemented a RECALL preprocessor directive for the pmc classes. ... Thus ensuring that the correct semantics always occur. I'm afraid I don't quite understand what RECALL is supposed to do. Can you explain it in a little more detail? Cheers, Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ This sentence no verb
Re: minitutorial on submitting patches
Aldo Calpini sent the following bits through the ether: this is a little tutorial about submitting patches (should be added to a FAQ, or somewhere where it's handy for people like me that tend to forget everything :-). This is really handy. While writing up the Perl 6 summary I've noticed that there were a couple of patches which appear to have slipped though the gapes. Patch authors - if you follow the Parrot patch procedure we won't forget your patches! Leon -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ There's someone in my head, but its not me
Perl 6 summary for week ending 2002-07-21
=head1 TITLE Perl 6 summary for week ending 2002-07-21 =head1 AUTHOR Leon Brocard [EMAIL PROTECTED] =head1 DETAILS Another week, another Perl 6 summary. Cunningly this week I have taken over the summary from Piers in order to make it easier for me to namecheck myself. It's been a good week too, with more happening in perl6-internals than perl6-language. So that's where I'll start... =head2 Parrot 0.0.7 The big news for this week is that DrForr has released Parrot 0.0.7 to the world (strange that lots of open source projects are releasing code just before the O'Reilly Open Source conference...). This release contains a Perl 6 grammar (with small, partial compiler!), functional subroutine, coroutine and continuation PMCs, global variables, an intermediate code compiler (imcc), a pure-Perl assembler and working garbage collection. The name is Parrot. Percy Parrot. http:[EMAIL PROTECTED]/msg11090.html http://www.cpan.org/modules/by-authors/id/J/JG/JGOFF/parrot_0.0.7.tgz Note that the really cool Perl 6 compiler needs at least Perl 5.6. Oh, and check out imcc if you haven't looked at it yet. =head2 Retro Perl Nicholas Clark stated that In October 2000 I believed that 5.005 maintenance *is* important for the acceptance of perl6, and I still do now. A first patch to the preliminary Perl 6 compiler was sent by Leopold Toetsch to make it work on 5.005_03 and seeing as Chip Salzenberg has restarted work on a new maintenance release of Perl 5.005 it's probably good for various parts of Parrot to run on retro perls. Shouldn't be a major problem. =head2 Parrot docs One of the big pushes last week was for more documentation inside Parrot. Writing documentation is always a problem for an open source project and it hit the wall last week. The good news is that lots of new documentation has been added to Parrot. There was some discussion on the nature of documentation. The result is that inline C documention should write up API details and that longer discussions (say, the choice of algorithms, how to avoid overflows in unsigned arithmetic, the pros and cons of differing hash algorithms) would end up as .dev files inside the docs/dev/ directory, much as PDD07 Conventions and Guidelines for Perl Source Code says. A few more documentation patches followed. Recently the mailing list and IRC channel have been quite busy and it seems like the new push for more documentation has attracted new people. Bonus! http:[EMAIL PROTECTED]/msg11080.html =head2 MANIFESTations The Parrot MANIFEST file tends not to be kept up-to-date with recent additions. Andy Dougherty produced a patch to do this. Nicholas Clark asked: Is CVS flexible enough to let us run a manifest check on each commit and generate warnings that get sent somewhere useful if it fails?. Robert Spier answered that it could and with any luck he'll get it in soon... =head2 RECALL Tanton Gibbs posted a patch to clean up a problem with our Copy on Write strategy. He kindly explained it for me: The basic problem is that in perlint.pmc we have something like: void set_string( PMC* value ) { CHANGE_TYPE( SELF, PerlString ); SELF-data = value-data } In other words implement a COW strategy after being changed into a PerlString. However, in perlstring.pmc the following is performed: void set_string( PMC* value ) { SELF-data = string_copy( INTERP, value-data ); } The RECALL command automates that so that set_string now looks like: void set_string( PMC* value ) { CHANGE_TYPE( pmc, PerlString ); RECALL; } Thanks to Tanton for explaining. =head2 Internals misc There were also lots of other small patches and discussions. It looks like the push for this week is to make it easier to add new PMCs to Parrot. =head2 Meanwhile, in perl6-language It was a quiet week in the perl6-language list, which is probably a good thing as thinking too much about hyper operators makes my head hurt. =head2 Hyper operators There was some discussion on hyper operators this week. It didn't go anywhere in particular, but discussed lots of syntax. Objections such as this code looks ugly! came up regularly when talking about code such as: @solution = (^-@b + sqrt(@b^**2 ^+ 4^*@a^*@c) ) ^/ (2^*@a); Luke Palmer pointed out that it might be better expressed as: for @a; @b; @c; @s is rw - $a; $b; $c; $s { $s = (-$b + sqrt($b**2 - 4*$a*$c)) / (2*$a) } Karl Glazebrook explained that PDL keeps everything as objects and does hyper operator magic without additional syntax. So Perl 6 @y = $a ^* @x ^+ @b happens in PDL with the clearer $y = $a * $x + $b. Isn't PDL shiny? =head1 Whitespace? Brent Dax noticed that there might be a problem with the regular expression modifier :w. The words modifier, according to Apocalypse 5 , causes an implicit match of whitespace wherever there's literal whitespace in a pattern. He asked what the following expand to: m:w/foo [~|bar]/ m:w/[~|bar] foo/ m:w/[~|bar] [^|baz]/ m:w/@foo @bar/ Luke Palmer
Re: Parrot contribution - #parrot stream parser.
Jim Cromie sent the following bits through the ether: can we could invent a super-lightweight markup language that #parrot-eers would type into the stream to put meta-info into it ? OK, I'll finally join this discussion. Yes, IRC is handy for realtime questions like (just an example as it happened last night): 19:33 blogan What's the best way to debug parrot? 19:33 seano probably parrot -t 19:33 seano 'least that's what I do. launch a parrot -t foo.pbc in gdb 19:36 blogan OK, it's the -t that's the key. 19:37 acme if you want to debug parrot code, there's also the parrot debugger: do make pdb And look, once we found a problem it made it straight to the list. IRC is useful as a supplement to the list. Sometimes it's easier to hash things out in real time, but mostly people just want to check something out before either producing a patch or initiating further discussion onlist. Don't worry about IRC. If you want to help develop parrot, it's another avenue but you're not missing important things in the Parrot world if you're not on it as everything happens onlist. OK, apart for general more docs what in particular does anyone not understand about Parrot? We'll try and help and then add docs or whatever. HTH, Leon ps as it so happens, blogan's question could go into a faq... -- Leon Brocard.http://www.astray.com/ scribot.http://www.scribot.com/ I'd love to go out with you, but I'm taking punk totem pole carving
Re: [PATCH] perlarray strange behaviour
Jeff sent the following bits through the ether: It runs strange code because it depends upon partially-deprecated code. Try 'set P0[2], 1' and 'set I0,P0[-2]'... OK, when will we get set P0[2], P2? Is it because the semantics aren't defined yet? Do we copy or leave references? I really need proper nested datastructures... ;-) Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ I have seen the evidence. I want DIFFERENT evidence!
parrotcode.org examples updated
It was long overdue but I've finally updated the examples page on parrotcode.org: http://www.parrotcode.org/examples/ Main changes: The calling conventions have been completely changed from callee-save to caller-save. The examples have been updated and are now much more comprehensive. Updated the examples to work with the new assembler. The new, calling-convention-following examples do look a little unwieldy, but hopefully they show how the real thing is going to work. I may have got things wrong - can you check I understand it correctly? [Of course, within a library/subroutine that are never called externally you're welcome to optimise away and ignore the calling conventions] Next update will be PMC examples... Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Abandon all hope ye who have entered cyberspace
BF interpreter
Hello. I've been looking at languages to run under Parrot, and I choose a certain language which is turing complete in eight instructions. Start with the small ones eh? Unfortunately its name is not family friendly. An interpreter is attached, although you'll need to add the chr() operator (see the patch). A BF compiler would be neat too, of course. Any chance of this going in the languages directory if I provide more docs and examples? Leon ps yes, interpreters for real languages on the way -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ (This tagline in Stereo where available) # A Brainfuck interpreter # By Leon Brocard [EMAIL PROTECTED] # # See http://www.catseye.mb.ca/esoteric/bf/ # for more information on this silly language # Get the brainfuck source file into S0 get_keyed S0, P0, 1 if S0, SOURCE get_keyed S0, P0, 0 print usage: ./parrot print S0 print file.bf\n # Read the file into S1 SOURCE: open I0, S0 SOURCE_LOOP: readline S2, I0 concat S1, S2 if S2, SOURCE_LOOP close I0 length I30, S1 # Initialise set I0, 0 # Our PC new P0, PerlArray # Our memory set I1, 0 # Our pointer # The main interpreter loop INTERP: substr S0, S1, I0, 1 ne S0, +, NOTPLUS get_keyed I2, P0, I1 inc I2 set_keyed P0, I1, I2 goto NEXT NOTPLUS: ne S0, -, NOTMINUS get_keyed I2, P0, I1 dec I2 set_keyed P0, I1, I2 goto NEXT NOTMINUS: ne S0, , NOTGT inc I1 goto NEXT NOTGT: ne S0, , NOTLT dec I1 goto NEXT NOTLT: ne S0, [, NOTOPEN get_keyed I2, P0, I1 if I2, NEXT set I2, 0 # depth OPEN_LOOP: inc I0 substr S2, S1, I0, 1 ne S2, [, OPEN_NOTOPEN inc I2 goto OPEN_LOOP OPEN_NOTOPEN: ne S2, ], OPEN_LOOP eq I2, 0, NEXT dec I2 goto OPEN_LOOP NOTOPEN: ne S0, ], NOTCLOSE set I2, 0 # height CLOSE_LOOP: dec I0 substr S2, S1, I0, 1 ne S2, ], CLOSE_NOTCLOSE inc I2 goto CLOSE_LOOP CLOSE_NOTCLOSE: ne S2, [, CLOSE_LOOP eq I2, 0, INTERP dec I2 goto CLOSE_LOOP NOTCLOSE: ne S0, ., NOTDOT get_keyed I2, P0, I1 chr S31, I2 print S31 goto NEXT NOTDOT: ne S0, ,, NEXT readline S31, 0 ord I2, S31 set_keyed P0, I1, I2 goto NEXT NEXT: inc I0 le I0, I30, INTERP end +[-].+++[-]+.+++..+++.[-][-] .+++[+-].[+++-].+++.--..[-][ -]+.[-]++. Index: core.ops === RCS file: /cvs/public/parrot/core.ops,v retrieving revision 1.144 diff -u -r1.144 core.ops --- core.ops23 May 2002 18:36:49 - 1.144 +++ core.ops30 May 2002 10:06:15 - @@ -207,6 +207,22 @@ goto NEXT(); } +=item Bchr(out STR, in INT) + +Returns the character represented by the $2 number in the ASCII +character set. + +=cut + +inline op chr (out STR, in INT) { + STRING *s; + s = string_make(interpreter, $1, (UINTVAL)1, NULL, 0, NULL); + *(char *)s-bufstart = $2; + s-strlen = 1; + $1 = s; + goto NEXT(); +} +
Re: BF interpreter
Clinton A. Pierce sent the following bits through the ether: If you'd like a pure-PASM chr() operator, see the BASIC interpreter in expr.pasm. I essentially do (everything in BASIC is on the stack...excuse the restore and saves...): Oooh, interesting hack! Of course, the discussion that should come up that we have an ord() in Parrot but not a chr(). I realise mine is a bit of a hack, but I really don't understand the current string encoding stuff. Is it finished? Do we need lots of unicode hacking? Do we need to work on ICU-lite? Will this patch get in in the meantime? ;-) Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ He who reads many fortunes gets confused
Re: [COMMIT] Configure.pl 2.0
Sebastian Bergmann sent the following bits through the ether: NMAKE : fatal error U1073: 'config_h.in' konnte nicht erstellt werden Stop. And likewise here on my linux box: make: *** No rule to make target `config_h.in', needed by `Makefile'. Stop. Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Barium: what you do with dead chemists
Re: Parrot and Mono / .Net
Sebastian Bergmann sent the following bits through the ether: It'd be great if you could comment of different goals, etc. between Parrot and the .Net concept. Oh, this happens to be a FAQ. The main reason is: http://www.parrotcode.org/faq/ * Why your own virtual machine? Why not compile to JVM/.NET? Those VMs are designed for statically typed languages. That's fine, since Java, C#, and lots of other languages are statically typed. Perl isn't. For a variety of reasons, it means that perl would run more slowly there than on an interpreter geared towards dynamic languages. The main problem is that Perl is so dynamic. You can redefine almost anything in Perl at runtime. This means we need a very dynamic virtual machine behind it in order to run Perl (and possibly Ruby, Python) efficiently. Hope this helps, Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Windows Error: 002 No error, yet
[PATCH] fix genclass.pl
Well, I was a good boy and tried to follow the instructions on the list and mail [EMAIL PROTECTED], but that bounced, so here it is: Here is a terribly simple genclass.pl patch to make the generated classes actually compile. No, I don't know what to do about the bad comment, either. Index: genclass.pl === RCS file: /cvs/public/parrot/classes/genclass.pl,v retrieving revision 1.8 diff -u -r1.8 genclass.pl --- genclass.pl 30 Jan 2002 18:02:23 - 1.8 +++ genclass.pl 14 May 2002 19:23:30 - @@ -36,7 +36,7 @@ $thisproto =~ s[(\S+) (\S+)] [$1 $2]; # Quick hack - don't do that at home: -$thisproto =~ s/struct Parrot_Interp \*interpreter, PMC\* pmc,* *//; +$thisproto =~ s/struct Parrot_Interp\* interpreter, PMC\* pmc,* *//; print$thisproto {\n; print}\n\n; } Cheers, Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ All generalizations are false, including this one - End forwarded message - -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Famous last words - Don't worry, I can handle it
jvm.ops
Over the weekend I've been thinking about Targeting Parrot. My thoughts went something like this: Parrot is a register machine. The Java virtual machine is a stack machine. Parrot is also a stack machine. Instead of converting Java bytecode to Parrot bytecode, I can make Parrot into a JVM. And lo, so I did (for a small number of opcodes): This is Java source code: public static void spin() { int i; for(i = 0, i 12345678; i++); System.out.print(i); } which turns into the following Java bytecode: 0 iconst_0 1 istore_0 2 goto 8 5 iinc 0 1 8 iload_0 9 sipush 1000 12 if_icmplt 5 15 getstatic #3 Field java.io.PrintStream out 18 iload_0 19 invokevirtual #4 Method void print(int) 22 return On a different VM, not so far away: # This is Parrot assembler: iconst_0 istore_0 goto IN REDO: iinc 0, 1 IN: iload_0 sipush12345678 if_icmplt REDO iload_0 jvm_print end Cute, huh? Of course, Java interpreters are very optimised (and non-dynamic) and without JITs doing it in Parrot is about 6 times slower, but it's interesting nevertheless. Is this the kind of thing I should be doing? I've attached a fledgling jvm.ops. Does my C code look ok? Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ (c) The Intergalactic Thought Association /* ** jvm.ops */ VERSION = PARROT_VERSION; =head1 NAME jvm.ops =cut =head1 DESCRIPTION Library of ops for Parrot which resemble the JVM ops =cut ### =head2 Basic ops These are the fundamental operations. =over 4 =cut =item Biadd() Pop two integers off the stack, add them together and push the result on the stack. =cut op iadd() { INTVAL x, y; stack_pop(interpreter, interpreter-user_stack, y, STACK_ENTRY_INT); stack_pop(interpreter, interpreter-user_stack, x, STACK_ENTRY_INT); x = x + y; stack_push(interpreter, interpreter-user_stack, x, STACK_ENTRY_INT, STACK_CLEANUP_NULL); goto NEXT(); } op iconst_0() { INTVAL x = 0; stack_push(interpreter, interpreter-user_stack, x, STACK_ENTRY_INT, STACK_CLEANUP_NULL); goto NEXT(); } op iconst_1() { INTVAL x = 1; stack_push(interpreter, interpreter-user_stack, x, STACK_ENTRY_INT, STACK_CLEANUP_NULL); goto NEXT(); } op sipush(in INT) { INTVAL i = $1; stack_push(interpreter, interpreter-user_stack, i, STACK_ENTRY_INT, STACK_CLEANUP_NULL); goto NEXT(); } op iload_0() { INTVAL i = interpreter-int_reg.registers[0]; stack_push(interpreter, interpreter-user_stack, i, STACK_ENTRY_INT, STACK_CLEANUP_NULL); goto NEXT(); } op istore_0() { INTVAL i; stack_pop(interpreter, interpreter-user_stack, i, STACK_ENTRY_INT); interpreter-int_reg.registers[0] = i; goto NEXT(); } op jvm_print() { INTVAL i; stack_pop(interpreter, interpreter-user_stack, i, STACK_ENTRY_INT); printf(INTVAL_FMT, (INTVAL)i); goto NEXT(); } op iinc(in INT, in INT) { interpreter-int_reg.registers[$1] += $2; goto NEXT(); } op if_icmplt(inconst INT) { INTVAL x, y; stack_pop(interpreter, interpreter-user_stack, y, STACK_ENTRY_INT); stack_pop(interpreter, interpreter-user_stack, x, STACK_ENTRY_INT); if (x y) { goto OFFSET($1); } goto NEXT(); } op goto (in INT) { goto OFFSET($1); }
Re: [OT] Parrot Logo
Andy Wardley sent the following bits through the ether: http://andywardley.com/parrot/ That's a wonderful colour! ;-) Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ High message: 9434567. Message last read: 9
Re: Various PASM routines
Clinton A. Pierce sent the following bits through the ether: Actually, if I knew where to look I'd update them myself. :) http://parrotcode.org/examples/ mentions them but I guess we should roll the ideas behind: http:[EMAIL PROTECTED]/msg06001.html into one of the files in docs/... Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ It is now pitch dark. If you proceed, you will likely fall into a pit
Re: setline
Dan Sugalski sent the following bits through the ether: We should come up with an alternative for the bytecode files that has the line number info out of band. This is what Java bytecode does. It has an oob offset = line number mapping. Are .pyc the same? Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Clap on! (clap, clap) Clap off! (clap@#$NO CARRIER
Re: Java to Parrot
Melvin Smith sent the following bits through the ether: Anyone doing any work with Java bytecode to Parrot? I've got a java class disassembler 90% working if anyone is interested in helping, I'm not sure if this would belong in the Parrot tree or not. Yes, actually. I've done some initial work but have completely redone it recently. I gave a talk early on: http://www.astray.com/java/ I've even got a module on CPAN which does Java bytecode to Perl (for simple stuff currently): http://search.cpan.org/search?dist=Java-JVM-Classfile To be honest, I've been waiting until Parrot can do objects and classes. Converting the bytecode isn't the problem, it's converting the Java APIs that is... HTH, Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ #include witty.f
Re: Parrot FAQ
Dan Sugalski sent the following bits through the ether: The Zork interpreter might be stack based, thinking about it, but it was hardly geared for speed, so I don't know that it'd count if it was. For what it is worth, in my quest for learning more about VMs I've taken a detailed look at the Z-machine with an eye to converting between Z-code and Parrot. I gave up 'cos it really wasn't designed for simplicity. It's all horrid and like a real-life machine, with lots of exceptions and lots of new ops in the later versions. I was looking for a quick hack, and that wasn't it ;-) Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Do not clone your neighbors in their sleep
Re: Parrot vs JVM
Leon Brocard sent the following bits through the ether: o JVM is stack-based, Parrot is register-based (major difference!) I forgot to point out that details of the JVM are available at: http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ DOWN WITH EXCLAMATION POINTS
Re: [PATCH] mops.pasm
James Mastros sent the following bits through the ether: Perhaps it's just too late at night, but if this cange makes it better, tighter code, shouldn't it make the MOPS numbers look better, not worse? Right: the older code did the average of three ops (eq, add, and branch), and the new code does the average of two ops (add, lt). The branch is the simplest in terms of complexity, so taking it own makes the average slower. That's why the MOPS result doesn't mean much, but the new code is simpler and *faster*, which is why I suggested it. (just not faster per op, you see) Hope that makes it clear, Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Error 404: There is no spoon
[PATCH] mops.pasm
You may think that this is a silly patch, but it's real. mops.pasm uses a very simple loop to figure out how many operations a second parrot can go. However, the loop it uses is inefficient: it does a branch *and* an eq every time around. Real code shouldn't do this: I try and explain this at http://www.parrotcode.org/examples/ and it also features at http://java.sun.com/docs/books/vmspec/2nd-edition/html/Compiling.doc.html#4182 The attached patch optimises the loop. Note that MOPS numbers now look slightly different. For example, on my laptop: OLD LOOP mops.pasm: 11.713909 ./mops: 108.442655 with -O3: mops.pasm: 17.030964 ./mops: 240.719673 NEW LOOP mops.pasm: 10.647256 ./mops: 73.574232 with -O3: mops.pasm: 15.141514 ./mops: 150.416772 Of course, the benchmark could be improved, but I suggest we should at least change it to be good, tight code ;-) Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Clones are people two Index: examples/assembly/mops.pasm === RCS file: /home/perlcvs/parrot/examples/assembly/mops.pasm,v retrieving revision 1.1 diff -u -r1.1 mops.pasm --- examples/assembly/mops.pasm 2001/10/15 21:37:07 1.1 +++ examples/assembly/mops.pasm 2001/11/10 19:22:02 @@ -16,7 +16,7 @@ print I4 print \n -setI1, 3 +setI1, 2 mulI5, I4, I1 print Estimated ops: @@ -25,9 +25,8 @@ time N1 -REDO: eq I2, I4, DONE -addI2, I2, I3 -branch REDO +REDO: addI2, I2, I3 +lt I2, I4, REDO DONE: time N5
Re: Rounding?
Zach Lipton sent the following bits through the ether: Is there any way to round this, or at least chop the 0's off the end? Right. I'd just like to clear this up completely. The N registers are for numerics (well, ok, floating point) and the I registers are for integers. Currently, quite a bit of precision is used when printing the N registers. There are two ways to get 4 out of your code: either convert the N to an I or work with Is: set N0,2 set N1,2 add N3, N0, N1 print N3 # prints 4.0 print \n ntoi I0, N3 print I0 # prints 4 print \n set I0, 2 set I1, 2 add I2, I0, I1 print I2 # prints 4 print \n end Hope this helps, Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Tonight's the night: Sleep in a eucalyptus tree
Re: java vs. parrot mops
Dan Sugalski sent the following bits through the ether: For the Java-impaired (i.e. me :) what's the -Xint option do? It turns off the JIT (which is enabled by default). Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ DATA - Dedicated Absorbing Technical Absurdities (?)
Re: java vs. parrot mops
Kevin Huber sent the following bits through the ether: Parrot2Java which I will make available once I fix a few more bugs :-). Oh, cute! I've been frustrating myself by trying to do it the other way around (it'll happen eventually...). Optimising the stack loads/saves will be the fun part for you I imagine ;-) Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ Okay - right after this one we're BACK to the TOPIC
Re: [PATCH] Fixes logical ops in Parrot Scheme compiler
Gregor N. Purdy sent the following bits through the ether: I'd like to see the folks with other language implementations speak up again about their current status and desires to have their stuff in CVS My JVM - Parrot stuff is going slowly, but parts of a Better Solution are going up on CPAN. My previous attempts needed java to be installed locally, but I'm now implementing a Perl Java Classfile parser: http://search.cpan.org/search?dist=Java-JVM-Classfile It's only basic and development will be pretty slow but I think I'll be targetting Perl first so I can play with translation ideas and not have to worry about static type inference... Errr, so not yet. But I'll be updating the parrotcode.org examples rsn, honest... Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... Gravity is a myth - the earth sucks
[BUG] Mandlebrot core
Simon Cozens sent the following bits through the ether: No release today, folks. False alarm. You know, I think I have a case for adding my Mandlebrot generator to the test suite. 'Cos it coredumps on my PIII Linux laptop ;-) I have no C debugging skills, but grab it from the bottom of http://www.parrotcode.org/examples/ and with any luck you'll get something like: [acme@piglet parrot]$ ./assemble.pl mandlebrot.pasm run.pbc [acme@piglet parrot]$ ./test_prog run.pbc Segmentation fault (core dumped) [acme@piglet parrot]$ gdb ./test_prog core ... #0 0x0804b759 in Parrot_op_gt_nc_ic (cur_opcode=0x806143c, interpreter=0x8055048) at basic_opcodes.c:413 413 if (interpreter-num_reg-registers[cur_opcode[1]] interpreter-code-const_table-constants[cur_opcode[2]]-number) { (gdb) bt #0 0x0804b759 in Parrot_op_gt_nc_ic (cur_opcode=0x806143c, interpreter=0x8055048) at basic_opcodes.c:413 #1 0x08048d70 in runops_notrace_core (interpreter=0x8055048) at interpreter.c:66 #2 0x08048fd6 in runops_generic (core=0x8048cf8 runops_notrace_core, interpreter=0x8055048) at interpreter.c:147 #3 0x0804905e in runops (interpreter=0x8055048, code=0x80610b8) at interpreter.c:172 #4 0x0804ec96 in main (argc=2, argv=0xbb64) at test_main.c:103 #5 0x400c5177 in __libc_start_main (main=0x804e89c main, argc=2, ubp_av=0xbb64, init=0x80488e4 _init, fini=0x804ed10 _fini, rtld_fini=0x4000e184 _dl_fini, stack_end=0xbb5c) at ../sysdeps/generic/libc-start.c:129 It's all greek to me, Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... 1001 Things To Do With Whipped Cream, LGLB (1995)
Re: [BUG] Mandlebrot core
Leon Brocard sent the following bits through the ether: It's all greek to me, Leon The following bytecode: 0075 [01d4]: 0032 0008 000a 0008 gt_nc_ic N8, [nc:10], L2 is wrong. It shouldn't be [nc:10]. 10 is the numeric constant which should have been in the constant table ([nc:10] refers to the 10th constant, there are only constants 0-6 hence the crash), so I point the finger at the assembler (of which I little). But I know more about debugging coredumps now, honest. Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... I tried to think but nothing happened!
Re: Wow.
Bart Lateur sent the following bits through the ether: What underlying graphics engine would you use? I see a great need for OpenGL opcodes (let's forget about arrays and hashes, right?) ;-) Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... Corrupt REALITY.SYS: Reboot Universe (Y/n)?
Re: Suggestion: register liveness information
Andrew J Bromage sent the following bits through the ether: What do you all think? Leon mentioned control flow graphs a few days ago, but I think that live value information is more generally useful to optimising interpreters and JIT compilers. I guess it depends what level you want to be able to do this at. My CFG stuff is intended to eventually move on to liveliness so as to optimise badly-generated bycode (from naive compilers, or lazy humans). I'm relearning all this as I haven't used it much since uni, but it's possible to gather all this information from the bytecode. I'd prefer to have code which does real liveliness calculations and can do real optimisations before we start talking about adding more opcodes ;-) Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... C program run. C program crash. C programmer quit
Re: Floating Points and 0.0.2 release
Gibbs Tanton - tgibbs sent the following bits through the ether: For the 0.0.2 release While we're at it: Simon, what do we need to have ready before we release the next version? Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... DIODE: What happens to people who don't die young
[PATCH] Remove warning when compiling test.c
I get a warning during the Configure process: ... Alright, now I'm gonna check some stuff by compiling and running a small C program. This could take a bit... test.c:13:1: warning: no newline at end of file ... Attached is a trivial patch which adds a newline. Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... Join the Group Mind - become a Borg Index: test_c.in === RCS file: /home/perlcvs/parrot/test_c.in,v retrieving revision 1.1 diff -u -u -r1.1 test_c.in --- test_c.in 2001/09/21 04:45:27 1.1 +++ test_c.in 2001/09/22 13:32:41 @@ -10,4 +10,4 @@ int main(int argc, char **argv) { printf(%d/%d/%d, sizeof(${iv}), sizeof(long), sizeof(${nv})); return 0; -} \ No newline at end of file +}
[PATCH] assemble.pl registers go from 0-31
Attached patch makes sure you don't try and use register numbers over 31. That is, this patch allows registers I0-I31 and anything else gets a: Error (foo.pasm:0): Register 32 out of range (should be 0-31) in 'set_i_ic' Oh, there's also a comment at end of line patch that has snuck in 'cos it's so darn useful. Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... You seem a decent fellow, I hate to kill you Index: assemble.pl === RCS file: /home/perlcvs/parrot/assemble.pl,v retrieving revision 1.38 diff -u -u -r1.38 assemble.pl --- assemble.pl 2001/09/22 16:18:48 1.38 +++ assemble.pl 2001/09/22 20:01:41 @@ -162,6 +162,7 @@ 1 while $code=~s/\([^\\\]*(?:\\.[^\\\]*)*)\/constantize($1)/eg; $code=~s/,/ /g; +$code =~ s/#.*$//; # Strip end-of-line comments my($opcode,@args)=split(/\s+/,$code); if(exists($macros{$opcode})) { # found a macro @@ -303,6 +304,7 @@ if($rtype eq I || $rtype eq N || $rtype eq P || $rtype eq S) { # its a register argument $args[$_]=~s/^[INPS](\d+)$/$1/i; + error(Register $1 out of range (should be 0-31) in +'$opcode',$file,$line) if $1 0 or $1 31; } elsif($rtype eq D) { # a destination if($args[$_]=~/^\$/) {
Re: [PATCH] Comment fixes
Leon Brocard sent the following bits through the ether: Attached are trivial comment fixes for two files. Oh go on, I know we're in a feature freeze but this is a doc patch. Can someone apply these please? Leon -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... Dew knot trussed yore spell chequer two fined awl year miss stakes
[PATCH] Comment fixes
Attached are trivial comment fixes for two files. As it so happens, it strikes me that CONCAT Sx, Sx isn't three-register code. I'd be much happier with CONCAT Sx, Sx, Sx - it'd make it easier to generate code for and would fit in with the rest of the instructions. Comments? Leon ps should i start filing bug reports in rt if my assembler bugs aren't being fixed? ;-) -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... Have you seen Quasimoto? I have a hunch he's back! Index: basic_opcodes.ops === RCS file: /home/perlcvs/parrot/basic_opcodes.ops,v retrieving revision 1.21 diff -u -u -r1.21 basic_opcodes.ops --- basic_opcodes.ops 2001/09/19 21:32:29 1.21 +++ basic_opcodes.ops 2001/09/20 09:01:17 @@ -452,6 +452,7 @@ STR_REG(P1) = s; } +/* CONCAT Sx, Sx */ AUTO_OP concat_s { STRING *s = string_concat(STR_REG(P1), STR_REG(P2), 1); STR_REG(P1) = s; Index: process_opfunc.pl === RCS file: /home/perlcvs/parrot/process_opfunc.pl,v retrieving revision 1.12 diff -u -u -r1.12 process_opfunc.pl --- process_opfunc.pl 2001/09/19 21:32:29 1.12 +++ process_opfunc.pl 2001/09/20 09:01:32 @@ -19,11 +19,11 @@ # #... body of function ... # -#RETVAL = x; +#RETURN(x); # # } # -# There may be more than one RETVAL +# There may be more than one RETURN # # The functions have the magic variables Pnnn for parameters 1 through # X. (Parameter 0 is the opcode number) Types for each, and the size
Example assembler code (primes.pasm)
Attached is a cute prime number printer. It strikes me that we need a central place to put these things - it'd really help people get stuck into the lowlevel stuff. How about an examples/ directory in the CVS tree? Alternatively, I could set up a learning parrot assembler website of some sort, although Simon's recent article on perl.com was damn good. Leon ps the assembler doesn't grok if I5, NEXT4, NEXT3 or comments on lines which just have labels -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... My name is Inigo Montoya. You killed my father. Prepare to die # Some simple code to print out the primes up to 100 # Leon Brocard [EMAIL PROTECTED] # I1 holds the number we're currently checking for primality set I1, 1 # I2 holds the highest number we want to check for primality set I2, 100 print The primes up to print I2 printare:\n # I1 counts up to I2 REDO: gt I1, I2, OVER, NEXT1 NEXT1: # I3 counts from 2 up to I4 (I1/2) set I3, 2 set I4, 2 div I4, I1, I4 LOOP: gt I3, I4, PRIME, NEXT2 NEXT2: # Check if I3 is a factor of I1 mod I5, I1, I3 if_i_ic I5, NEXT4, NEXT3 NEXT3: # We've found a factor, so it can't be a prime and # we can skip right out of this loop and to the next # number branch NEXT NEXT4: inc I3 branch LOOP PRIME: # We haven't found a factor so it must be a prime print I1 print \n NEXT: # Move on to the next number inc I1 branch REDO OVER: end
Re: [PATCH] Bytecode bounds checking and TRACE_OPS
Simon Cozens sent the following bits through the ether: My view is that if you screw up writing assembly code, you should be thankful that you get the protection of a segfault. Indeed, but why not warn about it. The JVM does this by checking that the bytecodes are wellformed during its bytecode verification stage (before it runs the bytecode). It does some simple checks to see if the bytecode is doing reasonable things (no halting problem here, move along). Something for later, perhaps. Leon -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... All generalizations are false, including this one
Number bug
piglet$ cat minus.pasm set N1, -2 print N1 piglet$ ./assemble.pl minus.pasm Error (1): No opcode set (tried set_n_ic, set_n) in set N1, -2 This should probably work. Unfortunately, this involves more work on the assembler than I have knowledge of it so far. Leon ps test suite for inc coming up once this is fixed -- Leon Brocard.http://www.astray.com/ Nanoware...http://www.nanoware.org/ ... And he disappeared in a puff of logic
Re: Op documentation versus implementation
Simon Cozens sent the following bits through the ether: eq_i_ic I Which reminds me, we currently have: eq_i_ic4 I I D D Do we really need the extra D? I'm generating twice as many labels for little gain. ISTR Dan saying it slipped in somehow. May I suggest it slips out again ;-)? Leon -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... With a rubber duck, one's never alone
Re: RFC: Bytecode file format
Simon Cozens sent the following bits through the ether: If you don't know what Python's CodeObjects look like, I suggest you go see it now. I've been spendind a lot of time recently looking at the Java classfile specification. Yes, they were trying to optimise for space, but there are some interesting pieces. For example, the actual bytecode for a method is a Code attribute[1] attached to the method (other attributes such as line number information etc. can also be part of it). The constant pool is the scary part, but interesting. Why not have a look, although we may want to generalise a bit more: http://java.sun.com/docs/books/vmspec/html/ClassFile.doc.html Leon [1] No, attributes aren't limited to four characters. Let's be modern about this... -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... Error 15 - Unable to exit Windows. Try the door
Microbenchmark JVM-PVM
Sky asked me if anyone had done any simple benchmarks comparing JVM and PVM at this point. Now, I know we're still at an early stage and haven't really looked at speed, but a trivial counting and simple arithmetic benchmark: piglet$ time java Bench 1.470u 0.080s 0:01.59 97.4% 0+0k 0+0io 5784pf+0w piglet$ time ./test_prog run.pbc 40.080u 0.030s 0:42.07 95.3%0+0k 0+0io 137pf+0w Source files attached so I can humiliate myself in public at a later stage when someone points out I've done something stupid Leon ps my jvm is j2sdk-1.3.1-FCS from blackdown on linux ps2 oh, and are we calling it pvm? parrotvm? -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... I am serious. And don't call me Shirley class Bench { public static void main (String args[]) { int q = 1; int w = 1; int i = 1; int j = 1; while(q 1) { w = 1; while(w 1) { i++; j += i; w++; // System.out.print(q + , + w + \n); } q++; } } } set_i_ic I1, 1 set_i I63, I1 set_i_ic I1, 1 set_i I62, I1 set_i_ic I1, 1 set_i I61, I1 set_i_ic I1, 1 set_i I60, I1 set I4, 1 set I7, 1 branch_ic LAAA LAAE: set_i I62, 1 branch_ic LAAB LAAC: inc_i I61 add_i I60, I60, I61 inc_i I62 LAAB: lt_i_ic I62, I4, LAAC, LAAD LAAD: inc_i I63 LAAA: lt_i_ic I63, I7, LAAE, LAAF LAAF: end
Re: Microbenchmark JVM-PVM
Masatake E. Hori sent the following bits through the ether: piglet$ time java Bench 1.470u 0.080s 0:01.59 97.4% 0+0k 0+0io 5784pf+0w piglet$ time ./test_prog run.pbc 40.080u 0.030s 0:42.07 95.3%0+0k 0+0io 137pf+0w Maybe you got a Just-In-Time compiler? Oh, I hadn't realised blackdown had that. Now a smaller difference: [acme@piglet parrot]$ time java -Xint Bench 16.430u 0.080s 0:18.17 90.8%0+0k 0+0io 5783pf+0w Didn't want to panic you all, Leon -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... ebius tagline. This is a moebius tagline. This is a mo...
Re: [patch] First cut at TODO allow add I4, I4, 3 instead of add_i_ic ...
Dan Sugalski sent the following bits through the ether: Actually, I'm expecting almost nothing to be written in pasm after we get a working parser and compiler I am, as you may have noticed already, clearly a frustrated assembler programmer who's had to code high-level stuff for far too long. I'm interested in converting between languages. At the moment I expect to do that using pasm, but the second we have a bytecode-writing module... Look at all these programming languages for the JVM. s/JVM/ParrotVM/ perhaps? http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.html Leon -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... You are in a twisty little maze of Unix versions, all different
Re: Fibonaci
[EMAIL PROTECTED] sent the following bits through the ether: Here is the fibonaci function Here are slightly cleaner (could even be used for testing purposes) fibonacci and factorial example files. I'd say bundle them in as examples and prod me until I do the test suite Leon -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... # Some simple code to print some Fibonacci numbers # Leon Brocard [EMAIL PROTECTED] print The first 20 fibonacci numbers are:\n set I1, 0 set I2, 20 set I3, 0 set I4, 1 REDO: eq I1, I2, DONE, NEXT NEXT: set I5, I4 add I4, I3, I4 set I3, I5 print I3 print \n inc I1 branch REDO DONE: end # Some simple code to print some factorials # Leon Brocard [EMAIL PROTECTED] print The first 15 factorials are:\n set I1, 0 set I2, 15 set I3, 1 REDO: eq I1, I2, DONE, NEXT NEXT: inc I1 mul I3, I3, I1 print I3 print \n branch REDO DONE: end
[PATCH] Prettier tests
The attached patch munges the tests (well, examples really) in the following ways: a) use set instead of set_i_ic b) more comments c) newlines at strategic places This brings up two problems I don't understand. test.pasm produces the following crud for me (meaning the I to N stuff hasn't worked): Quick test loop Time at start: 1000488350 Time at end: 1000488353 Loops: 1000 Duration: 3 secs No. of ops: 3000 No. of ops: -899095475435029602216738764410621465215709480252725280455602021508827072646435375341811378307171461854551678538697264100821727119019984740237830264020440104489381149510991872.00 (float) Duration: -2.00 (float) Ops per sec: -0.00 and for some reason the assembler can't grok substr in test2: Error (10): No opcode substr in WAX: substr S2, S1, I3, I4 I must be tired but I just can't figure out why. HTH, Leon -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... Mr. Worf, blow the Windows-powered Borg ship out of this Universe! Index: t/euclid.pasm === RCS file: /home/perlcvs/parrot/t/euclid.pasm,v retrieving revision 1.2 diff -u -r1.2 euclid.pasm --- t/euclid.pasm 2001/09/13 14:34:28 1.2 +++ t/euclid.pasm 2001/09/14 17:14:00 @@ -22,12 +22,12 @@ main: setI1, 96 setI2, 64 setI3, 0 -setS1, Algorithm E (Euclid's algorithm) -print S1 +print Algorithm E (Euclid's algorithm): e1: modI4, I1, I2 e2: eq I4, I3, done, e3 e3: setI1, I2 setI2, I4 branch e1 done: print I2 + print \n end Index: t/test.pasm === RCS file: /home/perlcvs/parrot/t/test.pasm,v retrieving revision 1.1 diff -u -r1.1 test.pasm --- t/test.pasm 2001/09/10 22:18:43 1.1 +++ t/test.pasm 2001/09/14 17:14:00 @@ -1,24 +1,37 @@ -time_i I1 -set_i_ic I2, 0 -set_i_ic I3, 1 -set_i_ic I4, 1000 -REDO: eq_i_ic I2, I4, DONE, NEXT -NEXT: add_i I2, I2, I3 -branch_ic REDO -DONE: time_i I5 -print_i I1 -print_i I5 -print_i I2 -sub_i I2, I5, I1 -print_i I2 -set_i_ic I1, 3 -mul_i I4, I4, I1 -iton_n_i N1, I4 -iton_n_i N2, I2 -print_i I4 -print_n N1 -print_i I2 -print_n N2 -div_n N1, N1, N2 -print_n N1 -end +# This example parrot assembly tests how long a Parrot operator takes +# to dispatch + + print Quick test loop\n + timeI1 + set I2, 0 + set I3, 1 + set I4, 1000 +REDO: eq I2, I4, DONE, NEXT +NEXT: add I2, I2, I3 + branch REDO +DONE: timeI5 + print Time at start: + print I1 + print \n Time at end: + print I5 + print \n Loops: + print I2 + print \n Duration: + sub I2, I5, I1 + print I2 + printsecs\n No. of ops: + # There are 3 ops in the loop above + set I1, 3 + mul I4, I4, I1 + itonN1, I4 + itonN2, I2 + print I4 + print \n No. of ops: + print N1 + print(float)\n Duration: + print N2 + print(float) \n Ops per sec: + div N1, N1, N2 + print N1 + print \n + end Index: t/test2.pasm === RCS file: /home/perlcvs/parrot/t/test2.pasm,v retrieving revision 1.3 diff -u -r1.3 test2.pasm --- t/test2.pasm2001/09/13 07:14:25 1.3 +++ t/test2.pasm2001/09/14 17:14:00 @@ -1,15 +1,20 @@ -set_i_ic I2, 1 -set_i_ic I1, 0 -set_s_sc S1, Hello World -set_i_ic I3, 0 -set_i_ic I4, 0 -length_i_s I5, S1 -WAX:substr_s_s_i S2, S1, I3, I4 -print_s S2 -add_i I4, I4, I2 -eq_i_ic I4, I5, WANE, WAX -WANE: length_i_s I1, S1 -print_s S1 -chopn_s_ic S1, 1 -eq_i_ic I1, I3, DONE, WANE -DONE: end +# This prints a pleasing sideways triangle composed of the phrase +# Hello World + + set I2, 1 + set I1, 0 + set S1, Hello World + set I3, 0 + set I4, 0 + length I5, S1 +WAX: substr S2, S1, I3, I4 + print S2 + print \n + add I4, I4, I2 + eq I4, I5, WANE, WAX +WANE: length I1, S1 + print S1 + print \n + chopn S1, 1 + eq I1, I3, DONE, WANE +DONE: end Index: t/test3.pasm === RCS file: /home/perlcvs/parrot/t/test3.pasm,v retrieving revision 1.2 diff -u -r1.2 test3.pasm --- t/test3.pasm2001/09
JavaVM - ParrotVM
Seeing as Simon's gone to all the trouble of releasing the source to Parrot now, I wondered what I could have a play with. I've did simple Parrot assembler and thought about different types of bytecode. Like bytecode for the Java virtual machine, which it turns out is stack based. Could I convert JVM-PVM? I think so ;-) [Yes, this is a proof of concept, and the parrot assembler will change in many ways rsn, so this is just a head up to show it's possible] Given the following Java code: class HelloWorld { public static void main (String args[]) { int i = 1; int j = 1; while(i 10) { System.out.print(i); System.out.print(j); i++; j += i; } } } (which prints out: 112336410515621728836945) That actually gets translated into the the following JVM bytecode: 0 iconst_1 1 istore_1 2 iconst_1 3 istore_2 4 goto 28 7 getstatic #2 Field java.io.PrintStream out 10 iload_1 11 invokevirtual #3 Method void print(int) 14 getstatic #2 Field java.io.PrintStream out 17 iload_2 18 invokevirtual #3 Method void print(int) 21 iinc 1 1 24 iload_2 25 iload_1 26 iadd 27 istore_2 28 iload_1 29 bipush 10 31 if_icmplt 7 34 return And my magic script (http://astray.com/java2parrot.pl.txt) converts it to the following Parrot assembler code: set_i_ic I1, 1 set_i I63, I1 set_i_ic I1, 1 set_i I62, I1 branch_ic LAAA LAAB: set_i I1, I63 print_i I1 set_i I1, I62 print_i I1 inc_i I63 set_i I1, I62 set_i I2, I63 add_i I1, I1, I2 set_i I62, I1 LAAA: set_i I3, I63 set_i_ic I4, 10 lt_i_ic I3, I4, LAAB, LAAC LAAC: end which outputs: I reg 1 is 1 I reg 1 is 1 I reg 1 is 2 I reg 1 is 3 I reg 1 is 3 I reg 1 is 6 I reg 1 is 4 I reg 1 is 10 I reg 1 is 5 I reg 1 is 15 I reg 1 is 6 I reg 1 is 21 I reg 1 is 7 I reg 1 is 28 I reg 1 is 8 I reg 1 is 36 I reg 1 is 9 I reg 1 is 45 Cool, huh. Much more on this soon! Leon -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... If you eat yogurt you'll have lots of culture
Re: Something to hash out
Dan Sugalski sent the following bits through the ether: I like it The following amusing entries were posted on london.pm-list but I haven't seen them here, so without further ado: Greg McCarroll: pbc could be shortened to pb, which has two meanings precompiled byte code and pretty boy, as in who is a pretty boy, *squawk* I'm guessing that the assembler code is not 8-bit, so we cannot make a .po8 as in pieces of 8, aka parrot opcodes 8-bit, or some such tomfoolery .seed is always good as something that parrot can swallow up nicely precompiled code could have the extension .dead as in the parrot code is dead, it is dead parrot code, it is not running if we ever have safe and unsafe code where we check parity, we could have .pcc , parrot-y checked code (ok that was really bad) if ingy ever does anything like Inline for parrot, it could be called parott-ing (i better stop soon) .parrots is quite lame, but could be parrot source .feather could represent light to run code, as in precompiled bytecode ok, thats bad enough Patrick Carmichael: Parrot stuffit files for Macs would be .psit My daughter suggests .pex files - for executables, perhaps? Lucy McWilliam: .rip? HTH, Leon -- Leon Brocard.http://www.astray.com/ Iterative Software...http://www.iterative-software.com/ ... Fascinating, Captain
Re: Perl's parser and lexer will likely be in Perl (was Re: RFC 334 (v1) I'm {STILL} trying to understand this...)
Bradley M. Kuhn sent the following bits through the ether: It should be noted that in Larry's speech on Friday, he said that he wanted to write the Lexer and Parser for Perl in some subset of Perl. :) Is there a writeup somewhere for those who couldn't attend? Hmmm, I wonder what kind of subset would be necessary - surely the most useful constructs are also the most complicated... Leon -- Leon Brocard.http://www.astray.com/ yapc::Europehttp://yapc.org/Europe/ ... Where has all that spare time just come from? ;-)