Last active
April 22, 2024 19:46
-
-
Save ab5tract/c6b7eea8e6c8bb961953a4eb45e3266c to your computer and use it in GitHub Desktop.
Investigating R#6486 - General_Category does not work with L
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./rakudo-m --target=QAST -e 'say "a" ~~ / <:General_Category("Ll")> /;' > a.qast | |
$ ./rakudo-m --target=QAST -e 'say "a" ~~ / <:General_Category("L")> /;' > b.qast | |
$ diff -c a.qast b.qast | |
*** /tmp/a.qast Mon Apr 22 20:42:20 2024 | |
--- /tmp/b.qast Mon Apr 22 20:42:32 2024 | |
*************** | |
*** 45,55 **** | |
- QAST::Op(call) | |
- QAST::BVal(1) | |
[children] | |
! - QAST::Block(:name(<unit>) :cuid(1) :blocktype(declaration_static)) :IN_DECL<mainline> say \"a\" ~~ / <:General_Category(\"Ll\")> /; | |
│ - QAST::Stmts | |
│ - QAST::Stmts | |
│ - QAST::WVal(Nil) | |
! │ - QAST::Stmts say \"a\" ~~ / <:General_Category(\"Ll\")> /; | |
│ - QAST::Var(local __args__ :decl(param)) | |
│ - QAST::Stmts | |
│ - QAST::Var(lexical GLOBALish :decl(static)) | |
--- 45,55 ---- | |
- QAST::Op(call) | |
- QAST::BVal(1) | |
[children] | |
! - QAST::Block(:name(<unit>) :cuid(1) :blocktype(declaration_static)) :IN_DECL<mainline> say \"a\" ~~ / <:General_Category(\"L\")> /; | |
│ - QAST::Stmts | |
│ - QAST::Stmts | |
│ - QAST::WVal(Nil) | |
! │ - QAST::Stmts say \"a\" ~~ / <:General_Category(\"L\")> /; | |
│ - QAST::Var(local __args__ :decl(param)) | |
│ - QAST::Stmts | |
│ - QAST::Var(lexical GLOBALish :decl(static)) | |
*************** | |
*** 96,102 **** | |
│ │ - QAST::Want | |
│ │ - QAST::WVal(Str) | |
│ │ - Ss | |
! │ │ - QAST::SVal(Ll) | |
│ │ - QAST::Regex(:rxtype(pass) :subtype()) | |
│ - QAST::Stmts | |
│ - QAST::Stmts | |
--- 96,102 ---- | |
│ │ - QAST::Want | |
│ │ - QAST::WVal(Str) | |
│ │ - Ss | |
! │ │ - QAST::SVal(L) | |
│ │ - QAST::Regex(:rxtype(pass) :subtype()) | |
│ - QAST::Stmts | |
│ - QAST::Stmts | |
*************** | |
*** 113,120 **** | |
│ - QAST::SVal(ctxsave) | |
│ - QAST::Op(callmethod ctxsave) | |
│ - QAST::Var(local ctxsave) | |
! │ - QAST::Stmts say \"a\" ~~ / <:General_Category(\"Ll\")> /; | |
! │ - QAST::Stmt say \"a\" ~~ / <:General_Category(\"Ll\")> / | |
│ - QAST::Op(p6sink) | |
│ - QAST::Op(call &say) | |
│ - QAST::Stmt(:resultchild(2))) | |
--- 113,120 ---- | |
│ - QAST::SVal(ctxsave) | |
│ - QAST::Op(callmethod ctxsave) | |
│ - QAST::Var(local ctxsave) | |
! │ - QAST::Stmts say \"a\" ~~ / <:General_Category(\"L\")> /; | |
! │ - QAST::Stmt say \"a\" ~~ / <:General_Category(\"L\")> / | |
│ - QAST::Op(p6sink) | |
│ - QAST::Op(call &say) | |
│ - QAST::Stmt(:resultchild(2))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 3fdf5203525bd7ad2ed607d8b5d2a80de8ca2dc5 | |
Author: ab5tract <longwalker@hey.com> | |
Date: Mon Apr 22 21:09:49 2024 +0200 | |
Add method dump_reg | |
diff --git a/src/vm/moar/QAST/QASTCompilerMAST.nqp b/src/vm/moar/QAST/QASTCompilerMAST.nqp | |
index 01090399c..3aa9218e3 100644 | |
--- a/src/vm/moar/QAST/QASTCompilerMAST.nqp | |
+++ b/src/vm/moar/QAST/QASTCompilerMAST.nqp | |
@@ -395,6 +395,26 @@ my class MASTCompilerInstance { | |
$!mast_compunit | |
} | |
+ sub op($frame, str $op, *@args) { | |
+ MAST::Op.new_with_operand_array(:$frame, :$op, @args ); | |
+ } | |
+ | |
+ method dump_reg($header, $reg, int $type, $frame, $regalloc) { | |
+ my $tmp := $regalloc.fresh_register($type); | |
+ op($frame, 'set', $tmp, $reg); | |
+ | |
+ my $sreg := $regalloc.fresh_s(); | |
+ op($frame, 'const_s', $sreg, $header); | |
+ op($frame, 'print', $sreg); | |
+ | |
+ my $res := MAST::InstructionList.new($tmp, $type); | |
+ self.coerce($res, nqp::const::MVM_reg_str); | |
+ op($frame, 'say', $res.result_reg()); | |
+ | |
+ $regalloc.release_register($tmp, $type); | |
+ $regalloc.release_s($sreg); | |
+ } | |
+ | |
method coerce($res, int $desired) { | |
my int $got := nqp::unbox_i($res.result_kind); | |
if $got != $desired { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment