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