[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/igc 536bec0f0ae 35/78: WIP
From: |
Gerd Moellmann |
Subject: |
scratch/igc 536bec0f0ae 35/78: WIP |
Date: |
Fri, 14 Jun 2024 04:27:13 -0400 (EDT) |
branch: scratch/igc
commit 536bec0f0ae2df454692ffa0dcf10ac2ae942cf8
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
WIP
---
src/igc.c | 113 +++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 61 insertions(+), 52 deletions(-)
diff --git a/src/igc.c b/src/igc.c
index 5b95b9d1dc3..b416d80a807 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -3586,6 +3586,66 @@ igc_header_size (void)
return sizeof (struct igc_header);
}
+static bool
+is_builtin_subr (enum igc_obj_type type, void *client)
+{
+ if (type == IGC_OBJ_VECTOR && pseudo_vector_type (client) == PVEC_SUBR)
+ {
+ Lisp_Object subr = make_lisp_ptr (client, Lisp_Vectorlike);
+ return !SUBR_NATIVE_COMPILEDP (subr);
+ }
+ return false;
+}
+
+static enum igc_obj_type
+builtin_obj_type (enum igc_obj_type type, void *client)
+{
+ if (c_symbol_p (client))
+ return IGC_OBJ_BUILTIN_SYMBOL;
+ if (client == &main_thread)
+ return IGC_OBJ_BUILTIN_THREAD;
+ if (is_builtin_subr (type, client))
+ return IGC_OBJ_BUILTIN_SUBR;
+ emacs_abort ();
+}
+
+static bool
+is_builtin_obj_type (enum igc_obj_type type)
+{
+ switch (type)
+ {
+ case IGC_OBJ_INVALID:
+ case IGC_OBJ_PAD:
+ case IGC_OBJ_FWD:
+ case IGC_OBJ_CONS:
+ case IGC_OBJ_SYMBOL:
+ case IGC_OBJ_INTERVAL:
+ case IGC_OBJ_STRING:
+ case IGC_OBJ_STRING_DATA:
+ case IGC_OBJ_VECTOR:
+ case IGC_OBJ_ITREE_TREE:
+ case IGC_OBJ_ITREE_NODE:
+ case IGC_OBJ_IMAGE:
+ case IGC_OBJ_IMAGE_CACHE:
+ case IGC_OBJ_FACE:
+ case IGC_OBJ_FACE_CACHE:
+ case IGC_OBJ_FLOAT:
+ case IGC_OBJ_BLV:
+ case IGC_OBJ_WEAK:
+ case IGC_OBJ_PTR_VEC:
+ case IGC_OBJ_OBJ_VEC:
+ case IGC_OBJ_HANDLER:
+ case IGC_OBJ_BYTES:
+ case IGC_OBJ_NUM_TYPES:
+ return false;
+
+ case IGC_OBJ_BUILTIN_SYMBOL:
+ case IGC_OBJ_BUILTIN_THREAD:
+ case IGC_OBJ_BUILTIN_SUBR:
+ return true;
+ }
+}
+
char *
igc_dump_finish_obj (void *client, enum igc_obj_type type,
char *base, char *end)
@@ -3603,24 +3663,10 @@ igc_dump_finish_obj (void *client, enum igc_obj_type
type,
return base + to_bytes (h->nwords);
}
- /* If the copied object is not in MPS, it is something
- like a built-in symbol. */
- if (c_symbol_p (client))
- type = IGC_OBJ_BUILTIN_SYMBOL;
- else if (client == &main_thread)
- type = IGC_OBJ_BUILTIN_THREAD;
-#ifdef HAVE_NATIVE_COMP
- else if (type == IGC_OBJ_VECTOR
- && pseudo_vector_type (client) == PVEC_SUBR
- && !((struct Aligned_Lisp_Subr *) client)->s.native_comp_u)
- type = IGC_OBJ_BUILTIN_SUBR;
-#endif
- else
- emacs_abort ();
-
size_t client_size = end - base - sizeof *out;
size_t nbytes = obj_size (client_size);
size_t nwords = to_words (nbytes);
+ type = builtin_obj_type (type, client);
*out = (struct igc_header) { .obj_type = type, .nwords = nwords };
return base + nbytes;
}
@@ -3806,43 +3852,6 @@ lookup_base (struct igc_mirror *m, void *base)
return NILP (found) ? NULL : fixnum_to_pointer (found);
}
-static bool
-is_builtin_obj_type (enum igc_obj_type type)
-{
- switch (type)
- {
- case IGC_OBJ_INVALID:
- case IGC_OBJ_PAD:
- case IGC_OBJ_FWD:
- case IGC_OBJ_CONS:
- case IGC_OBJ_SYMBOL:
- case IGC_OBJ_INTERVAL:
- case IGC_OBJ_STRING:
- case IGC_OBJ_STRING_DATA:
- case IGC_OBJ_VECTOR:
- case IGC_OBJ_ITREE_TREE:
- case IGC_OBJ_ITREE_NODE:
- case IGC_OBJ_IMAGE:
- case IGC_OBJ_IMAGE_CACHE:
- case IGC_OBJ_FACE:
- case IGC_OBJ_FACE_CACHE:
- case IGC_OBJ_FLOAT:
- case IGC_OBJ_BLV:
- case IGC_OBJ_WEAK:
- case IGC_OBJ_PTR_VEC:
- case IGC_OBJ_OBJ_VEC:
- case IGC_OBJ_HANDLER:
- case IGC_OBJ_BYTES:
- case IGC_OBJ_NUM_TYPES:
- return false;
-
- case IGC_OBJ_BUILTIN_SYMBOL:
- case IGC_OBJ_BUILTIN_THREAD:
- case IGC_OBJ_BUILTIN_SUBR:
- return true;
- }
-}
-
static void
copy_dump_to_mps (struct igc_mirror *m)
{
- scratch/igc 790e99b2b83 03/78: Make it build again, (continued)
- scratch/igc 790e99b2b83 03/78: Make it build again, Gerd Moellmann, 2024/06/14
- scratch/igc 8abca66ede4 12/78: Refactoring, Gerd Moellmann, 2024/06/14
- scratch/igc 0f42efc428a 16/78: Refactoring, Gerd Moellmann, 2024/06/14
- scratch/igc 219f7d5ce20 01/78: emacs_lldb.py: reflect PVEC changes, Gerd Moellmann, 2024/06/14
- scratch/igc a09e5827a06 04/78: WIP, Gerd Moellmann, 2024/06/14
- scratch/igc d9830156fb9 05/78: WIP, Gerd Moellmann, 2024/06/14
- scratch/igc 931dc7c27cf 10/78: WIP, Gerd Moellmann, 2024/06/14
- scratch/igc c9b85c4516a 13/78: More refactoring, Gerd Moellmann, 2024/06/14
- scratch/igc 399e0776507 17/78: igc_const_cast, Gerd Moellmann, 2024/06/14
- scratch/igc 19df715fe2c 23/78: Refactoring, Gerd Moellmann, 2024/06/14
- scratch/igc 536bec0f0ae 35/78: WIP,
Gerd Moellmann <=
- scratch/igc b6f508613a7 37/78: +hash_table_rehash, Gerd Moellmann, 2024/06/14
- scratch/igc 4049bfa0d09 41/78: Refactor a bit, Gerd Moellmann, 2024/06/14
- scratch/igc 41ff9072503 47/78: Replace igc_create_charset_root (not executed if dump is loaded), Gerd Moellmann, 2024/06/14
- scratch/igc a4000e8a81d 14/78: WIP, Gerd Moellmann, 2024/06/14
- scratch/igc 5754633ebce 15/78: WIP, Gerd Moellmann, 2024/06/14
- scratch/igc 8d0bce3e858 18/78: Record times differently, Gerd Moellmann, 2024/06/14
- scratch/igc 9e9f9cde79a 29/78: Check hash table, Gerd Moellmann, 2024/06/14
- scratch/igc 5bb9ab84ef9 31/78: IGC_OBJ_BYTES, Gerd Moellmann, 2024/06/14
- scratch/igc 478daac4151 38/78: coding_system_categories, Gerd Moellmann, 2024/06/14
- scratch/igc e9610ef9467 42/78: Refactor a bit, Gerd Moellmann, 2024/06/14