Fix 64-bit build issue; relocation entries are 32-bit on all platforms
parent
ae09d85d84
commit
2a7848053f
|
@ -13,8 +13,8 @@ void iterate_relocations(F_CODE_BLOCK *compiled, RELOCATION_ITERATOR iter)
|
|||
|
||||
CELL index = 1;
|
||||
|
||||
CELL *rel = (CELL *)(relocation + 1);
|
||||
CELL *rel_end = (CELL *)((char *)rel + byte_array_capacity(relocation));
|
||||
F_REL *rel = (F_REL *)(relocation + 1);
|
||||
F_REL *rel_end = (F_REL *)((char *)rel + byte_array_capacity(relocation));
|
||||
|
||||
while(rel < rel_end)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ void store_address_in_code_block(CELL class, CELL offset, F_FIXNUM absolute_valu
|
|||
}
|
||||
}
|
||||
|
||||
void update_literal_references_step(CELL rel, CELL index, F_CODE_BLOCK *compiled)
|
||||
void update_literal_references_step(F_REL rel, CELL index, F_CODE_BLOCK *compiled)
|
||||
{
|
||||
if(REL_TYPE(rel) == RT_IMMEDIATE)
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ CELL object_xt(CELL obj)
|
|||
return (CELL)untag_quotation(obj)->xt;
|
||||
}
|
||||
|
||||
void update_word_references_step(CELL rel, CELL index, F_CODE_BLOCK *compiled)
|
||||
void update_word_references_step(F_REL rel, CELL index, F_CODE_BLOCK *compiled)
|
||||
{
|
||||
if(REL_TYPE(rel) == RT_XT)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ void *get_rel_symbol(F_ARRAY *literals, CELL index)
|
|||
}
|
||||
|
||||
/* Compute an address to store at a relocation */
|
||||
void relocate_code_block_step(CELL rel, CELL index, F_CODE_BLOCK *compiled)
|
||||
void relocate_code_block_step(F_REL rel, CELL index, F_CODE_BLOCK *compiled)
|
||||
{
|
||||
CELL offset = REL_OFFSET(rel) + (CELL)(compiled + 1);
|
||||
F_ARRAY *literals = untag_object(compiled->literals);
|
||||
|
|
|
@ -44,13 +44,14 @@ typedef enum {
|
|||
#define REL_RELATIVE_ARM_3_MASK 0xffffff
|
||||
|
||||
/* code relocation table consists of a table of entries for each fixup */
|
||||
typedef u32 F_REL;
|
||||
#define REL_TYPE(r) (((r) & 0xf0000000) >> 28)
|
||||
#define REL_CLASS(r) (((r) & 0x0f000000) >> 24)
|
||||
#define REL_OFFSET(r) ((r) & 0x00ffffff)
|
||||
|
||||
void flush_icache_for(F_CODE_BLOCK *compiled);
|
||||
|
||||
typedef void (*RELOCATION_ITERATOR)(CELL rel, CELL index, F_CODE_BLOCK *compiled);
|
||||
typedef void (*RELOCATION_ITERATOR)(F_REL rel, CELL index, F_CODE_BLOCK *compiled);
|
||||
|
||||
void iterate_relocations(F_CODE_BLOCK *compiled, RELOCATION_ITERATOR iter);
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ F_CODE_BLOCK *compile_profiling_stub(F_WORD *word)
|
|||
CELL code = array_nth(quadruple,0);
|
||||
REGISTER_ROOT(code);
|
||||
|
||||
CELL rel = (to_fixnum(array_nth(quadruple,1)) << 24)
|
||||
F_REL rel = (to_fixnum(array_nth(quadruple,1)) << 24)
|
||||
| (to_fixnum(array_nth(quadruple,2)) << 28)
|
||||
| (to_fixnum(array_nth(quadruple,3)) * compiled_code_format());
|
||||
|
||||
F_BYTE_ARRAY *relocation = allot_byte_array(sizeof(CELL));
|
||||
memcpy(relocation + 1,&rel,sizeof(CELL));
|
||||
F_BYTE_ARRAY *relocation = allot_byte_array(sizeof(F_REL));
|
||||
memcpy(relocation + 1,&rel,sizeof(F_REL));
|
||||
|
||||
UNREGISTER_ROOT(code);
|
||||
UNREGISTER_ROOT(literals);
|
||||
|
|
|
@ -94,7 +94,7 @@ F_ARRAY *code_to_emit(CELL code)
|
|||
return untag_object(array_nth(untag_object(code),0));
|
||||
}
|
||||
|
||||
CELL rel_to_emit(CELL code, CELL code_format, CELL code_length, bool *rel_p)
|
||||
F_REL rel_to_emit(CELL code, CELL code_format, CELL code_length, bool *rel_p)
|
||||
{
|
||||
F_ARRAY *quadruple = untag_object(code);
|
||||
CELL rel_class = array_nth(quadruple,1);
|
||||
|
@ -117,8 +117,8 @@ CELL rel_to_emit(CELL code, CELL code_format, CELL code_length, bool *rel_p)
|
|||
|
||||
#define EMIT(name) { \
|
||||
bool rel_p; \
|
||||
CELL rel = rel_to_emit(name,code_format,code_count,&rel_p); \
|
||||
if(rel_p) GROWABLE_BYTE_ARRAY_APPEND(relocation,&rel,sizeof(CELL)); \
|
||||
F_REL rel = rel_to_emit(name,code_format,code_count,&rel_p); \
|
||||
if(rel_p) GROWABLE_BYTE_ARRAY_APPEND(relocation,&rel,sizeof(F_REL)); \
|
||||
GROWABLE_ARRAY_APPEND(code,code_to_emit(name)); \
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue