Rakudo::Internals.REGISTER-DYNAMIC: '@*ARGS', {
    my @ARGS;
    my Mu $argiter := nqp::getcurhllsym('$!ARGITER');
    @ARGS.push(nqp::p6box_s(nqp::shift($argiter))) while $argiter;
    PROCESS::<@ARGS> := @ARGS;
}
Rakudo::Internals.REGISTER-DYNAMIC: '$*ARGFILES', {
    # Here, we use $*IN's attributes to init the arg files because
    # the $*ARGFILES won't get instantiated until first access and by that
    # time the user may have already modified $*IN's attributes to their liking
    PROCESS::<$ARGFILES> = @*ARGS
      ?? IO::ArgFiles.new(@*ARGS)
      !! IO::ArgFiles.new:
          (my $in := $*IN),
          :nl-in($in.nl-in), :chomp($in.chomp), :encoding($in.encoding),
          :bin(nqp::hllbool(nqp::isfalse($in.encoding)));
}

# vim: ft=perl6 expandtab sw=4

Rakudo::Internals.REGISTER-DYNAMIC: '@*ARGS', {
    my @ARGS;
    my Mu $argiter := nqp::getcurhllsym('$!ARGITER');
    @ARGS.push(nqp::p6box_s(nqp::shift($argiter))) while $argiter;
    PROCESS::<@ARGS> := @ARGS;
}
Rakudo::Internals.REGISTER-DYNAMIC: '$*ARGFILES', {
    # Here, we use $*IN's attributes to init the arg files because
    # the $*ARGFILES won't get instantiated until first access and by that
    # time the user may have already modified $*IN's attributes to their liking
    PROCESS::<$ARGFILES> = @*ARGS
      ?? IO::ArgFiles.new(@*ARGS)
      !! $*IN
}

# vim: ft=perl6 expandtab sw=4

Set $*ARGFILES to $*IN if no arguments
Set $*ARGFILES to $*IN if no arguments

Not sure why it was made an IO::ArgFiles, copying over all relevant
attributes.  If there are no arguments, $*ARGFILES effectively reads
from STDIN, so not sure why special wrapping would be needed in that
case.  This is make spectest / make test clean, so if there is any
ecosystem fallout, then this commit should be reverted and tests
should be added to ensure this optimization is not attempted again.
