Use autogenerated struct definition

This commit is contained in:
Douglas Katzman 2023-10-24 13:07:31 -04:00
parent ec32440095
commit 3662004420
8 changed files with 25 additions and 38 deletions

View file

@ -3583,8 +3583,11 @@ static inline int hashtable_weakness(struct hash_table* ht) { return ht->uw_flag
(write-hash-table-flag-extractors)) (write-hash-table-flag-extractors))
(when (eq (dd-name dd) 'sb-lockless::split-ordered-list) (when (eq (dd-name dd) 'sb-lockless::split-ordered-list)
(terpri) (terpri)
(output (layout-info (find-layout 'sb-lockless::so-data-node)) (output (layout-info (find-layout 'sb-lockless::list-node)) "list_node")
"split_ordered_list_node")) (terpri)
(output (layout-info (find-layout 'sb-lockless::so-data-node)) "solist_node")
(format t "static inline int so_dummy_node_p(struct solist_node* n) {
return !(n->node_hash & ~D);~%}~%" (sb-vm:fixnumize 1)))
(when assembler-guard (when assembler-guard
(format t "~%#endif /* __ASSEMBLER__ */~2%")))) (format t "~%#endif /* __ASSEMBLER__ */~2%"))))
@ -4370,7 +4373,7 @@ static inline uword_t word_has_stickymark(uword_t word) {
(format stream "extern uword_t brothertree_find_lesseql(uword_t key, lispobj tree);~%")) (format stream "extern uword_t brothertree_find_lesseql(uword_t key, lispobj tree);~%"))
(dolist (class '(defstruct-description package (dolist (class '(defstruct-description package
;; FIXME: probably these should be external? ;; FIXME: probably these should be external?
sb-lockless::list-node sb-lockless::split-ordered-list sb-lockless::split-ordered-list
sb-vm::arena sb-thread::avlnode sb-vm::arena sb-thread::avlnode
sb-c::compiled-debug-info)) sb-c::compiled-debug-info))
(out-to (string-downcase class) (out-to (string-downcase class)

View file

@ -15,7 +15,7 @@
#include "genesis/instance.h" #include "genesis/instance.h"
#include "genesis/vector.h" #include "genesis/vector.h"
#include "genesis/hash-table.h" #include "genesis/hash-table.h"
#include "genesis/list-node.h" #include "genesis/split-ordered-list.h"
#include "genesis/static-symbols.h" #include "genesis/static-symbols.h"
#include "genesis/symbol.h" #include "genesis/symbol.h"
#include "genesis/fdefn.h" #include "genesis/fdefn.h"

View file

@ -43,7 +43,6 @@
#include "genesis/primitive-objects.h" #include "genesis/primitive-objects.h"
#include "genesis/binding.h" #include "genesis/binding.h"
#include "genesis/hash-table.h" #include "genesis/hash-table.h"
#include "genesis/list-node.h"
#include "genesis/split-ordered-list.h" #include "genesis/split-ordered-list.h"
#include "var-io.h" #include "var-io.h"
#include "search.h" #include "search.h"
@ -2617,20 +2616,6 @@ scavenge_interrupt_contexts(struct thread *th)
#endif /* x86oid targets */ #endif /* x86oid targets */
/* Finalizer table based on Split-Ordered Lists */ /* Finalizer table based on Split-Ordered Lists */
typedef struct {
// FIXME: 'struct split_ordered_list_node' is autogenerated,
// so does this manual definition really need to exist?
struct list_node lfnode;
lispobj hash;
lispobj key;
lispobj data;
// padding word, only if #+compact-instance-header
} so_node;
static inline int dummy_node_p(so_node* node) {
return (node->hash & make_fixnum(1)) == 0;
}
static void push_in_ordinary_list(struct symbol* list_holder, lispobj element) static void push_in_ordinary_list(struct symbol* list_holder, lispobj element)
{ {
struct cons* cons = gc_general_alloc(cons_region, 2*N_WORD_BYTES, PAGE_TYPE_CONS); struct cons* cons = gc_general_alloc(cons_region, 2*N_WORD_BYTES, PAGE_TYPE_CONS);
@ -2688,33 +2673,33 @@ void scan_finalizers()
struct split_ordered_list* solist = (void*)native_pointer(finalizer_store); struct split_ordered_list* solist = (void*)native_pointer(finalizer_store);
// SO-HEAD can not possibly be marked for deletion, therefore %NODE-NEXT // SO-HEAD can not possibly be marked for deletion, therefore %NODE-NEXT
// returns a valid node. // returns a valid node.
lispobj node = ((so_node*)native_pointer(solist->head))->lfnode._node_next; lispobj node = ((struct solist_node*)native_pointer(solist->head))->_node_next;
while (node != LFLIST_TAIL_ATOM) { while (node != LFLIST_TAIL_ATOM) {
// At each iteration, 'this' is the node whose disposition we're pondering, // At each iteration, 'this' is the node whose disposition we're pondering,
so_node* this = (so_node*)(node-INSTANCE_POINTER_LOWTAG); struct solist_node* this = (void*)INSTANCE(node);
// To determine if 'this' is pending deletion, read the bits of its 'next' // To determine if 'this' is pending deletion, read the bits of its 'next'
lispobj next = this->lfnode._node_next; lispobj next = this->_node_next;
if (fixnump(next)) { // node is already logically deleted, pending physical deletion if (fixnump(next)) { // node is already logically deleted, pending physical deletion
gc_assert(!dummy_node_p(this)); gc_assert(!so_dummy_node_p(this));
node = next | INSTANCE_POINTER_LOWTAG; node = next | INSTANCE_POINTER_LOWTAG;
continue; continue;
} }
if (dummy_node_p(this)) { if (so_dummy_node_p(this)) {
// nothing to do // nothing to do
} else if (forwarding_pointer_p((lispobj*)this->key)) { } else if (forwarding_pointer_p((lispobj*)this->so_key)) {
// live object moved // live object moved
push_in_alist(SYMBOL(FINALIZER_REHASHLIST), push_in_alist(SYMBOL(FINALIZER_REHASHLIST),
forwarding_pointer_value((lispobj*)this->key), forwarding_pointer_value((lispobj*)this->so_key),
this->data); this->so_data);
// FIXME: use sync_fetch_and_and or does it not matter since world is stopped? // FIXME: use sync_fetch_and_and or does it not matter since world is stopped?
this->lfnode._node_next = next & ~LOWTAG_MASK; // logically delete this->_node_next = next & ~LOWTAG_MASK; // logically delete
// 'key' is left alone but is no longer considered a reference because the // 'key' is left alone but is no longer considered a reference because the
// node is logically deleted. This preserves a partial order if there are // node is logically deleted. This preserves a partial order if there are
// hash collisions as key is the tiebreaker. // hash collisions as key is the tiebreaker.
--solist->uw_count; --solist->uw_count;
} else if (!obj_alivep((lispobj*)this->key)) { } else if (!obj_alivep((lispobj*)this->so_key)) {
push_in_ordinary_list(SYMBOL(FINALIZERS_TRIGGERED), this->data); push_in_ordinary_list(SYMBOL(FINALIZERS_TRIGGERED), this->so_data);
this->lfnode._node_next = next & ~LOWTAG_MASK; // logically delete this->_node_next = next & ~LOWTAG_MASK; // logically delete
--solist->uw_count; --solist->uw_count;
} }
node = next; node = next;

View file

@ -46,7 +46,6 @@
#include "genesis/fdefn.h" #include "genesis/fdefn.h"
#include "save.h" #include "save.h"
#include "genesis/hash-table.h" #include "genesis/hash-table.h"
#include "genesis/list-node.h"
#include "genesis/instance.h" #include "genesis/instance.h"
#include "hopscotch.h" #include "hopscotch.h"
#include "genesis/cons.h" #include "genesis/cons.h"
@ -4915,7 +4914,7 @@ static int verify_headered_object(lispobj* object, sword_t nwords,
if (fixnump(next) && next) if (fixnump(next) && next)
CHECK(next | INSTANCE_POINTER_LOWTAG, &node->_node_next); CHECK(next | INSTANCE_POINTER_LOWTAG, &node->_node_next);
if (finalizer_node_layout_p(LAYOUT(layout))) { if (finalizer_node_layout_p(LAYOUT(layout))) {
struct split_ordered_list_node* node = (void*)object; struct solist_node* node = (void*)object;
// !fixnump(next) implies that this node is NOT deleted, nor in // !fixnump(next) implies that this node is NOT deleted, nor in
// the process of getting deleted by CANCEL-FINALIZATION // the process of getting deleted by CANCEL-FINALIZATION
if (node->so_key && !fixnump(next)) { if (node->so_key && !fixnump(next)) {

View file

@ -31,7 +31,7 @@
#include "genesis/instance.h" #include "genesis/instance.h"
#include "genesis/closure.h" #include "genesis/closure.h"
#include "genesis/hash-table.h" #include "genesis/hash-table.h"
#include "genesis/list-node.h" #include "genesis/split-ordered-list.h"
#define PAGES_CLAIMED_PER_THREAD 128 #define PAGES_CLAIMED_PER_THREAD 128
#define PREFETCH_DISTANCE 32 #define PREFETCH_DISTANCE 32

View file

@ -24,7 +24,7 @@
#include "pseudo-atomic.h" #include "pseudo-atomic.h"
#include "genesis/instance.h" #include "genesis/instance.h"
#include "genesis/gc-tables.h" #include "genesis/gc-tables.h"
#include "genesis/list-node.h" #include "genesis/split-ordered-list.h"
#include "thread.h" #include "thread.h"
/* forward declarations */ /* forward declarations */

View file

@ -350,7 +350,7 @@ int bsearch_greatereql_uint32(uint32_t item, uint32_t* array, int nelements)
* Unlike the lisp algorithm, this does not "assist" a pending deletion * Unlike the lisp algorithm, this does not "assist" a pending deletion
* by completing it with compare-and-swap - this loop simply ignores * by completing it with compare-and-swap - this loop simply ignores
* any deleted nodes that haven't been snipped out yet. */ * any deleted nodes that haven't been snipped out yet. */
struct split_ordered_list_node* struct solist_node*
split_ordered_list_find(struct split_ordered_list* solist, split_ordered_list_find(struct split_ordered_list* solist,
lispobj key) lispobj key)
{ {
@ -369,7 +369,7 @@ split_ordered_list_find(struct split_ordered_list* solist,
while ((nodeptr & WIDETAG_MASK) == UNBOUND_MARKER_WIDETAG) { while ((nodeptr & WIDETAG_MASK) == UNBOUND_MARKER_WIDETAG) {
nodeptr = bins->data[--bin_index]; nodeptr = bins->data[--bin_index];
} }
struct split_ordered_list_node* node = (void*)native_pointer(nodeptr); struct solist_node* node = (void*)native_pointer(nodeptr);
lispobj hash_as_fixnum = make_fixnum(full_hash); lispobj hash_as_fixnum = make_fixnum(full_hash);
while (1) { while (1) {
if (node->node_hash == hash_as_fixnum) { // possible hit if (node->node_hash == hash_as_fixnum) { // possible hit

View file

@ -34,7 +34,7 @@ run_sbcl_with_core "$tmpcore" --noinform --disable-ldb --no-userinit --no-sysini
(sb-sys:with-pinned-objects (*x*) (sb-sys:with-pinned-objects (*x*)
(let ((list (sb-lockless:so-data (let ((list (sb-lockless:so-data
(sb-lockless:so-find sb-impl::**finalizer-store** (sb-lockless:so-find sb-impl::**finalizer-store**
(sb-kerneL:%make-lisp-obj (sb-kernel:%make-lisp-obj
(logandc2 (sb-kernel:get-lisp-obj-address *x*) (logandc2 (sb-kernel:get-lisp-obj-address *x*)
sb-vm:lowtag-mask)))))) sb-vm:lowtag-mask))))))
(assert (= (length list) 2)) (assert (= (length list) 2))