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
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 ant - a unix shell script to launch ant
39 bin/ - all binary stuff generated by ant builds
41 build.xml - ANT build file
42 Makefile - build file for gcc 3.3
44 lib/ - any third-party binary stuff needed during the build process
45 javago - a copy of the javago post-compilation bytecode inliner
46 ant.jar - the Jakarta project's ANT build tool, including Sun's XML parser
47 netscape.jar - minimal set of classes required for compiling against Netcape's Applet interfaces
48 msjvm.jar - minimal set of classes required for compiling against Microsoft's Applet interfaces
49 javasrc.jar - javasrc, a tool for generating hyperlinked, syntax-colored html from java code
51 src/ - all java source files and xwt sources go here
53 bouncycastle/ - the BouncyCastle Crypto Library
54 mozilla/ - a copy of Rhino, the Mozilla JavaScript interpreter
55 xwt/builtin/ - .xwt's and .png's that are essential to bootstrapping the engine
56 xwt/plat/ - platform-specific code
58 ______________________________________________________________________________
61 *** XWT now requires JDK 1.4 or later to build ***
63 To build, make sure your $JAVA_HOME points to jdk1.4 or later, and type
65 ./ant -Dplat=<platform> <targetname>
67 The name of any class in org.xwt.plat is a valid <platform>; here is a
68 list as of 20-Mar-2002:
70 Win32 - Windows 95 / NT4 or later
71 Java12 - Any Java 1.2+ compliant JVM
75 build - builds a binary for the selected platform
77 The following targets do not require that you specify a platform:
79 compile - compiles all .java's to .class'es
80 clean - empties bin/ and compiled binaries in dist/
83 ______________________________________________________________________________
86 - WARNING: Jikes 1.16 has a bug which will cause it to generate
87 corrupt .class files; you must downgrade to 1.15 in order to compile
90 - If you only want to build the JVM version of XWT, delete these three
93 xwt/src/org/xwt/plat/Win32.java
94 xwt/src/org/xwt/plat/POSIX.java
95 xwt/src/org/xwt/plat/GCJ.java
97 This will allow XWT to build correctly *without* gcc 3.1. Otherwise,
98 you must compile and install gcc 3.1.
100 - The Win32 native version of XWT can ONLY be built with the very
101 latest pre-release of GCC 3.3. Run "make gcc-lin" to build a gcc
102 3.3 that targets Linux; run "make gcc-win" to build a gcc 3.3 that
107 ______________________________________________________________________________
110 Index: java/net/natInetAddress.cc
111 ===================================================================
112 RCS file: /cvs/gcc/gcc/libjava/java/net/natInetAddress.cc,v
113 retrieving revision 1.18.18.1
114 diff -u -r1.18.18.1 natInetAddress.cc
115 --- java/net/natInetAddress.cc 4 Mar 2002 20:02:19 -0000 1.18.18.1
116 +++ java/net/natInetAddress.cc 27 May 2002 22:54:40 -0000
121 +#include <platform.h>
125 Index: include/win32.h
126 ===================================================================
127 RCS file: /cvs/gcc/gcc/libjava/include/win32.h,v
128 retrieving revision 1.3.8.5
129 diff -u -r1.3.8.5 win32.h
130 --- include/win32.h 24 Apr 2002 01:04:45 -0000 1.3.8.5
131 +++ include/win32.h 27 May 2002 22:54:40 -0000
133 ARRAY and return the exact number of values stored. */
134 extern int backtrace (void **__array, int __size);
136 +// configure cannot correctly detect inet_addr due to Win32's
137 +// oddball header naming scheme
138 +#define HAVE_INET_ADDR
140 #endif /* __JV_WIN32_H__ */
144 ______________________________________________________________________________
145 Throwable.printStackTrace() patch
148 ===================================================================
149 RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
150 retrieving revision 1.43
151 diff -u -r1.43 Class.h
152 --- Class.h 21 Dec 2001 19:47:50 -0000 1.43
153 +++ Class.h 24 Apr 2002 03:06:14 -0000
155 friend void _Jv_LayoutVTableMethods (jclass klass);
156 friend void _Jv_SetVTableEntries (jclass, _Jv_VTable *);
157 friend void _Jv_MakeVTable (jclass);
158 + friend JArray<java::lang::reflect::Method*>* _Jv_GetAllMethods();
160 // Return array class corresponding to element type KLASS, creating it if
162 Index: ClassLoader.java
163 ===================================================================
164 RCS file: /cvs/gcc/gcc/libjava/java/lang/ClassLoader.java,v
165 retrieving revision 1.16
166 diff -u -r1.16 ClassLoader.java
167 --- ClassLoader.java 7 Dec 2001 23:34:12 -0000 1.16
168 +++ ClassLoader.java 24 Apr 2002 03:06:14 -0000
170 // Default to returning null. Derived classes implement this.
174 + static native java.lang.reflect.Method[] getAllMethods();
175 + static native long[] getAllMethodAddrs();
178 Index: Throwable.java
179 ===================================================================
180 RCS file: /cvs/gcc/gcc/libjava/java/lang/Throwable.java,v
181 retrieving revision 1.10
182 diff -u -r1.10 Throwable.java
183 --- Throwable.java 24 Feb 2001 03:52:49 -0000 1.10
184 +++ Throwable.java 24 Apr 2002 03:06:14 -0000
185 @@ -123,21 +123,64 @@
186 printStackTrace (writer);
189 + private native static long longFromStackTraceBytes(byte[] stackTrace, int i);
191 public void printStackTrace (PrintWriter wr)
195 - CPlusPlusDemangler cPlusPlusFilter = new CPlusPlusDemangler (wr);
196 - PrintWriter writer = new PrintWriter (cPlusPlusFilter);
197 - printRawStackTrace (writer);
199 - if (cPlusPlusFilter.written == 0) // The demangler has failed...
200 - printRawStackTrace (wr);
203 + CPlusPlusDemangler cPlusPlusFilter = new CPlusPlusDemangler (wr);
204 + PrintWriter writer = new PrintWriter (cPlusPlusFilter);
205 + printRawStackTrace (writer);
207 + if (cPlusPlusFilter.written > 0) return;
209 + catch (Exception e1)
213 + wr.println(toString());
214 + if (stackTrace == null) {
218 - catch (Exception e1)
220 - printRawStackTrace (wr);
222 + long[] allAddrs = ClassLoader.getAllMethodAddrs();
223 + java.lang.reflect.Method[] meths = ClassLoader.getAllMethods();
225 + // FIXME: assumes little endian
226 + for(int i=0; i<stackTrace.length; i++) {
227 + long addr = longFromStackTraceBytes(stackTrace, i);
228 + if (addr == 0) break;
230 + int whichMethod = -1;
231 + for(int j=0; j<allAddrs.length; j++) {
232 + if (allAddrs[j] <= addr &&
233 + (whichMethod == -1 || allAddrs[whichMethod] < allAddrs[j])) {
238 + if (whichMethod == -1) {
239 + wr.println("[" + Long.toString(addr, 16) + "] " + "??");
243 + if (meths[whichMethod].getDeclaringClass().getName().equals("gnu.gcj.runtime.FirstThread") &&
244 + meths[whichMethod].getName().equals("call_main"))
247 + wr.println(" [" + Long.toString(addr, 16) + "] " +
248 + meths[whichMethod].getDeclaringClass().getName() + "." +
249 + meths[whichMethod].getName() + "() " +
250 + "+" + (addr - allAddrs[whichMethod])
253 + if (java.lang.Thread.class.isAssignableFrom(meths[whichMethod].getDeclaringClass()) &&
254 + meths[whichMethod].getName().equals("run"))
261 Index: natClassLoader.cc
262 ===================================================================
263 RCS file: /cvs/gcc/gcc/libjava/java/lang/natClassLoader.cc,v
264 retrieving revision 1.47.8.1
265 diff -u -r1.47.8.1 natClassLoader.cc
266 --- natClassLoader.cc 2 Apr 2002 22:19:55 -0000 1.47.8.1
267 +++ natClassLoader.cc 24 Apr 2002 03:06:14 -0000
269 #include <java/lang/StringBuffer.h>
270 #include <java/io/Serializable.h>
271 #include <java/lang/Cloneable.h>
272 +#include <java/lang/reflect/Method.h>
274 +#include<java/lang/reflect/Constructor.h>
275 +#include<gcj/method.h>
277 // FIXME: remove these.
278 #define CloneableClass java::lang::Cloneable::class$
280 static jclass loaded_classes[HASH_LEN];
282 // This is the root of a linked list of classes
284 +JArray<java::lang::reflect::Method*>*
285 +java::lang::ClassLoader::getAllMethods()
287 + return _Jv_GetAllMethods();
291 +java::lang::ClassLoader::getAllMethodAddrs()
293 + JArray<java::lang::reflect::Method*>* arr = _Jv_GetAllMethods();
294 + java::lang::reflect::Method** el = (java::lang::reflect::Method**)elements(arr);
295 + JArray<jlong>* ret = JvNewLongArray(arr->length);
296 + jlong* retel = (jlong*)elements(ret);
297 + for(int i=0; i<arr->length; i++)
298 + retel[i] = (jlong)((unsigned int)(_Jv_FromReflectedMethod (el[i])->ncode));
302 +JArray<java::lang::reflect::Method*>*
305 + int numMethods = 0;
307 + for(int i=0; i<HASH_LEN; i++)
308 + for(jclass c = loaded_classes[i]; c; c = c->next)
309 + numMethods += c->getDeclaredMethods()->length;
311 + JArray<java::lang::reflect::Method*>* ret =
312 + (JArray<java::lang::reflect::Method*>*)
313 + JvNewObjectArray(numMethods, &java::lang::reflect::Method::class$, NULL);
315 + java::lang::reflect::Method** el = (java::lang::reflect::Method**)elements(ret);
317 + for(int i=0; i<HASH_LEN; i++)
318 + for(jclass c = loaded_classes[i]; c; c = c->next) {
319 + JArray<java::lang::reflect::Method*>* methods = c->getDeclaredMethods();
320 + jint len = methods->length;
321 + java::lang::reflect::Method** meths = (java::lang::reflect::Method**)elements(methods);
322 + for(int j=0; j<len; j++) el[--numMethods] = meths[j];
330 Index: natThrowable.cc
331 ===================================================================
332 RCS file: /cvs/gcc/gcc/libjava/java/lang/natThrowable.cc,v
333 retrieving revision 1.11
334 diff -u -r1.11 natThrowable.cc
335 --- natThrowable.cc 7 Feb 2002 19:26:06 -0000 1.11
336 +++ natThrowable.cc 24 Apr 2002 03:06:14 -0000
341 +#include <platform.h>
343 #ifdef HAVE_EXECINFO_H
344 #include <execinfo.h>
346 #endif /* HAVE_BACKTRACE */
350 +// Returns the i^th call address in the stackTrace member, or 0 if i
351 +// is beyond the end of the trace. This has to be done in C++ because
352 +// the addresses in stackTrace are the same width as the platform's
353 +// pointers (which is unknown to Java code), and stackTrace is a
354 +// byte[] using the platform's endianness (which is unknown to Java
357 +java::lang::Throwable::longFromStackTraceBytes(jbyteArray stackArr, jint i)
359 + if (i * sizeof(void*) > stackArr->length) return 0;
360 + unsigned int* stack = (unsigned int*)elements(stackArr);
361 + return (jlong)stack[i];