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
31 ______________________________________________________________________________
35 AUTHORS - people involved in developing XWT
37 COPYING - copyright information for all files in this distro
38 TM - trademark information for XWT
39 Makefile - build file for gcc 3.3
40 next.build - the build id of the next build to be generated
41 bin/ - all binary stuff generated by xwt builds
42 gcc/ - build area for a custom copy of gcc3.3 and binutils2.13
43 Makefile - will download, configure, compile, and private-install gcc3.3/binutils2.13
44 lib/ - any third-party binary stuff needed during the build process
45 javago - a copy of the javago post-compilation bytecode inliner
46 netscape.jar - minimal set of classes required for compiling against Netcape's Applet interfaces
47 msjvm.jar - minimal set of classes required for compiling against Microsoft's Applet interfaces
48 jump.jar - the jump2 bytecode-to-palmos translator
49 libgcj-minimal.jar - a tiny portion of libgcj.jar; allows java->bytecode compilation without gcj
50 src/ - all java source files and xwt sources go here
52 bouncycastle/ - the BouncyCastle Crypto Library
53 mozilla/ - a copy of Rhino, the Mozilla JavaScript interpreter
54 xwt/builtin/ - .xwt's and .png's that are essential to bootstrapping the engine
55 xwt/plat/ - platform-specific code
57 ______________________________________________________________________________
58 Build Targets and Requirements
62 - jikes (warning: Jikes 1.16 has a fatal bug; use 1.15)
67 If you already have a suitably configured gcj 3.3 and binutils 2.13+
68 you can set "gcc_path" to point at its installation location;
69 otherwise the Makefile will download, configure, compile, and install
74 compile - compiles all .java files into bin/*.class
75 Win32 - Win95 or later (bin-Win32/xwt.exe)
76 Linux - Linux 2.2 or later (bin-Linux/xwt.linux)
77 Java2 - Any Java 1.2+ compliant JVM
81 ______________________________________________________________________________
84 Index: java/net/natInetAddress.cc
85 ===================================================================
86 RCS file: /cvs/gcc/gcc/libjava/java/net/natInetAddress.cc,v
87 retrieving revision 1.18.18.1
88 diff -u -r1.18.18.1 natInetAddress.cc
89 --- java/net/natInetAddress.cc 4 Mar 2002 20:02:19 -0000 1.18.18.1
90 +++ java/net/natInetAddress.cc 27 May 2002 22:54:40 -0000
95 +#include <platform.h>
99 Index: include/win32.h
100 ===================================================================
101 RCS file: /cvs/gcc/gcc/libjava/include/win32.h,v
102 retrieving revision 1.3.8.5
103 diff -u -r1.3.8.5 win32.h
104 --- include/win32.h 24 Apr 2002 01:04:45 -0000 1.3.8.5
105 +++ include/win32.h 27 May 2002 22:54:40 -0000
107 ARRAY and return the exact number of values stored. */
108 extern int backtrace (void **__array, int __size);
110 +// configure cannot correctly detect inet_addr due to Win32's
111 +// oddball header naming scheme
112 +#define HAVE_INET_ADDR
114 #endif /* __JV_WIN32_H__ */
118 ______________________________________________________________________________
119 Throwable.printStackTrace() patch
122 ===================================================================
123 RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
124 retrieving revision 1.43
125 diff -u -r1.43 Class.h
126 --- Class.h 21 Dec 2001 19:47:50 -0000 1.43
127 +++ Class.h 24 Apr 2002 03:06:14 -0000
129 friend void _Jv_LayoutVTableMethods (jclass klass);
130 friend void _Jv_SetVTableEntries (jclass, _Jv_VTable *);
131 friend void _Jv_MakeVTable (jclass);
132 + friend JArray<java::lang::reflect::Method*>* _Jv_GetAllMethods();
134 // Return array class corresponding to element type KLASS, creating it if
136 Index: ClassLoader.java
137 ===================================================================
138 RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
139 retrieving revision 1.16
140 diff -u -r1.16 ClassLoader.java
141 --- ClassLoader.java 7 Dec 2001 23:34:12 -0000 1.16
142 +++ ClassLoader.java 24 Apr 2002 03:06:14 -0000
144 // Default to returning null. Derived classes implement this.
148 + static native java.lang.reflect.Method[] getAllMethods();
149 + static native long[] getAllMethodAddrs();
152 Index: Throwable.java
153 ===================================================================
154 RCS file: /cvs/gcc/gcc/libjava/java/lang/Throwable.java,v
155 retrieving revision 1.10
156 diff -u -r1.10 Throwable.java
157 --- Throwable.java 24 Feb 2001 03:52:49 -0000 1.10
158 +++ Throwable.java 24 Apr 2002 03:06:14 -0000
159 @@ -123,21 +123,64 @@
160 printStackTrace (writer);
163 + private native static long longFromStackTraceBytes(byte[] stackTrace, int i);
165 public void printStackTrace (PrintWriter wr)
169 - CPlusPlusDemangler cPlusPlusFilter = new CPlusPlusDemangler (wr);
170 - PrintWriter writer = new PrintWriter (cPlusPlusFilter);
171 - printRawStackTrace (writer);
173 - if (cPlusPlusFilter.written == 0) // The demangler has failed...
174 - printRawStackTrace (wr);
177 + CPlusPlusDemangler cPlusPlusFilter = new CPlusPlusDemangler (wr);
178 + PrintWriter writer = new PrintWriter (cPlusPlusFilter);
179 + printRawStackTrace (writer);
181 + if (cPlusPlusFilter.written > 0) return;
183 + catch (Exception e1)
187 + wr.println(toString());
188 + if (stackTrace == null) {
192 - catch (Exception e1)
194 - printRawStackTrace (wr);
196 + long[] allAddrs = ClassLoader.getAllMethodAddrs();
197 + java.lang.reflect.Method[] meths = ClassLoader.getAllMethods();
199 + // FIXME: assumes little endian
200 + for(int i=0; i<stackTrace.length; i++) {
201 + long addr = longFromStackTraceBytes(stackTrace, i);
202 + if (addr == 0) break;
204 + int whichMethod = -1;
205 + for(int j=0; j<allAddrs.length; j++) {
206 + if (allAddrs[j] <= addr &&
207 + (whichMethod == -1 || allAddrs[whichMethod] < allAddrs[j])) {
212 + if (whichMethod == -1) {
213 + wr.println("[" + Long.toString(addr, 16) + "] " + "??");
217 + if (meths[whichMethod].getDeclaringClass().getName().equals("gnu.gcj.runtime.FirstThread") &&
218 + meths[whichMethod].getName().equals("call_main"))
221 + wr.println(" [" + Long.toString(addr, 16) + "] " +
222 + meths[whichMethod].getDeclaringClass().getName() + "." +
223 + meths[whichMethod].getName() + "() " +
224 + "+" + (addr - allAddrs[whichMethod])
227 + if (java.lang.Thread.class.isAssignableFrom(meths[whichMethod].getDeclaringClass()) &&
228 + meths[whichMethod].getName().equals("run"))
235 Index: natClassLoader.cc
236 ===================================================================
237 RCS file: /cvs/gcc/gcc/libjava/java/lang/natClassLoader.cc,v
238 retrieving revision 1.47.8.1
239 diff -u -r1.47.8.1 natClassLoader.cc
240 --- natClassLoader.cc 2 Apr 2002 22:19:55 -0000 1.47.8.1
241 +++ natClassLoader.cc 24 Apr 2002 03:06:14 -0000
243 #include <java/lang/StringBuffer.h>
244 #include <java/io/Serializable.h>
245 #include <java/lang/Cloneable.h>
246 +#include <java/lang/reflect/Method.h>
248 +#include<java/lang/reflect/Constructor.h>
249 +#include<gcj/method.h>
251 // FIXME: remove these.
252 #define CloneableClass java::lang::Cloneable::class$
254 static jclass loaded_classes[HASH_LEN];
256 // This is the root of a linked list of classes
258 +JArray<java::lang::reflect::Method*>*
259 +java::lang::ClassLoader::getAllMethods()
261 + return _Jv_GetAllMethods();
265 +java::lang::ClassLoader::getAllMethodAddrs()
267 + JArray<java::lang::reflect::Method*>* arr = _Jv_GetAllMethods();
268 + java::lang::reflect::Method** el = (java::lang::reflect::Method**)elements(arr);
269 + JArray<jlong>* ret = JvNewLongArray(arr->length);
270 + jlong* retel = (jlong*)elements(ret);
271 + for(int i=0; i<arr->length; i++)
272 + retel[i] = (jlong)((unsigned int)(_Jv_FromReflectedMethod (el[i])->ncode));
276 +JArray<java::lang::reflect::Method*>*
279 + int numMethods = 0;
281 + for(int i=0; i<HASH_LEN; i++)
282 + for(jclass c = loaded_classes[i]; c; c = c->next)
283 + numMethods += c->getDeclaredMethods()->length;
285 + JArray<java::lang::reflect::Method*>* ret =
286 + (JArray<java::lang::reflect::Method*>*)
287 + JvNewObjectArray(numMethods, &java::lang::reflect::Method::class$, NULL);
289 + java::lang::reflect::Method** el = (java::lang::reflect::Method**)elements(ret);
291 + for(int i=0; i<HASH_LEN; i++)
292 + for(jclass c = loaded_classes[i]; c; c = c->next) {
293 + JArray<java::lang::reflect::Method*>* methods = c->getDeclaredMethods();
294 + jint len = methods->length;
295 + java::lang::reflect::Method** meths = (java::lang::reflect::Method**)elements(methods);
296 + for(int j=0; j<len; j++) el[--numMethods] = meths[j];
304 Index: natThrowable.cc
305 ===================================================================
306 RCS file: /cvs/gcc/gcc/libjava/java/lang/natThrowable.cc,v
307 retrieving revision 1.11
308 diff -u -r1.11 natThrowable.cc
309 --- natThrowable.cc 7 Feb 2002 19:26:06 -0000 1.11
310 +++ natThrowable.cc 24 Apr 2002 03:06:14 -0000
315 +#include <platform.h>
317 #ifdef HAVE_EXECINFO_H
318 #include <execinfo.h>
320 #endif /* HAVE_BACKTRACE */
324 +// Returns the i^th call address in the stackTrace member, or 0 if i
325 +// is beyond the end of the trace. This has to be done in C++ because
326 +// the addresses in stackTrace are the same width as the platform's
327 +// pointers (which is unknown to Java code), and stackTrace is a
328 +// byte[] using the platform's endianness (which is unknown to Java
331 +java::lang::Throwable::longFromStackTraceBytes(jbyteArray stackArr, jint i)
333 + if (i * sizeof(void*) > stackArr->length) return 0;
334 + unsigned int* stack = (unsigned int*)elements(stackArr);
335 + return (jlong)stack[i];