[kaffe] Kaffe for PS2 Patches and "FAQ"
Dylan Schell
dylans@xs4all.nl
Wed, 18 Dec 2002 18:39:26 +0100
--Apple-Mail-8--351059347
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
For those who are interested, please find attached my PS2 patch as it
currently stands against the CVS version of kaffe. Status is basically
as before. The interpreter works except for some IEEE compliancy
issues. see FAQ.ps2linux for more notes and workarounds.
P.S. I've recently changed from an wintel to a Mac and even though
apple produces a JVM I was still curious about kaffe on OSX. It turns
building on OSX produces more regression errors than on my PS2......
Have fun
Dylan Schell
dylans@xs4all.nl
--Apple-Mail-8--351059347
Content-Disposition: attachment;
filename=FAQ.ps2linux
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="FAQ.ps2linux"
Status
======
last updated 18-dec-2002
- kaffe in interpreter mode currently fails 5 regression tests related to
IEEE compliancy. ( See Notes )
- kaffe in jit3 mode currently fails a 27 regression tests since the
jit is emitting 64 bit floating point instructions that are not supported
on the PS2. ( see Notes )
Building kaffe on the PS2
=========================
1. install jikes ( version 1.13 was tested )
compiling jikes will take some time on the PS2 but building the
kaffe runtime library with the supplied compiler is a bit of a problem
(and a lot slower than compiling jikes) It is possible to use a more
recent version of jikes, but you will have to manually change the calls
to jikes in libraries/javalib/rebuildLib to avoid class version errors
( add: -source 1.2 to the VERBOSE variable to force jikes to generate
class files compatible with kaffe )
2. run configure to enable jikes and select the interpreter engine:
./configure --with-jikes --with-engine=intrp
Or if you don't need double precision floating point support, you can
build the jit3 version:
./configure --with-jikes
(Remember to run make clean if you change between interpreter and jit! )
3. compile/install in the regular fashion.
make
sudo make install
Notes about the PS2 Linux port
==============================
The ps2 port is a work in progress, it works with the following limitations:
1. Some IEEE constructs are not supported by the FPU: NaN/+Inf/-Inf/+0.0/-0.0
If the PS2 kernel is ever updated to include a FPU emulator to add these missing
constructs, then this port should pass all regression tests.
(This goes for the interpreter as well as for the jit version)
1. jit3 is functional but will cause problems when using double precision floating
point operations. This is because the PS2 lacks a double precsion FPU. If, or when
the linux kernel is updated with a FPU emulator (and a matching gcc is installed)
to make up for this problem, the port will have to be updated ( the PS2 specific
patches in config/mips/o32-sysdepCallMethod.h can go away ).
To make sure interpreter bugs don't interfere with building
kaffe on the PS2 use jikes to compile the class library/tests. Some versions
of jikes generate incorrect class files or class files that are too new for
kaffe to handle. Using jikes 1.13 seems to work OK.
The PS2 also lacks the MIPS II "LL" and "SC" instructions. This means
locking is somewhat slower. the MIPS II instructions are disabled in
config/mips/common.h
The PS2 register set is also different from basic mips processors. This means the
FP_OFFSET is much larger ( general purpose registers are 128 bit wide for special
multimedia/vector processing instructions )
Note that the changes in o32-sysdepCallMethod.h pass 64 bit floats in a pair
of general purpose registers. This is the convention gcc uses on the PS2 (
This might be the default for all mips systems that lack these registers, I
don't know...)
Files with PS2 specific changes
===============================
config/mips/o32-sysdepCallMethod.h ( work around lack of 64 bit FPU regs )
config/mips/common.h ( set FP_OFFSET / disable MIPS II instructions )
config/mips/linux/md.h ( FP_OFFSET=36 )
Dylan Schell
dylans@xs4all.nl
--Apple-Mail-8--351059347
Content-Disposition: attachment;
filename=kaffe-ps2-cvs.patch
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="kaffe-ps2-cvs.patch"
Only in kaffe/FAQ: FAQ.ps2linux
Only in kaffe/config: jit-md.h
diff -r -c3 kaffe.cvs/config/mips/common.h kaffe/config/mips/common.h
*** kaffe.cvs/config/mips/common.h Sun Dec 15 18:48:02 2002
--- kaffe/config/mips/common.h Wed Dec 18 12:26:25 2002
***************
*** 15,20 ****
--- 15,32 ----
#ifndef __mips_common_h
#define __mips_common_h
+ /* The R5900 is the Mips Core in the PS2 (Playstation 2)
+ * It has most of the Mips III instructions set, some of the Mips IV
+ * instructions, it lacks the Mips II "ll" and "sc" instructions and
+ * it has 128 bit GP registers and 32 bit FPU registers. There is no
+ * FPU Emulation present in the default kernel. Since no 64 bit
+ * FPU registers exist, doubles are passed in 2 GP registers.
+ */
+ #ifdef _R5900
+ #define PS2LINUX
+ #undef HAVE_MIPSII_INSTRUCTIONS
+ #endif
+
#if NEED_sysdepCallMethod
#if !defined (_MIPS_SIM) || (_MIPS_SIM == _MIPS_SIM_ABI32)
diff -r -c3 kaffe.cvs/config/mips/linux/md.h kaffe/config/mips/linux/md.h
*** kaffe.cvs/config/mips/linux/md.h Sun Dec 15 18:48:02 2002
--- kaffe/config/mips/linux/md.h Wed Dec 18 12:46:34 2002
***************
*** 19,25 ****
--- 19,30 ----
#undef FP_OFFSET
#define SP_OFFSET 1
+
+ #ifdef PS2LINUX
+ #define FP_OFFSET 36
+ #else
#define FP_OFFSET 10
+ #endif
#if defined(TRANSLATOR)
#include "jit-md.h"
diff -r -c3 kaffe.cvs/config/mips/o32-sysdepCallMethod.h kaffe/config/mips/o32-sysdepCallMethod.h
*** kaffe.cvs/config/mips/o32-sysdepCallMethod.h Sun Dec 15 18:48:02 2002
--- kaffe/config/mips/o32-sysdepCallMethod.h Wed Dec 18 12:23:50 2002
***************
*** 103,110 ****
--- 103,120 ----
register ARG_TYPE a2 asm("$6");
register ARG_TYPE a3 asm("$7");
+ #ifdef PS2LINUX
+ union {
+ double d;
+ struct {
+ int hi;
+ int lo;
+ } fake_double;
+ } split;
+ #else
register double d0 asm("$f12");
register double d2 asm("$f14");
+ #endif
register float f0 asm("$f12");
register float f2 asm("$f14");
***************
*** 132,140 ****
}
if (calltype[2] == D) {
! d2 = callargs[2].d;
if(calltype[0] == D) d0 = callargs[0].d;
else f0 = callargs[0].f;
goto alldone;
}
--- 142,166 ----
}
if (calltype[2] == D) {
! #ifdef PS2LINUX
! split.d = callargs[2].d;
! a2 = split.fake_double.hi;
! a3 = split.fake_double.lo;
! #else
! d2 = callargs[2].d;
! #endif
! #ifdef PS2LINUX
! if ( calltype[0] == D) {
! split.d = callargs[0].d;
! a0 = split.fake_double.hi;
! a1 = split.fake_double.lo;
! } else {
! f0 = callargs[0].f;
! }
! #else
if(calltype[0] == D) d0 = callargs[0].d;
else f0 = callargs[0].f;
+ #endif
goto alldone;
}
***************
*** 156,162 ****
--- 182,194 ----
case 2:
if (calltype[0] == D) {
+ #ifdef PS2LINUX
+ split.d = callargs[0].d;
+ a0 = split.fake_double.hi;
+ a1 = split.fake_double.lo;
+ #else
d0=callargs[0].d;
+ #endif
goto alldone;
} else {
if (calltype[0] != F) {
***************
*** 188,194 ****
--- 220,230 ----
noargs:
#endif
/* Ensure that the assignments to f* registers won't be optimized away. */
+ #ifdef PS2LINUX
+ asm ("" :: "f" (f0), "f" (f2));
+ #else
asm ("" :: "f" (f0), "f" (f2), "f" (d0), "f" (d2));
+ #endif
switch(call->retsize) {
case 0:
Only in kaffe.cvs/config: stamp-h1.in
Only in kaffe.cvs/include: stamp-h2.in
Only in kaffe/kaffe/kaffe: version-info.h
Only in kaffe/kaffe/xprof: Makefile
Only in kaffe/libraries: Makefile
Only in kaffe/libraries/clib/awt/qt: Makefile
Only in kaffe/test/regression: serializedFoos.bin
--Apple-Mail-8--351059347--