[perl #41597] [PATCH] replacing explicit access to $^O in Configure
On Fr. 23. Feb. 2007, 07:28:38, acalpini wrote: > this patch adds an 'osname' key to Parrot's own $conf->data, which is > used in the configure process instead of $^O (and $Config{osname}). > > this patch does not affect the current configuration process. in the > long term, an --osname parameter (along with --arch and others, > probably) will be added to Configure.pl, to provide support for > cross-compilation. > > as of now, the value of $conf->data->get('osname') ALWAYS returns $^O. This patch hasn't been applied yet. It make sense to me as it is a prerequisite for cross-compilation. Should I go ahead and try to apply the patch ? Regards, Bernhard -- /* [EMAIL PROTECTED] */
Re: [svn:parrot] r22780 - in trunk/src: . pmc
On 10/11/2007, chromatic <[EMAIL PROTECTED]> wrote: > On Friday 09 November 2007 09:00:00 [EMAIL PROTECTED] wrote: > > > Author: paultcochrane > > Date: Fri Nov 9 08:59:59 2007 > > New Revision: 22780 > > > > Modified: > >trunk/src/objects.c > >trunk/src/pmc/namespace.pmc > >trunk/src/pmc_freeze.c > > > > Log: > > [core,pmc] Removed unreachable code compiler warnings > > > > Modified: trunk/src/objects.c > > === > >=== --- trunk/src/objects.c(original) > > +++ trunk/src/objects.c Fri Nov 9 08:59:59 2007 > > @@ -1918,10 +1918,8 @@ > > > > /* RT#45989 escape NUL char */ > > if (VTABLE_exists_keyed_str(interp, attr_hash, full_attr_name)) { > > -char * const c_error = string_to_cstring(interp, full_attr_name); > > -real_exception(interp, NULL, 1, "Attribute '%s' already exists", > > c_error); -/* RT#45991 leak! */ > > -string_cstring_free(c_error); > > +real_exception(interp, NULL, 1, "Attribute '%s' already exists", > > +string_to_cstring(interp, full_attr_name)); > > } > > I'm not a huge fan of this, especially when removing the RT #45591 link, but a > better solution is to use the format %Ss, which tells Parrot's sprintf engine > that it's getting a STRING. This avoids the memory leak of > string_to_cstring(). Ok, that's good to know. I'll go through and change the recent commits of this kind to use %Ss which probably also means that I can get rid of the ticket as well, right? Paul
[perl #47313] [BUG] config/auto/va_ptr.pm delivering surprising result
On Fri Nov 09 23:31:56 2007, [EMAIL PROTECTED] wrote: > It in no way refers to architecture actually. It refers to the calling > convention on an architecture(dependent upon implementation). The x86 > method is by pushing arguments onto the stack, and the ppc method is in > registers. On amd64, parrot reports ppc, which is essentially correct. > Calling it x86 and ppc is probably just because those are the two > dominant architectures. They could be labeled differently. > Thanks, Josh, I'd like to work this explanation into the module's POD. Is there some place where this distinction is "officially" explained? (Wikipedia turned up nothing for 'va_ptr'; Google mostly turned up references to this very package.)
[perl #43326] [TODO] config/auto/pmc.pm: Write unit tests
The patch attached provides a small refactoring of Parrot configuration step auto::pmc. Package global variable %PMC_PARENTS is replaced by an element in the auto::pmc class's data structure. Two test files replace the current placeholder file. I will apply in 2-3 days if no one objects. Thank you very much. kid51 Index: MANIFEST === --- MANIFEST(revision 22788) +++ MANIFEST(working copy) @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Sat Nov 10 01:52:43 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Sat Nov 10 16:56:27 2007 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -3061,7 +3061,8 @@ t/configure/121-inter_types-01.t[] t/configure/121-inter_types-02.t[] t/configure/122-auto_ops.t [] -t/configure/123-auto_pmc.t [] +t/configure/123-auto_pmc-01.t [] +t/configure/123-auto_pmc-02.t [] t/configure/124-auto_alignptrs-01.t [] t/configure/124-auto_alignptrs-02.t [] t/configure/124-auto_alignptrs-03.t [] Index: t/configure/123-auto_pmc-02.t === --- t/configure/123-auto_pmc-02.t (revision 0) +++ t/configure/123-auto_pmc-02.t (revision 0) @@ -0,0 +1,158 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 123-auto_pmc-02.t + +use strict; +use warnings; +use Test::More qw(no_plan); # tests => 22; +use Carp; +use Cwd; +use File::Path qw| mkpath |; +use File::Temp qw| tempdir |; +use lib qw( lib t/configure/testlib ); +use_ok('config::init::defaults'); +use_ok('config::auto::pmc'); +use Parrot::Configure; +use Parrot::Configure::Options qw( process_options ); +use Parrot::Configure::Test qw( test_step_thru_runstep); + +my $args = process_options( +{ +argv => [ ], +mode => q{configure}, +} +); + +my $conf = Parrot::Configure->new; + +test_step_thru_runstep( $conf, q{init::defaults}, $args ); + +my $pkg = q{auto::pmc}; + +$conf->add_steps($pkg); +$conf->options->set( %{$args} ); + +my ( $task, $step_name, @step_params, $step); +$task= $conf->steps->[1]; +$step_name = $task->step; [EMAIL PROTECTED] = @{ $task->params }; + +$step = $step_name->new(); +ok( defined $step, "$step_name constructor returned defined value" ); + +my $cwd = cwd(); +{ +my $tdir = tempdir( CLEANUP => 1 ); +ok( chdir $tdir, 'changed to temp directory for testing' ); + +my $pmc_with_PCCMETHOD = q{yes.pmc}; +open my $IN1, ">", $pmc_with_PCCMETHOD +or croak "Unable to open file for writing: $!"; +print $IN1 "PCCMETHOD\n"; +close $IN1 or croak "Unable to close file after writing: $!"; +ok(auto::pmc::contains_pccmethod($pmc_with_PCCMETHOD), +"Internal subroutine contains_pccmethod returns true as expected"); + +my $pmc_sans_PCCMETHOD = q{no.pmc}; +open my $IN2, ">", $pmc_sans_PCCMETHOD +or croak "Unable to open file for writing: $!"; +print $IN2 "Hello world\n"; +close $IN2 or croak "Unable to close file after writing: $!"; +ok( ! defined ( +auto::pmc::contains_pccmethod($pmc_sans_PCCMETHOD) +), "Internal subroutine contains_pccmethod returns true as expected" +); + +my $file = 'foobar'; +eval { auto::pmc::contains_pccmethod($file); }; +like($@, qr/Can't read '$file'/, "Got expected 'die' message"); #' + +ok( chdir $cwd, 'changed back to original directory after testing' ); +} + +{ +my $tdir = tempdir( CLEANUP => 1 ); +ok( chdir $tdir, 'changed to temp directory for testing' ); + +my $pmcdir = qq{$tdir/src/pmc}; +ok(mkpath($pmcdir, 0, 0755), "Able to make directory for testing"); +my $num = qq{$pmcdir/pmc.num}; +open my $IN3, ">", $num or croak "Unable to open file for writing: $!"; +print $IN3 "# comment line\n"; +print $IN3 "\n"; +print $IN3 "default.pmc\t0\n"; +print $IN3 "null.pmc1\n"; +print $IN3 "env.pmc 2\n"; +print $IN3 "notapmc 3\n"; +close $IN3 or croak "Unable to close file after writing: $!"; +my $order_ref = auto::pmc::get_pmc_order(); +is_deeply( +$order_ref, +{ +'default.pmc' => 0, +'null.pmc' => 1, +'env.pmc' => 2, +}, +"Able to read src/pmc/pmc.num correctly" +); + +my @pmcs = qw| env.pmc default.pmc null.pmc other.pmc |; +my @sorted_pmcs = auto::pmc::sort_pmcs(@pmcs); +is_deeply( +[EMAIL PROTECTED], +[ qw| default.pmc null.pmc env.pmc other.pmc | ], +"PMCs sorted correctly" +); + +ok( chdir $cwd, 'changed back to original directory after testing' ); +} + +{ +my $tdir = tempdir( CLEANUP =>
Re: [perl #47313] [BUG] config/auto/va_ptr.pm delivering surprising result
On Nov 10, 2007, at 7:42 AM, James Keenan via RT wrote: On Fri Nov 09 23:31:56 2007, [EMAIL PROTECTED] wrote: It in no way refers to architecture actually. It refers to the calling convention on an architecture(dependent upon implementation). The x86 method is by pushing arguments onto the stack, and the ppc method is in registers. On amd64, parrot reports ppc, which is essentially correct. Calling it x86 and ppc is probably just because those are the two dominant architectures. They could be labeled differently. Thanks, Josh, I'd like to work this explanation into the module's POD. Is there some place where this distinction is "officially" explained? (Wikipedia turned up nothing for 'va_ptr'; Google mostly turned up references to this very package.) Reading http://en.wikipedia.org/wiki/Stdarg.h may help a little. But it still doesn't get into the low level implementation. To really get into the details, you'd have to find the ABI for the architecture(OS and processor, since the OS has a fair bit of say in it). Let's just say it's probably one of those really terse things that gets written once and forgotten about because it's been written.
Re: [svn:parrot] r22780 - in trunk/src: . pmc
On Saturday 10 November 2007 05:21:00 Paul Cochrane wrote: > On 10/11/2007, chromatic <[EMAIL PROTECTED]> wrote: > > I'm not a huge fan of this, especially when removing the RT #45591 link, > > but a better solution is to use the format %Ss, which tells Parrot's > > sprintf engine that it's getting a STRING. This avoids the memory leak > > of string_to_cstring(). > Ok, that's good to know. I'll go through and change the recent > commits of this kind to use %Ss which probably also means that I can > get rid of the ticket as well, right? Absolutely! -- c
Re: [perl #47313] [BUG] config/auto/va_ptr.pm delivering surprising result
On Friday 09 November 2007 23:28:52 Joshua Isom wrote: > It in no way refers to architecture actually. It refers to the calling > convention on an architecture(dependent upon implementation). The x86 > method is by pushing arguments onto the stack, and the ppc method is in > registers. On amd64, parrot reports ppc, which is essentially correct. > Calling it x86 and ppc is probably just because those are the two > dominant architectures. They could be labeled differently. How about "stack" and "register", or are there better labels? If it's confusing now, it will probably be confusing in the future, especially for everyone who doesn't know it's the platform ABI. -- c
[perl #47313] [BUG] config/auto/va_ptr.pm delivering surprising result
On Sat Nov 10 11:55:07 2007, [EMAIL PROTECTED] wrote: > > How about "stack" and "register", or are there better labels? If it's > confusing now, it will probably be confusing in the future, especially for > everyone who doesn't know it's the platform ABI. > So if we were to change: x86 -> stack ppc -> register ... would we also want to change: -DVA_TYPE_X86 -> -DVA_TYPE_STACK -DVA_TYPE_PPC -> -DVA_TYPE_REGISTER ?
[perl #43324] [TODO] config/auto/headers.pm: Write unit tests
Patch attached refactors Parrot configuration step auto::headers to improve testability. 3 additional test files contributed. Will apply in 2-3 days if there is no objection. Index: MANIFEST === --- MANIFEST(revision 22788) +++ MANIFEST(working copy) @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Sat Nov 10 01:52:43 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Sun Nov 11 00:43:11 2007 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -3068,6 +3068,9 @@ t/configure/124-auto_alignptrs-04.t [] t/configure/124-auto_alignptrs-05.t [] t/configure/125-auto_headers-01.t [] +t/configure/125-auto_headers-02.t [] +t/configure/125-auto_headers-03.t [] +t/configure/125-auto_headers-04.t [] t/configure/126-auto_sizes-01.t [] t/configure/127-auto_byteorder-01.t [] t/configure/127-auto_byteorder-02.t [] Index: t/configure/125-auto_headers-02.t === --- t/configure/125-auto_headers-02.t (revision 0) +++ t/configure/125-auto_headers-02.t (revision 0) @@ -0,0 +1,82 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 125-auto_headers-02.t + +use strict; +use warnings; +use Test::More tests => 13; +use Carp; +use lib qw( lib t/configure/testlib ); +use_ok('config::init::defaults'); +use_ok('config::auto::headers'); +use Parrot::Configure; +use Parrot::Configure::Options qw( process_options ); +use Parrot::Configure::Test qw( test_step_thru_runstep); + +my $args = process_options( +{ +argv => [ ], +mode => q{configure}, +} +); + +my $conf = Parrot::Configure->new; + +test_step_thru_runstep( $conf, q{init::defaults}, $args ); + +my $pkg = q{auto::headers}; + +$conf->add_steps($pkg); +$conf->options->set( %{$args} ); + +my ( $task, $step_name, @step_params, $step); +$task= $conf->steps->[1]; +$step_name = $task->step; [EMAIL PROTECTED] = @{ $task->params }; + +$step = $step_name->new(); +ok( defined $step, "$step_name constructor returned defined value" ); +isa_ok( $step, $step_name ); +ok( $step->description(), "$step_name has description" ); + +my $ret = $step->runstep($conf); +ok( $ret, "$step_name runstep() returned true value" ); +is($step->result(), q{}, "Result is empty string as expected"); + +pass("Keep Devel::Cover happy"); +pass("Completed all tests in $0"); + +### DOCUMENTATION ### + +=head1 NAME + +125-auto_headers-02.t - test config::auto::headers + +=head1 SYNOPSIS + +% prove t/configure/125-auto_headers-02.t + +=head1 DESCRIPTION + +The files in this directory test functionality used by F. + +The tests in this file test config::auto::headers in its most typical +case. + +=head1 AUTHOR + +James E Keenan + +=head1 SEE ALSO + +config::auto::headers, F. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Property changes on: t/configure/125-auto_headers-02.t ___ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Index: t/configure/125-auto_headers-03.t === --- t/configure/125-auto_headers-03.t (revision 0) +++ t/configure/125-auto_headers-03.t (revision 0) @@ -0,0 +1,91 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 125-auto_headers-03.t + +use strict; +use warnings; +use Test::More tests => 14; +use Carp; +use lib qw( lib t/configure/testlib ); +use_ok('config::init::defaults'); +use_ok('config::auto::headers'); +use Parrot::Configure; +use Parrot::Configure::Options qw( process_options ); +use Parrot::Configure::Test qw( test_step_thru_runstep); +use Parrot::IO::Capture::Mini; + +my $args = process_options( +{ +argv => [ q{--verbose} ], +mode => q{configure}, +} +); + +my $conf = Parrot::Configure->new; + +test_step_thru_runstep( $conf, q{init::defaults}, $args ); + +my $pkg = q{auto::headers}; + +$conf->add_steps($pkg); +$conf->options->set( %{$args} ); + +my ( $task, $step_name, @step_params, $step); +$task= $conf->steps->[1]; +$step_name = $task->step; [EMAIL PROTECTED] = @{ $task->params }; + +$step = $step_name->new(); +ok( defined $step, "$step_name constructor returned defined value" ); +isa_ok( $step, $step_name ); +ok( $step->description(), "$step_name has description" ); + +{ +my $tie_out = tie *STDOUT, "Parrot::IO::Capture::Mini" +or croak "Unable to tie"; +my $ret = $step->runstep($conf); +my @more_lines
Re: [perl #47313] [BUG] config/auto/va_ptr.pm delivering surprising result
On Saturday 10 November 2007 15:48:08 James Keenan via RT wrote: > On Sat Nov 10 11:55:07 2007, [EMAIL PROTECTED] wrote: > > How about "stack" and "register", or are there better labels? If it's > > confusing now, it will probably be confusing in the future, especially > > for everyone who doesn't know it's the platform ABI. > > So if we were to change: > > x86 -> stack > ppc -> register > > ... would we also want to change: > > -DVA_TYPE_X86 -> -DVA_TYPE_STACK > -DVA_TYPE_PPC -> -DVA_TYPE_REGISTER > > ? Yes, exactly. -- c
Re: [perl #47313] [BUG] config/auto/va_ptr.pm delivering surprising result
> > How about "stack" and "register", or are there better labels? If it's > confusing now, it will probably be confusing in the future, especially for > everyone who doesn't know it's the platform ABI. > That sounds like the essential distinction to me. While I was researching the topic, I came across this site: http://www.agner.org/optimize/ It has some tables that seem to be useful summaries of various compilers and architectures, e.g.: http://www.agner.org/optimize/calling_conventions.pdf Just forget that it's supposed to be about C++, and resist the temptation to optimise anything. -- Email and shopping with the feelgood factor! 55% of income to good causes. http://www.ippimail.com