<commit_before>module CompileTestLib;

sub compile_test_lib($name) is export {
    my ($c_line, $l_line);
    my $cfg = $*VM.config;
    if $*VM.name eq 'parrot' {
        my $o  = $cfg<o>;
        my $so = $cfg<load_ext>;
        $c_line = "$cfg<cc> -c $cfg<cc_shared> $cfg<cc_o_out>$name$o $cfg<ccflags> t/04-nativecall/$name.c";
        $l_line = "$cfg<ld> $cfg<ld_load_flags> $cfg<ldflags> " ~
            "$cfg<libs> $cfg<ld_out>$name$so $name$o";
    }
    elsif $*VM.name eq 'moar' {
        my $o  = $cfg<obj>;
        my $so = $cfg<dll>;
        $so ~~ s/^.*\%s//;
        $c_line = "$cfg<cc> -c $cfg<ccshared> $cfg<ccout>$name$o $cfg<cflags> t/04-nativecall/$name.c";
        $l_line = "$cfg<ld> $cfg<ldshared> $cfg<ldflags> " ~
            "$cfg<ldlibs> $cfg<ldout>$name$so $name$o";
    }
    elsif $*VM.name eq 'jvm' {
        $c_line = "$cfg<nativecall.cc> -c $cfg<nativecall.ccdlflags> -o$name$cfg<nativecall.o> $cfg<nativecall.ccflags> t/04-nativecall/$name.c";
        $l_line = "$cfg<nativecall.ld> $cfg<nativecall.perllibs> $cfg<nativecall.lddlflags> $cfg<nativecall.ldflags> $cfg<nativecall.ldout>$name.$cfg<nativecall.so> $name$cfg<nativecall.o>";
    }
    else {
        die "Unknown VM; don't know how to compile test libraries";
    }
    shell($c_line);
    shell($l_line);
}<commit_msg>Look up $*VM only once<commit_after>module CompileTestLib;

sub compile_test_lib($name) is export {
    my ($c_line, $l_line);
    my $VM := $*VM;
    my $cfg = $VM.config;
    if $VM.name eq 'parrot' {
        my $o  = $cfg<o>;
        my $so = $cfg<load_ext>;
        $c_line = "$cfg<cc> -c $cfg<cc_shared> $cfg<cc_o_out>$name$o $cfg<ccflags> t/04-nativecall/$name.c";
        $l_line = "$cfg<ld> $cfg<ld_load_flags> $cfg<ldflags> " ~
            "$cfg<libs> $cfg<ld_out>$name$so $name$o";
    }
    elsif $VM.name eq 'moar' {
        my $o  = $cfg<obj>;
        my $so = $cfg<dll>;
        $so ~~ s/^.*\%s//;
        $c_line = "$cfg<cc> -c $cfg<ccshared> $cfg<ccout>$name$o $cfg<cflags> t/04-nativecall/$name.c";
        $l_line = "$cfg<ld> $cfg<ldshared> $cfg<ldflags> " ~
            "$cfg<ldlibs> $cfg<ldout>$name$so $name$o";
    }
    elsif $VM.name eq 'jvm' {
        $c_line = "$cfg<nativecall.cc> -c $cfg<nativecall.ccdlflags> -o$name$cfg<nativecall.o> $cfg<nativecall.ccflags> t/04-nativecall/$name.c";
        $l_line = "$cfg<nativecall.ld> $cfg<nativecall.perllibs> $cfg<nativecall.lddlflags> $cfg<nativecall.ldflags> $cfg<nativecall.ldout>$name.$cfg<nativecall.so> $name$cfg<nativecall.o>";
    }
    else {
        die "Unknown VM; don't know how to compile test libraries";
    }
    shell($c_line);
    shell($l_line);
}
{'fraction_non_alphanumeric': 0.1991701244813278, 'fraction_numerical': 0.004526593738211996, 'mean_word_length': 2.98796992481203, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7200785', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1087, 'n_words': 193}