Skip to content

Instantly share code, notes, and snippets.

@timo

timo/output.txt Secret

Forked from MasterDuke17/gdb.log
Created November 5, 2020 16:38
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 timo/4430620df583760d081e57430eff6c41 to your computer and use it in GitHub Desktop.
Save timo/4430620df583760d081e57430eff6c41 to your computer and use it in GitHub Desktop.
+++ Compiling gen/moar/stage2/QAST.moarvm
+++ Compiling gen/moar/stage2/NQPP6QRegex.moarvm
+++ Creating stage 2 NQP
+++ Installing MOAR stage 2 files locally
+++ Compiling NQPP5QRegex.moarvm
Confused at line 6, near "use QRegex
at gen/moar/stage2/NQPHLL.nqp:1053 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:panic)
from gen/moar/stage2/NQP.nqp:945 (nqp.moarvm:comp_unit)
from gen/moar/stage2/NQP.nqp:806 (nqp.moarvm:TOP)
from gen/moar/stage2/QRegex.nqp:2258 (/home/dan/Source/perl6/nqp/QRegex.moarvm:parse)
from gen/moar/stage2/NQPHLL.nqp:2297 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:parse)
from gen/moar/stage2/NQPHLL.nqp:2213 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:execute_stage)
from gen/moar/stage2/NQPHLL.nqp:2248 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:run)
from gen/moar/stage2/NQPHLL.nqp:2244 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:)
from gen/moar/stage2/NQPHLL.nqp:2240 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:compile)
from gen/moar/stage2/NQPHLL.nqp:1915 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:2150 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:evalfiles)
from gen/moar/stage2/NQPHLL.nqp:2110 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:2035 (/home/dan/Source/perl6/nqp/NQPHLL.moarvm:command_line)
from gen/moar/stage2/NQP.nqp:4178 (nqp.moarvm:MAIN)
from gen/moar/stage2/NQP.nqp:1 (nqp.moarvm:<mainline>)
from <unknown>:1 (nqp.moarvm:<main>)
from <unknown>:1 (nqp.moarvm:<entry>)
make: *** [Makefile:552: NQPP5QRegex.moarvm] Error 1
│ │ - QAST::Block(:name(pod_comment) :cuid(41) :blocktype(declaration_static)) :orig_qast<?> :compile_time_dummy<?>
│ │ │ - QAST::Stmts
│ │ │ - QAST::Var(local __lowered_lex_215 :decl(param))
│ │ │ - QAST::Op(bind)
│ │ │ - QAST::Var(local self :decl(var))
│ │ │ - QAST::Var(local __lowered_lex_215)
│ │ │ - QAST::Var(lexical $¢ :decl(var))
│ │ │ - QAST::Var(lexical $/ :decl(var))
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(cut)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(=end)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(begin)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(=end)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(begin)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(END)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(=end)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(END)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Op(if)
│ │ │ - QAST::Op(isge_i)
│ │ │ - QAST::Op(index)
│ │ │ - QAST::Var(local self)
│ │ │ - QAST::SVal(begin)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::IVal(0)
│ │ │ - QAST::Regex+{QAST::RegexCursorType}(:rxtype(concat) :subtype() :cursor_type(NQPMatch))
│ │ │ - QAST::Regex(:rxtype(scan) :subtype())
│ │ │ - QAST::Regex(:rxtype(concat) :subtype()) ^^ \\h* '='\n [\n | 'begin' \\h+ 'EN...
│ │ │ - QAST::Regex(:rxtype(anchor) :subtype(bol)) ^^
│ │ │ - QAST::Regex(:rxtype(quant) :subtype()) \\h*
│ │ │ - QAST::Regex(:rxtype(enumcharlist) :subtype()) h
│ │ │ -   ᠎              
│ │ │ - QAST::Regex(:rxtype(literal) :subtype()) '='\n
│ │ │ - =
│ │ │ - QAST::Regex(:rxtype(alt) :subtype() :name(alt_nfa__5_4601DF53F14E25DEF519D9381122C62BCBB1FD51-0)) [\n | 'begin' \\h+ 'END' >>\n [ ...
│ │ │ - QAST::Regex(:rxtype(concat) :subtype()) 'begin' \\h+ 'END' >>\n [ .*? \\n \\h* ...
│ │ │ - QAST::Regex(:rxtype(literal) :subtype()) 'begin'
│ │ │ - begin
│ │ │ - QAST::Regex(:rxtype(quant) :subtype()) \\h+
│ │ │ - QAST::Regex(:rxtype(enumcharlist) :subtype()) h
│ │ │ -   ᠎              
│ │ │ - QAST::Regex(:rxtype(literal) :subtype()) 'END'
│ │ │ - END
│ │ │ - QAST::Regex(:rxtype(anchor) :subtype(rwb)) >>\n
[...]
diff --git src/QRegex/P6Regex/Optimizer.nqp src/QRegex/P6Regex/Optimizer.nqp
index 320abb63c..e6e32d3b9 100644
--- src/QRegex/P6Regex/Optimizer.nqp
+++ src/QRegex/P6Regex/Optimizer.nqp
@@ -152,6 +152,19 @@ class QRegex::Optimizer {
if $type eq 'concat' {
$node[$i] := self.visit_concat($visit);
} elsif $type eq 'literal' {
+ if nqp::chars($visit[0]) > 2 {
+ #say(@!outer[0].dump);
+ my $if_index :=
+ QAST::Op.new(:op('if'),
+ QAST::Op.new(:op('isge_i'),
+ QAST::Op.new(:op('index'), QAST::Var.new(:name('self'), :scope('local')), QAST::SVal.new(:value($visit[0])), QAST::IVal.new(:value(0))),
+ QAST::IVal.new(:value(0))),
+ @!outer[0][1],
+ QAST::Regex.new( :rxtype<literal>, :subtype<fail>, :node($visit) ));
+ #say($if_index.dump);
+ @!outer[0][1] := $if_index;
+ #say(@!outer[0].dump);
+ }
} elsif $type eq 'quant' {
self.visit_children($visit);
} elsif $type eq 'subrule' {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment