aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>2012-01-28 13:42:33 +0200
committerPekka Enberg <penberg@kernel.org>2012-01-28 22:19:45 +0200
commited365549dc57bcab3ce3dc2f9ffcd11d5acf1bd4 (patch)
treea0aeeae8a28a1afa61d361a699a6725c12a3267d
parenta995d80739c151ff34915e37f903fd12bc4b2332 (diff)
downloadjato-ed365549dc57bcab3ce3dc2f9ffcd11d5acf1bd4.tar.gz
jit: pass the frame size to emit_lock_this() and its counterpart
Let these emitters know the frame size in case we need to recover *this in a non-trivial way. Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro> Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r--arch/arm/emit-code.c4
-rw-r--r--arch/ppc/emit-code.c4
-rw-r--r--arch/x86/emit_32.c4
-rw-r--r--arch/x86/emit_64.c4
-rw-r--r--include/jit/emit-code.h4
-rw-r--r--jit/emit.c16
6 files changed, 19 insertions, 17 deletions
diff --git a/arch/arm/emit-code.c b/arch/arm/emit-code.c
index b8689c0b..0d696827 100644
--- a/arch/arm/emit-code.c
+++ b/arch/arm/emit-code.c
@@ -98,7 +98,7 @@ void emit_unlock(struct buffer *buffer, struct vm_object *vo)
assert(!"not implemented");
}
-void emit_unlock_this(struct buffer *buffer)
+void emit_unlock_this(struct buffer *buffer, unsigned long frame_size)
{
assert(!"not implemented");
}
@@ -176,7 +176,7 @@ void emit_lock(struct buffer *buf, struct vm_object *vo)
assert(!"not implemented");
}
-void emit_lock_this(struct buffer *buf)
+void emit_lock_this(struct buffer *buf, unsigned long frame_size)
{
assert(!"not implemented");
}
diff --git a/arch/ppc/emit-code.c b/arch/ppc/emit-code.c
index c548bc8c..73ab42b5 100644
--- a/arch/ppc/emit-code.c
+++ b/arch/ppc/emit-code.c
@@ -132,7 +132,7 @@ void emit_unlock(struct buffer *buffer, struct vm_object *vo)
assert(!"not implemented");
}
-void emit_unlock_this(struct buffer *buffer)
+void emit_unlock_this(struct buffer *buffer, unsigned long frame_size)
{
assert(!"not implemented");
}
@@ -161,7 +161,7 @@ void emit_lock(struct buffer *buf, struct vm_object *vo)
assert(!"not implemented");
}
-void emit_lock_this(struct buffer *buf)
+void emit_lock_this(struct buffer *buf, unsigned long frame_size)
{
assert(!"not implemented");
}
diff --git a/arch/x86/emit_32.c b/arch/x86/emit_32.c
index c3bd776e..40004c06 100644
--- a/arch/x86/emit_32.c
+++ b/arch/x86/emit_32.c
@@ -987,7 +987,7 @@ void emit_unlock(struct buffer *buf, struct vm_object *obj)
__emit_pop_reg(buf, MACH_REG_EAX);
}
-void emit_lock_this(struct buffer *buf)
+void emit_lock_this(struct buffer *buf, unsigned long frame_size)
{
unsigned long this_arg_offset;
@@ -1002,7 +1002,7 @@ void emit_lock_this(struct buffer *buf)
__emit_pop_reg(buf, MACH_REG_EAX);
}
-void emit_unlock_this(struct buffer *buf)
+void emit_unlock_this(struct buffer *buf, unsigned long frame_size)
{
unsigned long this_arg_offset;
diff --git a/arch/x86/emit_64.c b/arch/x86/emit_64.c
index 67982bc5..b150f499 100644
--- a/arch/x86/emit_64.c
+++ b/arch/x86/emit_64.c
@@ -1397,7 +1397,7 @@ void emit_unlock(struct buffer *buf, struct vm_object *obj)
__emit_pop_reg(buf, MACH_REG_RAX);
}
-void emit_lock_this(struct buffer *buf)
+void emit_lock_this(struct buffer *buf, unsigned long frame_size)
{
__emit64_mov_membase_reg(buf, MACH_REG_RSP, 0x00, MACH_REG_RDI);
emit_save_regparm(buf);
@@ -1409,7 +1409,7 @@ void emit_lock_this(struct buffer *buf)
__emit_pop_reg(buf, MACH_REG_RAX);
}
-void emit_unlock_this(struct buffer *buf)
+void emit_unlock_this(struct buffer *buf, unsigned long frame_size)
{
__emit64_mov_membase_reg(buf, MACH_REG_RSP, 0x00, MACH_REG_RDI);
__emit_push_reg(buf, MACH_REG_RAX);
diff --git a/include/jit/emit-code.h b/include/jit/emit-code.h
index 2a74a409..feedecdf 100644
--- a/include/jit/emit-code.h
+++ b/include/jit/emit-code.h
@@ -18,9 +18,9 @@ extern void emit_epilog(struct buffer *);
extern void emit_trampoline(struct compilation_unit *, void *, struct jit_trampoline *);
extern void emit_unwind(struct buffer *);
extern void emit_lock(struct buffer *, struct vm_object *);
-extern void emit_lock_this(struct buffer *);
+extern void emit_lock_this(struct buffer *, unsigned long);
extern void emit_unlock(struct buffer *, struct vm_object *);
-extern void emit_unlock_this(struct buffer *);
+extern void emit_unlock_this(struct buffer *, unsigned long);
extern void emit_body(struct basic_block *, struct buffer *);
extern void emit_insn(struct buffer *, struct basic_block *, struct insn *);
extern void emit_nop(struct buffer *buf);
diff --git a/jit/emit.c b/jit/emit.c
index e4342d9d..dbb61cea 100644
--- a/jit/emit.c
+++ b/jit/emit.c
@@ -34,20 +34,22 @@
bool opt_debug_stack;
-static void emit_monitorenter(struct compilation_unit *cu)
+static void emit_monitorenter(struct compilation_unit *cu,
+ unsigned long frame_size)
{
if (vm_method_is_static(cu->method))
emit_lock(cu->objcode, cu->method->class->object);
else
- emit_lock_this(cu->objcode);
+ emit_lock_this(cu->objcode, frame_size);
}
-static void emit_monitorexit(struct compilation_unit *cu)
+static void emit_monitorexit(struct compilation_unit *cu,
+ unsigned long frame_size)
{
if (vm_method_is_static(cu->method))
emit_unlock(cu->objcode, cu->method->class->object);
else
- emit_unlock_this(cu->objcode);
+ emit_unlock_this(cu->objcode, frame_size);
}
static void backpatch_tableswitch(struct tableswitch *table)
@@ -209,7 +211,7 @@ int emit_machine_code(struct compilation_unit *cu)
emit_prolog(cu->objcode, cu->stack_frame, frame_size);
if (method_is_synchronized(cu->method))
- emit_monitorenter(cu);
+ emit_monitorenter(cu, frame_size);
if (opt_trace_invoke)
emit_trace_invoke(cu->objcode, cu);
@@ -219,13 +221,13 @@ int emit_machine_code(struct compilation_unit *cu)
emit_body(cu->exit_bb, cu->objcode);
if (method_is_synchronized(cu->method))
- emit_monitorexit(cu);
+ emit_monitorexit(cu, frame_size);
cu->exit_past_unlock_ptr = buffer_current(cu->objcode);
emit_epilog(cu->objcode);
emit_body(cu->unwind_bb, cu->objcode);
if (method_is_synchronized(cu->method))
- emit_monitorexit(cu);
+ emit_monitorexit(cu, frame_size);
cu->unwind_past_unlock_ptr = buffer_current(cu->objcode);
emit_unwind(cu->objcode);