Ticket #490: gc_options_remove.diff

File gc_options_remove.diff, 7.2 KB (added by jkeenan, 13 years ago)

What I was trying to apply to trunk to merge in the 'gc_options_remove' branch

  • lib/Parrot/Configure/Options/Conf.pm

     
    9494   --cgoto=0            Don't build cgoto core - recommended when short of mem 
    9595   --jitcapable         Use JIT 
    9696   --execcapable        Use JIT to emit a native executable 
    97    --gc=(type)          Determine the type of garbage collection 
    98                         type=(gc|libc|malloc|malloc-trace) default is gc 
    9997   --without-threads    Build parrot without thread support 
    10098 
    10199External Library Options: 
  • lib/Parrot/Configure/Options/Conf/Shared.pm

     
    2929    fatal 
    3030    fatal-step 
    3131    floatval 
    32     gc 
    3332    help 
    3433    icu-config 
    3534    icuheaders 
  • Configure.pl

     
    355355 
    356356Use JIT to emit a native executable. 
    357357 
    358 =item C<--gc=(type)> 
    359  
    360 Determine the type of garbage collection. The value for C<type> should be one 
    361 of: C<gc>, C<libc>, C<malloc> or C<malloc-trace>. The default is C<gc>. 
    362  
    363358=back 
    364359 
    365360=head2 International Components For Unicode (ICU) Options 
  • t/steps/auto/gc-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests => 35; 
     8use Test::More tests =>  8; 
    99use lib qw( lib t/configure/testlib ); 
    1010use_ok('config::auto::gc'); 
    1111use Parrot::Configure; 
     
    4848        "Got expected value for 'gc_flag'"); 
    4949} 
    5050 
    51 $conf->replenish($serialized); 
    52  
    53 ########### --gc=gc ########### 
    54  
    55 ($args, $step_list_ref) = process_options( { 
    56     argv => [ q{--gc=gc} ], 
    57     mode => q{configure}, 
    58 } ); 
    59 $conf->options->set( %{$args} ); 
    60 $step = test_step_constructor_and_description($conf); 
    61 my $ret = $step->runstep($conf); 
    62 ok( $ret, "runstep() returned true value" ); 
    63 is($conf->data->get('gc_flag'), q{}, 
    64     "Got expected value for 'gc_flag'"); 
    65  
    66 $conf->replenish($serialized); 
    67  
    68 ########### --gc=libc ########### 
    69  
    70 ($args, $step_list_ref) = process_options( { 
    71     argv => [ q{--gc=libc} ], 
    72     mode => q{configure}, 
    73 } ); 
    74 $conf->options->set( %{$args} ); 
    75 $step = test_step_constructor_and_description($conf); 
    76 $conf->data->set('i_malloc' => 1); 
    77 $ret = $step->runstep($conf); 
    78 ok( $ret, "runstep() returned true value" ); 
    79 is($conf->data->get('gc_flag'), '-DGC_IS_MALLOC', 
    80     "Got expected value for 'gc_flag'"); 
    81 is($conf->data->get('malloc_header'), 'malloc.h', 
    82     "Got expected value for 'malloc_header'"); 
    83  
    84 $conf->replenish($serialized); 
    85  
    86 ########### --gc=libc ########### 
    87  
    88 ($args, $step_list_ref) = process_options( { 
    89     argv => [ q{--gc=libc} ], 
    90     mode => q{configure}, 
    91 } ); 
    92 $conf->options->set( %{$args} ); 
    93 $step = test_step_constructor_and_description($conf); 
    94 $conf->data->set('i_malloc' => undef); 
    95 $ret = $step->runstep($conf); 
    96 ok( $ret, "runstep() returned true value" ); 
    97 is($conf->data->get('gc_flag'), '-DGC_IS_MALLOC', 
    98     "Got expected value for 'gc_flag'"); 
    99 is($conf->data->get('malloc_header'), 'stdlib.h', 
    100     "Got expected value for 'malloc_header'"); 
    101  
    102 $conf->replenish($serialized); 
    103  
    104 ########### --gc=malloc ########### 
    105  
    106 ($args, $step_list_ref) = process_options( { 
    107     argv => [ q{--gc=malloc} ], 
    108     mode => q{configure}, 
    109 } ); 
    110 $conf->options->set( %{$args} ); 
    111 $step = test_step_constructor_and_description($conf); 
    112 $ret = $step->runstep($conf); 
    113 ok( $ret, "runstep() returned true value" ); 
    114 is($conf->data->get('gc_flag'), '-DGC_IS_MALLOC', 
    115     "Got expected value for 'gc_flag'"); 
    116  
    117 $conf->replenish($serialized); 
    118  
    119 ########### --gc=malloc-trace ########### 
    120  
    121 ($args, $step_list_ref) = process_options( { 
    122     argv => [ q{--gc=malloc-trace} ], 
    123     mode => q{configure}, 
    124 } ); 
    125 $conf->options->set( %{$args} ); 
    126 $step = test_step_constructor_and_description($conf); 
    127 $ret = $step->runstep($conf); 
    128 ok( $ret, "runstep() returned true value" ); 
    129 is($conf->data->get('gc_flag'), '-DGC_IS_MALLOC', 
    130     "Got expected value for 'gc_flag'"); 
    131  
    13251pass("Completed all tests in $0"); 
    13352 
    13453################### DOCUMENTATION ################### 
    13554 
    13655=head1 NAME 
    13756 
    138 auto/gc-01.t - test auto::gc 
     57auto_gc-01.t - test auto::gc 
    13958 
    14059=head1 SYNOPSIS 
    14160 
  • config/auto/gc.pm

     
    77 
    88=head1 DESCRIPTION 
    99 
    10 Checks whether the C<--gc> command-line option was passed to F<Configure.pl> 
    11 and sets the memory allocator accordingly. 
     10Sets memory allocator. 
    1211 
    13 Eventually, C<--gc> will be able to take any of the following values: 
     12Currently, we have only one choice:  the memory allocator in F<src/gc/resources.c>. 
    1413 
    15 =over 
     14In the future, we will have a C<--gc> command-line option which will enable 
     15the configurer to choose among the default and: 
    1616 
    17 =item C<gc> 
     17=over4 
    1818 
    19 The default. Use the memory allocator in F<src/resources.c>. 
    20  
    2119=item C<libc> 
    2220 
    2321Use the C library C<malloc> along with F<src/gc/res_lea.c>. 
     
    3634 
    3735=back 
    3836 
    39 So, for the time being, only the default value works. 
    40  
    4137=cut 
    4238 
    4339package auto::gc; 
     
    4945 
    5046use Parrot::Configure::Utils ':auto'; 
    5147 
    52  
    53 # valid libc/malloc/malloc-trace/gc 
    5448sub _init { 
    5549    my $self = shift; 
    5650    my %data; 
     
    6256sub runstep { 
    6357    my ( $self, $conf ) = @_; 
    6458 
    65     my $gc = $conf->options->get('gc'); 
     59    my $gc = 'gc'; 
    6660 
    67     # default is GC in alloc_resources.c 
    68     $gc = 'gc' unless defined $gc; 
    69  
    70     if ( $gc =~ /^malloc(?:-trace)?$/ ) { 
    71         $conf->data->set( 
    72             TEMP_gc_c => <<"EOF", 
    73 \$(SRC_DIR)/$gc\$(O):   \$(GENERAL_H_FILES) \$(SRC_DIR)/$gc.c 
    74 \$(SRC_DIR)/gc/res_lea\$(O):    \$(GENERAL_H_FILES) \$(SRC_DIR)/gc/res_lea.c 
    75 EOF 
    76             TEMP_gc_o => "\$(SRC_DIR)\/$gc\$(O) \$(SRC_DIR)/gc/res_lea\$(O)", 
    77             gc_flag   => '-DGC_IS_MALLOC', 
    78         ); 
    79     } 
    80     elsif ( $gc eq 'libc' ) { 
    81         $conf->data->set( 
    82             TEMP_gc_c => <<"EOF", 
    83 \$(SRC_DIR)/gc/res_lea\$(O):    \$(GENERAL_H_FILES) \$(SRC_DIR)/gc/res_lea.c 
    84 EOF 
    85             TEMP_gc_o => "\$(SRC_DIR)/gc/res_lea\$(O)", 
    86             gc_flag   => '-DGC_IS_MALLOC', 
    87         ); 
    88         # tests mallinfo after allocation of 128 bytes 
    89         if ( $conf->data->get('i_malloc') ) { 
    90             $conf->data->set( malloc_header => 'malloc.h' ); 
    91         } 
    92         else { 
    93             $conf->data->set( malloc_header => 'stdlib.h' ); 
    94         } 
    95     } 
    96     else { 
    97         $gc = 'gc'; 
    98         $conf->data->set( 
    99             TEMP_gc_c => <<"EOF", 
     61    $conf->data->set( 
     62        TEMP_gc_c => <<"EOF", 
    10063\$(SRC_DIR)/gc/alloc_resources\$(O):    \$(GENERAL_H_FILES) \$(SRC_DIR)/gc/alloc_resources.c 
    10164EOF 
    102             TEMP_gc_o => "\$(SRC_DIR)/gc/alloc_resources\$(O)", 
    103             gc_flag   => '', 
    104         ); 
    105     } 
     65        TEMP_gc_o => "\$(SRC_DIR)/gc/resources\$(O)", 
     66        gc_flag   => '', 
     67    ); 
    10668    print(" ($gc) ") if $conf->options->get('verbose'); 
    10769 
    10870    return 1;