Skip to content

proof of concept/performance test for use float #17831

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

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ext/Opcode/Opcode.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Opcode 1.63;
package Opcode 1.64;

use strict;

Expand Down Expand Up @@ -312,7 +312,8 @@ invert_opset function.

preinc i_preinc predec i_predec postinc i_postinc
postdec i_postdec int hex oct abs pow multiply i_multiply
divide i_divide modulo i_modulo add i_add subtract i_subtract
f_multiply divide i_divide f_divide modulo i_modulo add i_add
f_add subtract i_subtract f_subtract

left_shift right_shift bit_and bit_xor bit_or nbit_and
nbit_xor nbit_or sbit_and sbit_xor sbit_or negate i_negate not
Expand Down
38 changes: 25 additions & 13 deletions feature.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions lib/B/Deparse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# This is based on the module of the same name by Malcolm Beattie,
# but essentially none of his code remains.

package B::Deparse 1.72;
package B::Deparse 1.73;
use strict;
use Carp;
use B qw(class main_root main_start main_cv svref_2object opnumber perlstring
Expand Down Expand Up @@ -3000,12 +3000,12 @@ sub assoc_class {
# $a + $b + $c is equivalent to ($a + $b) + $c

BEGIN {
%left = ('multiply' => 19, 'i_multiply' => 19,
'divide' => 19, 'i_divide' => 19,
%left = ('multiply' => 19, 'i_multiply' => 19, 'f_multiply' => 19,
'divide' => 19, 'i_divide' => 19, 'f_divide' => 19,
'modulo' => 19, 'i_modulo' => 19,
'repeat' => 19,
'add' => 18, 'i_add' => 18,
'subtract' => 18, 'i_subtract' => 18,
'add' => 18, 'i_add' => 18, 'f_add' => 18,
'subtract' => 18, 'i_subtract' => 18, 'f_subtract' => 18,
'concat' => 18,
'left_shift' => 17, 'right_shift' => 17,
'bit_and' => 13, 'nbit_and' => 13, 'sbit_and' => 13,
Expand Down Expand Up @@ -3035,12 +3035,12 @@ sub deparse_binop_left {
BEGIN {
%right = ('pow' => 22,
'sassign=' => 7, 'aassign=' => 7,
'multiply=' => 7, 'i_multiply=' => 7,
'divide=' => 7, 'i_divide=' => 7,
'multiply=' => 7, 'i_multiply=' => 7, 'f_multiply=' => 7,
'divide=' => 7, 'i_divide=' => 7, 'f_divide=' => 7,
'modulo=' => 7, 'i_modulo=' => 7,
'repeat=' => 7, 'refassign' => 7, 'refassign=' => 7,
'add=' => 7, 'i_add=' => 7,
'subtract=' => 7, 'i_subtract=' => 7,
'add=' => 7, 'i_add=' => 7, 'f_add=' => 7,
'subtract=' => 7, 'i_subtract=' => 7, 'f_subtract=' => 7,
'concat=' => 7,
'left_shift=' => 7, 'right_shift=' => 7,
'bit_and=' => 7, 'sbit_and=' => 7, 'nbit_and=' => 7,
Expand Down Expand Up @@ -3101,6 +3101,10 @@ sub pp_i_multiply { maybe_targmy(@_, \&binop, "*", 19, ASSIGN) }
sub pp_i_subtract { maybe_targmy(@_, \&binop, "-", 18, ASSIGN) }
sub pp_i_divide { maybe_targmy(@_, \&binop, "/", 19, ASSIGN) }
sub pp_i_modulo { maybe_targmy(@_, \&binop, "%", 19, ASSIGN) }
sub pp_f_add { maybe_targmy(@_, \&binop, "+", 18, ASSIGN) }
sub pp_f_multiply { maybe_targmy(@_, \&binop, "*", 19, ASSIGN) }
sub pp_f_subtract { maybe_targmy(@_, \&binop, "-", 18, ASSIGN) }
sub pp_f_divide { maybe_targmy(@_, \&binop, "/", 19, ASSIGN) }
sub pp_pow { maybe_targmy(@_, \&binop, "**", 22, ASSIGN) }

sub pp_left_shift { maybe_targmy(@_, \&binop, "<<", 17, ASSIGN) }
Expand Down
8 changes: 6 additions & 2 deletions lib/B/Op_private.pm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions lib/feature.pm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions op.c
Original file line number Diff line number Diff line change
Expand Up @@ -4791,6 +4791,9 @@ S_op_integerize(pTHX_ OP *o)
{
o->op_ppaddr = PL_ppaddr[++(o->op_type)];
}
else if ((PL_opargs[type] & OA_OTHERFLOAT) && FEATURE_FLOAT_IS_ENABLED) {
o->op_ppaddr = PL_ppaddr[o->op_type += 2];
}

if (type == OP_NEGATE)
/* XXX might want a ck_negate() for this */
Expand Down
9 changes: 5 additions & 4 deletions op.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,10 @@ typedef enum {
#define OA_OTHERINT 32
#define OA_DANGEROUS 64
#define OA_DEFGV 128
#define OA_OTHERFLOAT 256

/* The next 4 bits (8..11) encode op class information */
#define OCSHIFT 8
/* The next 4 bits (9..12) encode op class information */
#define OCSHIFT 9

#define OA_CLASS_MASK (15 << OCSHIFT)

Expand All @@ -601,9 +602,9 @@ typedef enum {
#define OA_METHOP (14 << OCSHIFT)
#define OA_UNOP_AUX (15 << OCSHIFT)

/* Each remaining nybble of PL_opargs (i.e. bits 12..15, 16..19 etc)
/* Each remaining nybble of PL_opargs (i.e. bits 13..16, 17..20 etc)
* encode the type for each arg */
#define OASHIFT 12
#define OASHIFT 13

#define OA_SCALAR 1
#define OA_LIST 2
Expand Down
Loading