Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@niner
Created May 15, 2016 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niner/48daf2fef50e8453fd6dc71e4b3eef03 to your computer and use it in GitHub Desktop.
Save niner/48daf2fef50e8453fd6dc71e4b3eef03 to your computer and use it in GitHub Desktop.
diff --git a/src/core/CompUnit/PrecompilationRepository.pm b/src/core/CompUnit/PrecompilationRepository.pm
index d6df7f6..751d04e 100644
--- a/src/core/CompUnit/PrecompilationRepository.pm
+++ b/src/core/CompUnit/PrecompilationRepository.pm
@@ -206,7 +206,7 @@ class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationR
"--source-name=$source-name",
$path,
:out,
- :err,
+ #:err,
);
%ENV.DELETE-KEY(<RAKUDO_PRECOMP_WITH>);
%ENV.DELETE-KEY(<RAKUDO_PRECOMP_LOADING>);
@@ -216,13 +216,14 @@ class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationR
if not $proc.out.close or $proc.status { # something wrong
self.store.unlock;
$RMD("Precomping $path failed: $proc.status()") if $RMD;
- Rakudo::Internals.VERBATIM-EXCEPTION(1);
- die $proc.err.slurp-rest;
+ die @result;
+ #Rakudo::Internals.VERBATIM-EXCEPTION(1);
+ #die $proc.err.slurp-rest;
}
- if $proc.err.slurp-rest -> $warnings {
- $*ERR.print($warnings);
- }
+ #if $proc.err.slurp-rest -> $warnings {
+ # $*ERR.print($warnings);
+ #}
unless $bc.e {
$RMD("$path aborted precompilation without failure") if $RMD;
self.store.unlock;
diff --git a/src/core/CompUnit/PrecompilationStore/File.pm b/src/core/CompUnit/PrecompilationStore/File.pm
index bce07e1..f27701f 100644
--- a/src/core/CompUnit/PrecompilationStore/File.pm
+++ b/src/core/CompUnit/PrecompilationStore/File.pm
@@ -37,8 +37,27 @@ class CompUnit::PrecompilationStore::File does CompUnit::PrecompilationStore {
}
method bytecode(--> Buf) {
+#?if !jvm
self!read-dependencies;
$!bytecode //= $!file.slurp-rest(:bin)
+ note("not for the JVM!");
+#?endif
+#?if jvm
+ # this can go once mixing get() and slurp-rest(:bin) on the JVM works
+ #$!file.seek(0);
+ #my $buf = $!file.slurp-rest(:bin);
+ my $buf = $!path.slurp(:bin);
+ my int $elems = $buf.elems;
+ my int $start = 0;
+ my $prev = 0x0a;
+ loop (my int $i = 0; $i < $elems; $i++) {
+ if $prev == 0x0a and $buf[$i] == 0x0a {
+ $start = $i;
+ last;
+ }
+ }
+ $!bytecode = $buf.subbuf($start + 1);
+#?endif
}
method bytecode-handle(--> IO::Handle) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment