[penberg/jato] 80947d: mmix: set REG_UNASSIGNED to INT_MAX

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 80947df9bcade599edcc0c118d3f54f9d947784f

http://github.com/penberg/jato/commit/80947df9bcade599edcc0c118d3f54f9d947784f
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/mmix/include/arch/registers.h

Log Message:
---
mmix: set REG_UNASSIGNED to INT_MAX

Enumerations are 'int'-sized (by default) and GCC complains about the
use of ~0UL.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: 73cd4ea08c2d5be74b9c4d6acc91482937c1b65c

http://github.com/penberg/jato/commit/73cd4ea08c2d5be74b9c4d6acc91482937c1b65c
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M scripts/build/test.mk
  M test/jit/Makefile

Log Message:
---
Fix 'make test' breakage

This fixes breakage encountered when doing 'make test' on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: 9d2658f753f193c9af0598ad2145d05d00baaca9

http://github.com/penberg/jato/commit/9d2658f753f193c9af0598ad2145d05d00baaca9
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/args.c
  M include/jit/args.h
  M include/vm/method.h
  M jit/args.c

Log Message:
---
x86-64: add reg_args_count to struct vm_method

reg_args_count provides a faster way of determining how many stack and
register arguments a method takes.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: 5c8c5079abefbe713ea07ea0bb44676cb6c70b22

http://github.com/penberg/jato/commit/5c8c5079abefbe713ea07ea0bb44676cb6c70b22
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/insn-selector.brg

Log Message:
---
x86-64: handle local variables correctly

Previous implementation attempted to access the argument map for local
variables as well. We now determine if the local index refers to a local
variable and act accordingly.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: 0aaca09fe6983419a6f5f1afa818c4124f43a452

http://github.com/penberg/jato/commit/0aaca09fe6983419a6f5f1afa818c4124f43a452
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/disassemble.c

Log Message:
---
x86-64: fix disassembly listing

This adds support for proper disassembling of generated code on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: f5fbd6024d8b91d30fa0dd310a6185dac5aefb2c

http://github.com/penberg/jato/commit/f5fbd6024d8b91d30fa0dd310a6185dac5aefb2c
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/insn-selector.brg

Log Message:
---
x86-64: handle STMT_STORE(EXPR_LOCAL, reg)

This fixes handling of storing into local variables on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: 62a7adf840c5a841546f96db0a9ea8eab646f2f2

http://github.com/penberg/jato/commit/62a7adf840c5a841546f96db0a9ea8eab646f2f2
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/insn-selector.brg

Log Message:
---
x86-64: handle locals in EXPR_LOCAL

We determine if the local index refers to a local variable and do not
access the argument map if we shouldn't.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: cd432dfe3f05cd299b0317afbefea38450fef24e

http://github.com/penberg/jato/commit/cd432dfe3f05cd299b0317afbefea38450fef24e
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/insn-selector.brg

Log Message:
---
x86-64: use GPR_VM_TYPE in EXPR_NULL_CHECK

This fixes EXPR_NULL_CHECK by choosing a suitable vm type depending on
the architecture.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: 8020d80c98b4858ec3c434b841acbae60a3748fd

http://github.com/penberg/jato/commit/8020d80c98b4858ec3c434b841acbae60a3748fd
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/insn-selector.brg
  M arch/x86/use-def.c

Log Message:
---
x86-64: notify liveness analysis about caller saved registers

Liveness analysis needs to know about registers belonging to the caller
(such as those used to pass parameters, which can be modified by the
callee). This prevents the callee from messing up the data belonging to
the caller.

Signed-off-by: Eduard - Gabriel Munteanu 
Signed-off-by: Pekka Enberg 


Commit: 051a476683f908cbe288aa98abcee4c35fbb8ca4

http://github.com/penberg/jato/commit/051a476683f908cbe288aa98abcee4c35fbb8ca4
Author: Eduard - Gabriel Munteanu 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/emit-code.c

Log Message:
---
x86-64: fix membase insns

Re: [PATCH 13/30] x86-64: pass correct object reference to fixup_vtable()

2009-08-15 Thread Pekka Enberg
On Sat, 2009-08-15 at 18:55 +0200, Tomek Grabiec wrote:
> 2009/8/15 Eduard - Gabriel Munteanu :
> > The previous implementation passed an incorrect object reference to
> > fixup_vtable() from code generated by emit_trampoline(). That was
> > because *this gets passed by %rdi, not stack, on x86-64. Therefore, we
> > now make use of the saved %rdi to pass it to fixup_vtable().
> >
> > Signed-off-by: Eduard - Gabriel Munteanu 
> > ---
> >  arch/x86/emit-code.c |   15 +++
> >  1 files changed, 15 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
> > index 5dd4e68..b37 100644
> > --- a/arch/x86/emit-code.c
> > +++ b/arch/x86/emit-code.c
> > @@ -2920,6 +2920,21 @@ void emit_trampoline(struct compilation_unit *cu,
> >   MACH_REG_RCX);
> >__emit64_test_membase_reg(buf, MACH_REG_RCX, 0, MACH_REG_RCX);
> >
> > +   if (method_is_virtual(cu->method)) {
> > +   __emit64_push_reg(buf, MACH_REG_RAX);
> > +
> > +   /*
> > +* 0x30(%rsp) contains the %rdi passed
> > +* to the trampoline, which we pushed earlier.
> > +*/
> > +   __emit64_mov_imm_reg(buf, (unsigned long) cu, MACH_REG_RDI);
> > +   __emit64_mov_membase_reg(buf, MACH_REG_RSP, 0x30, 
> > MACH_REG_RSI);
> > +   __emit64_mov_reg_reg(buf, MACH_REG_RAX, MACH_REG_RDX);
> > +   __emit_call(buf, fixup_vtable);
> > +
> > +   __emit64_pop_reg(buf, MACH_REG_RAX);
> > +   }
> > +
> >__emit64_pop_reg(buf, MACH_REG_R9);
> >__emit64_pop_reg(buf, MACH_REG_R8);
> >__emit64_pop_reg(buf, MACH_REG_RCX);
> > --
> > 1.6.0.6
> 
> Since commit c0c9caa1c6a8c5f40fc1b4bb5026fc07e2a7ca2a
> we no longer pass object reference to fixup_vtable() so there is also no
> need to call it from trampoline. It is called from jit_magic_trampoline() now.

I skipped this patch for now as discussed with Tomek on IRC.

Pekka


--
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


Re: [PATCH 08/30] x86-64: use GPR_VM_TYPE in EXPR_NULL_CHECK

2009-08-15 Thread Tomek Grabiec
2009/8/15 Eduard - Gabriel Munteanu :
> This fixes EXPR_NULL_CHECK by choosing a suitable vm type depending on
> the architecture.
>
> Signed-off-by: Eduard - Gabriel Munteanu 
> ---
>  arch/x86/insn-selector.brg |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
> index 376ea0d..3220ba0 100644
> --- a/arch/x86/insn-selector.brg
> +++ b/arch/x86/insn-selector.brg
> @@ -1293,7 +1293,7 @@ reg:      EXPR_NULL_CHECK(EXPR_LOCAL)
>        struct expression *expr;
>        struct expression *local;
>
> -       reg = get_var(s->b_parent, J_INT);
> +       reg = get_var(s->b_parent, GPR_VM_TYPE);
>        state->reg1 = reg;
>
>        expr = to_expr(tree);
> --
> 1.6.0.6

I think we should use J_REFERENCE here, so that garbage collector will
know we're holding a reference here. With this in mind, it is clear that
we should not use GPR_VM_TYPE if we're not sure if register will
hold a refernce or not. A general solution is to use expr->vm_type as
register type.

-- 
Tomek Grabiec

--
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


Re: [PATCH 13/30] x86-64: pass correct object reference to fixup_vtable()

2009-08-15 Thread Tomek Grabiec
2009/8/15 Eduard - Gabriel Munteanu :
> The previous implementation passed an incorrect object reference to
> fixup_vtable() from code generated by emit_trampoline(). That was
> because *this gets passed by %rdi, not stack, on x86-64. Therefore, we
> now make use of the saved %rdi to pass it to fixup_vtable().
>
> Signed-off-by: Eduard - Gabriel Munteanu 
> ---
>  arch/x86/emit-code.c |   15 +++
>  1 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
> index 5dd4e68..b37 100644
> --- a/arch/x86/emit-code.c
> +++ b/arch/x86/emit-code.c
> @@ -2920,6 +2920,21 @@ void emit_trampoline(struct compilation_unit *cu,
>                           MACH_REG_RCX);
>        __emit64_test_membase_reg(buf, MACH_REG_RCX, 0, MACH_REG_RCX);
>
> +       if (method_is_virtual(cu->method)) {
> +               __emit64_push_reg(buf, MACH_REG_RAX);
> +
> +               /*
> +                * 0x30(%rsp) contains the %rdi passed
> +                * to the trampoline, which we pushed earlier.
> +                */
> +               __emit64_mov_imm_reg(buf, (unsigned long) cu, MACH_REG_RDI);
> +               __emit64_mov_membase_reg(buf, MACH_REG_RSP, 0x30, 
> MACH_REG_RSI);
> +               __emit64_mov_reg_reg(buf, MACH_REG_RAX, MACH_REG_RDX);
> +               __emit_call(buf, fixup_vtable);
> +
> +               __emit64_pop_reg(buf, MACH_REG_RAX);
> +       }
> +
>        __emit64_pop_reg(buf, MACH_REG_R9);
>        __emit64_pop_reg(buf, MACH_REG_R8);
>        __emit64_pop_reg(buf, MACH_REG_RCX);
> --
> 1.6.0.6

Since commit c0c9caa1c6a8c5f40fc1b4bb5026fc07e2a7ca2a
we no longer pass object reference to fixup_vtable() so there is also no
need to call it from trampoline. It is called from jit_magic_trampoline() now.


-- 
Tomek Grabiec

--
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


[PATCH 26/30] x86: move emit_lock() and friends back into non-common code

2009-08-15 Thread Eduard - Gabriel Munteanu
These functions cannot be shared between x86-32 and x86-64 code due to
different calling conventions. They generate code that calls functions
and, on x86-64, we need to pass arguments in registers.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/emit-code.c |  124 +-
 1 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index f20a0f0..96746b5 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -280,68 +280,6 @@ static void emit_jmp_branch(struct buffer *buf, struct 
basic_block *bb, struct i
__emit_branch(buf, bb, 0x00, 0xe9, insn);
 }
 
-void emit_lock(struct buffer *buf, struct vm_object *obj)
-{
-   __emit_push_imm(buf, (unsigned long)obj);
-   __emit_call(buf, vm_object_lock);
-   __emit_add_imm_reg(buf, PTR_SIZE, MACH_REG_xSP);
-
-   __emit_push_reg(buf, MACH_REG_xAX);
-   emit_exception_test(buf, MACH_REG_xAX);
-   __emit_pop_reg(buf, MACH_REG_xAX);
-}
-
-void emit_unlock(struct buffer *buf, struct vm_object *obj)
-{
-   /* Save caller-saved registers which contain method's return value */
-   __emit_push_reg(buf, MACH_REG_xAX);
-   __emit_push_reg(buf, MACH_REG_xDX);
-
-   __emit_push_imm(buf, (unsigned long)obj);
-   __emit_call(buf, vm_object_unlock);
-   __emit_add_imm_reg(buf, PTR_SIZE, MACH_REG_xSP);
-
-   emit_exception_test(buf, MACH_REG_xAX);
-
-   __emit_pop_reg(buf, MACH_REG_xDX);
-   __emit_pop_reg(buf, MACH_REG_xAX);
-}
-
-void emit_lock_this(struct buffer *buf)
-{
-   unsigned long this_arg_offset;
-
-   this_arg_offset = offsetof(struct jit_stack_frame, args);
-
-   __emit_push_membase(buf, MACH_REG_xBP, this_arg_offset);
-   __emit_call(buf, vm_object_lock);
-   __emit_add_imm_reg(buf, PTR_SIZE, MACH_REG_xSP);
-
-   __emit_push_reg(buf, MACH_REG_xAX);
-   emit_exception_test(buf, MACH_REG_xAX);
-   __emit_pop_reg(buf, MACH_REG_xAX);
-}
-
-void emit_unlock_this(struct buffer *buf)
-{
-   unsigned long this_arg_offset;
-
-   this_arg_offset = offsetof(struct jit_stack_frame, args);
-
-   /* Save caller-saved registers which contain method's return value */
-   __emit_push_reg(buf, MACH_REG_xAX);
-   __emit_push_reg(buf, MACH_REG_xDX);
-
-   __emit_push_membase(buf, MACH_REG_xBP, this_arg_offset);
-   __emit_call(buf, vm_object_unlock);
-   __emit_add_imm_reg(buf, PTR_SIZE, MACH_REG_xSP);
-
-   emit_exception_test(buf, MACH_REG_xAX);
-
-   __emit_pop_reg(buf, MACH_REG_xDX);
-   __emit_pop_reg(buf, MACH_REG_xAX);
-}
-
 void backpatch_branch_target(struct buffer *buf,
 struct insn *insn,
 unsigned long target_offset)
@@ -1957,6 +1895,68 @@ void emit_trampoline(struct compilation_unit *cu,
jit_text_unlock();
 }
 
+void emit_lock(struct buffer *buf, struct vm_object *obj)
+{
+   __emit_push_imm(buf, (unsigned long)obj);
+   __emit_call(buf, vm_object_lock);
+   __emit_add_imm_reg(buf, PTR_SIZE, MACH_REG_xSP);
+
+   __emit_push_reg(buf, MACH_REG_EAX);
+   emit_exception_test(buf, MACH_REG_EAX);
+   __emit_pop_reg(buf, MACH_REG_EAX);
+}
+
+void emit_unlock(struct buffer *buf, struct vm_object *obj)
+{
+   /* Save caller-saved registers which contain method's return value */
+   __emit_push_reg(buf, MACH_REG_EAX);
+   __emit_push_reg(buf, MACH_REG_EDX);
+
+   __emit_push_imm(buf, (unsigned long)obj);
+   __emit_call(buf, vm_object_unlock);
+   __emit_add_imm_reg(buf, PTR_SIZE, MACH_REG_ESP);
+
+   emit_exception_test(buf, MACH_REG_EAX);
+
+   __emit_pop_reg(buf, MACH_REG_EDX);
+   __emit_pop_reg(buf, MACH_REG_EAX);
+}
+
+void emit_lock_this(struct buffer *buf)
+{
+   unsigned long this_arg_offset;
+
+   this_arg_offset = offsetof(struct jit_stack_frame, args);
+
+   __emit_push_membase(buf, MACH_REG_EBP, this_arg_offset);
+   __emit_call(buf, vm_object_lock);
+   __emit_add_imm_reg(buf, PTR_SIZE, MACH_REG_ESP);
+
+   __emit_push_reg(buf, MACH_REG_EAX);
+   emit_exception_test(buf, MACH_REG_EAX);
+   __emit_pop_reg(buf, MACH_REG_EAX);
+}
+
+void emit_unlock_this(struct buffer *buf)
+{
+   unsigned long this_arg_offset;
+
+   this_arg_offset = offsetof(struct jit_stack_frame, args);
+
+   /* Save caller-saved registers which contain method's return value */
+   __emit_push_reg(buf, MACH_REG_EAX);
+   __emit_push_reg(buf, MACH_REG_EDX);
+
+   __emit_push_membase(buf, MACH_REG_EBP, this_arg_offset);
+   __emit_call(buf, vm_object_unlock);
+   __emit_add_imm_reg(buf, PTR_SIZE, MACH_REG_ESP);
+
+   emit_exception_test(buf, MACH_REG_EAX);
+
+   __emit_pop_reg(buf, MACH_REG_EDX);
+   __emit_pop_reg(buf, MACH_REG_EAX);
+}
+
 static void fixup_branch_target(uint8_t *target_p, void *target)
 {
long cur = (long) (target - (void *) target_

[PATCH 29/30] jit: silence x86-64 pointer cast warning in lookupswitch_pair_comp()

2009-08-15 Thread Eduard - Gabriel Munteanu
This silences a warning that surfaces on x86-64 due to casting a pointer
to an integer of a different size.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 jit/statement.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/jit/statement.c b/jit/statement.c
index 1010739..b9431a8 100644
--- a/jit/statement.c
+++ b/jit/statement.c
@@ -152,5 +152,5 @@ int lookupswitch_pair_comp(const void *key, const void 
*elem)
 {
const struct lookupswitch_pair *pair = elem;
 
-   return (int32_t)key - pair->match;
+   return (int32_t) ((intptr_t) key) - pair->match;
 }
-- 
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


[PATCH 30/30] x86-64: implement emit_exception_test()

2009-08-15 Thread Eduard - Gabriel Munteanu
This implements emit_exception_test() on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/emit-code.c |   16 +++-
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 3d56581..6319b2c 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -2585,11 +2585,6 @@ emit_mov_reg_membase(struct buffer *buf, struct operand 
*src,
   mach_reg(&dest->base_reg), dest->disp);
 }
 
-static void emit_exception_test(struct buffer *buf, enum machine_reg reg)
-{
-   /* FIXME: implement this! */
-}
-
 static void __emit_memdisp(struct buffer *buf,
   int rex_w,
   unsigned char opc,
@@ -2988,6 +2983,17 @@ void emit_trampoline(struct compilation_unit *cu,
jit_text_unlock();
 }
 
+static void emit_exception_test(struct buffer *buf, enum machine_reg reg)
+{
+   /* mov fs:(0xXXX), %reg */
+   emit(buf, 0x64);
+   __emit_memdisp_reg(buf, 1, 0x8b,
+   get_thread_local_offset(&exception_guard), reg);
+
+   /* test (%reg), %reg */
+   __emit64_test_membase_reg(buf, reg, 0, reg);
+}
+
 void emit_lock(struct buffer *buf, struct vm_object *obj)
 {
emit_save_regparm(buf);
-- 
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


[PATCH 28/30] x86-64: implement emit_lock() and friends

2009-08-15 Thread Eduard - Gabriel Munteanu
This implements emit_lock() and other closely related functions.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 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


[PATCH 27/30] x86-64: move saving and restoring parameter regs into separate functions

2009-08-15 Thread Eduard - Gabriel Munteanu
Other emitters need to save and restore parameter registers, so we split
this code from emit_trampoline() into separate functions.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/emit-code.c |   34 ++
 1 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 96746b5..7b1f506 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -2906,6 +2906,26 @@ static void emit_restore_regs(struct buffer *buf)
__emit_pop_reg(buf, MACH_REG_RBX);
 }
 
+static void emit_save_regparm(struct buffer *buf)
+{
+   __emit64_push_reg(buf, MACH_REG_RDI);
+   __emit64_push_reg(buf, MACH_REG_RSI);
+   __emit64_push_reg(buf, MACH_REG_RDX);
+   __emit64_push_reg(buf, MACH_REG_RCX);
+   __emit64_push_reg(buf, MACH_REG_R8);
+   __emit64_push_reg(buf, MACH_REG_R9);
+}
+
+static void emit_restore_regparm(struct buffer *buf)
+{
+   __emit64_pop_reg(buf, MACH_REG_R9);
+   __emit64_pop_reg(buf, MACH_REG_R8);
+   __emit64_pop_reg(buf, MACH_REG_RCX);
+   __emit64_pop_reg(buf, MACH_REG_RDX);
+   __emit64_pop_reg(buf, MACH_REG_RSI);
+   __emit64_pop_reg(buf, MACH_REG_RDI);
+}
+
 void emit_trampoline(struct compilation_unit *cu,
 void *call_target,
 struct jit_trampoline *trampoline)
@@ -2925,12 +2945,7 @@ void emit_trampoline(struct compilation_unit *cu,
 * %rdi, %rsi, %rdx, %rcx, %r8 and %r9 are used
 * to pass parameters, so save them if they get modified.
 */
-   __emit64_push_reg(buf, MACH_REG_RDI);
-   __emit64_push_reg(buf, MACH_REG_RSI);
-   __emit64_push_reg(buf, MACH_REG_RDX);
-   __emit64_push_reg(buf, MACH_REG_RCX);
-   __emit64_push_reg(buf, MACH_REG_R8);
-   __emit64_push_reg(buf, MACH_REG_R9);
+   emit_save_regparm(buf);
 
__emit64_mov_imm_reg(buf, (unsigned long) cu, MACH_REG_RDI);
__emit_call(buf, call_target);
@@ -2964,12 +2979,7 @@ void emit_trampoline(struct compilation_unit *cu,
__emit64_pop_reg(buf, MACH_REG_RAX);
}
 
-   __emit64_pop_reg(buf, MACH_REG_R9);
-   __emit64_pop_reg(buf, MACH_REG_R8);
-   __emit64_pop_reg(buf, MACH_REG_RCX);
-   __emit64_pop_reg(buf, MACH_REG_RDX);
-   __emit64_pop_reg(buf, MACH_REG_RSI);
-   __emit64_pop_reg(buf, MACH_REG_RDI);
+   emit_restore_regparm(buf);
 
__emit64_pop_reg(buf, MACH_REG_RBP);
emit_indirect_jump_reg(buf, MACH_REG_RAX);
-- 
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


[PATCH 25/30] x86-64: implement INSN_TEST_IMM_MEMDISP

2009-08-15 Thread Eduard - Gabriel Munteanu
This implements emitters for INSN_TEST_IMM_MEMDISP.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/emit-code.c |   29 +
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 440a63a..f20a0f0 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -2817,6 +2817,34 @@ static void emit_indirect_call(struct buffer *buf, 
struct operand *operand)
emit(buf, encode_modrm(0x0, 0x2, reg));
 }
 
+static void __emit_test_imm_memdisp(struct buffer *buf,
+   int rex_w,
+   long imm,
+   long disp)
+{
+   /* XXX: Supports only byte or long imms */
+
+   if (rex_w)
+   emit(buf, REX_W);
+
+   if (is_imm_8(imm))
+   emit(buf, 0xf6);
+   else
+   emit(buf, 0xf7);
+
+   emit(buf, 0x04);
+   emit(buf, 0x25);
+   emit_imm32(buf, disp);
+   emit_imm(buf, imm);
+}
+
+static void emit_test_imm_memdisp(struct buffer *buf,
+ struct operand *imm,
+ struct operand *disp)
+{
+   __emit_test_imm_memdisp(buf, 0, imm->imm, disp->disp);
+}
+
 struct emitter emitters[] = {
GENERIC_X86_EMITTERS,
DECL_EMITTER(INSN_ADD_IMM_REG, emit_add_imm_reg, TWO_OPERANDS),
@@ -2843,6 +2871,7 @@ struct emitter emitters[] = {
DECL_EMITTER(INSN_SUB_IMM_REG, emit_sub_imm_reg, TWO_OPERANDS),
DECL_EMITTER(INSN_SUB_REG_REG, emit_sub_reg_reg, TWO_OPERANDS),
DECL_EMITTER(INSN_TEST_MEMBASE_REG, emit_test_membase_reg, 
TWO_OPERANDS),
+   DECL_EMITTER(INSN_TEST_IMM_MEMDISP, emit_test_imm_memdisp, 
TWO_OPERANDS),
 };
 
 void emit_prolog(struct buffer *buf, unsigned long nr_locals)
-- 
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


[PATCH 24/30] x86-64: handle EXPR_ANEWARRAY

2009-08-15 Thread Eduard - Gabriel Munteanu
This implements EXPR_ANEWARRAY handling on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |   28 +++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 8a5a652..d8d679d 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -1349,6 +1349,7 @@ reg:  EXPR_MULTIANEWARRAY(arg)
select_exception_test(s, tree);
 }
 
+%ifdef CONFIG_X86_32
 reg:EXPR_ANEWARRAY(reg)
 {
 struct var_info *var, *size;
@@ -1356,7 +1357,7 @@ reg:EXPR_ANEWARRAY(reg)
 
 expr = to_expr(tree);
 
-var = get_fixed_var(s->b_parent, MACH_REG_xAX);
+var = get_fixed_var(s->b_parent, MACH_REG_EAX);
 state->reg1 = var;
 
 size = state->left->reg1;
@@ -1370,6 +1371,31 @@ reg:EXPR_ANEWARRAY(reg)
 method_args_cleanup(s, tree, 3);
select_exception_test(s, tree);
 }
+%else
+reg:EXPR_ANEWARRAY(reg)
+{
+struct var_info *var, *size, *rdi, *rsi;
+struct expression *expr;
+
+expr = to_expr(tree);
+
+var = get_fixed_var(s->b_parent, MACH_REG_RAX);
+state->reg1 = var;
+
+size = state->left->reg1;
+
+   rdi = get_fixed_var(s->b_parent, MACH_REG_RDI);
+   rsi = get_fixed_var(s->b_parent, MACH_REG_RSI);
+
+   select_insn(s, tree, imm_reg_insn(INSN_MOV_IMM_REG,
+   (unsigned long) expr->anewarray_ref_type, rdi));
+   select_insn(s, tree, reg_reg_insn(INSN_MOV_REG_REG, size, rsi));
+   select_insn(s, tree, rel_insn(INSN_CALL_REL,
+   (unsigned long) vm_object_alloc_array));
+
+   select_exception_test(s, tree);
+}
+%endif
 
 reg:EXPR_ARRAYLENGTH(reg)
 {
-- 
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


[PATCH 22/30] x86: convert native_call() and vm_native_call() to functions

2009-08-15 Thread Eduard - Gabriel Munteanu
x86-64 needs more logic to handle native_call() and vm_native_call().
Therefore we turn these two macros into functions to cater for other
arches' needs.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/Makefile_32 |1 +
 arch/x86/Makefile_64 |1 +
 arch/x86/call.c  |  129 ++
 arch/x86/include/arch/call.h |   68 --
 include/vm/call.h|7 ++
 vm/call.c|6 +-
 6 files changed, 140 insertions(+), 72 deletions(-)
 create mode 100644 arch/x86/call.c
 delete mode 100644 arch/x86/include/arch/call.h

diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32
index 58bd024..8a76208 100644
--- a/arch/x86/Makefile_32
+++ b/arch/x86/Makefile_32
@@ -1,6 +1,7 @@
 ARCH_OBJS = \
arch/x86/args.o \
arch/x86/backtrace.o\
+   arch/x86/call.o \
arch/x86/disassemble.o  \
arch/x86/emit-code.o\
arch/x86/exception.o\
diff --git a/arch/x86/Makefile_64 b/arch/x86/Makefile_64
index 30b4e0c..34052d2 100644
--- a/arch/x86/Makefile_64
+++ b/arch/x86/Makefile_64
@@ -4,6 +4,7 @@ ARCH_LIBS   = -L/usr/lib64/libffi -lffi
 ARCH_OBJS = \
arch/x86/args.o \
arch/x86/backtrace.o\
+   arch/x86/call.o \
arch/x86/disassemble.o  \
arch/x86/emit-code.o\
arch/x86/exception.o\
diff --git a/arch/x86/call.c b/arch/x86/call.c
new file mode 100644
index 000..cef3bdf
--- /dev/null
+++ b/arch/x86/call.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2009 Tomek Grabiec 
+ * Copyright (C) 2009 Eduard - Gabriel Munteanu 
+ * 
+ * This file is released under the GPL version 2 with the following
+ * clarification and special exception:
+ *
+ * Linking this library statically or dynamically with other modules is
+ * making a combined work based on this library. Thus, the terms and
+ * conditions of the GNU General Public License cover the whole
+ * combination.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under terms
+ * of your choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module. An
+ * independent module is a module which is not derived from or based on
+ * this library. If you modify this library, you may extend this exception
+ * to your version of the library, but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version.
+ *
+ * Please refer to the file LICENSE for details.
+ */
+
+#include 
+
+#include "vm/call.h"
+#include "vm/method.h"
+
+#ifdef CONFIG_X86_32
+
+/**
+ * This calls a function with call arguments copied from @args
+ * array. The array contains @args_count elements of machine word
+ * size. The @target must be a variable holding a function
+ * pointer. Call result will be stored in @result.
+ */
+unsigned long native_call(struct vm_method *method,
+ const void *target,
+ unsigned long *args)
+{
+   unsigned long result;
+
+   __asm__ volatile (
+   "movl %%ebx, %%ecx \n"
+   "shl $2, %%ebx \n"
+   "subl %%ebx, %%esp \n"
+   "movl %%esp, %%edi \n"
+   "cld \n"
+   "rep movsd \n"
+   "movl %%ebx, %%esi \n"
+   "call *%3 \n"   
+   "addl %%esi, %%esp \n"
+   : "=a" (result)
+   : "b" (method->args_count), "S"(args), "m"(target)
+   : "%ecx", "%edi", "cc"
+   );
+
+   return result;
+}
+
+/**
+ * This calls a VM native function with call arguments copied from
+ * @args array. The array contains @args_count elements of machine
+ * word size. The @target must be a pointer to a VM function. Call
+ * result will be stored in @result.
+ */
+unsigned long vm_native_call(struct vm_method *method,
+const void *target,
+unsigned long *args)
+   unsigned long result;
+
+   __asm__ volatile (
+   "movl %%ebx, %%ecx \n"
+   "shl $2, %%ebx \n"
+   "subl %%ebx, %%esp \n"
+   "movl %%esp, %%edi \n"
+   "cld \n"
+   "rep movsd \n"
+   "movl %%ebx, %%esi \n"
+ 
+   "pushl %%esp \n"
+   "pushl %3 \n"
+   "call vm_enter_vm_native \n"
+   "addl $8, %%esp \n"
+   "test %%eax, %%eax \n"
+   "jnz 1f \n"
+ 
+   

[PATCH 23/30] x86-64: implement native_call()

2009-08-15 Thread Eduard - Gabriel Munteanu
This implements native_call() on x86-64. Unlike on x86-32, it also needs
to handle register arguments.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/call.c |   45 -
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/arch/x86/call.c b/arch/x86/call.c
index cef3bdf..f70c8a2 100644
--- a/arch/x86/call.c
+++ b/arch/x86/call.c
@@ -27,6 +27,10 @@
 
 #include 
 
+#include "arch/registers.h"
+
+#include "jit/args.h"
+
 #include "vm/call.h"
 #include "vm/method.h"
 
@@ -109,7 +113,46 @@ unsigned long native_call(struct vm_method *method,
  const void *target,
  unsigned long *args)
 {
-   abort();
+   int i, sp = 0, r = 0;
+   unsigned long *stack, regs[6];
+   unsigned long result;
+
+   stack = malloc(sizeof(unsigned long) * method->args_count);
+   if (!stack)
+   abort();
+
+   for (i = 0; i < method->args_count; i++)
+   if (method->args_map[i].reg == MACH_REG_UNASSIGNED)
+   stack[sp++] = args[i];
+   else
+   regs[r++] = args[i];
+
+   __asm__ volatile (
+   /* Copy stack arguments onto the stack. */
+   "movq %%rbx, %%rcx \n"
+   "shl $3, %%rbx \n"
+   "subq %%rbx, %%rsp \n"
+   "movq %%rsp, %%rdi \n"
+   "cld \n"
+   "rep movsq \n"
+
+   /* Assign registers to register arguments. */
+   "movq 0x00(%%rax), %%rdi \n"
+   "movq 0x08(%%rax), %%rsi \n"
+   "movq 0x10(%%rax), %%rdx \n"
+   "movq 0x18(%%rax), %%rcx \n"
+   "movq 0x20(%%rax), %%r8 \n"
+   "movq 0x28(%%rax), %%r9 \n"
+
+   "call *%3 \n"   
+   "addq %%rbx, %%rsp \n"
+   : "=a" (result)
+   : "b" (get_stack_args_count(method)), "S" (stack),
+ "m" (target), "a" (regs)
+   : "%rcx", "%rdi", "%r8", "%r9", "cc"
+   );
+
+   free(stack);
 
return 0;
 }
-- 
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


[PATCH 16/30] x86: ifdef EXPR_CONVERSION_FROM_DOUBLE

2009-08-15 Thread Eduard - Gabriel Munteanu
We temporarily avoid problems on x86-64 by removing the definition of
EXPR_CONVERSION_FROM_DOUBLE.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 0c68a16..7484801 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -1574,6 +1574,7 @@ reg:  EXPR_CONVERSION_FROM_FLOAT(freg)
}
 }
 
+%ifdef CONFIG_X86_32
 reg:   EXPR_CONVERSION_FROM_DOUBLE(freg)
 {
struct expression *expr, *src;
@@ -1621,6 +1622,7 @@ reg:  EXPR_CONVERSION_FROM_DOUBLE(freg)
die("EXPR_CONVERSION_FROM_DOUBLE: no conversion from %d to %d", 
src->vm_type, expr->vm_type);
}
 }
+%endif
 
 arg:   EXPR_NO_ARGS
 {
-- 
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


[PATCH 19/30] x86: ifdef EXPR_LOOKUPSWITCH_BSEARCH

2009-08-15 Thread Eduard - Gabriel Munteanu
This prevents a few problems from surfacing on x86-64 until
EXPR_LOOKUPSWITCH_BSEARCH is properly implemented.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index f04d589..8a5a652 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -2579,6 +2579,7 @@ stmt: STMT_LOOKUPSWITCH_JUMP(reg)
offsetof(struct lookupswitch_pair, target)));
 }
 
+%ifdef CONFIG_X86_32
 reg:   EXPR_LOOKUPSWITCH_BSEARCH(reg)
 {
struct expression *expr;
@@ -2602,6 +2603,7 @@ reg:  EXPR_LOOKUPSWITCH_BSEARCH(reg)
state->reg1 = get_fixed_var(s->b_parent, MACH_REG_EAX);
select_insn(s, tree, rel_insn(INSN_CALL_REL, (unsigned long) &bsearch));
 }
+%endif
 
 stmt:  STMT_MONITOR_ENTER(reg)
 {
-- 
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


[PATCH 21/30] x86-64: add stub for emit_jni_trampoline()

2009-08-15 Thread Eduard - Gabriel Munteanu
This adds a stub for emit_jni_trampoline() until it gets properly
implemented on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/emit-code.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index b37..440a63a 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -2956,6 +2956,13 @@ void *emit_itable_resolver_stub(struct vm_class *vmc,
return NULL;
 }
 
+void emit_jni_trampoline(struct buffer *buf,
+struct vm_method *vmm,
+void *target)
+{
+   abort();
+}
+
 #endif /* CONFIG_X86_32 */
 
 typedef void (*emit_no_operands_fn) (struct buffer *);
-- 
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


[PATCH 14/30] x86-64: don't alter the first argument's register in invokevirtual()

2009-08-15 Thread Eduard - Gabriel Munteanu
Altering the first argument's register's contents was okay on x86-32,
but on x86-64 we use the very same register to pass the object
reference. Therefore, we allocate a different register and do not modify
the original. x86-32 should optimize this behavior by doing copy
propagation (not currently implemented).

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 7983dbb..32f029d 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -3078,7 +3078,9 @@ static void invokevirtual(struct _MBState *state, struct 
basic_block *s, struct
method  = expr->target_method;
 
/* object reference */
-   call_target = state->left->reg1;
+   call_target = get_var(s->b_parent, J_REFERENCE);
+   select_insn(s, tree, reg_reg_insn(INSN_MOV_REG_REG,
+ state->left->reg1, call_target));
 
/* object class */
select_insn(s, tree, membase_reg_insn(INSN_MOV_MEMBASE_REG, 
call_target, offsetof(struct vm_object, class), call_target));
-- 
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


[PATCH 18/30] x86-64: update registers_64.c according to x86-32 changes

2009-08-15 Thread Eduard - Gabriel Munteanu
The previous interfaces from registers_64.c were no longer valid and had
to be updated according to x86-32 code.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/include/arch/registers_64.h |3 ++
 arch/x86/registers_64.c  |   53 +-
 2 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/arch/x86/include/arch/registers_64.h 
b/arch/x86/include/arch/registers_64.h
index d3330e3..5efa48a 100644
--- a/arch/x86/include/arch/registers_64.h
+++ b/arch/x86/include/arch/registers_64.h
@@ -4,6 +4,8 @@
 #include 
 #include 
 
+#include "vm/types.h"
+
 enum machine_reg {
MACH_REG_RAX, /* R0 */
MACH_REG_RCX, /* R1 */
@@ -46,6 +48,7 @@ enum machine_reg {
 
 const char *reg_name(enum machine_reg reg);
 enum machine_reg_type reg_type(enum machine_reg reg);
+bool reg_supports_type(enum machine_reg reg, enum vm_type type);
 
 static inline bool is_caller_saved_reg(enum machine_reg reg)
 {
diff --git a/arch/x86/registers_64.c b/arch/x86/registers_64.c
index af0a219..641c3f8 100644
--- a/arch/x86/registers_64.c
+++ b/arch/x86/registers_64.c
@@ -29,23 +29,6 @@
 
 #include 
 
-static enum machine_reg_type register_types[] = {
-   [MACH_REG_RAX] = REG_TYPE_GPR,
-   [MACH_REG_RBX] = REG_TYPE_GPR,
-   [MACH_REG_RCX] = REG_TYPE_GPR,
-   [MACH_REG_RDX] = REG_TYPE_GPR,
-   [MACH_REG_RDI] = REG_TYPE_GPR,
-   [MACH_REG_RSI] = REG_TYPE_GPR,
-   [MACH_REG_R8] = REG_TYPE_GPR,
-   [MACH_REG_R9] = REG_TYPE_GPR,
-   [MACH_REG_R10] = REG_TYPE_GPR,
-   [MACH_REG_R11] = REG_TYPE_GPR,
-   [MACH_REG_R12] = REG_TYPE_GPR,
-   [MACH_REG_R13] = REG_TYPE_GPR,
-   [MACH_REG_R14] = REG_TYPE_GPR,
-   [MACH_REG_R15] = REG_TYPE_GPR,
-};
-
 static const char *register_names[] = {
[MACH_REG_RAX] = "RAX",
[MACH_REG_RCX] = "RCX",
@@ -73,9 +56,39 @@ const char *reg_name(enum machine_reg reg)
return register_names[reg];
 }
 
-enum machine_reg_type reg_type(enum machine_reg reg)
+#define GPR_64 (1UL << J_LONG) | (1UL << J_REFERENCE)
+#define GPR_32 (1UL << J_INT)
+#define GPR_16 (1UL << J_SHORT) | (1UL << J_CHAR)
+#define GPR_8 (1UL << J_BYTE) | (1UL << J_BOOLEAN)
+#define FPU (1UL << J_FLOAT) | (1UL << J_DOUBLE)
+
+bool reg_supports_type(enum machine_reg reg, enum vm_type type)
 {
-   assert(reg != MACH_REG_UNASSIGNED);
+   static const uint32_t table[NR_REGISTERS] = {
+   [MACH_REG_RAX] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_RCX] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_RDX] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_RBX] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_R8] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_R9] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_R10] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_R11] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_R12] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_R13] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_R14] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_R15] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+
+   /* XXX: We can't access the lower nibbles of these registers,
+* so they shouldn't have GPR_16 or GPR_8, but we need it for
+* now to work around a reg-alloc bug. */
+   [MACH_REG_RSI] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   [MACH_REG_RDI] = GPR_64 | GPR_32 | GPR_16 | GPR_8,
+   };
+
+   assert(reg < NR_REGISTERS);
+   assert(type < VM_TYPE_MAX);
+   assert(type != J_VOID);
+   assert(type != J_RETURN_ADDRESS);
 
-   return register_types[reg];
+   return table[reg] & (1UL << type);
 }
-- 
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


[PATCH 20/30] x86-64: use parse_method_args() to fill args map

2009-08-15 Thread Eduard - Gabriel Munteanu
skip_type() has been removed and we need to use parse_method_args() to
parse the method type string.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/args.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/args.c b/arch/x86/args.c
index 6fe22b8..c6835a1 100644
--- a/arch/x86/args.c
+++ b/arch/x86/args.c
@@ -60,7 +60,7 @@ static enum machine_reg args_map_alloc_gpr(int gpr)
 
 int args_map_init(struct vm_method *method)
 {
-   const char *type;
+   const char *type = method->type;
enum vm_type vm_type;
int idx, gpr_count = 0, stack_count = 0;
struct vm_args_map *map;
@@ -83,10 +83,9 @@ int args_map_init(struct vm_method *method)
idx = 0;
 
/* Scan the real parameters and assign registers and stack slots. */
-   for (type = method->type + 1; *type != ')'; skip_type(&type)) {
+   while ((type = parse_method_args(type, &vm_type, NULL))) {
map = &method->args_map[idx];
 
-   vm_type = str_to_type(type);
switch (vm_type) {
case J_BYTE:
case J_CHAR:
-- 
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


[PATCH 04/30] x86-64: handle local variables correctly

2009-08-15 Thread Eduard - Gabriel Munteanu
Previous implementation attempted to access the argument map for local
variables as well. We now determine if the local index refers to a local
variable and act accordingly.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |   19 +--
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 65bc5d1..c86362a 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -2195,15 +2195,22 @@ stmt:  STMT_STORE(EXPR_TEMPORARY, EXPR_LOCAL) 1
 
method = s->b_parent->method;
 
-   reg = method->args_map[exprsrc->local_index].reg;
-   if (reg == MACH_REG_UNASSIGNED) {
-   index = method->args_map[exprsrc->local_index].stack_index;
+   if (exprsrc->local_index < (unsigned long) method->args_count) {
+   reg = method->args_map[exprsrc->local_index].reg;
+   if (reg == MACH_REG_UNASSIGNED) {
+   index = 
method->args_map[exprsrc->local_index].stack_index;
+   slot = get_local_slot(s->b_parent->stack_frame, index);
+   select_insn(s, tree, 
memlocal_reg_insn(INSN_MOV_MEMLOCAL_REG,
+  slot, dest));
+   } else {
+   src = get_fixed_var(s->b_parent, reg);
+   select_insn(s, tree, reg_reg_insn(INSN_MOV_REG_REG, 
src, dest));
+   }
+   } else {
+   index = exprsrc->local_index - method->reg_args_count;
slot = get_local_slot(s->b_parent->stack_frame, index);
select_insn(s, tree, memlocal_reg_insn(INSN_MOV_MEMLOCAL_REG,
   slot, dest));
-   } else {
-   src = get_fixed_var(s->b_parent, reg);
-   select_insn(s, tree, reg_reg_insn(INSN_MOV_REG_REG, src, dest));
}
 }
 
-- 
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


[PATCH 07/30] x86-64: handle locals in EXPR_LOCAL

2009-08-15 Thread Eduard - Gabriel Munteanu
We determine if the local index refers to a local variable and do not
access the argument map if we shouldn't.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |   18 +-
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 69e03cb..376ea0d 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -244,15 +244,23 @@ reg:  EXPR_LOCAL  1
 
method = cu->method;
 
-   reg = method->args_map[expr->local_index].reg;
-   if (reg == MACH_REG_UNASSIGNED) {
-   index = method->args_map[expr->local_index].stack_index;
+   if (expr->local_index < (unsigned long) method->args_count) {
+   reg = method->args_map[expr->local_index].reg;
+   if (reg == MACH_REG_UNASSIGNED) {
+   index = method->args_map[expr->local_index].stack_index;
+   slot = get_local_slot(s->b_parent->stack_frame, index);
+   result = get_var(s->b_parent, J_LONG);
+   select_insn(s, tree, 
memlocal_reg_insn(INSN_MOV_MEMLOCAL_REG,
+  slot, result));
+   } else
+   result = get_fixed_var(s->b_parent, reg);
+   } else {
+   index = expr->local_index - method->reg_args_count;
slot = get_local_slot(s->b_parent->stack_frame, index);
result = get_var(s->b_parent, J_LONG);
select_insn(s, tree, memlocal_reg_insn(INSN_MOV_MEMLOCAL_REG,
   slot, result));
-   } else
-   result = get_fixed_var(s->b_parent, reg);
+   }
 
state->reg1 = result;
 }
-- 
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


[PATCH 17/30] x86-64: add missing declarations to insn-selector

2009-08-15 Thread Eduard - Gabriel Munteanu
This fixes issues related to missing declarations on x86-64, due to
changes introduced to the instruction selector.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 7484801..f04d589 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -1800,7 +1800,7 @@ arg:  EXPR_ARG(reg) 1
 
 arg:   EXPR_ARG(freg)
 {
-   struct var_info *src, *esp;
+   struct var_info *src, *esp, *dst;
struct expression *expr, *arg_expr;
 
expr = to_expr(tree);
@@ -2250,7 +2250,10 @@ stmt:  STMT_STORE(EXPR_FLOAT_TEMPORARY, 
EXPR_FLOAT_LOCAL) 1
struct expression *exprdest, *exprsrc;
struct stack_slot *slot;
struct statement *stmt;
-   struct var_info *dest;
+   struct var_info *src, *dest;
+   struct vm_method *method = s->b_parent->method;
+   enum machine_reg reg;
+   int index;
 
stmt = to_stmt(tree);
 
-- 
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


[PATCH 13/30] x86-64: pass correct object reference to fixup_vtable()

2009-08-15 Thread Eduard - Gabriel Munteanu
The previous implementation passed an incorrect object reference to
fixup_vtable() from code generated by emit_trampoline(). That was
because *this gets passed by %rdi, not stack, on x86-64. Therefore, we
now make use of the saved %rdi to pass it to fixup_vtable().

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/emit-code.c |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 5dd4e68..b37 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -2920,6 +2920,21 @@ void emit_trampoline(struct compilation_unit *cu,
   MACH_REG_RCX);
__emit64_test_membase_reg(buf, MACH_REG_RCX, 0, MACH_REG_RCX);
 
+   if (method_is_virtual(cu->method)) {
+   __emit64_push_reg(buf, MACH_REG_RAX);
+
+   /*
+* 0x30(%rsp) contains the %rdi passed
+* to the trampoline, which we pushed earlier.
+*/
+   __emit64_mov_imm_reg(buf, (unsigned long) cu, MACH_REG_RDI);
+   __emit64_mov_membase_reg(buf, MACH_REG_RSP, 0x30, MACH_REG_RSI);
+   __emit64_mov_reg_reg(buf, MACH_REG_RAX, MACH_REG_RDX);
+   __emit_call(buf, fixup_vtable);
+
+   __emit64_pop_reg(buf, MACH_REG_RAX);
+   }
+
__emit64_pop_reg(buf, MACH_REG_R9);
__emit64_pop_reg(buf, MACH_REG_R8);
__emit64_pop_reg(buf, MACH_REG_RCX);
-- 
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


[PATCH 11/30] x86-64: treat J_REFERENCE as a 64-bit operand

2009-08-15 Thread Eduard - Gabriel Munteanu
Pointers are 64-bits on x86-64, so we need to use 64-bit operand widths
for instructions operating on J_REFERENCE values.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/emit-code.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index e149cf2..5dd4e68 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -2208,7 +2208,8 @@ static inline unsigned long rip_relative(struct buffer 
*buf,
 
 static inline int is_64bit_reg(struct operand *reg)
 {
-   return (reg->reg.interval->var_info->vm_type == J_LONG);
+   return (reg->reg.interval->var_info->vm_type == J_LONG ||
+   reg->reg.interval->var_info->vm_type == J_REFERENCE);
 }
 
 static int is_64bit_bin_reg_op(struct operand *a, struct operand *b)
-- 
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


[PATCH 08/30] x86-64: use GPR_VM_TYPE in EXPR_NULL_CHECK

2009-08-15 Thread Eduard - Gabriel Munteanu
This fixes EXPR_NULL_CHECK by choosing a suitable vm type depending on
the architecture.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 376ea0d..3220ba0 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -1293,7 +1293,7 @@ reg:  EXPR_NULL_CHECK(EXPR_LOCAL)
struct expression *expr;
struct expression *local;
 
-   reg = get_var(s->b_parent, J_INT);
+   reg = get_var(s->b_parent, GPR_VM_TYPE);
state->reg1 = reg;
 
expr = to_expr(tree);
-- 
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


[PATCH 15/30] x86-64: use offsetof() instead of sizeof() in EXPR_INSTANCE_FIELD

2009-08-15 Thread Eduard - Gabriel Munteanu
sizeof() doesn't work correctly due to the flexible array contained in
struct vm_object. In some cases, GCC may add padding to such a structure
in such a way that sizeof() gives different results than offsetof()
(which is what we really want). This piece of code exposes the problem
on x86-64:

struct flex {
unsigned long b;
char a;
unsigned char f[];
};

In this case sizeof(struct flex) != offsetof(struct flex, f).

We fix the problem by replacing sizeof() with offsetof().

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 32f029d..0c68a16 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -1133,7 +1133,7 @@ reg:  EXPR_INSTANCE_FIELD(reg) 1
base = state->left->reg1;
state->reg1 = get_var(s->b_parent, J_INT);
 
-   offset = sizeof(struct vm_object) + expr->instance_field->offset;
+   offset = offsetof(struct vm_object, fields) + 
expr->instance_field->offset;
select_insn(s, tree, membase_reg_insn(INSN_MOV_MEMBASE_REG, base, 
offset, state->reg1));
 
if (expr->vm_type == J_LONG) {
-- 
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


[PATCH 03/30] x86-64: add reg_args_count to struct vm_method

2009-08-15 Thread Eduard - Gabriel Munteanu
reg_args_count provides a faster way of determining how many stack and
register arguments a method takes.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/args.c |2 ++
 include/jit/args.h  |5 -
 include/vm/method.h |1 +
 jit/args.c  |   11 ---
 4 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/x86/args.c b/arch/x86/args.c
index bb1bfe9..6fe22b8 100644
--- a/arch/x86/args.c
+++ b/arch/x86/args.c
@@ -127,6 +127,8 @@ int args_map_init(struct vm_method *method)
map->stack_index = stack_count++;
}
 
+   method->reg_args_count = gpr_count;
+
return 0;
 }
 
diff --git a/include/jit/args.h b/include/jit/args.h
index 8e9bceb..12d31dc 100644
--- a/include/jit/args.h
+++ b/include/jit/args.h
@@ -29,7 +29,10 @@ static inline int get_stack_args_count(struct vm_method 
*method)
return method->args_count;
 }
 #else
-extern int get_stack_args_count(struct vm_method *method);
+static inline int get_stack_args_count(struct vm_method *method)
+{
+   return method->args_count - method->reg_args_count;
+}
 #endif /* CONFIG_ARGS_MAP */
 
 #endif
diff --git a/include/vm/method.h b/include/vm/method.h
index ebb1abe..90a4fef 100644
--- a/include/vm/method.h
+++ b/include/vm/method.h
@@ -38,6 +38,7 @@ struct vm_method {
int args_count;
 #ifdef CONFIG_ARGS_MAP
struct vm_args_map *args_map;
+   int reg_args_count;
 #endif
 
struct cafebabe_code_attribute code_attribute;
diff --git a/jit/args.c b/jit/args.c
index f054c5c..3761cf2 100644
--- a/jit/args.c
+++ b/jit/args.c
@@ -35,17 +35,6 @@
 #include "vm/stack.h"
 
 #ifdef CONFIG_ARGS_MAP
-int get_stack_args_count(struct vm_method *method)
-{
-   int i, count = 0;
-
-   for (i = 0; i < method->args_count; i++)
-   if (method->args_map[i].reg == MACH_REG_UNASSIGNED)
-   count++;
-
-   return count;
-}
-
 static inline void set_expr_arg_reg(struct expression *expr,
struct vm_method *method,
int index)
-- 
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


[PATCH 09/30] x86-64: notify liveness analysis about caller saved registers

2009-08-15 Thread Eduard - Gabriel Munteanu
Liveness analysis needs to know about registers belonging to the caller
(such as those used to pass parameters, which can be modified by the
callee). This prevents the callee from messing up the data belonging to
the caller.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |   26 ++--
 arch/x86/use-def.c |   45 ++-
 2 files changed, 54 insertions(+), 17 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index 3220ba0..7983dbb 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -3222,6 +3222,28 @@ static void insn_select(struct basic_block *bb)
}
 }
 
+#ifdef CONFIG_X86_32
+static void touch_caller_saved_regs(struct compilation_unit *cu)
+{
+   get_fixed_var(cu, MACH_REG_EAX);
+   get_fixed_var(cu, MACH_REG_ECX);
+   get_fixed_var(cu, MACH_REG_EDX);
+}
+#else /* CONFIG_X86_32 */
+static void touch_caller_saved_regs(struct compilation_unit *cu)
+{
+   get_fixed_var(cu, MACH_REG_RAX);
+   get_fixed_var(cu, MACH_REG_RDI);
+   get_fixed_var(cu, MACH_REG_RSI);
+   get_fixed_var(cu, MACH_REG_RDX);
+   get_fixed_var(cu, MACH_REG_RCX);
+   get_fixed_var(cu, MACH_REG_R8);
+   get_fixed_var(cu, MACH_REG_R9);
+   get_fixed_var(cu, MACH_REG_R10);
+   get_fixed_var(cu, MACH_REG_R11);
+}
+#endif /* CONFIG_X86_32 */
+
 int select_instructions(struct compilation_unit *cu)
 {
struct basic_block *bb;
@@ -3242,9 +3264,7 @@ int select_instructions(struct compilation_unit *cu)
/*
 * Let the liveness analysis pass know about caller saved registers.
 */
-   get_fixed_var(cu, MACH_REG_xAX);
-   get_fixed_var(cu, MACH_REG_xCX);
-   get_fixed_var(cu, MACH_REG_xDX);
+   touch_caller_saved_regs(cu);
 
for_each_basic_block(bb, &cu->bb_list) {
insn_select(bb);
diff --git a/arch/x86/use-def.c b/arch/x86/use-def.c
index 5d017bc..9f76d13 100644
--- a/arch/x86/use-def.c
+++ b/arch/x86/use-def.c
@@ -10,18 +10,19 @@
 #include "jit/vars.h"
 
 enum {
-   DEF_DST = 1,
-   DEF_SRC = 2,
-   DEF_NONE= 4,
-   DEF_xAX = 8,
-   DEF_xCX = 16,
-   DEF_xDX = 32,
-   USE_DST = 64,
-   USE_IDX_DST = 128,  /* destination operand is memindex */
-   USE_IDX_SRC = 256,  /* source operand is memindex */
-   USE_NONE= 512,
-   USE_SRC = 1024,
-   USE_FP  = 2048, /* frame pointer */
+   DEF_DST = 1,
+   DEF_SRC = 2,
+   DEF_NONE= 4,
+   DEF_xAX = 8,
+   DEF_xCX = 16,
+   DEF_xDX = 32,
+   USE_DST = 64,
+   USE_IDX_DST = 128,  /* destination operand is memindex */
+   USE_IDX_SRC = 256,  /* source operand is memindex */
+   USE_NONE= 512,
+   USE_SRC = 1024,
+   USE_FP  = 2048, /* frame pointer */
+   DEF_CALLER_SAVED= 4096,
 
 #ifdef CONFIG_X86_32
DEF_EAX = DEF_xAX,
@@ -49,8 +50,8 @@ static struct insn_info insn_infos[] = {
DECLARE_INFO(INSN_ADD_REG_REG, USE_SRC | USE_DST | DEF_DST),
DECLARE_INFO(INSN_AND_MEMBASE_REG, USE_SRC | USE_DST | DEF_DST),
DECLARE_INFO(INSN_AND_REG_REG, USE_SRC | USE_DST | DEF_DST),
-   DECLARE_INFO(INSN_CALL_REG, USE_SRC | DEF_xAX | DEF_xCX | DEF_xDX),
-   DECLARE_INFO(INSN_CALL_REL, USE_NONE | DEF_xAX | DEF_xCX | DEF_xDX),
+   DECLARE_INFO(INSN_CALL_REG, USE_SRC | DEF_CALLER_SAVED),
+   DECLARE_INFO(INSN_CALL_REL, USE_NONE | DEF_CALLER_SAVED),
DECLARE_INFO(INSN_CLTD_REG_REG, USE_SRC | DEF_SRC | DEF_DST),
DECLARE_INFO(INSN_CMP_IMM_REG, USE_DST),
DECLARE_INFO(INSN_CMP_MEMBASE_REG, USE_SRC | USE_DST),
@@ -187,6 +188,22 @@ static struct mach_reg_def checkregs[] = {
{ MACH_REG_xAX, DEF_xAX },
{ MACH_REG_xCX, DEF_xCX },
{ MACH_REG_xDX, DEF_xDX },
+
+#ifdef CONFIG_X86_32
+   { MACH_REG_EAX, DEF_CALLER_SAVED },
+   { MACH_REG_ECX, DEF_CALLER_SAVED },
+   { MACH_REG_EDX, DEF_CALLER_SAVED },
+#else
+   { MACH_REG_RAX, DEF_CALLER_SAVED },
+   { MACH_REG_RDI, DEF_CALLER_SAVED },
+   { MACH_REG_RSI, DEF_CALLER_SAVED },
+   { MACH_REG_RDX, DEF_CALLER_SAVED },
+   { MACH_REG_RCX, DEF_CALLER_SAVED },
+   { MACH_REG_R8, DEF_CALLER_SAVED },
+   { MACH_REG_R9, DEF_CALLER_SAVED },
+   { MACH_REG_R10, DEF_CALLER_SAVED },
+   { MACH_REG_R11, DEF_CALLER_SAVED },
+#endif
 };
 
 
-- 
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. 

[PATCH 10/30] x86-64: fix membase insns with %r12 and %r13 as base registers

2009-08-15 Thread Eduard - Gabriel Munteanu
This fixes membase instructions in the two special cases when %r12 and
%r13 are used as base registers. These cases require different
encodings, similar to what is done with %rsp (and %esp on x86-32).

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/emit-code.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index 2ef7d3e..e149cf2 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -2467,16 +2467,17 @@ static void __emit_membase(struct buffer *buf,
 {
unsigned char rex_pfx = 0, mod, rm, mod_rm;
unsigned char __base_reg = __encode_reg(base_reg);
-   int needs_sib;
+   int needs_sib, needs_disp;
 
-   needs_sib = (base_reg == MACH_REG_RSP);
+   needs_sib = (base_reg == MACH_REG_RSP || base_reg == MACH_REG_R12);
+   needs_disp = (disp || base_reg == MACH_REG_R13);
 
if (needs_sib)
rm = 0x04;
else
rm = __base_reg;
 
-   if (disp == 0)
+   if (!needs_disp)
mod = 0x00;
else if (is_imm_8(disp))
mod = 0x01;
@@ -2501,7 +2502,7 @@ static void __emit_membase(struct buffer *buf,
if (needs_sib)
emit(buf, encode_sib(0x00, 0x04, __base_reg));
 
-   if (disp)
+   if (needs_disp)
emit_imm(buf, disp);
 }
 
-- 
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


[PATCH 12/30] regression: make ParameterPassingTest more thorough

2009-08-15 Thread Eduard - Gabriel Munteanu
This makes it harder to pass ParameterPassingTest in order to catch bugs
related to register parameter passing and stack cleanup.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 regression/jvm/ParameterPassingTest.java |3 ++-
 regression/run-suite.sh  |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/regression/jvm/ParameterPassingTest.java 
b/regression/jvm/ParameterPassingTest.java
index 11d72e6..6e2c28a 100644
--- a/regression/jvm/ParameterPassingTest.java
+++ b/regression/jvm/ParameterPassingTest.java
@@ -37,7 +37,8 @@ public class ParameterPassingTest {
 }
 
 public static void main(String[] args) {
-VM.exit(add(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
+VM.exit(add(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) +
+add(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
 }
 }
 
diff --git a/regression/run-suite.sh b/regression/run-suite.sh
index 8dc8379..4c86fae 100755
--- a/regression/run-suite.sh
+++ b/regression/run-suite.sh
@@ -80,7 +80,7 @@ if [ -z "$CLASS_LIST" ]; then
 run_java jvm.ObjectCreationAndManipulationExceptionsTest 0
 run_java jvm.ObjectCreationAndManipulationTest 0
 run_java jvm.ObjectStackTest 0
-run_java jvm.ParameterPassingTest 55
+run_java jvm.ParameterPassingTest 100
 run_java jvm.PopTest 0
 run_java jvm.PrintTest 0
 run_java jvm.PutfieldTest 0
-- 
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


[PATCH 06/30] x86-64: handle STMT_STORE(EXPR_LOCAL, reg)

2009-08-15 Thread Eduard - Gabriel Munteanu
This fixes handling of storing into local variables on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/insn-selector.brg |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg
index c86362a..69e03cb 100644
--- a/arch/x86/insn-selector.brg
+++ b/arch/x86/insn-selector.brg
@@ -2081,6 +2081,7 @@ stmt: STMT_STORE(float_inst_field, freg)
reg_membase_insn(INSN_MOV_64_XMM_MEMBASE, src, base, 
offset));
 }
 
+%ifdef CONFIG_X86_32
 stmt:  STMT_STORE(EXPR_LOCAL, reg)
 {
struct compilation_unit *cu = s->b_parent;
@@ -2105,6 +2106,26 @@ stmt:STMT_STORE(EXPR_LOCAL, reg)
select_insn(s, tree, reg_memlocal_insn(INSN_MOV_REG_MEMLOCAL, 
src, slot));
}
 }
+%else
+stmt:  STMT_STORE(EXPR_LOCAL, reg)
+{
+   struct compilation_unit *cu = s->b_parent;
+   struct expression *local;
+   struct stack_slot *slot;
+   struct statement *stmt;
+   struct var_info *src;
+   int index;
+
+   src = state->right->reg1;
+
+   stmt = to_stmt(tree);
+   local = to_expr(stmt->store_dest);
+   index = local->local_index - cu->method->reg_args_count;
+   slot = get_local_slot(cu->stack_frame, index);
+
+   select_insn(s, tree, reg_memlocal_insn(INSN_MOV_REG_MEMLOCAL, src, 
slot));
+}
+%endif
 
 stmt:  STMT_STORE(EXPR_FLOAT_LOCAL, freg)
 {
-- 
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


[PATCH 05/30] x86-64: fix disassembly listing

2009-08-15 Thread Eduard - Gabriel Munteanu
This adds support for proper disassembling of generated code on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/x86/disassemble.c |   30 +-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/arch/x86/disassemble.c b/arch/x86/disassemble.c
index bdd068c..3200fca 100644
--- a/arch/x86/disassemble.c
+++ b/arch/x86/disassemble.c
@@ -42,6 +42,10 @@
 #include 
 #include 
 
+#ifdef CONFIG_X86_32
+
+# define JIT_BFD_MACH  bfd_mach_i386_i386
+
 char *regs[] = {
"eax",
"ecx",
@@ -53,6 +57,30 @@ char *regs[] = {
"edi"
 };
 
+#else /* CONFIG_X86_32 */
+
+# define JIT_BFD_MACH  bfd_mach_x86_64
+
+char *regs[] = {
+   "rax",
+   "rcx",
+   "rdx",
+   "rbx",
+   "rsp",
+   "rbp",
+   "rsi",
+   "rdi",
+   "r8",
+   "r9",
+   "r10",
+   "r11",
+   "r12",
+   "r13",
+   "r14",
+   "r15"
+};
+
+#endif /* CONFIG_X86_32 */
 
 /* disassinstr 
*
 
@@ -74,7 +102,7 @@ unsigned char *disassinstr(struct compilation_unit *cu, 
unsigned char *code)
/* setting the struct members must be done after
   INIT_DISASSEMBLE_INFO */
 
-   info.mach = bfd_mach_i386_i386;
+   info.mach = JIT_BFD_MACH;
info.read_memory_func = &disass_buffer_read_memory;
 
disass_initialized = 1;
-- 
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


[PATCH 02/30] Fix 'make test' breakage

2009-08-15 Thread Eduard - Gabriel Munteanu
This fixes breakage encountered when doing 'make test' on x86-64.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 scripts/build/test.mk |4 +++-
 test/jit/Makefile |2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/build/test.mk b/scripts/build/test.mk
index bbfc279..8861641 100644
--- a/scripts/build/test.mk
+++ b/scripts/build/test.mk
@@ -4,7 +4,9 @@ DEFAULT_CFLAGS  ?= -rdynamic -g -Wall -Wundef -Wsign-compare 
-Os -std=gnu99 -D_GN
 # XXX: Temporary hack -Vegard
 DEFAULT_CFLAGS += -DNOT_IMPLEMENTED='fprintf(stderr, "%s:%d: warning: %s not 
implemented\n", __FILE__, __LINE__, __func__)'
 
-INCLUDE?= -I../include/ -I. -I../libharness -I../../include 
-I../../jit/glib -I../../cafebabe/include/ -include $(ARCH_CONFIG)
+INCLUDE?= -I../include/ -I. -I../libharness -I../../include \
+  -I../../jit/glib -I../../cafebabe/include/ \
+  -I../../arch/$(ARCH)/include -include $(ARCH_CONFIG)
 DEFAULT_LIBS   ?= -lrt -lpthread -lm -ldl -lz -lbfd -lopcodes -liberty
 
 ifdef TESTS
diff --git a/test/jit/Makefile b/test/jit/Makefile
index 25a0966..2912903 100644
--- a/test/jit/Makefile
+++ b/test/jit/Makefile
@@ -96,6 +96,6 @@ TEST_OBJS := \
tree-printer-test.o \
typeconv-bc-test.o
 
-CFLAGS += -I ../../arch/mmix/include
+DEFAULT_CFLAGS += -I../../arch/mmix/include -std=gnu99
 
 include ../../scripts/build/test.mk
-- 
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


[PATCH 01/30] mmix: set REG_UNASSIGNED to INT_MAX

2009-08-15 Thread Eduard - Gabriel Munteanu
Enumerations are 'int'-sized (by default) and GCC complains about the
use of ~0UL.

Signed-off-by: Eduard - Gabriel Munteanu 
---
 arch/mmix/include/arch/registers.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/mmix/include/arch/registers.h 
b/arch/mmix/include/arch/registers.h
index 48634ee..8faa73f 100644
--- a/arch/mmix/include/arch/registers.h
+++ b/arch/mmix/include/arch/registers.h
@@ -2,6 +2,7 @@
 #define __JIT_REGISTERS_H
 
 #include 
+#include 
 
 #include "vm/types.h"
 
@@ -16,7 +17,7 @@ enum machine_reg {
/* The above registers are available for get_fixed_var().  */
NR_FIXED_REGISTERS = NR_REGISTERS,
 
-   MACH_REG_UNASSIGNED = ~0UL,
+   MACH_REG_UNASSIGNED = INT_MAX,
 };
 
 static inline bool reg_supports_type(enum machine_reg reg, enum vm_type type)
-- 
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


[penberg/jato] 505f3b: vm: Fix formatting of function arguments

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 505f3bf6cd0aca5dd2ca8d8ec703ea1f7276d0df

http://github.com/penberg/jato/commit/505f3bf6cd0aca5dd2ca8d8ec703ea1f7276d0df
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/jar.c

Log Message:
---
vm: Fix formatting of function arguments

The vm/jar.c follows a very confusing style of indenting function
arguments with one tab which makes the code very hard to follow. Fix
that up by running the file through Lindent. Fix that up by running the
file through Lindent.

Signed-off-by: Pekka Enberg 



--
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


[penberg/jato] f21341: Makefile: Allow the user to override CC and JAVAC

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: f21341fd8c35567b582113bf8bf5ae265a74825a

http://github.com/penberg/jato/commit/f21341fd8c35567b582113bf8bf5ae265a74825a
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M Makefile

Log Message:
---
Makefile: Allow the user to override CC and JAVAC

Fix Makefile definitions so that the user can override CC and JAVAC if
necessary.

Signed-off-by: Pekka Enberg 


Commit: 71880799d94f94d2a71ecf197e35d49988f57054

http://github.com/penberg/jato/commit/71880799d94f94d2a71ecf197e35d49988f57054
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M include/vm/jni.h
  M vm/jni.c

Log Message:
---
vm: Make global variables static

Make global variables that are local to vm/jni.c static.

Signed-off-by: Pekka Enberg 


Commit: 134a086c9ddb563103e57646e9b375adda04

http://github.com/penberg/jato/commit/134a086c9ddb563103e57646e9b375adda04
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M jit/cfg-analyzer.c

Log Message:
---
jit: Use NULL pointer instead of zero integer

Signed-off-by: Pekka Enberg 


Commit: 8f444cd3cce8dd55705e3c64ff599fcf02167cd0

http://github.com/penberg/jato/commit/8f444cd3cce8dd55705e3c64ff599fcf02167cd0
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M jit/cu-mapping.c

Log Message:
---
jit: Make global variables static in jit/cu-mapping.c

Signed-off-by: Pekka Enberg 


Commit: da5af1514019785c7f8001f1e82a5a8a90737803

http://github.com/penberg/jato/commit/da5af1514019785c7f8001f1e82a5a8a90737803
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/jni-interface.c
  M vm/stack-trace.c

Log Message:
---
vm: Fix non-ANSI function declarations

Signed-off-by: Pekka Enberg 


Commit: 84e1ce7699cf9059ffafd0f8de8d8499121f389f

http://github.com/penberg/jato/commit/84e1ce7699cf9059ffafd0f8de8d8499121f389f
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/jni-interface.c

Log Message:
---
vm: Make global variables static in vm/jni-interface.c

Signed-off-by: Pekka Enberg 


Commit: c91c76f66f350cd0b4dc2cb53503ce8b48af4154

http://github.com/penberg/jato/commit/c91c76f66f350cd0b4dc2cb53503ce8b48af4154
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/string.c

Log Message:
---
vm: Make global variable static in vm/string.c

Signed-off-by: Pekka Enberg 


Commit: 3edbd0b67a57a8fb1f76981a56fa3b66f9df4a9c

http://github.com/penberg/jato/commit/3edbd0b67a57a8fb1f76981a56fa3b66f9df4a9c
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M lib/string.c

Log Message:
---
lib: Fix shadowed 'err' variable in lib/string.c

Signed-off-by: Pekka Enberg 


Commit: 10a482e4f3d80b851323194409069dc74a1b15ec

http://github.com/penberg/jato/commit/10a482e4f3d80b851323194409069dc74a1b15ec
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M jit/trace-jit.c
  M test/jit/trace-stub.c

Log Message:
---
vm: Remove unused option global variables

Signed-off-by: Pekka Enberg 



--
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


[penberg/jato] 60b78d: vm: Remove ifdef'd code from vm/jar.c

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 60b78dc9fb2b4878daeff440145660160679

http://github.com/penberg/jato/commit/60b78dc9fb2b4878daeff440145660160679
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/jar.c

Log Message:
---
vm: Remove ifdef'd code from vm/jar.c

Signed-off-by: Pekka Enberg 


Commit: af654f263a11f00df58f4a8e4122488efff13783

http://github.com/penberg/jato/commit/af654f263a11f00df58f4a8e4122488efff13783
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/jar.c

Log Message:
---
vm: Cleanup vm/jar.c some more

This patch makes some function static and shuffles around code so we can
get rid of forward declarations.

Signed-off-by: Pekka Enberg 



--
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


[penberg/jato] 369c43: vm: Fix parse_individual_section() to return parse...

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 369c43e5b25df843aac938f30419645dccb44b9d

http://github.com/penberg/jato/commit/369c43e5b25df843aac938f30419645dccb44b9d
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/jar.c

Log Message:
---
vm: Fix parse_individual_section() to return parsed section

The parse_individual_section() never assigned 'section' which caused
segmentation fault when trying to launch SPECjvm2008, for example. While
at it, fix the parse_individual_section() to signal error conditions
with NULL pointer to clean up some of the confusion caused by a boolean
return value.

Signed-off-by: Pekka Enberg 


Commit: 0f10e224bbabb5ac3ae4c4e8a94327d5d7afd2e8

http://github.com/penberg/jato/commit/0f10e224bbabb5ac3ae4c4e8a94327d5d7afd2e8
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/jar.c

Log Message:
---
vm: Remove parse_individual_section() forward declaration

Signed-off-by: Pekka Enberg 



--
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


[penberg/jato] 4c867f: vm: Fix error handling in vm_open_jar()

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 4c867fb41efd1f6a7f08aeec430ec4938811b656

http://github.com/penberg/jato/commit/4c867fb41efd1f6a7f08aeec430ec4938811b656
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/jar.c

Log Message:
---
vm: Fix error handling in vm_open_jar()

Call zip_close() file before exiting vm_open_jar() and plug memory leaks
in error paths.

Signed-off-by: Pekka Enberg 



--
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


[penberg/jato] 957bc9: vm: Make 'exe_name' static to vm/jato.c

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 957bc9358c57fe0adb938fca4367f14b4aeccc54

http://github.com/penberg/jato/commit/957bc9358c57fe0adb938fca4367f14b4aeccc54
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/backtrace.c
  M scripts/build/make-tests.sh
  M vm/jato.c

Log Message:
---
vm: Make 'exe_name' static to vm/jato.c

The 'exe_name' variable is no longer used by the backtrace code so make
it static to vm/jatoc.

Signed-off-by: Pekka Enberg 


Commit: 6dc9b21473502173bccb282c08c5752cb580d626

http://github.com/penberg/jato/commit/6dc9b21473502173bccb282c08c5752cb580d626
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M include/vm/call.h

Log Message:
---
vm: declare vm_call_method_*() for all primitive types

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: 70e36c881f6f95d0842da962617254976bf31e4e

http://github.com/penberg/jato/commit/70e36c881f6f95d0842da962617254976bf31e4e
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M jit/trace-jit.c

Log Message:
---
jit: remove "*** pointer not on heap ***" from -Xtrace:invoke-verbose

It is so common for pointers to be not on heap that
it is pointless to print this information.

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: 7d62cebf2e2c5a308e20be68461a8d6813973071

http://github.com/penberg/jato/commit/7d62cebf2e2c5a308e20be68461a8d6813973071
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M include/vm/preload.h
  M vm/classloader.c
  M vm/preload.c
  M vm/reflection.c

Log Message:
---
vm: preload primitive type class for J_VOID.

We will have to return this class as void method's result type class.

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: 45eb00dd01f9131aaf98f8156300dc223d099cb4

http://github.com/penberg/jato/commit/45eb00dd01f9131aaf98f8156300dc223d099cb4
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/reflection.c

Log Message:
---
vm: cleanup field access functions in reflection.c

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: cf1a33afadcdaabdbf1bdefd119022e93ae29143

http://github.com/penberg/jato/commit/cf1a33afadcdaabdbf1bdefd119022e93ae29143
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M include/vm/reflection.h
  M include/vm/types.h
  M vm/jato.c
  M vm/reflection.c
  M vm/types.c

Log Message:
---
vm: implement java/lang/reflection.Field.getType()

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: 958a129e4015663e789b0ebb6adf131102fdd040

http://github.com/penberg/jato/commit/958a129e4015663e789b0ebb6adf131102fdd040
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/reflection.c

Log Message:
---
vm: handle primitive and array classes in reflection code

We cannot access ->class field for primitive and array classes (it is
NULL). These classes do not declare methods, fields nor constructors.

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: e448e92e3d4955023d4925d28aa99f9f1e6e798d

http://github.com/penberg/jato/commit/e448e92e3d4955023d4925d28aa99f9f1e6e798d
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/class.c

Log Message:
---
vm: fix vm_class_is_assignable_from() for array classes

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: b86a6f19d8702706c893da45f0b153d7a14b0031

http://github.com/penberg/jato/commit/b86a6f19d8702706c893da45f0b153d7a14b0031
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M include/vm/preload.h
  M vm/preload.c
  M vm/reflection.c

Log Message:
---
vm: implement marshall_call_arguments() for majority of primitive types

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: 4f3c6da1a9d287217c7cc3923dc15fe119697f21

http://github.com/penberg/jato/commit/4f3c6da1a9d287217c7cc3923dc15fe119697f21
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M include/vm/reflection.h
  M vm/jato.c
  M vm/reflection.c

Log Message:
---
vm: implement java/lang/reflection/Field.set()

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 


Commit: def536e7f8a3d69cb806008b61536227afecaba3

http://github.com/penberg/jato/commit/def536e7f8a3d69cb806008b61536227afecaba3
Author: Tomek Grabiec 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/reflection.c

Log Message:
---
vm: introduce vm_object_to_vm_method() helper

Signed-off-by: Tomek Grabiec 
Signed-off-by: Pekka Enberg 



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, int

[PATCH 11/11] vm: introduce vm_object_to_vm_method() helper

2009-08-15 Thread Tomek Grabiec

Signed-off-by: Tomek Grabiec 
---
 vm/reflection.c |   28 +++-
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/vm/reflection.c b/vm/reflection.c
index 1eecf99..dd53135 100644
--- a/vm/reflection.c
+++ b/vm/reflection.c
@@ -81,6 +81,21 @@ throw:
return NULL;
 }
 
+static struct vm_method *vm_object_to_vm_method(struct vm_object *method)
+{
+   struct vm_object *clazz;
+   struct vm_class *vmc;
+   int slot;
+
+   clazz = field_get_object(method, 
vm_java_lang_reflect_Method_declaringClass);
+   vmc = vm_object_to_vm_class(clazz);
+   if (!vmc)
+   return NULL;
+
+   slot  = field_get_int(method, vm_java_lang_reflect_Method_slot);
+   return &vmc->methods[slot];
+}
+
 struct vm_object *
 native_vmclass_get_declared_fields(struct vm_object *clazz,
   jboolean public_only)
@@ -355,21 +370,16 @@ static struct vm_object 
*get_method_parameter_types(struct vm_method *vmm)
 struct vm_object *
 native_method_get_parameter_types(struct vm_object *method)
 {
-   struct vm_object *clazz;
-   struct vm_class *class;
-   struct vm_method *vmm;
-   int slot;
-
if (!method) {
signal_new_exception(vm_java_lang_NullPointerException, NULL);
return NULL;
}
 
-   clazz = field_get_object(method, 
vm_java_lang_reflect_Method_declaringClass);
-   slot = field_get_int(method, vm_java_lang_reflect_Method_slot);
+   struct vm_method *vmm
+   = vm_object_to_vm_method(method);
 
-   class = vm_class_get_class_from_class_object(clazz);
-   vmm = &class->methods[slot];
+   if (!vmm)
+   return NULL;
 
return get_method_parameter_types(vmm);
 }
-- 
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


[PATCH 08/11] vm: implement marshall_call_arguments() for majority of primitive types

2009-08-15 Thread Tomek Grabiec

Signed-off-by: Tomek Grabiec 
---
 include/vm/preload.h |3 +++
 vm/preload.c |   16 
 vm/reflection.c  |   44 +---
 3 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/include/vm/preload.h b/include/vm/preload.h
index 4976468..c5f6614 100644
--- a/include/vm/preload.h
+++ b/include/vm/preload.h
@@ -48,6 +48,7 @@ extern struct vm_class *vm_java_lang_Long;
 extern struct vm_class *vm_java_lang_Short;
 extern struct vm_class *vm_java_lang_IllegalArgumentException;
 extern struct vm_class *vm_java_lang_ClassLoader;
+extern struct vm_class *vm_java_lang_Number;
 extern struct vm_class *vm_boolean_class;
 extern struct vm_class *vm_char_class;
 extern struct vm_class *vm_float_class;
@@ -106,6 +107,8 @@ extern struct vm_method *vm_java_lang_Integer_init;
 extern struct vm_method *vm_java_lang_Long_init;
 extern struct vm_method *vm_java_lang_Short_init;
 extern struct vm_method *vm_java_lang_ClassLoader_loadClass;
+extern struct vm_method *vm_java_lang_Number_intValue;
+extern struct vm_method *vm_java_lang_Number_floatValue;
 
 int preload_vm_classes(void);
 
diff --git a/vm/preload.c b/vm/preload.c
index f75304b..8f83aa1 100644
--- a/vm/preload.c
+++ b/vm/preload.c
@@ -89,6 +89,7 @@ struct vm_class *vm_java_lang_Integer;
 struct vm_class *vm_java_lang_Long;
 struct vm_class *vm_java_lang_Short;
 struct vm_class *vm_java_lang_VMString;
+struct vm_class *vm_java_lang_Number;
 struct vm_class *vm_boolean_class;
 struct vm_class *vm_char_class;
 struct vm_class *vm_float_class;
@@ -149,6 +150,7 @@ static const struct preload_entry preload_entries[] = {
{ "java/lang/Long", &vm_java_lang_Long },
{ "java/lang/ClassLoader", &vm_java_lang_ClassLoader},
{ "java/lang/VMString", &vm_java_lang_VMString},
+   { "java/lang/Number", &vm_java_lang_Number },
 };
 
 static const struct preload_entry primitive_preload_entries[] = {
@@ -252,6 +254,8 @@ struct vm_method *vm_java_lang_Long_init;
 struct vm_method *vm_java_lang_Short_init;
 struct vm_method *vm_java_lang_ClassLoader_loadClass;
 struct vm_method *vm_java_lang_VMString_intern;
+struct vm_method *vm_java_lang_Number_intValue;
+struct vm_method *vm_java_lang_Number_floatValue;
 
 static const struct method_preload_entry method_preload_entries[] = {
{
@@ -404,6 +408,18 @@ static const struct method_preload_entry 
method_preload_entries[] = {
"(Ljava/lang/String;)Ljava/lang/String;",
&vm_java_lang_VMString_intern,
},
+   {
+   &vm_java_lang_Number,
+   "intValue",
+   "()I",
+   &vm_java_lang_Number_intValue,
+   },
+   {
+   &vm_java_lang_Number,
+   "floatValue",
+   "()F",
+   &vm_java_lang_Number_floatValue,
+   },
 };
 
 /*
diff --git a/vm/reflection.c b/vm/reflection.c
index 093d5a7..5ca70b2 100644
--- a/vm/reflection.c
+++ b/vm/reflection.c
@@ -618,6 +618,41 @@ jint native_field_get_modifiers_internal(struct vm_object 
*this)
return vmf->field->access_flags;
 }
 
+static int unwrap_and_set_field(void *field_ptr, enum vm_type type,
+   struct vm_object *value)
+{
+   switch (type) {
+   case J_REFERENCE:
+   *(jobject *) field_ptr = value;
+   return 0;
+   case J_BYTE:
+   case J_BOOLEAN:
+   case J_SHORT:
+   case J_CHAR:
+   case J_INT:
+   /*
+* We can handle those as int because these values are
+* returned by ireturn anyway.
+*/
+   *(long *) field_ptr = 
vm_call_method_this_a(vm_java_lang_Number_intValue,
+   value, NULL);
+   return 0;
+   case J_FLOAT:
+   *(jfloat *) field_ptr = (jfloat) 
vm_call_method_this_a(vm_java_lang_Number_floatValue,
+  value, 
NULL);
+   return 0;
+   case J_LONG:
+   case J_DOUBLE:
+   error("not implemented");
+   case J_VOID:
+   case J_RETURN_ADDRESS:
+   case VM_TYPE_MAX:
+   error("unexpected type");
+   }
+
+   return 0;
+}
+
 static int marshall_call_arguments(struct vm_method *vmm, unsigned long *args,
   struct vm_object *args_array)
 {
@@ -639,13 +674,8 @@ static int marshall_call_arguments(struct vm_method *vmm, 
unsigned long *args,
 
arg = array_get_field_ptr(args_array, args_array_idx++);
 
-   if (type == J_REFERENCE)
-   *(jobject *) &args[idx++] = arg;
-   else {
-   /* XXX: marshalling of primitive types not
-  implemented yet. */
-   error("primitive type marshalling not implemented");
-   }
+   if 

[PATCH 10/11] vm: implement properly VMStackWalker.getClassContext()

2009-08-15 Thread Tomek Grabiec

Signed-off-by: Tomek Grabiec 
---
 vm/jato.c |   28 +---
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/vm/jato.c b/vm/jato.c
index e1fd13c..fc90c3d 100644
--- a/vm/jato.c
+++ b/vm/jato.c
@@ -100,24 +100,38 @@ static struct vm_object 
*native_vmstackwalker_getclasscontext(void)
 {
struct stack_trace_elem st_elem;
struct compilation_unit *cu;
-   struct vm_class *class;
struct vm_object *res;
+   int depth;
 
init_stack_trace_elem_current(&st_elem);
+   depth = get_java_stack_trace_depth(&st_elem);
 
+   /* Skip call to VMStackWalker.getClassContext() */
+   depth--;
if (stack_trace_elem_next_java(&st_elem))
return NULL;
 
-   cu = jit_lookup_cu(st_elem.addr);
-   if (!cu) {
-   NOT_IMPLEMENTED;
+   res = vm_object_alloc_array(vm_array_of_java_lang_Class, depth);
+   if (!res) {
+   signal_new_exception(vm_java_lang_OutOfMemoryError, NULL);
return NULL;
}
 
-   class = cu->method->class;
+   for (int i = 0; i < depth; i++) {
+   cu = jit_lookup_cu(st_elem.addr);
+   if (!cu)
+   error("no compilation_unit mapping for %lx", 
st_elem.addr);
 
-   res = vm_object_alloc_array(vm_java_lang_Class, 1);
-   array_set_field_object(res, 0, class->object);
+   struct vm_class *vmc = cu->method->class;
+
+   if (vm_class_ensure_init(vmc))
+   return NULL;
+
+   /* XXX: We should remove Method.invoke() frames. */
+   array_set_field_object(res, i, vmc->object);
+
+   stack_trace_elem_next_java(&st_elem);
+   }
 
return res;
 }
-- 
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


[PATCH 09/11] vm: implement java/lang/reflection/Field.set()

2009-08-15 Thread Tomek Grabiec

Signed-off-by: Tomek Grabiec 
---
 include/vm/reflection.h |1 +
 vm/jato.c   |1 +
 vm/reflection.c |   47 +++
 3 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/include/vm/reflection.h b/include/vm/reflection.h
index 8e5f307..f9c709a 100644
--- a/include/vm/reflection.h
+++ b/include/vm/reflection.h
@@ -38,5 +38,6 @@ native_method_invokenative(struct vm_object *method, struct 
vm_object *o,
   struct vm_object *args,
   struct vm_object *declaringClass,
   jint slot);
+void native_field_set(struct vm_object *this, struct vm_object *o, struct 
vm_object *value_obj);
 
 #endif /* __JATO_VM_REFLECTION_H */
diff --git a/vm/jato.c b/vm/jato.c
index 9009334..e1fd13c 100644
--- a/vm/jato.c
+++ b/vm/jato.c
@@ -863,6 +863,7 @@ static struct vm_native natives[] = {
DEFINE_NATIVE("java/lang/reflect/Constructor", "constructNative", 
&native_constructor_construct_native),
DEFINE_NATIVE("java/lang/reflect/Field", "get", &native_field_get),
DEFINE_NATIVE("java/lang/reflect/Field", "getModifiersInternal", 
native_field_get_modifiers_internal),
+   DEFINE_NATIVE("java/lang/reflect/Field", "set", &native_field_set),
DEFINE_NATIVE("java/lang/reflect/Field", "getType", 
&native_field_gettype),
DEFINE_NATIVE("java/lang/reflect/Method", "getParameterTypes", 
&native_method_get_parameter_types),
DEFINE_NATIVE("java/lang/reflect/Method", "invokeNative", 
&native_method_invokenative),
diff --git a/vm/reflection.c b/vm/reflection.c
index 5ca70b2..1eecf99 100644
--- a/vm/reflection.c
+++ b/vm/reflection.c
@@ -653,6 +653,53 @@ static int unwrap_and_set_field(void *field_ptr, enum 
vm_type type,
return 0;
 }
 
+void native_field_set(struct vm_object *this, struct vm_object *o,
+ struct vm_object *value_obj)
+{
+   struct vm_field *vmf;
+
+   if (!this) {
+   signal_new_exception(vm_java_lang_NullPointerException, NULL);
+   return;
+   }
+
+   vmf = vm_object_to_vm_field(this);
+   if (!vmf)
+   return;
+
+   /*
+* TODO: "If this Field enforces access control, your runtime
+* context is evaluated, and you may have an
+* IllegalAccessException if you could not access this field
+* in similar compiled code". (java/lang/reflect/Field.java)
+*/
+
+   enum vm_type type = vm_field_type(vmf);
+
+   if (vm_field_is_static(vmf)) {
+   unwrap_and_set_field(vmf->class->static_values + vmf->offset,
+type, value_obj);
+   } else {
+   /*
+* If o is null, you get a NullPointerException, and
+* if it is incompatible with the declaring class of
+* the field, you get an IllegalArgumentException.
+*/
+   if (!o) {
+   signal_new_exception(vm_java_lang_NullPointerException,
+NULL);
+   return;
+   }
+
+   if (o->class != vmf->class) {
+   
signal_new_exception(vm_java_lang_IllegalArgumentException, NULL);
+   return;
+   }
+
+   unwrap_and_set_field(&o->fields[vmf->offset], type, value_obj);
+   }
+}
+
 static int marshall_call_arguments(struct vm_method *vmm, unsigned long *args,
   struct vm_object *args_array)
 {
-- 
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


[PATCH 07/11] vm: fix vm_class_is_assignable_from() for array classes

2009-08-15 Thread Tomek Grabiec

Signed-off-by: Tomek Grabiec 
---
 vm/class.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/vm/class.c b/vm/class.c
index 12932e8..e4e099d 100644
--- a/vm/class.c
+++ b/vm/class.c
@@ -998,7 +998,7 @@ bool vm_class_is_assignable_from(const struct vm_class 
*vmc, const struct vm_cla
 
if (vm_class_is_array_class(vmc)) {
if (!vm_class_is_array_class(from))
-   return from == vm_java_lang_Object;
+   return false;
 
const struct vm_class *vmc_el
= vm_class_get_array_element_class(vmc);
-- 
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


[PATCH 06/11] vm: handle primitive and array classes in reflection code

2009-08-15 Thread Tomek Grabiec
We cannot access ->class field for primitive and array classes (it is
NULL). These classes do not declare methods, fields nor constructors.

Signed-off-by: Tomek Grabiec 
---
 vm/reflection.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/vm/reflection.c b/vm/reflection.c
index 154e86e..093d5a7 100644
--- a/vm/reflection.c
+++ b/vm/reflection.c
@@ -91,6 +91,9 @@ native_vmclass_get_declared_fields(struct vm_object *clazz,
if (!vmc)
return NULL;
 
+   if (vm_class_is_primitive_class(vmc) || vm_class_is_array_class(vmc))
+   return 
vm_object_alloc_array(vm_array_of_java_lang_reflect_Field, 0);
+
int count;
 
if (public_only) {
@@ -160,6 +163,9 @@ native_vmclass_get_declared_methods(struct vm_object *clazz,
if (!vmc)
return NULL;
 
+   if (vm_class_is_primitive_class(vmc) || vm_class_is_array_class(vmc))
+   return 
vm_object_alloc_array(vm_array_of_java_lang_reflect_Field, 0);
+
int count;
 
if (public_only) {
@@ -229,6 +235,9 @@ native_vmclass_get_declared_constructors(struct vm_object 
*clazz,
if (!vmc)
return NULL;
 
+   if (vm_class_is_primitive_class(vmc) || vm_class_is_array_class(vmc))
+   return 
vm_object_alloc_array(vm_array_of_java_lang_reflect_Field, 0);
+
int count = 0;
 
for (int i = 0; i < vmc->class->methods_count; i++) {
-- 
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


[PATCH 05/11] vm: implement java/lang/reflection.Field.getType()

2009-08-15 Thread Tomek Grabiec

Signed-off-by: Tomek Grabiec 
---
 include/vm/reflection.h |1 +
 include/vm/types.h  |1 +
 vm/jato.c   |1 +
 vm/reflection.c |   29 +
 vm/types.c  |   22 +-
 5 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/include/vm/reflection.h b/include/vm/reflection.h
index ebfd0fe..8e5f307 100644
--- a/include/vm/reflection.h
+++ b/include/vm/reflection.h
@@ -31,6 +31,7 @@ struct vm_object *native_vmclass_get_interfaces(struct 
vm_object *clazz);
 struct vm_object *native_vmclass_get_superclass(struct vm_object *clazz);
 struct vm_object *native_field_get(struct vm_object *this, struct vm_object 
*o);
 jint native_field_get_modifiers_internal(struct vm_object *this);
+struct vm_object *native_field_gettype(struct vm_object *this);
 
 struct vm_object *
 native_method_invokenative(struct vm_object *method, struct vm_object *o,
diff --git a/include/vm/types.h b/include/vm/types.h
index 93fbb33..368729d 100644
--- a/include/vm/types.h
+++ b/include/vm/types.h
@@ -36,6 +36,7 @@ int vmtype_to_bytecode_type(enum vm_type);
 int get_vmtype_size(enum vm_type);
 const char *get_vm_type_name(enum vm_type);
 const char *parse_method_args(const char *, enum vm_type *, char **);
+const char *parse_type(const char *, enum vm_type *, char **);
 unsigned int count_java_arguments(const char *);
 
 static inline bool vm_type_is_float(enum vm_type type)
diff --git a/vm/jato.c b/vm/jato.c
index bf67188..9009334 100644
--- a/vm/jato.c
+++ b/vm/jato.c
@@ -863,6 +863,7 @@ static struct vm_native natives[] = {
DEFINE_NATIVE("java/lang/reflect/Constructor", "constructNative", 
&native_constructor_construct_native),
DEFINE_NATIVE("java/lang/reflect/Field", "get", &native_field_get),
DEFINE_NATIVE("java/lang/reflect/Field", "getModifiersInternal", 
native_field_get_modifiers_internal),
+   DEFINE_NATIVE("java/lang/reflect/Field", "getType", 
&native_field_gettype),
DEFINE_NATIVE("java/lang/reflect/Method", "getParameterTypes", 
&native_method_get_parameter_types),
DEFINE_NATIVE("java/lang/reflect/Method", "invokeNative", 
&native_method_invokenative),
DEFINE_NATIVE("jato/internal/VM", "enableFault", 
&native_vm_enable_fault),
diff --git a/vm/reflection.c b/vm/reflection.c
index c9846f8..154e86e 100644
--- a/vm/reflection.c
+++ b/vm/reflection.c
@@ -701,3 +701,32 @@ native_method_invokenative(struct vm_object *method, 
struct vm_object *o,
signal_new_exception(vm_java_lang_IllegalArgumentException, NULL);
return NULL;
 }
+
+struct vm_object *native_field_gettype(struct vm_object *this)
+{
+   struct vm_field *vmf;
+
+   if (!this) {
+   signal_new_exception(vm_java_lang_NullPointerException, NULL);
+   return 0;
+   }
+
+   vmf = vm_object_to_vm_field(this);
+   if (!vmf)
+   return 0;
+
+   enum vm_type vmtype;
+   char *type_name;
+
+   if (!parse_type(vmf->type, &vmtype, &type_name)) {
+   warn("type parsing failed");
+   return NULL;
+   }
+
+   struct vm_class *vmc = vm_type_to_class(type_name, vmtype);
+
+   if (vm_class_ensure_init(vmc))
+   return NULL;
+
+   return vmc->object;
+}
diff --git a/vm/types.c b/vm/types.c
index 39e3d45..08a2e4a 100644
--- a/vm/types.c
+++ b/vm/types.c
@@ -161,20 +161,15 @@ const char *get_vm_type_name(enum vm_type type) {
return vm_type_names[type];
 }
 
-const char *parse_method_args(const char *type_str, enum vm_type *vmtype,
- char **name_p)
+const char *parse_type(const char *type_str, enum vm_type *vmtype,
+  char **name_p)
 {
-   const char *type_name_start;
-
-   if (*type_str == '(')
-   type_str++;
-
-   type_name_start = type_str;
+   const char *type_name_start = type_str;
 
if (name_p)
*name_p = NULL;
 
-   if (*type_str == ')')
+   if (!type_str || *type_str == ')')
return NULL;
 
if (*type_str == '[') {
@@ -217,6 +212,15 @@ const char *parse_method_args(const char *type_str, enum 
vm_type *vmtype,
return type_str;
 }
 
+const char *parse_method_args(const char *type_str, enum vm_type *vmtype,
+ char **name_p)
+{
+   if (*type_str == '(')
+   type_str++;
+
+   return parse_type(type_str, vmtype, name_p);
+}
+
 unsigned int count_java_arguments(const char *type)
 {
unsigned int count;
-- 
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-

[PATCH 01/11] vm: declare vm_call_method_*() for all primitive types

2009-08-15 Thread Tomek Grabiec

Signed-off-by: Tomek Grabiec 
---
 include/vm/call.h |   22 +-
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/include/vm/call.h b/include/vm/call.h
index c6e6f39..d0238ba 100644
--- a/include/vm/call.h
+++ b/include/vm/call.h
@@ -18,15 +18,15 @@ unsigned long vm_call_method_this_a(struct vm_method 
*method,
unsigned long *args);
 unsigned long vm_call_method_a(struct vm_method *method, unsigned long *args);
 
-#define DECLARE_VM_CALL_METHOD(type, suffix)   \
-   static inline type  \
-   vm_call_method##suffix(struct vm_method *method, ...)   \
+#define DECLARE_VM_CALL_METHOD(type)   \
+   static inline j ## type \
+   vm_call_method_ ## type(struct vm_method *method, ...)  \
{   \
-   type result;\
+   j ## type result;   \
va_list args;   \
\
va_start(args, method); \
-   result = (type)vm_call_method_v(method, args);  \
+   result = (j ## type)vm_call_method_v(method, args); \
va_end(args);   \
\
return result;  \
@@ -41,9 +41,13 @@ static inline void vm_call_method(struct vm_method *method, 
...)
va_end(args);
 }
 
-DECLARE_VM_CALL_METHOD(unsigned long, _ulong);
-DECLARE_VM_CALL_METHOD(struct vm_object *, _object);
-DECLARE_VM_CALL_METHOD(jint, _jint);
-DECLARE_VM_CALL_METHOD(jboolean, _jboolean);
+DECLARE_VM_CALL_METHOD(byte);
+DECLARE_VM_CALL_METHOD(boolean);
+DECLARE_VM_CALL_METHOD(double);
+DECLARE_VM_CALL_METHOD(float);
+DECLARE_VM_CALL_METHOD(long);
+DECLARE_VM_CALL_METHOD(short);
+DECLARE_VM_CALL_METHOD(object);
+DECLARE_VM_CALL_METHOD(int);
 
 #endif
-- 
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


[PATCH 04/11] vm: cleanup field access functions in reflection.c

2009-08-15 Thread Tomek Grabiec

Signed-off-by: Tomek Grabiec 
---
 vm/reflection.c |   18 --
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/vm/reflection.c b/vm/reflection.c
index 14fdb12..c9846f8 100644
--- a/vm/reflection.c
+++ b/vm/reflection.c
@@ -553,9 +553,6 @@ static struct vm_object *encapsulate_value(void *value_p, 
enum vm_type type)
 struct vm_object *native_field_get(struct vm_object *this, struct vm_object *o)
 {
struct vm_field *vmf;
-   struct vm_class *vmc;
-   struct vm_object *clazz;
-   unsigned int slot;
void *value_p;
 
if (!this) {
@@ -563,17 +560,10 @@ struct vm_object *native_field_get(struct vm_object 
*this, struct vm_object *o)
return NULL;
}
 
-   clazz = field_get_object(this, 
vm_java_lang_reflect_Field_declaringClass);
-   slot = field_get_int(this, vm_java_lang_reflect_Field_slot);
-
-   vmc = vm_class_get_class_from_class_object(clazz);
-
-   vm_class_ensure_init(vmc);
-   if (exception_occurred())
+   vmf = vm_object_to_vm_field(this);
+   if (!vmf)
return NULL;
 
-   vmf = &vmc->fields[slot];
-
/*
 * TODO: "If this Field enforces access control, your runtime
 * context is evaluated, and you may have an
@@ -584,7 +574,7 @@ struct vm_object *native_field_get(struct vm_object *this, 
struct vm_object *o)
enum vm_type type = vm_field_type(vmf);
 
if (vm_field_is_static(vmf)) {
-   value_p = vmc->static_values + vmf->offset;
+   value_p = vmf->class->static_values + vmf->offset;
} else {
/*
 * If o is null, you get a NullPointerException, and
@@ -597,7 +587,7 @@ struct vm_object *native_field_get(struct vm_object *this, 
struct vm_object *o)
return NULL;
}
 
-   if (o->class != vmc) {
+   if (o->class != vmf->class) {

signal_new_exception(vm_java_lang_IllegalArgumentException, NULL);
return NULL;
}
-- 
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


[PATCH 03/11] vm: preload primitve type class for J_VOID.

2009-08-15 Thread Tomek Grabiec
We will have to return this class as void method's result type class.

Signed-off-by: Tomek Grabiec 
---
 include/vm/preload.h |1 +
 vm/classloader.c |2 +-
 vm/preload.c |2 ++
 vm/reflection.c  |7 +--
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/vm/preload.h b/include/vm/preload.h
index 0617ba6..4976468 100644
--- a/include/vm/preload.h
+++ b/include/vm/preload.h
@@ -56,6 +56,7 @@ extern struct vm_class *vm_byte_class;
 extern struct vm_class *vm_short_class;
 extern struct vm_class *vm_int_class;
 extern struct vm_class *vm_long_class;
+extern struct vm_class *vm_void_class;
 
 extern struct vm_field *vm_java_lang_Class_vmdata;
 extern struct vm_field *vm_java_lang_String_offset;
diff --git a/vm/classloader.c b/vm/classloader.c
index 5011b3e..73bfcd7 100644
--- a/vm/classloader.c
+++ b/vm/classloader.c
@@ -382,7 +382,7 @@ struct vm_class *classloader_load_primitive(const char 
*class_name)
 
cache_index = str_to_type(class_name);
 
-   if (cache_index == J_VOID || cache_index == J_REFERENCE)
+   if (cache_index == J_REFERENCE)
return NULL;
 
if (primitive_class_cache[cache_index])
diff --git a/vm/preload.c b/vm/preload.c
index 4d477db..f75304b 100644
--- a/vm/preload.c
+++ b/vm/preload.c
@@ -97,6 +97,7 @@ struct vm_class *vm_byte_class;
 struct vm_class *vm_short_class;
 struct vm_class *vm_int_class;
 struct vm_class *vm_long_class;
+struct vm_class *vm_void_class;
 
 static const struct preload_entry preload_entries[] = {
{ "java/lang/Object",   &vm_java_lang_Object },
@@ -159,6 +160,7 @@ static const struct preload_entry 
primitive_preload_entries[] = {
{"S", &vm_short_class},
{"I", &vm_int_class},
{"J", &vm_long_class},
+   {"V", &vm_void_class},
 };
 
 struct field_preload_entry {
diff --git a/vm/reflection.c b/vm/reflection.c
index 8270f1a..14fdb12 100644
--- a/vm/reflection.c
+++ b/vm/reflection.c
@@ -294,10 +294,13 @@ static struct vm_class *vm_type_to_class(char *type_name, 
enum vm_type type)
return vm_int_class;
case J_LONG:
return vm_long_class;
+   case J_VOID:
+   return vm_void_class;
case J_REFERENCE:
return classloader_load(type_name);
-   default:
-   NOT_IMPLEMENTED;
+   case J_RETURN_ADDRESS:
+   case VM_TYPE_MAX:
+   error("invalid type");
}
 
return NULL;
-- 
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


[PATCH 02/11] jit: remove "*** pointer not on heap ***" from -Xtrace:invoke-verbose

2009-08-15 Thread Tomek Grabiec
It is so common for pointers to be not on heap that
it is pointless to print this information.

Signed-off-by: Tomek Grabiec 
---
 jit/trace-jit.c |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/jit/trace-jit.c b/jit/trace-jit.c
index 07dd84a..2caa1c9 100644
--- a/jit/trace-jit.c
+++ b/jit/trace-jit.c
@@ -524,11 +524,6 @@ static void print_arg(enum vm_type arg_type, const 
unsigned long *args,
goto out;
}
 
-   if (!is_on_heap((unsigned long)obj)) {
-   trace_printf("*** pointer not on heap ***");
-   trace_flush();
-   }
-
if (obj->class == vm_java_lang_String) {
char *str;
int len;
-- 
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


[penberg/jato] 95d678: vm: Implement Field.getModifiersInternal()

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 95d678e2865dff699efadd8249313ef6df177404

http://github.com/penberg/jato/commit/95d678e2865dff699efadd8249313ef6df177404
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M include/vm/reflection.h
  M vm/jato.c
  M vm/reflection.c

Log Message:
---
vm: Implement Field.getModifiersInternal()

Signed-off-by: Pekka Enberg 



--
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


[penberg/jato] 5bca4a: vm: ifdef gc_map_init() because it's so slow

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 5bca4a547b0a8792d83ba92015226082ca5eb5f6

http://github.com/penberg/jato/commit/5bca4a547b0a8792d83ba92015226082ca5eb5f6
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M jit/gc-map.c

Log Message:
---
vm: ifdef gc_map_init() because it's so slow

This patch ifdefs the expensive loop in gc_map_init() because it's so
damn slow. HelloWorldSwing spends 60% and JDarkRoom 80% of its time
there which makes testing painful.

Signed-off-by: Pekka Enberg 



--
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


[penberg/jato] 91829e: vm: Cleanup vm_object_to_vm_field()

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 91829e2c372a9567fb0f297f49494bf23fc6a5ad

http://github.com/penberg/jato/commit/91829e2c372a9567fb0f297f49494bf23fc6a5ad
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M vm/reflection.c
  M vm/unsafe.c

Log Message:
---
vm: Cleanup vm_object_to_vm_field()

This patch changes vm_object_to_vm_field() to behave like
vm_object_to_vm_class() which signals an exception on error conditions.

Signed-off-by: Pekka Enberg 



--
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


[penberg/jato] 2f2f6a: x86: Implement Unsafe.compareAndSwapInt()

2009-08-15 Thread noreply
Branch: refs/heads/master
Home:   http://github.com/penberg/jato

Commit: 2f2f6a46e915ccfab83ab87178e92aa168bcfadd

http://github.com/penberg/jato/commit/2f2f6a46e915ccfab83ab87178e92aa168bcfadd
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M Makefile
  A arch/x86/include/arch/atomic.h
  M include/vm/unsafe.h
  M regression/run-suite.sh
  A regression/sun/misc/UnsafeTest.java
  M vm/jato.c
  M vm/unsafe.c

Log Message:
---
x86: Implement Unsafe.compareAndSwapInt()

This patch implements UnsafeTest.compareAndSwapInt() using the cmpxchgl
instruction.

Signed-off-by: Pekka Enberg 


Commit: ff67c0604f354a13c69a3c75e52238773b51d88c

http://github.com/penberg/jato/commit/ff67c0604f354a13c69a3c75e52238773b51d88c
Author: Pekka Enberg 
Date:   2009-08-15 (Sat, 15 Aug 2009)

Changed paths:
  M arch/x86/include/arch/atomic.h
  M include/vm/unsafe.h
  M regression/sun/misc/UnsafeTest.java
  M vm/jato.c
  M vm/unsafe.c

Log Message:
---
x86: Implement Unsafe.compareAndSwapObject()

While at it, fix return value of native_unsafe_compare_and_swap_int() to
"jint"; otherwise GCC can use "sete %al" for the return value which does
not zero the upper bits of %eax.

Note: the 64-bit version is untested.

Signed-off-by: Pekka Enberg 



--
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