These two functions can be used by both x86 and x86-64, so we share
them.

Signed-off-by: Eduard - Gabriel Munteanu <[email protected]>
---
 arch/x86/emit-code.c |   92 +++++++++++++++++++++++++-------------------------
 1 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 9e9e7bf..a77178a 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -409,6 +409,52 @@ static void fixup_vtable(struct compilation_unit *cu,
        vmc->vtable.native_ptr[cu->method->virtual_index] = target;
 }
 
+int fixup_static(struct vm_class *vmc)
+{
+       struct static_fixup_site *this, *next;
+
+       if (vm_class_ensure_init(vmc))
+               return -1;
+
+       list_for_each_entry_safe(this, next,
+               &vmc->static_fixup_site_list, vmc_node)
+       {
+               struct vm_field *vmf = this->vmf;
+               void *site_addr = buffer_ptr(this->cu->objcode)
+                       + this->insn->mach_offset;
+               void *new_target = vmc->static_values + vmf->offset;
+
+               cpu_write_u32(site_addr + 2, (unsigned long) new_target);
+
+               list_del(&this->vmc_node);
+               list_del(&this->cu_node);
+               free(this);
+       }
+
+       return 0;
+}
+
+int fixup_static_at(unsigned long addr)
+{
+       struct compilation_unit *cu;
+       struct static_fixup_site *this;
+
+       cu = jit_lookup_cu(addr);
+       assert(cu);
+
+       list_for_each_entry(this, &cu->static_fixup_site_list, cu_node)
+       {
+               void *site_addr = buffer_ptr(cu->objcode)
+                       + this->insn->mach_offset;
+
+               if ((unsigned long) site_addr == addr) {
+                       return fixup_static(this->vmf->class);
+               }
+       }
+
+       return 0;
+}
+
 #ifdef CONFIG_X86_32
 
 /************************
@@ -1290,52 +1336,6 @@ struct emitter emitters[] = {
        DECL_EMITTER(INSN_XOR_XMM_REG_REG, emit_xor_xmm_reg_reg, TWO_OPERANDS),
 };
 
-int fixup_static(struct vm_class *vmc)
-{
-       struct static_fixup_site *this, *next;
-
-       if (vm_class_ensure_init(vmc))
-               return -1;
-
-       list_for_each_entry_safe(this, next,
-               &vmc->static_fixup_site_list, vmc_node)
-       {
-               struct vm_field *vmf = this->vmf;
-               void *site_addr = buffer_ptr(this->cu->objcode)
-                       + this->insn->mach_offset;
-               void *new_target = vmc->static_values + vmf->offset;
-
-               cpu_write_u32(site_addr + 2, (unsigned long) new_target);
-
-               list_del(&this->vmc_node);
-               list_del(&this->cu_node);
-               free(this);
-       }
-
-       return 0;
-}
-
-int fixup_static_at(unsigned long addr)
-{
-       struct compilation_unit *cu;
-       struct static_fixup_site *this;
-
-       cu = jit_lookup_cu(addr);
-       assert(cu);
-
-       list_for_each_entry(this, &cu->static_fixup_site_list, cu_node)
-       {
-               void *site_addr = buffer_ptr(cu->objcode)
-                       + this->insn->mach_offset;
-
-               if ((unsigned long) site_addr == addr) {
-                       return fixup_static(this->vmf->class);
-               }
-       }
-
-       return 0;
-}
-
 void emit_trampoline(struct compilation_unit *cu,
                     void *call_target,
                     struct jit_trampoline *trampoline)
-- 
1.6.0.6


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to