[kaffe] CVS kaffe (guilhem): Fixlet for AMD64.

Kaffe CVS cvs-commits at kaffe.org
Thu Sep 22 13:25:51 PDT 2005


PatchSet 6929 
Date: 2005/09/22 20:20:43
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fixlet for AMD64.

        * kaffe/kaffevm/kaffe-gc/gc-incremental.c
        (KaffeGC_WalkMemory): Use a specific alignment for stack.

        * include/defs.h
        (ALIGNMENTOF_VOIDP_IN_STACK): New macro.

        * config/x86_64/common.h
        (ALIGNMENTOF_VOIDP_IN_STACK): It is explicitly defined
        for amd64.

Members: 
	ChangeLog:1.4451->1.4452 
	config/x86_64/common.h:1.6->1.7 
	include/defs.h:INITIAL->1.9 
	kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.32->1.33 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4451 kaffe/ChangeLog:1.4452
--- kaffe/ChangeLog:1.4451	Wed Sep 21 22:37:53 2005
+++ kaffe/ChangeLog	Thu Sep 22 20:20:43 2005
@@ -1,3 +1,15 @@
+2005-09-22  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* kaffe/kaffevm/kaffe-gc/gc-incremental.c
+	(KaffeGC_WalkMemory): Use a specific alignment for stack.
+
+	* include/defs.h
+	(ALIGNMENTOF_VOIDP_IN_STACK): New macro.
+
+	* config/x86_64/common.h
+	(ALIGNMENTOF_VOIDP_IN_STACK): It is explicitly defined
+	for amd64.
+
 2005-09-22  Dalibor Topic  <robilad at kaffe.org>
 
 	* kaffe/kaffeh/Makefile.am:
Index: kaffe/config/x86_64/common.h
diff -u kaffe/config/x86_64/common.h:1.6 kaffe/config/x86_64/common.h:1.7
--- kaffe/config/x86_64/common.h:1.6	Sun Apr 17 20:36:43 2005
+++ kaffe/config/x86_64/common.h	Thu Sep 22 20:20:47 2005
@@ -17,6 +17,8 @@
 /* Stack must be aligned on 16-bytes boundary.  */
 #define NEED_STACK_ALIGN
 #define STACK_ALIGN(p)  ((((unsigned long)(p)) & 15) ^ (unsigned long)(p))
+/* However pointers are specially aligned on 4 bytes. */
+#define ALIGNMENTOF_VOIDP_IN_STACK 4
 
 /* This define will cause callMethodV and callMethodA to avoid
    introducing unused slots after jlongs and jdoubles.  */
===================================================================
Checking out kaffe/include/defs.h
RCS:  /home/cvs/kaffe/kaffe/include/defs.h,v
VERS: 1.9
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/include/defs.h	Thu Sep 22 20:25:50 2005
@@ -0,0 +1,80 @@
+/*
+ * defs.h
+ *
+ * Copyright (c) 1996, 1997
+ *	Transvirtual Technologies, Inc.  All rights reserved.
+ *
+ * Copyright (c) 2003
+ *      Kaffe.org contributors. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution 
+ * of this file. 
+ */
+
+#ifndef __defs_h
+#define __defs_h
+
+#include "gccbuiltin.h"
+
+#define	MAXNUMLEN	64
+#define	MAXLIBPATH	1024
+
+#if !defined(MAXNAMELEN)
+#define	MAXNAMELEN	1024
+#endif
+
+#if !defined(MAXPATHLEN)
+#define	MAXPATHLEN	1024
+#endif
+
+#ifdef __cplusplus
+#  define BEGIN_C_DECLS extern "C" {
+#  define END_C_DECLS   }
+#else /* !__cplusplus */
+#  define BEGIN_C_DECLS
+#  define END_C_DECLS
+#endif /* __cplusplus */
+
+/* define a cross platform VA_LIST_COPY(destination, source).
+ *
+ * We can's simply assign va_lists, since they are not necessarily structs.
+ * On s390-linux, they are arrays, for example.
+ * So let's use whatever system method there is to copy va_lists, before
+ * we try to copy them by assignment.
+ */
+#if defined(HAVE_VA_COPY)
+/* use va_copy */
+#  define VA_LIST_COPY(dest, src) (va_copy(dest,src))
+#else /* ! HAVE_VA_COPY */
+
+/* use __va_copy*/
+#  if defined(HAVE__VA_COPY)
+#    define VA_LIST_COPY(dest, src) (__va_copy(dest, src))
+#  else /* ! HAVE_VA_COPY && ! HAVE__VA_COPY */
+
+/* va_list is an array, use memcpy */
+#    if defined(VA_LIST_IS_ARRAY)
+#     define VA_LIST_COPY(dest, src) (memcpy (dest, src, sizeof (dest)))
+#    else /* ! HAVE_VA_COPY && ! HAVE__VA_COPY && ! VA_LIST_IS_ARRAY */
+
+/* use plain assignment, then */
+#     define VA_LIST_COPY(dest, src) (dest = src)
+#    endif /* VA_LIST_IS_ARRAY */
+#  endif /* HAVE__VA_COPY */
+#endif /* HAVE_VA_COPY */
+
+#ifndef NULL
+#define NULL (void *)0
+#endif
+
+/* define alignment of 'void *' */
+#ifndef ALIGNMENTOF_VOIDP
+typedef struct { char c; void *p; } alignmentof_voidp_helper;
+#define ALIGNMENTOF_VOIDP (offsetof(alignmentof_voidp_helper, p))
+#endif
+
+#ifndef ALIGNMENTOF_VOIDP_IN_STACK
+#define ALIGNMENTOF_VOIDP_IN_STACK ALIGNMENTOF_VOIDP
+#endif
+
+#endif /* __defs_h */
Index: kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c
diff -u kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.32 kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.33
--- kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c:1.32	Sun Jul 31 15:18:50 2005
+++ kaffe/kaffe/kaffevm/kaffe-gc/gc-incremental.c	Thu Sep 22 20:20:48 2005
@@ -340,7 +340,9 @@
 	record_marked(1, size);
 
 	if (size > 0) {
-		for (mem = ((const int8*)base) + (size & (uintp)-ALIGNMENTOF_VOIDP) - sizeof(void*);
+		uintp alignment = ALIGNMENTOF_VOIDP_IN_STACK;
+
+		for (mem = ((const int8*)base) + (size & -alignment) - sizeof(void*);
 		     (const void*)mem >= base;
 		     mem -= ALIGNMENTOF_VOIDP) {
 			const void *p = *(void * const *)mem;




More information about the kaffe mailing list