1 ==============================================================================
5 ______________________________________________________________________________
8 If you're new to XWT, you should read the documentation in the order
13 Start here. Includes a map of all other documentation and a
14 description of the directory strucure
16 - The XWT home page [http://www.xwt.org/]
18 - The XWT tutorial [http://www.xwt.org/tutorial.html]
20 Gentle introduction to what XWT is, and how to write
21 .xwt's. Good for anybody who wants to write XWT applications.
23 - The XWT reference [http://www.xwt.org/reference.html]
25 Precise, technical spec of exactly how XWT works. Assumes
26 familiarity with XWT (ie, you've read the tutorial). This is the
27 authoritative source for how an XWT engine should
30 ______________________________________________________________________________
34 AUTHORS - people involved in developing XWT
36 COPYING - copyright information for all files in this distro
37 TM - trademark information for XWT
38 Makefile - build file for gcc 3.3
39 next.build - the build id of the next build to be generated
40 bin/ - all binary stuff generated by xwt builds
41 gcc/ - build area for a custom copy of gcc3.3 and binutils2.13
42 Makefile - will download, configure, compile, and private-install gcc3.3/binutils2.13
43 lib/ - any third-party binary stuff needed during the build process
44 javago - a copy of the javago post-compilation bytecode inliner
45 netscape.jar - minimal set of classes required for compiling against Netcape's Applet interfaces
46 msjvm.jar - minimal set of classes required for compiling against Microsoft's Applet interfaces
47 jump.jar - the jump2 bytecode-to-palmos translator
48 libgcj-minimal.jar - a tiny portion of libgcj.jar; allows java->bytecode compilation without gcj
49 src/ - all java source files and xwt sources go here
51 bouncycastle/ - the BouncyCastle Crypto Library
52 mozilla/ - a copy of Rhino, the Mozilla JavaScript interpreter
53 xwt/builtin/ - .xwt's and .png's that are essential to bootstrapping the engine
54 xwt/plat/ - platform-specific code
56 ______________________________________________________________________________
57 Build Targets and Requirements
61 - jikes (warning: Jikes 1.16 has a fatal bug; use 1.15)
66 If you already have a suitably configured gcj 3.3 and binutils 2.13+
67 you can set "gcc_path" to point at its installation location;
68 otherwise the Makefile will download, configure, compile, and install
73 compile - compiles all .java files into bin/*.class
74 Win32 - Win95 or later (bin-Win32/xwt.exe)
75 Linux - Linux 2.2 or later (bin-Linux/xwt.linux)
76 Java2 - Any Java 1.2+ compliant JVM
80 ______________________________________________________________________________
83 Index: java/net/natInetAddress.cc
84 ===================================================================
85 RCS file: /cvs/gcc/gcc/libjava/java/net/natInetAddress.cc,v
86 retrieving revision 1.18.18.1
87 diff -u -r1.18.18.1 natInetAddress.cc
88 --- java/net/natInetAddress.cc 4 Mar 2002 20:02:19 -0000 1.18.18.1
89 +++ java/net/natInetAddress.cc 27 May 2002 22:54:40 -0000
94 +#include <platform.h>
98 Index: include/win32.h
99 ===================================================================
100 RCS file: /cvs/gcc/gcc/libjava/include/win32.h,v
101 retrieving revision 1.3.8.5
102 diff -u -r1.3.8.5 win32.h
103 --- include/win32.h 24 Apr 2002 01:04:45 -0000 1.3.8.5
104 +++ include/win32.h 27 May 2002 22:54:40 -0000
106 ARRAY and return the exact number of values stored. */
107 extern int backtrace (void **__array, int __size);
109 +// configure cannot correctly detect inet_addr due to Win32's
110 +// oddball header naming scheme
111 +#define HAVE_INET_ADDR
113 #endif /* __JV_WIN32_H__ */
117 ______________________________________________________________________________
118 Throwable.printStackTrace() patch
121 ===================================================================
122 RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
123 retrieving revision 1.43
124 diff -u -r1.43 Class.h
125 --- Class.h 21 Dec 2001 19:47:50 -0000 1.43
126 +++ Class.h 24 Apr 2002 03:06:14 -0000
128 friend void _Jv_LayoutVTableMethods (jclass klass);
129 friend void _Jv_SetVTableEntries (jclass, _Jv_VTable *);
130 friend void _Jv_MakeVTable (jclass);
131 + friend JArray<java::lang::reflect::Method*>* _Jv_GetAllMethods();
133 // Return array class corresponding to element type KLASS, creating it if
135 Index: ClassLoader.java
136 ===================================================================
137 RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
138 retrieving revision 1.16
139 diff -u -r1.16 ClassLoader.java
140 --- ClassLoader.java 7 Dec 2001 23:34:12 -0000 1.16
141 +++ ClassLoader.java 24 Apr 2002 03:06:14 -0000
143 // Default to returning null. Derived classes implement this.
147 + static native java.lang.reflect.Method[] getAllMethods();
148 + static native long[] getAllMethodAddrs();
151 Index: Throwable.java
152 ===================================================================
153 RCS file: /cvs/gcc/gcc/libjava/java/lang/Throwable.java,v
154 retrieving revision 1.10
155 diff -u -r1.10 Throwable.java
156 --- Throwable.java 24 Feb 2001 03:52:49 -0000 1.10
157 +++ Throwable.java 24 Apr 2002 03:06:14 -0000
158 @@ -123,21 +123,64 @@
159 printStackTrace (writer);
162 + private native static long longFromStackTraceBytes(byte[] stackTrace, int i);
164 public void printStackTrace (PrintWriter wr)
168 - CPlusPlusDemangler cPlusPlusFilter = new CPlusPlusDemangler (wr);
169 - PrintWriter writer = new PrintWriter (cPlusPlusFilter);
170 - printRawStackTrace (writer);
172 - if (cPlusPlusFilter.written == 0) // The demangler has failed...
173 - printRawStackTrace (wr);
176 + CPlusPlusDemangler cPlusPlusFilter = new CPlusPlusDemangler (wr);
177 + PrintWriter writer = new PrintWriter (cPlusPlusFilter);
178 + printRawStackTrace (writer);
180 + if (cPlusPlusFilter.written > 0) return;
182 + catch (Exception e1)
186 + wr.println(toString());
187 + if (stackTrace == null) {
191 - catch (Exception e1)
193 - printRawStackTrace (wr);
195 + long[] allAddrs = ClassLoader.getAllMethodAddrs();
196 + java.lang.reflect.Method[] meths = ClassLoader.getAllMethods();
198 + // FIXME: assumes little endian
199 + for(int i=0; i<stackTrace.length; i++) {
200 + long addr = longFromStackTraceBytes(stackTrace, i);
201 + if (addr == 0) break;
203 + int whichMethod = -1;
204 + for(int j=0; j<allAddrs.length; j++) {
205 + if (allAddrs[j] <= addr &&
206 + (whichMethod == -1 || allAddrs[whichMethod] < allAddrs[j])) {
211 + if (whichMethod == -1) {
212 + wr.println("[" + Long.toString(addr, 16) + "] " + "??");
216 + if (meths[whichMethod].getDeclaringClass().getName().equals("gnu.gcj.runtime.FirstThread") &&
217 + meths[whichMethod].getName().equals("call_main"))
220 + wr.println(" [" + Long.toString(addr, 16) + "] " +
221 + meths[whichMethod].getDeclaringClass().getName() + "." +
222 + meths[whichMethod].getName() + "() " +
223 + "+" + (addr - allAddrs[whichMethod])
226 + if (java.lang.Thread.class.isAssignableFrom(meths[whichMethod].getDeclaringClass()) &&
227 + meths[whichMethod].getName().equals("run"))
234 Index: natClassLoader.cc
235 ===================================================================
236 RCS file: /cvs/gcc/gcc/libjava/java/lang/natClassLoader.cc,v
237 retrieving revision 1.47.8.1
238 diff -u -r1.47.8.1 natClassLoader.cc
239 --- natClassLoader.cc 2 Apr 2002 22:19:55 -0000 1.47.8.1
240 +++ natClassLoader.cc 24 Apr 2002 03:06:14 -0000
242 #include <java/lang/StringBuffer.h>
243 #include <java/io/Serializable.h>
244 #include <java/lang/Cloneable.h>
245 +#include <java/lang/reflect/Method.h>
247 +#include<java/lang/reflect/Constructor.h>
248 +#include<gcj/method.h>
250 // FIXME: remove these.
251 #define CloneableClass java::lang::Cloneable::class$
253 static jclass loaded_classes[HASH_LEN];
255 // This is the root of a linked list of classes
257 +JArray<java::lang::reflect::Method*>*
258 +java::lang::ClassLoader::getAllMethods()
260 + return _Jv_GetAllMethods();
264 +java::lang::ClassLoader::getAllMethodAddrs()
266 + JArray<java::lang::reflect::Method*>* arr = _Jv_GetAllMethods();
267 + java::lang::reflect::Method** el = (java::lang::reflect::Method**)elements(arr);
268 + JArray<jlong>* ret = JvNewLongArray(arr->length);
269 + jlong* retel = (jlong*)elements(ret);
270 + for(int i=0; i<arr->length; i++)
271 + retel[i] = (jlong)((unsigned int)(_Jv_FromReflectedMethod (el[i])->ncode));
275 +JArray<java::lang::reflect::Method*>*
278 + int numMethods = 0;
280 + for(int i=0; i<HASH_LEN; i++)
281 + for(jclass c = loaded_classes[i]; c; c = c->next)
282 + numMethods += c->getDeclaredMethods()->length;
284 + JArray<java::lang::reflect::Method*>* ret =
285 + (JArray<java::lang::reflect::Method*>*)
286 + JvNewObjectArray(numMethods, &java::lang::reflect::Method::class$, NULL);
288 + java::lang::reflect::Method** el = (java::lang::reflect::Method**)elements(ret);
290 + for(int i=0; i<HASH_LEN; i++)
291 + for(jclass c = loaded_classes[i]; c; c = c->next) {
292 + JArray<java::lang::reflect::Method*>* methods = c->getDeclaredMethods();
293 + jint len = methods->length;
294 + java::lang::reflect::Method** meths = (java::lang::reflect::Method**)elements(methods);
295 + for(int j=0; j<len; j++) el[--numMethods] = meths[j];
303 Index: natThrowable.cc
304 ===================================================================
305 RCS file: /cvs/gcc/gcc/libjava/java/lang/natThrowable.cc,v
306 retrieving revision 1.11
307 diff -u -r1.11 natThrowable.cc
308 --- natThrowable.cc 7 Feb 2002 19:26:06 -0000 1.11
309 +++ natThrowable.cc 24 Apr 2002 03:06:14 -0000
314 +#include <platform.h>
316 #ifdef HAVE_EXECINFO_H
317 #include <execinfo.h>
319 #endif /* HAVE_BACKTRACE */
323 +// Returns the i^th call address in the stackTrace member, or 0 if i
324 +// is beyond the end of the trace. This has to be done in C++ because
325 +// the addresses in stackTrace are the same width as the platform's
326 +// pointers (which is unknown to Java code), and stackTrace is a
327 +// byte[] using the platform's endianness (which is unknown to Java
330 +java::lang::Throwable::longFromStackTraceBytes(jbyteArray stackArr, jint i)
332 + if (i * sizeof(void*) > stackArr->length) return 0;
333 + unsigned int* stack = (unsigned int*)elements(stackArr);
334 + return (jlong)stack[i];