Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/rakudo/rakudo into proble…
Browse files Browse the repository at this point in the history
…m-solving-80
  • Loading branch information
vrurg committed Aug 19, 2019
2 parents ae7e77e + 207b825 commit d1c1afd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 20 deletions.
16 changes: 9 additions & 7 deletions lib/NativeCall.pm6
Expand Up @@ -576,16 +576,18 @@ our role Native[Routine $r, $libname where Str|Callable|List|IO::Path|Distributi
self!setup() unless $!setup;

my Mu $args := nqp::getattr(nqp::decont(args), Capture, '@!list');
if nqp::elems($args) != $!arity {
X::TypeCheck::Argument.new(
:objname($.name),
:arguments(args.list.map(*.^name)),
:signature(try $r.signature.gist),
).throw
}
self!arity-error(args) if nqp::elems($args) != $!arity;

nqp::nativecall($!rettype, self, $args)
}

method !arity-error(\args) {
X::TypeCheck::Argument.new(
:objname($.name),
:arguments(args.list.map(*.^name)),
:signature(try $r.signature.gist),
).throw
}
}

multi sub postcircumfix:<[ ]>(CArray:D \array, $pos) is raw is export(:DEFAULT, :types) is default {
Expand Down
19 changes: 15 additions & 4 deletions src/core/CompUnit/PrecompilationRepository.pm6
Expand Up @@ -46,7 +46,7 @@ class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationR
my ($handle, $checksum) = (
self.may-precomp and (
my $loaded = self.load($id, :source($source), :checksum($dependency.checksum), :@precomp-stores) # already precompiled?
or self.precompile($source, $id, :source-name($dependency.source-name), :force($loaded ~~ Failure))
or self.precompile($source, $id, :source-name($dependency.source-name), :force($loaded ~~ Failure), :@precomp-stores)
and self.load($id, :@precomp-stores) # if not do it now
)
);
Expand Down Expand Up @@ -88,11 +88,13 @@ class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationR
CompUnit::PrecompilationStore @precomp-stores,
CompUnit::PrecompilationId $id,
:$repo-id,
:$refresh,
) {
my $compiler-id = CompUnit::PrecompilationId.new-without-check($*PERL.compiler.id);
my $RMD = $*RAKUDO_MODULE_DEBUG;
for @precomp-stores -> $store {
$RMD("Trying to load {$id ~ ($repo-id ?? '.repo-id' !! '')} from $store.prefix()") if $RMD;
$store.remove-from-cache($id) if $refresh;
my $file = $repo-id
?? $store.load-repo-id($compiler-id, $id)
!! $store.load-unit($compiler-id, $id);
Expand Down Expand Up @@ -222,14 +224,23 @@ class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationR
IO::Path:D $path,
CompUnit::PrecompilationId $id,
Bool :$force = False,
:$source-name = $path.Str
:$source-name = $path.Str,
:$precomp-stores,
) {
my $compiler-id = CompUnit::PrecompilationId.new-without-check($*PERL.compiler.id);
my $io = self.store.destination($compiler-id, $id);
return False unless $io;
my $RMD = $*RAKUDO_MODULE_DEBUG;
if not $force and $io.e and $io.s {
$RMD("$source-name\nalready precompiled into\n$io") if $RMD;
if $force
?? (
$precomp-stores
and my $unit = self!load-file($precomp-stores, $id, :refresh)
and nqp::sha1($path.slurp(:enc<iso-8859-1>)) eq $unit.source-checksum
and self!load-dependencies($unit, $precomp-stores)
)
!! ($io.e and $io.s)
{
$RMD("$source-name\nalready precompiled into\n{$io}{$force ?? ' by another process' !! ''}") if $RMD;
with %*COMPILING<%?OPTIONS><stagestats> {
note "\n load $path.relative()";
$*ERR.flush;
Expand Down
1 change: 0 additions & 1 deletion src/core/core_prologue.pm6
Expand Up @@ -10,7 +10,6 @@ my class Rakudo::Deprecations { ... }
my class Rakudo::Internals { ... }
my class Rakudo::Internals::JSON { ... }
my class Rakudo::Internals::RegexBoolification6cMarker { ... }
my class Rakudo::Internals::HyperWorkBatch { ... }
my class Rakudo::Iterator { ... }
#?if !js
my class ThreadPoolScheduler { ... }
Expand Down
16 changes: 14 additions & 2 deletions src/vm/moar/spesh-plugins.nqp
Expand Up @@ -305,6 +305,11 @@ sub assign-fallback($cont, $value) {
sub assign-scalar-no-whence-no-typecheck($cont, $value) {
nqp::bindattr($cont, Scalar, '$!value', $value);
}
sub assign-scalar-nil-no-whence($cont, $value) {
my $desc := nqp::getattr($cont, Scalar, '$!descriptor');
nqp::bindattr($cont, Scalar, '$!value',
nqp::getattr($desc, ContainerDescriptor, '$!default'))
}
sub assign-scalar-no-whence($cont, $value) {
my $desc := nqp::getattr($cont, Scalar, '$!descriptor');
my $type := nqp::getattr($desc, ContainerDescriptor, '$!of');
Expand Down Expand Up @@ -357,13 +362,20 @@ nqp::speshreg('perl6', 'assign', sub ($cont, $value) {
my $desc := nqp::speshguardgetattr($cont, Scalar, '$!descriptor');
if nqp::eqaddr($desc.WHAT, ContainerDescriptor) && nqp::isconcrete($desc) {
# Simple assignment, no whence. But is Nil being assigned?
my $of := $desc.of;
if nqp::eqaddr($value, Nil) {
# Yes; NYI.
# Yes; just copy in the default, provided we've a simple type.
if $of.HOW.archetypes.nominal {
nqp::speshguardtype($desc, $desc.WHAT);
nqp::speshguardconcrete($desc);
my $of := nqp::speshguardgetattr($desc, ContainerDescriptor, '$!of');
nqp::speshguardobj($of);
return &assign-scalar-nil-no-whence;
}
}
else {
# No whence, no Nil. Is it a nominal type? If yes, we can check
# it here.
my $of := $desc.of;
unless $of.HOW.archetypes.nominal {
nqp::speshguardobj($desc);
return &assign-scalar-no-whence;
Expand Down
13 changes: 7 additions & 6 deletions tools/templates/jvm/Makefile.in
Expand Up @@ -37,7 +37,8 @@ PERL6_C_JAR = @nfp(blib/Perl6/Compiler.jar)@
PERL6_M_JAR = @nfp(blib/Perl6/Metamodel.jar)@
PERL6_B_JAR = @nfp(blib/Perl6/BOOTSTRAP.jar)@
SETTING_JAR = CORE.setting.jar
SETTING_D_JAR = CORE.d.setting.jar
@for_specs(SETTING_@ucspec@_JAR = CORE.@lcspec@.setting.jar
)@

PERL6_LANG_JARS = $(PERL6_ML_JAR) $(PERL6_W_JAR) $(PERL6_G_JAR) $(PERL6_OPS_JAR) $(PERL6_A_JAR) \
$(PERL6_O_JAR) $(PERL6_P_JAR) $(PERL6_C_JAR) $(PERL6_M_JAR) $(PERL6_B_JAR)
Expand Down Expand Up @@ -66,8 +67,8 @@ J_DEBUG_RUNNER = perl6-debug-j@runner_suffix@
J_CLEANUPS = \
*.manifest \
@nfp(blib/Perl6/*.jar)@ \
$(SETTING_JAR) \
$(SETTING_D_JAR) \
$(SETTING_JAR) \\@for_specs(
$(SETTING_@ucspec@_JAR) \)@
$(PERL6_JAR) \
j-rakudo_test_run.tar.gz \
@nfp($(J_BUILD_DIR)/*)@ \
Expand All @@ -84,7 +85,7 @@ HARNESS_TYPE =
J_HARNESS5 = $(PERL5) @nfp(t/harness5)@ --jvm
J_HARNESS5_WITH_FUDGE = $(J_HARNESS5) --fudge --keep-exit-code

j-all: check_@backend_prefix@_nqp_version $(PERL6_JAR) $(SETTING_JAR) $(SETTING_D_JAR) $(J_RUNNER) eval-client.pl $(PERL6_DEBUG_JAR) $(J_DEBUG_RUNNER)
j-all: check_@backend_prefix@_nqp_version $(PERL6_JAR) $(SETTING_JAR) @for_specs($(SETTING_@ucspec@_JAR) )@$(J_RUNNER) eval-client.pl $(PERL6_DEBUG_JAR) $(J_DEBUG_RUNNER)

check_@backend_prefix@_nqp_version: @@script(check-nqp-version.pl)@@
$(PERL5) @shquot(@script(check-nqp-version.pl)@)@ $(J_NQP)
Expand Down Expand Up @@ -155,7 +156,7 @@ $(SETTING_JAR): $(PERL6_JAR) $(PERL6_B_JAR) $(J_CORE_SOURCES)
@echo "The following step can take a long time, please be patient."
@set_nqp_lib@$(J_RUN_PERL6) --setting=NULL --ll-exception --optimize=3 --target=jar --stagestats --output=$(SETTING_JAR) --nqp-lib=blib @nfpq($(J_BUILD_DIR)/CORE.setting)@

@for_specs($(SETTING_@ucspec@_JAR): $(PERL6_JAR) $(PERL6_@ucspec@_JAR) $(SETTING_JAR) $(J_CORE_SOURCES)
@for_specs($(SETTING_@ucspec@_JAR): $(PERL6_JAR) $(PERL6_B_JAR) $(SETTING_JAR) $(J_CORE_@ucspec@_SOURCES)
$(J_NQP) $(J_GEN_CAT) $(J_CORE_@ucspec@_SOURCES) > @nfpq($(J_BUILD_DIR)/CORE.@lcspec@.setting)@
@echo "The following step can take a long time, please be patient."
@set_nqp_lib@$(J_RUN_PERL6) --setting=NULL.@lcspec@ --ll-exception --optimize=3 --target=jar --stagestats --output=$(SETTING_@ucspec@_JAR) --nqp-lib=blib @nfpq($(J_BUILD_DIR)/CORE.@lcspec@.setting)@
Expand Down Expand Up @@ -227,7 +228,7 @@ j-install: j-all @@script(create-jvm-runner.pl)@@ @@script(install-core-dist.p6)
$(MKPATH) @nfpq($(DESTDIR)$(J_LIBPATH)/Perl6)@
$(MKPATH) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime)@
$(CP) $(PERL6_LANG_JARS) @nfpq($(DESTDIR)$(J_LIBPATH)/Perl6)@
$(CP) $(SETTING_JAR) $(SETTING_D_JAR) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime)@
$(CP) $(SETTING_JAR) @for_specs($(SETTING_@ucspec@_JAR) )@@nfpq($(DESTDIR)$(PERL6_HOME)/runtime)@
$(CP) $(PERL6_JAR) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime)@
$(CP) $(PERL6_DEBUG_JAR) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime)@
$(CP) $(RUNTIME_JAR) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime)@
Expand Down

0 comments on commit d1c1afd

Please sign in to comment.