Skip to content

Commit

Permalink
Use MoarVM::BytecodeWriter for assemble_to_file
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Sep 21, 2018
1 parent 488bbd4 commit 207b0a6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/vm/moar/QAST/QASTCompilerMAST.nqp
Expand Up @@ -3169,10 +3169,10 @@ class MASTBytecodeAssembler {
}

method assemble_to_file($mast, $file) {
nqp::masttofile($mast, self.node_hash(), $file)
self.assemble($mast).save($file);
}

method assemble_and_load($mast) {
method assemble($mast) {
my @cu_frames := nqp::getattr($mast, MAST::CompUnit, '@!frames');
my $string-heap := MoarVM::StringHeap.new(:strings($mast.string_heap));
my $callsites := MoarVM::Callsites.new(:$string-heap);
Expand All @@ -3192,7 +3192,11 @@ class MASTBytecodeAssembler {
$writer.add-frame($frame);
}
$writer.assemble;
nqp::buffertocu($writer.bytecode);
$writer
}

method assemble_and_load($mast) {
nqp::buffertocu(self.assemble($mast).bytecode);
}
}

Expand Down

0 comments on commit 207b0a6

Please sign in to comment.