1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-26 00:34:17 -07:00

Avoid type pun.

Copied from Perforce
 Change: 180364
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2012-11-06 12:16:46 +00:00
parent bf34dfa4b2
commit b6300a3af4
4 changed files with 17 additions and 6 deletions

View file

@ -4136,6 +4136,7 @@ static void *start(void *p, size_t s)
size_t i;
volatile obj_t env, op_env, obj;
jmp_buf jb;
mps_addr_t ref;
mps_res_t res;
mps_root_t globals_root;
@ -4148,8 +4149,9 @@ static void *start(void *p, size_t s)
we must also ensure that 'symtab' is valid before registration
(in this case, by setting it to NULL). See topic/root. */
symtab = NULL;
ref = &symtab;
res = mps_root_create_table(&symtab_root, arena, mps_rank_exact(), 0,
(mps_addr_t *)&symtab, 1);
ref, 1);
if(res != MPS_RES_OK) error("Couldn't register symtab root");
/* The symbol table is strong-key weak-value. */

View file

@ -755,6 +755,7 @@ static void rehash(void) {
unsigned old_symtab_size = symtab_size;
mps_root_t old_symtab_root = symtab_root;
unsigned i;
mps_addr_t ref;
mps_res_t res;
symtab_size *= 2;
@ -770,8 +771,9 @@ static void rehash(void) {
across from the old symbol table. The MPS might be moving objects
in memory at any time, and will arrange that both copies are updated
atomically to the mutator (this interpreter). */
ref = symtab;
res = mps_root_create_table(&symtab_root, arena, mps_rank_exact(), 0,
(mps_addr_t *)symtab, symtab_size);
ref, symtab_size);
if(res != MPS_RES_OK) error("Couldn't register new symtab root");
for(i = 0; i < old_symtab_size; ++i)
@ -4048,6 +4050,7 @@ static void *start(void *p, size_t s)
size_t i;
volatile obj_t env, op_env, obj;
jmp_buf jb;
mps_addr_t ref;
mps_res_t res;
mps_root_t globals_root;
@ -4064,8 +4067,9 @@ static void *start(void *p, size_t s)
pointers -- NULL in this case. Random values look like false
references into MPS memory and cause undefined behaviour (most likely
assertion failures). See topic/root. */
ref = symtab;
res = mps_root_create_table(&symtab_root, arena, mps_rank_exact(), 0,
(mps_addr_t *)symtab, symtab_size);
ref, symtab_size);
if(res != MPS_RES_OK) error("Couldn't register symtab root");
error_handler = &jb;

View file

@ -818,9 +818,11 @@ The symbol table now becomes a very simple :term:`root`, that only has
to be registered once (not :ref:`every time it is rehashed
<guide-lang-root>`, as previously)::
mps_addr_t ref;
symtab = NULL;
ref = &symtab;
res = mps_root_create_table(&symtab_root, arena, mps_rank_exact(), 0,
(mps_addr_t *)&symtab, 1);
ref, 1);
if(res != MPS_RES_OK) error("Couldn't register symtab root");
symtab = make_table(16, string_hash, string_equalp, 0, 1);

View file

@ -896,8 +896,9 @@ function, :c:func:`mps_root_create_table`, for registering it::
/* ... */
mps_addr_t ref = symtab;
res = mps_root_create_table(&symtab_root, arena, mps_rank_exact(), 0,
(mps_addr_t *)symtab, symtab_size);
ref, symtab_size);
if (res != MPS_RES_OK) error("Couldn't register new symtab root");
.. _guide-lang-roots-rehash:
@ -910,6 +911,7 @@ changes size::
unsigned old_symtab_size = symtab_size;
mps_root_t old_symtab_root = symtab_root;
unsigned i;
mps_addr_t ref;
mps_res_t res;
symtab_size *= 2;
@ -920,8 +922,9 @@ changes size::
for (i = 0; i < symtab_size; ++i)
symtab[i] = NULL;
ref = symtab;
res = mps_root_create_table(&symtab_root, arena, mps_rank_exact(), 0,
(mps_addr_t *)symtab, symtab_size);
ref, symtab_size);
if (res != MPS_RES_OK) error("Couldn't register new symtab root");
for (i = 0; i < old_symtab_size; ++i)