Re: [REPATCH] Re: [PATCH] Bash some more warnings
Josh Wilmes: > Any chance of getting this in some time soon? The key.c part of it fixes > the broken tcc (and probably lcc) builds. All tests passed with tcc for > me, which is neat. Most of key.c's about to die anyway, so I don't consider that particularly important. OTOH, having non-broken builds is nice. I don't have much time to apply it now, but if nobody else gets to this before tonight, I'll do it then. -- So what if I have a fertile brain? Fertilizer happens. -- Larry Wall in <[EMAIL PROTECTED]>
Re: De Morgan's theorum
Nicholas Clark <[EMAIL PROTECTED]> writes: >I have remembered the name correctly, haven't I? > >Would it gain us much implementing De Morgan's theorem in the peephole >optimiser? It gets even more fun when there are NOTs on the other side as well... Speaking of which why does NOT have two UNOPs - can we collapse those ? > >nick@Bagpuss [nick]$ perl -MO=Terse -e 'print 0+(!$l && !$r)' >LISTOP (0x164048) leave [1] >OP (0x164070) enter >COP (0x164008) nextstate >LISTOP (0x163fc0) print >OP (0x163fe8) pushmark >BINOP (0x163f98) add [1] >SVOP (0x163db0) const IV (0xed2b8) 0 >UNOP (0x163f78) null >LOGOP (0x10db20) and >UNOP (0x163e68) not >UNOP (0x163e48) null [15] Why two UNOPs ? >SVOP (0x163dd0) gvsv GV (0x10a974) *l >UNOP (0x163f58) not >UNOP (0x163f38) null [15] >SVOP (0x163e88) gvsv GV (0x10a98c) *r >-e syntax OK >nick@Bagpuss [nick]$ perl -MO=Terse -e 'print 0+!($l || $r)' >LISTOP (0x164028) leave [1] >OP (0x164050) enter >COP (0x163fe8) nextstate >LISTOP (0x163fa0) print >OP (0x163fc8) pushmark >BINOP (0x163f78) add [1] >SVOP (0x163db0) const IV (0xed2b8) 0 >UNOP (0x163f58) not >UNOP (0x163f38) null >LOGOP (0x10db20) or >UNOP (0x163e48) null [15] >SVOP (0x163dd0) gvsv GV (0x10a974) *l >UNOP (0x163f18) null [15] >SVOP (0x163e68) gvsv GV (0x10a98c) *r >-e syntax OK > > >For "much" equal to 1 op in total. > >I think that the answer is "no, do it by hand if it matters that much", >doesn't it? > >This also might be a perl6 question, for a more "serious" -O2 optimiser. >Hmm. Would parrot benefit from nand and nor ops? > >[beware of cross posting when replying] > >Nicholas Clark -- Nick Ing-Simmons http://www.ni-s.u-net.com/
Creating Parrot Code on the fly
I've reading through the Parrot documentation and I am still a bit hazy about how data and code are stored within the memory model of the Parrot VM. As things stand with the Parrot VM at present, is it possible to create a structure containing byte code and then at some later point execute it? Cheers, Sam Phillips.
Re: Creating Parrot Code on the fly
At 3:36 PM + 2/20/02, Sam Phillips wrote: >I've reading through the Parrot documentation and I am still a bit >hazy about how data and code are stored within the memory model of >the Parrot VM. Docs on the way. >As things stand with the Parrot VM at present, is it possible to >create a structure containing byte code and then at some later point >execute it? At the moment, no. We will, but it's not been defined--there are some security aspects to it that are sort of troubling. I want to make sure that however we do it is possible to wall off in a Safe interpreter without crippling things. -- Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: PDDs, guys.
At 9:22 AM + 2/19/02, Piers Cawley wrote: >Dan Sugalski <[EMAIL PROTECTED]> writes: >> The first person to say "But XP says code first!" will be summarily >> mocked, as that's completely full of crap. You have been warned. :) > >Actually, XP says tests/interface first and be prepared to change it >if the code tells you to. That, then, would be a good reason to mock them. :) >But XP is specifically about small teams working in close physical >proximity on an application that is, in some sense 'complete': >ie. interfaces generally don't have to be published. Which doesn't >really sound like Parrot anyway. Yeah, compilers (and OSes, and other big projects) don't seem to fit the XP mold in many ways. XP looks good for projects equivalent to building a house. Projects akin to bridges, large buildings (like, say, cathedrals...), or modern CPUs are in a different class. -- Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: Keys and Indices PDD
At 7:19 PM + 2/19/02, Nicholas Clark wrote: >On Mon, Feb 18, 2002 at 01:12:24PM -0500, Dan Sugalski wrote: > > Non-aggregates can (and must) implement the _keyed vtable method, > > though it may well do nothing but throw an exception. > > > > References, for example, will implement them, just passing the access > > down to the referent. > >So does this mean that (it is likely?) that the default _keyed vtable methods >on a non-aggregate will return self if KEY* is NULL, otherwise throw an >exception? Hrm, good question. I think yes, otherwise the NULL check gets pushed out into a zillion different places. -- Dan --"it's like this"--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: PDDs, guys.
We're getting wildly off topic. And there's no PDD for the JIT, either. -- FAILURE: When Your Best Just Isn't Good Enough http://www.despair.com
Re: De Morgan's theorum
Brian Lee Ray <[EMAIL PROTECTED]> writes: >From: "Nicholas Clark" <[EMAIL PROTECTED]> >Sent: Tuesday, February 19, 2002 3:15 PM >Subject: De Morgan's theorum >> I have remembered the name correctly, haven't I? >Yes. If we were really serious about optimizing logical expressions, >we would probably want to use Karnaugh maps. Karnaugh maps are for Humans with visual ways of understanding. There is an easy-to-code Algorithm (Quine McLusky?) which does the job for computers - it it can handle what would be (projection of) an n-Dimensional hyper cube of a Karnaugh map. >However, I just don't >think most programs spend enough time doing logical comparison to >really matter. Besides which, such techniques work best on complex >expressions, which are rare indeed. >I could be wrong, of course. Maybe someone could run some benchmarks? > >brian. -- Nick Ing-Simmons http://www.ni-s.u-net.com/
Re: De Morgan's theorum
On Wed, Feb 20, 2002 at 07:04:44PM +, Nick Ing-Simmons wrote: > Karnaugh maps are for Humans with visual ways of understanding. > There is an easy-to-code Algorithm (Quine McLusky?) which does > the job for computers - it it can handle what would be (projection of) > an n-Dimensional hyper cube of a Karnaugh map. Yep, that's the one. I remember implementing the algorithm long ago as part of a computer architecture class I was taking. I don't think I have the code where I can get it, but it'd probably be best to reimplement from scratch anyway. -Scott -- Jonathan Scott Duff [EMAIL PROTECTED]
[Patch] Fix that broken pdump
well, pdump is broken...the patch to fix it... Index: pdump.c === RCS file: /cvs/public/parrot/pdump.c,v retrieving revision 1.10 diff -u -r1.10 pdump.c --- pdump.c 18 Feb 2002 08:26:03 - 1.10 +++ pdump.c 20 Feb 2002 21:52:49 - @@ -19,7 +19,7 @@ opcode_t *packed; size_tpacked_size; struct PackFile * pf; -struct Parrot_Interp *interpreter = make_interpreter(0); +struct Parrot_Interp *interpreter; if (argc != 2) { fprintf(stderr, "pdump: usage: pdump FILE\n"); @@ -37,8 +37,11 @@ } init_world(); - interpreter = make_interpreter(0); + +if(!interpreter) { +return 1; +} packed_size = file_stat.st_size;
[Patch] Win32: Borland C support
this patch adds support for the freely availabe borland c++ 5.5.1 compiler depends on: - josh's patch to remove ssize_t from CPrederef.pm - working borland compiler (compiler must know where to find headers and libs) - Perl's Config.pm modified to use cc='bcc32.exe' not of cc='cl.exe' - a working make utility (borland make doesn't work, nmake does) changes: - add bcc in hints/mswin32.pl - clean up for msvc++ in hints/mswin32.pl - remove a space from Configure.pl (very very important for bcc) - add a O_BINARY flag to open() in pdump.c, embed.c (required by bcc) - define O_BINARY 0 when it's not defined (win32 knows it, linux not) and the why: - parrot is MUCH faster when compiled with borland c (make test on p2-450, 320MB): * msvc++: 313 seconds * bcc: 251 seconds Index: Configure.pl === RCS file: /cvs/public/parrot/Configure.pl,v retrieving revision 1.92 diff -u -r1.92 Configure.pl --- Configure.pl 15 Feb 2002 23:20:31 - 1.92 +++ Configure.pl 20 Feb 2002 23:05:29 - @@ -876,7 +876,7 @@ sub compiletestc { my ($name) = @_; -my $cmd = "$c{cc} $c{ccflags} -I./include -c $c{ld_out} $name$c{o} $name.c"; +my $cmd = "$c{cc} $c{ccflags} -I./include -c $c{ld_out}$name$c{o} $name.c"; system($cmd) and die "C compiler died! Command was '$cmd'\n"; $cmd = "$c{ld} $c{ldflags} $name$c{o} $c{cc_exe_out}$name$c{exe} $c{libs}"; Index: embed.c === RCS file: /cvs/public/parrot/embed.c,v retrieving revision 1.11 diff -u -r1.11 embed.c --- embed.c 18 Feb 2002 08:26:03 - 1.11 +++ embed.c 20 Feb 2002 23:05:30 - @@ -96,7 +96,7 @@ return NULL; } -fd = open(filename, O_RDONLY); +fd = open(filename, O_RDONLY | O_BINARY); if (!fd) { fprintf(stderr, "Parrot VM: Can't open %s, code %i.\n", filename, errno); return NULL; Index: pdump.c === RCS file: /cvs/public/parrot/pdump.c,v retrieving revision 1.10 diff -u -r1.10 pdump.c --- pdump.c 18 Feb 2002 08:26:03 - 1.10 +++ pdump.c 20 Feb 2002 23:05:30 - @@ -30,7 +30,7 @@ printf("can't stat %s, code %i\n", argv[1], errno); return 1; } -fd = open(argv[1], O_RDONLY); +fd = open(argv[1], O_RDONLY | O_BINARY); if (!fd) { printf("Can't open, error %i\n", errno); return 1; Index: hints/mswin32.pl === RCS file: /cvs/public/parrot/hints/mswin32.pl,v retrieving revision 1.9 diff -u -r1.9 mswin32.pl --- hints/mswin32.pl 31 Jan 2002 21:46:43 - 1.9 +++ hints/mswin32.pl 20 Feb 2002 23:05:30 - @@ -1,6 +1,7 @@ { my $is_msvc = grep { $c{cc} eq $_ } ( qw(cl cl.exe) ); my $is_mingw = grep { $c{cc} eq $_ } ( qw(gcc gcc.exe) ); + my $is_bcc = grep { $c{cc} eq $_ } ( qw(bcc32 bcc32.exe) ); $c{rm_f} = '$(PERL) -MExtUtils::Command -e rm_f'; $c{rm_rf} = '$(PERL) -MExtUtils::Command -e rm_rf'; @@ -9,8 +10,6 @@ $c{o} = '.obj'; $c{cc_o_out} = '-Fo'; $c{cc_exe_out} = '-Fe'; - $c{ld_out} = '/OUT:'; - $c{cc_ldflags} = '/link'; $c{cc_ldflags} = '/link'; $c{cc_debug} = '-Zi'; $c{ld_debug} = '-debug'; @@ -27,6 +26,25 @@ # The logo gets printed to STDERR; hence the redirection. my $cc_output = `$c{cc} 2>&1`; $c{ccflags} =~ s/-O1 // if $cc_output =~ m/Standard/; + } + if( $is_bcc ) { + $c{o} = '.obj'; +$c{ccflags} = '-O2 -w-8066 -DWIN32 -DNO_STRICT -DNDEBUG -D_CONSOLE'; + $c{cc_o_out} = '-o'; + $c{cc_exe_out} = '-e'; + $c{cc_debug} = '-v'; + +$c{ld} = 'bcc32.exe'; +$c{ldflags} = ''; + $c{ld_out} = '-e'; + $c{cc_ldflags} = ''; + $c{ld_debug} = '-v'; + $c{ld_shard} = '-WD'; +$c{libs} = 'import32.lib cw32.lib'; + + $c{platform} = 'win32'; + $c{cp} = 'copy'; + $c{slash} = '\\'; } elsif( $is_mingw ) { $c{ld} = 'gcc'; Index: include/parrot/parrot.h === RCS file: /cvs/public/parrot/include/parrot/parrot.h,v retrieving revision 1.26 diff -u -r1.26 parrot.h --- include/parrot/parrot.h 18 Feb 2002 08:26:10 - 1.26 +++ include/parrot/parrot.h 20 Feb 2002 23:05:30 - @@ -92,6 +92,12 @@ #endif #endif +/* On Win32 we need the constant O_BINARY for open() (at least for Borland C), + but on UNIX it doesn't exist, so set it to 0 if it's not defined + */ +#ifndef O_BINARY +#define O_BINARY 0 +#endif /* define a macro to acknowledge an unused argument, and silence a "helpful" compiler warning. gcc will emit a warning on an empty if body unless {} is
Re: De Morgan's theorum
On Wed, Feb 20, 2002 at 07:04:44PM +, Nick Ing-Simmons wrote: > Brian Lee Ray <[EMAIL PROTECTED]> writes: > >From: "Nicholas Clark" <[EMAIL PROTECTED]> > >Sent: Tuesday, February 19, 2002 3:15 PM > >Subject: De Morgan's theorum > >> I have remembered the name correctly, haven't I? > >Yes. If we were really serious about optimizing logical expressions, > >we would probably want to use Karnaugh maps. > > Karnaugh maps are for Humans with visual ways of understanding. > There is an easy-to-code Algorithm (Quine McLusky?) which does > the job for computers - it it can handle what would be (projection of) > an n-Dimensional hyper cube of a Karnaugh map. Unfortunately this problem is NP-complete and Quine-McClusky is an exact algorithm. A heuristic algorithm like espresso might be better, but > >However, I just don't > >think most programs spend enough time doing logical comparison to > >really matter. Besides which, such techniques work best on complex > >expressions, which are rare indeed. I suspect this is true. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net
Re: [Patch] Win32: Borland C support
At 0:39 on 02/21/2002 +0100, "Ritz Daniel" <[EMAIL PROTECTED]> wrote: > - add a O_BINARY flag to open() in pdump.c, embed.c (required by bcc) > - define O_BINARY 0 when it's not defined (win32 knows it, linux not) Offhand, i'm wondering if it wouldn't be better to make these files use the ParrotIO subsystem rather than directly calling open(). I'm not sure what implications that might have, as there isn't currently a ParrotIO PDD :) --Josh
Re: De Morgan's theorum
G'day all. On Tue, Feb 19, 2002 at 09:15:02PM +, Nicholas Clark wrote: > Would it gain us much implementing De Morgan's theorem in the peephole > optimiser? I suspect that most code generators for Parrot will translate LOGOPs as jumps (i.e. the way most compilers do it), in which case the De Morgan optimisations will fall out naturally. Cheers, Andrew Bromage