[svn:parrot] r40208 - in trunk: . config/auto lib/Parrot/Configure/Options lib/Parrot/Configure/Options/Conf t/steps/auto

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Wed Jul 22 00:41:47 UTC 2009


Author: whiteknight
Date: Wed Jul 22 00:41:45 2009
New Revision: 40208
URL: https://trac.parrot.org/parrot/changeset/40208

Log:
[gc_options_remove] apply patch from kid51++ for the gc_options_remove branch. Required some tweaking of file names to match things that have changed in the GC in recent months. For TT #490

Modified:
   trunk/Configure.pl
   trunk/config/auto/gc.pm
   trunk/lib/Parrot/Configure/Options/Conf.pm
   trunk/lib/Parrot/Configure/Options/Conf/Shared.pm
   trunk/t/steps/auto/gc-01.t

Modified: trunk/Configure.pl
==============================================================================
--- trunk/Configure.pl	Wed Jul 22 00:05:52 2009	(r40207)
+++ trunk/Configure.pl	Wed Jul 22 00:41:45 2009	(r40208)
@@ -355,11 +355,6 @@
 
 Use JIT to emit a native executable.
 
-=item C<--gc=(type)>
-
-Determine the type of garbage collection. The value for C<type> should be one
-of: C<gc>, C<libc>, C<malloc> or C<malloc-trace>. The default is C<gc>.
-
 =back
 
 =head2 International Components For Unicode (ICU) Options

Modified: trunk/config/auto/gc.pm
==============================================================================
--- trunk/config/auto/gc.pm	Wed Jul 22 00:05:52 2009	(r40207)
+++ trunk/config/auto/gc.pm	Wed Jul 22 00:41:45 2009	(r40208)
@@ -7,16 +7,15 @@
 
 =head1 DESCRIPTION
 
-Checks whether the C<--gc> command-line option was passed to F<Configure.pl>
-and sets the memory allocator accordingly.
+Sets memory allocator.
 
-Eventually, C<--gc> will be able to take any of the following values:
+Currently, we have only one choice:  the memory allocator in
+F<src/gc/alloc_resources.c>.
 
-=over
+In the future, we will have a C<--gc> command-line option which will enable
+the configurer to choose among the default and:
 
-=item C<gc>
-
-The default. Use the memory allocator in F<src/resources.c>.
+=over4
 
 =item C<libc>
 
@@ -25,19 +24,17 @@
 
 =item C<malloc>
 
-Use the malloc in F<src/malloc.c> along with F<src/gc/res_lea.c>.
+Use the malloc in F<src/gc/malloc.c> along with F<src/gc/res_lea.c>.
 Since this uses res_lea.c, it doesn't currently work either.  See [perl #42774].
 
 =item C<malloc-trace>
 
-Use the malloc in F<src/malloc-trace.c> with tracing enabled, along
+Use the malloc in F<src/gc/malloc-trace.c> with tracing enabled, along
 with F<src/gc/res_lea.c>.
 Since this uses res_lea.c, it doesn't work currently either.  See [perl #42774].
 
 =back
 
-So, for the time being, only the default value works.
-
 =cut
 
 package auto::gc;
@@ -49,8 +46,6 @@
 
 use Parrot::Configure::Utils ':auto';
 
-
-# valid libc/malloc/malloc-trace/gc
 sub _init {
     my $self = shift;
     my %data;
@@ -62,47 +57,15 @@
 sub runstep {
     my ( $self, $conf ) = @_;
 
-    my $gc = $conf->options->get('gc');
+    my $gc = 'gc';
 
-    # default is GC in alloc_resources.c
-    $gc = 'gc' unless defined $gc;
-
-    if ( $gc =~ /^malloc(?:-trace)?$/ ) {
-        $conf->data->set(
-            TEMP_gc_c => <<"EOF",
-\$(SRC_DIR)/$gc\$(O):	\$(GENERAL_H_FILES) \$(SRC_DIR)/$gc.c
-\$(SRC_DIR)/gc/res_lea\$(O):	\$(GENERAL_H_FILES) \$(SRC_DIR)/gc/res_lea.c
-EOF
-            TEMP_gc_o => "\$(SRC_DIR)\/$gc\$(O) \$(SRC_DIR)/gc/res_lea\$(O)",
-            gc_flag   => '-DGC_IS_MALLOC',
-        );
-    }
-    elsif ( $gc eq 'libc' ) {
-        $conf->data->set(
-            TEMP_gc_c => <<"EOF",
-\$(SRC_DIR)/gc/res_lea\$(O):	\$(GENERAL_H_FILES) \$(SRC_DIR)/gc/res_lea.c
-EOF
-            TEMP_gc_o => "\$(SRC_DIR)/gc/res_lea\$(O)",
-            gc_flag   => '-DGC_IS_MALLOC',
-        );
-        # tests mallinfo after allocation of 128 bytes
-        if ( $conf->data->get('i_malloc') ) {
-            $conf->data->set( malloc_header => 'malloc.h' );
-        }
-        else {
-            $conf->data->set( malloc_header => 'stdlib.h' );
-        }
-    }
-    else {
-        $gc = 'gc';
-        $conf->data->set(
-            TEMP_gc_c => <<"EOF",
+    $conf->data->set(
+        TEMP_gc_c => <<"EOF",
 \$(SRC_DIR)/gc/alloc_resources\$(O):	\$(GENERAL_H_FILES) \$(SRC_DIR)/gc/alloc_resources.c
 EOF
-            TEMP_gc_o => "\$(SRC_DIR)/gc/alloc_resources\$(O)",
-            gc_flag   => '',
-        );
-    }
+        TEMP_gc_o => "\$(SRC_DIR)/gc/alloc_resources\$(O)",
+        gc_flag   => '',
+    );
     print(" ($gc) ") if $conf->options->get('verbose');
 
     return 1;

Modified: trunk/lib/Parrot/Configure/Options/Conf.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Options/Conf.pm	Wed Jul 22 00:05:52 2009	(r40207)
+++ trunk/lib/Parrot/Configure/Options/Conf.pm	Wed Jul 22 00:41:45 2009	(r40208)
@@ -94,8 +94,6 @@
    --cgoto=0            Don't build cgoto core - recommended when short of mem
    --jitcapable         Use JIT
    --execcapable        Use JIT to emit a native executable
-   --gc=(type)          Determine the type of garbage collection
-                        type=(gc|libc|malloc|malloc-trace) default is gc
    --without-threads    Build parrot without thread support
 
 External Library Options:

Modified: trunk/lib/Parrot/Configure/Options/Conf/Shared.pm
==============================================================================
--- trunk/lib/Parrot/Configure/Options/Conf/Shared.pm	Wed Jul 22 00:05:52 2009	(r40207)
+++ trunk/lib/Parrot/Configure/Options/Conf/Shared.pm	Wed Jul 22 00:41:45 2009	(r40208)
@@ -29,7 +29,6 @@
     fatal
     fatal-step
     floatval
-    gc
     help
     icu-config
     icuheaders

Modified: trunk/t/steps/auto/gc-01.t
==============================================================================
--- trunk/t/steps/auto/gc-01.t	Wed Jul 22 00:05:52 2009	(r40207)
+++ trunk/t/steps/auto/gc-01.t	Wed Jul 22 00:41:45 2009	(r40208)
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 35;
+use Test::More tests =>  8;
 use lib qw( lib t/configure/testlib );
 use_ok('config::auto::gc');
 use Parrot::Configure;
@@ -48,94 +48,13 @@
         "Got expected value for 'gc_flag'");
 }
 
-$conf->replenish($serialized);
-
-########### --gc=gc ###########
-
-($args, $step_list_ref) = process_options( {
-    argv => [ q{--gc=gc} ],
-    mode => q{configure},
-} );
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-my $ret = $step->runstep($conf);
-ok( $ret, "runstep() returned true value" );
-is($conf->data->get('gc_flag'), q{},
-    "Got expected value for 'gc_flag'");
-
-$conf->replenish($serialized);
-
-########### --gc=libc ###########
-
-($args, $step_list_ref) = process_options( {
-    argv => [ q{--gc=libc} ],
-    mode => q{configure},
-} );
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-$conf->data->set('i_malloc' => 1);
-$ret = $step->runstep($conf);
-ok( $ret, "runstep() returned true value" );
-is($conf->data->get('gc_flag'), '-DGC_IS_MALLOC',
-    "Got expected value for 'gc_flag'");
-is($conf->data->get('malloc_header'), 'malloc.h',
-    "Got expected value for 'malloc_header'");
-
-$conf->replenish($serialized);
-
-########### --gc=libc ###########
-
-($args, $step_list_ref) = process_options( {
-    argv => [ q{--gc=libc} ],
-    mode => q{configure},
-} );
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-$conf->data->set('i_malloc' => undef);
-$ret = $step->runstep($conf);
-ok( $ret, "runstep() returned true value" );
-is($conf->data->get('gc_flag'), '-DGC_IS_MALLOC',
-    "Got expected value for 'gc_flag'");
-is($conf->data->get('malloc_header'), 'stdlib.h',
-    "Got expected value for 'malloc_header'");
-
-$conf->replenish($serialized);
-
-########### --gc=malloc ###########
-
-($args, $step_list_ref) = process_options( {
-    argv => [ q{--gc=malloc} ],
-    mode => q{configure},
-} );
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-$ret = $step->runstep($conf);
-ok( $ret, "runstep() returned true value" );
-is($conf->data->get('gc_flag'), '-DGC_IS_MALLOC',
-    "Got expected value for 'gc_flag'");
-
-$conf->replenish($serialized);
-
-########### --gc=malloc-trace ###########
-
-($args, $step_list_ref) = process_options( {
-    argv => [ q{--gc=malloc-trace} ],
-    mode => q{configure},
-} );
-$conf->options->set( %{$args} );
-$step = test_step_constructor_and_description($conf);
-$ret = $step->runstep($conf);
-ok( $ret, "runstep() returned true value" );
-is($conf->data->get('gc_flag'), '-DGC_IS_MALLOC',
-    "Got expected value for 'gc_flag'");
-
 pass("Completed all tests in $0");
 
 ################### DOCUMENTATION ###################
 
 =head1 NAME
 
-auto/gc-01.t - test auto::gc
+auto_gc-01.t - test auto::gc
 
 =head1 SYNOPSIS
 


More information about the parrot-commits mailing list