Skip to content

Commit

Permalink
pir::defined to nqp::defined, pir::find_not_cclass__Iisii to nqp::fin…
Browse files Browse the repository at this point in the history
…dnotcclass, pir::find_method__PPs to nqp::findmethod
  • Loading branch information
kboga authored and perlpilot committed Jun 1, 2012
1 parent 6ae28d9 commit b1fb4b3
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 58 deletions.
20 changes: 13 additions & 7 deletions docs/nqp-opcode.txt
Expand Up @@ -51,8 +51,8 @@ General notes:
nqp::chars pir::length__Is
nqp::split pir::split__Pss
nqp::iscclass pir::iscclass__Isii (?)
nqp::findcclass pir::find_cclass__Isii (?)
nqp::findnotcclass pir::find_not_cclass__Isii (?)
nqp::findcclass pir::find_cclass__Iisii (?)
nqp::findnotcclass pir::find_not_cclass__Iisii (?)

relational:
nqp::iseq_i pir::iseq__Iii
Expand All @@ -77,24 +77,30 @@ General notes:
object:
nqp::bindattribute pir::setattribute__0PPsP
nqp::getattribute pir::getattribute__PPPs
nqp::findmethod pir::find_method__PPs (?)
nqp::find_method pir::find_method__PPs (?)
nqp::can pir::can__IPs (?)
nqp::null pir::null__P
nqp::isnull pir::isnull__IP
nqp::defined pir::defined__IP
nqp::?? pir::istrue__IP
nqp::istrue pir::istrue__IP
nqp::clone pir::clone__PP
nqp::typecheck or ::isa pir::type_check__IPP
or ::istype
nqp::?? pir::isa__IPs (?)
nqp::?? pir::typeof__SP (?)
nqp::?? pir::does__IPs (?)
nqp::create pir::repr_instance_of__PP (?)

nqp::unbox_i pir::repr_unbox_int__IP
nqp::unbox_n pir::repr_unbox_num__NP
nqp::unbox_s pir::repr_unbox_str__SP
nqp::box_i pir::repr_box_int__PPi
nqp::box_n pir::repr_box_num__PPn
nqp::box_s pir::repr_box_str__PPs
nqp::what or nqp::getwhat (?)
nqp::how or nqp::gethow (?)
nqp::?? pir::can__IPs (?)
nqp::what or nqp::getwhat pir::get_what__PP (?)
nqp::how or nqp::gethow pir::get_how__PP (?)
nqp::who or nqp::getwho pir::get_who__PP (?)
nqp::where or nqp::getwhere pir::get_id__IP (?)

Rakudo-specific:
nqp::p6box_i pir::perl6_box_int__Pi
Expand Down
4 changes: 2 additions & 2 deletions src/HLL/Actions.pm
Expand Up @@ -35,7 +35,7 @@ class HLL::Actions {

method SET_BLOCK_OUTER_CTX($block) {
my $outer_ctx := %*COMPILING<%?OPTIONS><outer_ctx>;
if pir::defined($outer_ctx) {
if nqp::defined($outer_ctx) {
my @ns := pir::getattribute__PPs($outer_ctx, 'current_namespace').get_name;
@ns.shift;
$block.namespace(@ns);
Expand All @@ -61,7 +61,7 @@ class HLL::Actions {
}
if $key eq 'POSTFIX' { $past.unshift($/[0].ast); }
else {
for $/.list { if pir::defined__IP($_.ast) { $past.push($_.ast); } }
for $/.list { if nqp::defined($_.ast) { $past.push($_.ast); } }
}
make $past;
}
Expand Down
12 changes: 6 additions & 6 deletions src/HLL/Compiler.pm
Expand Up @@ -57,7 +57,7 @@ class HLL::Compiler {
$tagset := $tagset // (@symbols ?? 'ALL' !! 'DEFAULT');
my %exports;
my %source := $module{'EXPORT'}{~$tagset};
if !pir::defined(%source) {
if !nqp::defined(%source) {
%source := $tagset eq 'ALL' ?? $module !! {};
}
if @symbols {
Expand Down Expand Up @@ -161,7 +161,7 @@ class HLL::Compiler {
my $code := $stdin.readline_interactive(~$prompt);

last if nqp::isnull($code);
unless pir::defined($code) {
unless nqp::defined($code) {
nqp::print("\n");
last;
}
Expand All @@ -181,7 +181,7 @@ class HLL::Compiler {
next;
}
};
if pir::defined($*MAIN_CTX) {
if nqp::defined($*MAIN_CTX) {
for $*MAIN_CTX.lexpad_full() {
%interactive_pad{$_.key} := $_.value;
}
Expand Down Expand Up @@ -212,7 +212,7 @@ class HLL::Compiler {
if !pir::isa($output, 'String')
&& %adverbs<target> eq '' {
my $outer_ctx := %adverbs<outer_ctx>;
if pir::defined($outer_ctx) {
if nqp::defined($outer_ctx) {
$output[0].set_outer_ctx($outer_ctx);
}

Expand Down Expand Up @@ -267,7 +267,7 @@ class HLL::Compiler {
method interactive_prompt() { '> ' }

method compiler_progname($value?) {
if pir::defined($value) {
if nqp::defined($value) {
$!compiler_progname := $value;
}
$!compiler_progname;
Expand Down Expand Up @@ -319,7 +319,7 @@ class HLL::Compiler {
my $has_error := 0;
my $target := nqp::lc(%adverbs<target>);
try {
if pir::defined(%adverbs<e>) {
if nqp::defined(%adverbs<e>) {
$!user_progname := '-e';
my $?FILES := '-e';
$result := self.eval(%adverbs<e>, '-e', |@a, |%adverbs);
Expand Down
4 changes: 2 additions & 2 deletions src/HLL/World.pm
Expand Up @@ -73,7 +73,7 @@ class HLL::World {
# Gets the slot for a given object. Dies if it is not in the context.
method slot_for_object($obj) {
my $slot := %!addr_to_slot{nqp::where($obj)};
unless pir::defined($slot) {
unless nqp::defined($slot) {
nqp::die('slot_for_object called on object not in context');
}
$slot
Expand Down Expand Up @@ -178,7 +178,7 @@ class HLL::World {
# Get the object's serialization context; we're stuck if it
# has none.
my $sc := pir::nqp_get_sc_for_object__PP($obj);
unless pir::defined($sc) {
unless nqp::defined($sc) {
self.add_object($obj);
$sc := $!sc;
}
Expand Down
8 changes: 4 additions & 4 deletions src/ModuleLoader.pm
Expand Up @@ -53,7 +53,7 @@ knowhow ModuleLoader {
last;
}
}
if pir::defined(%modules_loaded{$path}) {
if nqp::defined(%modules_loaded{$path}) {
$module_ctx := %modules_loaded{$path};
}
else {
Expand All @@ -66,7 +66,7 @@ knowhow ModuleLoader {
}

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

# Unless we already did so, load the setting.
unless pir::defined(%settings_loaded{$path}) {
unless nqp::defined(%settings_loaded{$path}) {
my $*CTXSAVE := self;
my $*MAIN_CTX;
my $preserve_global := pir::get_hll_global__Ps('GLOBAL');
pir::load_bytecode($path);
pir::set_hll_global__vsP('GLOBAL', $preserve_global);
unless pir::defined($*MAIN_CTX) {
unless nqp::defined($*MAIN_CTX) {
nqp::die("Unable to load setting $setting_name; maybe it is missing a YOU_ARE_HERE?");
}
%settings_loaded{$path} := $*MAIN_CTX;
Expand Down
10 changes: 5 additions & 5 deletions src/NQP/Actions.pm
Expand Up @@ -117,7 +117,7 @@ class NQP::Actions is HLL::Actions {
if $<statement> {
for $<statement> {
my $ast := $_.ast;
$ast := $ast<sink> if pir::defined($ast<sink>);
$ast := $ast<sink> if nqp::defined($ast<sink>);
if $ast<bareblock> { $ast := block_immediate($ast); }
$ast := PAST::Stmt.new($ast) if $ast ~~ PAST::Node;
$past.push( $ast );
Expand Down Expand Up @@ -189,7 +189,7 @@ class NQP::Actions is HLL::Actions {
}

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

method statement_control:sym<use>($/) {
my $module := $*W.load_module(~$<name>, $*GLOBALish);
if pir::defined($module) {
if nqp::defined($module) {
import_HOW_exports($module);
}
make PAST::Stmts.new();
Expand Down Expand Up @@ -481,7 +481,7 @@ class NQP::Actions is HLL::Actions {
last;
}
}
if pir::defined($attr) {
if nqp::defined($attr) {
if nqp::can($attr, 'type') {
$past.type($attr.type);
}
Expand Down Expand Up @@ -1175,7 +1175,7 @@ class NQP::Actions is HLL::Actions {
my $past := PAST::Node.'map_node'(|$args, :map<nqp>, :op($op),
:node($/));

pir::defined($past) ||
nqp::defined($past) ||
$/.CURSOR.panic("Unrecognized nqp:: opcode 'nqp::$op'");
make $past;
}
Expand Down
8 changes: 4 additions & 4 deletions src/NQP/World.pm
Expand Up @@ -229,7 +229,7 @@ class NQP::World is HLL::World {
my $fixups := PAST::Stmts.new();
my $dummy;
my $code_ref_idx;
if pir::defined($past<compile_time_dummy>) {
if nqp::defined($past<compile_time_dummy>) {
$dummy := $past<compile_time_dummy>;
}
else {
Expand Down Expand Up @@ -336,8 +336,8 @@ class NQP::World is HLL::World {
method pkg_create_mo($how, :$name, :$repr) {
# Create the meta-object and add to root objects.
my %args;
if pir::defined($name) { %args<name> := $name; }
if pir::defined($repr) { %args<repr> := $repr; }
if nqp::defined($name) { %args<name> := $name; }
if nqp::defined($repr) { %args<repr> := $repr; }
my $mo := $how.new_type(|%args);
my $slot := self.add_object($mo);

Expand Down Expand Up @@ -390,7 +390,7 @@ class NQP::World is HLL::World {
# Fixup code depends on if we have the routine in the SC for
# fixing up.
my $fixup := PAST::Op.new( :pirop('set_sub_multisig vPP'), self.get_ref($sig_obj) );
if pir::defined($routine<compile_time_dummy>) {
if nqp::defined($routine<compile_time_dummy>) {
$fixup.unshift(self.get_slot_past_for_object($routine<compile_time_dummy>));
}
else {
Expand Down
1 change: 1 addition & 0 deletions src/PAST/NQP.pir
Expand Up @@ -533,6 +533,7 @@ entry to produce the node to be returned.
maphash['substr'] = 'substr__Ssii'
maphash['x'] = 'repeat__Ssi'
maphash['iscclass'] = 'is_cclass__Iisi'
maphash['findnotcclass'] = 'find_not_cclass__Iisii'
maphash['sprintf'] = 'sprintf__SsP'
maphash['find_not_cclass'] = 'find_not_cclass__Iisii'

Expand Down
2 changes: 1 addition & 1 deletion src/QAST/Node.nqp
Expand Up @@ -9,7 +9,7 @@ class QAST::Node is NQPCapture {
$new.BUILD();
nqp::splice($new.list, @children, 0, 0);
for %options {
pir::find_method__PPs($new, $_.key)($new, $_.value);
nqp::find_method($new, $_.key)($new, $_.value);
}
$new;
}
Expand Down
18 changes: 9 additions & 9 deletions src/QRegex/Cursor.nqp
Expand Up @@ -40,7 +40,7 @@ role NQPCursorRole {
$subcur := nqp::shift($iter);
$submatch := $subcur.MATCH;
$name := nqp::getattr($subcur, $?CLASS, '$!name');
if pir::defined($name) {
if nqp::defined($name) {
if nqp::index($name, '=') < 0 {
%caplist{$name} >= 2
?? nqp::push($caps{$name}, $submatch)
Expand All @@ -64,7 +64,7 @@ role NQPCursorRole {
nqp::bindattr($new, $?CLASS, '$!orig', $target);
$target := pir::trans_encoding__Ssi($target, pir::find_encoding__Is('ucs4'));
nqp::bindattr_s($new, $?CLASS, '$!target', $target);
if pir::defined($c) {
if nqp::defined($c) {
nqp::bindattr_i($new, $?CLASS, '$!from', -1);
nqp::bindattr_i($new, $?CLASS, '$!pos', $c);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ role NQPCursorRole {

method !cursor_capture($capture, $name) {
$!match := nqp::null();
$!cstack := [] unless pir::defined($!cstack);
$!cstack := [] unless nqp::defined($!cstack);
nqp::push($!cstack, $capture);
nqp::bindattr($capture, $?CLASS, '$!name', $name);
pir::push__vPi($!bstack, 0);
Expand All @@ -126,7 +126,7 @@ role NQPCursorRole {
}

method !cursor_push_cstack($capture) {
$!cstack := [] unless pir::defined($!cstack);
$!cstack := [] unless nqp::defined($!cstack);
nqp::push($!cstack, $capture);
$!cstack;
}
Expand Down Expand Up @@ -161,13 +161,13 @@ role NQPCursorRole {

method !reduce($name) {
my $actions := pir::find_dynamic_lex__Ps('$*ACTIONS');
pir::find_method__PPs($actions, $name)($actions, self.MATCH)
nqp::find_method($actions, $name)($actions, self.MATCH)
if nqp::can($actions, $name);
}

method !reduce_with_match($name, $key, $match) {
my $actions := pir::find_dynamic_lex__Ps('$*ACTIONS');
pir::find_method__PPs($actions, $name)($actions, $match, $key)
nqp::find_method($actions, $name)($actions, $match, $key)
if nqp::can($actions, $name);
}

Expand Down Expand Up @@ -283,7 +283,7 @@ role NQPCursorRole {
|| !nqp::iscclass(pir::const::CCLASS_WORD, $!target, $!pos)
|| !nqp::iscclass(pir::const::CCLASS_WORD, $!target, $!pos-1)
) && $cur."!cursor_pass"(
pir::find_not_cclass__Iisii(
nqp::findnotcclass(
pir::const::CCLASS_WHITESPACE, $!target, $!pos, nqp::chars($!target)),
'ws');
$cur;
Expand Down Expand Up @@ -313,7 +313,7 @@ role NQPCursorRole {
method ident() {
my $cur := self."!cursor_start"();
$cur."!cursor_pass"(
pir::find_not_cclass__Iisii(
nqp::findnotcclass(
pir::const::CCLASS_WORD,
$!target, $!pos, nqp::chars($!target)))
if $!pos < nqp::chars($!target) &&
Expand Down Expand Up @@ -497,7 +497,7 @@ class NQPCursor does NQPCursorRole {
my $cur := self.'!cursor_init'($target, |%options);
pir::is_invokable__IP($rule) ??
$rule($cur).MATCH() !!
pir::find_method__PPs($cur, $rule)($cur).MATCH()
nqp::find_method($cur, $rule)($cur).MATCH()
}

method !INTERPOLATE($var) {
Expand Down
6 changes: 3 additions & 3 deletions src/QRegex/NFA.nqp
Expand Up @@ -145,7 +145,7 @@ class QRegex::NFA {
if $max > 1 || $min > 1 {
my $count := 0;
my $st;
my $has_sep := pir::defined($node[1]);
my $has_sep := nqp::defined($node[1]);
while $count < $max || $count < $min {
if $count >= $min {
my $f := self.addedge($from, $to, $EDGE_EPSILON, 0);
Expand Down Expand Up @@ -175,7 +175,7 @@ class QRegex::NFA {
}
if $max == -1 {
if $min == 0 { # * quantifier
if pir::defined($node[1]) { # * %
if nqp::defined($node[1]) { # * %
my $start := self.addstate();
self.addedge($from, $start, $EDGE_EPSILON, 0);
my $looper := self.addstate();
Expand All @@ -195,7 +195,7 @@ class QRegex::NFA {
self.addedge($from, $start, $EDGE_EPSILON, 0);
my $looper := self.addstate();
my $st := self.regex_nfa($node[0], $start, $looper);
if pir::defined($node[1]) {
if nqp::defined($node[1]) {
self.regex_nfa($node[1], $looper, $start);
}
else {
Expand Down
6 changes: 3 additions & 3 deletions src/core/NQPRoutine.pm
Expand Up @@ -7,7 +7,7 @@ my knowhow NQPRoutine {
$!dispatchees.push($code);
}
method is_dispatcher() {
pir::defined($!dispatchees)
nqp::defined($!dispatchees)
}
method derive_dispatcher() {
# Clone the underlying VM code ref.
Expand All @@ -21,7 +21,7 @@ my knowhow NQPRoutine {

# If needed, arrange for a fixup of the cloned code-ref.
my $clone_callback := pir::getprop__PPs($!do, 'CLONE_CALLBACK');
if pir::defined($clone_callback) {
if nqp::defined($clone_callback) {
$clone_callback($!do, $do, $der);
}

Expand All @@ -38,7 +38,7 @@ my knowhow NQPRoutine {

# If needed, arrange for a fixup of the cloned code-ref.
my $clone_callback := pir::getprop__PPs($!do, 'CLONE_CALLBACK');
if pir::defined($clone_callback) {
if nqp::defined($clone_callback) {
$clone_callback($!do, $do, $der);
}

Expand Down

0 comments on commit b1fb4b3

Please sign in to comment.