Branch: Tag:

2014-12-04

2014-12-04 19:23:46 by Martin Nilsson <nilsson@opera.com>

Removed auto bignum checks.

11:   #include "global.h"      #undef CJUMP - #undef AUTO_BIGNUM_LOOP_TEST +    #undef LOOP   #undef COMPARISON   #undef MKAPPLY   #undef DO_CALL_BUILTIN    - #undef DO_IF_BIGNUM - #ifdef AUTO_BIGNUM - #define DO_IF_BIGNUM(CODE) CODE - #else /* !AUTO_BIGNUM */ - #define DO_IF_BIGNUM(CODE) - #endif /* AUTO_BIGNUM */ -  +    #undef DO_IF_ELSE_COMPUTED_GOTO   #ifdef HAVE_COMPUTED_GOTO   #define DO_IF_ELSE_COMPUTED_GOTO(A, B) (A)
514:    struct svalue *dst = Pike_fp->locals+arg1;    struct svalue *src = Pike_fp->locals+arg2;    if( (dst->type|src->type) == PIKE_T_INT -  DO_IF_BIGNUM( -  &&(!INT_TYPE_ADD_OVERFLOW(src->u.integer,dst->u.integer)))) +  && !INT_TYPE_ADD_OVERFLOW(src->u.integer,dst->u.integer) )    {    SET_SVAL_SUBTYPE(*dst,NUMBER_NUMBER);    dst->u.integer += src->u.integer;
559:   OPCODE2(F_ADD_LOCAL_INT_AND_POP, "local += number", 0,{    struct svalue *dst = Pike_fp->locals+arg1;    if( dst->type == PIKE_T_INT -  DO_IF_BIGNUM( -  &&(!INT_TYPE_ADD_OVERFLOW(dst->u.integer,arg2)))) +  && !INT_TYPE_ADD_OVERFLOW(dst->u.integer,arg2) )    {    SET_SVAL_SUBTYPE(*dst,NUMBER_NUMBER);    dst->u.integer += arg2;
578:   OPCODE2(F_ADD_LOCAL_INT, "local += number local", 0,{    struct svalue *dst = Pike_fp->locals+arg1;    if( dst->type == PIKE_T_INT -  DO_IF_BIGNUM( -  &&(!INT_TYPE_ADD_OVERFLOW(dst->u.integer,arg2)))) +  && !INT_TYPE_ADD_OVERFLOW(dst->u.integer,arg2) )    {    SET_SVAL_SUBTYPE(*dst,NUMBER_NUMBER);    dst->u.integer += arg2;
598:   OPCODE1(F_INC_LOCAL, "++local", I_UPDATE_SP, {    struct svalue *dst = Pike_fp->locals+arg1;    if( (TYPEOF(*dst) == PIKE_T_INT) -  DO_IF_BIGNUM( -  && (!INT_TYPE_ADD_OVERFLOW(dst->u.integer, 1)) -  ) -  ) +  && !INT_TYPE_ADD_OVERFLOW(dst->u.integer, 1) )    {    push_int(++dst->u.integer);    SET_SVAL_SUBTYPE(*dst, NUMBER_NUMBER); /* Could have UNDEFINED there before. */
617:   OPCODE1(F_POST_INC_LOCAL, "local++", I_UPDATE_SP, {    struct svalue *dst = Pike_fp->locals+arg1;    if( (TYPEOF(*dst) == PIKE_T_INT) -  DO_IF_BIGNUM( -  && (!INT_TYPE_ADD_OVERFLOW(dst->u.integer, 1)) -  ) -  ) +  && !INT_TYPE_ADD_OVERFLOW(dst->u.integer, 1) )    {    push_int( dst->u.integer++ );    SET_SVAL_SUBTYPE(*dst, NUMBER_NUMBER); /* Could have UNDEFINED there before. */
636:   OPCODE1(F_INC_LOCAL_AND_POP, "++local and pop", 0, {    struct svalue *dst = Pike_fp->locals+arg1;    if( (TYPEOF(*dst) == PIKE_T_INT) -  DO_IF_BIGNUM( -  && (!INT_TYPE_ADD_OVERFLOW(dst->u.integer, 1)) -  ) -  ) +  && !INT_TYPE_ADD_OVERFLOW(dst->u.integer, 1) )    {    dst->u.integer++;    SET_SVAL_SUBTYPE(*dst, NUMBER_NUMBER); /* Could have UNDEFINED there before. */
655:   OPCODE1(F_DEC_LOCAL, "--local", I_UPDATE_SP, {    struct svalue *dst = Pike_fp->locals+arg1;    if( (TYPEOF(*dst) == PIKE_T_INT) -  DO_IF_BIGNUM( -  && (!INT_TYPE_SUB_OVERFLOW(dst->u.integer, 1)) -  ) -  ) +  && !INT_TYPE_SUB_OVERFLOW(dst->u.integer, 1) )    {    push_int(--(dst->u.integer));    SET_SVAL_SUBTYPE(*dst, NUMBER_NUMBER); /* Could have UNDEFINED there before. */
675:    push_svalue( Pike_fp->locals + arg1);       if( (TYPEOF(Pike_fp->locals[arg1]) == PIKE_T_INT) -  DO_IF_BIGNUM( -  && (!INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1)) -  ) -  ) +  && !INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1) )    {    Pike_fp->locals[arg1].u.integer--;    SET_SVAL_SUBTYPE(Pike_fp->locals[arg1], NUMBER_NUMBER); /* Could have UNDEFINED there before. */
693:   OPCODE1(F_DEC_LOCAL_AND_POP, "--local and pop", 0, {    struct svalue *dst = Pike_fp->locals+arg1;    if( (TYPEOF(*dst) == PIKE_T_INT) -  DO_IF_BIGNUM( -  && (!INT_TYPE_SUB_OVERFLOW(dst->u.integer, 1)) -  ) -  ) +  && !INT_TYPE_SUB_OVERFLOW(dst->u.integer, 1) )    {    --dst->u.integer;    SET_SVAL_SUBTYPE(*dst, NUMBER_NUMBER); /* Could have UNDEFINED there before. */
826:    if( TYPEOF(Pike_sp[-1]) == PIKE_T_INT &&    TYPEOF(Pike_sp[-2]) == PIKE_T_INT )    { -  DO_IF_BIGNUM( +     if(!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, Pike_sp[-2].u.integer)) -  ) +     {    /* Optimization for a rather common case. Makes it 30% faster. */    INT_TYPE val = (Pike_sp[-1].u.integer += Pike_sp[-2].u.integer);
893:    if( TYPEOF(Pike_sp[-1]) == PIKE_T_INT &&    TYPEOF(Pike_sp[-2]) == PIKE_T_INT )    { -  DO_IF_BIGNUM( +     if(!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, Pike_sp[-2].u.integer)) -  ) +     {    /* Optimization for a rather common case. Makes it 30% faster. */    Pike_sp[-1].u.integer += Pike_sp[-2].u.integer;
955:      OPCODE0(F_INC, "++x", I_UPDATE_SP, {    union anything *u=get_pointer_if_this_type(Pike_sp-2, PIKE_T_INT); -  if(u -  DO_IF_BIGNUM( -  && !INT_TYPE_ADD_OVERFLOW(u->integer, 1) -  ) -  ) +  if(u && !INT_TYPE_ADD_OVERFLOW(u->integer, 1))    {    INT_TYPE val = ++u->integer;    pop_2_elems();
975:      OPCODE0(F_DEC, "--x", I_UPDATE_SP, {    union anything *u=get_pointer_if_this_type(Pike_sp-2, PIKE_T_INT); -  if(u -  DO_IF_BIGNUM( -  && !INT_TYPE_SUB_OVERFLOW(u->integer, 1) -  ) -  ) +  if(u && !INT_TYPE_SUB_OVERFLOW(u->integer, 1))    {    INT_TYPE val = --u->integer;    pop_2_elems();
995:      OPCODE0(F_DEC_AND_POP, "x-- and pop", I_UPDATE_SP, {    union anything *u=get_pointer_if_this_type(Pike_sp-2, PIKE_T_INT); -  if(u -  DO_IF_BIGNUM( -  && !INT_TYPE_SUB_OVERFLOW(u->integer, 1) -  ) - ) +  if(u && !INT_TYPE_SUB_OVERFLOW(u->integer, 1))    {    --u->integer;    pop_2_elems();
1014:      OPCODE0(F_INC_AND_POP, "x++ and pop", I_UPDATE_SP, {    union anything *u=get_pointer_if_this_type(Pike_sp-2, PIKE_T_INT); -  if(u -  DO_IF_BIGNUM( -  && !INT_TYPE_ADD_OVERFLOW(u->integer, 1) -  ) -  ) +  if(u && !INT_TYPE_ADD_OVERFLOW(u->integer, 1))    {    ++u->integer;    pop_2_elems();
1033:      OPCODE0(F_POST_INC, "x++", I_UPDATE_SP, {    union anything *u=get_pointer_if_this_type(Pike_sp-2, PIKE_T_INT); -  if(u -  DO_IF_BIGNUM( -  && !INT_TYPE_ADD_OVERFLOW(u->integer, 1) -  ) -  ) +  if(u && !INT_TYPE_ADD_OVERFLOW(u->integer, 1))    {    INT_TYPE val = u->integer++;    pop_2_elems();
1056:      OPCODE0(F_POST_DEC, "x--", I_UPDATE_SP, {    union anything *u=get_pointer_if_this_type(Pike_sp-2, PIKE_T_INT); -  if(u -  DO_IF_BIGNUM( -  && !INT_TYPE_SUB_OVERFLOW(u->integer, 1) -  ) -  ) +  if(u && !INT_TYPE_SUB_OVERFLOW(u->integer, 1))    {    INT_TYPE val = u->integer--;    pop_2_elems();
1579:   });       - #ifdef AUTO_BIGNUM - #define AUTO_BIGNUM_LOOP_TEST(X,Y) INT_TYPE_ADD_OVERFLOW(X,Y) - #else - #define AUTO_BIGNUM_LOOP_TEST(X,Y) 0 - #endif -  -  /* FIXME: Does this need bignum tests? /Fixed - Hubbe */ +     /* LOOP(OPCODE, INCREMENT, OPERATOR, IS_OPERATOR) */   #define LOOP(ID, DESC, INC, OP2, OP4) \    OPCODE0_BRANCH(ID, DESC, 0, { \    union anything *i=get_pointer_if_this_type(Pike_sp-2, T_INT); \ -  if(i && !AUTO_BIGNUM_LOOP_TEST(i->integer,INC) && \ +  if(i && !INT_TYPE_ADD_OVERFLOW(i->integer,INC) && \    TYPEOF(Pike_sp[-3]) == T_INT) \    { \    i->integer += INC; \
1748:   OPCODE0(F_NEGATE, "unary minus", 0, {    if(TYPEOF(Pike_sp[-1]) == PIKE_T_INT)    { -  DO_IF_BIGNUM( +     if(INT_TYPE_NEG_OVERFLOW(Pike_sp[-1].u.integer))    {    convert_stack_top_to_bignum();    o_negate();    }    else -  ) +     {    Pike_sp[-1].u.integer =- Pike_sp[-1].u.integer;    SET_SVAL_SUBTYPE(Pike_sp[-1], NUMBER_NUMBER); /* Could have UNDEFINED there before. */
1823:   /* Used with F_LTOSVAL*_AND_FREE - must not release interpreter lock. */   OPCODE0(F_ADD_INTS, "int+int", I_UPDATE_SP, {    if(TYPEOF(Pike_sp[-1]) == T_INT && TYPEOF(Pike_sp[-2]) == T_INT -  DO_IF_BIGNUM( -  && (!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, Pike_sp[-2].u.integer)) -  ) -  ) +  && !INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, Pike_sp[-2].u.integer))    {    Pike_sp[-2].u.integer+=Pike_sp[-1].u.integer;    SET_SVAL_SUBTYPE(Pike_sp[-2], NUMBER_NUMBER); /* Could have UNDEFINED there before. */
1860:      OPCODE1(F_ADD_INT, "add integer", 0, {    if(TYPEOF(Pike_sp[-1]) == T_INT -  DO_IF_BIGNUM( -  && (!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, arg1)) -  ) -  ) +  && !INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, arg1))    {    Pike_sp[-1].u.integer+=arg1;    SET_SVAL_SUBTYPE(Pike_sp[-1], NUMBER_NUMBER); /* Could have UNDEFINED there before. */
1875:      OPCODE1(F_ADD_NEG_INT, "add -integer", 0, {    if(TYPEOF(Pike_sp[-1]) == T_INT -  DO_IF_BIGNUM( -  && (!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, -arg1)) -  ) -  ) +  && !INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, -arg1))    {    Pike_sp[-1].u.integer-=arg1;    SET_SVAL_SUBTYPE(Pike_sp[-1], NUMBER_NUMBER); /* Could have UNDEFINED there before. */