File: README

package info (click to toggle)
tya 1.1v3-3
  • links: PTS
  • area: contrib
  • in suites: slink
  • size: 480 kB
  • ctags: 658
  • sloc: ansic: 5,209; java: 329; asm: 215; makefile: 75; sh: 17
file content (443 lines) | stat: -rw-r--r-- 12,610 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
----- The TYA 1.1v3 Readme written by Albrecht Kleine -----

0. CONTENTS
===========

1. WHAT IS TYA?
2. WHAT DO YOU NEED?
3. SOME RELEASE NOTES
4. COMPILATION
5. INSTALLATION
6. USAGE
7. A FIRST TRY
8. IF ANYTHING FAILS
9. EXAMPLES
10. HOW DOES IT WORK?
11. MORE ABOUT JIT-COMPILER
12. PROBLEMS AND BUGS
13. FILES
14. THANKS


1. WHAT IS TYA?
===============

TYA is a ``100% unofficial'' JIT-compiler original designed as 
an add-on to Randy Chapman's port of JDK 1.0.2 for Linux (x86).
I have added some changes in TYA code for working together 
with the newer 1.1.x ports by Steve Byrne and Sergey Nikitin.

I've written TYA:
 - without knowledge of Sun(tm)'s JDK source code 
   (*.c code etc. - except some shipped include/*.h files),
 - in my spare time,
 - from the beginning for running together with AWT-package graphics,
 - using only public information sources delivered by
   * Frank Yellin's JIT interface documentation concerning
     the java.lang.Compiler class under the headline 
     ``The Java Native Code API'',(archived on javasoft site),
   * some of Sun(tm)'s well known JDK-include/*.h files
     for native code interfacing
   * and two books dealing with the JVM by F.Yellin and 
     M.K.Dalheimer.

Since TYA 0.4 I have received more cool contributions
from other people, so now it's a team effort.

BUT DO NOT FORGET: USE  tya  AT YOUR OWN RISK!


2. WHAT DO YOU NEED?
====================

Important:
 -You need a 586-pc running Linux port of the JDK 1.1.6.
 -You have to read and understand file COPYRIGHT for legal stuff.
 -Read this file carefully.


3. SOME RELEASE NOTES
=====================

Current TYA releases should run most applets and programs 
out there including swing, beans, browsers, servers etc.

For details (WHAT's NEW) look into Changelog file. 



4. COMPILATION
==============

The original TYA distribution doesn't contain TYA in a binary form.
If you want to use this software, you have to compile it 
first.
If you compile the source code (or if you use precompiled
code) YOU AGREE with the contents of file COPYRIGHT (...else 
delete the complete TYA from your computer).


BTW: Never do exchange versions compiled for a special JDK
with different versions, this won't work (except 1.1.5 
and 1.1.6 sbb releases).



5. INSTALLATION
===============

A clear advantage of TYA is: There is no problem in giving TYA a try!

Please note, the configuration process has changed completely (since 
TYA 0.6). Many thanks to Artur!
After configuration ./configure , compilation ("make") simply copy the 
libtya.so file to the location where the JVM can find it ("make install")

So, for simple cases, there should be no need to modify Makefile at all.
But if you are interested to change the handling of the libdir,
configure allows to override install dir, by either
1) specifying it explicite
./configure --libdir=/usr/mydir/lib
2) using jdk lib dir (TYA among other lib*.so files from the jdk port)
./configure --libdir=java

3) New in TYA 1.0 is the option --with-jdk: here you would specify
where main java directory lies.



6. USAGE
========

Run java(*) using option "-Djava.compiler=", like this example:

java    -Djava.compiler=tya       Iview          Valetta.jpg
#         ^ set property ^        ^your pgm      ^ pgm's options


But a better and easier way is setting the JAVA_COMPILER envionment via  

      export JAVA_COMPILER=tya

This way you don't have to change any scripts.
BTW: if you want to remove TYA from your system, delete the sources, the 
libfile, etc., and do not use the "-Djava.compiler=tya" property.



Because some users complained about debug messages, here is a note
about TYA debug message device [new in TYA 1.0]:

If you do not like to see any messages by TYA on stderr device please 
set the TYA_LOGFILE environment via

      export TYA_LOGFILE=tya_logfile_what_ever
      
With some exceptions TYA should be quiet unless you compile TYA with
enabled settings DEBUG or one of the VERBOSE modes. [tnx to Eric]

(BTW: the messages about exceptions caught by TYA are quite harmless.)
      



7. A FIRST TRY
==============

Execute ``Sy'', the output should look similar to the following:

	TYA 0.4 (for J1.0.2) loaded. Copyright (c) 1997,98 Albrecht Kleine
	This should be a (c) line ^^^   (else TYA is not loaded.)
	tya
	Linux
	
If there is an error that JVM cannot find the TYA shared lib,  at least
the JVM-1.0.2 would NOT give any error hint !!!  So the copyright 
message is an important indicator for proper loading the TYA lib. 
Never remove this line.
Line 3 shows us the property is set right.
Line 4 detects the right OS ;-)



8. IF ANYTHING FAILS
=====================


If you have trouble using the automatic confguration,
you should take a look into config.h and Makefile.
Look for proper setting the state of Jxxx flags.

If anything other goes wrong, check Makefile, config.h 
and tyaconfig.h for proper settings. There are some #defines 
in the source code file tyaconfig.h:

#define VERBOSE
  -enable for some time & size informations, but won't
   help in case of core dumps
#define VERBOSE_ASM86
  -some information about produced assembler code
#define DEBUG
  -lots of information about invocation etc.

The predefined settings are designed for speed, not for
maximized crash security. So if you have trouble, 
disable all experimental stuff in tyaconfig.h, and TYA
should run, but perhaps slow.
Go into a cycle of disabeling and recompiling 
in an order as follows:

// #define FAST_NATIVE102STYLE	        (at first)
// #define EXCEPTIONS_BY_SIGNALS
// #define USEASM
// #define TRY_FAST_INVOKE
// #define USE_REG_OPT
// #define INLINING			(at last)

Each time you disable a #define the TYA will run slower,
but you have more chances to get TYA running in an
JDK port unknown for me. 

If you want to maintain code for different data structure
I recommend switching off #define USEASM.



9. EXAMPLES
===========

The shipped Sieve benchmark on my computer 
(P200/32M/Linux 2.0.x):

JVM 1.0.2            19
JVM 1.0.2 +TYA 0.1  126
JVM 1.0.2 +TYA 0.2  153
JVM 1.0.2 +TYA 0.3  222
JVM 1.0.2 +TYA 0.3  229

JVM 1.1.1            77
JVM 1.1.5 (sbb)      80
JVM 1.1.5 (sn)       17
JVM 1.1.1 +TYA 0.2  150
JVM 1.1.3 +TYA 0.3  215
JVM 1.1.3 +TYA 0.4  220
JVM 1.1.5 +TYA 0.5  245
JVM 1.1.5 +TYA 0.6  249
JVM 1.1.6 +TYA 1.1  259

(kaffe 0.83         218)


The second project is a more practical one: it is an
example from image processing using AWT (but not running 
using kaffe**)

The color separation of the jpeg-image from Valetta 
into red/green/blue layers takes:

-circa 4700 milliseconds for JVM 1.0.2

-circa 2400 milliseconds for JVM 1.0.2 together with TYA 0.1,
-circa 1600 milliseconds for JVM 1.0.2 together with TYA 0.2,
-circa 1100 milliseconds for JVM 1.1.x together with TYA 0.3,
-circa  950 milliseconds for JVM 1.1.x together with TYA 0.4,
-circa  880 milliseconds for JVM 1.1.x together with TYA 0.5,
-circa  800 milliseconds for JVM 1.1.x together with TYA 0.7,
-circa  770 milliseconds for JVM 1.1.x together with TYA 1.1


The Valetta snapshot has circa 150000 pixels, so there 
are 750000 method invocations to do!

Please consider: this milliseconds are not really comparable,
because I've changed the also the jdk (1.1.1 up to 1.1.6),
Linux-kernel and libc.
Also some jdk needs different memory, so sometimes I've 
added switches like ``-ms2M'' to avoid gc.




10. HOW DOES IT WORK?
=====================

My JIT consists in four parts:

- at first we _translate_ the java byte code into x86-code,
  always a complete method at once.
  For this purpose I've written a set of producers of _preassembled_ ! 
  machine code blocks (one for each opcode), using a big outer switch 
  glued together during JIT-compilation.
  
- the second part is the interface to the JVM: here we decide
  if a method get this translation or not. (BTW, nearly all methods
  can be translated except native methods - and this is 
  how it will handle the graphics-peers: these are compiled native 
  methods, we won't hook their invokers.)
  You see: this JIT is NOT intended to run without the JVM.

- the third part is the method invocation process: we are calling
  the methods, handling exceptions to the caller level and preparing
  the interface to the GC.

- last but not least we are hooking into JVM's hooks: this is the way
  to add the TYA JIT compiler into the virtual machine.


11. MORE ABOUT JIT-COMPILER
===========================

The most important source of information is Frank Yellin's
``JAVA native code API'' documentation concerning the 
java.lang.Compiler class.
   ^^^^^^^^^^^^^
(Look for file jit_interface.html, somewhere archived on 
javasoft site.)


12. PROBLEMS and BUGS
=====================

If you want to help developing TYA, grep for some FIXMEs.

Problems are:
-  there are error situations handled by TYA via 
   termination by calling abort()
-  there could be some BIG security holes
-  too high recursion level could cause 
   stack overflow errors [unlike pure JVM]
-  the JNI is not complete checked

Some quick_opcodes are NOT yet implemented, but
it seems they are not used.

Remember: use this software AT YOUR OWN RISK.

Please do NOT send useless bug reports like this to me:
!  Full thread dump:
!    "Finalizer thread" (TID:0x404c23b0, sys_thread_t:0x412cbf2c) prio=1
!    "Async Garbage Collector" (TID:0x404c2368, sys_thread_t:0x412a9f2c) prio=1
!    "Idle thread" (TID:0x404c2320, sys_thread_t:0x41287f2c) prio=0
!    "clock handler" (TID:0x404c21f8, sys_thread_t:0x41265f2c) prio=11
!    "main" (TID:0x404c20a0, sys_thread_t:0x817bd00) prio=5 *current thread*
!	n1.main(Compiled Code)
!  Monitor Cache Dump:
!  Registered Monitor Dump:
!    Finalize me queue lock:     unowned
!    Thread queue lock:     unowned
!............etc........................

In most cases they are pretty useless for me. But in some situations 
mailing of a SMALL java file together with a description could help.

You are invited to help TYA making better and bugfree.
We will log your patches etc. in file CHANGELOG. Thank you.


13. FILES
=========

Never mix this files together with other projects.

D O C U M E N T A T I O N
-------------------------
COPYING.GPL			<- license
COPYRIGHT			<- important copyright info
README       			<- you read
FAQ				<- new in 1.0

S O U R C E C O D E
-----------------
ChangeLog			<- release & contributions history

Makefile.in			
acconfig.h
config.h.in
configure
configure.in			<- the new configuration tool files

tya.c
tyaruntime.c
tyaexc.c
tyautil.c
tyarechelp.c
tyarecode.c			<- the C source files

tyaasm.S			<- asm stuff

tya.h				<- source, include file
tyaconfig.h			<- source, include file for cfg.



T E S T I N G   S T U F F (in demo directory)
-------------------------
Makefile			<- for rebuilding

Sy				<- example 1 (to verify the compiler-property)
SystemProperties.class		<- bytecode
SystemProperties.java		<- source code

Sieve				<- example 2	the prime sieve
Sieve.class			   (one of kaffe's benchmarks)
Sieve.java			<- source code

Iview				<- example 3
Iview.java			<- source
Iview.class			<- bytecode
IviewCanvas.class		<- bytecode
IviewColorFilter.class		<- bytecode
Valetta.jpg			<- ``The Maltese balconies''

Test*				<- both...
javacspeed			<- ... for internal tests



14. THANKS
==========

I want to say THANK YOU 
for promotion / testing / bug reports / hints / 
contribution / grammar_help
to:

Marcel Ammerlaan <marcel@ch.twi.tudelft.nl>
Artur Biesiadowski <abies@pg.gda.pl>
Steven Bird-Downum <bird@runner.utsa.edu>
Joe Carter <joseph.carter@man.brite.co.uk>
Jon Cox <jcox@experiments.com>
Patrick D'Cruze <pdcruze@fusion.iinet.net.au>
Olaf Flebbe <O.Flebbe@science-computing.de>
Didier Gautheron <dgautheron@magic.fr>
Jason Gilbert <jason@scott.net>
David Lucas <ddlucas@lse.com>
Louis-David Mitterrand <mito@aparima.com>
Eugen N.Vasilchenko <eugen@inter-soft.com.ru>
phillips <phillips@online-computers.dyn.ml.org>
Georg Prossinagg <Georg.Prossinagg@humanomed.co.at>
Neal Sanche <neal@nsdev.org>
Matthias Sattler <m_sattle@informatik.uni-kl.de>
Rene Schmit <rene@bss.lu>
Ean Schuessler <ean@novare.net>
Artur Skawina <skawina@usa.net>
.......and all others......

More special thanks for writing java demo programs 
that revealed special TYA bugs you will find mentioned 
in Changelog file.




That's all folks.
Bye,
Albrecht
mailto:kleine@ak.sax.de

----
* Java and all Java-based names are registered trademarks of Sun Microsystems, Inc.

** =Tim Wilkinson's kaffe version 0.83 . (Didn't try later versions.)

*** =David Engberg's excellent guavac compiler (v1.0 and earlier)