slightly faster 3m allocation for inexacts, rationals, complexes, and non-ASCII chars
svn: r5493
This commit is contained in:
parent
81eb579aae
commit
b0b3fc2e9f
|
@ -165,6 +165,7 @@ GC2_EXTERN void *GC_malloc_atomic(size_t size_in_bytes);
|
||||||
Alloc pointerless memory (not necessarily zeroed). */
|
Alloc pointerless memory (not necessarily zeroed). */
|
||||||
|
|
||||||
#define GC_malloc_atomic_tagged GC_malloc_one_tagged
|
#define GC_malloc_atomic_tagged GC_malloc_one_tagged
|
||||||
|
#define GC_malloc_small_atomic_tagged GC_malloc_one_small_dirty_tagged
|
||||||
/*
|
/*
|
||||||
Alloc pointer-free tagged memory (not necessarily zeroed).
|
Alloc pointer-free tagged memory (not necessarily zeroed).
|
||||||
MzScheme sets the tag before a collection. */
|
MzScheme sets the tag before a collection. */
|
||||||
|
|
|
@ -1504,6 +1504,8 @@ void *scheme_malloc(size_t size);
|
||||||
# endif
|
# endif
|
||||||
# define scheme_malloc_tagged GC_malloc_one_tagged
|
# define scheme_malloc_tagged GC_malloc_one_tagged
|
||||||
# define scheme_malloc_small_tagged(s) GC_malloc_one_small_tagged(gcWORDS_TO_BYTES(gcBYTES_TO_WORDS(s)))
|
# define scheme_malloc_small_tagged(s) GC_malloc_one_small_tagged(gcWORDS_TO_BYTES(gcBYTES_TO_WORDS(s)))
|
||||||
|
# define scheme_malloc_small_dirty_tagged(s) GC_malloc_one_small_dirty_tagged(gcWORDS_TO_BYTES(gcBYTES_TO_WORDS(s)))
|
||||||
|
# define scheme_malloc_small_atomic_tagged(s) GC_malloc_small_atomic_tagged(gcWORDS_TO_BYTES(gcBYTES_TO_WORDS(s)))
|
||||||
# define scheme_malloc_array_tagged GC_malloc_array_tagged
|
# define scheme_malloc_array_tagged GC_malloc_array_tagged
|
||||||
# define scheme_malloc_atomic_tagged GC_malloc_atomic_tagged
|
# define scheme_malloc_atomic_tagged GC_malloc_atomic_tagged
|
||||||
# define scheme_malloc_stubborn_tagged GC_malloc_one_tagged
|
# define scheme_malloc_stubborn_tagged GC_malloc_one_tagged
|
||||||
|
@ -1533,7 +1535,9 @@ extern void *scheme_malloc_envunbox(size_t);
|
||||||
# define scheme_malloc_uncollectable_tagged scheme_malloc_uncollectable
|
# define scheme_malloc_uncollectable_tagged scheme_malloc_uncollectable
|
||||||
# define scheme_malloc_envunbox scheme_malloc
|
# define scheme_malloc_envunbox scheme_malloc
|
||||||
# endif
|
# endif
|
||||||
|
# define scheme_malloc_small_dirty_tagged scheme_malloc_small_tagged
|
||||||
# define scheme_malloc_allow_interior scheme_malloc
|
# define scheme_malloc_allow_interior scheme_malloc
|
||||||
|
# define scheme_malloc_small_atomic_tagged scheme_malloc_atomic_tagged
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,8 @@ Scheme_Object *scheme_make_char(mzchar ch)
|
||||||
if (ch < 256)
|
if (ch < 256)
|
||||||
return scheme_char_constants[ch];
|
return scheme_char_constants[ch];
|
||||||
|
|
||||||
o = scheme_alloc_small_object();
|
o = scheme_malloc_small_atomic_tagged(sizeof(Scheme_Simple_Object));
|
||||||
|
CLEAR_KEY_FIELD(o);
|
||||||
o->type = scheme_char_type;
|
o->type = scheme_char_type;
|
||||||
SCHEME_CHAR_VAL(o) = ch;
|
SCHEME_CHAR_VAL(o) = ch;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,8 @@ static Scheme_Object *make_complex(const Scheme_Object *r, const Scheme_Object *
|
||||||
{
|
{
|
||||||
Scheme_Complex *c;
|
Scheme_Complex *c;
|
||||||
|
|
||||||
c = MALLOC_ONE_TAGGED(Scheme_Complex);
|
c = (Scheme_Complex *)scheme_malloc_small_dirty_tagged(sizeof(Scheme_Complex));
|
||||||
|
CLEAR_KEY_FIELD(&c->so);
|
||||||
c->so.type = scheme_complex_type;
|
c->so.type = scheme_complex_type;
|
||||||
c->r = (Scheme_Object *)r;
|
c->r = (Scheme_Object *)r;
|
||||||
c->i = (Scheme_Object *)i;
|
c->i = (Scheme_Object *)i;
|
||||||
|
|
|
@ -659,7 +659,7 @@ int scheme_is_nan(double d)
|
||||||
|
|
||||||
Scheme_Object *scheme_make_double(double d)
|
Scheme_Object *scheme_make_double(double d)
|
||||||
{
|
{
|
||||||
Scheme_Double *sd;
|
GC_CAN_IGNORE Scheme_Double *sd;
|
||||||
|
|
||||||
if (d == 0.0) {
|
if (d == 0.0) {
|
||||||
if (minus_zero_p(d))
|
if (minus_zero_p(d))
|
||||||
|
@ -672,7 +672,8 @@ Scheme_Object *scheme_make_double(double d)
|
||||||
return scheme_zerod;
|
return scheme_zerod;
|
||||||
}
|
}
|
||||||
|
|
||||||
sd = (Scheme_Double *)scheme_malloc_atomic_tagged(sizeof(Scheme_Double));
|
sd = (Scheme_Double *)scheme_malloc_small_atomic_tagged(sizeof(Scheme_Double));
|
||||||
|
CLEAR_KEY_FIELD(&sd->so);
|
||||||
sd->so.type = scheme_double_type;
|
sd->so.type = scheme_double_type;
|
||||||
SCHEME_DBL_VAL(sd) = d;
|
SCHEME_DBL_VAL(sd) = d;
|
||||||
return (Scheme_Object *)sd;
|
return (Scheme_Object *)sd;
|
||||||
|
|
|
@ -33,8 +33,9 @@ static Scheme_Object *make_rational(const Scheme_Object *n, const Scheme_Object
|
||||||
{
|
{
|
||||||
Scheme_Rational *r;
|
Scheme_Rational *r;
|
||||||
|
|
||||||
r = MALLOC_ONE_TAGGED(Scheme_Rational);
|
r = (Scheme_Rational *)scheme_malloc_small_dirty_tagged(sizeof(Scheme_Rational));
|
||||||
r->so.type = scheme_rational_type;
|
r->so.type = scheme_rational_type;
|
||||||
|
CLEAR_KEY_FIELD(&r->so);
|
||||||
r->num = (Scheme_Object *)n;
|
r->num = (Scheme_Object *)n;
|
||||||
r->denom = (Scheme_Object *)d;
|
r->denom = (Scheme_Object *)d;
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,12 @@ void scheme_clear_ephemerons(void);
|
||||||
# define MZ_INLINE /* empty */
|
# define MZ_INLINE /* empty */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MZ_PRECISE_GC
|
||||||
|
# define CLEAR_KEY_FIELD(o) ((o)->keyex = 0)
|
||||||
|
#else
|
||||||
|
# define CLEAR_KEY_FIELD(o) /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
/*========================================================================*/
|
/*========================================================================*/
|
||||||
/* initialization */
|
/* initialization */
|
||||||
/*========================================================================*/
|
/*========================================================================*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user