5 /* arg is a primitive number */
7 /* arg is a literal table index, holding an array pair (symbol/dll) */
9 /* a pointer to a compiled word reference */
11 /* a word or quotation's general entry point */
13 /* a word's PIC entry point */
15 /* a word's tail-call PIC entry point */
19 /* current code block */
21 /* immediate literal */
23 /* address of stack_chain var */
25 /* untagged fixnum literal */
27 /* address of megamorphic_cache_hits var */
28 RT_MEGAMORPHIC_CACHE_HITS,
29 /* address of vm object */
33 enum relocation_class {
34 /* absolute address in a 64-bit location */
36 /* absolute address in a 32-bit location */
38 /* relative address in a 32-bit location */
40 /* absolute address in a PowerPC LIS/ORI sequence */
42 /* absolute address in a PowerPC LWZ instruction */
44 /* relative address in a PowerPC LWZ/STW/BC instruction */
46 /* relative address in a PowerPC B/BL instruction */
48 /* relative address in an ARM B/BL instruction */
50 /* pointer to address in an ARM LDR/STR instruction */
52 /* pointer to address in an ARM LDR/STR instruction offset by 8 bytes */
56 static const cell rel_absolute_ppc_2_mask = 0xffff;
57 static const cell rel_relative_ppc_2_mask = 0xfffc;
58 static const cell rel_relative_ppc_3_mask = 0x3fffffc;
59 static const cell rel_indirect_arm_mask = 0xfff;
60 static const cell rel_relative_arm_3_mask = 0xffffff;
62 /* code relocation table consists of a table of entries for each fixup */
63 typedef u32 relocation_entry;
67 typedef void (*relocation_iterator)(relocation_entry rel, cell index, code_block *compiled, factorvm *vm);
70 void relocate_code_block(code_block *compiled, factorvm *myvm);
71 void copy_literal_references(code_block *compiled, factorvm *myvm);
72 void update_word_references(code_block *compiled, factorvm *myvm);
73 void update_literal_and_word_references(code_block *compiled, factorvm *myvm);