[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/igc 035fae58b1d 2/6: Allocate hash table vectors and object vect
From: |
Pip Cet |
Subject: |
scratch/igc 035fae58b1d 2/6: Allocate hash table vectors and object vectors as Lisp_Vectors |
Date: |
Sun, 21 Jul 2024 05:24:53 -0400 (EDT) |
branch: scratch/igc
commit 035fae58b1d3657ce81df0a39e8eabf060f0a799
Author: Pip Cet <pipcet@protonmail.com>
Commit: Pip Cet <pipcet@protonmail.com>
Allocate hash table vectors and object vectors as Lisp_Vectors
* src/igc.c (igc_alloc_lisp_obj_vec):
(igc_make_hash_table_vec): Return a vector's contents area rather than a
plain Lisp_Object array.
* src/pdumper.c (dump_hash_vec): Assume we're actually dumping a
vector's content area.
---
src/igc.c | 5 +++--
src/pdumper.c | 10 ++++------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/igc.c b/src/igc.c
index 6d17e020fd4..1dfafd2433f 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -3992,7 +3992,8 @@ igc_make_ptr_vec (size_t n)
Lisp_Object *
igc_alloc_lisp_obj_vec (size_t n)
{
- return alloc (n * sizeof (Lisp_Object), IGC_OBJ_OBJ_VEC);
+ Lisp_Object v = make_vector (n, Qnil);
+ return XVECTOR (v)->contents;
}
static mps_addr_t
@@ -4023,7 +4024,7 @@ weak_hash_find_dependent (mps_addr_t base)
Lisp_Object *
igc_make_hash_table_vec (size_t n)
{
- return alloc (n * sizeof (Lisp_Object), IGC_OBJ_HASH_VEC);
+ return XVECTOR (make_vector (n, Qnil))->contents;
}
Lisp_Object
diff --git a/src/pdumper.c b/src/pdumper.c
index be3d6f1c6a4..dc31bfdad65 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2727,13 +2727,14 @@ static dump_off
dump_hash_vec (struct dump_context *ctx,
const Lisp_Object array[], size_t len)
{
+#ifdef HAVE_MPS
+ struct Lisp_Vector *v = (struct Lisp_Vector *)((char *)array - sizeof (*v));
+ return dump_vectorlike_generic (ctx, &v->header) + sizeof (*v);
+#endif
dump_align_output (ctx, DUMP_ALIGNMENT);
struct dump_flags old_flags = ctx->flags;
ctx->flags.pack_objects = true;
-#ifdef HAVE_MPS
- dump_igc_start_obj (ctx, IGC_OBJ_HASH_VEC, array);
-#endif
dump_off start_offset = ctx->offset;
for (size_t i = 0; i < len; i++)
@@ -2746,9 +2747,6 @@ dump_hash_vec (struct dump_context *ctx,
}
ctx->flags = old_flags;
-#ifdef HAVE_MPS
- dump_igc_finish_obj (ctx);
-#endif
return start_offset;
}
- scratch/igc updated (9a96b02bb51 -> 90e80a9a53e), Pip Cet, 2024/07/21
- scratch/igc 1551ac70793 4/6: Split up MPS fix functions by type, Pip Cet, 2024/07/21
- scratch/igc 47fa4bb6e97 1/6: Give byte allocations a header, Pip Cet, 2024/07/21
- scratch/igc 2c6e10f8351 5/6: Make client_to_base, base_to_client identity functions, Pip Cet, 2024/07/21
- scratch/igc 90e80a9a53e 6/6: Adjust igc.c code to header changes, Pip Cet, 2024/07/21
- scratch/igc fd9709f58a8 3/6: Adjust dumping code to assume a header, Pip Cet, 2024/07/21
- scratch/igc 035fae58b1d 2/6: Allocate hash table vectors and object vectors as Lisp_Vectors,
Pip Cet <=