(arch_create_jit_trampoline): cache trampoline code
[mono.git] / mono / jit / ChangeLog
1 2002-02-19  Dietmar Maurer  <dietmar@ximian.com>
2
3         * emit-x86.c (arch_compile_method): add shared code to mono_root_domain
4         (arch_create_jit_trampoline): cache trampoline code
5
6 2002-02-18  Dietmar Maurer  <dietmar@ximian.com>
7
8         * jit.c (mono_analyze_stack): optimize LDSFLD/STSFLD for domain
9         specific code.
10         (mono_analyze_stack): use MB_TERM_LDELEMA to perform bound check
11
12         * x86.brg: do not encode exception objects into the instruction
13         stream, because they are domain dependend. Use
14         arch_get_throw_exception_by_name() instead;
15
16 Mon Feb 18 15:51:40 CET 2002 Paolo Molaro <lupus@ximian.com>
17
18         * jit.c: intern command line arguments.
19
20 2002-02-18  Dietmar Maurer  <dietmar@ximian.com>
21
22         * jit.c (mono_analyze_stack): use the magic trampoline for all
23         calls (since we cant store the address of compiled code in
24         method->addr).
25         (mono_analyze_stack): imp. LDSTR for shared code
26
27         * emit-x86.c (x86_magic_trampoline): handle x86_call_code().
28         (arch_compile_method): add a cache for compiled methods to avoid
29         recompilation. dont use method->addr to store domain dependent
30         code address.
31
32 2002-02-15  Dietmar Maurer  <dietmar@ximian.com>
33
34         * x86.brg: impl. BLE,BGT for freg
35
36 Sat Feb 16 16:27:42 CET 2002 Paolo Molaro <lupus@ximian.com>
37
38         * emit-x86.c: handle unreachable code. Eliminate some unneeded
39         malloc() calls.
40         * jit.c: handle unreachable code. Move setting of mono_end_of_stack to
41         main(). Add --compile classname and --ncompile num command line
42         options to do performance evaluation of the jitter (and help
43         debugging).
44
45 2002-02-15  Dietmar Maurer  <dietmar@ximian.com>
46
47         * emit-x86.c (arch_compile_method): bug fix in static delegate
48         Invoke code.
49
50 2002-02-14  Dietmar Maurer  <dietmar@ximian.com>
51
52         * jit.c (mono_analyze_stack): do a LDIND after NEWOBJ for value types.
53
54 2002-02-13  Dietmar Maurer  <dietmar@ximian.com>
55
56         * jit.c (mono_analyze_stack): impl. CEE_SIZEOF
57
58 2002-02-13  Miguel de Icaza  <miguel@ximian.com>
59
60         * jit.c (arch_allocate_var): Only assert that the alignment is
61         at least 32-bits aligned, not always 32-bits aligned (for I8 for example).
62
63 Mon Feb 11 11:20:57 CET 2002 Paolo Molaro <lupus@ximian.com>
64
65         * x86.brg: fix invalid cast check in unbox. Pack MBTree structure.
66
67 Sun Feb 10 12:54:05 CET 2002 Paolo Molaro <lupus@ximian.com>
68
69         * emit-x86.c: make x86_magic_trampoline() handle call instructions
70         with an imm8 displacement. x86.brg not yet changed to take advantage
71         of it.
72
73 Sun Feb 10 11:47:30 CET 2002 Paolo Molaro <lupus@ximian.com>
74
75         * jit.c: use opcode info from libmetadata to do flow analysis
76         and simplify code.
77
78 2002-02-06  Dietmar Maurer  <dietmar@ximian.com>
79
80         * jit.c (MAKE_LDELEM, MAKE_STELEM): added bound checking 
81
82 2002-02-05  Dietmar Maurer  <dietmar@ximian.com>
83
84         * x86.brg: use element_class for type check
85
86 2002-02-04  Dietmar Maurer  <dietmar@ximian.com>
87
88         * jit.c (main): impl. __array_Address icall
89
90         * mempool.c (mono_mempool_alloc): handle large block allocation
91
92 2002-02-01  Dietmar Maurer  <dietmar@ximian.com>
93
94         * x86.brg: impl. SHL/SHR/CLT for 64 bit values
95
96 2002-01-31  Dietmar Maurer  <dietmar@ximian.com>
97
98         * x86.brg: impl. CEQ(lreg,lreg)
99
100         * jit.c (mono_analyze_stack): impl. LDVIRTFTN
101         (mono_analyze_stack): handle MONO_TABLE_MEMBERREF in LDSFLD/STSFLD
102
103         * x86.brg: removed some dead code.
104
105 2002-01-18  Dietmar Maurer  <dietmar@ximian.com>
106
107         * jit.c (arch_allocate_var): fixed alignment bugs
108
109 2002-01-17  Dietmar Maurer  <dietmar@ximian.com>
110
111         * jit.c (mono_analyze_stack): use LDIND_REF/STIND_REF
112
113 2002-01-16  Dietmar Maurer  <dietmar@ximian.com>
114
115         * jit.c (main): install the trampoline before we start to create
116         objects.
117
118         * x86.brg: impl. CLT_UN, CGT_UN
119
120         * emit-x86.c (leave_method): added check for null object
121         (enter_method): consider byref arguments
122
123 2002-01-14  Dietmar Maurer  <dietmar@ximian.com>
124
125         * x86.brg: bug fix in CONV_OVF_I1_UN
126         impl. ADD_OVF, MUL_OVF
127         impl. ADD_OVF_UN, SUB_OVF, SUB_OVF_UN
128         (SUB (lreg, lreg)): bug fix - use SBB instead of SUB
129         (EMIT_COND_EXCEPTION): added signed flag
130
131 Fri Jan 11 20:06:22 CET 2002 Paolo Molaro <lupus@ximian.com>
132
133         * jit.c: implement stloc, ldloc, ldloca.
134
135 2002-01-11  Dietmar Maurer  <dietmar@ximian.com>
136
137         * jit.c (mono_analyze_stack): fixed calculation of last_instr
138
139         * x86.brg (LDLEN): emit null_reference exception
140         (BLE_UN): bug fix. 
141         (RET, RET_VOID, RET_OBJ, ...) fixed jump to epilog
142
143 2002-01-04  Dietmar Maurer  <dietmar@ximian.com>
144
145         * x86.brg: bug fix in CASTCLASS
146
147 2001-12-21  Dietmar Maurer  <dietmar@ximian.com>
148
149         * jit.c (mono_analyze_stack): spill MUL to avoid problem with
150         register allocation.
151
152         * emit-x86.c (arch_compile_method): fixed static delegate bug
153
154 2001-12-16  Miguel de Icaza  <miguel@ximian.com>
155
156         * x86.brg, jit.c: Split up the nodes that we used to share on
157         CONV_OVF.  They were sharing the nodes because they are the same
158         on 32-bit machines, but on 64-bit machines you need different
159         code for them.
160
161 2001-12-17  Dietmar Maurer  <dietmar@ximian.com>
162
163         * x86.brg: removed prerequisite that (tree->left->reg1 <
164         tree->right->reg1) to make register allocation easier.
165
166 2001-12-16  Dietmar Maurer  <dietmar@ximian.com>
167
168         * emit-x86.c (arch_handle_exception): new code to handle
169         exceptions inside unmanaged code.
170
171         * x86.brg: impl. SAVE_LMF, RESTORE_LMF, pass implizit valuetype
172         address as first argument.
173
174 2001-12-15  Dietmar Maurer  <dietmar@ximian.com>
175
176         * x86.brg: pass exceptions on the stack
177
178         * jit.h (ISSTRUCT): new macro to check for real value types
179         (return false for enum types). 
180
181 2001-12-11  Dietmar Maurer  <dietmar@ximian.com>
182
183         * x86.brg: use position indepentent code if possible. 
184
185         * x86.brg (EMIT_COND_EXCEPTION): new macro.
186
187         * emit-x86.c (mono_emit_cfg): impl. variable code buffer size
188
189 2001-12-10  Dietmar Maurer  <dietmar@ximian.com>
190
191         * jit.c (mono_analyze_flow): use g_malloc0 o allocate large bcinfo
192         blocks.
193         (mono_analyze_flow): use g_malloc0 o allocate large bblocks array.
194
195         * x86.brg (stmt): added opt. for STIND_R4/STIND_R8
196
197 2001-12-07  Dietmar Maurer  <dietmar@ximian.com>
198
199         * jit.c (mono_allocate_intvar): bug fix.
200
201         * emit-x86.c (get_unbox_trampoline): impl.
202
203         * jit.c (mono_analyze_stack): impl STOBJ, LEAVE
204
205 2001-12-06  Dietmar Maurer  <dietmar@ximian.com>
206
207         * x86.brg: raise exceptions.
208
209 2001-12-05  Dietmar Maurer  <dietmar@ximian.com>
210
211         * x86.brg: impl. CEQ for freg, NEWSTRUCT now allocates valuetypes on
212         the stack. 
213
214 2001-12-06  Miguel de Icaza  <miguel@ximian.com>
215
216         * jit.c (mono_analyze_stack), x86.brg: Implement CONV.OVF.I1,
217         CONV.OVF.I4, CONV.OVF.I1.UN, CONV.OVF.U1, CONV.OVF.U1.UN,
218         CONV.OVF.I2.UN, CONV.OVF.I8.UN
219
220 2001-12-04  Dietmar Maurer  <dietmar@ximian.com>
221
222         * x86.brg: impl. UNBOX, NEWSTRUCT, removed VTYPE, bug fixes,
223         removed the locaddr nonterminal, reimplemented value types
224         
225         * jit.c: reimplemented value type support, better support for
226         enumeration types. 
227
228 2001-12-03  Miguel de Icaza  <miguel@ximian.com>
229
230         * x86.brg, jit.c: Implement conv.ovf.u4, conv.ovf.u2, conv.ovf.i2,
231         conv.ovf.u8 
232
233 Mon Dec 3 17:16:36 CET 2001 Paolo Molaro <lupus@ximian.com>
234
235         * jit.c: call mono_init() after registering internal calls.
236
237 2001-11-30  Dietmar Maurer  <dietmar@ximian.com>
238
239         * emit-x86.c (tree_preallocate_regs): improved register allocation
240
241         * x86.brg: impl. ISINST, CASTCLASS
242
243 Fri Nov 30 12:02:24 CET 2001 Paolo Molaro <lupus@ximian.com>
244
245         * x86.brg: rearrange fields to reduce struct size.
246         * jit.c: use signature->param_count, not signature->params_size.
247         * debug.c: off-by-one error fix.
248
249 2001-11-29  Radek Doulik  <rodo@ximian.com>
250
251         * Makefile.am: build mono only for X86 architecture, compilation
252         fails for ppc now because of accessing registers in sigcontext
253         structure
254
255 2001-11-29  Dietmar Maurer  <dietmar@ximian.com>
256
257         * jit.c (mono_analyze_stack): bug fix in DUP
258
259 Thu Nov 29 12:32:01 CET 2001 Paolo Molaro <lupus@ximian.com>
260
261         * debug.c: fix type handling. Position function position at start of
262         IL code. Output more fine-grained stepping information.
263
264 2001-11-28  Dietmar Maurer  <dietmar@ximian.com>
265
266         * x86.brg (LDIND_I1, LDIND_I2): use x86_widen_ instead of x86_mov_
267
268         * jit.c (mono_analyze_stack): record the cli_address for later use
269         with gdb.
270         (sigsegv_signal_handler): translate sigsegv into "Internal error"
271         exception.
272
273 Tue Nov 27 16:32:41 CET 2001 Paolo Molaro <lupus@ximian.com>
274
275         * debug.c, debug.h: added support for generating stabs.
276         Stabs can be compiled with as and the resulting object file can be
277         loaded in a gdb session with add-symbol-file object.o.
278         * jit.c, jit.h: add --stabs and --debug command line arguments. Keep track
279         where locals and arguments are stored in the stack. Add support for
280         passing command line arguments to CLR programs.
281         * emit-x86.c: insert a breakpoint at method invocation if needed.
282
283 2001-11-27  Dietmar Maurer  <dietmar@ximian.com>
284
285         * jit.c: exception support
286
287         * emit-x86.c (arch_emit_epilogue): bug fix: restore the regs in
288         the right order.
289
290 2001-11-26  Dick Porter  <dick@ximian.com>
291
292         * Makefile.am (mono_LDADD): Add io-layer library
293
294 2001-11-19  Dietmar Maurer  <dietmar@ximian.com>
295
296         * jit.c (mono_analyze_stack): impl. LDFTN
297         (MAKE_SPILLED_BI_ALU): always spill DIV/REM results to memory to
298         make register allocation easier on x86
299
300         * emit-x86.c (enter_method): more debugging output for Strings
301         (arch_compile_method): added delegate support
302         (arch_compile_method): align EBP to 8 byte boundary
303
304 Mon Nov 19 11:36:22 CET 2001 Paolo Molaro <lupus@ximian.com>
305
306         * jit.c: use mono_install_trampoline (), instead of exporting
307         a function to a lower-level library.
308
309 2001-11-16  Dietmar Maurer  <dietmar@ximian.com>
310
311         * x86.brg (STRING_ARG): impl. a way to marshal strings. This
312         will be extensible to handle all possible kinds of marshalling
313         requirements. 
314
315         * jit.c (map_call_type): added MB_TERM_CALL_VOID
316         (mono_analyze_stack): impl. LDELEMA, reimplemented CALL
317         instructions to handle this arguments more effectively.
318
319 2001-11-15  Dietmar Maurer  <dietmar@ximian.com>
320
321         * Makefile.am (mono_SOURCES): renamed testjit to mono
322
323         * x86.brg: added debugging support 
324
325         * testjit.c: added support for value types, CFG improvements
326
327         * emit-x86.c (enter_method): handle value types
328         (tree_allocate_regs): impl. a better way to handle chain rules
329
330 2001-11-10  Dietmar Maurer  <dietmar@ximian.com>
331
332         * x86.brg (INITOBJ): bug fix: initialize data before use,
333         simplified the code.
334
335 2001-11-09  Miguel de Icaza  <miguel@ximian.com>
336
337         * testjit.c (mono_analyze_stack): Remove compiler warning by
338         testing against NULL.
339
340 2001-11-09  Dick Porter  <dick@ximian.com>
341
342         * Makefile.am (testjit_LDADD): Don't need THREAD_LIBS any more
343
344 2001-11-09  Dietmar Maurer  <dietmar@ximian.com>
345
346         * testjit.c (mono_analyze_stack): new BOX impl.
347
348         * x86.brg: implemented INITOBJ
349
350         * testjit.c (mono_analyze_stack): finished array support
351         (mono_analyze_stack): reimplemented DUP instruction
352
353 2001-11-08  Dietmar Maurer  <dietmar@ximian.com>
354
355         * testjit.c (MAKE_STELEM, MAKE_LDELEM): we build a tree which
356         represents the address of the element. This way we can emit highly
357         optimized x86 instructions to access elements (using base+index+offset
358         adressing mode)
359
360 2001-11-07  Miguel de Icaza  <miguel@ximian.com>
361
362         * mempool.c: Include string.h to kill warning.
363
364         * testjit.c: Add typecast to kill warning.
365
366         * x86.brg: Include string.h to eliminate warning.
367
368         * emit-x86.c (tree_allocate_regs): Fix arguments to g_warning to
369         kill warning.
370
371 2001-11-07  Dietmar Maurer  <dietmar@ximian.com>
372
373         * emit-x86.c (enter_method): print out all method arguments
374         (x86_magic_trampoline): impl.
375         (arch_create_simple_jit_trampoline): we use different trampolines
376         for static methods (no need to write the address back into to
377         vtable).
378
379 2001-11-06  Dietmar Maurer  <dietmar@ximian.com>
380
381         * emit-x86.c (arch_create_jit_trampoline): optimised trampoline to
382         use less the 16 bytes.
383
384         * x86.brg: code cleanup
385
386 2001-11-05  Dietmar Maurer  <dietmar@ximian.com>
387
388         * testjit.c: bug fixes.
389
390         * emit-x86.c (leave_method): print result values
391
392 2001-11-03  Dietmar Maurer  <dietmar@ximian.com>
393
394         * emit-x86.c (enter_method): new debugging code
395         (leave_method): new debbuging code, this functions are called
396         when you use the new option --trace-calls
397
398 2001-11-02  Dietmar Maurer  <dietmar@ximian.com>
399
400         * testjit.c: impl. STELEM_XX, STELEM_XX
401
402         * x86.brg: impl. LDLEN, LDELEMA
403         
404
405 2001-10-15  Dietmar Maurer  <dietmar@ximian.com>
406
407         * x86.brg: added some experimental code for CALL
408         instructions - still not found the optimal way to do it.
409
410         * testjit.c (map_stind_type): add support for value types with
411         a size of 1, 2 or 4 bytes, implemented CEE_UNBOX, CEE_LDOBJ,
412         CEE_LDSTR, CEE_LDFLD, CEE_LDFLDA, CEE_STFLD, CEE_NEWOBJ, CEE_CEQ
413         (ctree_create_newobj): impl.
414         
415
416         * emit-x86.c (tree_allocate_regs): removed allocation code for
417         addr nonterminal.
418         (get_address): use a simple, but bug free search instead of the
419         buggy binary search.
420
421 2001-10-12  Dietmar Maurer  <dietmar@ximian.com>
422
423         * testjit.c: support virtual functions
424
425         * x86.brg: support different addressing modes for calls
426
427 2001-10-11  Dietmar Maurer  <dietmar@ximian.com>
428
429         * testjit.c: impl. STFLD
430
431 2001-10-10  Dietmar Maurer  <dietmar@ximian.com>
432
433         * x86.brg: impl. CEQ
434
435 2001-10-04  Dick Porter  <dick@ximian.com>
436
437         * testjit.c:
438         * emit-x86.c: include mono-endian.h not endian.h
439
440 2001-10-02  Dietmar Maurer  <dietmar@ximian.com>
441
442         * testjit.c (ctree_create_dup): really duplicate the tree.
443         attach the arguments to the CALL node. Added a new macro to
444         make argument order configurable (ARCH_ARGS_RIGHT_TO_LEFT).
445
446 2001-10-01  Dietmar Maurer  <dietmar@ximian.com>
447
448         * interp.brg: the burm based interpreter: added the file as example.
449
450 2001-09-27  Dietmar Maurer  <dietmar@ximian.com>
451
452         * x86.brg: cleanup
453
454         * testjit.c: impl. LDIND/STIND/LDLOCA, use g_malloc to alloc static
455         data.
456         (map_stind_type): support enum types
457         (map_ldind_type): support enum types
458
459         * emit-x86.c (tree_allocate_regs): added code to support
460         register allocation for addressing modes trees.
461         (tree_emit): bug fix: we have to emit all mono_burg_functins. The
462         previous impl. did not work for chain rules.
463         (compute_branches): support for SWITCH statements
464
465         * x86.brg: added rules to model x86 addressing modes
466
467 2001-09-26  Dietmar Maurer  <dietmar@ximian.com>
468
469         * emit-x86.c (compute_branches): implemented SWITCH
470
471         * testjit.c (mono_create_forest): implemented LDIND/STIND opcodes
472         (map_ldind_type): add enumeration types.
473         (map_stind_type): add enumeration types.
474
475         * emit-x86.c (arch_compile_method): more documentation.
476
477         * testjit.c: moved the architecture specific things to emit-x86.c
478         and x86.brg. Added more documentation. code cleanup.
479
480 2001-09-25  Dietmar Maurer  <dietmar@ximian.com>
481
482         * x86.brg: we now have different types of addresses: ADDR_L for local
483         values, ADDR_A for arguments and ADDR_G for global addresses. We
484         also use LDIND_XX token to load values from a specific address
485         instead of LDLOC/STLOC. 
486
487         * testjit.c: use the new adressing scheme everywhere:
488         LDIND _XX (ADDR_X), and STIND_XX (ADDR_X, tree)  
489
490 2001-09-24  Dietmar Maurer  <dietmar@ximian.com>
491
492         * testjit.c (main): fix bug in parameter parsing
493
494         * x86.brg: impl. more opcodes
495
496 2001-09-23  Dick Porter  <dick@ximian.com>
497
498         * Makefile.am (testjit_LDADD): rename PTHREAD_LIBS to THREAD_LIBS
499
500 2001-09-23  Dietmar Maurer  <dietmar@ximian.com>
501
502         * testjit.c: use the memory pool to avoid memory leaks
503
504 2001-09-22  Dietmar Maurer  <dietmar@ximian.com>
505
506         * x86.brg: increment the stack pointer after function calls
507
508 2001-09-21  Dick Porter  <dick@ximian.com>
509
510         * Makefile.am (testjit_LDADD): Added PTHREAD_LIBS to the link line
511
512 2001-09-21  Dietmar Maurer  <dietmar@ximian.com>
513
514         * x86.brg: implemented long MUL/DIV
515         (MB_OPT_LEVEL): define optimisation level macro
516
517         * testjit.c (tree_allocate_regs): added a way to prevent EDX usage
518         for operations like idiv. it is also possible to assign specific registers.
519
520 2001-09-20  Dietmar Maurer  <dietmar@ximian.com>
521
522         * x86.brg: added basic support for long
523
524         * testjit.c (mono_compile_method): implemented POP
525
526 2001-09-19  Miguel de Icaza  <miguel@ximian.com>
527
528         * testjit.c (usage): Added a couple of more usage options.
529
530 2001-09-19  Dietmar Maurer  <dietmar@ximian.com>
531
532         * x86.brg: added more floating point grammar 
533
534         * testjit.c (mono_compile_method): make local offsets negative
535
536         * x86.brg: added some floating point trees
537
538         * testjit.c (mono_compile_method): arguments on the runtime 
539         stack are at least 4 bytes
540
541         * x86.brg: partly implemented 8,16 bit integers
542
543         * testjit.c (get_address): mark basic blocks
544
545 2001-09-18  Dietmar Maurer  <dietmar@ximian.com>
546
547         * x86.brg: added some rules to optimize code
548
549         * testjit.c (get_address): use a binary search to get the address
550         (main): added an option to debug the jit (-d)
551
552 Tue Sep 18 13:19:16 CEST 2001 Paolo Molaro <lupus@ximian.com>
553
554         * testjit.c: better/faster align code. Handle ldloc.s and stloc.s.
555
556 2001-09-17  Miguel de Icaza  <miguel@ximian.com>
557
558         * testjit.c (mono_compile_method): Provide better error reporting.
559
560 2001-09-17  Dietmar Maurer  <dietmar@ximian.com>
561
562         * testjit.c (tree_get_address): impl. to fix address bug
563         (tree_get_address): make sure that we can only jump to the first
564         instruction of a tree.
565
566         * x86.brg: emit real code for calls
567
568         * testjit.c (create_jit_trampoline): creates a function to trigger jit
569         compilation.
570         (mono_compile_method): reversed argument order
571
572 2001-09-15  Dietmar Maurer  <dietmar@ximian.com>
573
574         * x86.brg (stmt): don't emit unnecessary register moves
575
576         * testjit.c (tree_allocate_regs): free registers earlier
577
578 2001-09-14  Dietmar Maurer  <dietmar@ximian.com>
579
580         * x86.brg: branch addresses are now resolved
581
582         * testjit.c (compute_branches): compute address of branches
583
584         * x86.brg: emit real x86 instructions
585
586         * testjit.c: call objdump to disassemble the output
587
588 2001-09-13  Dietmar Maurer  <dietmar@ximian.com>
589
590         * x86.brg: use the right offsets to access local variables
591         and arguments.
592
593         * emit-x86.c: only save/restore callee saved registers if they are
594         really modified.
595
596         * testjit.c (tree_allocate_regs): use the new MonoRegSet to
597         allocate registers.
598         (mono_compile_method): changed the tree for mothod calls
599
600         * regset.h: impl.
601         
602         * regset.c: impl.
603         
604
605 2001-09-10  Miguel de Icaza  <miguel@ximian.com>
606
607         * x86.brg: Use Unix assembly syntax.
608
609         * emit-x86.c: support code, should be moved
610
611         * testjit.c: Use GPtrArrays instead of GLists, as those are very
612         inefficient at appends.
613
614         * Renamed `create_new_leave' to `create_new_leaf'
615
616         
617