avoid clang warnings

The main change is to use C99 flexible array declarations
in structs, instead of declaring single-element arrays.
There are still a few -Wtautological-compare warnings
in 3m due to marco expansion.
This commit is contained in:
Matthew Flatt 2011-09-09 20:45:43 -06:00
parent 9c5b78e998
commit 446fb89af1
27 changed files with 188 additions and 199 deletions

View File

@ -1192,7 +1192,18 @@
(set! line (+ line 3))))]
[(threadlocal-decl? v) (void)]
[(seq? v)
(display/indent v (tok-n v))
(define skip-parens?
;; avoid `if ((...))' when "..." is not an assignment,
;; because that annoys compilers like clang
(and prev (tok? prev) (memq (tok-n prev) '(if))
(let ([l (seq->list (seq-in v))])
(and (pair? l)
(null? (cdr l))
(parens? (car l))
(let ([l (seq->list (seq-in (car l)))])
(not (ormap (lambda (i) (eq? '= (tok-n i)))
l)))))))
(display/indent v (if skip-parens? "" (tok-n v)))
(let ([subindent (if (braces? v)
(begin
(newline/indent (+ indent 2))
@ -1214,7 +1225,8 @@
(set! sysheader? s?))
(when (and next-indent (= next-indent subindent))
(set! next-indent indent)))
(display/indent #f (seq-close v))
(unless skip-parens?
(display/indent #f (seq-close v)))
(cond
[(braces? v)
(newline/indent indent)
@ -1574,7 +1586,7 @@
(begin
(when pgc?
(unless (eq? (tok-n (car e)) 'static)
(let-values ([(pointers non-pointers) (get-vars e "TOPVAR" #f)])
(let-values ([(pointers non-pointers) (get-vars e "TOPVAR" #f #t)])
(top-vars (append pointers non-pointers (top-vars))))))
e))]
@ -1824,7 +1836,7 @@
(let ([e (append (prototype-type proto)
(list (make-tok name #f #f)
(make-tok semi #f #f)))])
(let ([vars (get-pointer-vars e "PROTODEF" #f)])
(let ([vars (get-pointer-vars e "PROTODEF" #f #t)])
(set-prototype-pointer?! proto (not (null? vars)))
(set-prototype-pointer?-determined?! proto #t))))
(prototype-pointer? proto)))
@ -1845,7 +1857,7 @@
cddr
cdr)
e)
"PTRDEF" #t)]
"PTRDEF" #t #t)]
;; Remove things like HANDLE and HWND, which are not
;; malloced and could overlap with GCed areas:
[(pointers non-pointers)
@ -1861,10 +1873,10 @@
(set! pointer-types (append pointers pointer-types))
(set! non-pointer-types (append (map car non-pointers) non-pointer-types))))
;; get-vars : tok-list str bool -> (values list-of-(cons sym vtype) list-of-(cons sym vtype))
;; get-vars : tok-list str bool bool -> (values list-of-(cons sym vtype) list-of-(cons sym vtype))
;; Parses a declaration of one line (which may have multiple, comma-separated variables).
;; Returns a list of pointer declarations and a list of non-pointer declarations.
(define (get-vars e comment union-ok?)
(define (get-vars e comment union-ok? empty-array-is-ptr?)
(let* ([e (if (or (eq? GC_CAN_IGNORE (tok-n (car e)))
(eq? 'XFORM_CAN_IGNORE (tok-n (car e))))
(list (make-tok semi #f #f)) ; drop everything
@ -1915,7 +1927,9 @@
(loop (sub1 l)
(let ([inner (seq->list (seq-in (list-ref e l)))])
(if (null? inner)
(if empty-array-is-ptr?
'pointer
0)
(tok-n (car inner))))
pointers non-pointers)]
[(braces? v)
@ -2028,9 +2042,9 @@
(make-non-pointer-type non-ptr-base))
non-pointers)))))]))))))))
(define (get-pointer-vars e comment union-ok?)
(define (get-pointer-vars e comment union-ok? empty-array-is-ptr?)
(let-values ([(pointers non-pointers)
(get-vars e comment union-ok?)])
(get-vars e comment union-ok? empty-array-is-ptr?)])
pointers))
(define (get-pointer-vars-from-seq body comment comma-sep?)
@ -2038,7 +2052,7 @@
(apply
append
(map (lambda (e)
(get-pointer-vars e comment #t))
(get-pointer-vars e comment #t #f))
el))))
;; e is a struct decl; parse it an remember the results
@ -2338,7 +2352,7 @@
(let loop ([l arg-decls][arg-vars null][all-arg-vars null])
(if (null? l)
(values arg-vars all-arg-vars)
(let-values ([(ptrs non-ptrs) (get-vars (car l) "PTRARG" #f)])
(let-values ([(ptrs non-ptrs) (get-vars (car l) "PTRARG" #f #t)])
(loop (cdr l) (append arg-vars ptrs) (append all-arg-vars ptrs non-ptrs))))))]
[(c++-class) (let ([c++-class (find-c++-class class-name #t)])
(and c++-class
@ -2484,7 +2498,7 @@
(let-values ([(pragmas el) (body->lines body-e #f)])
(let-values ([(decls body) (split-decls el)])
(for-each (lambda (e)
(let-values ([(pointers non-pointers) (get-vars e "CVTLOCAL" #f)])
(let-values ([(pointers non-pointers) (get-vars e "CVTLOCAL" #f #t)])
(for-each
(lambda (var)
(when (get-c++-class-var (car var) c++-class)
@ -2733,7 +2747,7 @@
(map (lambda (e)
(if (eq? (tok-n (car e)) 'static)
null
(get-pointer-vars e "PTRLOCAL" #f)))
(get-pointer-vars e "PTRLOCAL" #f #t)))
decls))]
[vars (begin
(ormap (lambda (var)

View File

@ -120,6 +120,19 @@ typedef long FILE;
# define MZ_SIGSET(s, f) sigset(s, f)
#endif
/* C99 allows an array in a struct to be declared
with [] to indicate that its actual size can be
any number. The old way was to declare the array
of size 1. For now, we support going back to the
old way. */
#ifdef MZ_USE_OLD_ARRAY_STYLE
# define mzFLEX_ARRAY_DECL 1
# define mzFLEX_DELTA 1
#else
# define mzFLEX_ARRAY_DECL /* empty */
# define mzFLEX_DELTA 0
#endif
#ifdef MZ_XFORM
# define XFORM_NONGCING __xform_nongcing__
#else
@ -305,7 +318,7 @@ typedef struct Scheme_Symbol {
typedef struct Scheme_Vector {
Scheme_Inclhash_Object iso; /* 1 in low bit of keyex indicates immutable */
intptr_t size;
Scheme_Object *els[1];
Scheme_Object *els[mzFLEX_ARRAY_DECL];
} Scheme_Vector;
# define SHARED_ALLOCATED 0x2
@ -315,7 +328,7 @@ typedef struct Scheme_Vector {
typedef struct Scheme_Double_Vector {
Scheme_Inclhash_Object iso; /* & 0x2 indicates allocated in the MASTERGC */
intptr_t size;
double els[1];
double els[mzFLEX_ARRAY_DECL];
} Scheme_Double_Vector;
typedef struct Scheme_Print_Params Scheme_Print_Params;
@ -698,7 +711,7 @@ typedef struct Scheme_Primitive_Closure {
#ifdef MZ_PRECISE_GC
mzshort count;
#endif
Scheme_Object *val[1];
Scheme_Object *val[mzFLEX_ARRAY_DECL];
} Scheme_Primitive_Closure;
#define SCHEME_PRIM_CLOSURE_ELS(p) ((Scheme_Primitive_Closure *)p)->val

View File

@ -1456,7 +1456,7 @@ Scheme_Object *scheme_unclose_case_lambda(Scheme_Object *expr, int mode)
Scheme_Case_Lambda *cl2;
cl2 = (Scheme_Case_Lambda *)scheme_malloc_tagged(sizeof(Scheme_Case_Lambda)
+ ((cl->count - 1) * sizeof(Scheme_Object*)));
+ ((cl->count - mzFLEX_DELTA) * sizeof(Scheme_Object*)));
cl2->so.type = scheme_case_lambda_sequence_type;
cl2->count = cl->count;
@ -1517,7 +1517,7 @@ case_lambda_syntax (Scheme_Object *form, Scheme_Comp_Env *env,
if (SCHEME_STX_NULLP(form)) {
/* Case where there are no cases... */
form = (Scheme_Object *)scheme_malloc_tagged(sizeof(Scheme_Case_Lambda)
- sizeof(Scheme_Object*));
- (mzFLEX_DELTA * sizeof(Scheme_Object*)));
form->type = scheme_case_lambda_sequence_type;
((Scheme_Case_Lambda *)form)->count = 0;
@ -1581,7 +1581,7 @@ case_lambda_syntax (Scheme_Object *form, Scheme_Comp_Env *env,
cl = (Scheme_Case_Lambda *)
scheme_malloc_tagged(sizeof(Scheme_Case_Lambda)
+ (count - 1) * sizeof(Scheme_Object *));
+ (count - mzFLEX_DELTA) * sizeof(Scheme_Object *));
cl->so.type = scheme_case_lambda_sequence_type;
cl->count = count;
cl->name = SCHEME_TRUEP(name) ? name : NULL;
@ -2859,7 +2859,7 @@ begin0_syntax (Scheme_Object *form, Scheme_Comp_Env *env, Scheme_Compile_Info *r
Scheme_Sequence *scheme_malloc_sequence(int count)
{
return (Scheme_Sequence *)scheme_malloc_tagged(sizeof(Scheme_Sequence)
+ (count - 1)
+ (count - mzFLEX_DELTA)
* sizeof(Scheme_Object *));
}
@ -4097,7 +4097,7 @@ Scheme_App_Rec *scheme_malloc_application(int n)
int size;
size = (sizeof(Scheme_App_Rec)
+ ((n - 1) * sizeof(Scheme_Object *))
+ ((n - mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ n * sizeof(char));
app = (Scheme_App_Rec *)scheme_malloc_tagged(size);
@ -4114,7 +4114,7 @@ void scheme_finish_application(Scheme_App_Rec *app)
n = app->num_args + 1;
devals = sizeof(Scheme_App_Rec) + (app->num_args * sizeof(Scheme_Object *));
devals = sizeof(Scheme_App_Rec) + ((app->num_args + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object *));
for (i = 0; i < n; i++) {
char etype;

View File

@ -1926,7 +1926,7 @@ scheme_case_lambda_execute(Scheme_Object *expr)
seqout = (Scheme_Case_Lambda *)
scheme_malloc_tagged(sizeof(Scheme_Case_Lambda)
+ (seqin->count - 1) * sizeof(Scheme_Object *));
+ (seqin->count - mzFLEX_DELTA) * sizeof(Scheme_Object *));
seqout->so.type = scheme_case_closure_type;
seqout->count = seqin->count;
seqout->name = seqin->name;
@ -2169,7 +2169,7 @@ scheme_make_closure(Scheme_Thread *p, Scheme_Object *code, int close)
closure = (Scheme_Closure *)
scheme_malloc_tagged(sizeof(Scheme_Closure)
+ (i - 1) * sizeof(Scheme_Object *));
+ (i - mzFLEX_DELTA) * sizeof(Scheme_Object *));
closure->so.type = scheme_closure_type;
SCHEME_COMPILED_CLOS_CODE(closure) = data;
@ -2193,7 +2193,7 @@ Scheme_Closure *scheme_malloc_empty_closure()
{
Scheme_Closure *cl;
cl = (Scheme_Closure *)scheme_malloc_tagged(sizeof(Scheme_Closure) - sizeof(Scheme_Object *));
cl = (Scheme_Closure *)scheme_malloc_tagged(sizeof(Scheme_Closure) - (mzFLEX_DELTA * sizeof(Scheme_Object *)));
cl->so.type = scheme_closure_type;
return cl;
@ -2916,7 +2916,8 @@ scheme_do_eval(Scheme_Object *obj, int num_rands, Scheme_Object **rands,
app = (Scheme_App_Rec *)obj;
num_rands = app->num_args;
d_evals = sizeof(Scheme_App_Rec) + (num_rands * sizeof(Scheme_Object *));
d_evals = (sizeof(Scheme_App_Rec)
+ ((num_rands + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
#ifndef MZ_XFORM
evals = ((char *)obj) + d_evals;
#endif
@ -5256,7 +5257,7 @@ Scheme_Object **scheme_push_prefix(Scheme_Env *genv, Resolve_Prefix *rp,
tl_map_len = ((rp->num_toplevels + rp->num_lifts) + 31) / 32;
pf = scheme_malloc_tagged(sizeof(Scheme_Prefix)
+ ((i-1) * sizeof(Scheme_Object *))
+ ((i-mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ (tl_map_len * sizeof(int)));
pf->so.type = scheme_prefix_type;
pf->num_slots = i;

View File

@ -656,7 +656,7 @@ make_prim_closure(Scheme_Prim *fun, int eternal,
? sizeof(Scheme_Prim_W_Result_Arity)
: (closed
? (sizeof(Scheme_Primitive_Closure)
+ ((count - 1) * sizeof(Scheme_Object *)))
+ ((count - mzFLEX_DELTA) * sizeof(Scheme_Object *)))
: sizeof(Scheme_Primitive_Proc)));
if (eternal && scheme_starting_up && !closed)

View File

@ -78,7 +78,7 @@ static MZ_INLINE Scheme_Object *do_make_native_closure(Scheme_Native_Closure_Dat
Scheme_Native_Closure *o;
o = (Scheme_Native_Closure *)scheme_malloc_tagged(sizeof(Scheme_Native_Closure)
+ ((size - 1) * sizeof(Scheme_Object *)));
+ ((size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
o->so.type = scheme_native_closure_type;
o->code = code;
@ -1123,7 +1123,7 @@ static int generate_closure(Scheme_Closure_Data *data,
int sz;
intptr_t init_word;
sz = (sizeof(Scheme_Native_Closure)
+ ((data->closure_size - 1) * sizeof(Scheme_Object *)));
+ ((data->closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
# ifdef CAN_INLINE_ALLOC
if (immediately_filled) {
/* Inlined alloc */

View File

@ -3373,7 +3373,9 @@ static int generate_vector_alloc(mz_jit_state *jitter, Scheme_Object *rator,
/* Inlined alloc */
if (app2)
(void)jit_movi_p(JIT_R1, NULL); /* needed because R1 is marked during a GC */
scheme_inline_alloc(jitter, sizeof(Scheme_Vector) + ((c - 1) * sizeof(Scheme_Object*)), scheme_vector_type,
scheme_inline_alloc(jitter,
sizeof(Scheme_Vector) + ((c - mzFLEX_DELTA) * sizeof(Scheme_Object*)),
scheme_vector_type,
imm, app2 || app3, 0, 0);
CHECK_LIMIT();

View File

@ -57,7 +57,7 @@ static Scheme_Object *jit_application(Scheme_Object *o)
return o;
size = (sizeof(Scheme_App_Rec)
+ ((n - 1) * sizeof(Scheme_Object *))
+ ((n - mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ n * sizeof(char));
app2 = (Scheme_App_Rec *)scheme_malloc_tagged(size);
memcpy(app2, app, size);
@ -139,7 +139,7 @@ static Scheme_Object *jit_sequence(Scheme_Object *o)
return o;
size = (sizeof(Scheme_Sequence)
+ ((n - 1) * sizeof(Scheme_Object *)));
+ ((n - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
seq2 = (Scheme_Sequence *)scheme_malloc_tagged(size);
memcpy(seq2, seq, size);
seq2->array[i] = naya;
@ -364,7 +364,7 @@ Scheme_Object *scheme_case_lambda_jit(Scheme_Object *expr)
cnt = seqin->count;
size = sizeof(Scheme_Case_Lambda) + ((cnt - 1) * sizeof(Scheme_Object *));
size = sizeof(Scheme_Case_Lambda) + ((cnt - mzFLEX_DELTA) * sizeof(Scheme_Object *));
seqout = (Scheme_Case_Lambda *)scheme_malloc_tagged(size);
memcpy(seqout, seqin, size);
@ -461,7 +461,7 @@ static Scheme_Object *begin0_jit(Scheme_Object *data)
return data;
seq2 = (Scheme_Sequence *)scheme_malloc_tagged(sizeof(Scheme_Sequence)
+ (count - 1)
+ (count - mzFLEX_DELTA)
* sizeof(Scheme_Object *));
seq2->so.type = scheme_begin0_sequence_type;
seq2->count = count;

View File

@ -343,7 +343,7 @@ static Scheme_Object *read_case_lambda(Scheme_Object *obj)
cl = (Scheme_Case_Lambda *)
scheme_malloc_tagged(sizeof(Scheme_Case_Lambda)
+ (count - 1) * sizeof(Scheme_Object *));
+ (count - mzFLEX_DELTA) * sizeof(Scheme_Object *));
cl->so.type = scheme_case_lambda_sequence_type;
cl->count = count;

View File

@ -10,7 +10,7 @@ static int native_closure_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Native_Closure)
+ (closure_size - 1) * sizeof(Scheme_Object *)));
+ (closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
static int native_closure_MARK(void *p, struct NewGC *gc) {
@ -39,7 +39,7 @@ static int native_closure_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Native_Closure)
+ (closure_size - 1) * sizeof(Scheme_Object *)));
+ (closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
static int native_closure_FIXUP(void *p, struct NewGC *gc) {
@ -63,7 +63,7 @@ static int native_closure_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Native_Closure)
+ (closure_size - 1) * sizeof(Scheme_Object *)));
+ (closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
#define native_closure_IS_ATOMIC 0

View File

@ -4,7 +4,7 @@ static int mark_listener_SIZE(void *p, struct NewGC *gc) {
listener_t *l = (listener_t *)p;
return
gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - 1) * sizeof(tcp_t)));
gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - mzFLEX_DELTA) * sizeof(tcp_t)));
}
static int mark_listener_MARK(void *p, struct NewGC *gc) {
@ -14,7 +14,7 @@ static int mark_listener_MARK(void *p, struct NewGC *gc) {
gcMARK2(l->mref, gc);
return
gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - 1) * sizeof(tcp_t)));
gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - mzFLEX_DELTA) * sizeof(tcp_t)));
}
static int mark_listener_FIXUP(void *p, struct NewGC *gc) {
@ -24,7 +24,7 @@ static int mark_listener_FIXUP(void *p, struct NewGC *gc) {
gcFIXUP2(l->mref, gc);
return
gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - 1) * sizeof(tcp_t)));
gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - mzFLEX_DELTA) * sizeof(tcp_t)));
}
#define mark_listener_IS_ATOMIC 0

View File

@ -7,7 +7,7 @@ static int mark_serialized_struct_val_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Serialized_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *))));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int mark_serialized_struct_val_MARK(void *p, struct NewGC *gc) {
@ -23,7 +23,7 @@ static int mark_serialized_struct_val_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Serialized_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *))));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int mark_serialized_struct_val_FIXUP(void *p, struct NewGC *gc) {
@ -39,7 +39,7 @@ static int mark_serialized_struct_val_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Serialized_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *))));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
#define mark_serialized_struct_val_IS_ATOMIC 0
@ -53,7 +53,7 @@ static int mark_struct_val_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *))));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int mark_struct_val_MARK(void *p, struct NewGC *gc) {
@ -69,7 +69,7 @@ static int mark_struct_val_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *))));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int mark_struct_val_FIXUP(void *p, struct NewGC *gc) {
@ -85,7 +85,7 @@ static int mark_struct_val_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *))));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
#define mark_struct_val_IS_ATOMIC 0
@ -97,7 +97,8 @@ static int mark_struct_type_val_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Struct_Type)
+ (t->name_pos * sizeof(Scheme_Struct_Type *))));
+ ((t->name_pos + 1 - mzFLEX_DELTA)
* sizeof(Scheme_Struct_Type *))));
}
static int mark_struct_type_val_MARK(void *p, struct NewGC *gc) {
@ -120,7 +121,8 @@ static int mark_struct_type_val_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Struct_Type)
+ (t->name_pos * sizeof(Scheme_Struct_Type *))));
+ ((t->name_pos + 1 - mzFLEX_DELTA)
* sizeof(Scheme_Struct_Type *))));
}
static int mark_struct_type_val_FIXUP(void *p, struct NewGC *gc) {
@ -143,7 +145,8 @@ static int mark_struct_type_val_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Struct_Type)
+ (t->name_pos * sizeof(Scheme_Struct_Type *))));
+ ((t->name_pos + 1 - mzFLEX_DELTA)
* sizeof(Scheme_Struct_Type *))));
}
#define mark_struct_type_val_IS_ATOMIC 0

View File

@ -98,7 +98,7 @@ static int mark_srcloc_FIXUP(void *p, struct NewGC *gc) {
static int mark_wrapchunk_SIZE(void *p, struct NewGC *gc) {
Wrap_Chunk *wc = (Wrap_Chunk *)p;
return
gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - 1) * sizeof(Scheme_Object *)));
gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
static int mark_wrapchunk_MARK(void *p, struct NewGC *gc) {
@ -108,7 +108,7 @@ static int mark_wrapchunk_MARK(void *p, struct NewGC *gc) {
gcMARK2(wc->a[i], gc);
}
return
gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - 1) * sizeof(Scheme_Object *)));
gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
static int mark_wrapchunk_FIXUP(void *p, struct NewGC *gc) {
@ -118,7 +118,7 @@ static int mark_wrapchunk_FIXUP(void *p, struct NewGC *gc) {
gcFIXUP2(wc->a[i], gc);
}
return
gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - 1) * sizeof(Scheme_Object *)));
gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
#define mark_wrapchunk_IS_ATOMIC 0
@ -156,37 +156,3 @@ static int lex_rib_FIXUP(void *p, struct NewGC *gc) {
#define lex_rib_IS_CONST_SIZE 1
static int mark_free_id_info_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((8 - 1) * sizeof(Scheme_Object *))));
}
static int mark_free_id_info_MARK(void *p, struct NewGC *gc) {
Scheme_Vector *vec = (Scheme_Vector *)p;
int i;
for (i = 8; i--; )
gcMARK2(vec->els[i], gc);
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((8 - 1) * sizeof(Scheme_Object *))));
}
static int mark_free_id_info_FIXUP(void *p, struct NewGC *gc) {
Scheme_Vector *vec = (Scheme_Vector *)p;
int i;
for (i = 8; i--; )
gcFIXUP2(vec->els[i], gc);
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((8 - 1) * sizeof(Scheme_Object *))));
}
#define mark_free_id_info_IS_ATOMIC 0
#define mark_free_id_info_IS_CONST_SIZE 0

View File

@ -3,7 +3,7 @@
static int mark_parameterization_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Parameterization)
+ ((max_configs - 1) * sizeof(Scheme_Object*))));
+ ((max_configs - mzFLEX_DELTA) * sizeof(Scheme_Object*))));
}
static int mark_parameterization_MARK(void *p, struct NewGC *gc) {
@ -17,7 +17,7 @@ static int mark_parameterization_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Parameterization)
+ ((max_configs - 1) * sizeof(Scheme_Object*))));
+ ((max_configs - mzFLEX_DELTA) * sizeof(Scheme_Object*))));
}
static int mark_parameterization_FIXUP(void *p, struct NewGC *gc) {
@ -31,7 +31,7 @@ static int mark_parameterization_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Parameterization)
+ ((max_configs - 1) * sizeof(Scheme_Object*))));
+ ((max_configs - mzFLEX_DELTA) * sizeof(Scheme_Object*))));
}
#define mark_parameterization_IS_ATOMIC 0

View File

@ -253,7 +253,7 @@ static int app_rec_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_App_Rec)
+ (r->num_args * sizeof(Scheme_Object *))
+ ((r->num_args + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ ((r->num_args + 1) * sizeof(char))));
}
@ -266,7 +266,7 @@ static int app_rec_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_App_Rec)
+ (r->num_args * sizeof(Scheme_Object *))
+ ((r->num_args + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ ((r->num_args + 1) * sizeof(char))));
}
@ -279,7 +279,7 @@ static int app_rec_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_App_Rec)
+ (r->num_args * sizeof(Scheme_Object *))
+ ((r->num_args + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ ((r->num_args + 1) * sizeof(char))));
}
@ -348,7 +348,7 @@ static int seq_rec_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Sequence)
+ ((s->count - 1) * sizeof(Scheme_Object *))));
+ ((s->count - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int seq_rec_MARK(void *p, struct NewGC *gc) {
@ -360,7 +360,7 @@ static int seq_rec_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Sequence)
+ ((s->count - 1) * sizeof(Scheme_Object *))));
+ ((s->count - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int seq_rec_FIXUP(void *p, struct NewGC *gc) {
@ -372,7 +372,7 @@ static int seq_rec_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Sequence)
+ ((s->count - 1) * sizeof(Scheme_Object *))));
+ ((s->count - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
#define seq_rec_IS_ATOMIC 0
@ -689,7 +689,7 @@ static int prim_proc_SIZE(void *p, struct NewGC *gc) {
return
((prim->pp.flags & SCHEME_PRIM_IS_CLOSURE)
? (gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Closure))
+ ((Scheme_Primitive_Closure *)prim)->count - 1)
+ ((Scheme_Primitive_Closure *)prim)->count - mzFLEX_DELTA)
: ((prim->pp.flags & SCHEME_PRIM_IS_MULTI_RESULT)
? gcBYTES_TO_WORDS(sizeof(Scheme_Prim_W_Result_Arity))
: gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Proc))));
@ -713,7 +713,7 @@ static int prim_proc_MARK(void *p, struct NewGC *gc) {
return
((prim->pp.flags & SCHEME_PRIM_IS_CLOSURE)
? (gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Closure))
+ ((Scheme_Primitive_Closure *)prim)->count - 1)
+ ((Scheme_Primitive_Closure *)prim)->count - mzFLEX_DELTA)
: ((prim->pp.flags & SCHEME_PRIM_IS_MULTI_RESULT)
? gcBYTES_TO_WORDS(sizeof(Scheme_Prim_W_Result_Arity))
: gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Proc))));
@ -737,7 +737,7 @@ static int prim_proc_FIXUP(void *p, struct NewGC *gc) {
return
((prim->pp.flags & SCHEME_PRIM_IS_CLOSURE)
? (gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Closure))
+ ((Scheme_Primitive_Closure *)prim)->count - 1)
+ ((Scheme_Primitive_Closure *)prim)->count - mzFLEX_DELTA)
: ((prim->pp.flags & SCHEME_PRIM_IS_MULTI_RESULT)
? gcBYTES_TO_WORDS(sizeof(Scheme_Prim_W_Result_Arity))
: gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Proc))));
@ -804,7 +804,7 @@ static int scm_closure_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Closure)
+ (closure_size - 1) * sizeof(Scheme_Object *)));
+ (closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
static int scm_closure_MARK(void *p, struct NewGC *gc) {
@ -830,7 +830,7 @@ static int scm_closure_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Closure)
+ (closure_size - 1) * sizeof(Scheme_Object *)));
+ (closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
static int scm_closure_FIXUP(void *p, struct NewGC *gc) {
@ -851,7 +851,7 @@ static int scm_closure_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Closure)
+ (closure_size - 1) * sizeof(Scheme_Object *)));
+ (closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
#define scm_closure_IS_ATOMIC 0
@ -863,7 +863,7 @@ static int case_closure_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Case_Lambda)
+ ((c->count - 1) * sizeof(Scheme_Object *))));
+ ((c->count - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int case_closure_MARK(void *p, struct NewGC *gc) {
@ -880,7 +880,7 @@ static int case_closure_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Case_Lambda)
+ ((c->count - 1) * sizeof(Scheme_Object *))));
+ ((c->count - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int case_closure_FIXUP(void *p, struct NewGC *gc) {
@ -897,7 +897,7 @@ static int case_closure_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Case_Lambda)
+ ((c->count - 1) * sizeof(Scheme_Object *))));
+ ((c->count - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
#define case_closure_IS_ATOMIC 0
@ -1443,7 +1443,7 @@ static int vector_obj_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((vec->size - 1) * sizeof(Scheme_Object *))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int vector_obj_MARK(void *p, struct NewGC *gc) {
@ -1455,7 +1455,7 @@ static int vector_obj_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((vec->size - 1) * sizeof(Scheme_Object *))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int vector_obj_FIXUP(void *p, struct NewGC *gc) {
@ -1467,7 +1467,7 @@ static int vector_obj_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((vec->size - 1) * sizeof(Scheme_Object *))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
#define vector_obj_IS_ATOMIC 0
@ -1479,7 +1479,7 @@ static int fxvector_obj_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((vec->size - 1) * sizeof(Scheme_Object *))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int fxvector_obj_MARK(void *p, struct NewGC *gc) {
@ -1487,7 +1487,7 @@ static int fxvector_obj_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((vec->size - 1) * sizeof(Scheme_Object *))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
static int fxvector_obj_FIXUP(void *p, struct NewGC *gc) {
@ -1495,7 +1495,7 @@ static int fxvector_obj_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((vec->size - 1) * sizeof(Scheme_Object *))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
#define fxvector_obj_IS_ATOMIC 1
@ -1507,7 +1507,7 @@ static int flvector_obj_SIZE(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Double_Vector)
+ ((vec->size - 1) * sizeof(double))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(double))));
}
static int flvector_obj_MARK(void *p, struct NewGC *gc) {
@ -1515,7 +1515,7 @@ static int flvector_obj_MARK(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Double_Vector)
+ ((vec->size - 1) * sizeof(double))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(double))));
}
static int flvector_obj_FIXUP(void *p, struct NewGC *gc) {
@ -1523,7 +1523,7 @@ static int flvector_obj_FIXUP(void *p, struct NewGC *gc) {
return
gcBYTES_TO_WORDS((sizeof(Scheme_Double_Vector)
+ ((vec->size - 1) * sizeof(double))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(double))));
}
#define flvector_obj_IS_ATOMIC 1
@ -2313,7 +2313,7 @@ static int prefix_val_SIZE(void *p, struct NewGC *gc) {
Scheme_Prefix *pf = (Scheme_Prefix *)p;
return
gcBYTES_TO_WORDS((sizeof(Scheme_Prefix)
+ ((pf->num_slots-1) * sizeof(Scheme_Object *))
+ ((pf->num_slots-mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ ((((pf->num_slots - (pf->num_stxes ? (pf->num_stxes+1) : 0)) + 31) / 32)
* sizeof(int))));
}
@ -2325,7 +2325,7 @@ static int prefix_val_MARK(void *p, struct NewGC *gc) {
gcMARK2(pf->a[i], gc);
return
gcBYTES_TO_WORDS((sizeof(Scheme_Prefix)
+ ((pf->num_slots-1) * sizeof(Scheme_Object *))
+ ((pf->num_slots-mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ ((((pf->num_slots - (pf->num_stxes ? (pf->num_stxes+1) : 0)) + 31) / 32)
* sizeof(int))));
}
@ -2337,7 +2337,7 @@ static int prefix_val_FIXUP(void *p, struct NewGC *gc) {
gcFIXUP2(pf->a[i], gc);
return
gcBYTES_TO_WORDS((sizeof(Scheme_Prefix)
+ ((pf->num_slots-1) * sizeof(Scheme_Object *))
+ ((pf->num_slots-mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ ((((pf->num_slots - (pf->num_stxes ? (pf->num_stxes+1) : 0)) + 31) / 32)
* sizeof(int))));
}

View File

@ -99,7 +99,7 @@ app_rec {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_App_Rec)
+ (r->num_args * sizeof(Scheme_Object *))
+ ((r->num_args + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ ((r->num_args + 1) * sizeof(char))));
}
@ -134,7 +134,7 @@ seq_rec {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Sequence)
+ ((s->count - 1) * sizeof(Scheme_Object *))));
+ ((s->count - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
branch_rec {
@ -273,7 +273,7 @@ prim_proc {
size:
((prim->pp.flags & SCHEME_PRIM_IS_CLOSURE)
? (gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Closure))
+ ((Scheme_Primitive_Closure *)prim)->count - 1)
+ ((Scheme_Primitive_Closure *)prim)->count - mzFLEX_DELTA)
: ((prim->pp.flags & SCHEME_PRIM_IS_MULTI_RESULT)
? gcBYTES_TO_WORDS(sizeof(Scheme_Prim_W_Result_Arity))
: gcBYTES_TO_WORDS(sizeof(Scheme_Primitive_Proc))));
@ -327,7 +327,7 @@ scm_closure {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Closure)
+ (closure_size - 1) * sizeof(Scheme_Object *)));
+ (closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
case_closure {
@ -345,7 +345,7 @@ case_closure {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Case_Lambda)
+ ((c->count - 1) * sizeof(Scheme_Object *))));
+ ((c->count - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
cont_proc {
@ -564,7 +564,7 @@ vector_obj {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((vec->size - 1) * sizeof(Scheme_Object *))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
fxvector_obj {
@ -573,7 +573,7 @@ fxvector_obj {
mark:
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((vec->size - 1) * sizeof(Scheme_Object *))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
flvector_obj {
@ -582,7 +582,7 @@ flvector_obj {
mark:
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Double_Vector)
+ ((vec->size - 1) * sizeof(double))));
+ ((vec->size - mzFLEX_DELTA) * sizeof(double))));
}
input_port {
@ -935,7 +935,7 @@ prefix_val {
gcMARK2(pf->a[i], gc);
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Prefix)
+ ((pf->num_slots-1) * sizeof(Scheme_Object *))
+ ((pf->num_slots-mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ ((((pf->num_slots - (pf->num_stxes ? (pf->num_stxes+1) : 0)) + 31) / 32)
* sizeof(int))));
}
@ -1700,7 +1700,7 @@ mark_listener {
gcMARK2(l->mref, gc);
size:
gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - 1) * sizeof(tcp_t)));
gcBYTES_TO_WORDS(sizeof(listener_t) + ((l->count - mzFLEX_DELTA) * sizeof(tcp_t)));
}
#ifdef USE_TCP
@ -1759,7 +1759,7 @@ mark_parameterization {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Parameterization)
+ ((max_configs - 1) * sizeof(Scheme_Object*))));
+ ((max_configs - mzFLEX_DELTA) * sizeof(Scheme_Object*))));
}
mark_config {
@ -1991,7 +1991,7 @@ mark_serialized_struct_val {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Serialized_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *))));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
#endif
@ -2009,7 +2009,7 @@ mark_struct_val {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *))));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *))));
}
mark_struct_type_val {
@ -2033,7 +2033,8 @@ mark_struct_type_val {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Struct_Type)
+ (t->name_pos * sizeof(Scheme_Struct_Type *))));
+ ((t->name_pos + 1 - mzFLEX_DELTA)
* sizeof(Scheme_Struct_Type *))));
}
mark_struct_proc_info {
@ -2282,7 +2283,7 @@ mark_wrapchunk {
gcMARK2(wc->a[i], gc);
}
size:
gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - 1) * sizeof(Scheme_Object *)));
gcBYTES_TO_WORDS(sizeof(Wrap_Chunk) + ((wc->len - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
lex_rib {
@ -2297,20 +2298,6 @@ lex_rib {
gcBYTES_TO_WORDS(sizeof(Scheme_Lexical_Rib));
}
mark_free_id_info {
mark:
Scheme_Vector *vec = (Scheme_Vector *)p;
int i;
for (i = 8; i--; )
gcMARK2(vec->els[i], gc);
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Vector)
+ ((8 - 1) * sizeof(Scheme_Object *))));
}
END syntax;
/**********************************************************************/
@ -2350,7 +2337,7 @@ native_closure {
size:
gcBYTES_TO_WORDS((sizeof(Scheme_Native_Closure)
+ (closure_size - 1) * sizeof(Scheme_Object *)));
+ (closure_size - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
}
mark_jit_state {

View File

@ -120,7 +120,7 @@ typedef struct {
Scheme_Object so;
Scheme_Custodian_Reference *mref;
int count;
tcp_t s[1];
tcp_t s[mzFLEX_ARRAY_DECL];
} listener_t;
#endif
@ -1935,7 +1935,7 @@ tcp_listen(int argc, Scheme_Object *argv[])
if (!listen(s, backlog)) {
if (!pos) {
l = scheme_malloc_tagged(sizeof(listener_t) + ((count - 1) * sizeof(tcp_t)));
l = scheme_malloc_tagged(sizeof(listener_t) + ((count - mzFLEX_DELTA) * sizeof(tcp_t)));
l->so.type = scheme_listener_type;
l->count = count;
{

View File

@ -2609,6 +2609,8 @@ scheme_expt(int argc, Scheme_Object *argv[])
if ((d == 0.0)
#ifdef NAN_EQUALS_ANYTHING
&& !MZ_IS_NAN(d)
#else
&& 1
#endif
) {
if (SCHEME_REALP(e)) {
@ -3331,7 +3333,7 @@ Scheme_Double_Vector *scheme_alloc_flvector(intptr_t size)
vec = (Scheme_Double_Vector *)scheme_malloc_fail_ok(scheme_malloc_atomic_tagged,
sizeof(Scheme_Double_Vector)
+ ((size - 1) * sizeof(double)));
+ ((size - mzFLEX_DELTA) * sizeof(double)));
vec->iso.so.type = scheme_flvector_type;
vec->size = size;
@ -3515,7 +3517,7 @@ Scheme_Vector *scheme_alloc_fxvector(intptr_t size)
vec = (Scheme_Vector *)scheme_malloc_fail_ok(scheme_malloc_atomic_tagged,
sizeof(Scheme_Vector)
+ ((size - 1) * sizeof(Scheme_Object*)));
+ ((size - mzFLEX_DELTA) * sizeof(Scheme_Object*)));
vec->iso.so.type = scheme_fxvector_type;
vec->size = size;

View File

@ -253,12 +253,12 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved,
return 1;
}
if ((vtype == scheme_compiled_quote_syntax_type)) {
if (vtype == scheme_compiled_quote_syntax_type) {
note_match(1, vals, warn_info);
return ((vals == 1) || (vals < 0));
}
if ((vtype == scheme_branch_type)) {
if (vtype == scheme_branch_type) {
Scheme_Branch_Rec *b;
b = (Scheme_Branch_Rec *)o;
return (scheme_omittable_expr(b->test, 1, fuel - 1, resolved, warn_info, deeper_than)
@ -269,20 +269,20 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved,
#if 0
/* We can't do this because a set! to a lexical is turned into
a let_value_type! */
if ((vtype == scheme_let_value_type)) {
if (vtype == scheme_let_value_type) {
Scheme_Let_Value *lv = (Scheme_Let_Value *)o;
return (scheme_omittable_expr(lv->value, lv->count, fuel - 1, resolved, warn_info, deeper_than)
&& scheme_omittable_expr(lv->body, vals, fuel - 1, resolved, warn_info, deeper_than));
}
#endif
if ((vtype == scheme_let_one_type)) {
if (vtype == scheme_let_one_type) {
Scheme_Let_One *lo = (Scheme_Let_One *)o;
return (scheme_omittable_expr(lo->value, 1, fuel - 1, resolved, warn_info, deeper_than + 1)
&& scheme_omittable_expr(lo->body, vals, fuel - 1, resolved, warn_info, deeper_than + 1));
}
if ((vtype == scheme_let_void_type)) {
if (vtype == scheme_let_void_type) {
Scheme_Let_Void *lv = (Scheme_Let_Void *)o;
/* recognize (letrec ([x <omittable>]) ...): */
if (SAME_TYPE(SCHEME_TYPE(lv->body), scheme_let_value_type)) {
@ -301,7 +301,7 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved,
goto try_again;
}
if ((vtype == scheme_compiled_let_void_type)) {
if (vtype == scheme_compiled_let_void_type) {
/* recognize another (let ([x <omittable>]) ...) pattern: */
Scheme_Let_Header *lh = (Scheme_Let_Header *)o;
if ((lh->count == 1) && (lh->num_clauses == 1)) {
@ -316,12 +316,12 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved,
}
}
if ((vtype == scheme_letrec_type)) {
if (vtype == scheme_letrec_type) {
o = ((Scheme_Letrec *)o)->body;
goto try_again;
}
if ((vtype == scheme_application_type)) {
if (vtype == scheme_application_type) {
/* Look for multiple values, or for `make-struct-type'.
(The latter is especially useful to Honu.) */
Scheme_App_Rec *app = (Scheme_App_Rec *)o;
@ -402,7 +402,7 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved,
return 0;
}
if ((vtype == scheme_application2_type)) {
if (vtype == scheme_application2_type) {
/* ({values,void,list,list*,vector,vector-immutable,box} <omittable>) */
Scheme_App2_Rec *app = (Scheme_App2_Rec *)o;
if (SAME_OBJ(scheme_values_func, app->rator)
@ -433,7 +433,7 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved,
return 0;
}
if ((vtype == scheme_application3_type)) {
if (vtype == scheme_application3_type) {
/* (values <omittable> <omittable>) */
Scheme_App3_Rec *app = (Scheme_App3_Rec *)o;
if (SAME_OBJ(scheme_values_func, app->rator)) {
@ -2942,7 +2942,7 @@ case_lambda_clone(int dup_ok, Scheme_Object *data, Optimize_Info *info, int delt
Scheme_Case_Lambda *seq = (Scheme_Case_Lambda *)data;
Scheme_Case_Lambda *seq2;
sz = sizeof(Scheme_Case_Lambda) + ((seq->count - 1) * sizeof(Scheme_Object*));
sz = sizeof(Scheme_Case_Lambda) + ((seq->count - mzFLEX_DELTA) * sizeof(Scheme_Object*));
seq2 = (Scheme_Case_Lambda *)scheme_malloc_tagged(sz);
memcpy(seq2, seq, sz);

View File

@ -204,7 +204,7 @@ static Scheme_Object *resolve_application(Scheme_Object *o, Resolve_Info *orig_i
}
}
devals = sizeof(Scheme_App_Rec) + ((n - 1) * sizeof(Scheme_Object *));
devals = sizeof(Scheme_App_Rec) + ((n - mzFLEX_DELTA) * sizeof(Scheme_Object *));
info = resolve_info_extend(orig_info, n - 1, 0, 0);

View File

@ -1732,7 +1732,7 @@ void count_tagged(void *p, int size, void *data)
cnt = NUM_RECORDED_APP_SIZES;
} else {
int i, devals, kind;
devals = sizeof(Scheme_App_Rec) + (app->num_args * sizeof(Scheme_Object *));
devals = sizeof(Scheme_App_Rec) + ((app->num_args + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object *));
for (i = 0; i <= cnt; i++) {
kind = ((char *)app + devals)[i];
if ((kind >= 0) && (kind <= 4)) {
@ -2724,7 +2724,7 @@ intptr_t scheme_count_memory(Scheme_Object *root, Scheme_Hash_Table *ht)
Scheme_App_Rec *app = (Scheme_App_Rec *)root;
int i;
s = sizeof(Scheme_App_Rec) + (app->num_args * sizeof(Scheme_Object *))
s = sizeof(Scheme_App_Rec) + ((app->num_args + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object *))
+ (app->num_args + 1);
need_align = 1;
#if FORCE_KNOWN_SUBPARTS
@ -2742,7 +2742,7 @@ intptr_t scheme_count_memory(Scheme_Object *root, Scheme_Hash_Table *ht)
Scheme_Sequence *seq = (Scheme_Sequence *)root;
int i;
s = sizeof(Scheme_Sequence) + (seq->count - 1) * sizeof(Scheme_Object *);
s = sizeof(Scheme_Sequence) + (seq->count - mzFLEX_DELTA) * sizeof(Scheme_Object *);
#if FORCE_KNOWN_SUBPARTS
for (i = e = 0; i < seq->count; i++) {
@ -3008,7 +3008,7 @@ intptr_t scheme_count_memory(Scheme_Object *root, Scheme_Hash_Table *ht)
Scheme_Object **slots = ((Scheme_Structure *)root)->slots;
int i, count = SCHEME_STRUCT_NUM_SLOTS(root);
s = sizeof(Scheme_Structure) + (count - 1) * sizeof(Scheme_Object *);
s = sizeof(Scheme_Structure) + (count - mzFLEX_DELTA) * sizeof(Scheme_Object *);
#if FORCE_KNOWN_SUBPARTS
for (i = e = 0; i < count; i++) {
e += COUNT(slots[i]);
@ -3024,7 +3024,7 @@ intptr_t scheme_count_memory(Scheme_Object *root, Scheme_Hash_Table *ht)
if (count < 0)
count = -count;
s = sizeof(Small_Bignum) + (count - 1) * sizeof(bigdig);
s = sizeof(Scheme_Bignum) + (count * sizeof(bigdig));
}
break;
case scheme_escaping_cont_type:
@ -3076,7 +3076,7 @@ intptr_t scheme_count_memory(Scheme_Object *root, Scheme_Hash_Table *ht)
case scheme_struct_type_type:
{
Scheme_Struct_Type *st = (Scheme_Struct_Type *)root;
s = sizeof(Scheme_Struct_Type) + st->name_pos * sizeof(Scheme_Object*);
s = sizeof(Scheme_Struct_Type) + (st->name_pos + 1 - mzFLEX_DELTA) * sizeof(Scheme_Object*);
#if FORCE_KNOWN_SUBPARTS
e = COUNT(st->name);
if (st->name_pos)

View File

@ -618,7 +618,7 @@ THREAD_LOCAL_DECL(extern int scheme_main_was_once_suspended);
typedef struct {
MZTAG_IF_REQUIRED
Scheme_Bucket_Table *extensions;
Scheme_Object *prims[1];
Scheme_Object *prims[mzFLEX_ARRAY_DECL];
} Scheme_Parameterization;
struct Scheme_Config {
@ -730,7 +730,7 @@ typedef struct Scheme_Struct_Type {
Scheme_Object *guard;
struct Scheme_Struct_Type *parent_types[1];
struct Scheme_Struct_Type *parent_types[mzFLEX_ARRAY_DECL];
} Scheme_Struct_Type;
#define STRUCT_TYPE_ALL_IMMUTABLE 0x1
@ -740,7 +740,7 @@ typedef struct Scheme_Structure
{
Scheme_Object so;
Scheme_Struct_Type *stype;
Scheme_Object *slots[1];
Scheme_Object *slots[mzFLEX_ARRAY_DECL];
} Scheme_Structure;
#ifdef MZ_USE_PLACES
@ -749,7 +749,7 @@ typedef struct Scheme_Serialized_Structure
Scheme_Object so;
Scheme_Object *prefab_key;
int num_slots;
Scheme_Object *slots[1];
Scheme_Object *slots[mzFLEX_ARRAY_DECL];
} Scheme_Serialized_Structure;
#endif
@ -1095,7 +1095,7 @@ Scheme_Object *scheme_transfer_srcloc(Scheme_Object *to, Scheme_Object *from);
typedef struct {
Scheme_Object so;
mzshort num_args; /* doesn't include rator, so arguments are at args[1]...args[num_args] */
Scheme_Object *args[1];
Scheme_Object *args[mzFLEX_ARRAY_DECL];
/* After array of f & args, array of chars for eval type */
} Scheme_App_Rec;
@ -1296,7 +1296,7 @@ typedef struct Scheme_Letrec {
typedef struct {
Scheme_Object so;
mzshort count;
Scheme_Object *array[1];
Scheme_Object *array[mzFLEX_ARRAY_DECL];
} Scheme_Sequence;
typedef struct {
@ -1306,7 +1306,7 @@ typedef struct {
#ifdef MZ_USE_JIT
struct Scheme_Native_Closure_Data *native_code; /* generated by lightning */
#endif
Scheme_Object *array[1];
Scheme_Object *array[mzFLEX_ARRAY_DECL];
} Scheme_Case_Lambda;
/* If count is not 0, then check array[0] for CLOS_IS_METHOD.
Otherwise, name is a boxed symbol (or #f) to indicate a method. */
@ -2048,12 +2048,12 @@ typedef struct Scheme_Prefix
Scheme_Object so; /* scheme_prefix_type */
int num_slots, num_toplevels, num_stxes;
struct Scheme_Prefix *next_final; /* for special GC handling */
Scheme_Object *a[1]; /* array of objects */
Scheme_Object *a[mzFLEX_ARRAY_DECL]; /* array of objects */
/* followed by an array of `int's for tl_map uses */
} Scheme_Prefix;
#define PREFIX_TO_USE_BITS(pf) \
(int *)((char *)pf + sizeof(Scheme_Prefix) + ((pf->num_slots - 1) * sizeof(Scheme_Object *)))
(int *)((char *)pf + sizeof(Scheme_Prefix) + ((pf->num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *)))
#define LOAD_ON_DEMAND
void scheme_clear_delayed_load_cache();
@ -2291,7 +2291,7 @@ int scheme_has_method_property(Scheme_Object *code);
typedef struct {
Scheme_Object so;
Scheme_Closure_Data *code;
Scheme_Object *vals[1];
Scheme_Object *vals[mzFLEX_ARRAY_DECL];
} Scheme_Closure;
#define SCHEME_COMPILED_CLOS_CODE(c) ((Scheme_Closure *)c)->code
@ -2329,7 +2329,7 @@ typedef struct Scheme_Native_Closure_Data {
typedef struct {
Scheme_Object so;
Scheme_Native_Closure_Data *code;
Scheme_Object *vals[1];
Scheme_Object *vals[mzFLEX_ARRAY_DECL];
} Scheme_Native_Closure;
Scheme_Native_Closure_Data *scheme_generate_lambda(Scheme_Closure_Data *obj, int drop_code,

View File

@ -2087,7 +2087,7 @@ scheme_make_struct_instance(Scheme_Object *_stype, int argc, Scheme_Object **arg
c = stype->num_slots;
inst = (Scheme_Structure *)
scheme_malloc_tagged(sizeof(Scheme_Structure)
+ ((c - 1) * sizeof(Scheme_Object *)));
+ ((c - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
inst->so.type = (stype->proc_attr ? scheme_proc_struct_type : scheme_structure_type);
inst->stype = stype;
@ -2132,7 +2132,7 @@ Scheme_Object *scheme_make_blank_prefab_struct_instance(Scheme_Struct_Type *styp
c = stype->num_slots;
inst = (Scheme_Structure *)
scheme_malloc_tagged(sizeof(Scheme_Structure)
+ ((c - 1) * sizeof(Scheme_Object *)));
+ ((c - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
inst->so.type = scheme_structure_type;
inst->stype = stype;
@ -2147,7 +2147,7 @@ Scheme_Object *scheme_make_serialized_struct_instance(Scheme_Object *prefab_key,
inst = (Scheme_Serialized_Structure *)
scheme_malloc_tagged(sizeof(Scheme_Serialized_Structure)
+ ((num_slots - 1) * sizeof(Scheme_Object *)));
+ ((num_slots - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
inst->so.type = scheme_serialized_structure_type;
inst->num_slots = num_slots;
@ -2166,7 +2166,7 @@ Scheme_Object *scheme_make_prefab_struct_instance(Scheme_Struct_Type *stype,
c = stype->num_slots;
inst = (Scheme_Structure *)
scheme_malloc_tagged(sizeof(Scheme_Structure)
+ ((c - 1) * sizeof(Scheme_Object *)));
+ ((c - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
inst->so.type = scheme_structure_type;
inst->stype = stype;
@ -2192,7 +2192,7 @@ Scheme_Object *scheme_clone_prefab_struct_instance(Scheme_Structure *s)
c = s->stype->num_slots;
sz = (sizeof(Scheme_Structure)
+ ((c - 1) * sizeof(Scheme_Object *)));
+ ((c - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
inst = (Scheme_Structure *)scheme_malloc_tagged(sz);
memcpy(inst, s, sz);
@ -2223,7 +2223,7 @@ make_simple_struct_instance(int argc, Scheme_Object **args, Scheme_Object *prim)
c = stype->num_slots;
inst = (Scheme_Structure *)
scheme_malloc_tagged(sizeof(Scheme_Structure)
+ ((c - 1) * sizeof(Scheme_Object *)));
+ ((c - mzFLEX_DELTA) * sizeof(Scheme_Object *)));
inst->so.type = scheme_structure_type;
inst->stype = stype;
@ -4022,7 +4022,7 @@ Scheme_Struct_Type *scheme_make_prefab_struct_type_raw(Scheme_Object *base,
parent_type = (Scheme_Struct_Type *)parent;
depth = parent_type ? (1 + parent_type->name_pos) : 0;
struct_type = (Scheme_Struct_Type *)scheme_malloc_tagged(sizeof(Scheme_Struct_Type)
+ (depth
+ ((depth + 1 - mzFLEX_DELTA)
* sizeof(Scheme_Struct_Type *)));
struct_type->iso.so.type = scheme_struct_type_type;
@ -4086,7 +4086,7 @@ static Scheme_Object *_make_struct_type(Scheme_Object *base,
depth = parent_type ? (1 + parent_type->name_pos) : 0;
struct_type = (Scheme_Struct_Type *)scheme_malloc_tagged(sizeof(Scheme_Struct_Type)
+ (depth
+ ((depth + 1 - mzFLEX_DELTA)
* sizeof(Scheme_Struct_Type *)));
/* defeats optimizer bug in gcc 2.7.2.3: */

View File

@ -298,10 +298,10 @@ XFORM_NONGCING static int nom_mod_p(Scheme_Object *p)
typedef struct {
Scheme_Type type;
mzshort len;
Scheme_Object *a[1];
Scheme_Object *a[mzFLEX_ARRAY_DECL];
} Wrap_Chunk;
#define MALLOC_WRAP_CHUNK(n) (Wrap_Chunk *)scheme_malloc_tagged(sizeof(Wrap_Chunk) + ((n - 1) * sizeof(Scheme_Object *)))
#define MALLOC_WRAP_CHUNK(n) (Wrap_Chunk *)scheme_malloc_tagged(sizeof(Wrap_Chunk) + ((n - mzFLEX_DELTA) * sizeof(Scheme_Object *)))
/* Macros for iterating over the elements of a wrap. */
@ -4087,10 +4087,11 @@ static Scheme_Object *resolve_env(Scheme_Object *a, Scheme_Object *orig_phase,
WRAP_POS w2;
WRAP_POS_INIT(w2, ((Scheme_Stx *)renamed)->wraps);
same = same_marks(&w2, &wraps, other_env);
if (!same)
if (!same) {
EXPLAIN(fprintf(stderr, "%d Different marks\n", depth));
}
}
}
if (same) {
/* If it turns out that we're going to return
@ -8526,7 +8527,6 @@ static void register_traversers(void)
GC_REG_TRAV(scheme_rt_srcloc, mark_srcloc);
GC_REG_TRAV(scheme_wrap_chunk_type, mark_wrapchunk);
GC_REG_TRAV(scheme_lexical_rib_type, lex_rib);
GC_REG_TRAV(scheme_free_id_info_type, mark_free_id_info);
}
END_XFORM_SKIP;

View File

@ -6304,7 +6304,7 @@ void scheme_set_param(Scheme_Config *c, int pos, Scheme_Object *o)
static Scheme_Parameterization *malloc_paramz()
{
return (Scheme_Parameterization *)scheme_malloc_tagged(sizeof(Scheme_Parameterization) +
(max_configs - 1) * sizeof(Scheme_Object*));
(max_configs - mzFLEX_DELTA) * sizeof(Scheme_Object*));
}
void scheme_flatten_config(Scheme_Config *orig_c)
@ -6583,8 +6583,7 @@ static void make_initial_config(Scheme_Thread *p)
cells = scheme_make_bucket_table(5, SCHEME_hash_weak_ptr);
p->cell_values = cells;
paramz = (Scheme_Parameterization *)scheme_malloc_tagged(sizeof(Scheme_Parameterization) +
(max_configs - 1) * sizeof(Scheme_Object*));
paramz = malloc_paramz();
#ifdef MZTAG_REQUIRED
paramz->type = scheme_rt_parameterization;
#endif

View File

@ -687,6 +687,8 @@ void scheme_register_traversers(void)
GC_REG_TRAV(scheme_rt_runstack, runstack_val);
GC_REG_TRAV(scheme_free_id_info_type, vector_obj);
GC_REG_TRAV(scheme_rib_delimiter_type, small_object);
GC_REG_TRAV(scheme_noninline_proc_type, small_object);
GC_REG_TRAV(scheme_prune_context_type, small_object);

View File

@ -239,8 +239,8 @@ scheme_init_unsafe_vector (Scheme_Env *env)
scheme_add_global_constant("unsafe-bytes-set!", p, env);
}
#define VECTOR_BYTES(size) (sizeof(Scheme_Vector) + ((size) - 1) * sizeof(Scheme_Object *))
#define REV_VECTOR_BYTES(size) (((size) - (sizeof(Scheme_Vector) - sizeof(Scheme_Object *))) / sizeof(Scheme_Object *))
#define VECTOR_BYTES(size) (sizeof(Scheme_Vector) + ((size) - mzFLEX_DELTA) * sizeof(Scheme_Object *))
#define REV_VECTOR_BYTES(size) (((size) - (sizeof(Scheme_Vector) - (mzFLEX_DELTA * sizeof(Scheme_Object *)))) / sizeof(Scheme_Object *))
Scheme_Object *
scheme_make_vector (intptr_t size, Scheme_Object *fill)