]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix 64-bit build issue; relocation entries are 32-bit on all platforms
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 20 Mar 2009 04:21:32 +0000 (23:21 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 20 Mar 2009 04:21:32 +0000 (23:21 -0500)
vm/code_block.c
vm/code_block.h
vm/profiler.c
vm/quotations.c

index 7cfadbbefb7684e8f39e84c0d78eb8c4acc99cfa..a9b5277c840b668b35d9291715093b0b7dc6ebe9 100644 (file)
@@ -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);
index e3668108dab75b623879a5339ccf1d71fb50c68d..b00e4be8b6f7f6ce48a93387d266a20fea402a9d 100644 (file)
@@ -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);
 
index b87a241f7d294922240515d76c9da43aef39a8a3..acafecdff5d3cb20c02c811fb5f9361e1648d26a 100755 (executable)
@@ -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);
index b65f8de27cc29dd607e24208435a3ceb81926a97..86e47745b789ff908c63a6459181f79ac52d1711 100755 (executable)
@@ -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)); \
        }