Branch: Tag:

2014-06-24

2014-06-24 14:31:50 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Runtime: Unified struct svalue and struct fast_svalue.

Modern gcc (4.7.3) had aliasing problems with the two structs, which
caused changes performed with SET_SVAL() (which used struct fast_svalue)
to not be reflected in TYPEOF() (which used struct svalue). This in turn
caused eg casts of integers to floats to fail with "Cast failed, wanted
float, got int".

The above problem is now solved by having an actual union for the type
fields in struct svalue. This has the additional benefit of forcing
all code to use the svalue macros.

NB: This code change will cause problems with compilers that don't
support union initializers.

494:    LOAD_PIKE_SP();    /* lduh [ %pike_sp, %g0 ], %i0 */    SPARC_LDUH(SPARC_REG_I0, SPARC_REG_PIKE_SP, -  sparc_pike_sp_bias + OFFSETOF(svalue, type), 1); +  sparc_pike_sp_bias + OFFSETOF(svalue, tu.t.type), 1);    /* subcc %g0, %i0, 8 */    SPARC_SUBcc(SPARC_REG_G0, SPARC_REG_I0, PIKE_T_INT, 1);    /* be,a .+8 */    SPARC_BE(8, 1);    /* sth %g0, [ %pike_sp, 2 ] */    SPARC_STH(SPARC_REG_G0, SPARC_REG_PIKE_SP, -  sparc_pike_sp_bias + OFFSETOF(svalue, subtype), 1); +  sparc_pike_sp_bias + OFFSETOF(svalue, tu.t.subtype), 1);   }      static void sparc_push_lfun(unsigned int no)