Skip to content

Commit 388a271

Browse files
committed
A little optimization. Shaves some more seconds of CORE.setting compile time here, and off the spectest also.
1 parent dc13ec1 commit 388a271

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/QAST/Compiler.nqp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,9 @@ class QAST::Compiler is HLL::Compiler {
13611361
my $ops := self.post_new('Ops', :result(%*REG<cur>));
13621362
my $name := $*PASTCOMPILER.as_post($node.name, :rtype<*>);
13631363
my $subtype := $node.subtype;
1364-
my $cpn := $node[0] ~~ QAST::Node ?? self.children($node[0]) !! self.post_children($node[0]);
1364+
my $cpn := nqp::istype($node[0], QAST::Node)
1365+
?? self.children($node[0])
1366+
!! self.post_children($node[0]);
13651367
my @pargs := $cpn[1] // [];
13661368
my @nargs := $cpn[2] // [];
13671369
my $subpost := nqp::shift(@pargs);

src/QAST/PIRT.nqp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PIRT::CallResult {
99
method new(:$result!) {
1010
my $obj := nqp::create(self);
1111
nqp::bindattr_s($obj, PIRT::CallResult, '$!result',
12-
$result ~~ PIRT::Node ?? $result.result !! $result);
12+
nqp::istype($result, PIRT::Node) ?? $result.result !! $result);
1313
$obj
1414
}
1515

@@ -70,10 +70,10 @@ class PIRT::Node {
7070
my $result;
7171
while $i < $c {
7272
$arg := $_[$i];
73-
if $arg ~~ PIRT::Node {
73+
if nqp::istype($arg, PIRT::Node) {
7474
nqp::push(@op_args, $arg.result);
7575
}
76-
elsif $arg ~~ PIRT::CallResult {
76+
elsif nqp::istype($arg, PIRT::CallResult) {
7777
$result := $arg.result;
7878
$*HAS_RESULT := 1;
7979
}
@@ -92,10 +92,10 @@ class PIRT::Node {
9292
nqp::push(@parts, ' ' ~ $op_name ~ ' ' ~ nqp::join(", ", @op_args));
9393
}
9494
}
95-
elsif $_ ~~ PIRT::Sub {
95+
elsif nqp::istype($_, PIRT::Sub) {
9696
nqp::push(@*PIRT_BLOCKS, $_);
9797
}
98-
elsif $_ ~~ PIRT::Node {
98+
elsif nqp::istype($_, PIRT::Node) {
9999
my $pir := $_.pir;
100100
nqp::push(@parts, $pir) unless $pir eq '';
101101
}
@@ -252,7 +252,7 @@ class PIRT::Ops is PIRT::Node {
252252
my $obj := nqp::create(self);
253253
nqp::bindattr($obj, PIRT::Ops, '@!children', nqp::list());
254254
nqp::bindattr_s($obj, PIRT::Ops, '$!result',
255-
$result ~~ PIRT::Node ?? $result.result !! $result);
255+
nqp::istype($result, PIRT::Node) ?? $result.result !! $result);
256256
$obj
257257
}
258258
@@ -269,7 +269,7 @@ class PIRT::Ops is PIRT::Node {
269269
270270
method result(*@value) is parrot_vtable('get_string') {
271271
if @value {
272-
$!result := @value[0] ~~ PIRT::Node ?? @value[0].result !! @value[0];
272+
$!result := nqp::istype(@value[0], PIRT::Node) ?? @value[0].result !! @value[0];
273273
}
274274
else {
275275
$!result

0 commit comments

Comments
 (0)