mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
more care regarding SCM_PACK and SCM_UNPACK
* libguile/control.c (reify_partial_continuation): * libguile/eval.c (RETURN_BOOT_CLOSURE): * libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x) * libguile/frames.h (SCM_FRAME_SET_RETURN_ADDRESS): (SCM_FRAME_SET_MV_RETURN_ADDRESS, SCM_FRAME_SET_DYNAMIC_LINK): * libguile/goops.c (scm_class_of, scm_primitive_generic_generic) (scm_c_extend_primitive_generic, compute_getters_n_setters) (scm_sys_initialize_object): * libguile/guardians.c (finalize_guarded): * libguile/list.c (SCM_I_CONS): * libguile/macros.c (scm_i_make_primitive_macro) (scm_make_syntax_transformer): * libguile/memoize.c (MAKMEMO, SCM_MAKE_MEMOIZER) (SCM_MAKE_REST_MEMOIZER): * libguile/modules.c (scm_module_reverse_lookup) * libguile/print.c (iprin1): * libguile/promises.c (scm_make_promise) * libguile/srcprop.c (scm_make_srcprops): * libguile/vectors.c (scm_c_vector_ref): * libguile/vm-engine.c (vm_engine) * libguile/vm-i-scheme.c (REL, add1, sub1): * libguile/vm-i-system.c (new_frame, call_cc) * libguile/weaks.h (SCM_WEAK_PAIR_WORD_DELETED_P): Be more careful about SCM_PACK / SCM_UNPACK.
This commit is contained in:
parent
d223c3fcdd
commit
b2b33168b1
18 changed files with 75 additions and 72 deletions
|
@ -163,7 +163,7 @@ reify_partial_continuation (SCM vm, SCM prompt, SCM extwinds,
|
||||||
/* Since non-escape continuations should begin with a thunk application, the
|
/* Since non-escape continuations should begin with a thunk application, the
|
||||||
first bit of the stack should be a frame, with the saved fp equal to the fp
|
first bit of the stack should be a frame, with the saved fp equal to the fp
|
||||||
that was current when the prompt was made. */
|
that was current when the prompt was made. */
|
||||||
if ((SCM*)(SCM_PROMPT_REGISTERS (prompt)->sp[1])
|
if ((SCM*)SCM_UNPACK (SCM_PROMPT_REGISTERS (prompt)->sp[1])
|
||||||
!= SCM_PROMPT_REGISTERS (prompt)->fp)
|
!= SCM_PROMPT_REGISTERS (prompt)->fp)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static scm_t_bits scm_tc16_boot_closure;
|
static scm_t_bits scm_tc16_boot_closure;
|
||||||
#define RETURN_BOOT_CLOSURE(code, env) SCM_RETURN_NEWSMOB2 (scm_tc16_boot_closure, (code), (env))
|
#define RETURN_BOOT_CLOSURE(code, env) \
|
||||||
|
SCM_RETURN_NEWSMOB2 (scm_tc16_boot_closure, SCM_UNPACK (code), SCM_UNPACK (env))
|
||||||
#define BOOT_CLOSURE_P(obj) SCM_TYP16_PREDICATE (scm_tc16_boot_closure, (obj))
|
#define BOOT_CLOSURE_P(obj) SCM_TYP16_PREDICATE (scm_tc16_boot_closure, (obj))
|
||||||
#define BOOT_CLOSURE_CODE(x) SCM_SMOB_OBJECT (x)
|
#define BOOT_CLOSURE_CODE(x) SCM_SMOB_OBJECT (x)
|
||||||
#define BOOT_CLOSURE_ENV(x) SCM_SMOB_OBJECT_2 (x)
|
#define BOOT_CLOSURE_ENV(x) SCM_SMOB_OBJECT_2 (x)
|
||||||
|
|
|
@ -124,7 +124,7 @@ SCM_DEFINE (scm_frame_num_locals, "frame-num-locals", 1, 0, 0,
|
||||||
p = SCM_FRAME_STACK_ADDRESS (SCM_VM_FRAME_FP (frame));
|
p = SCM_FRAME_STACK_ADDRESS (SCM_VM_FRAME_FP (frame));
|
||||||
while (p <= sp)
|
while (p <= sp)
|
||||||
{
|
{
|
||||||
if (p[0] == (SCM)0)
|
if (SCM_UNPACK (p[0]) == 0)
|
||||||
/* skip over not-yet-active frame */
|
/* skip over not-yet-active frame */
|
||||||
p += 3;
|
p += 3;
|
||||||
else
|
else
|
||||||
|
@ -154,7 +154,7 @@ SCM_DEFINE (scm_frame_local_ref, "frame-local-ref", 2, 0, 0,
|
||||||
p = SCM_FRAME_STACK_ADDRESS (SCM_VM_FRAME_FP (frame));
|
p = SCM_FRAME_STACK_ADDRESS (SCM_VM_FRAME_FP (frame));
|
||||||
while (p <= sp)
|
while (p <= sp)
|
||||||
{
|
{
|
||||||
if (p[0] == (SCM)0)
|
if (SCM_UNPACK (p[0]) == 0)
|
||||||
/* skip over not-yet-active frame */
|
/* skip over not-yet-active frame */
|
||||||
p += 3;
|
p += 3;
|
||||||
else if (n == i)
|
else if (n == i)
|
||||||
|
@ -186,7 +186,7 @@ SCM_DEFINE (scm_frame_local_set_x, "frame-local-set!", 3, 0, 0,
|
||||||
p = SCM_FRAME_STACK_ADDRESS (SCM_VM_FRAME_FP (frame));
|
p = SCM_FRAME_STACK_ADDRESS (SCM_VM_FRAME_FP (frame));
|
||||||
while (p <= sp)
|
while (p <= sp)
|
||||||
{
|
{
|
||||||
if (p[0] == (SCM)0)
|
if (SCM_UNPACK (p[0]) == 0)
|
||||||
/* skip over not-yet-active frame */
|
/* skip over not-yet-active frame */
|
||||||
p += 3;
|
p += 3;
|
||||||
else if (n == i)
|
else if (n == i)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
|
/* Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||||
* *
|
* *
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -70,15 +70,15 @@
|
||||||
#define SCM_FRAME_RETURN_ADDRESS(fp) \
|
#define SCM_FRAME_RETURN_ADDRESS(fp) \
|
||||||
(SCM_FRAME_BYTE_CAST (SCM_FRAME_DATA_ADDRESS (fp)[2]))
|
(SCM_FRAME_BYTE_CAST (SCM_FRAME_DATA_ADDRESS (fp)[2]))
|
||||||
#define SCM_FRAME_SET_RETURN_ADDRESS(fp, ra) \
|
#define SCM_FRAME_SET_RETURN_ADDRESS(fp, ra) \
|
||||||
((SCM_FRAME_DATA_ADDRESS (fp)[2])) = (SCM)(ra);
|
((SCM_FRAME_DATA_ADDRESS (fp)[2])) = SCM_PACK (ra)
|
||||||
#define SCM_FRAME_MV_RETURN_ADDRESS(fp) \
|
#define SCM_FRAME_MV_RETURN_ADDRESS(fp) \
|
||||||
(SCM_FRAME_BYTE_CAST (SCM_FRAME_DATA_ADDRESS (fp)[1]))
|
(SCM_FRAME_BYTE_CAST (SCM_FRAME_DATA_ADDRESS (fp)[1]))
|
||||||
#define SCM_FRAME_SET_MV_RETURN_ADDRESS(fp, mvra) \
|
#define SCM_FRAME_SET_MV_RETURN_ADDRESS(fp, mvra) \
|
||||||
((SCM_FRAME_DATA_ADDRESS (fp)[1])) = (SCM)(mvra);
|
((SCM_FRAME_DATA_ADDRESS (fp)[1])) = SCM_PACK (mvra)
|
||||||
#define SCM_FRAME_DYNAMIC_LINK(fp) \
|
#define SCM_FRAME_DYNAMIC_LINK(fp) \
|
||||||
(SCM_FRAME_STACK_CAST (SCM_FRAME_DATA_ADDRESS (fp)[0]))
|
(SCM_FRAME_STACK_CAST (SCM_FRAME_DATA_ADDRESS (fp)[0]))
|
||||||
#define SCM_FRAME_SET_DYNAMIC_LINK(fp, dl) \
|
#define SCM_FRAME_SET_DYNAMIC_LINK(fp, dl) \
|
||||||
((SCM_FRAME_DATA_ADDRESS (fp)[0])) = (SCM)(dl);
|
((SCM_FRAME_DATA_ADDRESS (fp)[0])) = SCM_PACK (dl)
|
||||||
#define SCM_FRAME_VARIABLE(fp,i) SCM_FRAME_STACK_ADDRESS (fp)[i]
|
#define SCM_FRAME_VARIABLE(fp,i) SCM_FRAME_STACK_ADDRESS (fp)[i]
|
||||||
#define SCM_FRAME_PROGRAM(fp) SCM_FRAME_STACK_ADDRESS (fp)[-1]
|
#define SCM_FRAME_PROGRAM(fp) SCM_FRAME_STACK_ADDRESS (fp)[-1]
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,8 @@ SCM_DEFINE (scm_class_of, "class-of", 1, 0, 0,
|
||||||
return scm_class_fraction;
|
return scm_class_fraction;
|
||||||
}
|
}
|
||||||
case scm_tc7_program:
|
case scm_tc7_program:
|
||||||
if (SCM_PROGRAM_IS_PRIMITIVE_GENERIC (x) && *SCM_SUBR_GENERIC (x))
|
if (SCM_PROGRAM_IS_PRIMITIVE_GENERIC (x)
|
||||||
|
&& SCM_UNPACK (*SCM_SUBR_GENERIC (x)))
|
||||||
return scm_class_primitive_generic;
|
return scm_class_primitive_generic;
|
||||||
else
|
else
|
||||||
return scm_class_procedure;
|
return scm_class_procedure;
|
||||||
|
@ -494,8 +495,8 @@ compute_getters_n_setters (SCM slots)
|
||||||
SCM options = SCM_CDAR (slots);
|
SCM options = SCM_CDAR (slots);
|
||||||
if (!scm_is_null (options))
|
if (!scm_is_null (options))
|
||||||
{
|
{
|
||||||
init = scm_get_keyword (k_init_value, options, 0);
|
init = scm_get_keyword (k_init_value, options, SCM_PACK (0));
|
||||||
if (init)
|
if (SCM_UNPACK (init))
|
||||||
{
|
{
|
||||||
init = scm_primitive_eval (scm_list_3 (scm_sym_lambda,
|
init = scm_primitive_eval (scm_list_3 (scm_sym_lambda,
|
||||||
SCM_EOL,
|
SCM_EOL,
|
||||||
|
@ -592,7 +593,7 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0,
|
||||||
get_n_set = SCM_CDR (get_n_set), slots = SCM_CDR (slots))
|
get_n_set = SCM_CDR (get_n_set), slots = SCM_CDR (slots))
|
||||||
{
|
{
|
||||||
SCM slot_name = SCM_CAR (slots);
|
SCM slot_name = SCM_CAR (slots);
|
||||||
SCM slot_value = 0;
|
SCM slot_value = SCM_PACK (0);
|
||||||
|
|
||||||
if (!scm_is_null (SCM_CDR (slot_name)))
|
if (!scm_is_null (SCM_CDR (slot_name)))
|
||||||
{
|
{
|
||||||
|
@ -604,10 +605,10 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0,
|
||||||
tmp = scm_i_get_keyword (k_init_keyword,
|
tmp = scm_i_get_keyword (k_init_keyword,
|
||||||
SCM_CDR (slot_name),
|
SCM_CDR (slot_name),
|
||||||
n,
|
n,
|
||||||
0,
|
SCM_PACK (0),
|
||||||
FUNC_NAME);
|
FUNC_NAME);
|
||||||
slot_name = SCM_CAR (slot_name);
|
slot_name = SCM_CAR (slot_name);
|
||||||
if (tmp)
|
if (SCM_UNPACK (tmp))
|
||||||
{
|
{
|
||||||
/* an initarg was provided for this slot */
|
/* an initarg was provided for this slot */
|
||||||
if (!scm_is_keyword (tmp))
|
if (!scm_is_keyword (tmp))
|
||||||
|
@ -616,12 +617,12 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0,
|
||||||
slot_value = scm_i_get_keyword (tmp,
|
slot_value = scm_i_get_keyword (tmp,
|
||||||
initargs,
|
initargs,
|
||||||
n_initargs,
|
n_initargs,
|
||||||
0,
|
SCM_PACK (0),
|
||||||
FUNC_NAME);
|
FUNC_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slot_value)
|
if (SCM_UNPACK (slot_value))
|
||||||
/* set slot to provided value */
|
/* set slot to provided value */
|
||||||
set_slot_value (class, obj, SCM_CAR (get_n_set), slot_value);
|
set_slot_value (class, obj, SCM_CAR (get_n_set), slot_value);
|
||||||
else
|
else
|
||||||
|
@ -1775,7 +1776,7 @@ SCM_DEFINE (scm_primitive_generic_generic, "primitive-generic-generic", 1, 0, 0,
|
||||||
{
|
{
|
||||||
if (SCM_PRIMITIVE_GENERIC_P (subr))
|
if (SCM_PRIMITIVE_GENERIC_P (subr))
|
||||||
{
|
{
|
||||||
if (!*SCM_SUBR_GENERIC (subr))
|
if (!SCM_UNPACK (*SCM_SUBR_GENERIC (subr)))
|
||||||
scm_enable_primitive_generic_x (scm_list_1 (subr));
|
scm_enable_primitive_generic_x (scm_list_1 (subr));
|
||||||
return *SCM_SUBR_GENERIC (subr);
|
return *SCM_SUBR_GENERIC (subr);
|
||||||
}
|
}
|
||||||
|
@ -1802,7 +1803,7 @@ scm_c_extend_primitive_generic (SCM extended, SCM extension)
|
||||||
if (goops_loaded_p)
|
if (goops_loaded_p)
|
||||||
{
|
{
|
||||||
SCM gf, gext;
|
SCM gf, gext;
|
||||||
if (!*SCM_SUBR_GENERIC (extended))
|
if (!SCM_UNPACK (*SCM_SUBR_GENERIC (extended)))
|
||||||
scm_enable_primitive_generic_x (scm_list_1 (extended));
|
scm_enable_primitive_generic_x (scm_list_1 (extended));
|
||||||
gf = *SCM_SUBR_GENERIC (extended);
|
gf = *SCM_SUBR_GENERIC (extended);
|
||||||
gext = scm_call_2 (SCM_VARIABLE_REF (scm_var_make_extended_generic),
|
gext = scm_call_2 (SCM_VARIABLE_REF (scm_var_make_extended_generic),
|
||||||
|
|
|
@ -151,7 +151,7 @@ finalize_guarded (GC_PTR ptr, GC_PTR finalizer_data)
|
||||||
cell_pool = SCM_CDR (cell_pool);
|
cell_pool = SCM_CDR (cell_pool);
|
||||||
|
|
||||||
/* Compute and update G's zombie list. */
|
/* Compute and update G's zombie list. */
|
||||||
SCM_SETCAR (zombies, SCM_PACK (obj));
|
SCM_SETCAR (zombies, obj);
|
||||||
SCM_SETCDR (zombies, g->zombies);
|
SCM_SETCDR (zombies, g->zombies);
|
||||||
g->zombies = zombies;
|
g->zombies = zombies;
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
|
|
||||||
/* creating lists */
|
/* creating lists */
|
||||||
|
|
||||||
#define SCM_I_CONS(cell, x, y) \
|
#define SCM_I_CONS(cell, x, y) \
|
||||||
do { \
|
do { \
|
||||||
cell = scm_cell ((scm_t_bits)x, (scm_t_bits)y); \
|
cell = scm_cell (SCM_UNPACK (x), SCM_UNPACK (y)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
scm_list_1 (SCM e1)
|
scm_list_1 (SCM e1)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -64,9 +64,9 @@ scm_i_make_primitive_macro (const char *name, scm_t_macro_primitive fn)
|
||||||
{
|
{
|
||||||
SCM z = scm_words (scm_tc16_macro, 5);
|
SCM z = scm_words (scm_tc16_macro, 5);
|
||||||
SCM_SET_SMOB_DATA_N (z, 1, (scm_t_bits)fn);
|
SCM_SET_SMOB_DATA_N (z, 1, (scm_t_bits)fn);
|
||||||
SCM_SET_SMOB_DATA_N (z, 2, scm_from_locale_symbol (name));
|
SCM_SET_SMOB_OBJECT_N (z, 2, scm_from_locale_symbol (name));
|
||||||
SCM_SET_SMOB_DATA_N (z, 3, SCM_BOOL_F);
|
SCM_SET_SMOB_OBJECT_N (z, 3, SCM_BOOL_F);
|
||||||
SCM_SET_SMOB_DATA_N (z, 4, SCM_BOOL_F);
|
SCM_SET_SMOB_OBJECT_N (z, 4, SCM_BOOL_F);
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +104,9 @@ SCM_DEFINE (scm_make_syntax_transformer, "make-syntax-transformer", 3, 0, 0,
|
||||||
|
|
||||||
z = scm_words (scm_tc16_macro, 5);
|
z = scm_words (scm_tc16_macro, 5);
|
||||||
SCM_SET_SMOB_DATA_N (z, 1, prim);
|
SCM_SET_SMOB_DATA_N (z, 1, prim);
|
||||||
SCM_SET_SMOB_DATA_N (z, 2, name);
|
SCM_SET_SMOB_OBJECT_N (z, 2, name);
|
||||||
SCM_SET_SMOB_DATA_N (z, 3, type);
|
SCM_SET_SMOB_OBJECT_N (z, 3, type);
|
||||||
SCM_SET_SMOB_DATA_N (z, 4, binding);
|
SCM_SET_SMOB_OBJECT_N (z, 4, binding);
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
|
@ -64,7 +64,8 @@ SCM_SYMBOL (sym_case_lambda_star, "case-lambda*");
|
||||||
|
|
||||||
scm_t_bits scm_tc16_memoized;
|
scm_t_bits scm_tc16_memoized;
|
||||||
|
|
||||||
#define MAKMEMO(n, args) (scm_cell (scm_tc16_memoized | ((n) << 16), (scm_t_bits)(args)))
|
#define MAKMEMO(n, args) \
|
||||||
|
(scm_cell (scm_tc16_memoized | ((n) << 16), SCM_UNPACK (args)))
|
||||||
|
|
||||||
#define MAKMEMO_BEGIN(exps) \
|
#define MAKMEMO_BEGIN(exps) \
|
||||||
MAKMEMO (SCM_M_BEGIN, exps)
|
MAKMEMO (SCM_M_BEGIN, exps)
|
||||||
|
@ -448,13 +449,13 @@ SCM_DEFINE (scm_memoize_expression, "memoize-expression", 1, 0, 0,
|
||||||
|
|
||||||
#define SCM_MAKE_MEMOIZER(STR, MEMOIZER, N) \
|
#define SCM_MAKE_MEMOIZER(STR, MEMOIZER, N) \
|
||||||
(scm_cell (scm_tc16_memoizer, \
|
(scm_cell (scm_tc16_memoizer, \
|
||||||
(scm_t_bits)(scm_c_make_gsubr (STR, N, 0, 0, MEMOIZER))))
|
SCM_UNPACK (scm_c_make_gsubr (STR, N, 0, 0, MEMOIZER))))
|
||||||
#define SCM_DEFINE_MEMOIZER(STR, MEMOIZER, N) \
|
#define SCM_DEFINE_MEMOIZER(STR, MEMOIZER, N) \
|
||||||
SCM_SNARF_INIT(scm_c_define (STR, SCM_MAKE_MEMOIZER (STR, MEMOIZER, N)))
|
SCM_SNARF_INIT(scm_c_define (STR, SCM_MAKE_MEMOIZER (STR, MEMOIZER, N)))
|
||||||
|
|
||||||
#define SCM_MAKE_REST_MEMOIZER(STR, MEMOIZER, N) \
|
#define SCM_MAKE_REST_MEMOIZER(STR, MEMOIZER, N) \
|
||||||
(scm_cell (scm_tc16_memoizer, \
|
(scm_cell (scm_tc16_memoizer, \
|
||||||
(scm_t_bits)(scm_c_make_gsubr (STR, N, 0, 1, MEMOIZER))))
|
SCM_UNPACK ((scm_c_make_gsubr (STR, N, 0, 1, MEMOIZER)))))
|
||||||
#define SCM_DEFINE_REST_MEMOIZER(STR, MEMOIZER, N) \
|
#define SCM_DEFINE_REST_MEMOIZER(STR, MEMOIZER, N) \
|
||||||
SCM_SNARF_INIT(scm_c_define (STR, SCM_MAKE_REST_MEMOIZER (STR, MEMOIZER, N)))
|
SCM_SNARF_INIT(scm_c_define (STR, SCM_MAKE_REST_MEMOIZER (STR, MEMOIZER, N)))
|
||||||
|
|
||||||
|
|
|
@ -947,7 +947,7 @@ SCM_DEFINE (scm_module_reverse_lookup, "module-reverse-lookup", 2, 0, 0,
|
||||||
{
|
{
|
||||||
handle = SCM_CAR (ls);
|
handle = SCM_CAR (ls);
|
||||||
|
|
||||||
if (SCM_CAR (handle) == SCM_PACK (NULL))
|
if (SCM_UNPACK (SCM_CAR (handle)) == 0)
|
||||||
{
|
{
|
||||||
/* FIXME: We hit a weak pair whose car has become unreachable.
|
/* FIXME: We hit a weak pair whose car has become unreachable.
|
||||||
We should remove the pair in question or something. */
|
We should remove the pair in question or something. */
|
||||||
|
|
|
@ -525,7 +525,7 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate)
|
||||||
if (SCM_OBJ_CLASS_FLAGS (exp) & SCM_CLASSF_GOOPS)
|
if (SCM_OBJ_CLASS_FLAGS (exp) & SCM_CLASSF_GOOPS)
|
||||||
{
|
{
|
||||||
SCM pwps, print = pstate->writingp ? g_write : g_display;
|
SCM pwps, print = pstate->writingp ? g_write : g_display;
|
||||||
if (!print)
|
if (SCM_UNPACK (print) == 0)
|
||||||
goto print_struct;
|
goto print_struct;
|
||||||
pwps = scm_i_port_with_print_state (port, pstate->handle);
|
pwps = scm_i_port_with_print_state (port, pstate->handle);
|
||||||
pstate->revealed = 1;
|
pstate->revealed = 1;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010
|
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
|
@ -80,7 +80,7 @@ SCM_DEFINE (scm_make_promise, "make-promise", 1, 0, 0,
|
||||||
SCM_VALIDATE_THUNK (1, thunk);
|
SCM_VALIDATE_THUNK (1, thunk);
|
||||||
SCM_RETURN_NEWSMOB2 (scm_tc16_promise,
|
SCM_RETURN_NEWSMOB2 (scm_tc16_promise,
|
||||||
SCM_UNPACK (thunk),
|
SCM_UNPACK (thunk),
|
||||||
scm_make_recursive_mutex ());
|
SCM_UNPACK (scm_make_recursive_mutex ()));
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
|
@ -140,8 +140,8 @@ scm_make_srcprops (long line, int col, SCM filename, SCM copy, SCM alist)
|
||||||
|
|
||||||
SCM_RETURN_NEWSMOB3 (scm_tc16_srcprops,
|
SCM_RETURN_NEWSMOB3 (scm_tc16_srcprops,
|
||||||
SRCPROPMAKPOS (line, col),
|
SRCPROPMAKPOS (line, col),
|
||||||
copy,
|
SCM_UNPACK (copy),
|
||||||
alist);
|
SCM_UNPACK (alist));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -213,7 +213,7 @@ scm_c_vector_ref (SCM v, size_t k)
|
||||||
scm_out_of_range (NULL, scm_from_size_t (k));
|
scm_out_of_range (NULL, scm_from_size_t (k));
|
||||||
elt = (SCM_I_VECTOR_ELTS(v))[k];
|
elt = (SCM_I_VECTOR_ELTS(v))[k];
|
||||||
|
|
||||||
if ((elt == SCM_PACK (NULL)) && SCM_I_WVECTP (v))
|
if (SCM_UNPACK (elt) == 0 && SCM_I_WVECTP (v))
|
||||||
/* ELT was a weak pointer and got nullified by the GC. */
|
/* ELT was a weak pointer and got nullified by the GC. */
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ scm_c_vector_ref (SCM v, size_t k)
|
||||||
k = SCM_I_ARRAY_BASE (v) + k*dim->inc;
|
k = SCM_I_ARRAY_BASE (v) + k*dim->inc;
|
||||||
elt = (SCM_I_VECTOR_ELTS (vv))[k];
|
elt = (SCM_I_VECTOR_ELTS (vv))[k];
|
||||||
|
|
||||||
if ((elt == SCM_PACK (NULL)) && (SCM_I_WVECTP (vv)))
|
if (SCM_UNPACK (elt) == 0 && (SCM_I_WVECTP (vv)))
|
||||||
/* ELT was a weak pointer and got nullified by the GC. */
|
/* ELT was a weak pointer and got nullified by the GC. */
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
|
||||||
|
|
|
@ -89,17 +89,17 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
|
||||||
|
|
||||||
/* Initial frame */
|
/* Initial frame */
|
||||||
CACHE_REGISTER ();
|
CACHE_REGISTER ();
|
||||||
PUSH ((SCM)fp); /* dynamic link */
|
PUSH (SCM_PACK (fp)); /* dynamic link */
|
||||||
PUSH (0); /* mvra */
|
PUSH (SCM_PACK (0)); /* mvra */
|
||||||
PUSH ((SCM)ip); /* ra */
|
PUSH (SCM_PACK (ip)); /* ra */
|
||||||
CACHE_PROGRAM ();
|
CACHE_PROGRAM ();
|
||||||
PUSH (program);
|
PUSH (program);
|
||||||
fp = sp + 1;
|
fp = sp + 1;
|
||||||
ip = SCM_C_OBJCODE_BASE (bp);
|
ip = SCM_C_OBJCODE_BASE (bp);
|
||||||
/* MV-call frame, function & arguments */
|
/* MV-call frame, function & arguments */
|
||||||
PUSH (0); /* dynamic link */
|
PUSH (SCM_PACK (0)); /* dynamic link */
|
||||||
PUSH (0); /* mvra */
|
PUSH (SCM_PACK (0)); /* mvra */
|
||||||
PUSH (0); /* ra */
|
PUSH (SCM_PACK (0)); /* ra */
|
||||||
PUSH (prog);
|
PUSH (prog);
|
||||||
if (SCM_UNLIKELY (sp + nargs >= stack_limit))
|
if (SCM_UNLIKELY (sp + nargs >= stack_limit))
|
||||||
goto vm_error_too_many_args;
|
goto vm_error_too_many_args;
|
||||||
|
|
|
@ -168,15 +168,15 @@ VM_DEFINE_INSTRUCTION (144, set_cdr, "set-cdr!", 0, 2, 0)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#undef REL
|
#undef REL
|
||||||
#define REL(crel,srel) \
|
#define REL(crel,srel) \
|
||||||
{ \
|
{ \
|
||||||
ARGS2 (x, y); \
|
ARGS2 (x, y); \
|
||||||
if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) \
|
if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) \
|
||||||
RETURN (scm_from_bool ((scm_t_signed_bits) (x) \
|
RETURN (scm_from_bool (((scm_t_signed_bits) SCM_UNPACK (x)) \
|
||||||
crel (scm_t_signed_bits) (y))); \
|
crel ((scm_t_signed_bits) SCM_UNPACK (y)))); \
|
||||||
SYNC_REGISTER (); \
|
SYNC_REGISTER (); \
|
||||||
RETURN (srel (x, y)); \
|
RETURN (srel (x, y)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_DEFINE_FUNCTION (145, ee, "ee?", 2)
|
VM_DEFINE_FUNCTION (145, ee, "ee?", 2)
|
||||||
{
|
{
|
||||||
|
@ -297,13 +297,13 @@ VM_DEFINE_FUNCTION (151, add1, "add1", 1)
|
||||||
ARGS1 (x);
|
ARGS1 (x);
|
||||||
|
|
||||||
/* Check for overflow. */
|
/* Check for overflow. */
|
||||||
if (SCM_LIKELY ((scm_t_intptr) x < INUM_MAX))
|
if (SCM_LIKELY ((scm_t_intptr) SCM_UNPACK (x) < INUM_MAX))
|
||||||
{
|
{
|
||||||
SCM result;
|
SCM result;
|
||||||
|
|
||||||
/* Add the integers without untagging. */
|
/* Add the integers without untagging. */
|
||||||
result = SCM_PACK ((scm_t_intptr) x
|
result = SCM_PACK ((scm_t_intptr) SCM_UNPACK (x)
|
||||||
+ (scm_t_intptr) SCM_I_MAKINUM (1)
|
+ (scm_t_intptr) SCM_UNPACK (SCM_I_MAKINUM (1))
|
||||||
- scm_tc2_int);
|
- scm_tc2_int);
|
||||||
|
|
||||||
if (SCM_LIKELY (SCM_I_INUMP (result)))
|
if (SCM_LIKELY (SCM_I_INUMP (result)))
|
||||||
|
@ -331,13 +331,13 @@ VM_DEFINE_FUNCTION (153, sub1, "sub1", 1)
|
||||||
ARGS1 (x);
|
ARGS1 (x);
|
||||||
|
|
||||||
/* Check for underflow. */
|
/* Check for underflow. */
|
||||||
if (SCM_LIKELY ((scm_t_intptr) x > INUM_MIN))
|
if (SCM_LIKELY ((scm_t_intptr) SCM_UNPACK (x) > INUM_MIN))
|
||||||
{
|
{
|
||||||
SCM result;
|
SCM result;
|
||||||
|
|
||||||
/* Substract the integers without untagging. */
|
/* Substract the integers without untagging. */
|
||||||
result = SCM_PACK ((scm_t_intptr) x
|
result = SCM_PACK ((scm_t_intptr) SCM_UNPACK (x)
|
||||||
- (scm_t_intptr) SCM_I_MAKINUM (1)
|
- (scm_t_intptr) SCM_UNPACK (SCM_I_MAKINUM (1))
|
||||||
+ scm_tc2_int);
|
+ scm_tc2_int);
|
||||||
|
|
||||||
if (SCM_LIKELY (SCM_I_INUMP (result)))
|
if (SCM_LIKELY (SCM_I_INUMP (result)))
|
||||||
|
|
|
@ -765,9 +765,9 @@ VM_DEFINE_INSTRUCTION (52, new_frame, "new-frame", 0, 0, 3)
|
||||||
know that this frame will point to the current fp: it could be
|
know that this frame will point to the current fp: it could be
|
||||||
placed elsewhere on the stack if captured in a partial
|
placed elsewhere on the stack if captured in a partial
|
||||||
continuation, and invoked from some other context. */
|
continuation, and invoked from some other context. */
|
||||||
PUSH (0); /* dynamic link */
|
PUSH (SCM_PACK (0)); /* dynamic link */
|
||||||
PUSH (0); /* mvra */
|
PUSH (SCM_PACK (0)); /* mvra */
|
||||||
PUSH (0); /* ra */
|
PUSH (SCM_PACK (0)); /* ra */
|
||||||
NEXT;
|
NEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1182,9 +1182,9 @@ VM_DEFINE_INSTRUCTION (65, call_cc, "call/cc", 0, 1, 1)
|
||||||
cont = scm_i_make_continuation (&first, vm, vm_cont);
|
cont = scm_i_make_continuation (&first, vm, vm_cont);
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
PUSH (0); /* dynamic link */
|
PUSH (SCM_PACK (0)); /* dynamic link */
|
||||||
PUSH (0); /* mvra */
|
PUSH (SCM_PACK (0)); /* mvra */
|
||||||
PUSH (0); /* ra */
|
PUSH (SCM_PACK (0)); /* ra */
|
||||||
PUSH (proc);
|
PUSH (proc);
|
||||||
PUSH (cont);
|
PUSH (cont);
|
||||||
nargs = 1;
|
nargs = 1;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef SCM_WEAKS_H
|
#ifndef SCM_WEAKS_H
|
||||||
#define SCM_WEAKS_H
|
#define SCM_WEAKS_H
|
||||||
|
|
||||||
/* Copyright (C) 1995,1996,2000,2001, 2003, 2006, 2008, 2009 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,2000,2001, 2003, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -50,7 +50,7 @@ SCM_INTERNAL SCM scm_doubly_weak_pair (SCM car, SCM cdr);
|
||||||
|
|
||||||
/* Testing the weak component(s) of a cell for reachability. */
|
/* Testing the weak component(s) of a cell for reachability. */
|
||||||
#define SCM_WEAK_PAIR_WORD_DELETED_P(_cell, _word) \
|
#define SCM_WEAK_PAIR_WORD_DELETED_P(_cell, _word) \
|
||||||
(SCM_CELL_OBJECT ((_cell), (_word)) == SCM_PACK (NULL))
|
(SCM_UNPACK (SCM_CELL_OBJECT ((_cell), (_word))) == 0)
|
||||||
#define SCM_WEAK_PAIR_CAR_DELETED_P(_cell) \
|
#define SCM_WEAK_PAIR_CAR_DELETED_P(_cell) \
|
||||||
(SCM_WEAK_PAIR_WORD_DELETED_P ((_cell), 0))
|
(SCM_WEAK_PAIR_WORD_DELETED_P ((_cell), 0))
|
||||||
#define SCM_WEAK_PAIR_CDR_DELETED_P(_cell) \
|
#define SCM_WEAK_PAIR_CDR_DELETED_P(_cell) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue