1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-11 05:51:21 -08:00

Use PVEC_MODULE_GLOBAL_REFERENCE instead of PVEC_OTHER

This commit is contained in:
Gerd Möllmann 2024-04-26 16:30:25 +02:00
parent 446c0cb139
commit ea29f0f2eb
7 changed files with 26 additions and 17 deletions

View file

@ -3486,7 +3486,9 @@ cleanup_vector (struct Lisp_Vector *vector)
= (struct Lisp_Module_Function *) vector;
module_finalize_function (function);
}
#endif
# endif
break;
case PVEC_MODULE_GLOBAL_REFERENCE:
break;
case PVEC_NATIVE_COMP_UNIT:
#ifdef HAVE_NATIVE_COMP

View file

@ -234,7 +234,8 @@ a fixed set of types. */)
case Lisp_Vectorlike:
/* WARNING!! Keep 'cl--type-hierarchy' in sync with this code!! */
switch (PSEUDOVECTOR_TYPE (XVECTOR (object)))
{
{
case PVEC_MODULE_GLOBAL_REFERENCE: return Qmodule_global_reference;
case PVEC_NORMAL_VECTOR: return Qvector;
case PVEC_BIGNUM: return Qbignum;
case PVEC_MARKER: return Qmarker;
@ -4220,6 +4221,7 @@ syms_of_data (void)
DEFSYM (Qcons, "cons");
DEFSYM (Qmarker, "marker");
DEFSYM (Qsymbol_with_pos, "symbol-with-pos");
DEFSYM (Qmodule_global_reference, "module-global-reference");
DEFSYM (Qoverlay, "overlay");
DEFSYM (Qfinalizer, "finalizer");
DEFSYM (Qmodule_function, "module-function");

View file

@ -376,7 +376,7 @@ static Lisp_Object Vmodule_refs_hash;
static struct module_global_reference *
XMODULE_GLOBAL_REFERENCE (Lisp_Object o)
{
eassert (PSEUDOVECTORP (o, PVEC_OTHER));
eassert (PSEUDOVECTORP (o, PVEC_MODULE_GLOBAL_REFERENCE));
return XUNTAG (o, Lisp_Vectorlike, struct module_global_reference);
}
@ -425,11 +425,11 @@ module_make_global_ref (emacs_env *env, emacs_value value)
{
struct module_global_reference *ref
= ALLOCATE_PLAIN_PSEUDOVECTOR (struct module_global_reference,
PVEC_OTHER);
PVEC_MODULE_GLOBAL_REFERENCE);
ref->value.v = new_obj;
ref->refcount = 1;
Lisp_Object value;
XSETPSEUDOVECTOR (value, ref, PVEC_OTHER);
XSETPSEUDOVECTOR (value, ref, PVEC_MODULE_GLOBAL_REFERENCE);
hash_put (h, new_obj, value, hashcode);
MODULE_INTERNAL_CLEANUP ();
return &ref->value;

View file

@ -1588,22 +1588,19 @@ fix_xwidget_view (mps_ss_t ss, struct xwidget_view *v)
#endif // HAVE_XWIDGETS
#ifdef HAVE_MODULES
static mps_res_t
fix_other (mps_ss_t ss, void *o)
fix_global_ref (mps_ss_t ss, struct module_global_reference *r)
{
MPS_SCAN_BEGIN (ss)
{
IGC_FIX_CALL_FN (ss, struct Lisp_Vector, o, fix_vectorlike);
/* FIXME: PVEC_OTHER is also used on w32 for struct scroll_bar,
and there seems to be no way to discern both uses. */
#ifdef HAVE_MODULES
struct module_global_reference *r = o;
IGC_FIX_CALL_FN (ss, struct Lisp_Vector, r, fix_vectorlike);
IGC_FIX12_OBJ (ss, &r->value.v);
#endif
}
MPS_SCAN_END (ss);
return MPS_RES_OK;
}
#endif
#ifndef IN_MY_FORK
static mps_res_t
@ -1675,10 +1672,6 @@ fix_vector (mps_ss_t ss, struct Lisp_Vector *v)
IGC_FIX_CALL_FN (ss, struct Lisp_Finalizer, v, fix_finalizer);
break;
case PVEC_OTHER:
IGC_FIX_CALL_FN (ss, void, v, fix_other);
break;
case PVEC_MISC_PTR:
IGC_FIX_CALL_FN (ss, struct Lisp_Misc_Ptr, v, fix_misc_ptr);
break;
@ -1720,6 +1713,12 @@ fix_vector (mps_ss_t ss, struct Lisp_Vector *v)
IGC_FIX_CALL_FN (ss, struct Lisp_Native_Comp_Unit, v, fix_native_cu);
break;
case PVEC_MODULE_GLOBAL_REFERENCE:
#ifdef HAVE_MODULES
IGC_FIX_CALL_FN (ss, struct module_global_reference, v, fix_global_ref);
#endif
break;
case PVEC_NORMAL_VECTOR:
case PVEC_SYMBOL_WITH_POS:
case PVEC_PROCESS:
@ -1735,6 +1734,7 @@ fix_vector (mps_ss_t ss, struct Lisp_Vector *v)
case PVEC_COMPILED:
case PVEC_RECORD:
case PVEC_FONT:
case PVEC_OTHER:
#ifdef IN_MY_FORK
case PVEC_PACKAGE:
#endif
@ -2342,7 +2342,8 @@ finalize_vector (mps_addr_t v)
case PVEC_TERMINAL:
case PVEC_MARKER:
case PVEC_WEAK_REF:
igc_assert (!"not implemented");
case PVEC_MODULE_GLOBAL_REFERENCE:
igc_assert (!"finalization not implemented");
break;
}
}
@ -2433,6 +2434,7 @@ maybe_finalize (mps_addr_t client, enum pvec_type tag)
case PVEC_PACKAGE:
#endif
case PVEC_WEAK_REF:
case PVEC_MODULE_GLOBAL_REFERENCE:
break;
}
}

View file

@ -1042,6 +1042,7 @@ enum pvec_type
PVEC_MUTEX,
PVEC_CONDVAR,
PVEC_MODULE_FUNCTION,
PVEC_MODULE_GLOBAL_REFERENCE,
PVEC_NATIVE_COMP_UNIT,
PVEC_TS_PARSER,
PVEC_TS_NODE,

View file

@ -3164,6 +3164,7 @@ dump_vectorlike (struct dump_context *ctx,
case PVEC_CONDVAR:
case PVEC_SQLITE:
case PVEC_MODULE_FUNCTION:
case PVEC_MODULE_GLOBAL_REFERENCE:
case PVEC_SYMBOL_WITH_POS:
case PVEC_FREE:
case PVEC_TS_PARSER:

View file

@ -2115,6 +2115,7 @@ print_vectorlike_unreadable (Lisp_Object obj, Lisp_Object printcharfun,
/* Impossible cases. */
case PVEC_FREE:
case PVEC_OTHER:
case PVEC_MODULE_GLOBAL_REFERENCE:
break;
}
emacs_abort ();