Skip to content

Commit b1fb4b3

Browse files
kbogaperlpilot
authored andcommitted
pir::defined to nqp::defined, pir::find_not_cclass__Iisii to nqp::findnotcclass, pir::find_method__PPs to nqp::findmethod
1 parent 6ae28d9 commit b1fb4b3

File tree

16 files changed

+65
-58
lines changed

16 files changed

+65
-58
lines changed

docs/nqp-opcode.txt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ General notes:
5151
nqp::chars pir::length__Is
5252
nqp::split pir::split__Pss
5353
nqp::iscclass pir::iscclass__Isii (?)
54-
nqp::findcclass pir::find_cclass__Isii (?)
55-
nqp::findnotcclass pir::find_not_cclass__Isii (?)
54+
nqp::findcclass pir::find_cclass__Iisii (?)
55+
nqp::findnotcclass pir::find_not_cclass__Iisii (?)
5656

5757
relational:
5858
nqp::iseq_i pir::iseq__Iii
@@ -77,24 +77,30 @@ General notes:
7777
object:
7878
nqp::bindattribute pir::setattribute__0PPsP
7979
nqp::getattribute pir::getattribute__PPPs
80-
nqp::findmethod pir::find_method__PPs (?)
80+
nqp::find_method pir::find_method__PPs (?)
81+
nqp::can pir::can__IPs (?)
8182
nqp::null pir::null__P
8283
nqp::isnull pir::isnull__IP
8384
nqp::defined pir::defined__IP
84-
nqp::?? pir::istrue__IP
85+
nqp::istrue pir::istrue__IP
8586
nqp::clone pir::clone__PP
8687
nqp::typecheck or ::isa pir::type_check__IPP
8788
or ::istype
89+
nqp::?? pir::isa__IPs (?)
90+
nqp::?? pir::typeof__SP (?)
91+
nqp::?? pir::does__IPs (?)
8892
nqp::create pir::repr_instance_of__PP (?)
93+
8994
nqp::unbox_i pir::repr_unbox_int__IP
9095
nqp::unbox_n pir::repr_unbox_num__NP
9196
nqp::unbox_s pir::repr_unbox_str__SP
9297
nqp::box_i pir::repr_box_int__PPi
9398
nqp::box_n pir::repr_box_num__PPn
9499
nqp::box_s pir::repr_box_str__PPs
95-
nqp::what or nqp::getwhat (?)
96-
nqp::how or nqp::gethow (?)
97-
nqp::?? pir::can__IPs (?)
100+
nqp::what or nqp::getwhat pir::get_what__PP (?)
101+
nqp::how or nqp::gethow pir::get_how__PP (?)
102+
nqp::who or nqp::getwho pir::get_who__PP (?)
103+
nqp::where or nqp::getwhere pir::get_id__IP (?)
98104

99105
Rakudo-specific:
100106
nqp::p6box_i pir::perl6_box_int__Pi

src/HLL/Actions.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class HLL::Actions {
3535

3636
method SET_BLOCK_OUTER_CTX($block) {
3737
my $outer_ctx := %*COMPILING<%?OPTIONS><outer_ctx>;
38-
if pir::defined($outer_ctx) {
38+
if nqp::defined($outer_ctx) {
3939
my @ns := pir::getattribute__PPs($outer_ctx, 'current_namespace').get_name;
4040
@ns.shift;
4141
$block.namespace(@ns);
@@ -61,7 +61,7 @@ class HLL::Actions {
6161
}
6262
if $key eq 'POSTFIX' { $past.unshift($/[0].ast); }
6363
else {
64-
for $/.list { if pir::defined__IP($_.ast) { $past.push($_.ast); } }
64+
for $/.list { if nqp::defined($_.ast) { $past.push($_.ast); } }
6565
}
6666
make $past;
6767
}

src/HLL/Compiler.pm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class HLL::Compiler {
5757
$tagset := $tagset // (@symbols ?? 'ALL' !! 'DEFAULT');
5858
my %exports;
5959
my %source := $module{'EXPORT'}{~$tagset};
60-
if !pir::defined(%source) {
60+
if !nqp::defined(%source) {
6161
%source := $tagset eq 'ALL' ?? $module !! {};
6262
}
6363
if @symbols {
@@ -161,7 +161,7 @@ class HLL::Compiler {
161161
my $code := $stdin.readline_interactive(~$prompt);
162162

163163
last if nqp::isnull($code);
164-
unless pir::defined($code) {
164+
unless nqp::defined($code) {
165165
nqp::print("\n");
166166
last;
167167
}
@@ -181,7 +181,7 @@ class HLL::Compiler {
181181
next;
182182
}
183183
};
184-
if pir::defined($*MAIN_CTX) {
184+
if nqp::defined($*MAIN_CTX) {
185185
for $*MAIN_CTX.lexpad_full() {
186186
%interactive_pad{$_.key} := $_.value;
187187
}
@@ -212,7 +212,7 @@ class HLL::Compiler {
212212
if !pir::isa($output, 'String')
213213
&& %adverbs<target> eq '' {
214214
my $outer_ctx := %adverbs<outer_ctx>;
215-
if pir::defined($outer_ctx) {
215+
if nqp::defined($outer_ctx) {
216216
$output[0].set_outer_ctx($outer_ctx);
217217
}
218218

@@ -267,7 +267,7 @@ class HLL::Compiler {
267267
method interactive_prompt() { '> ' }
268268

269269
method compiler_progname($value?) {
270-
if pir::defined($value) {
270+
if nqp::defined($value) {
271271
$!compiler_progname := $value;
272272
}
273273
$!compiler_progname;
@@ -319,7 +319,7 @@ class HLL::Compiler {
319319
my $has_error := 0;
320320
my $target := nqp::lc(%adverbs<target>);
321321
try {
322-
if pir::defined(%adverbs<e>) {
322+
if nqp::defined(%adverbs<e>) {
323323
$!user_progname := '-e';
324324
my $?FILES := '-e';
325325
$result := self.eval(%adverbs<e>, '-e', |@a, |%adverbs);

src/HLL/World.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class HLL::World {
7373
# Gets the slot for a given object. Dies if it is not in the context.
7474
method slot_for_object($obj) {
7575
my $slot := %!addr_to_slot{nqp::where($obj)};
76-
unless pir::defined($slot) {
76+
unless nqp::defined($slot) {
7777
nqp::die('slot_for_object called on object not in context');
7878
}
7979
$slot
@@ -178,7 +178,7 @@ class HLL::World {
178178
# Get the object's serialization context; we're stuck if it
179179
# has none.
180180
my $sc := pir::nqp_get_sc_for_object__PP($obj);
181-
unless pir::defined($sc) {
181+
unless nqp::defined($sc) {
182182
self.add_object($obj);
183183
$sc := $!sc;
184184
}

src/ModuleLoader.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ knowhow ModuleLoader {
5353
last;
5454
}
5555
}
56-
if pir::defined(%modules_loaded{$path}) {
56+
if nqp::defined(%modules_loaded{$path}) {
5757
$module_ctx := %modules_loaded{$path};
5858
}
5959
else {
@@ -66,7 +66,7 @@ knowhow ModuleLoader {
6666
}
6767

6868
# Provided we have a mainline...
69-
if pir::defined($module_ctx) {
69+
if nqp::defined($module_ctx) {
7070
# Merge any globals.
7171
my $UNIT := pir::getattribute__PPs($module_ctx, 'lex_pad');
7272
unless nqp::isnull($UNIT<GLOBALish>) {
@@ -152,13 +152,13 @@ knowhow ModuleLoader {
152152
}
153153

154154
# Unless we already did so, load the setting.
155-
unless pir::defined(%settings_loaded{$path}) {
155+
unless nqp::defined(%settings_loaded{$path}) {
156156
my $*CTXSAVE := self;
157157
my $*MAIN_CTX;
158158
my $preserve_global := pir::get_hll_global__Ps('GLOBAL');
159159
pir::load_bytecode($path);
160160
pir::set_hll_global__vsP('GLOBAL', $preserve_global);
161-
unless pir::defined($*MAIN_CTX) {
161+
unless nqp::defined($*MAIN_CTX) {
162162
nqp::die("Unable to load setting $setting_name; maybe it is missing a YOU_ARE_HERE?");
163163
}
164164
%settings_loaded{$path} := $*MAIN_CTX;

src/NQP/Actions.pm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class NQP::Actions is HLL::Actions {
117117
if $<statement> {
118118
for $<statement> {
119119
my $ast := $_.ast;
120-
$ast := $ast<sink> if pir::defined($ast<sink>);
120+
$ast := $ast<sink> if nqp::defined($ast<sink>);
121121
if $ast<bareblock> { $ast := block_immediate($ast); }
122122
$ast := PAST::Stmt.new($ast) if $ast ~~ PAST::Node;
123123
$past.push( $ast );
@@ -189,7 +189,7 @@ class NQP::Actions is HLL::Actions {
189189
}
190190

191191
method outerctx($/) {
192-
unless pir::defined(%*COMPILING<%?OPTIONS><outer_ctx>) {
192+
unless nqp::defined(%*COMPILING<%?OPTIONS><outer_ctx>) {
193193
# We haven't got a specified outer context already, so load a
194194
# setting.
195195
my $SETTING := $*W.load_setting(%*COMPILING<%?OPTIONS><setting> // 'NQPCORE');
@@ -243,7 +243,7 @@ class NQP::Actions is HLL::Actions {
243243

244244
method statement_control:sym<use>($/) {
245245
my $module := $*W.load_module(~$<name>, $*GLOBALish);
246-
if pir::defined($module) {
246+
if nqp::defined($module) {
247247
import_HOW_exports($module);
248248
}
249249
make PAST::Stmts.new();
@@ -481,7 +481,7 @@ class NQP::Actions is HLL::Actions {
481481
last;
482482
}
483483
}
484-
if pir::defined($attr) {
484+
if nqp::defined($attr) {
485485
if nqp::can($attr, 'type') {
486486
$past.type($attr.type);
487487
}
@@ -1175,7 +1175,7 @@ class NQP::Actions is HLL::Actions {
11751175
my $past := PAST::Node.'map_node'(|$args, :map<nqp>, :op($op),
11761176
:node($/));
11771177

1178-
pir::defined($past) ||
1178+
nqp::defined($past) ||
11791179
$/.CURSOR.panic("Unrecognized nqp:: opcode 'nqp::$op'");
11801180
make $past;
11811181
}

src/NQP/World.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class NQP::World is HLL::World {
229229
my $fixups := PAST::Stmts.new();
230230
my $dummy;
231231
my $code_ref_idx;
232-
if pir::defined($past<compile_time_dummy>) {
232+
if nqp::defined($past<compile_time_dummy>) {
233233
$dummy := $past<compile_time_dummy>;
234234
}
235235
else {
@@ -336,8 +336,8 @@ class NQP::World is HLL::World {
336336
method pkg_create_mo($how, :$name, :$repr) {
337337
# Create the meta-object and add to root objects.
338338
my %args;
339-
if pir::defined($name) { %args<name> := $name; }
340-
if pir::defined($repr) { %args<repr> := $repr; }
339+
if nqp::defined($name) { %args<name> := $name; }
340+
if nqp::defined($repr) { %args<repr> := $repr; }
341341
my $mo := $how.new_type(|%args);
342342
my $slot := self.add_object($mo);
343343

@@ -390,7 +390,7 @@ class NQP::World is HLL::World {
390390
# Fixup code depends on if we have the routine in the SC for
391391
# fixing up.
392392
my $fixup := PAST::Op.new( :pirop('set_sub_multisig vPP'), self.get_ref($sig_obj) );
393-
if pir::defined($routine<compile_time_dummy>) {
393+
if nqp::defined($routine<compile_time_dummy>) {
394394
$fixup.unshift(self.get_slot_past_for_object($routine<compile_time_dummy>));
395395
}
396396
else {

src/PAST/NQP.pir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ entry to produce the node to be returned.
533533
maphash['substr'] = 'substr__Ssii'
534534
maphash['x'] = 'repeat__Ssi'
535535
maphash['iscclass'] = 'is_cclass__Iisi'
536+
maphash['findnotcclass'] = 'find_not_cclass__Iisii'
536537
maphash['sprintf'] = 'sprintf__SsP'
537538
maphash['find_not_cclass'] = 'find_not_cclass__Iisii'
538539

src/QAST/Node.nqp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class QAST::Node is NQPCapture {
99
$new.BUILD();
1010
nqp::splice($new.list, @children, 0, 0);
1111
for %options {
12-
pir::find_method__PPs($new, $_.key)($new, $_.value);
12+
nqp::find_method($new, $_.key)($new, $_.value);
1313
}
1414
$new;
1515
}

src/QRegex/Cursor.nqp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ role NQPCursorRole {
4040
$subcur := nqp::shift($iter);
4141
$submatch := $subcur.MATCH;
4242
$name := nqp::getattr($subcur, $?CLASS, '$!name');
43-
if pir::defined($name) {
43+
if nqp::defined($name) {
4444
if nqp::index($name, '=') < 0 {
4545
%caplist{$name} >= 2
4646
?? nqp::push($caps{$name}, $submatch)
@@ -64,7 +64,7 @@ role NQPCursorRole {
6464
nqp::bindattr($new, $?CLASS, '$!orig', $target);
6565
$target := pir::trans_encoding__Ssi($target, pir::find_encoding__Is('ucs4'));
6666
nqp::bindattr_s($new, $?CLASS, '$!target', $target);
67-
if pir::defined($c) {
67+
if nqp::defined($c) {
6868
nqp::bindattr_i($new, $?CLASS, '$!from', -1);
6969
nqp::bindattr_i($new, $?CLASS, '$!pos', $c);
7070
}
@@ -115,7 +115,7 @@ role NQPCursorRole {
115115

116116
method !cursor_capture($capture, $name) {
117117
$!match := nqp::null();
118-
$!cstack := [] unless pir::defined($!cstack);
118+
$!cstack := [] unless nqp::defined($!cstack);
119119
nqp::push($!cstack, $capture);
120120
nqp::bindattr($capture, $?CLASS, '$!name', $name);
121121
pir::push__vPi($!bstack, 0);
@@ -126,7 +126,7 @@ role NQPCursorRole {
126126
}
127127

128128
method !cursor_push_cstack($capture) {
129-
$!cstack := [] unless pir::defined($!cstack);
129+
$!cstack := [] unless nqp::defined($!cstack);
130130
nqp::push($!cstack, $capture);
131131
$!cstack;
132132
}
@@ -161,13 +161,13 @@ role NQPCursorRole {
161161

162162
method !reduce($name) {
163163
my $actions := pir::find_dynamic_lex__Ps('$*ACTIONS');
164-
pir::find_method__PPs($actions, $name)($actions, self.MATCH)
164+
nqp::find_method($actions, $name)($actions, self.MATCH)
165165
if nqp::can($actions, $name);
166166
}
167167

168168
method !reduce_with_match($name, $key, $match) {
169169
my $actions := pir::find_dynamic_lex__Ps('$*ACTIONS');
170-
pir::find_method__PPs($actions, $name)($actions, $match, $key)
170+
nqp::find_method($actions, $name)($actions, $match, $key)
171171
if nqp::can($actions, $name);
172172
}
173173

@@ -283,7 +283,7 @@ role NQPCursorRole {
283283
|| !nqp::iscclass(pir::const::CCLASS_WORD, $!target, $!pos)
284284
|| !nqp::iscclass(pir::const::CCLASS_WORD, $!target, $!pos-1)
285285
) && $cur."!cursor_pass"(
286-
pir::find_not_cclass__Iisii(
286+
nqp::findnotcclass(
287287
pir::const::CCLASS_WHITESPACE, $!target, $!pos, nqp::chars($!target)),
288288
'ws');
289289
$cur;
@@ -313,7 +313,7 @@ role NQPCursorRole {
313313
method ident() {
314314
my $cur := self."!cursor_start"();
315315
$cur."!cursor_pass"(
316-
pir::find_not_cclass__Iisii(
316+
nqp::findnotcclass(
317317
pir::const::CCLASS_WORD,
318318
$!target, $!pos, nqp::chars($!target)))
319319
if $!pos < nqp::chars($!target) &&
@@ -497,7 +497,7 @@ class NQPCursor does NQPCursorRole {
497497
my $cur := self.'!cursor_init'($target, |%options);
498498
pir::is_invokable__IP($rule) ??
499499
$rule($cur).MATCH() !!
500-
pir::find_method__PPs($cur, $rule)($cur).MATCH()
500+
nqp::find_method($cur, $rule)($cur).MATCH()
501501
}
502502

503503
method !INTERPOLATE($var) {

0 commit comments

Comments
 (0)