Partial MIPS support and debugging fixes.

Lee Iverson leei at ai.sri.com
Mon Jul 20 15:47:24 PDT 1998


There are two pieces to this patch:

Part 1 enables Kaffe to be compiled with gcc using the MIPS N32
calling convention.  It includes the changes to config/mips and also a
fic for configure.in which makes sure that -lsocket and -lnsl are only
used when necessary.  With these patches, the Kaffe 1.0b1 release runs
HelloWorldApp on an SGI under Irix 6.x!  It doesn't quite get to a
complete javac run -- that's next.

Part 2 is a set of fixes to debug calls so that they use dprintf()
instead of printf().  This ensures that debugging traces aren;t being
printed to two different streams (stderr and stdout) so that they will
remain in proper order independent of tty/piped output.

-------------------------------------------------------------------------------
Lee Iverson     		SRI International
leei at ai.sri.com			333 Ravenswood Ave., Menlo Park CA 94025
http://www.ai.sri.com/~leei/	(650) 859-3307

=== PART 1 ===

*** config/mips/common.h.orig	Tue Mar 31 11:10:53 1998
--- config/mips/common.h	Mon Jul 20 15:23:51 1998
***************
*** 13,91 ****
  #define __mips_common_h
  
! /*
!  * Make a call to a native or Java (JIT) method.
!  *  This assembly code should build a standard C call using the passed
!  *  call information.  By its nature this is highly processor specific.
!  *  This function is mandatory for the JIT, but can be avoided for
!  *  the interpreter if you don't define NO_KAFFE_STUBS.  However, the
!  *  Kaffe stubs will be deprecated at some time in the future and
!  *  this function will be needed for JNI support when it comes.
!  */
! #define	NO_KAFFE_STUBS
! #define	sysdepCallMethod(CALL)						\
! 	asm volatile ("							\n\
! 	" :								\
! 	  : "r" ((CALL)->nrargs),					\
! 	    "r" ((CALL)->args),						\
! 	    "r" ((CALL)->callsize),					\
! 	    "m" ((CALL)->function),					\
! 	    "m" ((CALL)->rettype),					\
! 	    "m" ((CALL)->ret)						\
! 	  : "eax", "ebx", "ecx", "edx", "edi", "esi", "cc", "memory");	\
! 	asm volatile ("							\n\
! 	" : : "r" ((CALL)->argsize * sizeof(jint)) : "cc")
  
! #define	CALL_KAFFE_FUNCTION_VARARGS(meth, obj, nargs, argptr, retval)	\
! 	asm volatile ("							\n\
! 		addiu $sp, $sp, -96 					\n\
! 		sw $16, 8($sp)						\n\
! 		sw $17, 12($sp)						\n\
! 		sw $18, 16($sp)						\n\
! 		sw $19, 20($sp)						\n\
! 		sw $20, 24($sp)						\n\
! 		sw $21, 28($sp)						\n\
! 		sw $22, 32($sp)						\n\
! 		sw $23, 36($sp)						\n\
! 		swc1 $f20, 40($sp)					\n\
! 		swc1 $f21, 44($sp)					\n\
! 		swc1 $f22, 48($sp)					\n\
! 		swc1 $f23, 52($sp)					\n\
! 		swc1 $f24, 56($sp)					\n\
! 		swc1 $f25, 60($sp)					\n\
! 		swc1 $f26, 64($sp)					\n\
! 		swc1 $f27, 68($sp)					\n\
! 		swc1 $f28, 72($sp)					\n\
! 		swc1 $f29, 76($sp)					\n\
! 		swc1 $f30, 80($sp)					\n\
! 		swc1 $f31, 84($sp)					\n\
! 		lw $5, 0(%2)						\n\
! 		lw $6, 4(%2)						\n\
! 		lw $7, 8(%2)						\n\
!                 move $4, %0                                             \n\
!                 move $25, %1                                            \n\
!                 jal $25                                                 \n\
! 		lwc1 $f31, 84($sp)					\n\
! 		lwc1 $f30, 80($sp)					\n\
! 		lwc1 $f29, 76($sp)					\n\
! 		lwc1 $f28, 72($sp)					\n\
! 		lwc1 $f27, 68($sp)					\n\
! 		lwc1 $f26, 64($sp)					\n\
! 		lwc1 $f25, 60($sp)					\n\
! 		lwc1 $f24, 56($sp)					\n\
! 		lwc1 $f23, 52($sp)					\n\
! 		lwc1 $f22, 48($sp)					\n\
! 		lwc1 $f21, 44($sp)					\n\
! 		lwc1 $f20, 40($sp)					\n\
! 		lw $23, 8($sp)						\n\
! 		lw $22, 12($sp)						\n\
! 		lw $21, 16($sp)						\n\
! 		lw $20, 20($sp)						\n\
! 		lw $19, 24($sp)						\n\
! 		lw $18, 28($sp)						\n\
! 		lw $17, 32($sp)						\n\
! 		lw $16, 36($sp)						\n\
!                 addiu $sp, $sp, 96 					\n\
! 	" : : "r" (obj), "r" (meth->ncode), "r" (argptr) :		\
! 		"$4", "$5", "$6", "$7", "$25")
  
  #endif
--- 13,21 ----
  #define __mips_common_h
  
! #include <stddef.h>
  
! #if _MIPS_SIM == _MIPS_SIM_NABI32
! #define sysdepCallMethod(CALL) mipsN32CallMethod(CALL)
! #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
  
  #endif
*** config/mips/irix5/md.c.orig	Tue Mar 31 11:10:53 1998
--- config/mips/irix5/md.c	Thu Jul 16 11:57:26 1998
***************
*** 9,10 ****
--- 9,12 ----
   * of this file. 
   */
+ 
+ #include "mips/mips.c"
*** config/mips/irix5/md.h.orig	Mon Apr  6 23:41:15 1998
--- config/mips/irix5/md.h	Thu Jul 16 11:32:28 1998
***************
*** 14,29 ****
  
  #include "mips/threads.h"
! 
! #ifdef SP_OFFSET
! #undef SP_OFFSET
! #endif
! 
! #ifdef FP_OFFSET
! #undef FP_OFFSET
! #endif
! 
! /* Determined on a SGI running IRIX 6.2 */ 
! #define SP_OFFSET               2
! #define FP_OFFSET               13
  
  #endif
--- 14,18 ----
  
  #include "mips/threads.h"
! #include "mips/common.h"
  
  #endif
*** config/mips/mips.c.orig	Tue Mar 31 11:10:53 1998
--- config/mips/mips.c	Mon Jul 20 15:24:46 1998
***************
*** 10,13 ****
--- 10,20 ----
   */
  
+ #include "config.h"
+ #include "config-std.h"
+ #include "config-mem.h"
+ #include "jtypes.h"
+ #include "object.h"
+ #include "support.h"
+ 
  #ifndef inline
  # define inline
***************
*** 20,21 ****
--- 27,204 ----
    return 2;
  }
+ 
+ #if _MIPS_SIM == _MIPS_SIM_NABI32
+ void
+ mipsN32CallMethod (callMethodInfo *CALL)
+ {
+   typedef long long regword;
+   int i, nrargs;
+   for (i = 0, nrargs = 0; i < (CALL)->nrargs; ++i) {
+     if ((CALL)->callsize[i] != 0) {
+       if (i > nrargs) {
+ 	(CALL)->args[nrargs] = (CALL)->args[i];
+ 	(CALL)->callsize[nrargs] = (CALL)->callsize[i];
+ 	(CALL)->calltype[nrargs] = (CALL)->calltype[i];
+       }
+       ++nrargs;
+     }
+   }
+   {
+     register int	iret	__asm__("$2");
+     register regword	jret	__asm__("$2");
+     register float	fret	__asm__("$f0");
+     register double	dret	__asm__("$f0");
+     register int	i0	__asm__("$4");
+     register regword	j0	__asm__("$4");
+     register int	i1	__asm__("$5");
+     register regword	j1	__asm__("$5");
+     register int	i2	__asm__("$6");
+     register regword	j2	__asm__("$6");
+     register int	i3	__asm__("$7");
+     register regword	j3	__asm__("$7");
+     register int	i4	__asm__("$8");
+     register regword	j4	__asm__("$8");
+     register int	i5	__asm__("$9");
+     register regword	j5	__asm__("$9");
+     register int	i6	__asm__("$10");
+     register regword	j6	__asm__("$10");
+     register int	i7	__asm__("$11");
+     register regword	j7	__asm__("$11");
+     register regword*	sp	__asm__("sp");
+     register regword*	gp	__asm__("gp");
+     register regword*	ra	__asm__("ra");
+     register regword	(*t9)()	__asm__("$25");
+     regword* curr_sp = sp;
+     regword* curr_gp = gp;
+     regword* curr_ra = ra;
+ 
+     switch (nrargs) {
+     default:
+     {
+       regword *argspace = __builtin_alloca((nrargs-8)*sizeof (regword));
+       regword *argframe = (regword *)sp;
+       regword *args = argframe;
+       int argidx = 8;
+       for (; argidx < nrargs; ++argidx, ++args) {
+ 	if ((CALL)->calltype[argidx] == 'F')
+ 	  *(float*)args = (CALL)->args[argidx].f;
+ 	else if ((CALL)->calltype[argidx] == 'D')
+ 	  *(double*)args = (CALL)->args[argidx].d;
+ 	else if ((CALL)->callsize[argidx] == 2)
+ 	  *args = (CALL)->args[argidx].j;
+ 	else
+ 	  *args = (CALL)->args[argidx].i;
+       }
+     }
+     case 8:
+       if ((CALL)->calltype[7] == 'D')
+         asm volatile ("l.d $f19,%0" : : "m" ((CALL)->args[7].d));
+       else if ((CALL)->calltype[7] == 'F')
+         asm volatile ("l.s $f19,%0" : : "m" ((CALL)->args[7].f));
+       if ((CALL)->callsize[7] == 2)
+ 	j7 = (CALL)->args[7].j;
+       else
+ 	i7 = (CALL)->args[7].i;
+     case 7:
+       if ((CALL)->calltype[6] == 'D')
+         asm volatile ("l.d $f18,%0" : : "m" ((CALL)->args[6].d));
+       else if ((CALL)->calltype[6] == 'F')
+         asm volatile ("l.s $f18,%0" : : "m" ((CALL)->args[6].f));
+       if ((CALL)->callsize[6] == 2)
+ 	j6 = (CALL)->args[6].j;
+       else
+ 	i6 = (CALL)->args[6].i;
+     case 6:
+       if ((CALL)->calltype[5] == 'D')
+         asm volatile ("l.d $f17,%0" : : "m" ((CALL)->args[5].d));
+       else if ((CALL)->calltype[5] == 'F')
+         asm volatile ("l.s $f17,%0" : : "m" ((CALL)->args[5].f));
+       if ((CALL)->callsize[5] == 2)
+ 	j5 = (CALL)->args[5].j;
+       else
+ 	i5 = (CALL)->args[5].i;
+     case 5:
+       if ((CALL)->calltype[4] == 'D')
+         asm volatile ("l.d $f16,%0" : : "m" ((CALL)->args[4].d));
+       else if ((CALL)->calltype[4] == 'F')
+         asm volatile ("l.s $f16,%0" : : "m" ((CALL)->args[4].f));
+       if ((CALL)->callsize[4] == 2)
+ 	j4 = (CALL)->args[4].j;
+       else
+ 	i4 = (CALL)->args[4].i;
+     case 4:
+       if ((CALL)->calltype[3] == 'D')
+         asm volatile ("l.d $f15,%0" : : "m" ((CALL)->args[3].d));
+       else if ((CALL)->calltype[3] == 'F')
+         asm volatile ("l.s $f15,%0" : : "m" ((CALL)->args[3].f));
+       if ((CALL)->callsize[3] == 2)
+ 	j3 = (CALL)->args[3].j;
+       else
+ 	i3 = (CALL)->args[3].i;
+     case 3:
+       if ((CALL)->calltype[2] == 'D')
+         asm volatile ("l.d $f14,%0" : : "m" ((CALL)->args[2].d));
+       else if ((CALL)->calltype[2] == 'F')
+         asm volatile ("l.s $f14,%0" : : "m" ((CALL)->args[2].f));
+       if ((CALL)->callsize[2] == 2)
+ 	j2 = (CALL)->args[2].j;
+       else
+ 	i2 = (CALL)->args[2].i;
+     case 2:
+       if ((CALL)->calltype[1] == 'D')
+         asm volatile ("l.d $f13,%0" : : "m" ((CALL)->args[1].d));
+       else if ((CALL)->calltype[1] == 'F')
+         asm volatile ("l.s $f13,%0" : : "m" ((CALL)->args[1].f));
+       if ((CALL)->callsize[1] == 2)
+ 	j1 = (CALL)->args[1].j;
+       else
+ 	i1 = (CALL)->args[1].i;
+     case 1:
+       if ((CALL)->calltype[0] == 'D')
+         asm volatile ("l.d $f12,%0" : : "m" ((CALL)->args[0].d));
+       else if ((CALL)->calltype[0] == 'F')
+         asm volatile ("l.s $f12,%0" : : "m" ((CALL)->args[0].f));
+       if ((CALL)->callsize[0] == 2)
+ 	j0 = (CALL)->args[0].j;
+       else
+ 	i0 = (CALL)->args[0].i;
+     case 0:
+       /* call function with 1st 8 args */
+       asm ("" : :
+ 	   "r" (i0), "r" (i1), "r" (i2), "r" (i3),
+ 	   "r" (i4), "r" (i5), "r" (i6), "r" (i7));
+       asm ("" : :
+ 	   "r" (j0), "r" (j1), "r" (j2), "r" (j3),
+ 	   "r" (j4), "r" (j5), "r" (j6), "r" (j7));
+ 
+       (*(t9 = (CALL)->function))();
+ 
+       asm ("lw $31,%0" : : "m" (curr_ra));
+       asm ("lw $gp,%0" : : "m" (curr_gp));
+       asm ("lw $sp,%0" : : "m" (curr_sp));
+ 
+       if ((CALL)->retsize != 0) {
+ 	switch((CALL)->retsize) {
+ 	case 2:
+ 	  if ((CALL)->rettype == 'D')
+ 	    (CALL)->ret->d = dret;
+ 	  else {
+ 	    (CALL)->ret->j = jret;
+ 	  }
+ 	  break;
+ 	case 1:
+ 	  if ((CALL)->rettype == 'F')
+ 	    (CALL)->ret->f = fret;
+ 	  else
+ 	    (CALL)->ret->i = iret;
+ 	  break;
+ 	default:
+ 	  ABORT();
+ 	  break;
+ 	}
+       }
+       break;
+     }
+   }
+ }
+ #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
*** config/mips/threads.h.orig	Wed Jul 15 20:43:48 1998
--- config/mips/threads.h	Thu Jul 16 11:38:54 1998
***************
*** 25,29 ****
   * stored.  This may be different with different OSes.
   */
! #define	SP_OFFSET		?
  
  #endif
--- 25,42 ----
   * stored.  This may be different with different OSes.
   */
! /*
!  * Stack offset.
!  * This is the offset into the setjmp buffer where the stack pointer is
!  * stored.  This may be different with different OSes.
!  */
! #if (_MIPS_SIM == _MIPS_SIM_ABI32)
! #define SP_OFFSET               2
! #define FP_OFFSET               13
! #endif
! 
! #if (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
! #define SP_OFFSET               1
! #define FP_OFFSET               23
! #endif
  
  #endif
*** configure.in.orig	Wed Jul 15 21:01:45 1998
--- configure.in	Wed Jul 15 21:12:44 1998
***************
*** 397,402 ****
  
  dnl Check for libraries for net library.
! AC_CHECK_LIBRARY(nsl,dial,NET_LIBRARIES)
! AC_CHECK_LIBRARY(socket,socket,NET_LIBRARIES)
  AC_SUBST(NET_LIBRARIES)
  
--- 397,408 ----
  
  dnl Check for libraries for net library.
! AC_CHECK_FUNC(gethostbyname)
! if test $ac_cv_func_gethostbyname = no; then
!       AC_CHECK_LIBRARY(nsl, gethostbyname, NET_LIBRARIES)
! fi
! AC_CHECK_FUNC(connect)
! if test $ac_cv_func_connect = no; then
!   AC_CHECK_LIBRARY(socket, connect, NET_LIBRARIES)
! fi
  AC_SUBST(NET_LIBRARIES)
  

=== PART 2 ===

*** kaffe/kaffevm/baseClasses.c.orig	Tue Jul 14 07:02:08 1998
--- kaffe/kaffevm/baseClasses.c	Mon Jul 20 11:57:40 1998
***************
*** 174,178 ****
  initExceptions(void)
  {
! DBG(INIT,	printf("initExceptions()\n");			)
  	if (DBGEXPR(EXCEPTION, false, true)) {
  	/* Catch signals we need to convert to exceptions */
--- 174,178 ----
  initExceptions(void)
  {
! DBG(INIT,	dprintf("initExceptions()\n");			)
  	if (DBGEXPR(EXCEPTION, false, true)) {
  	/* Catch signals we need to convert to exceptions */
*** kaffe/kaffevm/classMethod.c.orig	Sat Jul 11 23:29:04 1998
--- kaffe/kaffevm/classMethod.c	Mon Jul 20 11:57:40 1998
***************
*** 269,273 ****
  	/* Find the name of the class */
  	if (pool->tags[c] != CONSTANT_Class) {
! CDBG(		printf("setupClass: not a class.\n");			)
  		return (0);
  	}
--- 269,273 ----
  	/* Find the name of the class */
  	if (pool->tags[c] != CONSTANT_Class) {
! CDBG(		dprintf("setupClass: not a class.\n");			)
  		return (0);
  	}
***************
*** 347,356 ****
  	nc = m->name_index;
  	if (pool->tags[nc] != CONSTANT_Utf8) {
! MDBG(		printf("addMethod: no method name.\n");			)
  		return (0);
  	}
  	sc = m->signature_index;
  	if (pool->tags[sc] != CONSTANT_Utf8) {
! MDBG(		printf("addMethod: no signature name.\n");		)
  		return (0);
  	}
--- 347,356 ----
  	nc = m->name_index;
  	if (pool->tags[nc] != CONSTANT_Utf8) {
! MDBG(		dprintf("addMethod: no method name.\n");		)
  		return (0);
  	}
  	sc = m->signature_index;
  	if (pool->tags[sc] != CONSTANT_Utf8) {
! MDBG(		dprintf("addMethod: no signature name.\n");		)
  		return (0);
  	}
***************
*** 371,375 ****
  #endif
  
! MDBG(	printf("Adding method %s:%s%s (%x)\n", c->name->data, WORD2UTF(pool->data[nc])->data, WORD2UTF(pool->data[sc])->data, m->access_flags);	)
  
  	mt = &c->methods[c->nmethods++];
--- 371,375 ----
  #endif
  
! MDBG(	dprintf("Adding method %s:%s%s (%x)\n", c->name->data, WORD2UTF(pool->data[nc])->data, WORD2UTF(pool->data[sc])->data, m->access_flags);	)
  
  	mt = &c->methods[c->nmethods++];
***************
*** 406,410 ****
  	nc = f->name_index;
  	if (pool->tags[nc] != CONSTANT_Utf8) {
! FDBG(		printf("addField: no field name.\n");			)
  		return (0);
  	}
--- 406,410 ----
  	nc = f->name_index;
  	if (pool->tags[nc] != CONSTANT_Utf8) {
! FDBG(		dprintf("addField: no field name.\n");			)
  		return (0);
  	}
***************
*** 419,427 ****
  	ft = &CLASS_FIELDS(c)[index];
  
! FDBG(	printf("Adding field %s:%s\n", c->name, pool->data[nc].v.tstr);	)
  
  	sc = f->signature_index;
  	if (pool->tags[sc] != CONSTANT_Utf8) {
! FDBG(		printf("addField: no signature name.\n");		)
  		return (0);
  	}
--- 419,427 ----
  	ft = &CLASS_FIELDS(c)[index];
  
! FDBG(	dprintf("Adding field %s:%s\n", c->name, pool->data[nc].v.tstr);)
  
  	sc = f->signature_index;
  	if (pool->tags[sc] != CONSTANT_Utf8) {
! FDBG(		dprintf("addField: no signature name.\n");		)
  		return (0);
  	}
***************
*** 516,520 ****
  		Hjava_lang_String* str;
  
! LDBG(		printf("classLoader: loading %s\n", name->data); )
  		str = makeReplaceJavaStringFromUtf8(name->data, name->length, '/', '.');
  		clazz = (Hjava_lang_Class*)do_execute_java_method((Hjava_lang_Object*)loader, "loadClass", "(Ljava/lang/String;Z)Ljava/lang/Class;", 0, false, str, true).l;
--- 516,520 ----
  		Hjava_lang_String* str;
  
! LDBG(		dprintf("classLoader: loading %s\n", name->data); )
  		str = makeReplaceJavaStringFromUtf8(name->data, name->length, '/', '.');
  		clazz = (Hjava_lang_Class*)do_execute_java_method((Hjava_lang_Object*)loader, "loadClass", "(Ljava/lang/String;Z)Ljava/lang/Class;", 0, false, str, true).l;
***************
*** 523,527 ****
  		}
  		clazz->centry = centry;
! LDBG(		printf("classLoader: done\n");			)
  	} 
  
--- 523,527 ----
  		}
  		clazz->centry = centry;
! LDBG(		dprintf("classLoader: done\n");			)
  	} 
  
***************
*** 1052,1056 ****
  		fptr++;
  	}
! FDBG(	printf("Class:field lookup failed %s:%s\n", c, f);		)
  	return (0);
  }
--- 1052,1056 ----
  		fptr++;
  	}
! FDBG(	dprintf("Class:field lookup failed %s:%s\n", c, f);		)
  	return (0);
  }
*** kaffe/kaffevm/code-analyse.c.orig	Wed Jun 17 10:28:03 1998
--- kaffe/kaffevm/code-analyse.c	Mon Jul 20 11:57:40 1998
***************
*** 370,374 ****
  		if (sp < meth->localsz || sp > meth->localsz + meth->stacksz) {
  			failed = true;
! 			VDBG(printf("sp out of range: %d <%d> %d\n", meth->localsz, sp, meth->localsz + meth->stacksz);)
  			break;
  		}
--- 370,374 ----
  		if (sp < meth->localsz || sp > meth->localsz + meth->stacksz) {
  			failed = true;
! 			VDBG(dprintf("sp out of range: %d <%d> %d\n", meth->localsz, sp, meth->localsz + meth->stacksz);)
  			break;
  		}
***************
*** 390,394 ****
  		lclww = DWORD(pc+1);
  
! DBG(		printf("%d: %d\n", pc, INSN(pc));		)
  
  		switch (INSN(pc)) {
--- 390,394 ----
  		lclww = DWORD(pc+1);
  
! DBG(		dprintf("%d: %d\n", pc, INSN(pc));		)
  
  		switch (INSN(pc)) {
*** kaffe/kaffevm/constants.c.orig	Thu Jun  4 19:02:40 1998
--- kaffe/kaffevm/constants.c	Mon Jul 20 11:57:40 1998
***************
*** 49,53 ****
  
  	readu2(&info->size, fp);
! RDBG(	printf("constant_pool_count=%d\n", info->size);	)
  
  	/* Allocate space for tags and data */
--- 49,53 ----
  
  	readu2(&info->size, fp);
! RDBG(	dprintf("constant_pool_count=%d\n", info->size);	)
  
  	/* Allocate space for tags and data */
***************
*** 64,68 ****
  
  		readu1(&type, fp);
! RDBG(		printf("Constant type %d\n", type);			)
  		tags[i] = type;
  
--- 64,68 ----
  
  		readu1(&type, fp);
! RDBG(		dprintf("Constant type %d\n", type);			)
  		tags[i] = type;
  
*** kaffe/kaffevm/external.c.orig	Thu May 28 11:37:00 1998
--- kaffe/kaffevm/external.c	Mon Jul 20 11:57:40 1998
***************
*** 161,165 ****
  
  	if (libHandle[i].desc == 0) {
! LDBG(		printf("Library load failed: %s\n", LIBRARYERROR());	)
  		return (0);
  	}
--- 161,165 ----
  
  	if (libHandle[i].desc == 0) {
! LDBG(		dprintf("Library load failed: %s\n", LIBRARYERROR());	)
  		return (0);
  	}
***************
*** 209,214 ****
  	strcat(stub, STUB_POSTFIX);
  
! DBG(	printf("Method = %s.%s%s\n", m->class->name->data, m->name->data, m->signature->data);)
! DBG(	printf("Native stub = '%s'\n", stub);fflush(stdout);		)
  
  	/* Find the native method */
--- 209,214 ----
  	strcat(stub, STUB_POSTFIX);
  
! DBG(	dprintf("Method = %s.%s%s\n", m->class->name->data, m->name->data, m->signature->data);)
! DBG(	dprintf("Native stub = '%s'\n", stub);fflush(stdout);		)
  
  	/* Find the native method */
*** kaffe/kaffevm/findInJar.c.orig	Tue Jul 14 07:02:09 1998
--- kaffe/kaffevm/findInJar.c	Mon Jul 20 11:57:40 1998
***************
*** 86,90 ****
  
  	/* Look for the class */
! CDBG(	printf("Scanning for class %s\n", cname);		)
  
  	strcpy(buf, cname);
--- 86,90 ----
  
  	/* Look for the class */
! CDBG(	dprintf("Scanning for class %s\n", cname);		)
  
  	strcpy(buf, cname);
***************
*** 170,174 ****
  
  	/* Look for the class */
! CDBG(	printf("Scanning for element %s\n", cname);		)
  
  	/* One into the jar at once */
--- 170,174 ----
  
  	/* Look for the class */
! CDBG(	dprintf("Scanning for element %s\n", cname);		)
  
  	/* One into the jar at once */
***************
*** 179,183 ****
  		switch (ptr->type) {
  		case CP_ZIPFILE:
! ZDBG(			printf("Opening JAR file %s for %s\n", ptr->path, cname); )
  			if (ptr->u.jar == 0) {
  				ptr->u.jar = openJarFile(ptr->path);
--- 179,183 ----
  		switch (ptr->type) {
  		case CP_ZIPFILE:
! ZDBG(			dprintf("Opening JAR file %s for %s\n", ptr->path, cname); )
  			if (ptr->u.jar == 0) {
  				ptr->u.jar = openJarFile(ptr->path);
***************
*** 210,214 ****
  			strcat(buf, DIRSEP);
  			strcat(buf, cname);
! FDBG(			printf("Opening java file %s for %s\n", buf, cname); )
  			fp = open(buf, O_RDONLY|O_BINARY, 0);
  			if (fp < 0) {
--- 210,214 ----
  			strcat(buf, DIRSEP);
  			strcat(buf, cname);
! FDBG(			dprintf("Opening java file %s for %s\n", buf, cname); )
  			fp = open(buf, O_RDONLY|O_BINARY, 0);
  			if (fp < 0) {
***************
*** 355,359 ****
  	char* end;
  
! PDBG(	printf("initClasspath(): '%s'\n", cp);				)
  
  	for (;;) {
--- 355,359 ----
  	char* end;
  
! PDBG(	dprintf("initClasspath(): '%s'\n", cp);				)
  
  	for (;;) {
***************
*** 421,425 ****
  	classpathEntry* lptr;
  
! PDBG(	printf("addClasspath(): '%s'\n", cp);				)
  
  	lptr = 0;
--- 421,425 ----
  	classpathEntry* lptr;
  
! PDBG(	dprintf("addClasspath(): '%s'\n", cp);				)
  
  	lptr = 0;
*** kaffe/kaffevm/gc.c.orig	Tue Mar 31 11:10:53 1998
--- kaffe/kaffevm/gc.c	Thu Jul 16 17:10:50 1998
***************
*** 14,18 ****
  
  void*
! __malloc(size_t sz)
  {
  	return ((*Kaffe_GarbageCollectorInterface._malloc)(sz, GC_ALLOC_FIXED));
--- 14,18 ----
  
  void*
! __jmalloc(size_t sz)
  {
  	return ((*Kaffe_GarbageCollectorInterface._malloc)(sz, GC_ALLOC_FIXED));
***************
*** 20,24 ****
  
  void
! __free(void* mem)
  {
  	(*Kaffe_GarbageCollectorInterface._free)(mem);
--- 20,24 ----
  
  void
! __jfree(void* mem)
  {
  	(*Kaffe_GarbageCollectorInterface._free)(mem);
*** kaffe/kaffevm/intrp/checks.h.orig	Tue Mar 31 11:10:54 1998
--- kaffe/kaffevm/intrp/checks.h	Mon Jul 20 12:17:09 1998
***************
*** 13,42 ****
  #define	__checks_h
  
! #define	check_local_int(l)	CHDBG (printf ("- local %d: int %d\n", (l), local(l)->v.tint))
! #define	check_local_long(l)	CHDBG (printf ("- local %d: long %ld\n", (l), local_long(l)->v.tlong))
! #define	check_local_float(l)	CHDBG (printf ("- local %d: float %g\n", (l), local_float(l)->v.tfloat))
! #define	check_local_double(l)	CHDBG (printf ("- local %d: double %lg\n", (l), local_double(l)->v.tdouble))
! #define	check_local_ref(l)	CHDBG (printf ("- local %d: ref %p\n", (l), local(l)->v.taddr))
  
! #define	check_stack_int(l)	CHDBG (printf ("- stack %d: int %d\n", (l), stack(l)->v.tint))
! #define	check_stack_long(l)	CHDBG (printf ("- stack %d: long %ld\n", (l), stack(l)->v.tlong))
! #define	check_stack_float(l)	CHDBG (printf ("- stack %d: float %g\n", (l), stack(l)->v.tfloat))
! #define	check_stack_double(l)	CHDBG (printf ("- stack %d: double %lg\n", (l), stack(l)->v.tdouble))
! #define	check_stack_ref(l)	CHDBG (printf ("- stack %d: ref %p\n", (l), stack(l)->v.taddr))
  
! #define	check_stack_array(l)		CHDBG (printf ("- stack %d: array * %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_intarray(l)		CHDBG (printf ("- stack %d: array int %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_longarray(l)	CHDBG (printf ("- stack %d: array long %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_floatarray(l)	CHDBG (printf ("- stack %d: array float %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_doublearray(l)	CHDBG (printf ("- stack %d: array double %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_refarray(l)		CHDBG (printf ("- stack %d: array ref %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_bytearray(l)	CHDBG (printf ("- stack %d: array byte %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_chararray(l)	CHDBG (printf ("- stack %d: array char %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_shortarray(l)	CHDBG (printf ("- stack %d: array short %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
  
! #define check_pc(l)		CHDBG (printf ("  ARG %d: %d\n", l, getpc(l)))
! #define check_pc_wide(l)	CHDBG (printf ("  ARG %d: %d = %d + %d[WIDE]\n", l, getpc(l)+wide, getpc(l), wide))
! #define check_pcidx(l)	CHDBG (printf ("  ARG %d-%d: %d\n", l, l+1, (int16)((getpc(l) << 8) | getpc(l+1))))
! #define check_pcwidx(l)	CHDBG (printf ("  ARG %d-%d: %d\n", l, l+3, (int32)((getpc(l) << 24) | (getpc(l+1) << 16) | (getpc(l+2) << 8) | getpc(l+3))))
  
  #endif
--- 13,42 ----
  #define	__checks_h
  
! #define	check_local_int(l)	CHDBG (dprintf ("- local %d: int %d\n", (l), local(l)->v.tint))
! #define	check_local_long(l)	CHDBG (dprintf ("- local %d: long %ld\n", (l), local_long(l)->v.tlong))
! #define	check_local_float(l)	CHDBG (dprintf ("- local %d: float %g\n", (l), local_float(l)->v.tfloat))
! #define	check_local_double(l)	CHDBG (dprintf ("- local %d: double %lg\n", (l), local_double(l)->v.tdouble))
! #define	check_local_ref(l)	CHDBG (dprintf ("- local %d: ref %p\n", (l), local(l)->v.taddr))
  
! #define	check_stack_int(l)	CHDBG (dprintf ("- stack %d: int %d\n", (l), stack(l)->v.tint))
! #define	check_stack_long(l)	CHDBG (dprintf ("- stack %d: long %ld\n", (l), stack(l)->v.tlong))
! #define	check_stack_float(l)	CHDBG (dprintf ("- stack %d: float %g\n", (l), stack(l)->v.tfloat))
! #define	check_stack_double(l)	CHDBG (dprintf ("- stack %d: double %lg\n", (l), stack(l)->v.tdouble))
! #define	check_stack_ref(l)	CHDBG (dprintf ("- stack %d: ref %p\n", (l), stack(l)->v.taddr))
  
! #define	check_stack_array(l)		CHDBG (dprintf ("- stack %d: array * %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_intarray(l)		CHDBG (dprintf ("- stack %d: array int %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_longarray(l)	CHDBG (dprintf ("- stack %d: array long %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_floatarray(l)	CHDBG (dprintf ("- stack %d: array float %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_doublearray(l)	CHDBG (dprintf ("- stack %d: array double %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_refarray(l)		CHDBG (dprintf ("- stack %d: array ref %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_bytearray(l)	CHDBG (dprintf ("- stack %d: array byte %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_chararray(l)	CHDBG (dprintf ("- stack %d: array char %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
! #define	check_stack_shortarray(l)	CHDBG (dprintf ("- stack %d: array short %p[%d]\n", (l), stack(l)->v.taddr, *(uint32*)(object_array_length+(char*)stack(l)->v.taddr)))
  
! #define check_pc(l)		CHDBG (dprintf ("  ARG %d: %d\n", l, getpc(l)))
! #define check_pc_wide(l)	CHDBG (dprintf ("  ARG %d: %d = %d + %d[WIDE]\n", l, getpc(l)+wide, getpc(l), wide))
! #define check_pcidx(l)	CHDBG (dprintf ("  ARG %d-%d: %d\n", l, l+1, (int16)((getpc(l) << 8) | getpc(l+1))))
! #define check_pcwidx(l)	CHDBG (dprintf ("  ARG %d-%d: %d\n", l, l+3, (int32)((getpc(l) << 24) | (getpc(l+1) << 16) | (getpc(l+2) << 8) | getpc(l+3))))
  
  #endif
*** kaffe/kaffevm/lookup.c.orig	Tue Jun 16 17:04:22 1998
--- kaffe/kaffevm/lookup.c	Mon Jul 20 11:57:40 1998
***************
*** 177,181 ****
  	field = lookupClassField(class, WORD2UTF(pool->data[NAMEANDTYPE_NAME(ni, pool)]), isStatic);
  	if (field == 0) {
! DBG(FLOOKUP,	printf("Field not found\n");				)
                  throwException(NoSuchFieldError(WORD2UTF(pool->data[NAMEANDTYPE_NAME(ni, pool)])->data));
  	}
--- 177,181 ----
  	field = lookupClassField(class, WORD2UTF(pool->data[NAMEANDTYPE_NAME(ni, pool)]), isStatic);
  	if (field == 0) {
! DBG(FLOOKUP,	dprintf("Field not found\n");				)
                  throwException(NoSuchFieldError(WORD2UTF(pool->data[NAMEANDTYPE_NAME(ni, pool)])->data));
  	}
*** kaffe/kaffevm/mem/gc-mem.c.orig	Tue Jun 23 09:43:10 1998
--- kaffe/kaffevm/mem/gc-mem.c	Mon Jul 20 11:57:39 1998
***************
*** 179,185 ****
  DBG(GCSTAT,
  	for (i = 0; i < max_small_object_size; i++)
! 		printf("size %d list %d, list.size %d\n", i, sztable[i].list,
  			freelist[sztable[i].list].sz);
! 	printf("max smobjsize %d, max freelist %d\n", 
  		max_small_object_size, max_freelist);
      )
--- 179,185 ----
  DBG(GCSTAT,
  	for (i = 0; i < max_small_object_size; i++)
! 		dprintf("size %d list %d, list.size %d\n", i, sztable[i].list,
  			freelist[sztable[i].list].sz);
! 	dprintf("max smobjsize %d, max freelist %d\n", 
  		max_small_object_size, max_freelist);
      )
*** kaffe/kaffevm/object.c.orig	Tue Mar 31 11:10:54 1998
--- kaffe/kaffevm/object.c	Mon Jul 20 11:57:40 1998
***************
*** 64,68 ****
          obj->dtable = class->dtable;
  
! ADBG(	printf("newObject %x class %s\n", obj,
  		(class ? class->name->data : "<none>"));
  		fflush(stdout);						)
--- 64,68 ----
          obj->dtable = class->dtable;
  
! ADBG(	dprintf("newObject %x class %s\n", obj,
  		(class ? class->name->data : "<none>"));
  		fflush(stdout);						)
***************
*** 87,91 ****
  	cls->dtable = ClassClass->dtable;
  
! ADBG(	printf("newClass %x\n", cls);					)
  
          return (cls);
--- 87,91 ----
  	cls->dtable = ClassClass->dtable;
  
! ADBG(	dprintf("newClass %x\n", cls);					)
  
          return (cls);
*** kaffe/kaffevm/readClass.c.orig	Wed Jun 10 11:47:40 1998
--- kaffe/kaffevm/readClass.c	Mon Jul 20 11:57:40 1998
***************
*** 43,47 ****
  	readu2(&major_version, fp);
  
! DBG(	printf("major=%d, minor=%d\n", major_version, minor_version);	)
  
  	if (major_version != MAJOR_VERSION) {
--- 43,47 ----
  	readu2(&major_version, fp);
  
! DBG(	dprintf("major=%d, minor=%d\n", major_version, minor_version);	)
  
  	if (major_version != MAJOR_VERSION) {
***************
*** 77,81 ****
  
  	readu2(&interfaces_count, fp);
! DBG(	printf("interfaces_count=%d\n", interfaces_count);	)
  
  #ifdef READINTERFACES
--- 77,81 ----
  
  	readu2(&interfaces_count, fp);
! DBG(	dprintf("interfaces_count=%d\n", interfaces_count);	)
  
  #ifdef READINTERFACES
***************
*** 97,101 ****
  
  	readu2(&fields_count, fp);
! DBG(	printf("fields_count=%d\n", fields_count);		)
  	fieldThis = 0;
  
--- 97,101 ----
  
  	readu2(&fields_count, fp);
! DBG(	dprintf("fields_count=%d\n", fields_count);		)
  	fieldThis = 0;
  
***************
*** 130,134 ****
  
  	readu2(&cnt, fp);
! DBG(	printf("attributes_count=%d\n", cnt);				)
  
  	/* Skip attributes for the moment */
--- 130,134 ----
  
  	readu2(&cnt, fp);
! DBG(	dprintf("attributes_count=%d\n", cnt);				)
  
  	/* Skip attributes for the moment */
***************
*** 157,161 ****
  
  	readu2(&methods_count, fp);
! DBG(	printf("methods_count=%d\n", methods_count);		)
  	methodThis = 0;
  
--- 157,161 ----
  
  	readu2(&methods_count, fp);
! DBG(	dprintf("methods_count=%d\n", methods_count);		)
  	methodThis = 0;
  



More information about the kaffe mailing list