Thread: [Sablevm-developer] Porting SableVM to ia64 done in 3 (lazy) hours
Brought to you by:
egagnon
From: Grzegorz P. <gr...@se...> - 2002-10-11 18:33:18
|
Hi! Just wanted you to know, that "ia64" has been just added to the list of architectures supported by SableVM JVM, next to i386 and alpha. Thanks to Martin Schulze <jo...@in...> who installed build deps on merulo.d.o and thanks to Bdale Garbee <bd...@ga...> who asissted the port and installed the packages right after they were ready. "HelloWorld!" app started since the first kick. The diff is below, at the end of this amil I also inlined very simple&small c app that helps a bit w/ porting. It may be not so bad idea to have it in the sources. Maybe it's time for new release? ;-) Best regards Grzegorz B. Prokopski --- ./sablevm-1.0.4/src/libsablevm/include/jni_system_specific.h 2002-08-14 23:29:54.000000000 -0600 +++ ./sablevm-1.0.4-new/src/libsablevm/include/jni_system_specific.h 2002-10-11 08:49:24.000000000 -0600 @@ -15,7 +15,7 @@ /* ia64, alpha and i386 are identical here */ -#if ((defined (__alpha__) || defined (__i386__)) && defined (__GNUC__)) +#if ((defined (__ia64__) || defined (__alpha__) || defined (__i386__)) && defined (__GNUC__)) #define JNICALL #define JNIEXPORT @@ -38,3 +38,4 @@ #endif #endif /* NOT SVM_JNI_SYSTEM_SPECIFIC_H */ + --- ./sablevm-1.0.4/src/libsablevm/system.c 2002-08-18 23:16:06.000000000 -0600 +++ ./sablevm-1.0.4-new/src/libsablevm/system.c 2002-10-11 10:53:09.000000000 -0600 @@ -5,7 +5,7 @@ * modification of SableVM. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#if ((defined (__alpha__) || defined (__i386__)) && defined (__GNUC__)) +#if ((defined (__ia64__) || defined (__alpha__) || defined (__i386__)) && defined (__GNUC__)) /* ---------------------------------------------------------------------- @@ -28,6 +28,8 @@ #elif defined(__i386__) /* do nothing */ +#elif defined(__ia64__) + /* do nothing */ #else #error #endif @@ -99,6 +101,15 @@ /* *INDENT-ON* */ #endif +#if (defined (__ia64__)) +#include <ia64intrin.h> + + jboolean result; + + result = __sync_bool_compare_and_swap (pword, old_value, new_value); + +#endif + return result ? JNI_TRUE : JNI_FALSE; } --- ./sablevm-1.0.4/src/libsablevm/system.h 2002-08-14 23:29:54.000000000 -0600 +++ ./sablevm-1.0.4-new/src/libsablevm/system.h 2002-10-11 09:25:47.000000000 -0600 @@ -48,7 +48,7 @@ */ -#if ((defined (__alpha__) || defined (__i386__)) && defined (__GNUC__)) +#if ((defined (__ia64__) || defined (__alpha__) || defined (__i386__)) && defined (__GNUC__)) /* "inline" is now an official keyword since the latest C standard (1999). So, it is a reasonable assuption to expect a target compiler to @@ -88,6 +88,18 @@ #define SVM_ALIGNMENT_POWER 3 /* 2 ^^ SVM_ALIGNMENT_POWER == SVM_ALIGNMENT */ #define SVM_PAGE_SIZE 8192 +#elif defined (__ia64__) + +typedef _svmt_u64 _svmt_word; + +#define SVM_WORD_SIZE 8 /* size in bytes */ +#define SVM_WORD_BIT_COUNT 64 /* size in bits */ + +/* see comments at the head of this file */ +#define SVM_ALIGNMENT 8 +#define SVM_ALIGNMENT_POWER 3 /* 2 ^^ SVM_ALIGNMENT_POWER == SVM_ALIGNMENT */ +#define SVM_PAGE_SIZE 16384 + #endif /* FFI specific types */ The helper program is this: gadek@merulo:~/sablevm/tests$ cat ./typesizes.c #include <unistd.h> int main(void) { int i; printf("Size of char is %i\n", sizeof(char)); printf("Size of short is %i\n", sizeof(unsigned short)); printf("Size of int is %i\n", sizeof(int)); printf("Size of long int is %i\n", sizeof(long int)); printf("Size of long long int is %i\n", sizeof(long long int)); printf("Size of float is %i\n", sizeof(float)); printf("Size of double is %i\n", sizeof(double)); printf("Size of void* is %i\n", sizeof(void*)); i = getpagesize(); printf("Size of page is %i\n", i); return 0; } |
From: Grzegorz P. <gr...@se...> - 2002-10-11 19:28:39
|
Hi all! The question is mainly to Etienne... Instead of doing static inline jboolean _svmh_compare_and_swap (volatile _svmt_word *pword, _svmt_word old_value, _svmt_word new_value) { #if defined (__i386__) #if defined (__alpha__) #if defined (__ia64__) (about a dozen of lines for every arch) why not just use this construction: #include <asm/system.h> return (cmpxchg((pword), (old_value), (new_value)) == (old_value)) In the original (found there: http://www.mail-archive.com/ka...@ru.../msg02563.html ) there was <asm/atomic.h>, but the definition of cmpxchg seems to reside in asm/system.h I checked the existence of the definition on my i386 and on debian's ia64 machines. I haven't compiled it yet though. We could have all Linux arches supported in 24 hours! ;-) Why shouldn't we use it? Whaddayathink? GBP |
From: Etienne M. G. <eti...@uq...> - 2002-10-11 19:51:19
|
On Fri, Oct 11, 2002 at 09:28:22PM +0200, Grzegorz Prokopski wrote: > The question is mainly to Etienne... > > Instead of doing > > static inline jboolean > _svmh_compare_and_swap (volatile _svmt_word *pword, _svmt_word > old_value, ... > why not just use this construction: > > #include <asm/system.h> > return (cmpxchg((pword), (old_value), (new_value)) == (old_value)) ... > We could have all Linux arches supported in 24 hours! ;-) > Why shouldn't we use it? As long as we add a "#ifdef LINUX" (or the equivalent), we could do it. Is there an equivalent for "iflush()"? Then we would get the inline-threaded engine to work too... :) Etienne -- Etienne M. Gagnon http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |
From: Grzegorz P. <gr...@se...> - 2002-10-12 12:31:58
|
W li=B6cie z pi=B1, 11-10-2002, godz. 21:37, Etienne M. Gagnon pisze:=20 > On Fri, Oct 11, 2002 at 09:28:22PM +0200, Grzegorz Prokopski wrote: > > We could have all Linux arches supported in 24 hours! ;-) > > Why shouldn't we use it? >=20 > As long as we add a "#ifdef LINUX" (or the equivalent), we could do it. But there's nothing wrong it supporting all Linux arches out-of-the box, even without any manual intervention to add new ones. We can autodetect almost all we need. The current approach is that we have separate pieces of code, that define: - assembler parts - integer/float type sizes - page size, alignment size and helper values based on them Would you apply a patch that makes all of the above automagic? I mean: - I can autodetect if this cmpxchg in asm/system.h is available (I already have the patch using autotools) - I can autodetect which types use for which needed sizes (I already have the patch using autotools) - I can autodetect page size (getpagesize), siezeof(void*) and the helper values (see that small testing app I sent yesterday) [I need to assume sth. about alignment unfortunatelly, like that it's equal to machine word size] If we had this, we could have all Linux arches "just" working. If there will be other arches, maybe non-linux that we want to support - we can always have #else - don't we? The same stands for some better support for certain architectures. But the aim is "This program can be compiled on any Linux machine if it's dependencies can be fulfilled" Do you think you would apply such patch if I prepared complete solution? > Is there an equivalent for "iflush()"? Then we would get the > inline-threaded engine to work too... :) I haven't looked at it yet. Regards GBP |
From: Etienne M. G. <eti...@uq...> - 2002-10-14 00:47:22
|
On Sat, Oct 12, 2002 at 02:31:43PM +0200, Grzegorz Prokopski wrote: > Would you apply a patch that makes all of the above automagic? > I mean: > - I can autodetect if this cmpxchg in asm/system.h is available > (I already have the patch using autotools) > - I can autodetect which types use for which needed sizes > (I already have the patch using autotools) > - I can autodetect page size (getpagesize), siezeof(void*) > and the helper values (see that small testing app I sent yesterday) > [I need to assume sth. about alignment unfortunatelly, like that > it's equal to machine word size] > > If we had this, we could have all Linux arches "just" working. > If there will be other arches, maybe non-linux that we want to > support - we can always have #else - don't we? There seems to be a BSD version of SableVM floating around; so we definitely need to provide an "#else" hook for these. > The same stands for some better support for certain architectures. > > But the aim is > "This program can be compiled on any Linux machine if it's dependencies > can be fulfilled" > > Do you think you would apply such patch if I prepared complete solution? I think so. -- Etienne M. Gagnon http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |
From: Archie C. <ar...@de...> - 2002-10-14 04:30:15
|
Etienne M. Gagnon writes: > > If we had this, we could have all Linux arches "just" working. > > If there will be other arches, maybe non-linux that we want to > > support - we can always have #else - don't we? > > There seems to be a BSD version of SableVM floating around; so we > definitely need to provide an "#else" hook for these. FYI, The patches that are currently required to get SableVM to compile on FreeBSD are visible here: http://www.freebsd.org/cgi/cvsweb.cgi/ports/java/sablevm/files/ The files are named 'patch-*' (ignore the 'extra-patch-*' files). It would be nice if SableVM could be generalized enough that these patches wouldn't be necessary. I'm sure NetBSD and OpenBSD require similar fixes, so not just FreeBSD would benefit. I'd be happy to help test on FreeBSD if needed. Cheers, -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com |
From: Etienne M. G. <eti...@uq...> - 2002-10-14 14:30:47
|
On Sun, Oct 13, 2002 at 09:14:40PM -0700, Archie Cobbs wrote: > FYI, >=20 > The patches that are currently required to get SableVM to compile > on FreeBSD are visible here: >=20 > http://www.freebsd.org/cgi/cvsweb.cgi/ports/java/sablevm/files/ >=20 > The files are named 'patch-*' (ignore the 'extra-patch-*' files). >=20 > It would be nice if SableVM could be generalized enough that these > patches wouldn't be necessary. I'm sure NetBSD and OpenBSD require > similar fixes, so not just FreeBSD would benefit. Thanks for the link. I'll look at the patches and report back on this list. Etienne >=20 > I'd be happy to help test on FreeBSD if needed. >=20 > Cheers, > -Archie >=20 > __________________________________________________________________________ > Archie Cobbs * Packet Design * http://www.packetdesign.com >=20 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Sablevm-developer mailing list > Sab...@li... > https://lists.sourceforge.net/lists/listinfo/sablevm-developer --=20 Etienne M. Gagnon http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |
From: Etienne M. G. <eti...@uq...> - 2002-10-11 19:43:57
|
On Fri, Oct 11, 2002 at 08:33:07PM +0200, Grzegorz Prokopski wrote: > Just wanted you to know, that "ia64" has been just added to the > list of architectures supported by SableVM JVM, next to i386 and > alpha. Super! We'll have to port the inline-threaded engine soon, too. We can probably start working on that when I am finished with the current step: I am currently working on filling some "relflection" holes (e.g. Class.getMethods(), etc.) to get "Ant" to work on SableVM. > Thanks to Martin Schulze <jo...@in...> who installed > build deps on merulo.d.o and thanks to Bdale Garbee <bd...@ga...> > who asissted the port and installed the packages right after > they were ready. Thanks a lot. > "HelloWorld!" app started since the first kick. I like to hear this ;-) > Maybe it's time for new release? ;-) How about a new release on Sunday? I am leaving to Quebec city to visit friends until then, so I won't have time to work tonight and tomorrow. Grzegorz, thanks a lot! Etienne -- Etienne M. Gagnon http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |