Skip to content

Instantly share code, notes, and snippets.

@niner
Last active June 5, 2016 11:28
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/89b442aef9d41b650a4acf3a79c68dc1 to your computer and use it in GitHub Desktop.
Save niner/89b442aef9d41b650a4acf3a79c68dc1 to your computer and use it in GitHub Desktop.
diff --git a/src/vm/jvm/HLL/Backend.nqp b/src/vm/jvm/HLL/Backend.nqp
index 4c32e70..18dae14 100644
--- a/src/vm/jvm/HLL/Backend.nqp
+++ b/src/vm/jvm/HLL/Backend.nqp
@@ -61,7 +61,7 @@ class HLL::Backend::JVM {
method jast($qast, *%adverbs) {
my $classname := %*COMPILING<%?OPTIONS><javaclass> || nqp::sha1('eval-at-' ~ nqp::time_n() ~ $compile_count++);
- nqp::getcomp('QAST').jast($qast, :$classname);
+ nqp::getcomp('QAST').jast($qast, :$classname, |%adverbs);
}
method classfile($jast, *%adverbs) {
diff --git a/src/vm/jvm/QAST/Compiler.nqp b/src/vm/jvm/QAST/Compiler.nqp
index bcf1ac3..0fb5880 100644
--- a/src/vm/jvm/QAST/Compiler.nqp
+++ b/src/vm/jvm/QAST/Compiler.nqp
@@ -3147,6 +3147,14 @@ class QAST::CompilerJAST {
:super('org.perl6.nqp.runtime.CompilationUnit'),
:filename($file)
);
+ if nqp::existskey(%adverbs, 'mast_frames') {
+ if nqp::existskey(%adverbs<mast_frames>, 'jclass') {
+ $*JCLASS := nqp::atkey(%adverbs<mast_frames>, 'jclass');
+ }
+ else {
+ nqp::bindkey(%adverbs<mast_frames>, 'jclass', $*JCLASS);
+ }
+ }
# We'll also need to keep track of all the blocks we compile into Java
# methods; the CodeRefBuilder takes care of that.
@@ -3347,6 +3355,7 @@ class QAST::CompilerJAST {
# If we are in compilation mode, or have pre-deserialization or
# post-deserialization tasks, handle those. Overall, the process
# is to desugar this into simpler QAST nodes, then compile those.
+ my $is_nested := $cu.is_nested;
my @pre_des := $cu.pre_deserialize;
my @post_des := $cu.post_deserialize;
if %*BLOCK_LEX_VALUES {
@@ -3366,13 +3375,13 @@ class QAST::CompilerJAST {
}
# If we need to do deserialization, emit code for that.
- if $*COMP_MODE {
+ if $*COMP_MODE && !$is_nested {
$block.push(self.deserialization_code($cu.sc(), $cu.code_ref_blocks(),
$cu.repo_conflict_resolver()));
}
# Add code object fixups.
- if $cu.code_ref_blocks() {
+ if $cu.code_ref_blocks() && !$is_nested {
my $cur_pd_block := QAST::Block.new( :blocktype('immediate') );
my $i := 0;
for $cu.code_ref_blocks() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment