Kaffe 0.8.3 build on Solaris: Status

Gilles Dauphin kaffe@kaffe.org
Wed, 2 Apr 1997 09:57:12 +0200


----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 19


> From andyl@perihelion.co.uk Tue Apr  1 23:22:36 1997
> 
>   Thanks to those of you who have helped with my solaris builds. I've
> put together what I've discovered so far...
> 
>   2.3 seems to build and run correctly
>   2.4 needs minor modifications according to Thomas Lea.
>   2.5 needs minor makefile modifications to makefiles
>       but will not run once built. Attempting to configure builds
>       without JIT and/or scanned libraries only creates a TON of
>       problems.

Hi, Andy

Here is the diff for Solaris2.5 with SparcWorks Prof C 4.0 for Kaffe 0.8.3.
Configure in intrp mode will work.

Gilles
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: diffk0.8.3
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 77

diff -r kaffe-0.8.3/configure kaffe-0.8.3.orig/configure
841,842c841
< 	PIC=-KPIC
< 	CFLAGS="-g -DUSE_SPARC_PROF_C"
---
> 	PIC=-fPIC
Only in kaffe-0.8.3/config/sparc: sunc-threads.h
diff -r kaffe-0.8.3/config/sparc/threads.h kaffe-0.8.3.orig/config/sparc/threads.h
23,25d22
< #ifndef USE_SPARC_PROF_C
< 		/* we don't use SparcWorks professional */
< 
107,121d103
< #else
< 		/* We use SparcWorks Prof C  G.D. 12/Mars/97  */
< /**/                                        
< /* Thread handling */                       
< /**/                                        
<                                             
< #define THREADSWITCH(to, from) ThreadSwitch(to, from)
<                                             
< #define THREADINIT(to, func) ThreadInit(to, func)
<                                             
< #define THREADINFO(ee) ThreadInfo(ee)       
<                                             
< #define THREADFRAMES(tid, cnt) cnt = ThreadFrames(tid)
<                                             
< #endif
diff -r kaffe-0.8.3/include/native.h kaffe-0.8.3.orig/include/native.h
59d58
< #ifndef USE_SPARC_PROF_C
63,67d61
< #else
< #define ARRAY_FIELDS \
< 	unsigned int		length;\
< 	double			align
< #endif
diff -r kaffe-0.8.3/kaffe/kaffevm/Makefile.in kaffe-0.8.3.orig/kaffe/kaffevm/Makefile.in
77c77
< 		@LINKVMLIB@ @NET_LIBRARIES@
---
> 		@LINKVMLIB@
diff -r kaffe-0.8.3/kaffe/kaffevm/baseClasses.c kaffe-0.8.3.orig/kaffe/kaffevm/baseClasses.c
25d24
< #include "thread.h"
diff -r kaffe-0.8.3/kaffe/kaffevm/classMethod.c kaffe-0.8.3.orig/kaffe/kaffevm/classMethod.c
31d30
< #include "thread.h"
diff -r kaffe-0.8.3/kaffe/kaffevm/object.h kaffe-0.8.3.orig/kaffe/kaffevm/object.h
36d35
< #ifndef USE_SPARC_PROF_C 
38,40d36
< #else 
<         double                  align;
< #endif
diff -r kaffe-0.8.3/kaffe/kaffevm/thread.c kaffe-0.8.3.orig/kaffe/kaffevm/thread.c
48,51d47
< #ifdef USE_SPARC_PROF_C
< #include "sparc/sunc-threads.h"
< #endif
< 
1056,1063d1051
< /* From Frank.Mehnert@mchp.siemens.de Mon Mar 24 22:02:47 1997
< in file kaffe/kaffevm/thread.c function walkThread(gcInfo *base)
< there is a little bug: Because the stack of a thread is not allocated
< by gc_malloc we must adjust gcStats by hand (because scanConservative
< does it also):
< */
< 	gcStats.markedmem -= (base->size - sizeof(thread));
< /*end bug */
diff -r kaffe-0.8.3/kaffe/kaffevm/thread.h kaffe-0.8.3.orig/kaffe/kaffevm/thread.h
51d50
< #ifndef USE_SPARC_PROF_C
53,55d51
< #else
< 	double			align;
< #endif
----------
X-Sun-Data-Type: h-file
X-Sun-Data-Description: h-file
X-Sun-Data-Name: sunc-threads.h
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 122

/*
 * sparc/sunc-threads.h
 * Sparc threading information. when using sparc works prof C 4.0
 *
 */

#ifndef __sparc_sunc_threads_h
#define __sparc_sunc_threads_h

#ifndef USE_SPARC_PROF_C
/* we don't use SparcWorks professional */

#else
		/* We use SparcWorks Prof C  G.D. 12/Mars/97  */

/**/
/* Thread handling */
/**/

void ThreadSwitch( ctx * to,  ctx * from );
int ThreadFrames( thread* tid);
void ThreadInit( ctx * to, void (*)() );  /* ou func = void *  */
void ThreadInfo(ctx * ee);

#pragma unknow_control_flow (ThreadSwitch)

void ThreadSwitch( ctx * to,  ctx * from )
{
        int regstore[6];
        register int *reg;		/* %i5 */
        register uint8 ** frp;		/* %i4 */
        register uint8 ** trp;		/* %i3 */
 
 
        reg = regstore; /* avoid compiler optimisation */
        frp =  &((from)->restorePoint);
        trp =  &((to)->restorePoint);
 
        asm("                                                   \n\
                call 1f                                         \n\
                nop                                             \n\
1:                                                              \n\
                add %o7,%lo(2f-1b+8),%l0                        \n\
                                                                \n\
                ta 3                                            \n\
                st %l0,[%i5+0]                                  \n\
                st %fp,[%i5+4]                                  \n\
                st %sp,[%i5+8]                                  \n\
                st %l7,[%i5+12]                                 \n\
                st %i7,[%i5+16]                                 \n\
                st %i5,[%i4]                                    \n\
                                                                \n\
                ld [%i3],%i5                                    \n\
                ld [%i5+16],%i7                                 \n\
                ld [%i5+12],%l7                                 \n\
                ld [%i5+8],%sp                                  \n\
                ld [%i5+4],%fp                                  \n\
                ld [%i5+0],%l0                                  \n\
                                                                \n\
                jmpl %l0,%g0                                    \n\
                nop                                             \n\
2:              nop"
        );
}

void ThreadInit( ctx * to, void (*func)() )  /* ou func = void *  */
{
        int* regstore = (int*)((to)->stackEnd - (6 * 4));

        (to)->restorePoint = (void*)regstore;
        regstore[0] = (int)func;
        regstore[1] = ((int)regstore) - (16 * 4);
        regstore[2] = regstore[1];
        regstore[3] = 0;
        regstore[4] = 0;
}
 
void ThreadInfo(ctx * ee)
{
        void** ptr;     /* %fp -4 */
        int i;          /* %fp -8 */
                        /* no return value */
 
        asm("   ta 3");              
/* gnu as       asm("mov %%sp,%0" : "=r" (ptr)); */
        asm("   mov %sp,%o4");       
        asm("   st %o4,[%fp-4]");    
                                     
        for (i = 0; i != 2; i++) {   
                ptr = (void**)ptr[14];
        }                            
                                     
        (ee)->restorePoint = 0;      
        (ee)->stackEnd = (void*)ptr; 
        (ee)->stackBase = (ee)->stackEnd - threadStackSize;
        (ee)->flags = THREAD_FLAGS_NOSTACKALLOC;
}                                    
                                     
int ThreadFrames( thread* tid)       
{                                    
        void** ptr;             /* %fp -8 */
        int cnt = 0;            /* %fp -12 */
                                /* return value is in %fp-4 */
                                     
        if (tid == currentThread) {  
                asm("   ta 3");      
/* gcc asm              asm("mov %%sp,%0" : "=r" (ptr));*/
                asm("   mov %sp,%o3");
                asm("   st %o3,[%fp-8]"); 
        } else {                     
                ptr = ((void***)TCTX(tid)->restorePoint)[2];
        }                            
        while (*ptr != 0) {          
                cnt++ ;              
                ptr = (void**)ptr[14];
        }                            
        return cnt;                  
}                                    

#endif

#endif