mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-25 12:40:26 +02:00
Remove the `scm_tc_free_cell' SMOB type.
* libguile/deprecated.h (SCM_FREEP, SCM_NFREEP): Changed to constants. * libguile/gc.c (scm_i_tag_name): Remove reference to `scm_tc_free_cell'. * libguile/gc.h (SCM_FREE_CELL_CDR, SCM_SET_FREE_CELL_CDR): Remove. * libguile/smob.c (free_print): Remove. (scm_smob_prehistory): Don't create the "free" SMOB type. * libguile/struct.c (struct_finalizer_trampoline): Use a bare `scm_tc3_struct' tag for finalized structs instead of `scm_tc_free_cell'. * libguile/tags.h (scm_tc_free_cell): Remove.
This commit is contained in:
parent
78747ac6fb
commit
f86f3b5b11
6 changed files with 9 additions and 58 deletions
|
@ -5,7 +5,7 @@
|
||||||
#ifndef SCM_DEPRECATED_H
|
#ifndef SCM_DEPRECATED_H
|
||||||
#define SCM_DEPRECATED_H
|
#define SCM_DEPRECATED_H
|
||||||
|
|
||||||
/* Copyright (C) 2003,2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
/* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009 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
|
||||||
|
@ -117,8 +117,8 @@ SCM_API SCM scm_unprotect_object (SCM obj);
|
||||||
(SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) & (y))))
|
(SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) & (y))))
|
||||||
#define SCM_SETOR_CDR(x, y)\
|
#define SCM_SETOR_CDR(x, y)\
|
||||||
(SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
|
(SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
|
||||||
#define SCM_FREEP(x) (SCM_FREE_CELL_P (x))
|
#define SCM_FREEP(x) (0)
|
||||||
#define SCM_NFREEP(x) (!SCM_FREE_CELL_P (x))
|
#define SCM_NFREEP(x) (1)
|
||||||
#define SCM_GC8MARKP(x) SCM_GC_MARK_P (x)
|
#define SCM_GC8MARKP(x) SCM_GC_MARK_P (x)
|
||||||
#define SCM_SETGC8MARK(x) SCM_SET_GC_MARK (x)
|
#define SCM_SETGC8MARK(x) SCM_SET_GC_MARK (x)
|
||||||
#define SCM_CLRGC8MARK(x) SCM_CLEAR_GC_MARK (x)
|
#define SCM_CLRGC8MARK(x) SCM_CLEAR_GC_MARK (x)
|
||||||
|
|
|
@ -762,15 +762,10 @@ char const *
|
||||||
scm_i_tag_name (scm_t_bits tag)
|
scm_i_tag_name (scm_t_bits tag)
|
||||||
{
|
{
|
||||||
if (tag >= 255)
|
if (tag >= 255)
|
||||||
{
|
|
||||||
if (tag == scm_tc_free_cell)
|
|
||||||
return "free cell";
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int k = 0xff & (tag >> 8);
|
int k = 0xff & (tag >> 8);
|
||||||
return (scm_smobs[k].name);
|
return (scm_smobs[k].name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
switch (tag) /* 7 bits */
|
switch (tag) /* 7 bits */
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,15 +116,6 @@ typedef struct scm_t_cell
|
||||||
#define SCM_CELL_TYPE(x) SCM_CELL_WORD_0 (x)
|
#define SCM_CELL_TYPE(x) SCM_CELL_WORD_0 (x)
|
||||||
#define SCM_SET_CELL_TYPE(x, t) SCM_SET_CELL_WORD_0 ((x), (t))
|
#define SCM_SET_CELL_TYPE(x, t) SCM_SET_CELL_WORD_0 ((x), (t))
|
||||||
|
|
||||||
/* Freelists consist of linked cells where the type entry holds the value
|
|
||||||
* scm_tc_free_cell and the second entry holds a pointer to the next cell of
|
|
||||||
* the freelist. Due to this structure, freelist cells are not cons cells
|
|
||||||
* and thus may not be accessed using SCM_CAR and SCM_CDR. */
|
|
||||||
|
|
||||||
#define SCM_FREE_CELL_CDR(x) \
|
|
||||||
(SCM_GC_CELL_OBJECT ((x), 1))
|
|
||||||
#define SCM_SET_FREE_CELL_CDR(x, v) \
|
|
||||||
(SCM_GC_SET_CELL_OBJECT ((x), 1, (v)))
|
|
||||||
|
|
||||||
#if (SCM_DEBUG_CELL_ACCESSES == 1)
|
#if (SCM_DEBUG_CELL_ACCESSES == 1)
|
||||||
/* Set this to != 0 if every cell that is accessed shall be checked:
|
/* Set this to != 0 if every cell that is accessed shall be checked:
|
||||||
|
|
|
@ -471,26 +471,6 @@ scm_make_smob (scm_t_bits tc)
|
||||||
SCM_RETURN_NEWSMOB (tc, data);
|
SCM_RETURN_NEWSMOB (tc, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* {Initialization for the type of free cells}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
|
||||||
free_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED)
|
|
||||||
{
|
|
||||||
char buf[100];
|
|
||||||
sprintf (buf, "#<freed cell %p; GC missed a reference>",
|
|
||||||
(void *) SCM_UNPACK (exp));
|
|
||||||
scm_puts (buf, port);
|
|
||||||
|
|
||||||
#if (SCM_DEBUG_CELL_ACCESSES == 1)
|
|
||||||
if (scm_debug_cell_accesses_p)
|
|
||||||
abort();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Marking SMOBs using user-supplied mark procedures. */
|
/* Marking SMOBs using user-supplied mark procedures. */
|
||||||
|
@ -632,7 +612,6 @@ void
|
||||||
scm_smob_prehistory ()
|
scm_smob_prehistory ()
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
scm_t_bits tc;
|
|
||||||
|
|
||||||
smob_gc_kind = GC_new_kind (GC_new_free_list (),
|
smob_gc_kind = GC_new_kind (GC_new_free_list (),
|
||||||
GC_MAKE_PROC (GC_new_proc (smob_mark), 0),
|
GC_MAKE_PROC (GC_new_proc (smob_mark), 0),
|
||||||
|
@ -657,10 +636,6 @@ scm_smob_prehistory ()
|
||||||
scm_smobs[i].apply_3 = 0;
|
scm_smobs[i].apply_3 = 0;
|
||||||
scm_smobs[i].gsubr_type = 0;
|
scm_smobs[i].gsubr_type = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WARNING: This scm_make_smob_type call must be done first. */
|
|
||||||
tc = scm_make_smob_type ("free", 0);
|
|
||||||
scm_set_smob_print (tc, free_print);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
|
/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2003, 2004, 2006, 2007, 2008, 2009 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
|
||||||
|
@ -338,7 +338,7 @@ struct_finalizer_trampoline (GC_PTR ptr, GC_PTR unused_data)
|
||||||
scm_t_struct_free free_struct_data
|
scm_t_struct_free free_struct_data
|
||||||
= ((scm_t_struct_free) vtable_data[scm_struct_i_free]);
|
= ((scm_t_struct_free) vtable_data[scm_struct_i_free]);
|
||||||
|
|
||||||
SCM_SET_CELL_TYPE (obj, scm_tc_free_cell);
|
SCM_SET_CELL_TYPE (obj, scm_tc3_struct);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* A sanity check. However, this check can fail if the free function
|
/* A sanity check. However, this check can fail if the free function
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef SCM_TAGS_H
|
#ifndef SCM_TAGS_H
|
||||||
#define SCM_TAGS_H
|
#define SCM_TAGS_H
|
||||||
|
|
||||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2008
|
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2008,2009
|
||||||
* 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
|
||||||
|
@ -374,10 +374,6 @@ typedef unsigned long scm_t_bits;
|
||||||
* tc16 (for tc7==scm_tc7_smob):
|
* tc16 (for tc7==scm_tc7_smob):
|
||||||
* The largest part of the space of smob types is not subdivided in a
|
* The largest part of the space of smob types is not subdivided in a
|
||||||
* predefined way, since smobs can be added arbitrarily by user C code.
|
* predefined way, since smobs can be added arbitrarily by user C code.
|
||||||
* However, while Guile also defines a number of smob types throughout,
|
|
||||||
* there is one smob type, namely scm_tc_free_cell, for which Guile assumes
|
|
||||||
* that it is declared first and thus gets a known-in-advance tc16-code.
|
|
||||||
* The reason of requiring a fixed tc16-code for this type is performance.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -484,12 +480,6 @@ typedef unsigned long scm_t_bits;
|
||||||
#define SCM_TYP16_PREDICATE(tag, x) (!SCM_IMP (x) && SCM_TYP16 (x) == (tag))
|
#define SCM_TYP16_PREDICATE(tag, x) (!SCM_IMP (x) && SCM_TYP16 (x) == (tag))
|
||||||
|
|
||||||
|
|
||||||
/* Here is the first smob subtype. */
|
|
||||||
|
|
||||||
/* scm_tc_free_cell is the 0th smob type. We place this in free cells to tell
|
|
||||||
* the conservative marker not to trace it. */
|
|
||||||
#define scm_tc_free_cell (scm_tc7_smob + 0 * 256L)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* {Immediate Values}
|
/* {Immediate Values}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue