Signed-off-by: Tomek Grabiec <[email protected]>
---
test/arch-x86/emit-code-test_32.c | 6 ++++--
test/arch-x86/stack-frame-test_32.c | 12 +++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/test/arch-x86/emit-code-test_32.c
b/test/arch-x86/emit-code-test_32.c
index 06cd9ba..45dca00 100644
--- a/test/arch-x86/emit-code-test_32.c
+++ b/test/arch-x86/emit-code-test_32.c
@@ -30,6 +30,8 @@ DECLARE_STATIC_REG(VAR_EDX, MACH_REG_EDX);
DECLARE_STATIC_REG(VAR_EBP, MACH_REG_EBP);
DECLARE_STATIC_REG(VAR_ESP, MACH_REG_ESP);
+#define ARG_OFFSET(arg) (offsetof(struct jit_stack_frame, args) + sizeof(long)
* (arg))
+
static void assert_emit_insn(unsigned char *expected,
unsigned long expected_size,
struct insn *insn)
@@ -240,8 +242,8 @@ void test_emit_mov_reg_memlocal(void)
slot = get_local_slot(frame, 0);
wide_slot = get_local_slot(frame, 31);
- assert_emit_insn_3(0x89, 0x45, 0x14,
reg_memlocal_insn(INSN_MOV_REG_MEMLOCAL, &VAR_EAX, slot));
- assert_emit_insn_6(0x89, 0x9d, 0x90, 0x00, 0x00, 0x00,
reg_memlocal_insn(INSN_MOV_REG_MEMLOCAL, &VAR_EBX, wide_slot));
+ assert_emit_insn_3(0x89, 0x45, ARG_OFFSET(0),
reg_memlocal_insn(INSN_MOV_REG_MEMLOCAL, &VAR_EAX, slot));
+ assert_emit_insn_6(0x89, 0x9d, ARG_OFFSET(31), 0x00, 0x00, 0x00,
reg_memlocal_insn(INSN_MOV_REG_MEMLOCAL, &VAR_EBX, wide_slot));
free_stack_frame(frame);
}
diff --git a/test/arch-x86/stack-frame-test_32.c
b/test/arch-x86/stack-frame-test_32.c
index 1ba4757..d62487f 100644
--- a/test/arch-x86/stack-frame-test_32.c
+++ b/test/arch-x86/stack-frame-test_32.c
@@ -8,6 +8,8 @@
#include <stdlib.h>
#include <libharness.h>
+#define ARG_OFFSET(arg) (offsetof(struct jit_stack_frame, args) + sizeof(long)
* (arg))
+
/* Stub required by called_from_jit_trampoline() in arch/x86/stack-frame.c */
void *jit_magic_trampoline(struct compilation_unit *cu)
{
@@ -25,13 +27,13 @@ static void assert_local_offset(unsigned long expected,
struct expression *local
void test_should_map_local_index_to_frame_offset(void)
{
- assert_local_offset(20, local_expr(J_INT, 0), 2);
- assert_local_offset(24, local_expr(J_INT, 1), 2);
+ assert_local_offset(ARG_OFFSET(0), local_expr(J_INT, 0), 2);
+ assert_local_offset(ARG_OFFSET(1), local_expr(J_INT, 1), 2);
}
void test_should_map_local_variables_after_last_arg_at_negative_offsets(void)
{
- assert_local_offset(20, local_expr(J_INT, 0), 1);
+ assert_local_offset(ARG_OFFSET(0), local_expr(J_INT, 0), 1);
assert_local_offset(-4, local_expr(J_INT, 1), 1);
assert_local_offset(-8, local_expr(J_INT, 2), 1);
}
@@ -49,8 +51,8 @@ void test_arguments_are_at_successive_positive_offsets(void)
param1 = get_local_slot(frame, 0);
param2 = get_local_slot(frame, 1);
- assert_int_equals(0x14, slot_offset(param1));
- assert_int_equals(0x18, slot_offset(param2));
+ assert_int_equals(ARG_OFFSET(0), slot_offset(param1));
+ assert_int_equals(ARG_OFFSET(1), slot_offset(param2));
free_stack_frame(frame);
}
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel