mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 04:40:29 +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
|
@ -168,15 +168,15 @@ VM_DEFINE_INSTRUCTION (144, set_cdr, "set-cdr!", 0, 2, 0)
|
|||
*/
|
||||
|
||||
#undef REL
|
||||
#define REL(crel,srel) \
|
||||
{ \
|
||||
ARGS2 (x, y); \
|
||||
if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) \
|
||||
RETURN (scm_from_bool ((scm_t_signed_bits) (x) \
|
||||
crel (scm_t_signed_bits) (y))); \
|
||||
SYNC_REGISTER (); \
|
||||
RETURN (srel (x, y)); \
|
||||
}
|
||||
#define REL(crel,srel) \
|
||||
{ \
|
||||
ARGS2 (x, y); \
|
||||
if (SCM_I_INUMP (x) && SCM_I_INUMP (y)) \
|
||||
RETURN (scm_from_bool (((scm_t_signed_bits) SCM_UNPACK (x)) \
|
||||
crel ((scm_t_signed_bits) SCM_UNPACK (y)))); \
|
||||
SYNC_REGISTER (); \
|
||||
RETURN (srel (x, y)); \
|
||||
}
|
||||
|
||||
VM_DEFINE_FUNCTION (145, ee, "ee?", 2)
|
||||
{
|
||||
|
@ -297,13 +297,13 @@ VM_DEFINE_FUNCTION (151, add1, "add1", 1)
|
|||
ARGS1 (x);
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Add the integers without untagging. */
|
||||
result = SCM_PACK ((scm_t_intptr) x
|
||||
+ (scm_t_intptr) SCM_I_MAKINUM (1)
|
||||
result = SCM_PACK ((scm_t_intptr) SCM_UNPACK (x)
|
||||
+ (scm_t_intptr) SCM_UNPACK (SCM_I_MAKINUM (1))
|
||||
- scm_tc2_int);
|
||||
|
||||
if (SCM_LIKELY (SCM_I_INUMP (result)))
|
||||
|
@ -331,13 +331,13 @@ VM_DEFINE_FUNCTION (153, sub1, "sub1", 1)
|
|||
ARGS1 (x);
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Substract the integers without untagging. */
|
||||
result = SCM_PACK ((scm_t_intptr) x
|
||||
- (scm_t_intptr) SCM_I_MAKINUM (1)
|
||||
result = SCM_PACK ((scm_t_intptr) SCM_UNPACK (x)
|
||||
- (scm_t_intptr) SCM_UNPACK (SCM_I_MAKINUM (1))
|
||||
+ scm_tc2_int);
|
||||
|
||||
if (SCM_LIKELY (SCM_I_INUMP (result)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue