| File: | config/auto/gc.pm |
| Coverage: | 91.7% |
| line | stmt | bran | cond | sub | code |
|---|---|---|---|---|---|
| 1 | # Copyright (C) 2001-2009, Parrot Foundation. | ||||
| 2 | |||||
| 3 - 41 | =head1 NAME config/auto/gc.pm - Garbage Collection =head1 DESCRIPTION Sets memory allocator. The C<--gc> command-line option enables the configurer to choose among several garbage collectors. Current available options are: =over 4 =item ms Stop-the-world mark & sweep =item inf Infinite memory "collector" =item ms2 New style mark & sweep =item gms (default) Generational M&S based on MS2 =back The choice is stored as C<gc_type> in C<%PConfig>, and available (uppercased) as PARROT_GC_DEFAULT_TYPE in F<parrot/config.h> For backwards compatibility with parrot 3.1.0 and earlier, an empty entry C<gc_flag> is maintained. (It used to be used in Makefiles to append to the C compiler flags.) =cut | ||||
| 42 | |||||
| 43 | package auto::gc; | ||||
| 44 | |||||
| 45 | 2 2 2 | use strict; | |||
| 46 | 2 2 2 | use warnings; | |||
| 47 | |||||
| 48 | 2 2 2 | use base qw(Parrot::Configure::Step); | |||
| 49 | |||||
| 50 | sub _init { | ||||
| 51 | 2 | my $self = shift; | |||
| 52 | 2 | my %data; | |||
| 53 | 2 | $data{description} = q{Determine allocator to use}; | |||
| 54 | 2 | $data{result} = q{}; | |||
| 55 | 2 | return \%data; | |||
| 56 | } | ||||
| 57 | |||||
| 58 | sub runstep { | ||||
| 59 | 2 | my ( $self, $conf ) = @_; | |||
| 60 | |||||
| 61 | 2 | my $gc = $conf->options->get('gc') || 'gms'; | |||
| 62 | 2 | $conf->debug(" ($gc) "); | |||
| 63 | |||||
| 64 | 2 | my @known_gcs = qw<gms ms ms2 inf>; | |||
| 65 | |||||
| 66 | 2 | if ($gc) { | |||
| 67 | 2 | if (!grep /$gc/, @known_gcs) { | |||
| 68 | 0 | die "unknown gc '$gc': valid gc cores are ".join(', ', @known_gcs); | |||
| 69 | } | ||||
| 70 | 2 | $conf->data->set(gc_type => uc($gc)); | |||
| 71 | 2 | $self->set_result($gc); | |||
| 72 | } | ||||
| 73 | 2 | $conf->data->set(gc_flag => ''); # Compatibility with parrot-3.1.0 and earlier | |||
| 74 | |||||
| 75 | 2 | return 1; | |||
| 76 | } | ||||
| 77 | |||||
| 78 | 1; | ||||
| 79 | |||||
| 80 | # Local Variables: | ||||
| 81 | # mode: cperl | ||||
| 82 | # cperl-indent-level: 4 | ||||
| 83 | # fill-column: 100 | ||||
| 84 | # End: | ||||
| 85 | # vim: expandtab shiftwidth=4: | ||||