I've now committed the source of the generational mark & sweep GC system.

Some remarks:
- it's by far not finished
- fails still a lot of tests [1]
- to turn it on set PARROT_GC_SUBSYSTEM to 2 in settings.h
- you might also turn on GC_GMS_DEBUG when hacking on the code
- it should be documented sufficiently to see how it works
- if something is unclear please just ask

All help is very welcome to debug and complete the code and make it actually working.

I ran one example[2], which shows that the generational approach is really a win (~40% improvement in execution time).

leo

[1] stacks_52 seems to hang; 115/2214 subtests failed

[2] sample code
$ cat io.pasm
  new_pad 0
  new P16, .FixedPMCArray
  store_lex 0, "array", P16
  set I6, 500000
  set P16, I6
  set I5, 0
fill:
  new P5, .Integer
  set P5, I5
  set P16[I5], P5
  inc I5
  lt I5, I6, fill

  # next scope
  new_pad -1
  open P17, "test.tmp", ">"
  needs_destroy P17
  store_lex -1, "fh", P17
  print P17, "a"
  pop_pad
  null P17
  sweep 0

  # verify file
  open P17, "test.tmp", "<"
  read S5, P17, 1
  print S5
  print "\n"

  end

Here is the Perl5 equivalent:

$ cat io.pl
#!/usr/bin/perl -w
use strict;
use IO::File;

my @array;
$array[$_] = $_ for (0..499999);
{
    my $fh = IO::File->new;
    $fh->open(">test.tmp");
    print $fh "a";
}
my $fh = IO::File->new;
$fh->open("<test.tmp");
print <$fh>, "\n";



Reply via email to