[kaffe] RE: kaffe digest, Vol 1 #440 - 8 msgs

Claudio De Luca cdeluca at zeni.com.ar
Thu May 15 09:30:02 PDT 2003


-----Mensaje original-----
De: kaffe-request at kaffe.org [mailto:kaffe-request at kaffe.org]
Enviado el: Jueves 15 de Mayo de 2003 13:24
Para: kaffe at kaffe.org
Asunto: kaffe digest, Vol 1 #440 - 8 msgs


Send kaffe mailing list submissions to
	kaffe at kaffe.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
or, via email, send a message with subject or body 'help' to
	kaffe-request at kaffe.org

You can reach the person managing the list at
	kaffe-admin at kaffe.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of kaffe digest..."


Today's Topics:

   1. Kaffe CVS: kaffe stack (Kaffe CVS)
   2. Re: Re: Decoding compiled class files (Mark Wielaard)
   3. Kaffe CVS: kaffe stack (Kaffe CVS)
   4. Re: Bug [CVS version]: class not found (Timothy Stack)
   5. Kaffe CVS: kaffe stack (Kaffe CVS)
   6. Re: java.lang.UnsatisfiedLinkError: not enough memory (Ito Kazumitsu)
   7. Re: (no subject) (Gerlando Falauto)
   8. [PATCH] IA-64 fixes (Gwenole Beauchesne)

--__--__--

Message: 1
From: Kaffe CVS <cvs-commits at kaffe.org>
To:  kaffe at kaffe.org
Reply-To: kaffe at kaffe.org
Date: Thu, 15 May 2003 08:03:25 -0700
Subject: [kaffe] Kaffe CVS: kaffe stack


CVSROOT:	/cvs/kaffe
Module name:	kaffe
Changes by:	stack	03/05/15 08:03:25

Modified files:
	.              : Makefile.am Makefile.in configure configure.in 
	config         : Makefile.in config.h.in 
	include        : Arrays.h Makefile.am Makefile.in errors.h 
	kaffe          : Makefile.in 
	kaffe/kaffe    : Makefile.in 
	kaffe/kaffevm/gcj: Makefile.in 
	kaffe/kaffevm/intrp: Makefile.in 
	kaffe/kaffevm/jit: Makefile.in 
	kaffe/kaffevm/jit3: Makefile.in 
	kaffe/kaffevm/systems: Makefile.in 
	kaffe/kaffevm/systems/beos-native: Makefile.in 
	kaffe/kaffevm/systems/oskit-pthreads: Makefile.in 
	kaffe/kaffevm/systems/unix-jthreads: Makefile.in 
	kaffe/kaffevm/systems/unix-pthreads: Makefile.in 
	kaffe/man      : Makefile.in 
	kaffe/scripts  : Makefile.in 
	kaffe/scripts/bat: Makefile.in 
	kaffe/scripts/compat: Makefile.in 
	kaffe/xprof    : Makefile.in 
	libraries      : Makefile.in 
	libraries/clib : Makefile.in 
	libraries/clib/awt: Makefile.in 
	libraries/clib/awt/X: Makefile.in 
	libraries/clib/awt/qt: Makefile.in 
	libraries/clib/io: Makefile.in 
	libraries/clib/management: Makefile.in 
	libraries/clib/math: Makefile.in 
	libraries/clib/native: Makefile.in 
	libraries/clib/net: InetAddressImpl.c Makefile.am Makefile.in 
	libraries/clib/security: Makefile.in 
	libraries/clib/zip: Makefile.in 
	libraries/extensions: Makefile.in 
	libraries/extensions/comm: Makefile.in 
	libraries/extensions/comm/javalib: Makefile.in 
	libraries/extensions/microsoft: Makefile.in 
	libraries/extensions/microsoft/clib: Makefile.in 
	libraries/extensions/microsoft/javalib: Makefile.in 
	libraries/extensions/pjava: Makefile.in 
	libraries/extensions/pjava/javalib: Makefile.in 
	libraries/extensions/servlet: Makefile.in 
	libraries/extensions/servlet/javalib: Makefile.in 
	libraries/extensions/sound: Makefile.in 
	libraries/extensions/sound/alsa: Makefile.in 
	libraries/extensions/sound/common: Makefile.in 
	libraries/extensions/sound/esd: Makefile.in 
	libraries/javalib: Klasses.jar.bootstrap Makefile.am Makefile.in 
	                   bootstrap.classlist essential.files 
	                   rebuildLib.in 
	libraries/javalib/java/lang: IllegalArgumentException.java 
	libraries/javalib/java/net: InetAddress.java 
	                            InetAddressImpl.java 
	                            NetworkInterface.java 
	                            UnknownHostException.java 
	libraries/javalib/profiles/allatonce: all.files 
	libraries/javalib/profiles/default: core.files 
	replace        : Makefile.in 
	test           : Makefile.in 
	test/internal  : Makefile.in 
	test/regression: Makefile.am Makefile.in 
Added files:
	FAQ            : FAQ.dns 
	libraries/clib/net: NetworkInterfaceImpl.c 
	libraries/javalib/java/net: DNSJavaInetAddressImpl.java 
	                            Inet4Address.java Inet6Address.java 
	                            NativeInetAddressImpl.java 
	                            NetworkInterfaceImpl.java 
	test/regression: InetAddressTest.java 

Log message:
2003-05-15 Tim Stack <stack at cs.utah.edu>

* Makefile.am:
Add DNSJAVA_JAR to the BUILD_ENVIRONMENT.

* configure.in:
Add --with-dnsjava option that lets the user specify a dnsjava Jar
file from www.xbill.org/dnsjava.

* FAQ/FAQ.dns:
Explanation of DNS stuff in kaffe.

* include/Arrays.h:
Add more unhand_*_array() macros.

* include/Makefile.am:
Add java_net_NativeInetAddressImpl.h and
java_net_NetworkInterfaceImpl.h.

* include/errors.h:
Add JAVA_NET() macro.

* libraries/clib/net/InetAddressImpl.c:
Rewrite to use getaddrinfo()/getnameinfo() and support the new
InetAddressImpl API.

* libraries/clib/net/Makefile.am:
Change NetworkInterface.c to NetworkInterfaceImpl.c.

* libraries/clib/net/NetworkInterface.c:
Renamed to NetworkInterfaceImpl.c.

* libraries/clib/net/NetworkInterfaceImpl.c:
Name change and add support for IPv6 addresses.

* libraries/javalib/Makefile.am:
Add support for pure java DNS.  Add Inet4Address/Inet6Address from
classpath.  Add NetworkInterfaceImpl.java.

* libraries/javalib/bootstrap.classlist:
Add java/net/NativeInetAddressImpl.class and
java/net/NetworkInterfaceImpl.class.

* libraries/javalib/essential.files,
libraries/javalib/profiles/alltatonce/all.files,
libraries/javalib/profiles/default/core.files:
Add java/net/NativeInetAddressImpl.java.

* libraries/javalib/rebuildLib.in:
Test for zero arguments and exit with zero.  Use the
BUILD_ENVIRONMENT for jikes too.

* libraries/javalib/java/lang/IllegalArgumentException.java:
Add exception chaining.

* libraries/javalib/java/net/DNSJavaInetAddressImpl.java:
InetAddressImpl that uses dnsjava from xbill.org.

* libraries/javalib/java/net/Inet4Address.java,
libraries/javalib/java/net/Inet6Address.java:
Merged from GNU classpath and fixed.

* libraries/javalib/java/net/InetAddress.java:
Add support for IPv6 addresses and multiple implementations.

* libraries/javalib/java/net/InetAddressImpl.java:
Changes to support IPv6 and multiple implementations.

* libraries/javalib/java/net/NativeInetAddressImpl.java:
Default native InetAddressImpl.

* libraries/javalib/java/net/NetworkInterface.java:
Move implementation details to NetworkInterfaceImpl.java and
detection is now done on every call instead of once at startup.

* libraries/javalib/java/net/NetworkInterfaceImpl.java:
Implementation details for NetworkInterface.java.

* libraries/javalib/java/net/UnknownHostException.java:
Add exception chaining.

* test/regression/InetAddressTest.java:
Simple test for InetAddresses.

* test/regression/Makefile.am:
Add InetAddressTest.java.



--__--__--

Message: 2
Subject: Re: [kaffe] Re: Decoding compiled class files
From: Mark Wielaard <mark at klomp.org>
To: wyattaw at optushome.com.au
Cc: kaffe at kaffe.org
Organization: 
Date: 15 May 2003 17:15:27 +0200


--=-sYOCLcdmFK5trYhrUV06
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,

On Tue, 2003-05-13 at 16:24, Tony Wyatt wrote:
>
> I want something that decodes and prints out the entire contents of the
> .class file structure, so that I can see the variables, constants pool, 
> initialisation, operations performed by bytecode, etc, etc. 
> I'm trying to identify and then fix the difference of a single byte 
> between two very simple files.

gcj comes with jcf-dump. I believe jcf-dump -c does precisely what you
want. For example for your eexample (put into a main() method in a class
Test it gives the attached output.

Cheers,

Mark

--=-sYOCLcdmFK5trYhrUV06
Content-Disposition: inline; filename=jcf-dump-c.out
Content-Type: text/plain; name=jcf-dump-c.out; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Reading .class from ./Test.class.
Magic number: 0xcafebabe, minor_version: 0, major_version: 47.

Constant pool (count: 57):
#1: Class name: 2="Test"
#2: Utf8: "Test"
#3: Class name: 4="java/lang/Object"
#4: Utf8: "java/lang/Object"
#5: Utf8: "main"
#6: Utf8: "([Ljava/lang/String;)V"
#7: Utf8: "Code"
#8: Utf8: "LineNumberTable"
#9: Double QNaN(0), bits = 0x7ff8000000000000
#11: Long 9218869174563700736=0x7ff000abacab0000
#13: NameAndType name: 14=longBitsToDouble, signature: 15=(long)double
#14: Utf8: "longBitsToDouble"
#15: Utf8: "(J)D"
#16: Methodref class: 17=java.lang.Double name_and_type:
13=<longBitsToDouble (long)double>
#17: Class name: 18="java/lang/Double"
#18: Utf8: "java/lang/Double"
#19: Long -9223372036854775808=0x8000000000000000
#21: NameAndType name: 22=out, signature: 23=java.io.PrintStream
#22: Utf8: "out"
#23: Utf8: "Ljava/io/PrintStream;"
#24: Fieldref class: 25=java.lang.System name_and_type: 21=<out
java.io.PrintStream>
#25: Class name: 26="java/lang/System"
#26: Utf8: "java/lang/System"
#27: Class name: 28="java/lang/StringBuffer"
#28: Utf8: "java/lang/StringBuffer"
#29: String 30="x ="
#30: Utf8: "x ="
#31: NameAndType name: 32=<init>, signature: 33=(java.lang.String)void
#32: Utf8: "<init>"
#33: Utf8: "(Ljava/lang/String;)V"
#34: Methodref class: 27=java.lang.StringBuffer name_and_type: 31=<<init>
(java.lang.String)void>
#35: NameAndType name: 36=append, signature:
37=(double)java.lang.StringBuffer
#36: Utf8: "append"
#37: Utf8: "(D)Ljava/lang/StringBuffer;"
#38: Methodref class: 27=java.lang.StringBuffer name_and_type: 35=<append
(double)java.lang.StringBuffer>
#39: NameAndType name: 40=toString, signature: 41=()java.lang.String
#40: Utf8: "toString"
#41: Utf8: "()Ljava/lang/String;"
#42: Methodref class: 27=java.lang.StringBuffer name_and_type: 39=<toString
()java.lang.String>
#43: NameAndType name: 44=println, signature: 33=(java.lang.String)void
#44: Utf8: "println"
#45: Methodref class: 46=java.io.PrintStream name_and_type: 43=<println
(java.lang.String)void>
#46: Class name: 47="java/io/PrintStream"
#47: Utf8: "java/io/PrintStream"
#48: String 49="y ="
#49: Utf8: "y ="
#50: String 51="z ="
#51: Utf8: "z ="
#52: Utf8: "()V"
#53: NameAndType name: 32=<init>, signature: 52=()void
#54: Methodref class: 3=java.lang.Object name_and_type: 53=<<init> ()void>
#55: Utf8: "SourceFile"
#56: Utf8: "Test.java"

Access flags: 0x21 public super
This class: 1=Test, super: 3=java.lang.Object
Interfaces (count: 0):

Fields (count: 0):

Methods (count: 2):

Method name:"main" public static Signature: 6=(java.lang.String[])void
Attribute "Code", length:135, max_stack:4, max_locals:7, code_length:87
Attribute "LineNumberTable", length:30, count: 7

Method name:"<init>" public Signature: 52=()void
Attribute "Code", length:33, max_stack:1, max_locals:1, code_length:5
Attribute "LineNumberTable", length:10, count: 2

Attributes (count: 1):
Attribute "SourceFile", length:2, #56="Test.java"

--=-sYOCLcdmFK5trYhrUV06--



--__--__--

Message: 3
From: Kaffe CVS <cvs-commits at kaffe.org>
To:  kaffe at kaffe.org
Reply-To: kaffe at kaffe.org
Date: Thu, 15 May 2003 08:17:52 -0700
Subject: [kaffe] Kaffe CVS: kaffe stack


CVSROOT:	/cvs/kaffe
Module name:	kaffe
Changes by:	stack	03/05/15 08:17:52

Modified files:
	libraries/javalib: essential.files 

Log message:
add java/util/RandomAccess.java



--__--__--

Message: 4
Subject: Re: [kaffe] Bug [CVS version]: class not found
To: Herve.Roussain at univ-ubs.fr (=?ISO-8859-1?Q?Herv=E9_Roussain?=)
Date: Thu, 15 May 2003 09:25:58 -0600 (MDT)
Cc: kaffe at kaffe.org
From: Timothy Stack <stack at cs.utah.edu>

>=20
> Hi,

hi,

> I've just tried to compile the last CVS version, and I get this error=20
> message:
>
> (...)
> [ parsed kaffe/util/UTF8.java in 8 ms ]
> java/util/AbstractList.java:920: error:Cannot find class "RandomAccess"=
=20
> [JLS 8]

> This is because java/util/RandomAccess.java is not in essential.files,=20
> and the recently modified AbstractList.java use it.
>=20
> Solution: move the line "java/util/RandomAccess.java" from=20
> .../javalib/profiles/{default/core.files,allatonce/all.files) to=20
> .../javalib/essential.files
>=20
> I've tried, but it should work since RandomAccess have no other=20
> dependencies.

Done, thanks

> Cheers,
> Herv=E9

tim


--__--__--

Message: 5
From: Kaffe CVS <cvs-commits at kaffe.org>
To:  kaffe at kaffe.org
Reply-To: kaffe at kaffe.org
Date: Thu, 15 May 2003 08:22:46 -0700
Subject: [kaffe] Kaffe CVS: kaffe stack


CVSROOT:	/cvs/kaffe
Module name:	kaffe
Changes by:	stack	03/05/15 08:22:45

Modified files:
	libraries/javalib/profiles/allatonce: all.files 
	libraries/javalib/profiles/default: core.files 

Log message:
moved to essential.files



--__--__--

Message: 6
From: Ito Kazumitsu <kaz at maczuka.gcd.org>
To: kaffe at kaffe.org
Subject: Re: [kaffe] java.lang.UnsatisfiedLinkError: not enough memory
Date: Fri, 16 May 2003 01:23:07 +0900

>>>>> ":" == Ito Kazumitsu <kaz at maczuka.gcd.org> writes:

:> The "java.lang.UnsatisfiedLinkError: not enough memory" error
:> occurs on my machene:
:> 
:> bash-2.05b$ uname -a
:> FreeBSD ph.maczuka.gcd.org 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Wed Oct  9
15:08:34 GMT 2002
root at builder.freebsdmall.com:/usr/obj/usr/src/sys/GENERIC  i386

This time I used Doug Lea's malloc-2.6.5 instead of FreeBSD's malloc.

The AWT program did not run, either.  But the error message changed:

bash-2.05b$ LD_LIBRARY_PATH=/usr/local/kaffe/jre/lib/i386 java
org.hsqldb.util.DatabaseManager
accessing free page 0x854bffc (above 0x804c000)
Abort trap (core dumped)



--__--__--

Message: 7
Date: Thu, 15 May 2003 18:24:35 +0200 (CEST)
From: Gerlando Falauto <iurly at writeme.com>
To: Timothy Stack <stack at cs.utah.edu>
Cc: <kaffe at kaffe.org>
Subject: Re: [kaffe] (no subject)

Hi Tim,

thanks a lot for your impressively quick response!
I checked out the test/internal directory and it seems pretty much what I 
need. 

I got a minor problem though, I have been working on version 1.0.7 (the
head version seemed far too big and complicated to try working on that), 
so I kinda don't know how to merge it in my sandbox... I tried simply 
adding test/internal/Makefile to configure, but on make I get some weird:

Makefile:364: *** missing separator.  Stop.

where Makefile:364 says

@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jitBasic.Po at am__quote@

Any ideas how to fix that? I know this has nothing to do with kaffe,
but a little help could save me at least a whole day otherwise spent 
trying to figure out all the Automake/Autoconf/Configure/whatever magic
stuff.

Thanks again!
Gerlando



--__--__--

Message: 8
Date: Thu, 15 May 2003 18:26:30 +0200 (CEST)
From: Gwenole Beauchesne <gbeauchesne at mandrakesoft.com>
To: kaffe at kaffe.org
Subject: [kaffe] [PATCH] IA-64 fixes

Hi,

The sysdepCallMethod() tester I posted earlier triggered a few bugs in the 
IA-64 version. Fixed hereunder among other fixlets. Patch against 1.1 CVS 
(2003/05/14). No regressions, no improvement either. :-(

BTW, we probably need proper NEED_JTHREAD_ALIGN, JTHREAD macros to align a 
new thread context, in case the enclosed jmp_buf needs special treatments.

2003-05-15  Gwenole Beauchesne  <gbeauchesne at mandrakesoft.com>

	* config/config-setjmp.h (JTHREAD_DECLARE_JMPBUF,
	JTHREAD_ACCESS_JMPBUF): Kill.
	* kaffe/kaffevm/exception.c (dispatchException): Likewise.
	* kaffe/kaffevm/exception.h (vmExcept_jumpToHandler): Likewise.
	* kaffe/kaffevm/jni.c (BEGIN_EXCEPTION_HANDLING*): Likewise.
	
	Instead, the jthread struct containing a jmp_buf must be aligned
	once it is allocated. Other occurrences were already aligned per
	natural alignment requirements in stack.

	* config/ia64/linux/md.c (IA64_context_*): Update to match current
	state-threads v1.4 code from SGI.

	* config/ia64/sysdepCallMethod.h (sysdepCallMethod): Really match
	calling conventions. We now can deal with a mix of ints, longs,
	floats and doubles correctly. Reindent.

	* kaffe/kaffevm/systems/unix-jthreads/jthread.c
	(JTHREAD_CONTEXT_SAVE, JTHREAD_CONTEXT_RESTORE): New macros
	specific to context switches.
	(newThreadCtx): Align jthread struct on 16-byte boundaries for
	jmp_buf. Move down stack adjusting.

--- kaffe-1.1.orig/config/config-setjmp.h	2002-05-29
21:46:23.000000000 +0200
+++ kaffe-1.1/config/config-setjmp.h	2003-05-14 21:39:29.000000000 +0200
@@ -90,12 +90,4 @@ typedef void* kaffe_jmp_buf[JTHREAD_JBLE
 
 #endif
 
-#if defined(__ia64__)
-#define JTHREAD_DECLARE_JMPBUF(x)	JTHREAD_JMPBUF x; void * x##_pad
-#define JTHREAD_ACCESS_JMPBUF(x, y)	(__typeof__((x)->y[0]) *)
((((unsigned long)&(x)->y) + 15) & -16)
-#else
-#define JTHREAD_DECLARE_JMPBUF(x)	JTHREAD_JMPBUF x
-#define JTHREAD_ACCESS_JMPBUF(x, y)	(x)->y
-#endif
-
 #endif
--- kaffe-1.1.orig/config/ia64/linux/md.c	2002-05-29
21:49:58.000000000 +0200
+++ kaffe-1.1/config/ia64/linux/md.c	2003-05-15 21:43:25.000000000 +0200
@@ -29,7 +29,8 @@ init_md(void)
 }
 
 /*
- * Copyright (C) 2000 Silicon Graphics, Inc.  All Rights Reserved.
+ * Portions created by SGI are Copyright (C) 2000 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
  * The internal __jmp_buf layout is different from one used
  * by setjmp()/longjmp().
@@ -92,8 +93,8 @@ init_md(void)
         asm("
         .text
         .align 32
-        .global IA64_context_save#
-        .proc IA64_context_save#
+        .global IA64_context_save
+        .proc IA64_context_save
 IA64_context_save:
         alloc r14 = ar.pfs,1,0,0,0
         mov r16 = ar.unat
@@ -103,6 +104,7 @@ IA64_context_save:
         add r3 = 8,in0
         ;;
         st8.spill.nta [r2] = sp,16    // r12 (sp)
+        ;;
         st8.spill.nta [r3] = gp,16    // r1  (gp)
         ;;
         st8.nta [r2] = r16,16         // save caller's unat
@@ -110,6 +112,7 @@ IA64_context_save:
         add r8 = 0xb0,in0
         ;;   
         st8.spill.nta [r2] = r4,16    // r4
+        ;;
         st8.spill.nta [r3] = r5,16    // r5
         add r9 = 0xc0,in0
         ;;
@@ -150,11 +153,14 @@ IA64_context_save:
         ;;
         stf.spill.nta [r8] = f30
         stf.spill.nta [r9] = f31
+
         st8.spill.nta [r2] = r6,16    // r6
+        ;;
         st8.spill.nta [r3] = r7,16    // r7
         ;;
         mov r23 = ar.bsp
         mov r25 = ar.unat
+
         st8.nta [r2] = r15,16         // b0
         st8.nta [r3] = r17,16         // b1
         ;;
@@ -189,15 +195,17 @@ IA64_context_save:
         ;;
         mov r8 = 0
         br.ret.sptk.few b0
-        .endp IA64_context_save#
+        .endp IA64_context_save
         ");
 
+
+/****************************************************************/
+
         /* IA64_context_restore(__jmp_buf env, int val) */
         asm("
         .text
-        .align 32
-        .global IA64_context_restore#
-        .proc IA64_context_restore#
+        .global IA64_context_restore
+        .proc IA64_context_restore
 IA64_context_restore:
         alloc r8 = ar.pfs,2,0,0,0
         add r2 = 0x88,in0             // r2 <- &jmpbuf.ar_bsp
@@ -296,7 +304,10 @@ IA64_context_restore:
         ldf.fill.nta f31 = [r3]
 (p6)    mov r8 = 1
 (p7)    mov r8 = in1
+
         mov pr = r24,-1
         br.ret.sptk.few b0
-        .endp IA64_context_restore#
+        .endp IA64_context_restore
         ");
+
+/****************************************************************/
--- kaffe-1.1.orig/config/ia64/linux/md.h	2002-05-29
21:49:58.000000000 +0200
+++ kaffe-1.1/config/ia64/linux/md.h	2003-05-15 21:51:34.000000000 +0200
@@ -27,10 +27,10 @@ extern int IA64_context_save(jmp_buf env
 extern void IA64_context_restore(jmp_buf env, int val);
 
 #if 0
-#undef JTHREAD_SETJMP
-#define JTHREAD_SETJMP(env)			IA64_context_save((env))
-#undef JTHREAD_LONGJMP
-#define JTHREAD_LONGJMP(env, val)		IA64_context_restore((env),
(val))
+#undef  JTHREAD_CONTEXT_SAVE
+#define JTHREAD_CONTEXT_SAVE(env)		IA64_context_save((env))
+#undef  JTHREAD_CONTEXT_RESTORE
+#define JTHREAD_CONTEXT_RESTORE(env, val)	IA64_context_restore((env),
(val))
 #endif
 
 #define SIGNAL_ARGS(sig, scp)			int sig, siginfo_t *sip,
struct sigcontext *scp
--- kaffe-1.1.orig/config/ia64/sysdepCallMethod.h	2002-05-29
21:49:58.000000000 +0200
+++ kaffe-1.1/config/ia64/sysdepCallMethod.h	2003-05-15
21:24:55.000000000 +0200
@@ -2,7 +2,7 @@
  * ia64/sysdepCallMethod.h
  * Dynamically build function calls using IA-64 SVR4 ABI.
  *
- * Copyright (c) 2001
+ * Copyright (c) 2001-2003
  *	MandrakeSoft.  All rights reserved.
  *
  * See the file "license.terms" for information on usage and redistribution
@@ -37,6 +37,10 @@
 /* ARG_LIST is the argument list for such a function.  */
 #define ARG_LIST	a0, a1, a2, a3, a4, a5, a6, a7
 
+/* REG_ARGS is the total number of arguments passed in registers,
+   including both GPR and FPR.  */
+#define REG_ARGS	8
+
 /* GPR_ARGS is the number of GPR (integer) registers for passing
    arguments.  */
 #define GPR_ARGS	8
@@ -45,11 +49,6 @@
    arguments.  */
 #define FPR_ARGS	8
 
-/* ARG_DISPLACEMENT is the offset between the beginning of a
-   variable-sized array, allocated in the stack, and the position of
-   the first argument that can't be passed in a register.  */
-#define ARG_DISPLACEMENT	0
-
 /* ARG_GPR a case label and a statement that arranges for one integer
    argument to be passed. */
 #define ARG_GPR(N) \
@@ -67,176 +66,173 @@
    for both JIT and Interpreter (since stubs have now been deprecated).  */
 static inline void sysdepCallMethod(callMethodInfo* call)
 {
-    void *func = call->function;
-    jvalue *callargs = call->args;
-    char *calltype = call->calltype;
-    jvalue *args = callargs;
-    jvalue *last = &callargs[call->nrargs];
-    int nr_gpr = 0;
-    int nr_fpr = 0;
-    int nr_stack = 0;
-
-    unsigned long *stack;
-    unsigned long *gpr;
-    double *fpr;
-
-    /* Compute gpr[], fpr[] and stack[] arrays' size */
-    while (args != last) {
-	  switch (calltype[(args++) - callargs]) {
-	  case 'F':
-	  case 'D':
-		if (nr_fpr < FPR_ARGS) {
-		  nr_fpr++;
-		  nr_gpr++;
-		}
-		else
-		  nr_stack++;
-		break;
-		
-	  default:
-		if (nr_gpr < GPR_ARGS)
-		  nr_gpr++;
-		else
-		  nr_stack++;
-		break;
-	  }
-	}
-
-    /* Allocate all arrays with one big alloca() */
-    {
-	  int nr = nr_gpr + nr_fpr + nr_stack;
-	  
-	  /* stack, if used, must be 16 bytes aligned */
-	  if (nr_stack)
-		nr = (nr + 1) & ~1;
-
-	  /* stack[] is in called parameters area.  */
-	  stack = __builtin_alloca (8 * nr);
-
-	  /* gpr[] and fpr[] are in callee local variable area.  */
-	  gpr = stack + nr_stack;
-	  fpr = (double *)(gpr + nr_gpr);
-	  
-	  /* if __buildin_alloc() does not handle link-area, skip it.  */
-	  stack += ARG_DISPLACEMENT;
-    }
-
-    /* build gpr[], fpr[] and stack[] arrays */
-    nr_gpr = 0;
-	nr_fpr = 0;
-	nr_stack = 0;
-	
-    args = callargs;
-    while (args != last) {
-	  switch (calltype[args - callargs]) {
-	  case 'F': {
-		jvalue value = { .d = (double)args->f };
-		if (nr_fpr < FPR_ARGS) {
-		  fpr[nr_fpr++] = value.d;
-		  gpr[nr_gpr++] = value.j;
-		}
-		else {
-		  *(float *)stack = value.d;
-		  stack++;
-		}
-		break;
-	  }
-	  
-	  case 'D': {
-		jvalue value = { .d = args->d };
-	    if (nr_fpr < FPR_ARGS) {
-		  fpr[nr_fpr++] = value.d;
-		  gpr[nr_gpr++] = value.j;
-	    }
-		else {
-		  *(double *)stack = value.d;
-		  stack++;
-		}
-		break;
-	  }
-	  
-	  default:
-		if (nr_gpr < GPR_ARGS)
-		  gpr[nr_gpr++] = args->j;
-		else
-		  *stack++ = args->j;
-	  }
-	  args++;
-    }
-
-    {
-	  register ARG_TYPE a0 asm("out0");
-	  register ARG_TYPE a1 asm("out1");
-	  register ARG_TYPE a2 asm("out2");
-	  register ARG_TYPE a3 asm("out3");
-	  register ARG_TYPE a4 asm("out4");
-	  register ARG_TYPE a5 asm("out5");
-	  register ARG_TYPE a6 asm("out6");
-	  register ARG_TYPE a7 asm("out7");
-	  
-	  register double d0 asm("f8");
-	  register double d1 asm("f9");
-	  register double d2 asm("f10");
-	  register double d3 asm("f11");
-	  register double d4 asm("f12");
-	  register double d5 asm("f13");
-	  register double d6 asm("f14");
-	  register double d7 asm("f15");
-	  
-	  /* load FPR registers from fpr[] */
-	  switch (nr_fpr) {
-		ARG_FPR(7);
-		ARG_FPR(6);
-		ARG_FPR(5);
-		ARG_FPR(4);
-		ARG_FPR(3);
-		ARG_FPR(2);
-		ARG_FPR(1);
-		ARG_FPR(0);
-	  case 0:;
-	  }
-
-	  /* load GPR registers from gpr[] */
-	  switch (nr_gpr) {
-		ARG_GPR(7);
-		ARG_GPR(6);
-		ARG_GPR(5);
-		ARG_GPR(4);
-		ARG_GPR(3);
-		ARG_GPR(2);
-		ARG_GPR(1);
-		ARG_GPR(0);
-	  case 0:;
-	  }
-	  
-	  /* Ensure that the assignments to f* registers won't be optimized
away. */
-	  asm ("" ::
-		   "f" (d0), "f" (d1), "f" (d2), "f" (d3),
-		   "f" (d4), "f" (d5), "f" (d6), "f" (d7));
-
-	  switch(call->retsize) {
-	  case 0:
-	    /* Must be void.  */
-	    ((void (*)(ARG_TYPES))(func))(ARG_LIST);
-	    break;
-		
-	  case 1:
-	    if (call->rettype == 'F')
-		  call->ret->f = ((jfloat (*)(ARG_TYPES))(func))(ARG_LIST);
-	    else /* Must be 32-bit or smaller int.  */
-		  call->ret->i = ((jint (*)(ARG_TYPES))(func))(ARG_LIST);
-	    break;
-
-	  default:
-	    /* It could've been `case 2;', but then we'd get an additional
cmp
-	     * that we don't really need.  */
-	    if (call->rettype == 'D')
-		  call->ret->d = ((jdouble (*)(ARG_TYPES))(func))(ARG_LIST);
-	    else /* Must be jlong.  */
-		  call->ret->j = ((jlong (*)(ARG_TYPES))(func))(ARG_LIST);
-	    break;
-	  }
+  void *func = call->function;
+  jvalue *callargs = call->args;
+  char *calltype = call->calltype;
+  jvalue *args = callargs;
+  jvalue *last = &callargs[call->nrargs];
+  int nr_gpr = 0;
+  int nr_fpr = 0;
+  int nr_stack = 0;
+
+  unsigned long *stack;
+  unsigned long gpr[GPR_ARGS];
+  double fpr[FPR_ARGS];
+
+  /* Compute gpr[], fpr[] and stack[] arrays' size */
+  while (args != last) {
+    switch (calltype[(args++) - callargs]) {
+    case 'F':
+    case 'D':
+      if (nr_gpr + nr_fpr < REG_ARGS) {
+	nr_fpr++;
+	nr_gpr++;
+      }
+      else
+	nr_stack++;
+      break;
+
+    default:
+      if (nr_gpr + nr_fpr < REG_ARGS)
+	nr_gpr++;
+      else
+	nr_stack++;
+      break;
+    }
+  }
+
+  /* Allocate all arrays with one big alloca() */
+  {
+    int nr = nr_stack;
+
+    /* stack, if used, must be 16 bytes aligned */
+    if (nr_stack)
+      nr = (nr + 1) & ~1;
+
+    /* stack[] is in called parameters area.  */
+    stack = __builtin_alloca (8 * nr);
+  }
+
+  /* build gpr[], fpr[] and stack[] arrays */
+  nr_gpr = 0;
+  nr_fpr = 0;
+  nr_stack = 0;
+
+  args = callargs;
+  while (args != last) {
+    switch (calltype[args - callargs]) {
+    case 'F': {
+      jvalue value = { .d = (double)args->f };
+      if (nr_gpr + nr_fpr < REG_ARGS) {
+	fpr[nr_fpr++] = value.d;
+	/* Also pass the FP slot in GPR so that callee knows
+	   about it in case it was not prototyped beforehand. */
+	gpr[nr_gpr++] = value.j;
+      }
+      else {
+	*(float *)stack = value.d;
+	stack++;
+      }
+      break;
+    }
+
+    case 'D': {
+      jvalue value = { .d = args->d };
+      if (nr_gpr + nr_fpr < REG_ARGS) {
+	fpr[nr_fpr++] = value.d;
+	/* Also pass the FP slot in GPR so that callee knows
+	   about it in case it was not prototyped beforehand. */
+	gpr[nr_gpr++] = value.j;
+      }
+      else {
+	*(double *)stack = value.d;
+	stack++;
+      }
+      break;
+    }
+
+    default:
+      if (nr_gpr + nr_fpr < REG_ARGS)
+	gpr[nr_gpr++] = args->j;
+      else
+	*stack++ = args->j;
+    }
+    args++;
+  }
+
+  {
+    register ARG_TYPE a0 asm("out0");
+    register ARG_TYPE a1 asm("out1");
+    register ARG_TYPE a2 asm("out2");
+    register ARG_TYPE a3 asm("out3");
+    register ARG_TYPE a4 asm("out4");
+    register ARG_TYPE a5 asm("out5");
+    register ARG_TYPE a6 asm("out6");
+    register ARG_TYPE a7 asm("out7");
+
+    register double d0 asm("f8");
+    register double d1 asm("f9");
+    register double d2 asm("f10");
+    register double d3 asm("f11");
+    register double d4 asm("f12");
+    register double d5 asm("f13");
+    register double d6 asm("f14");
+    register double d7 asm("f15");
+
+    /* load FPR registers from fpr[] */
+    switch (nr_fpr) {
+      ARG_FPR(7);
+      ARG_FPR(6);
+      ARG_FPR(5);
+      ARG_FPR(4);
+      ARG_FPR(3);
+      ARG_FPR(2);
+      ARG_FPR(1);
+      ARG_FPR(0);
+    case 0:;
+    }
+
+    /* load GPR registers from gpr[] */
+    switch (nr_gpr) {
+      ARG_GPR(7);
+      ARG_GPR(6);
+      ARG_GPR(5);
+      ARG_GPR(4);
+      ARG_GPR(3);
+      ARG_GPR(2);
+      ARG_GPR(1);
+      ARG_GPR(0);
+    case 0:;
+    }
+
+    /* Ensure that the assignments to f* registers won't be optimized away.
*/
+    asm ("" ::
+	 "f" (d0), "f" (d1), "f" (d2), "f" (d3),
+	 "f" (d4), "f" (d5), "f" (d6), "f" (d7));
+
+    switch(call->retsize) {
+    case 0:
+      /* Must be void.  */
+      ((void (*)(ARG_TYPES))(func))(ARG_LIST);
+      break;
+
+    case 1:
+      if (call->rettype == 'F')
+	call->ret->f = ((jfloat (*)(ARG_TYPES))(func))(ARG_LIST);
+      else /* Must be 32-bit or smaller int.  */
+	call->ret->i = ((jint (*)(ARG_TYPES))(func))(ARG_LIST);
+      break;
+
+    default:
+      /* It could've been `case 2;', but then we'd get an additional cmp
+       * that we don't really need.  */
+      if (call->rettype == 'D')
+	call->ret->d = ((jdouble (*)(ARG_TYPES))(func))(ARG_LIST);
+      else /* Must be jlong.  */
+	call->ret->j = ((jlong (*)(ARG_TYPES))(func))(ARG_LIST);
+      break;
     }
+  }
 }
 
 #undef ARG_TYPE
--- kaffe-1.1.orig/kaffe/kaffevm/exception.c	2002-10-18
15:54:14.000000000 +0200
+++ kaffe-1.1/kaffe/kaffevm/exception.c	2003-05-14 20:54:41.000000000 +0200
@@ -452,7 +452,7 @@ DBG(ELOOKUP,
 
 			/* If not here, exit monitor if synchronised. */
 			if (obj != 0 && (einfo.method->accflags &
ACC_SYNCHRONISED) != 0) {
-				_slowUnlockMutexIfHeld(&obj->lock,
JTHREAD_ACCESS_JMPBUF(frame, jbuf));
+				_slowUnlockMutexIfHeld(&obj->lock,
frame->jbuf);
 			}
 		}
 	}
--- kaffe-1.1.orig/kaffe/kaffevm/exception.h	2003-01-06
18:14:19.000000000 +0100
+++ kaffe-1.1/kaffe/kaffevm/exception.h	2003-05-14 20:55:29.000000000 +0200
@@ -92,7 +92,7 @@ typedef struct VmExceptHandler {
 	u4				pc;
 		} intrp;
 	} frame;
-	JTHREAD_DECLARE_JMPBUF		(jbuf);
+	JTHREAD_JMPBUF		jbuf;
 } VmExceptHandler;
 
 #define VMEXCEPTHANDLER_KAFFEJNI_HANDLER ((struct _methods*)1)
@@ -156,7 +156,7 @@ vmExcept_setJNIFrame(VmExceptHandler* eh
 static inline void
 vmExcept_jumpToHandler(VmExceptHandler* frame)
 {
-	JTHREAD_LONGJMP(JTHREAD_ACCESS_JMPBUF(frame, jbuf), 1);
+	JTHREAD_LONGJMP(frame->jbuf, 1);
 }
 
 #if defined(INTERPRETER)
--- kaffe-1.1.orig/kaffe/kaffevm/jni.c	2003-01-06 18:14:20.000000000 +0100
+++ kaffe-1.1/kaffe/kaffevm/jni.c	2003-05-14 20:54:17.000000000 +0200
@@ -131,7 +131,7 @@ getMethodFunc (Method* meth, Hjava_lang_
 	VmExceptHandler ebuf;				\
 	KAFFE_JNI_SETEXCEPTFP(&ebuf); 			\
 	ebuf.prev =
(VmExceptHandler*)(unhand(getCurrentThread())->exceptPtr);\
-	if (JTHREAD_SETJMP(JTHREAD_ACCESS_JMPBUF(&ebuf, jbuf)) != 0) {
\
+	if (JTHREAD_SETJMP(ebuf.jbuf) != 0) {		\
 		unhand(getCurrentThread())->exceptPtr = \
 		  (struct Hkaffe_util_Ptr*)ebuf.prev;	\
 		return X;				\
@@ -142,7 +142,7 @@ getMethodFunc (Method* meth, Hjava_lang_
 	VmExceptHandler ebuf; 				\
 	KAFFE_JNI_SETEXCEPTFP(&ebuf); 			\
 	ebuf.prev =
(VmExceptHandler*)(unhand(getCurrentThread())->exceptPtr);\
-	if (JTHREAD_SETJMP(JTHREAD_ACCESS_JMPBUF(&ebuf, jbuf)) != 0) {
\
+	if (JTHREAD_SETJMP(ebuf.jbuf) != 0) {		\
 		unhand(getCurrentThread())->exceptPtr = \
 		  (struct Hkaffe_util_Ptr*)ebuf.prev;	\
 		return;					\
--- kaffe-1.1.orig/kaffe/kaffevm/systems/unix-jthreads/jthread.c
2003-03-11 09:00:19.000000000 +0100
+++ kaffe-1.1/kaffe/kaffevm/systems/unix-jthreads/jthread.c	2003-05-15
21:49:36.000000000 +0200
@@ -123,6 +123,14 @@ static int  min_priority;		/* minimum su
 
 jthread* currentJThread;
 
+/* Context switch related functions */
+#ifndef JTHREAD_CONTEXT_SAVE
+#define JTHREAD_CONTEXT_SAVE(buf)		JTHREAD_SETJMP((buf))
+#endif
+#ifndef JTHREAD_CONTEXT_RESTORE
+#define JTHREAD_CONTEXT_RESTORE(buf, val)	JTHREAD_LONGJMP((buf),
(val))
+#endif
+
 /* The arguments to a signal handler */
 #ifndef SIGNAL_ARGS
 #define SIGNAL_ARGS(sig, sc) int sig
@@ -898,10 +906,14 @@ newThreadCtx(int stackSize)
 {
 	jthread *ct;
 
-	ct = allocator(sizeof(jthread) + stackSize);
+	ct = allocator(sizeof(jthread) + 16 + stackSize);
 	if (ct == 0) {
 		return 0;
 	}
+#if defined(__ia64__)
+	/* (gb) Align jmp_buf on 16-byte boundaries */
+	ct = (jthread *)((((unsigned long)(ct)) & 15) ^ (unsigned
long)(ct));
+#endif
 	ct->stackBase = (ct + 1);
 	ct->stackEnd = (char *) ct->stackBase + stackSize;
 	ct->restorePoint = ct->stackEnd;
@@ -1269,12 +1281,6 @@ jthread_create(unsigned char pri, void (
 	void	*oldbsp, *newbsp;
 #endif
 	size_t   page_size;
-	
-	/* Adjust stack size */
-	page_size = getpagesize();
-	if (threadStackSize == 0)
-		threadStackSize = THREADSTACKSIZE;
-	threadStackSize = (threadStackSize + page_size - 1) & -page_size;
 
 	/*
 	 * Disable stop to protect the threadLock lock, and prevent
@@ -1283,6 +1289,12 @@ jthread_create(unsigned char pri, void (
 	 */
 	jthread_disable_stop();
 
+	/* Adjust stack size */
+	page_size = getpagesize();
+	if (threadStackSize == 0)
+		threadStackSize = THREADSTACKSIZE;
+	threadStackSize = (threadStackSize + page_size - 1) & -page_size;
+
 	jmutex_lock(&threadLock);
 	jtid = newThreadCtx(threadStackSize);
 	if (!jtid) {
@@ -1319,7 +1331,7 @@ DBG(JTHREAD,
 	 *
 	 * To be safe, we immediately call a new function.
 	 */
-        if (JTHREAD_SETJMP(JTHREAD_ACCESS_JMPBUF(jtid, env))) {
+        if (JTHREAD_CONTEXT_SAVE(jtid->env)) {
 		/* new thread */
 		start_this_sucker_on_a_new_frame();
 		assert(!"Never!");
@@ -1330,9 +1342,9 @@ DBG(JTHREAD,
 	SAVE_FP(jtid->fpstate);
 #endif
 	/* set up context for new thread */
-	oldstack = GET_SP(JTHREAD_ACCESS_JMPBUF(jtid, env));
+	oldstack = GET_SP(jtid->env);
 #if defined(__ia64__)
-	oldbsp = GET_BSP(JTHREAD_ACCESS_JMPBUF(jtid, env));
+	oldbsp = GET_BSP(jtid->env);
 #endif
 
 #if defined(STACK_GROWS_UP)
@@ -1348,7 +1360,7 @@ DBG(JTHREAD,
 	 * grows downward. Both stacks start in the middle and grow outward
 	 * from each other.
 	 */
-	newstack -= (threadStackSize >> 1);
+	(char *) newstack -= (threadStackSize >> 1);
 	newbsp = newstack;
 	/* Make register stack 64-byte aligned */
 	if ((unsigned long)newbsp & 0x3f)
@@ -1364,9 +1376,9 @@ DBG(JTHREAD,
 	newstack = (void *) STACK_ALIGN(newstack);
 #endif
 
-	SET_SP(JTHREAD_ACCESS_JMPBUF(jtid, env), newstack);
+	SET_SP(jtid->env, newstack);
 #if defined(__ia64__)
-	SET_BSP(JTHREAD_ACCESS_JMPBUF(jtid, env), newbsp);
+	SET_BSP(jtid->env, newbsp);
 #endif
 
 #if defined(SET_BP)
@@ -1374,13 +1386,13 @@ DBG(JTHREAD,
 	 * Clear the base pointer in the new thread's stack.
 	 * Nice for debugging, but not strictly necessary.
 	 */
-	SET_BP(JTHREAD_ACCESS_JMPBUF(jtid, env), 0);
+	SET_BP(jtid->env, 0);
 #endif
 
 
 #if defined(FP_OFFSET)
 	/* needed for: IRIX */
-	SET_FP(JTHREAD_ACCESS_JMPBUF(jtid, env), newstack + ((void
*)GET_FP(JTHREAD_ACCESS_JMPBUF(jtid, env)) - oldstack));
+	SET_FP(jtid->env, newstack + ((void *)GET_FP(jtid->env) -
oldstack));
 #endif
 
         resumeThread(jtid);
@@ -1627,9 +1639,10 @@ dprintf("switch from %p to %p\n", lastTh
 #if defined(CONTEXT_SWITCH)
 				CONTEXT_SWITCH(lastThread, currentJThread);
 #else
-				if
(JTHREAD_SETJMP(JTHREAD_ACCESS_JMPBUF(lastThread, env)) == 0) {
-				    lastThread->restorePoint =
GET_SP(JTHREAD_ACCESS_JMPBUF(lastThread, env));
-
JTHREAD_LONGJMP(JTHREAD_ACCESS_JMPBUF(currentJThread, env), 1);
+				if (JTHREAD_CONTEXT_SAVE(lastThread->env) ==
0) {
+				    lastThread->restorePoint = 
+					GET_SP(lastThread->env);
+
JTHREAD_CONTEXT_RESTORE(currentJThread->env, 1);
 				}
 #endif
 #if defined(LOAD_FP)
--- kaffe-1.1.orig/kaffe/kaffevm/systems/unix-jthreads/jthread.h
2002-11-27 19:32:55.000000000 +0100
+++ kaffe-1.1/kaffe/kaffevm/systems/unix-jthreads/jthread.h	2003-05-14
20:48:41.000000000 +0200
@@ -90,7 +90,7 @@ typedef struct _jthread {
 	 * used to hold the current Java thread
 	 */
 	void*				jlThread;
-	JTHREAD_DECLARE_JMPBUF		(env);
+	JTHREAD_JMPBUF			env;
 #if defined(SAVED_FP_SIZE)
 	char				fpstate[SAVED_FP_SIZE];
 #endif




--__--__--

_______________________________________________
kaffe mailing list
kaffe at kaffe.org
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


End of kaffe Digest




More information about the kaffe mailing list