Problems with kaffe-1.0.6 on alpha

Edouard G. Parmelan egp at free.fr
Thu Sep 7 16:49:39 PDT 2000


Patrick Tullmann wrote:

> > Ah. I had rather blithely assumed Alpha's were supported... Can anyone
> > clarify this? If it's a portability issue, I'd be prepared to put some
> > effort into getting it working, though time (and ability :-) may be a
> > limiting factor.
> 
> Well, if you want to try tracking this down further, you might avoid
> the JIT entirely.  Re-configure with '--with-engine=intrp'.  See if
> that builds and passes the checks.  Hopefully someone can chime in
> with actual experience with Kaffe on an Alpha...

Currently JIT is disable for Alpha, file config/alpha/osf/jit-md.h
contains the /* Needs update, do not use */ marker.

> Hmm... looking through the logs in config/alpha I messages like:
> 	Follow ``Calling Standard for Alpha Systems'' and add exceptions
> 	handling for
> 	Dec OSF/1 with libexc.
> 	@@@ Be careful, it's not yet working. @@@
> 
> Hopefully, "working" isn't too far off.

I made that last year but I was not able to make it working :-(

Your initial problem look like a 64 bug.  I already does same fixes last
year for Alpha on Dec OSF/1.

Correct my if I'm wrong, on the Alpha the expression (void*)-1 produces
0x00000000FFFFFFFF as the cast will not propagate bit sign and -1 is an
int aka a 32 bits value.

Could you test that with the following C test case ?

    #include <stdio.h>
    int main() {
	printf ("(void*)-1 = %p\n", (void*)-1);
	return 0;
    }


Also size_t should be 64 bits, but I'm not sure, so I have change
gc_heap_base and gc_block_base to uintp.

Could you test the following patch before I commit it in the CVS Tree ?
-- 
Edouard G. Parmelan
http://egp.free.fr
-------------- next part --------------
Only in kaffe-cvs-orig/kaffe/kaffevm/mem: .#gc-mem.h
diff -ru -xTAGS -xID kaffe-cvs-orig/kaffe/kaffevm/mem/gc-incremental.c kaffe-cvs/kaffe/kaffevm/mem/gc-incremental.c
--- kaffe-cvs-orig/kaffe/kaffevm/mem/gc-incremental.c	Wed Jun 14 09:16:48 2000
+++ kaffe-cvs/kaffe/kaffevm/mem/gc-incremental.c	Fri Sep  8 00:20:33 2000
@@ -27,7 +27,7 @@
 #include "classMethod.h"
 
 /* Avoid recursively allocating OutOfMemoryError */
-#define OOM_ALLOCATING		((void *) -1)
+#define OOM_ALLOCATING		((void *) ((uintp)0 - 1))
 
 #define GCSTACKSIZE		16384
 #define FINALIZERSTACKSIZE	THREADSTACKSIZE
diff -ru -xTAGS -xID kaffe-cvs-orig/kaffe/kaffevm/mem/gc-incremental.h kaffe-cvs/kaffe/kaffevm/mem/gc-incremental.h
--- kaffe-cvs-orig/kaffe/kaffevm/mem/gc-incremental.h	Sun Aug 27 15:53:35 2000
+++ kaffe-cvs/kaffe/kaffevm/mem/gc-incremental.h	Fri Sep  8 00:34:51 2000
@@ -20,8 +20,8 @@
 #define	MAX_HEAPSIZE	(64*1024*1024)
 #define	ALLOC_HEAPSIZE	(1024*1024)
 
-extern size_t gc_heap_base;
-extern size_t gc_block_base;
+extern uintp gc_heap_base;
+extern uintp gc_block_base;
 extern uintp gc_heap_range;	/* last gc-able address - gc_heap_base */
 
 /* ------------------------------------------------------------------------ */
diff -ru -xTAGS -xID kaffe-cvs-orig/kaffe/kaffevm/mem/gc-mem.c kaffe-cvs/kaffe/kaffevm/mem/gc-mem.c
--- kaffe-cvs-orig/kaffe/kaffevm/mem/gc-mem.c	Tue Mar 21 11:05:17 2000
+++ kaffe-cvs/kaffe/kaffevm/mem/gc-mem.c	Fri Sep  8 01:42:09 2000
@@ -40,8 +40,8 @@
 void gc_primitive_free(gc_block*);
 static void* gc_system_alloc(size_t);
 
-size_t gc_heap_base;
-size_t gc_block_base;
+uintp gc_heap_base;
+uintp gc_block_base;
 uintp gc_heap_range;
 
 typedef struct {
@@ -72,7 +72,7 @@
 	S(1000),
 	S(2016),
 	S(4040),
-	{ (gc_block *)((char*)0 - 1), 0 }
+	{ (gc_block *)((uintp)0 - 1), 0 }
 }
 #endif /* PREDEFINED_NUMBER_OF_TILES */
 ;
@@ -127,7 +127,7 @@
 
 	for (i = 0; i < NR_FREELISTS; i++) {
 		gc_block* blk = freelist[i].list;
-		if (blk == 0 || blk == (gc_block*)((char*)0 - 1)) {
+		if (blk == 0 || blk == (gc_block*)((uintp)0 - 1)) {
 			continue;
 		} else {
 			gc_freeobj* mem = blk->free;
@@ -762,7 +762,7 @@
 gc_primitive_reserve(void)
 {
 	gc_block *r = 0;
-	int size = 4 * gc_pgsize;
+	size_t size = 4 * gc_pgsize;
 	
 	while (size >= gc_pgsize && !(r = gc_primitive_alloc(size))) {
 		if (size == gc_pgsize) {
@@ -794,7 +794,7 @@
 	for (;;) {
 		int missed;
 		ptr = sbrk(size);
-		if (ptr == (void*)-1) {
+		if (ptr == (void*)((uintp)0 - 1)) {
 			ptr = 0;
 			break;
 		}
@@ -943,7 +943,7 @@
 
 			R(gc_prim_freelist);
 
-			for (i = 0; freelist[i].list != (void *) -1; i++) 
+			for (i = 0; freelist[i].list != (void*)((uintp)0 - 1); i++) 
 				R(freelist[i].list);
 #undef R
 		}
diff -ru -xTAGS -xID kaffe-cvs-orig/kaffe/kaffevm/mem/gc-mem.h kaffe-cvs/kaffe/kaffevm/mem/gc-mem.h
--- kaffe-cvs-orig/kaffe/kaffevm/mem/gc-mem.h	Sun Aug 27 15:53:35 2000
+++ kaffe-cvs/kaffe/kaffevm/mem/gc-mem.h	Fri Sep  8 00:11:23 2000
@@ -40,10 +40,10 @@
 #define	NR_FREELISTS		20
 #define	GC_SMALL_OBJECT(S)	((S) <= max_small_object_size)
 
-#define	MEMALIGN		8
+#define	MEMALIGN		(uintp)8
 #define	ROUNDUPALIGN(V)		(((uintp)(V) + MEMALIGN - 1) & -MEMALIGN)
 #define	ROUNDDOWNALIGN(V)	((uintp)(V) & -MEMALIGN)
-#define	ROUNDUPPAGESIZE(V)	(((uintp)(V) + gc_pgsize - 1) & -gc_pgsize)
+#define	ROUNDUPPAGESIZE(V)	(((uintp)(V) + gc_pgsize - 1) & -(uintp)gc_pgsize)
 
 /* ------------------------------------------------------------------------ */
 
@@ -74,7 +74,7 @@
 /* ------------------------------------------------------------------------ */
 
 #define	GC_MAGIC		0xD0DECADE
-#define GCBLOCK_LIVE		((gc_block *) -1) /* block->next when alloced*/
+#define GCBLOCK_LIVE		((gc_block *) ((uintp)0 - 1)) /* block->next when alloced*/
 #define GC_BLOCKS		((gc_block *) gc_block_base)
 
 #define	GCBLOCK2STATE(B, N)	(&(B)->state[(N)])


More information about the kaffe mailing list