From 8f059e07a79e7fea0a826cc4488e826269d805fb Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 19 Mar 2009 03:49:49 -0500 Subject: [PATCH] Move flags from F_CODE_BLOCK to F_BLOCK for further space savings --- vm/callstack.c | 2 +- vm/code_block.c | 18 +++++++++--------- vm/code_heap.c | 2 +- vm/layouts.h | 8 ++++---- vm/quotations.c | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/vm/callstack.c b/vm/callstack.c index ae3f524112..d44a889756 100755 --- a/vm/callstack.c +++ b/vm/callstack.c @@ -97,7 +97,7 @@ F_CODE_BLOCK *frame_code(F_STACK_FRAME *frame) CELL frame_type(F_STACK_FRAME *frame) { - return frame_code(frame)->type; + return frame_code(frame)->block.type; } CELL frame_executing(F_STACK_FRAME *frame) diff --git a/vm/code_block.c b/vm/code_block.c index 8e528120dc..fc19aff2ac 100644 --- a/vm/code_block.c +++ b/vm/code_block.c @@ -107,12 +107,12 @@ void update_literal_references(F_CODE_BLOCK *compiled) aging and nursery collections */ void copy_literal_references(F_CODE_BLOCK *compiled) { - if(collecting_gen >= compiled->last_scan) + if(collecting_gen >= compiled->block.last_scan) { if(collecting_accumulation_gen_p()) - compiled->last_scan = collecting_gen; + compiled->block.last_scan = collecting_gen; else - compiled->last_scan = collecting_gen + 1; + compiled->block.last_scan = collecting_gen + 1; /* initialize chase pointer */ CELL scan = newspace->here; @@ -153,7 +153,7 @@ to update references to other words, without worrying about literals or dlsyms. */ void update_word_references(F_CODE_BLOCK *compiled) { - if(compiled->needs_fixup) + if(compiled->block.needs_fixup) relocate_code_block(compiled); else { @@ -305,8 +305,8 @@ void relocate_code_block_step(F_REL *rel, F_CODE_BLOCK *compiled) /* Perform all fixups on a code block */ void relocate_code_block(F_CODE_BLOCK *compiled) { - compiled->last_scan = NURSERY; - compiled->needs_fixup = false; + compiled->block.last_scan = NURSERY; + compiled->block.needs_fixup = false; iterate_relocations(compiled,relocate_code_block_step); flush_icache_for(compiled); } @@ -411,9 +411,9 @@ F_CODE_BLOCK *add_code_block( UNREGISTER_ROOT(literals); /* compiled header */ - compiled->type = type; - compiled->last_scan = NURSERY; - compiled->needs_fixup = true; + compiled->block.type = type; + compiled->block.last_scan = NURSERY; + compiled->block.needs_fixup = true; compiled->literals = literals; compiled->relocation = relocation; diff --git a/vm/code_heap.c b/vm/code_heap.c index 89e6ceacfc..65a28c6de3 100755 --- a/vm/code_heap.c +++ b/vm/code_heap.c @@ -14,7 +14,7 @@ bool in_code_heap_p(CELL ptr) void set_word_code(F_WORD *word, F_CODE_BLOCK *compiled) { - if(compiled->type != WORD_TYPE) + if(compiled->block.type != WORD_TYPE) critical_error("bad param to set_word_xt",(CELL)compiled); word->code = compiled; diff --git a/vm/layouts.h b/vm/layouts.h index 95aa3c19b1..e9cdef6272 100755 --- a/vm/layouts.h +++ b/vm/layouts.h @@ -111,7 +111,10 @@ typedef enum typedef struct _F_BLOCK { - F_BLOCK_STATUS status; + char status; /* free or allocated? */ + char type; /* this is WORD_TYPE or QUOTATION_TYPE */ + char last_scan; /* the youngest generation in which this block's literals may live */ + char needs_fixup; /* is this a new block that needs full fixup? */ /* In bytes, includes this header */ CELL size; @@ -131,9 +134,6 @@ typedef struct _F_FREE_BLOCK typedef struct { F_BLOCK block; - char type; /* this is WORD_TYPE or QUOTATION_TYPE */ - char last_scan; /* the youngest generation in which this block's literals may live */ - char needs_fixup; /* is this a new block that needs full fixup? */ CELL literals; /* # bytes */ CELL relocation; /* tagged pointer to byte-array or f */ } F_CODE_BLOCK; diff --git a/vm/quotations.c b/vm/quotations.c index cc501e1fdc..4df45eba54 100755 --- a/vm/quotations.c +++ b/vm/quotations.c @@ -157,7 +157,7 @@ bool jit_stack_frame_p(F_ARRAY *array) void set_quot_xt(F_QUOTATION *quot, F_CODE_BLOCK *code) { - if(code->type != QUOTATION_TYPE) + if(code->block.type != QUOTATION_TYPE) critical_error("Bad param to set_quot_xt",(CELL)code); quot->code = code;