Re: libtool-enhanced testing on HP-PA

1999-05-31 Thread Marcus G. Daniels



KG> That is, with shared libraries! (Somebody else may try the static
KG> ones :-) Kaffe works under HP/UX 10.20!

I had a problem with shl_findsym (on HPsUX 9 and 10).  I had to use a
pointer to NULL for the shared library handle, in order to get access
to all the symbols in the environment.



Re: Where is kaffe/kaffevm/jit/translator.c ?

1999-07-27 Thread Marcus G. Daniels


> "EP" == Edouard G Parmelan <[EMAIL PROTECTED]> writes:

EP> First, use the correct automake version as FAQ/FAQ.automake said:

Huh?  "translator.c" is in kaffevm/jit/Makefile.am.



kaffe/io/ConverterAlias.java and "Default"

2000-01-31 Thread Marcus G. Daniels



It appears that the "Default" charset alias isn't handled in the right way.
I see there's a class CharToByteDefault, but the alias method
forces the name to upper case.  (A result of this is that unicode.tbl
file isn't located in the right way with Cygwin.)

diff -c -r1.7 ConverterAlias.java
*** libraries/javalib/kaffe/io/ConverterAlias.java  1999/10/25 17:31:26 1.7
--- libraries/javalib/kaffe/io/ConverterAlias.java  2000/01/30 21:34:31
***
*** 47,53 
   * @return alias if found, name if not.
   */
  static String alias(String name) {
!   name = name.toUpperCase();
String alternate = (String)alias.get(name);
if (alternate == null) {
return (name);
--- 47,54 
   * @return alias if found, name if not.
   */
  static String alias(String name) {
! if (!name.equals ("Default"))
!   name = name.toUpperCase();
String alternate = (String)alias.get(name);
if (alternate == null) {
return (name);



crash loading gcj stuff

2000-02-02 Thread Marcus G. Daniels



This is on Redhat 6.1 with sources fresh out of CVS.  Any ideas?

(gdb) bt
#0  0x40065365 in comparePath2ClassName (cname=0x81071a0 "java/lang/Object", 
pname=0x4 )
at /src/kaffe/kaffe/kaffevm/gcj/gcj-class.cc:477
#1  0x400653b2 in gcjFindClassByUtf8Name (
utf8name=0x81071a0 "java/lang/Object", einfo=0xb084)
at /src/kaffe/kaffe/kaffevm/gcj/gcj-class.cc:493
#2  0x40030d4d in findClass (centry=0x810e1f8, einfo=0xb084)
at /src/kaffe/kaffe/kaffevm/findInJar.c:84
#3  0x40027cf7 in loadClass (name=0x8107198, loader=0x0, einfo=0xb084)
at /src/kaffe/kaffe/kaffevm/classMethod.c:992
#4  0x400662e4 in kenvFindClass (cname=0x4008cda2 "Ljava/lang/Object;", 
einfo=0xb084) at /src/kaffe/kaffe/kaffevm/gcj/gcj-glue.c:96
#5  0x40066cb1 in kenvTranslateMethod (
classname=0x4008cda2 "Ljava/lang/Object;", mname=0x4008cdcd "", 
msig=0x4008cdd4 "()") at /src/kaffe/kaffe/kaffevm/gcj/gcj-glue.c:639
#6  0x4006493b in gcj_fixup_trampoline (psymbol=0x4035aa7c)
at /src/kaffe/kaffe/kaffevm/gcj/gcj-class.cc:124
#7  0x400636d5 in __kaffe_i386_gcj_fixup ()
at /src/kaffe/kaffe/kaffevm/jit3/machine.c:1013
#8  0x40242592 in global constructors keyed to _Jv_equalUtf8Consts ()
at /src/sourceware/libgcj/libjava/prims.cc:577
#9  0x402df177 in __do_global_ctors_aux () from /packages/lib/libgcj.so.1
#10 0x4023ae22 in ?? () from /packages/lib/libgcj.so.1
#11 0x4018dfba in dl_open_worker (a=0xb298) at dl-open.c:199
#12 0x4000a3eb in _dl_catch_error (errstring=0xb294, 
operate=0x4018dd20 , args=0xb298) at dl-error.c:141
#13 0x4018e0cd in _dl_open (file=0x8107108 "hello.so", mode=257, 
caller=0xb294) at dl-open.c:232
#14 0x40093737 in dlopen_doit (a=0xb3a8) at dlopenold.c:45
#15 0x4000a3eb in _dl_catch_error (errstring=0x40094d00, 
operate=0x4009370c , args=0xb3a8) at dl-error.c:141
#16 0x40093549 in _dlerror_run (operate=0x4009370c , 
args=0xb3a8) at dlerror.c:125
#17 0x400936fb in __dlopen_nocheck (file=0x8107108 "hello.so", mode=256)
at dlopenold.c:61
#18 0x40064b72 in gcjLoadSharedObject (sofile=0x8107108 "hello.so")
at /src/kaffe/kaffe/kaffevm/gcj/gcj-class.cc:221
#19 0x400316a1 in gcjInit () at /src/kaffe/kaffe/kaffevm/findInJar.c:347
#20 0x40026715 in initialiseKaffe ()
at /src/kaffe/kaffe/kaffevm/baseClasses.c:150
#21 0x40037e25 in JNI_CreateJavaVM (vm=0x804b6d4, env=0x804b6d8, 
args=0x804b680) at /src/kaffe/kaffe/kaffevm/jni.c:165
#22 0x8048c47 in main (argc=2, argv=0xb8e4)
at /src/kaffe/kaffe/kaffe/main.c:113
#23 0x400c91eb in __libc_start_main (main=0x8048b50 , argc=2, 
argv=0xb8e4, init=0x8048924 <_init>, fini=0x804997c <_fini>, 
rtld_fini=0x4000a610 <_dl_fini>, stack_end=0xb8dc)
at ../sysdeps/generic/libc-start.c:90



Re: crash loading gcj stuff

2000-02-02 Thread Marcus G. Daniels


> "GB" == Godmar Back <[EMAIL PROTECTED]> writes:

GB> Or are you a "alpha test power user" who wants to help testing gcj
GB> support?  

Yeah, I understand refinements are a long road..  But I must admit I'm greedy
to see how much difference gcj will make on the client-side of my things..

GB> If so, did you remember to run the fixup program in developers?

Yeah, incidentally, I had to exclude some symbols that matched a
pattern that fixup was looking for.  They were of the form
"__*@@GLIBC_2.0".  Another change was to include
 in gcj-class.cc and gcj-soft.cc.

GB> Could you give the gcc version (gcc -v), whether or not you have
GB> libgcj installed on your system (try locate libgcj), what
GB> libraries kaffe was linked against (try ldd ./libexec/Kaffe)

I'm using GCC out of CVS as of yesterday (2.96 2131), likewise for
libgcj.  ldd on Kaffe reports libdl.so.2, libm.so.6, libc.so.6,
ld-linux.so.2, and libkaffevm-1.0.5.so.

GB> What is your CLASSPATH? 

Just hello.so.  

GB> Your LD_LIBRARY_PATH? 

. (for the fixup) and /usr/X11R6/lib

GB> Your /etc/ld.so.conf?

/usr/X11R6/lib and /usr/i486-linux-libc5/lib

GB> How did you compile hello.so? 

First compiled against the unpacked Klasses.jar and then linked with
"gcj -shared -o X.so X.o". 

GB> Could you type "ldd hello.so" for me (this mustn't depend on
GB> libgcj.so!)

The previous link command ended up giving me libzgcj.so.0, libgcjgc.so.1,
and libgcj.so.1 as depedencies.  With -nostdlib that goes away, but now I 
get a different behavior:

mgd@hive[~] $ CLASSPATH=hello.so LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH KAFFE_DEBUG=gdb 
kaffe -vmdebug GCJ,GCJMORE hello
GNU gdb 2117
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-pc-linux-gnu"...
(gdb) run
Starting program: /packages/libexec/Kaffe -vmdebug GCJ,GCJMORE hello
-
Dumping fixup symbol table for module hello.so
CLASS @0x40099100, d1=Ljava/lang/Object;, d2=, d3=
CLASS @0x40099160, d1=Ljava/lang/System;, d2=, d3=
  STATICFIELD @0x400991ac, d1=Ljava/lang/System;, d2=out, d3=
   METHOD @0x400990c0, d1=Ljava/lang/Object;, d2=, d3=()
   VTABLE @0x400991c0, d1=Ljava/lang/Class;, d2=, d3=
   METHOD @0x400990c8, d1=Ljava/lang/Object;, d2=clone, d3=()
   METHOD @0x400990d0, d1=Ljava/lang/Object;, d2=equals, d3=(Ljava/lang/Object;)
   METHOD @0x400990d8, d1=Ljava/lang/Object;, d2=finalize, d3=()
   METHOD @0x400990e0, d1=Ljava/lang/Object;, d2=hashCode, d3=()
   METHOD @0x400990e8, d1=Ljava/lang/Object;, d2=toString, d3=()
---end of table for hello.so---
gcjLoadSharedObject: Loaded `hello.so'
getStaticFieldAddr: static field java/lang/System.out at 0x400991ac
Class `int'@0x4009
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
Class `long'@0x40090060
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
Class `boolean'@0x400900c0
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
Class `char'@0x40090120
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
Class `float'@0x40090180
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
Class `double'@0x400901e0
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
Class `byte'@0x40090240
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
Class `short'@0x400902a0
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
Class `void'@0x40090300
  accflags=0x0   superclass=@(nil)
  size_in_bytes= 0   vtable_method_count= 0   method_count= 0 
  field_count= 0   static_field_count= 0   state= 0 
  interface_count= 0 
invoking __throw: obj@0x81f7220 class=`java/util/NoSuchElementException'

Program received signal SIGABRT, Aborted.
0x400da4e1 in __kill () from /lib/libc.so.6
(gdb) bt
#0  0x400da4e1 in __kill () fro

Re: crash loading gcj stuff

2000-02-02 Thread Marcus G. Daniels


> "GB" == Godmar Back <[EMAIL PROTECTED]> writes:

MD> "gcj -shared -o X.so X.o".

GB> I don't believe this will work.  You have to use "gcc" instead of
GB> "gcj" or else you end up with a different spec file that pulls in
GB> the libs you describe.  Alexandre says the same.

Ok, I did this blindly per FAQ/FAQ.gcj. 

GB> Could you try x/i 0x40090760 x/i 0x4006d234 to see what stack
GB> frame we're in?

eh.0 and _Jv_Throw+180

GB> Note that kaffe must be compiled with the same version of gcc that
GB> you compile gcj with.

Yep, thanks.

GB> In frame 4, it would be nice to know what reg and
GB> udata->saved[reg] are.

reg was optimized away, apparently... But by the caller (next_stack_level)
it looks like it must be 256 and 40, respectively.

GB> Note that you can source developers/gdbinit and type
GB> findnativemethod 0x81f42d3 to find where you are.  But it's not
GB> important here, I don't think.

(Hey, cool!)

Ok, starting from the bottom and going up:

(gdb) 
#11 0x81e2693 in ?? ()
(gdb) findnativemethod 0x81e2693
java/util/Vector$1.nextElement;()Ljava/lang/Object;: 0x81e2638 0x81e26dd idx=
(gdb) up
#12 0x81cd301 in ?? ()
(gdb) findnativemethod 0x81cd301
java/lang/ClassLoader.getResource;(Ljava/lang/String;)Ljava/net/URL;: 0x81cd2  
  0x81cd387 idx=8
(gdb) up
#13 0x8173d2a in ?? ()
(gdb) findnativemethod 0x8173d2a
java/lang/ClassLoader.getResourceAsStream;(Ljava/lang/String;)Ljava/io/InputS  
  am;: 0x8173cf8 0x8173d9b idx=11
(gdb) up
#14 0x81a73ee in ?? ()
(gdb) findnativemethod 0x81a73ee
java/lang/ClassLoader.getSystemResourceAsStream;(Ljava/lang/String;)Ljava/io/  
  utStream;: 0x81a73c8 0x81a73fb idx=-1
(gdb) up
#15 0x81bf10b in ?? ()
(gdb) findnativemethod 0x81bf10b
java/lang/System.;()V: 0x81bf010 0x81bf88d idx=-1
(gdb) up
#16 0x4004d778 in callMethodA (meth=0x8139880, func=0x83a418, obj=0x0,
  args=0x0, ret=0xbfffeb00, prompted=0) at /src/kaffe/config/i386/common.h

GB> Could you also make sure that kaffe is compiled with the
GB> -fexceptions flag?

Building now.. 



Re: kaffe/io/ConverterAlias.java and "Default"

2000-02-02 Thread Marcus G. Daniels


> "AC" == Archie Cobbs <[EMAIL PROTECTED]> writes:

AC> I fixed this a slightly different way. Let me know if you have any
AC> problems.

I don't think that's quite right, because the file.encoding property is 
"Default", not "DEFAULT".



Re: crash loading gcj stuff

2000-02-02 Thread Marcus G. Daniels



So it seems to be something with exception handling.  In the two cases
below I had to take care to avoid class-lookup failures.  Avoiding
those failures, the gcj shared object loads and runs fine.

retrieving revision 1.1
Index: libraries/javalib/java/lang/ClassLoader.java
===
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/lang/ClassLoader.java,v
retrieving revision 1.19
diff -c -r1.19 ClassLoader.java
*** libraries/javalib/java/lang/ClassLoader.java1999/09/21 20:47:15 1.19
--- libraries/javalib/java/lang/ClassLoader.java2000/02/03 00:36:41
***
*** 146,152 
  
  public URL getResource(String name) {
try {
!   return (URL)getResources(name).nextElement();
} catch (IOException e) {
} catch (NoSuchElementException e) {
}
--- 146,155 
  
  public URL getResource(String name) {
try {
!   Enumeration vec = getResources (name);
!   
!   if (vec.hasMoreElements ())
!   return (URL)vec.nextElement();
} catch (IOException e) {
} catch (NoSuchElementException e) {
}
Index: libraries/javalib/kaffe/net/DefaultURLStreamHandlerFactory.java
===
RCS file: 
/cvs/kaffe/kaffe/libraries/javalib/kaffe/net/DefaultURLStreamHandlerFactory.java,v
retrieving revision 1.4
diff -c -r1.4 DefaultURLStreamHandlerFactory.java
*** libraries/javalib/kaffe/net/DefaultURLStreamHandlerFactory.java 1999/07/24 
00:56:36 1.4
--- libraries/javalib/kaffe/net/DefaultURLStreamHandlerFactory.java 2000/02/03 
00:36:43
***
*** 46,58 
}
}
  
/* Try the TVT default name */
!   String classPath = tvtName + protocol + ".Handler";
handler = tryClass(classPath);
if (handler != null) {
cache.put(protocol, handler);
return (handler);
}
  
/* Try the default name */
classPath = defaultName + protocol + ".Handler";
--- 46,61 
}
}
  
+   String classPath;
/* Try the TVT default name */
! /*
! classPath = tvtName + protocol + ".Handler";
handler = tryClass(classPath);
if (handler != null) {
cache.put(protocol, handler);
return (handler);
}
+ */
  
/* Try the default name */
classPath = defaultName + protocol + ".Handler";



Re: kaffe/io/ConverterAlias.java and "Default"

2000-02-03 Thread Marcus G. Daniels


> "AC" == Archie Cobbs <[EMAIL PROTECTED]> writes:

AC> It should match "Default" case-insensitively.. no?  

Ok, I see there is still a name.toUpperCase call in the alias method.
I must have had .class files out-of-sync, and was jumping to conclusions. 

Sorry for the false alarm.



Re: crash loading gcj stuff

2000-02-03 Thread Marcus G. Daniels


> "GB" == Godmar Back <[EMAIL PROTECTED]> writes:

GB> On the positive side, it's nice to see someone actually replicate
GB> what I did and getting that far.

In the interest of replication, here's a test case that works for me.
(A build script and a run script.)

#!/bin/sh
P=/packages
DATADIR=/common/share
S=/src
CP=.:$DATADIR/kaffe

cat > hello.java << EOF
public class hello {
static void main (String args[]) {
System.out.println ("Hello World");
}
}
EOF
jikes -classpath $CP hello.java
gcj -g -fPIC -c -classpath $CP hello.class
rm hello.class
gcc -g $S/kaffe/developers/fixup.c -o fixup
gcc -shared -o hello.so hello.o
./fixup hello > _fixup_hello.cc
g++ -fPIC -I$P/include -c _fixup_hello.cc
gcc -shared -o _fixup_hello.so _fixup_hello.o


#!/bin/sh
P=/packages
DATADIR=/common/share
CP=.:$DATADIR/kaffe
DEBUG='-vmdebug gcj -verbosejit'
#DEBUG='-v'

KAFFE_DEBUG=gdb CLASSPATH=hello.so:$CP LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH kaffe $DEBUG 
 hello



Re: crash loading gcj stuff

2000-02-03 Thread Marcus G. Daniels


> "GB" == Godmar Back <[EMAIL PROTECTED]> writes:

GB> It's 17.  So change 19 -> 17 in i386/jit.h and try that. 

Yep, my otherwise unmodified Kaffe is loading gcj-compiled code now.  Neat.

GB> Here's another hint: if you use optimization as in -O2 or -O3,
GB> make sure you also use -fkeep-inline to avoid that gcj removes the
GB> meta-information for private methods it inlines. 

There's one little hitch: when linking kaffeh, if you have
-fkeep-inline-functions, there will end-up being undefined references
to postOutOfMemory and throwError via in utf8const.o from checkPtr (a
static inline in errors.h).



DOS drive names

2000-02-08 Thread Marcus G. Daniels



This isn't suitable as a patch, but here are two places where
DOS-style pathnames (C:\path\file) aren't handled, and spooky things
happen as a result...

diff -c -r1.15 File.c
*** libraries/clib/io/File.c2000/01/05 00:16:20 1.15
--- libraries/clib/io/File.c2000/02/08 01:36:12
***
*** 311,320 
  jbool
  java_io_File_isAbsolute(struct Hjava_io_File* this)
  {
!   char str[2];
  
stringJava2CBuf(unhand(this)->path, str, sizeof(str));
!   return (str[0] == file_separator[0]);
  }
  
  jboolean
--- 311,324 
  jbool
  java_io_File_isAbsolute(struct Hjava_io_File* this)
  {
!   char str[3];
  
stringJava2CBuf(unhand(this)->path, str, sizeof(str));
!   return 
! #ifdef __CYGWIN__
! (str[1] == ':') ||
! #endif
! (str[0] == file_separator[0]);
  }
  
  jboolean
diff -c -r1.24 File.java
*** libraries/javalib/java/io/File.java 2000/01/13 21:04:39 1.24
--- libraries/javalib/java/io/File.java 2000/02/08 01:40:05
***
*** 184,191 
  // Build a string of the remaining elements.
  StringBuffer buf = new StringBuffer();
  for (int i = 0; i < j; i++) {
buf.append(separatorChar);
! buf.append(array[i]);
  }
  return (buf.toString());
  }
--- 184,194 
  // Build a string of the remaining elements.
  StringBuffer buf = new StringBuffer();
  for (int i = 0; i < j; i++) {
+   if (!(i == 0
+ && array[i].length () == 2
+ && array[i].lastIndexOf (':') == 1))
buf.append(separatorChar);
!   buf.append(array[i]);
  }
  return (buf.toString());
  }



Re: DOS drive names

2000-02-09 Thread Marcus G. Daniels


> "AO" == Alexandre Oliva <[EMAIL PROTECTED]> writes:

MD> This isn't suitable as a patch

AO> But, with your patch, it would say `C:file' is absolute.

Indeed -- just wanted to get the issue and vicinities recorded...



Re: sysdepCallMethod for embedded linux PowerPC

2000-02-26 Thread Marcus G. Daniels


> "PR" == Pavel Roskin <[EMAIL PROTECTED]> writes:

PR> Threads and AWT are broken.

Hmm, I noticed that a --with-engine=intrp configuration for
sparc-sun-solaris2.7 (non-libffi) results in illegal instruction
core dumps on native code calls.  PPC displays the same phenomenology.
Perhaps it is a more general problem?



Re: sysdepCallMethod for embedded linux PowerPC

2000-02-27 Thread Marcus G. Daniels


> "GB" == Godmar Back <[EMAIL PROTECTED]> writes:

GB> I bet the problem is general, it's in all the fragility
GB> surrounding the use of asm()'s in various versions of gcc/egcs/gcc
GB> on various architectures. 

This was the cause of the problems I was having, anyway...

Index: support.c
===
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/support.c,v
retrieving revision 1.46
diff -c -r1.46 support.c
*** support.c   2000/02/05 23:24:24 1.46
--- support.c   2000/02/26 18:43:54
***
*** 576,582 
  #if defined(INTERPRETER)
meth = (Method*)func;
if (meth->accflags & ACC_NATIVE) {
! if (METHOD_NATIVECODE(meth) == 0) {
errorInfo info;
if (native(meth, &info) == false) {
throwError(&info);
--- 585,591 
  #if defined(INTERPRETER)
meth = (Method*)func;
if (meth->accflags & ACC_NATIVE) {
! if (!METHOD_TRANSLATED (meth)) {
errorInfo info;
if (native(meth, &info) == false) {
throwError(&info);