Branch: Tag:

2007-03-03

2007-03-03 15:26:54 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Increased aggressiveness and robustness of the cast optimizer somewhat.

Rev: src/docode.c:1.189

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: docode.c,v 1.188 2006/10/28 18:16:31 grubba Exp $ + || $Id: docode.c,v 1.189 2007/03/03 15:26:54 grubba Exp $   */      #include "global.h"
1559:    }       case F_CAST: -  if(n->type==void_type_string) -  { +  switch(n->type->type) { +  case T_VOID:    DO_CODE_BLOCK(CAR(n));    return 0; -  } else if (n->type == int_type_string) { +  case T_INT: +  /* FIXME: Integer range? */    tmp1 = do_docode(CAR(n), 0);    if(!tmp1)    emit0(F_CONST0);
1573:    emit0(F_CAST_TO_INT);    }    return 1; -  } else if (n->type == string_type_string) { +  case T_STRING: +  /* FIXME: String width? */    tmp1 = do_docode(CAR(n), 0);    if(!tmp1)    emit0(F_CONST0);
1581:    do_pop(DO_NOT_WARN((INT32)(tmp1-1)));    emit0(F_CAST_TO_STRING);    return 1; -  } else if (compile_type_to_runtime_type(n->type) == PIKE_T_MIXED) { +  default: +  if (compile_type_to_runtime_type(n->type) == PIKE_T_MIXED) {    tmp1 = do_docode(CAR(n), 0);    if(!tmp1)    emit0(F_CONST0);
1589:    do_pop(DO_NOT_WARN((INT32)(tmp1-1)));    return 1;    } +  }    {    struct svalue sv;    sv.type = T_TYPE;