Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moar: falsey a num64 complains NYI #194

Closed
duzy opened this issue Oct 21, 2014 · 7 comments
Closed

moar: falsey a num64 complains NYI #194

duzy opened this issue Oct 21, 2014 · 7 comments

Comments

@duzy
Copy link

duzy commented Oct 21, 2014

The falsey op does not deal with num64, and it complains This case of nqp falsey op NYI always. (prefix:sym<!>)

@moritz
Copy link
Contributor

moritz commented Oct 21, 2014

What code exactly triggers this error?

@duzy
Copy link
Author

duzy commented Oct 21, 2014

Not sure, but it's from https://github.com/perl6/nqp/blob/master/src/vm/moar/NQP/Ops.nqp#L99, I'm trying to make such code..

@duzy
Copy link
Author

duzy commented Oct 21, 2014

This segment reproduce the NYI:

my num $v := 1.0;
say('falsey: '~!$v);

@duzy
Copy link
Author

duzy commented Oct 21, 2014

I'm trying to make a quick fix for my hacking, and thinking about converting num64 into int64, but don't know how (NUM64_TO_INT64):

    elsif $val.result_kind == $MVM_reg_num64 {
        my $not_reg := $regalloc.fresh_register($MVM_reg_int64);
        my $ir := $regalloc.fresh_register($MVM_reg_int64);
        my @ins := $val.instructions;
        push_op(@ins, 'NUM64_TO_INT64', $ir, $val.result_reg);
        push_op(@ins, 'not_i', $not_reg, $ir);
        MAST::InstructionList.new(@ins, $not_reg, $MVM_reg_int64)
    }

But I believe it should have a better way to do a falsey on num64.

@duzy
Copy link
Author

duzy commented Nov 8, 2014

Falsey is still not working with the following segment of code:

my num $v := 1.0;
if $v {
    say('bool: okay..');
}
if !$v {
    say('falsey: ...');
}

Runing this segment in nqp-p is fine, but failed in nqp-m.

@duzy
Copy link
Author

duzy commented Jan 5, 2015

This falsey is complained:

my %sym;
if !+%sym {
    # ...
}

@jnthn jnthn closed this as completed in 3933e32 Jan 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants