check fixnum-literal range before claiming it's always a fixnum

This commit is contained in:
Matthew Flatt 2012-11-15 05:03:26 -07:00
parent 367f47f92d
commit 6ee62ec5ad
3 changed files with 5 additions and 2 deletions

View File

@ -2081,7 +2081,8 @@ int scheme_expr_produces_local_type(Scheme_Object *expr)
default:
if (SCHEME_FLOATP(expr))
return SCHEME_LOCAL_TYPE_FLONUM;
if (SCHEME_INTP(expr))
if (SCHEME_INTP(expr)
&& IN_FIXNUM_RANGE_ON_ALL_PLATFORMS(SCHEME_INT_VAL(expr)))
return SCHEME_LOCAL_TYPE_FIXNUM;
return 0;
}

View File

@ -2175,7 +2175,7 @@ print(Scheme_Object *obj, int notdisplay, int compact, Scheme_Hash_Table *ht,
print_this_string(pp, (char *)s, 0, 1);
} else {
/* Make sure it's a fixnum on all platforms... */
if ((v >= -1073741824) && (v <= 1073741823)) {
if (IN_FIXNUM_RANGE_ON_ALL_PLATFORMS(v)) {
print_compact(pp, CPT_INT);
print_compact_number(pp, v);
} else {

View File

@ -1283,6 +1283,8 @@ typedef struct {
Fixnum unboxing is always fine, since it's easy to box. */
#define ALWAYS_PREFER_UNBOX_TYPE(ty) ((ty) == SCHEME_LOCAL_TYPE_FIXNUM)
#define IN_FIXNUM_RANGE_ON_ALL_PLATFORMS(v) (((v) >= -1073741824) && ((v) <= 1073741823))
typedef struct Scheme_Local {
Scheme_Inclhash_Object iso; /* keyex used for flags and type info (and can't be hashed) */
mzshort position;