This implements emit_lock() and other closely related functions. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro> --- arch/x86/emit-code.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c index 7b1f506..3d56581 100644 --- a/arch/x86/emit-code.c +++ b/arch/x86/emit-code.c @@ -2988,6 +2988,62 @@ void emit_trampoline(struct compilation_unit *cu, jit_text_unlock(); } +void emit_lock(struct buffer *buf, struct vm_object *obj) +{ + emit_save_regparm(buf); + + __emit64_mov_imm_reg(buf, (unsigned long) obj, MACH_REG_RDI); + __emit_call(buf, vm_object_lock); + + emit_restore_regparm(buf); + + __emit64_push_reg(buf, MACH_REG_RAX); + emit_exception_test(buf, MACH_REG_RAX); + __emit64_pop_reg(buf, MACH_REG_RAX); +} + +void emit_unlock(struct buffer *buf, struct vm_object *obj) +{ + __emit64_push_reg(buf, MACH_REG_RAX); + emit_save_regparm(buf); + + __emit64_mov_imm_reg(buf, (unsigned long) obj, MACH_REG_RDI); + __emit_call(buf, vm_object_unlock); + + emit_exception_test(buf, MACH_REG_RAX); + + emit_restore_regparm(buf); + __emit64_pop_reg(buf, MACH_REG_RAX); +} + +void emit_lock_this(struct buffer *buf) +{ + emit_save_regparm(buf); + + /* %rdi already contains *this. */ + __emit_call(buf, vm_object_lock); + + emit_restore_regparm(buf); + + __emit_push_reg(buf, MACH_REG_RAX); + emit_exception_test(buf, MACH_REG_RAX); + __emit_pop_reg(buf, MACH_REG_RAX); +} + +void emit_unlock_this(struct buffer *buf) +{ + __emit_push_reg(buf, MACH_REG_RAX); + emit_save_regparm(buf); + + /* %rdi already contains *this. */ + __emit_call(buf, vm_object_unlock); + + emit_exception_test(buf, MACH_REG_RAX); + + emit_restore_regparm(buf); + __emit_pop_reg(buf, MACH_REG_RAX); +} + void *emit_itable_resolver_stub(struct vm_class *vmc, struct itable_entry **table, unsigned int nr_entries) -- 1.6.0.6 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel