Small size reduction for deployed images
parent
1dfa621f4d
commit
39b53817b9
|
@ -53,7 +53,7 @@ SYMBOL: labels
|
||||||
V{ } clone literal-table set
|
V{ } clone literal-table set
|
||||||
V{ } clone calls set
|
V{ } clone calls set
|
||||||
compiling-word set
|
compiling-word set
|
||||||
compiled-stack-traces? compiling-word get f ? add-literal ;
|
compiled-stack-traces? [ compiling-word get add-literal ] when ;
|
||||||
|
|
||||||
: generate ( mr -- asm )
|
: generate ( mr -- asm )
|
||||||
[
|
[
|
||||||
|
|
|
@ -103,7 +103,7 @@ CELL frame_type(F_STACK_FRAME *frame)
|
||||||
CELL frame_executing(F_STACK_FRAME *frame)
|
CELL frame_executing(F_STACK_FRAME *frame)
|
||||||
{
|
{
|
||||||
F_CODE_BLOCK *compiled = frame_code(frame);
|
F_CODE_BLOCK *compiled = frame_code(frame);
|
||||||
if(compiled->literals == F)
|
if(compiled->literals == F || !stack_traces_p())
|
||||||
return F;
|
return F;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ void iterate_relocations(F_CODE_BLOCK *compiled, RELOCATION_ITERATOR iter)
|
||||||
{
|
{
|
||||||
F_BYTE_ARRAY *relocation = untag_object(compiled->relocation);
|
F_BYTE_ARRAY *relocation = untag_object(compiled->relocation);
|
||||||
|
|
||||||
CELL index = 1;
|
CELL index = stack_traces_p() ? 1 : 0;
|
||||||
|
|
||||||
F_REL *rel = (F_REL *)(relocation + 1);
|
F_REL *rel = (F_REL *)(relocation + 1);
|
||||||
F_REL *rel_end = (F_REL *)((char *)rel + byte_array_capacity(relocation));
|
F_REL *rel_end = (F_REL *)((char *)rel + byte_array_capacity(relocation));
|
||||||
|
@ -368,11 +368,6 @@ void deposit_integers(CELL here, F_ARRAY *array, CELL format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool stack_traces_p(void)
|
|
||||||
{
|
|
||||||
return to_boolean(userenv[STACK_TRACES_ENV]);
|
|
||||||
}
|
|
||||||
|
|
||||||
CELL compiled_code_format(void)
|
CELL compiled_code_format(void)
|
||||||
{
|
{
|
||||||
return untag_fixnum_fast(userenv[JIT_CODE_FORMAT]);
|
return untag_fixnum_fast(userenv[JIT_CODE_FORMAT]);
|
||||||
|
@ -429,6 +424,10 @@ F_CODE_BLOCK *add_code_block(
|
||||||
UNREGISTER_ROOT(relocation);
|
UNREGISTER_ROOT(relocation);
|
||||||
UNREGISTER_ROOT(literals);
|
UNREGISTER_ROOT(literals);
|
||||||
|
|
||||||
|
/* slight space optimization */
|
||||||
|
if(type_of(literals) == ARRAY_TYPE && array_capacity(untag_object(literals)) == 0)
|
||||||
|
literals = F;
|
||||||
|
|
||||||
/* compiled header */
|
/* compiled header */
|
||||||
compiled->block.type = type;
|
compiled->block.type = type;
|
||||||
compiled->block.last_scan = NURSERY;
|
compiled->block.last_scan = NURSERY;
|
||||||
|
|
|
@ -75,7 +75,10 @@ void relocate_code_block(F_CODE_BLOCK *relocating);
|
||||||
|
|
||||||
CELL compiled_code_format(void);
|
CELL compiled_code_format(void);
|
||||||
|
|
||||||
bool stack_traces_p(void);
|
INLINE bool stack_traces_p(void)
|
||||||
|
{
|
||||||
|
return userenv[STACK_TRACES_ENV] != F;
|
||||||
|
}
|
||||||
|
|
||||||
F_CODE_BLOCK *add_code_block(
|
F_CODE_BLOCK *add_code_block(
|
||||||
CELL type,
|
CELL type,
|
||||||
|
|
11
vm/debug.c
11
vm/debug.c
|
@ -311,7 +311,7 @@ void find_data_references(CELL look_for_)
|
||||||
/* Dump all code blocks for debugging */
|
/* Dump all code blocks for debugging */
|
||||||
void dump_code_heap(void)
|
void dump_code_heap(void)
|
||||||
{
|
{
|
||||||
CELL size = 0;
|
CELL reloc_size = 0, literal_size = 0;
|
||||||
|
|
||||||
F_BLOCK *scan = first_block(&code_heap);
|
F_BLOCK *scan = first_block(&code_heap);
|
||||||
|
|
||||||
|
@ -324,11 +324,13 @@ void dump_code_heap(void)
|
||||||
status = "free";
|
status = "free";
|
||||||
break;
|
break;
|
||||||
case B_ALLOCATED:
|
case B_ALLOCATED:
|
||||||
size += object_size(((F_CODE_BLOCK *)scan)->relocation);
|
reloc_size += object_size(((F_CODE_BLOCK *)scan)->relocation);
|
||||||
|
literal_size += object_size(((F_CODE_BLOCK *)scan)->literals);
|
||||||
status = "allocated";
|
status = "allocated";
|
||||||
break;
|
break;
|
||||||
case B_MARKED:
|
case B_MARKED:
|
||||||
size += object_size(((F_CODE_BLOCK *)scan)->relocation);
|
reloc_size += object_size(((F_CODE_BLOCK *)scan)->relocation);
|
||||||
|
literal_size += object_size(((F_CODE_BLOCK *)scan)->literals);
|
||||||
status = "marked";
|
status = "marked";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -343,7 +345,8 @@ void dump_code_heap(void)
|
||||||
scan = next_block(&code_heap,scan);
|
scan = next_block(&code_heap,scan);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_cell(size); print_string(" bytes of relocation data\n");
|
print_cell(reloc_size); print_string(" bytes of relocation data\n");
|
||||||
|
print_cell(literal_size); print_string(" bytes of literal data\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void factorbug(void)
|
void factorbug(void)
|
||||||
|
|
|
@ -180,7 +180,8 @@ void jit_compile(CELL quot, bool relocate)
|
||||||
GROWABLE_ARRAY(literals);
|
GROWABLE_ARRAY(literals);
|
||||||
REGISTER_ROOT(literals);
|
REGISTER_ROOT(literals);
|
||||||
|
|
||||||
GROWABLE_ARRAY_ADD(literals,stack_traces_p() ? quot : F);
|
if(stack_traces_p())
|
||||||
|
GROWABLE_ARRAY_ADD(literals,quot);
|
||||||
|
|
||||||
bool stack_frame = jit_stack_frame_p(untag_object(array));
|
bool stack_frame = jit_stack_frame_p(untag_object(array));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue