mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-27 21:40:34 +02:00
Always add a header onto objects
We're targetting systems that need to be able to inspect the kind of an object, so this information has to be somewhere. If it's out-of-line, we might save memory, but we would lose locality. Concretely in Guile the tag bits are in the object itself.
This commit is contained in:
parent
d8bcbf2d74
commit
cacc28b577
6 changed files with 14 additions and 20 deletions
6
quads.c
6
quads.c
|
@ -7,7 +7,7 @@
|
|||
#include "gc.h"
|
||||
|
||||
typedef struct Quad {
|
||||
GC_HEADER;
|
||||
struct gc_header header;
|
||||
struct Quad *kids[4];
|
||||
} Quad;
|
||||
static inline size_t quad_size(Quad *obj) {
|
||||
|
@ -125,10 +125,8 @@ int main(int argc, char *argv[]) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
// Compute byte size not counting any header word, so as to compute the same
|
||||
// heap size whether a header word is there or not.
|
||||
size_t nquads = tree_size(depth);
|
||||
size_t tree_bytes = nquads * 4 * sizeof(Quad*);
|
||||
size_t tree_bytes = nquads * sizeof(Quad);
|
||||
size_t heap_size = tree_bytes * multiplier;
|
||||
|
||||
unsigned long gc_start = current_time();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue