1 2022-09-08 Paulo Andrade <pcpa@gnu.org>
3 * lib/jit_fallback.c: Implement fallback compare and swap with
5 * check/Makefile.am: Update for new cas{r,i} simple test.
6 * check/catomic.c, check/catomic.ok: New test case for
7 simple compare and swap atomic operation.
8 * check/lightning.c: Add entries to be able to use
9 the new compare and swap atomic operation. Still missing
10 a general test, only the basic C version.
11 * include/lightning.h.in: Include pthread.h, even if not
12 needing a fallback compare and swap.
13 * include/lightning/jit_private.h: Add support for a register pair
14 in second argument. Required by the new casr and casi operations.
15 * lib/jit_aarch64-cpu.c, lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
16 lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c, lib/jit_x86-cpu.c,
17 lib/jit_x86-sz.c, lib/jit_x86.c: Implement inline code for compare
19 * lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c: Implement
20 inline code for compare and swap if cpu is armv7, otherwise, use
21 a fallback with pthreads.
22 * lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c,
23 lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
24 lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
25 lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c,
26 lib/jit_riscv-cpu.c, lib/jit_riscv-sz.c, lib/jit_riscv.c,
27 lib/jit_s390-cpu.c, lib/jit_s390-sz.c, lib/jit_s390.c,
28 lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c: Implement
29 fallback compare and swap with pthreads. At least some of these
30 should be updated for inline code generation.
31 * lib/jit_names.c, lib/jit_print.c: lib/lightning.c: Update for the
32 new compare and swap operation.
33 * doc/body.texi: Add simple documentation of the compare and swap
36 2022-08-12 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
39 * doc/body.texi: Add documentation for jit_align.
41 2022-05-14 Paulo Andrade <pcpa@gnu.org>
43 * include/lightning.h.in: Reorder jit_mov{n,z}r in instruction list.
44 * lib/jit_alpha.c, lib/jit_alpha-cpu.c, lib/jit_hppa.c,
45 lib/jit_hppa-cpu.c, lib/jit_ia64.c, lib/jit_ia64-cpu.c,
46 lib/jit_riscv.c, lib/jit_riscv-cpu.c, lib/jit_s390.c,
47 lib/jit_s390-cpu.c, lib/jit_sparc.c, lib/jit_sparc-cpu.c:
48 Implement fallback jit_mov{n,z}r. These are a somewhat cheap
49 implementation, but should be reviewed for the arches that already
50 have a proper conditional move.
51 * lib/jit_arm-sz.c, lib/jit_mips-sz.c: Add missing maximum size
52 estimative and reorder.
53 * lib/jit_aarch64-sz.c, lib/jit_x86-sz.c, lib/jit_ppc-sz.c:
54 Reorder entry to match definition order.
55 * lib/jit_aarch64-sz.c, lib/jit_alpha-sz.c, lib/jit_hppa-sz.c,
56 lib/jit_ia64-sz.c, lib/jit_riscv-sz.c, lib/jit_s390-sz.c,
57 lib/jit_sparc-sz.c: Add heuristic value, basically the sum of
58 the cost of a movr + beqr.
59 * lib/jit_names.c: Add entries for debug output of mov{n,z}r.
60 * lib/lightning.c: Use proper bitmask in jit_classify.
62 2021-04-03 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
64 * check/Makefile.am: Add test for the live instruction.
65 * check/live.ok: New file.
66 * check/live.tst: New file.
67 * doc/body.texi: Add documentation for the live instruction and
68 for jit_get_reg/jit_get_unreg. Fix menu entries.
69 * include/lightning.h.in (jit_get_reg, jit_unget_reg): Expose the
70 macros in the public header file.
71 * include/lightning/jit_private.h (jit_get_reg, jit_unget_reg):
72 Remove the macros from the private header file.
74 2021-04-03 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
76 * Makefile.am, check/Makefile.am, doc/Makefile.am,
77 lib/Makefile.am: Include $(top_builddir)/include in include paths
78 for the autoconf-generated header file lightning.h.
80 2021-04-03 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
82 * doc/.gitignore: Add version.texi to list of ignored files.
83 * doc/version.texi: Remove file from version control.
85 2020-18-04 Paulo Andrade <pcpa@gnu.org>
87 * lib/jit_x86-cpu.c, lib/jit_x86.c: Implement %rip relative
88 calls and jumps on x86_64. Currently very conservative, assuming
89 a jit block can be larger than 2G, so, if a jump or call is in
90 the same jit generation, but target is unknown, use an indirect
91 branch (could have an option to assume a jit code block is
92 never larger than 2G). Also a deoptimization is that now does
93 not always generate ip relative jmpi; previously implicitly
94 assumed jmpi would never be larger than 2G. Overall still an
97 2020-23-01 Paulo Andrade <pcpa@gnu.org>
99 * lib/lightning.c: Add a proper fix to the condition of considering
100 a register dead at entry of a block when it modifies the register
101 !after! a branch to a target where it is live.
102 The correction is just to split blocks on branches. It uses an
103 extra label per branch, but makes following the code simpler and
104 avoid costly searches.
106 2020-22-01 Paulo Andrade <pcpa@gnu.org>
108 * lib/lightning.c: Correct a special condition of a register
109 only assigned in a block, and incorrectly marked as dead before
110 a jump where the register is live.
112 2019-10-04 Paulo Andrade <pcpa@gnu.org>
114 * check/lightning.c, include/lightning/jit_private.h,
115 include/lightning/jit_x86.h, lib/jit_x86-cpu.c, lib/jit_x86-sz.c,
116 lib/jit_x86.c: Correct issues with MinGW64 that defines _WIN32
117 and needs long long for jit_word_t.
119 2019-09-16 Paulo Andrade <pcpa@gnu.org>
121 * lib/lightning.c: Do not add registers that are never modified
122 to the set of registers to scan for live range, what might
123 consume a lot of cpu time, doing nothing.
125 2019-09-16 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
127 * include/lightning/jit_x86.h, lib/jit_x86.c: Correct x86_64
128 backend, made %r12 a callee-save register as dictated by the
131 2019-09-16 Paulo Andrade <pcpa@gnu.org>
133 * Makefile.am: Do not force CFLAGS for the get_jit_size target.
134 * check/lightning.c: Drop __ppc__ check.
135 * include/lightning.h.in: Drop __ppc__ check. Add new
136 jit_flag_vararg flag, for special case in powerpc 32 bit using
137 the SYSV abi, and need to pass an extra argument during code
139 * include/lightning/jit_ppc.c: Drop __ppc_ check. Remove the
140 ABI_ELFv2 macro, as it now directly checks for the _CALL_ELF
141 value when/if appropriate.
142 * include/lightning/jit_private.h: Drop __ppc_ check. Check for
143 _CALL_AIXDESC to define extra data to handle function
145 * lib/jit_ppc-cpu.c: Update to check for _CALL_SYSV; assume
146 !_CALL_SYSV == (_CALL_AIX || _CALL_LINUX). Significant code
147 rework for the SYSV abi.
148 * lib/jit_ppc-sz.c: Update for the SYSV abi.
149 * lib/jit_ppc.c: Update for the SYSV abi. Add matching va_list
150 type. Drop __ppc__ check.
151 * lib/jit_size.c: Drop __ppc_ check.
152 * lib/lightning.c: Drop __ppc__ check. Add proper check for
153 __powerpc__ and _CALL_AIXDESC to manage function descriptors.
154 * lib/size.c: Update to drop __pppc_ check and SYSV abi.
156 2019-08-30 Paulo Andrade <pcpa@gnu.org>
158 * lib/jit_mips-cpu.c: Use JALR to get the same effect as JR, as
159 in mips32r6 JR generates an illegal instruction. Thanks to
160 Bruno Haible for providing a patch and the information, reported at
161 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=925129
164 2019-08-29 Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>
166 * include/lightning/jit_private.h: Move definition of offsetof
167 from the public header file here.
169 * configure.ac, include/Makefile.am, include/lightning.h,
170 include/lightning.h.in: Generate lightning.h from lightning.in.h
171 and remove the dependence on config.h from the public header file.
173 2019-06-04 Paulo Andrade <pcpa@gnu.org>
175 * include/lightning/jit_riscv.h, lib/jit_riscv-cpu.c,
176 lib/jit_riscv-fpu.c, lib/jit_riscv-sz.c, lib/jit_riscv.c:
177 Implement riscv port. Only 64 bit Linux supported. Built on
180 * check/all.tst, check/float.tst, configure.ac, include/lightning.h,
181 include/lightning/Makefile.am, include/lightning/jit_private.h,
182 lib/Makefile.am, lib/jit_disasm.c, lib/jit_size.c, lib/lightning.c:
183 Minor updates for the new riscv port.
185 2019-06-04 Paulo Andrade <pcpa@gnu.org>
187 * lib/jit_alpha.c lib/jit_ia64.c lib/jit_mips.c lib/jit_sparc.c:
188 Correct assertion of _jitc->regarg after emiting an instruction.
189 jit_carry may be set, but not an argument to the current instruction.
191 2019-06-01 Paulo Andrade <pcpa@gnu.org>
193 * lib/lightning.c: Correct assertion on jit_unget_reg when the
194 argument is jit_carry, and jit_carry was not used in the
197 2019-06-01 Paulo Andrade <pcpa@gnu.org>
199 * include/lightning/jit_private.h: Remove no longer need
200 setmask field of jit_block_t and blockmask from jit_compiler_t.
202 * lib/lightning.c: Rework of register live and unknown state
203 information during jit generation. It no longer recurses nor
204 do dangerous bit unset of registers in unknown state. The
205 only pitfall known, that must be taken care now is that jmpr
206 (or jmpi to not a jit node) is treated as a function call, as
207 otherwise it would need to consider all registers live, and
208 spill/reload during all jit generation.
210 2018-12-28 Paulo Andrade <pcpa@gnu.org>
212 * lib/jit_disasm.c: Release bfd handle. Thanks for patch to
213 Marc Nieper-Wißkirchen.
215 2018-08-30 Paulo Andrade <pcpa@gnu.org>
217 * lib/jit_disasm.c: Add hints to select hppa disassembler.
219 * lib/jit_hppa-cpu.c: Correct address of vastart when all
220 argument registers were used as non vararg arguments.
222 * lib/jit_hppa-fpu.c: Disable load/store of rv,ix,rb where
223 rv is the value, ix is an register or integer offset and rb
224 is a base register. These should be better tested, as they do
225 not work on all environments (fail on qemu-hppa).
227 2018-04-20 Paulo Andrade <pcpa@gnu.org>
229 * include/lightning/jit_private.h: Add new register classes to
230 flag float registers and double only registers, required for sparc64
231 where only low 32 bit fpr registers can be used for single precision
233 Add new 128 bit jit_regset_t type for sparc64 register set.
235 * include/lightning/jit_sparc.h, lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c,
236 lib/jit_sparc-sz.c, lib/jit_sparc.c: Update for 64 bits sparc.
238 * lib/lightning.c: Update for new jit_regset_t required for sparc64.
240 2018-02-26 Paulo Andrade <pcpa@gnu.org>
242 * check/lightning.c, include/lightning.h: Add the new jit_va_push
243 interface. That should be called when passing a va_list to a C
244 function. This is required because on Alpha a va_list is passed
245 by value, and lightning does not know about data types, so, cannot
246 understand it is pushing a va_list as argument.
248 * lib/jit_names.c, lib/lightning.c: Minor changes for the new
251 * check/cva_list.c: Update only test case using jit_va_push, to
252 pass a va_list to a C function.
254 doc/body.texi: Better documentation of the varargs interface.
256 * jit_alpha.c, jit_alpha-cpu.c: Update to properly push a
257 C va_list and correctly calculate varargs offset.
259 * lib/jit_aarch64-sz.c, lib/jit_aarch64.c, lib/jit_alpha-sz.c,
260 lib/jit_arm-sz.c, lib/jit_arm.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
261 lib/jit_ia64-sz.c, lib/jit_ia64.c, lib/jit_mips-sz.c, lib/jit_mips.c,
262 lib/jit_ppc-sz.c, lib/jit_ppc.c, lib/jit_s390-sz.c, lib/jit_s390.c,
263 lib/jit_sparc-sz.c, lib/jit_sparc.c, lib/jit_x86-sz.c, lib/jit_x86.c:
264 Update for the new jit_va_push interface.
266 2018-02-22 Paulo Andrade <pcpa@gnu.org>
268 * lib/jit_alpha-cpu.c: Always set t12 to the address of the
269 current function, to properly work on all systems. Previously
270 the shortcut did only work on Tru64. For Linux and glibc the
273 2018-02-22 Paulo Andrade <pcpa@gnu.org>
275 * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
276 lib/jit_mips.c, lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c:
277 Correct wrong logic in usage of jit_live in jit_retr. The
278 problem is that if a temporary is required during epilog,
279 the return register might be allocated, so, jit_live must always
282 2018-01-31 Paulo Andrade <pcpa@gnu.org>
284 * lib/lightning.c: Avoid deep recursions when computing live
287 2018-01-31 Paulo Andrade <pcpa@gnu.org>
289 * lib/jit_mips-cpu.c: Correct frame size and varargs
290 initialization for the n32 abi.
291 * lib/jit_mips.c, lib/jit_mips-fpu.c: Correct 32 bit abis
294 2017-09-13 Paulo Andrade <pcpa@gnu.org>
296 * configure.ac: Add check for binutils 2.29 prototype to the
297 disassembler function.
298 * lib/jit_disasm.c: Adapt for binutils 2.29 change.
300 2017-06-09 Paulo Andrade <pcpa@gnu.org>
302 * include/lightning/jit_private.h, lib/lightning.c: Add a
303 second pass from start when computing register live ranges.
304 This should be used temporarily, and is required for certain
305 loop constructs, with several consecutive blocks not referencing
308 2016-05-05 Paulo Andrade <pcpa@gnu.org>
310 * lib/lightning.c: Correct wrong movr simplification,
311 remove no longer needed code to set return registers live
312 and update live register set when reaching a label boundary,
313 but do not descend if the block has been already visited.
314 The later need some tuning for complex code generation, where
315 it will still have issues.
317 2015-11-30 Paulo Andrade <pcpa@gnu.org>
319 * doc/body.texi: Change documentation to no longer say
320 it is a variant of the Fibonacci sequence, and document
321 a proper implementation.
322 Thanks to Jon Arintok for pointing out that the Fibonacci
323 sequence generation was incorrect. It was documented, but
326 * check/fib.tst, check/fib.ok, check/bp.tst, check/bp.ok,
327 doc/ifib.c, doc/rbif.c: Implement a proper Fibonacci
328 sequence implementation.
330 2015-07-03 Paulo Andrade <pcpa@gnu.org>
332 * lib/jit_mips-cpu.c: Correct definition of htonr_ul.
333 Correct prolog/epilog/va* routines to work on o64 abi.
335 * lib/jit_mips-fpu.c: Correct load of double literal
336 argument when not using a data buffer.
337 Remove alignment correction in vaarg_d if using the
340 * lib/jit_mips.c: Correct code to allow creating variadic
341 jit functions when using the new mips abi.
343 * lib/jit_rewind.c: Minor adjust for rewind when using
344 the new mips abi, if there are varargs arguments in
347 2015-06-06 Paulo Andrade <pcpa@gnu.org>
349 * lib/jit_ia64-cpu.c: Search backward for the last output
350 register used, otherwise would stop too early if a float
351 argument used the slot.
352 Correct offset of first va_list argument, and use proper
355 * lib/jit_ia64-fpu.c: Add new functions to move a gpr
356 to a fpr register, to counterpart the ones that move a
357 fpr to a gpr. These are required to properly implement
358 jit_getarg*_{f,d} on complex prototypes, or variadic
361 * lib/jit_ia64-sz.c: Update for support to jit variadic
364 * lib/jit_ia64.c: Implement proper abi for variadic
367 2015-06-04 Paulo Andrade <pcpa@gnu.org>
369 * lib/jit_rewind.c: New file implementing generic functions
370 to "rewind", or rewrite IR code sequences.
372 * include/lightning.h: Add several new codes, that previously
373 were a function call, that would synthesize the operation.
374 Now, there is a code for the operation, and a new flag to
375 know an operation is synthesized.
377 * include/lightning/jit_private.h: Add several new macros to
378 help construct synthesized IR code sequences.
380 * lib/Makefile.am: Update for lib/jit_rewind.c.
382 * lib/jit_disasm.c: Update for a small rework on jit_node_t,
383 so that --enable-devel-disassembler does not need a change
384 in the layout of jit_node_t.
386 * lib/jit_names.c: Update for the new codes.
388 * lib/jit_print.c: Update to print more readable output, and
389 flag synthesized IR code sequences.
391 * lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
392 lib/jit_arm-sz.c, lib/jit_arm.c, lib/jit_x86-sz.c,
393 lib/jit_x86.c: Update for new synthesized IR code sequences.
395 * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu., lib/jit_ppc-sz.c,
396 lib/jit_ppc.c, lib/jit_mips-cpu.c, lib/jit_mips-fpu.c,
397 lib/jit_mips-sz.c, lib/jit_mips.c, lib/jit_s390-fpu.c,
398 lib/jit_s390-sz.c, lib/jit_s390.c: Update for new synthesized
399 IR code sequences and correct bugs in the initial varargs
400 implementation support.
402 * lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_hppa-sz.c,
403 lib/jit_hppa.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
404 lib/jit_sparc-sz.c, lib/jit_sparc.c: Add generic, untested
405 support for the new synthesized IR code sequences. Known
406 most likely broken right now, and should be corrected once
407 access to these hosts is available.
409 * lib/lightning.c: Update for new IR codes, and add support
410 for not yet existing instructions that change third argument.
412 * size.c: Change to use different tables for LE and BE PowerPC.
413 Correct a wrong endif for x32.
415 2015-05-25 Paulo Andrade <pcpa@gnu.org>
417 * check/cva_list.c: New file implementing a test to ensure
418 the value returned by jit_va_start is a valid C va_list.
420 * check/va_list.ok: New simple helper file, as now the
421 va_list.tst test is enabled.
423 * check/va_list.tst: Rewritten for an extensive variadic
426 * check/Makefile.am: Update for the new tests.
428 * lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm-vfp.c,
429 lib/jit_arm.c: Correct broken software float in a previous
430 commit. Note that the hard float abi implementation is known
431 broken at this time, for special cases involving variadic
432 functions, and should be corrected next.
434 lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c: Correct
435 the jit_va_list_t semantics to match C va_list.
437 2015-05-24 Paulo Andrade <pcpa@gnu.org>
439 * lib/Makefile.am: Bump library major. This is a preparation
440 for a rework that was due for quite some time, but that is
441 now required to properly implement variadic jit functions.
442 The rework is mainly required to know at prolog parsing, if
443 a function is variadic or not. This will benefit a few
444 backends, and is mandatory for the hard float arm abi.
445 The rework was already planned for quite some time, to
446 be able to use a variable stack framesize, and for leaf
447 functions optimization where applicable.
448 The change will be source compatible, but will change
449 some internals, and jit_code_t values, as some new will
451 The only behavior change is that, jit_arg_register_p may
452 change return value on hard float arm abi, if called before
453 or after jit_ellipsis. Common sense anyway, would say to
454 make that call after jit_ellipsis, but documentation
455 should be updated for it.
457 2015-05-24 Paulo Andrade <pcpa@gnu.org>
459 * lib/jit_aarch64-fpu.c, lib/jit_aarch64.c: Correct base
460 aarch64 varargs code.
462 2015-05-24 Paulo Andrade <pcpa@gnu.org>
464 * check/lightning.c: Clearly run check if clang is the system
467 2015-05-20 Paulo Andrade <pcpa@gnu.org>
469 * lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c, lib/jit_sparc.c:
470 Add base support to jit vararg functions to the sparc backend.
472 2015-05-20 Paulo Andrade <pcpa@gnu.org>
474 * lib/jit_alpha-cpu.c, lib/jit_alpha-fpu.c, lib/jit_alpha.c:
475 Add base support to jit vararg functions to the alpha backend.
477 2015-05-19 Paulo Andrade <pcpa@gnu.org>
479 * lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c, lib/jit_hppa.c:
480 Add base support to jit vararg functions to the hppa backend.
482 2015-05-10 Paulo Andrade <pcpa@gnu.org>
484 * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c, lib/jit_ia64.c:
485 Add base support to jit vararg functions to the ia64 backend.
487 2015-05-10 Paulo Andrade <pcpa@gnu.org>
489 * lib/jit_ia64-fpu.c, lib/jit_ia64.c: Correct movi_d_w
490 and movi_f_w implementation to work when not using a
491 data buffer. This causes the check varargs.tst to
492 work when passing "-d" to the lightning test tool.
494 2015-05-10 Paulo Andrade <pcpa@gnu.org>
496 * lib/jit_ia64.c: Implement inline assembly cache flush,
497 required on multiprocessor systems.
499 2015-05-06 Paulo Andrade <pcpa@gnu.org>
501 * lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c:
502 Add base support to jit vararg functions to the mips backend.
503 Currently only supported on the o32 abi, until access to a
504 n32 system is arranged.
506 2015-05-05 Paulo Andrade <pcpa@gnu.org>
508 * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c:
509 Add base support to jit vararg functions to the PowerPC backend.
511 2015-05-02 Paulo Andrade <pcpa@gnu.org>
513 * lib/jit_s390-cpu.c, lib/jit_s390-fpu.c, lib/jit_s390.c:
514 Add base support to jit vararg functions to the s390 backend.
516 2015-05-01 Paulo Andrade <pcpa@gnu.org>
518 * lib/jit_arm-cpu.c, lib/jit_arm-swf.c, lib/jit_arm-vfp.c,
519 lib/jit_arm.c: Add base support to jit vararg
520 functions to the arm backend.
522 2015-04-30 Paulo Andrade <pcpa@gnu.org>
524 * lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c,
525 lib/jit_aarch64.c: Add base support to jit vararg
526 functions to the aarch64 backend.
528 2015-04-27 Paulo Andrade <pcpa@gnu.org>
530 * include/lightning.h, include/lightning/jit_private.h,
531 lib/jit_names.c, lib/lightning.c: Add initial support
532 for the new jit_va_start, jit_va_arg, jit_va_arg_d, and
533 jit_va_end interfaces. The jit_va_start call is supposed
534 to return a va_list compatible pointer, but not yet
535 decided if it will be "declared" stdarg compatible,
536 as for now only x86 support has been added (and should
537 be compatible), but issues may arise on other backends.
539 * check/lightning.c: Add wrappers to call the new jit_va_*
542 * lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
545 * lib/jit_x86-sz.c: Add fields, but not yet fully updated,
546 as this is an intermediate commit.
548 * lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
549 lib/jit_alpha-sz.c, lib/jit_alpha.c,
550 lib/jit_arm-sz.c, lib/jit_arm.c,
551 lib/jit_hppa-sz.c, lib/jit_hppa.c,
552 lib/jit_ia64-sz.c, lib/jit_ia64.c,
553 lib/jit_mips-sz.c, lib/jit_mips.c,
554 lib/jit_ppc-sz.c, lib/jit_ppc.c,
555 lib/jit_s390-sz.c, lib/jit_s390.c,
556 lib/jit_sparc-sz.c, lib/jit_sparc.c: Prepare for the
557 new jit_va_* interfaces. Not yet implemented, and will
558 cause an assertion if used.
560 * check/va_list.tst: Simple early test case, that works
561 on x86_64, x32, ix86, cygwin, and cygwin64.
563 2015-02-17 Paulo Andrade <pcpa@gnu.org>
565 * include/lightning.h, include/lightning/jit_private.h,
566 lib/jit_aarch64-cpu.c, lib/jit_aarch64.c,
567 lib/jit_alpha-cpu.c, lib/jit_alpha.c,
568 lib/jit_arm-cpu.c, lib/jit_arm.c,
569 lib/jit_hppa-cpu.c, lib/jit_hppa.c,
570 lib/jit_ia64-cpu.c, lib/jit_ia64.c,
571 lib/jit_mips-cpu.c, lib/jit_mips.c,
572 lib/jit_ppc-cpu.c, lib/jit_ppc.c,
573 lib/jit_s390-cpu.c, lib/jit_s390.c,
574 lib/jit_sparc-cpu.c, lib/jit_sparc.c,
575 lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
576 jit_allocar(offs, size) interface, that receives
577 two integer registers arguments, allocates space
578 dynamically in the stack, returns the offset in
579 the first argument, and uses the second argument
580 for the size in bytes of the memory to be allocated.
582 * check/allocar.ok, check/allocar.tst: New files
583 implementing test cases for the new jit_allocar
586 * check/Makefile.am, check/lightning.c: Update for
587 the new test case and interface.
589 * doc/body.texi: Add documentation of the new
592 2015-02-17 Paulo Andrade <pcpa@gnu.org>
594 * include/lightning/jit_x86.h, lib/jit_x86-cpu.c,
595 lib/jit_x86-x87.c: No longer make st(7) available.
596 Need to keep one x87 slots empty to avoid exceptions.
597 This has the side effect of no longer needing the
598 hackish emms instruction before a function call.
600 2015-02-16 Paulo Andrade <pcpa@gnu.org>
602 * lib/lightning.c: Remove the jit_regno_patch bitfield
603 register fields before actual emit, as it is only really
604 used before emit, otherwise, on special conditions it
605 may consider live registers as dead during code emit.
607 2015-02-15 Paulo Andrade <pcpa@gnu.org>
609 * lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
610 Correct encoding of ldxr* stxr* in the x32 abi. If the
611 displacement register is negative, it would generate
612 a 64 bit instruction with a 32 bit unsigned displacement.
614 * check/ranger.tst, check/ranger.ok: New files, implementing
615 a test case for negative loads and stores. This is range.tst
616 converted to use registers instead of immediate offsets.
618 check/Makefile.am: Update for the new test case.
620 2015-02-07 Paulo Andrade <pcpa@gnu.org>
622 * lib/jit_size.c: Preventively use at least 144 bytes
623 if JIT_INSTR_MAX is less than it. The logic is not
624 guaranteed to be 100% precise, it is mostly heuristics
625 to allocate a buffer with as close as possible size,
626 but a wrong value may cause code generation to write
627 past the end of the buffer.
629 2015-02-03 Paulo Andrade <pcpa@gnu.org>
631 * lib/lightning.c: Correct the reason the bug in
632 simplify_stxi was not triggered before, it was due to
633 incorrectly resetting the value->code field, what was
634 causing it to never properly optimize:
637 when Rb0 == Rb1, Rt0 == Rt1 and Im0 == Im1
638 There was another possible issue, that has been also
639 addressed in this commit, that would be the case of
640 Rbn == Rtn, where no redundancy removal is possible.
642 2015-02-03 Paulo Andrade <pcpa@gnu.org>
644 * lib/lightning.c: Correct wrong check in simplify_stxi.
645 The test was incorrectly comparing the target register
646 and the displacement offset. This was a time bomb bug,
647 that would trigger in code like:
650 if Rb0 == Rb1 && Rt0 == Rt1 && Im0 == Rt1, that is,
651 the wrong check was Im0 == Rt1, instead of the supposed
652 Im0 == Imm1 (that was what the code mean't to do). It
653 was removing the second stxi assuming it was redundantly
654 generated; as that is not uncommon pattern on
655 translators generating jit.
657 2015-02-02 Paulo Andrade <pcpa@gnu.org>
659 * configure.ac, include/lightning/jit_private.h,
660 lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
661 lib/jit_disasm.c, lib/jit_hppa.c, lib/jit_ia64.c,
662 lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
663 lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c: Add a new
664 --enable-devel-disassembler option, that should be used
665 during development, or lightning debug. This option
666 intermixes previous jit_print and jit_disassemble
667 output, making it easier to visualize what lightning
668 call was used, and what code was generated.
670 2015-01-31 Paulo Andrade <pcpa@gnu.org>
672 * lib/jit_arm-cpu.c, lib/jit_arm.c: Only limit to 24 bit
673 displacement non conditional jump in the same jit_state_t.
675 2015-01-19 Paulo Andrade <pcpa@gnu.org>
677 * doc/body.texi: Reorder documentation, making jit_frame
678 and jit_tramp the lightning response to the need of
679 trampolines, continuations and tail call optimizations.
680 A pseudo code example of a factorial function was added.
681 Also added a section for description of the available
684 * doc/fact.c: New file, implementing a simple example of
685 a translation of a trivial, recursive, tail call optimization
686 into lightning calls. This is the conversion to functional C
687 code of the example in doc/body.texi.
689 * doc/Makefile.am: Update for the next test case.
691 2015-01-17 Paulo Andrade <pcpa@gnu.org>
693 * include/lightning.h, lib/jit_aarch64.c,
694 lib/jit_alpha.c, lib/jit_arm-vfp.c, lib/jit_arm.c,
695 lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
696 lib/jit_ppc.c, lib/jit_s390.c, lib/jit_sparc.c,
697 lib/jit_x86.c: Add the new jit_arg_register_p predicate.
698 The predicate is expected to be used to know if an
699 argument is in a register, what would need special
700 handling if code that can overwrite non callee save
701 registers is executed.
703 * check/carg.c: New test case to check consistency and
704 expected usage of jit_arg_register_p.
706 * check/Makefile.am: Update for new test case.
708 2015-01-17 Paulo Andrade <pcpa@gnu.org>
710 * include/lightning/jit_aarch64.h,
711 include/lightning/jit_alpha.h,
712 include/lightning/jit_arm.h,
713 include/lightning/jit_hppa.h,
714 include/lightning/jit_mips.h,
715 include/lightning/jit_ppc.h,
716 include/lightning/jit_s390.h,
717 include/lightning/jit_sparc.h,
718 include/lightning/jit_x86.h,
719 lib/jit_aarch64.c, lib/jit_alpha.c,
720 lib/jit_arm.c, lib/jit_hppa.c,
721 lib/jit_ia64.c, lib/jit_mips.c,
722 lib/jit_ppc.c, lib/jit_s390.c,
723 lib/jit_sparc.c, lib/jit_x86.c: Remove jit_arg_reg_p and
724 jit_arg_f_reg_p from a public header, and define it only
725 on port specific files where an integer offset is used
726 to qualify an argument identifier. Exported code expects
727 an opaque pointer (but of jit_node_t* type) to "qualify"
728 an argument identifier.
729 This patch, and the code review/simplification done during
730 it also corrected some bugs:
731 o Inconsistent jit_arg_d value of double argument after 3
732 integer arguments in arm for jit_functions; tested, C
733 functions were being properly called.
734 o Inconsistent use of getarg_{f,d} and putarg*_{f,d} on
735 s390 (32-bit) that happened to not have a proper test
736 case, as it would only happen for jit functions, and
737 tested, called C functions had proper arguments.
738 o Corrected a "last minute" correction that did not go
739 to the committed version, and would not compile on hppa,
740 due to bad _jit_putargi_d prototype definition.
742 2015-01-17 Paulo Andrade <pcpa@gnu.org>
744 * doc/body.texi: Correct wrong/outdated information for
745 hton*, pusharg* and ret*, and add missing documentation
746 for rsb*, qmul*, qdvi* and putarg*.
748 2015-01-15 Paulo Andrade <pcpa@gnu.org>
750 * configure.ac, lib/jit_disasm.c: Rewrite workaround
751 to apparent problem to initialize powerpc disassembler.
753 2015-01-15 Paulo Andrade <pcpa@gnu.org>
755 * include/lightning.h, lib/jit_aarch64.c,
756 lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
757 lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
758 lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c:
759 Implement jit_putarg*. It works as a mix of jit_getarg*
760 and jit_pusharg*, in the way that the first argument is
761 a register or immediate, and the second is a pointer
762 returned by jit_arg*. The use of the interface is to change
763 values of arguments to the current jit function.
765 * check/put.ok, check/put.tst: New test cases exercising
766 the new jit_putarg* interface.
768 * check/Makefile.am, check/lightning.c: Update for the
769 new test case and interface.
771 2015-01-08 Paulo Andrade <pcpa@gnu.org>
773 * include/lightning/jit_s390.h, lib/jit_s390-cpu.c,
774 lib/jit_s390-fpu.c, lib/jit_s390-sz.c, lib/jit_s390.c:
775 Renamed s390x* files to s390*.
777 * check/float.tst, check/lightning.c, configure.ac,
778 include/lightning.h, include/lightning/Makefile.am,
779 lib/Makefile.am, lib/jit_s390.c, lib/jit_size.c,
780 lib/lightning.c: Update for renamed files.
782 2015-01-08 Paulo Andrade <pcpa@gnu.org>
784 * include/lightning.h, include/lightning/jit_private.h,
785 include/lightning/jit_s390x.h, lib/jit_disasm.c,
786 lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c, lib/jit_s390x-sz.c,
787 lib/jit_s390x.c, lib/jit_size.c, lib/lightning.c:
788 Add support for generating jit for s390 32 bit. This change
789 also removed %f15 from the list of temporaries fpr registers;
790 it was not being used, but if were, it would corrupt the
791 stack frame because the spill address would overwrite grp
794 2014-12-26 Paulo Andrade <pcpa@gnu.org>
796 * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Correct some endianess issues
797 on the powerpc le backend.
799 2014-12-26 Paulo Andrade <pcpa@gnu.org>
801 * lib/jit_ppc-cpu.c: Add mcrxr instruction emulation,
802 as this instruction has been phased out, and should be
803 implemented as a kernel trap.
805 2014-12-26 Paulo Andrade <pcpa@gnu.org>
807 * lib/jit_arm.c: Better check for need to flush constants
808 before the pool being no longer reachable.
810 2014-12-25 Paulo Andrade <pcpa@gnu.org>
812 * include/lightning.h: Split jit_htonr in the new 3 interfaces
813 jit_htonr_us, jit_htonr_ui and jit_htonr_ul, the later only
814 available on 64 bit. The plain/untyped jit_htonr macro call
815 maps to the wordsize one.
816 * lib/jit_aarch64-cpu.c, lib/jit_aarch64-sz.c, lib/jit_aarch64.c,
817 lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c,
818 lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c,
819 lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c,
820 lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
821 lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c,
822 lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
823 lib/jit_s390x-cpu.c, lib/jit_s390x-sz.c, lib/jit_s390x.c,
824 lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c,
825 lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c:
826 Update backends for the new jit_htonr*.
827 * check/lightning.c, lib/jit_names.c, lib/lightning.c:
828 Update for the new jit_htonr* interfaces.
829 * check/Makefile.am: Update for new test cases.
830 * check/hton.ok, check/hton.tst: New test cases.
832 2014-12-24 Paulo Andrade <pcpa@gnu.org>
834 * include/lightning/jit_private.h, include/lightning/jit_x86.h,
835 lib/jit_disasm.c, lib/jit_x86-cpu.c, lib/jit_x86-sse.c,
836 lib/jit_x86-sz.c, lib/jit_x86-x87.c, lib/jit_x86.c,
837 size.c: Implement support for the x32 abi. Built and
838 tested on Gentoo default/linux/amd64/13.0/x32 profile.
840 2014-12-24 Paulo Andrade <pcpa@gnu.org>
842 * lib/jit_names.c: Add missing rsbi_f and rsbi_d strings.
844 2014-12-21 Paulo Andrade <pcpa@gnu.org>
846 * lib/jit_arm.c: Call __clear_cache for every page.
847 This should only be required for older boards or
848 toolchain setup, but has been reported to be required
849 for lightning at some point.
851 2014-12-21 Paulo Andrade <pcpa@gnu.org>
853 * lib/jit_arm.c: Correct check to guard overflow of index
854 of constants from program counter.
856 2014-11-24 Paulo Andrade <pcpa@gnu.org>
858 * lib/lightning.c: Remove an optimization to calee save
859 registers that may incorrectly remove a jit_movr under
862 2014-11-20 Paulo Andrade <pcpa@gnu.org>
864 * include/lightning/jit_ppc.h, lib/jit_ppc-cpu.c,
865 lib/jit_ppc.c: Add initial powerpc le support.
867 2014-11-20 Paulo Andrade <pcpa@gnu.org>
869 * lib/jit_disasm.c: Change thumb or arm disassemble based on
870 jit code before disassembly.
872 * lib/jit_arm-cpu.c: Correct reversed arguments to LDRD and
873 STRD instructions, and correct checking for support of those.
875 * lib/jit_arm-swf.c: Correct wrong use of LDRD and STRD and
876 only use those if the register is even.
878 * check/check.arm.swf.sh, check/check.arm4.swf.sh: New files
879 to test LDRD and STRD, as well as the alternate code path
880 when those are not available, in the .arm4. test case.
882 * check/Makefile.am: Update for the new test cases.
884 2014-11-08 Paulo Andrade <pcpa@gnu.org>
886 * include/lightning/jit_private.h, lib/jit_aarch64.c,
887 lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
888 lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
889 lib/jit_s390x.c, lib/jit_sparc.c, lib/jit_x86.c:
890 Implement a private jit_flush call, that flushes
891 the cache, if applicable, aligning down to the
892 previous and up to the next page boundary.
894 2014-11-08 Paulo Andrade <pcpa@gnu.org>
896 * check/ctramp.c: New file. It just repeats the test
897 of tramp.tst, but using two jit_state_t, what should
898 test possible issues with two contexts, and also validate
899 jit_tramp works on backends with function descriptions.
901 * check/Makefile.am: Update for new test case.
903 2014-11-03 Paulo Andrade <pcpa@gnu.org>
905 * include/lightning/jit_mips.h: Do not make the t9 register
906 JIT_R11 (or JIT_R7 for n32 or n64 abi) available. Previously
907 it cause problems if one expects it to not be changed in a
908 function call. For example, calling a jit function, where it
909 really does not need to be changed.
911 2014-10-26 Paulo Andrade <pcpa@gnu.org>
913 * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
914 lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c, lib/jit_ppc.c,
915 lib/jit_s390x.c, lib/jit_sparc.c, lib/jit_x86.c: Add an
916 assertion to all code generation "drivers" to ensure
917 _jitc->regarg is empty or in an expected state, after
918 translation of a lightning instruction to native code.
919 This change was a brute force test to find out other cases
920 of a temporary not being release (like was happening with
921 _bmsi and _bmci on x86), but no other case was found,
922 after running make check, with assertions enabled, on all
925 2014-10-26 Paulo Andrade <pcpa@gnu.org>
927 * lib/jit_x86-cpu.c: Correct a register allocation leak in
930 2014-10-25 Paulo Andrade <pcpa@gnu.org>
932 * lib/jit_disasm.c: Do not cause an fatal error if init_jit
933 fails in the jit_init_debug call.
935 2014-10-24 Paulo Andrade <pcpa@gnu.org>
937 * lib/jit_ia64.c, lib/jit_ppc.c: Correct handling of function
938 descriptor when first prolog is a jit_tramp prolog. The
939 test case was using the same jit_context_t, so was not
940 triggering this condition.
942 * lib/jit_ppc-cpu.c: Properly handle jump displacements that
943 do not fit on 24 powerpc. This required changing from previous
944 "mtlr reg, blr" to "mtctr reg, bctr" to properly handle
945 the logic to "hide" function descriptors, but that would
946 also be required as the proper jit_jmpr when/if implementing
947 optimizations to leaf functions (was working with blr because
948 it is saved/reloaded in prolog/epilog).
950 2014-10-21 Paulo Andrade <pcpa@gnu.org>
952 * include/lightning.h, lib/lightning.c: Add three predicates
953 to query information about labels. jit_forward_p(label)
954 will return non zero if the label is "forward", that is
955 need a call to jit_link(label), jit_indirect_p(label)
956 that returns non zero if the label was created with the
957 jit_indirect() call, and jit_target_p(label) that will
958 return non zero if there is at least one jump patched
959 to land at that label.
961 2014-10-18 Paulo Andrade <pcpa@gnu.org>
963 * check/range.ok, check/range.tst: New test case designed
964 to catch incorrect code generation, usually due to incorrect
965 test of immediate size. The test checks a large amount of
966 encodings in "power of two" boundaries. This test exorcises
967 a significant amount of code paths that was previously not
970 * check/Makefile.am: Add range test to make check target.
972 * lib/jit_aarch64-cpu.c: Correct wrong address calculation
973 for stxi_c, stxi_s, stxi_i and stxi_l when the offset is
976 * lib/jit_mips-fpu.c: Correct wrong size test to check if
977 an immediate can be encoded in a float or double store.
979 * lib/jit_s390x-cpu.c: Correct inverted encoding to stxi_s
980 when the offset cannot be encoded, and fallbacks to an
981 alternate encoding in 2 instructions.
983 2014-10-17 Paulo Andrade <pcpa@gnu.org>
985 * check/alu_rsb.ok, check/alu_rsb.tst: New files implementing
988 * check/Makefile.am, check/lightning.c, include/lightning.h,
989 lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c, lib/jit_aarch64-sz.c,
990 lib/jit_aarch64.c, lib/jit_alpha-cpu.c, lib/jit_alpha-fpu.c,
991 lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_arm-cpu.c,
992 lib/jit_arm-swf.c, lib/jit_arm-sz.c, lib/jit_arm-vfp.c,
993 lib/jit_arm.c, lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c,
994 lib/jit_hppa-sz.c, lib/jit_hppa.c, lib/jit_ia64-cpu.c,
995 lib/jit_ia64-fpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c,
996 lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips-sz.c,
997 lib/jit_mips.c, lib/jit_names.c, lib/jit_ppc-cpu.c,
998 lib/jit_ppc-fpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c,
999 lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c, lib/jit_s390x-sz.c,
1000 lib/jit_s390x.c, lib/jit_sparc-cpu.c, lib/jit_sparc-fpu.c,
1001 lib/jit_sparc-sz.c, lib/jit_sparc.c, lib/jit_x86-cpu.c,
1002 lib/jit_x86-sse.c, lib/jit_x86-sz.c, lib/jit_x86-x87.c,
1003 lib/jit_x86.c, lib/lightning.c: Implement jit_rsb*. This
1004 was a missing lightning 1.x interface, that on most
1005 backends is synthesized, but on a few backends (hppa and ia64),
1006 it can generate better code as on those there is, or the
1007 only instruction with an immediate is in "rsb" format
1010 2014-10-17 Paulo Andrade <pcpa@gnu.org>
1012 * lib/jit_names.c: New file with single definition of string
1013 representation of lightning IR codes.
1015 * size.c: Modified to append the code name in a C comment
1016 after the maximum instruction size.
1018 * lib/jit_print.c: Minor change to not duplicate jit_names.c
1021 * lib/jit_aarch64-sz.c, lib/jit_alpha-sz.c, lib/jit_arm-sz.c,
1022 lib/jit_hppa-sz.c, lib/jit_ia64-sz.c, lib/jit_mips-sz.c,
1023 lib/jit_ppc-sz.c, lib/jit_s390x-sz.c, lib/jit_sparc-sz.c,
1024 lib/jit_x86-sz.c: Rewritten to add string representation of
1025 IR codes in a C comment.
1027 2014-10-14 Paulo Andrade <pcpa@gnu.org>
1029 * lib/jit_aarch64-cpu.c, lib/jit_alpha-cpu.c, lib/jit_arm-cpu.c,
1030 lib/jit_hppa-cpu.c, lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c,
1031 lib/jit_sparc-cpu.c: Implement or correct the internal
1032 nop(count) call that receives an argument that tells the
1033 modulo bytes to align the code for the next instruction.
1035 * include/lightning.h, lib/lightning.c, lib/jit_aarch64.c,
1036 lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c, lib/jit_ia64.c,
1037 lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c, lib/jit_sparc.c,
1038 lib/jit_x86.c: Implement the new jit_align() call that receive
1039 an argument, that tells the modulo, in bytes, to align the
1040 next instruction. In most backends the only value that makes
1041 a difference is a value that matches sizeof(void*), as all
1042 other values usually are already automatically aligned in
1043 labels, but not guaranteed to be aligned at word size bytes.
1045 * check/align.ok, check/align.tst: New files, implementing
1046 a simple test for the new jit_align() interface.
1048 * check/Makefile.am, check/lightning.c, lib/jit_aarch64-sz.c,
1049 lib/jit_alpha-sz.c, lib/jit_arm-sz.c, lib/jit_hppa-sz.c,
1050 lib/jit_ia64-sz.c, lib/jit_mips-sz.c, lib/jit_ppc-sz.c,
1051 lib/jit_print.c, lib/jit_s390x-sz.c, lib/jit_sparc-sz.c,
1052 lib/jit_x86-sz.c: Update for the new jit_code_align code and
1053 the jit_align() interface.
1055 2014-10-13 Paulo Andrade <pcpa@gnu.org>
1057 * include/lightning.h, lib/jit_size.c, size.c: Use a
1058 symbolic value for the last IR code.
1060 2014-10-12 Paulo Andrade <pcpa@gnu.org>
1062 * include/lightning.h, include/lightning/jit_private.h,
1063 lib/jit_aarch64-cpu.c, lib/jit_alpha-cpu.c, lib/jit_arm-cpu.c,
1064 lib/jit_hppa-cpu.c, lib/jit_ia64-cpu.c, lib/jit_mips-cpu.c,
1065 lib/jit_ppc-cpu.c, lib/jit_s390x-cpu.c, lib/jit_sparc-cpu.c,
1066 lib/jit_x86-cpu.c, lib/lightning.c: Implement the new
1067 jit_frame and jit_tramp interfaces, that allow writing
1068 trampoline like calls, where a single dispatcher jit buffer
1069 is written, and later other jit buffers are created, with
1070 the same stack frame layout as the dispatcher. This is the
1071 logic that GNU Smalltalk used in lightning 1.x, and is required
1072 to make a sane port for lighting 2.x.
1074 * jit_ia64-cpu.c: Implement support for jit_frame and jit_tramp,
1075 and also correct wrong encoding for B4 instructions, that
1076 implement jmpr, as well as correct reverse logic in _jmpr,
1077 that was moving the branch register to the jump register,
1079 Also, if a stack frame is to be assumed, always assume it may
1080 call a function with up to 8 arguments, regardless of the
1081 hint frame argument.
1083 * lib/jit_arm.c: Add a new must_align_p() interface to ensure
1084 function prologs are always aligned. This condition was
1085 previously always true, somewhat by accident, but with
1086 jit_tramp it is not guaranteed.
1088 * jit_ia64-cpu.c: lib/jit_ppc.c: Add minor special handling
1089 required to implement jit_tramp, where a function descriptor
1090 should not be added before a prolog, as jit_tramp means omit
1093 * check/lightning.c: Update test driver for the new interfaces.
1095 * check/Makefile.am, check/tramp.tst, check/tramp.ok: Add
1096 a simple test and example of the jit_frame and jit_tramp
1097 usage implementing a simple Fibonacci function using a
1098 simulation of an interpreter stack and how it would handle
1099 state in language specific variables.
1101 * doc/body.texi: Add documentation for jit_frame and
1104 2014-09-29 Paulo Andrade <pcpa@gnu.org>
1106 * lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
1107 lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
1108 lib/jit_ppc.c, lib/jit_s390x.c, lib/jit_sparc.c,
1109 lib/jit_x86.c, lib/lightning.c: Allow jit_jmpi on a
1110 target that is not a node. This may lead to hard to
1111 debug code generation, but is a required feature for
1112 certain generators, like the ones that used lightning
1113 1.2x. Note that previously, but not really well
1114 documented, it was instructed to use:
1115 jit_movi(rn, addr); jit_jmpr(rn);
1117 jit_patch_abs(jit_jmpi(), addr);
1120 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1122 * lib/jit_x86-sz.c: Generate information about instruction
1123 lengths for more precise calculation of buffer size on
1124 Windows x64. This change is specially important because
1125 the maximum instruction length is larger than other
1126 systems, what could cause an out of bounds write on
1127 special conditions without this update.
1129 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1131 * check/lightning.c: Add workaround to conflicting global
1132 optind variable in cygwin binutils that have an internal
1133 getopt* implementation.
1135 * lib/jit_x86-cpu.c: Add a simple define ffsl ffs if building
1136 for 32 bit and there is no ffsl function.
1138 2014-09-24 Paulo Andrade <pcpa@gnu.org>
1140 * check/lightning.c: Add a hopefully temporary kludge to not use
1141 sprintf and sscanf returned by dlsym. This is required to pass
1144 * include/lightning/jit_private.h: Use symbolic name for first
1145 integer register argument, as this is different in sysv and
1148 * include/lightning/jit_x86.h: Add conditionals and definitions
1149 for Windows x64 (under __CYGWIN__ preprocessor conditional).
1151 * lib/jit_x86-cpu.c: Correct one instruction encoding bug, that
1152 was working by accident. Only use rax to rdx for some byte
1153 operations to work on compatibility mode (that is, to generate
1154 the proper encoding, instead of actually generating encoding
1155 for high byte registers, e.g. %bh).
1156 Add proper prolog and epilog for windows x64.
1158 * lib/jit_x86-sse.c: Correct a swapped rex prefix for float
1161 * lib/jit_x86.c: Adjust to support Windows x64 abi.
1163 * check/check.x87.nodata.sh: New file, previously used but that
1166 2014-09-07 Paulo Andrade <pcpa@gnu.org>
1168 * lib/lightning.c: Mark all registers advertised as live, as
1169 per jit_callee_save_p as live whenever reaching a jump that
1170 cannot be tracked. This is a rethink of the previous commit,
1171 and is a better approach, otherwise there would not be much
1172 sense on relying on jit_callee_save_p if it could not be
1175 * check/jmpr.tst, check/jmpr.ok: New files implementing a very
1176 simple test case, that would actually cause an assertion on
1177 code before the change to only mark as live when reaching a
1178 jump that could not tracked, the actually advertised as callee
1181 check/Makefile.am: Update for new jmpr test case.
1183 2014-09-01 Paulo Andrade <pcpa@gnu.org>
1185 * lib/lightning.c: Do not mark all registers in unknown state
1186 as live on jit_jmpr, or jit_jmpi to an absolute address. Instead,
1187 treat it as a function call, and only consider JIT_Vn registers
1190 2014-08-29 Paulo Andrade <pcpa@gnu.org>
1192 * doc/body.texi: Add a proper info menu entry for
1195 * doc/version.texi: Regenerate.
1197 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1199 * lib/jit_aarch64-cpu.c, lib/jit_aarch64-fpu.c,
1200 lib/jit_arm-cpu.c, lib/jit_arm-vfp.c,
1201 lib/jit_hppa-cpu.c, lib/jit_hppa-fpu.c,
1202 lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c,
1203 lib/jit_mips-cpu.c, lib/jit_mips-fpu.c,
1204 lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c,
1205 lib/jit_s390x-cpu.c, lib/jit_s390x-fpu.c,
1206 lib/jit_s390x.c, lib/jit_sparc-cpu.c,
1207 lib/jit_x86-cpu.c, lib/jit_x86-sse.c,
1208 lib/jit_x86-x87.c: Review generation of all branch
1209 instructions and always adds the jit_class_nospill
1210 bitfield for temporary registers that cannot be spilled
1211 because the reload would be after a conditional jump; the
1212 patch only adds an extra assertion. These conditions do
1213 not happen on documented lightning usage, but can happen
1214 if one uses the not exported jit_get_reg and jit_unget_reg
1215 calls and cause enough register starvation.
1217 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1219 * lib/jit_alpha.c: Correct wrong bitmask of most argument
1220 float register arguments, that were being set as callee
1221 save instead of argument registers class.
1223 2014-08-16 Paulo Andrade <pcpa@gnu.org>
1225 * lib/jit_arm-sz.c: Regenerate table of known maximum
1226 instruction sizes for the software float fallback,
1227 that implements "virtual" float registers in the stack
1228 and operations as calls to libgcc.
1230 * size.c: Correct typo in the generated jit_arm-sz.c file.
1232 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1234 * include/lightning/jit_alpha.h, lib/jit_alpha-cpu.c,
1235 lib/jit_alpha-fpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c:
1236 New files implementing a lightning Alpha port. Thanks
1237 to Trent Nelson and snakebit.net staff for providing access
1240 * check/float.tst, check/lightning.c, configure.ac,
1241 include/lightning.h, include/lightning/Makefile.am,
1242 include/lightning/jit_private.h, lib/Makefile.am,
1243 lib/jit_disasm.c, lib/jit_size.c, lib/lightning.c:
1244 Minor changes to adapt for the new Alpha port.
1246 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1248 * lib/lightning.c: Always mark JIT_RET and JIT_FRET as
1249 live in a function epilog. This is required because
1250 on some ports a complex sequence, allocating one or more
1251 registers, may be required to jump from a ret* to the
1252 epilog, and the lightning api does not have annotations
1253 to know if a function returns a value, or the type of
1256 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1258 * lib/lightning.c: Change the correct live bitmask of
1259 return registers after a function call in jit_update.
1261 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1263 * lib/lightning.c: Change assertions to have an int
1264 result and correct a bad bit mask assertion.
1266 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1268 * lib/jit_aarch64.c: Correct bad setup for assertion
1269 of consistency before a patch.
1271 2014-08-10 Paulo Andrade <pcpa@gnu.org>
1273 * lib/jit_mips-cpu.c: Correct typo in the jit_bmsr
1274 implementation that was using the wrong test result
1277 2014-07-28 Paulo Andrade <pcpa@gnu.org>
1279 * lib/jit_memory.c: Do not call free on NULL pointers.
1281 * include/lightning/jit_private.h, lib/jit_note.c,
1282 lib/lightning.c: Add a wrapper to memcpy and memmove
1283 to not actually call those functions with a zero size
1284 argument, and likely also a null src or dst.
1286 2014-07-27 Paulo Andrade <pcpa@gnu.org>
1288 * include/lightning/jit_private.h, lib/jit_disasm.c,
1289 lib/lightning.c: Remove the global jit_progname variable.
1290 It was being only used in jit_init_debug, that is called
1291 from init_jit, so, just pass an argument.
1293 2014-07-27 Paulo Andrade <pcpa@gnu.org>
1295 * doc/body.texi: Add note that jit_set_memory_functions
1296 should be called before init_jit, because init_jit
1297 itself may call the memory wrappers.
1299 2014-04-22 Paulo Andrade <pcpa@gnu.org>
1301 * lib/jit_arm.c: Do not get confused with default settings
1302 if /proc is not mounted on Linux specific code path.
1304 2014-04-09 Paulo Andrade <pcpa@gnu.org>
1306 * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
1307 include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
1308 include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
1309 include/lightning/jit_private.h, include/lightning/jit_s390x.h,
1310 include/lightning/jit_sparc.h, include/lightning/jit_x86.h:
1311 Do not add jit_regset_t, JIT_RA0, and JIT_FA0 to the installed
1312 header file. These types and definitions are supposed to be
1313 only used internally.
1315 2014-04-05 Paulo Andrade <pcpa@gnu.org>
1317 * lib/jit_arm-cpu.c: Only adjust stack pointer in prolog if
1318 need stack space, that is, do not emit a nop instruction
1319 subtracting zero from the stack pointer.
1321 2014-04-04 Paulo Andrade <pcpa@gnu.org>
1323 * lib/jit_disasm.c: Correct a crash in the doc/printf example
1324 on arm due to releasing the data_info information in
1325 jit_clear_state. This is a special case for arm only, and
1326 actually, only armv5 or older uses the data_info buffer,
1327 or when forcing arm instruction set mode besides thumb
1330 2014-12-03 Paulo Andrade <pcpa@gnu.org>
1332 * doc/body.texi: Write detailed description and examples for
1333 jit_get_memory_functions, jit_set_memory_functions,
1334 jit_get_code, jit_set_code, jit_get_data and jit_set_data.
1336 2014-12-03 Paulo Andrade <pcpa@gnu.org>
1338 * include/lightning.h, include/lightning/jit_private.h,
1339 lib/lightning.c: Implement the new jit_set_data() interface,
1340 and the new jit_get_data() helper. Like jit_set_code(),
1341 jit_realize() should be called before jit_set_data().
1342 The most common usage should be jit_set_data(JIT_DISABLE_DATA
1343 | JIT_DISABLE_NOTE), to force synthesize any float/double
1344 constant in the stack and not generate any debug information.
1346 * lib/jit_note.c: Minor change to debug note generation as
1347 now it uses an alternate temporary data buffer during constants
1348 and debug generation to accommodate the possibility of the user
1349 setting an alternate data buffer.
1351 * lib/jit_hppa-fpu.c, lib/jit_s390x.c, lib/jit_s390x-cpu.c,
1352 lib/jit_s390x-fpu.c, lib/jit_sparc.c, lib/jit_sparc-fpu.c,
1353 lib/jit_x86-sse.c, lib/jit_x86-x87.c: Implement jit_set_data.
1355 * lib/jit_hppa-sz.c, lib/jit_sparc-sz.c, lib/jit_x86-sz.c,
1356 lib/jit_s390x-sz.c: Update for several instructions that now
1357 have a different maximum length due to jit_set_data.
1359 * lib/jit_mips-fpu.c: Implement jit_set_data, but missing
1360 validation on n32 and n64 abis (and/or big endian).
1362 * lib/jit_mips-sz.c: Update for changes in o32.
1364 * lib/jit_ppc-fpu.c: Implement jit_set_data, but missing
1365 validation on Darwin PPC.
1367 * lib/jit_ppc-sz.c: Update for changes in powerpc 32 and
1370 * lib/jit_ia64-fpu.c: Implement untested jit_set_data.
1372 * TODO: Add note to list ports that were not tested for the
1373 new jit_set_data() feature, due to no longer having access
1376 * check/nodata.c: New file implementing a simple test exercising
1377 several different conditions created by jit_set_data().
1379 * check/check.nodata.sh: New file implementing a wrapper
1380 over the existing *.tst files, that runs all tests without
1381 using a data buffer for constants; only meaningful (and
1382 enabled) on architectures that used to store float/double
1383 constants on a read only data buffer.
1385 * configure.ac, check/Makefile.am: Update for the new test
1388 * check/lightning.c: Implement the new "-d" option that
1389 sets an internal flag to call jit_set_data() disable
1390 constants and debug, that is, using only a pure code
1393 2014-11-03 Paulo Andrade <pcpa@gnu.org>
1395 * include/lightning.h, include/lightning/jit_private.h,
1396 lib/lightning.c: Implement the new jit_set_code() interface,
1397 that allows instructing lightning to use an alternate code
1398 buffer. The new jit_realize() function should be called
1399 before jit_set_code(), and usually call jit_get_code()
1400 to query the amount of bytes expected to be required for
1403 * lib/jit_size.c: Minor update to have less chances of
1404 miscalculating the code buffer by starting the counter
1405 with the size of the longest instruction instead of zero,
1406 as code emit fails if at any moment less than the longest
1407 instruction bytes are available.
1409 * check/setcode.c: New file implementing some basic tests
1410 of the new jit_set_code() interface.
1412 * check/Makefile.am: Update for newer test case.
1414 2014-06-03 Paulo Andrade <pcpa@gnu.org>
1416 * include/lightning.h, lib/lightning.c: Add the new
1417 jit_indirect() call, that returns a special label node,
1418 and tells lightning that the label may be the target of
1421 * doc/body.texi: Document the new jit_indirect() call, and
1422 add examples of different ways to create labels and branches.
1424 2014-23-02 Paulo Andrade <pcpa@gnu.org>
1426 * lib/jit_x86.c: Rewrite previous patch to inline save/restore
1427 because clobbering %ebx in x86 is treated as an error
1428 (jit_x86.c:239:5: error: PIC register clobbered by 'ebx' in 'asm').
1430 2014-19-02 Paulo Andrade <pcpa@gnu.org>
1432 * lib/jit_x86.c: Rewrite incorrect inline assembly that could
1433 truncate a variable in a callee save register. Now it simply
1434 tells gcc that the register is clobbered, instead of using a
1435 *32 bit* swap with a temporary variable. The problem only
1436 happens when compiling with optimization.
1438 2014-19-02 Paulo Andrade <pcpa@gnu.org>
1440 * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
1441 include/lightning/jit_hppa.h, include/lightning/jit_ia64.h,
1442 include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
1443 include/lightning/jit_s390x.h, include/lightning/jit_sparc.h,
1444 include/lightning/jit_x86.h: Change jit_regset_t to an
1445 unsigned type, to allow safe right shift.
1447 * lib/lightning.c: Rewrite jit_regset_scan1 to allow easier
1448 compiler optimization.
1450 2013-12-03 Paulo Andrade <pcpa@gnu.org>
1452 * lib/jit_x86-x87.c: Correct wrong optimization when
1453 loading the log(2) constant.
1455 2013-12-03 Paulo Andrade <pcpa@gnu.org>
1457 * lib/jit_x86-cpu.c: Use the emms instruction before
1458 calling any function. This is particularly important
1459 when using c99 complex functions as it can easily
1460 overflow the x87 stack due to the way lightning uses
1461 the x87 stack as a flat register file.
1463 2013-12-02 Paulo Andrade <pcpa@gnu.org>
1465 * lib/jit_x86-x87.c: Correct wrong code generation due
1466 to comparing the base and not the value register with
1469 2013-12-02 Paulo Andrade <pcpa@gnu.org>
1471 * lib/jit_x86-x87.c, lib/jit_x86.c: Use 8 bytes aligned
1472 stack offset for float/double x87 to/from sse move.
1474 2013-11-27 Paulo Andrade <pcpa@gnu.org>
1476 * configure.ac, lib/jit_arm-swf.c, lib/jit_arm.c: Add
1477 changes that should at least allow building lightning
1480 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1482 * lib/jit_ppc-cpu.c: Correct wrong shortcut for ldxi_l with
1483 a zero offset, that was calling ldr_i instead of ldr_l.
1485 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1487 * include/lightning/jit_arm.h, lib/jit_arm-cpu.c: Do not use
1488 by default load/store instructions that map to ldrt/strt.
1489 There is already the long displacement version for positive
1490 offsets, and when using a (shorter) negative offset it does
1491 not map to ldrt/strt. At least on qemu strt may cause
1492 reproducible, but unexpected SIGILL.
1494 2013-10-08 Paulo Andrade <pcpa@gnu.org>
1496 * lib/jit_arm-vfp.c: Correct wrong load/store offset
1497 calculation when the displacement is constant but too
1498 large to use an instruction with an immediate offset.
1500 2013-10-07 Paulo Andrade <pcpa@gnu.org>
1502 * check/self.c: Extend tests to validate jit_callee_save_p
1503 does not cause an assertion on valid arguments, and test
1504 extra registers defined on some backends.
1506 * configure.ac: Do not ignore environment CFLAGS when
1507 checking if need to test runtime configurable options,
1508 like use x87 when sse2 is available, arm instruction set
1509 instead of thumb, etc.
1511 * include/lightning/jit_arm.h: Correct wrong jit_f macro
1514 * include/lightning/jit_ia64.h, include/lightning/jit_ppc.h:
1515 Correct wrong jit_r macro definition.
1517 * lib/jit_x86-x87.c, lib/jit_x86.c: Actually use the
1518 reserved stack space for integer to/from float conversion.
1519 The stack space was also changed to ensure it is 8 bytes
1520 aligned. Also, for Solaris x86 in 32 bit mode, an alternate
1521 truncr_d was implemented because for some reason it is
1522 failing with SIGILL if using the "fisttpl" instructions,
1523 that must be available on p6 or newer, but for the sake of
1524 making all tests pass, implement a 486 or newer sequence
1525 if "sun" is defined.
1527 2013-10-03 Paulo Andrade <pcpa@gnu.org>
1529 * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
1530 lib/jit_mips-sz.c, lib/jit_mips.c, size: Build and
1531 pass all test cases on Irix big endian mips using
1534 2013-10-02 Paulo Andrade <pcpa@gnu.org>
1536 * include/lightning/jit_mips.h: Add proper mips abi detection.
1538 2013-09-30 Paulo Andrade <pcpa@gnu.org>
1540 * lib/jit_print.c: Do not crash if calling jit_print from
1541 gdb before actually emitting code.
1543 * lib/lightning.c: Correct misplaced check for already
1544 visited blocks on conditional branches, what was preventing
1545 proper merge live bit masks of forward blocks.
1547 2013-09-30 Paulo Andrade <pcpa@gnu.org>
1549 * lib/jit_x86-cpu.c: Correct not properly tested case of using
1550 %r12 as index register, what was causing an invalid assertion.
1551 %r12 is mapped to the "extra" JIT_R3 register, and test cases
1552 only test "standard" lightning registers.
1554 2013-09-28 Paulo Andrade <pcpa@gnu.org>
1556 * lib/jit_ia64.c: Minor change to force collecting the maximum
1557 instruction length in the --enable-devel-get-jit-size build
1558 mode. The actual generated file did not change because the
1559 sampling was large enough that it had already collected proper
1560 information in the previously slightly buggy code (not forcing
1561 a sync of the instructions that could be combined).
1563 2013-09-27 Paulo Andrade <pcpa@gnu.org>
1565 * lib/jit_arm.c: Correct build when disassembler is
1568 2013-09-25 Paulo Andrade <pcpa@gnu.org>
1570 * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c: Correct some
1571 off by one range checks (that were only accepting values
1572 one less than the maximum allowed) and an invalid test
1573 condition check that was forcing it to always use
1574 indirect jumps even when reachable with an immediate
1577 2013-09-24 Paulo Andrade <pcpa@gnu.org>
1579 * lib/jit_aarch64-sz.c, lib/jit_arm-sz.c, lib/jit_hppa-sz.c,
1580 lib/jit_ia64-sz.c, lib/jit_mips-sz.c, lib/jit_ppc-sz.c,
1581 lib/jit_s390x-sz.c, lib/jit_size.c, lib/jit_sparc-sz.c,
1582 lib/jit_x86-sz.c: New files implementing static tables
1583 with longest known instructions length generated to match
1584 a lightning instruction. These tables should make it easier
1585 to make it very unlikely to ever miscalculate, or by too
1586 much, the size of a code buffer.
1588 * lib/jit_size.c: New file that aids to either collect
1589 jit code size information, or use the information depending
1592 * size.c: New helper file that parses input for, and create
1593 an initial jit_$arch-sz.c file, that needs some minor edit
1594 for arches with multiple configurations.
1596 * configure.ac, Makefile.am: Add the new, devel mode only
1597 --enable-devel-get-jit-size configure option, that sets
1598 compile time flags to collect jit code size information,
1599 that will be used as input for the "noinst size program".
1601 * lib/jit_aarch64.c, lib/jit_arm.c, lib/jit_disasm.c,
1602 lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_memory.c,
1603 lib/jit_mips.c, lib/jit_ppc.c, lib/jit_s390x.c,
1604 lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c: Minor
1605 changes for the --enable-devel-get-jit-size build mode,
1606 as well as the "production build mode" with jit code
1609 2013-09-14 Paulo Andrade <pcpa@gnu.org>
1611 * include/lightning.h, lib/lightning.c: Add the new
1612 jit_pointer_p interface, that returns a boolean value
1613 telling if the pointer argument is inside the jit
1614 code buffer. This is useful to avoid the need to add
1615 extra labels and calls to jit_address to figure bounds
1616 of code buffer, and still keep internal data private.
1618 2013-09-13 Paulo Andrade <pcpa@gnu.org>
1620 * include/lightning.h, include/lightning/jit_private.h,
1621 lib/jit_note.c: Change the code argument of jit_get_note
1622 to a jit_pointer_t and make jit_get_note a public interface.
1623 It was intended so since start, as a way to map an offset
1624 in the code to a function name, file name and line number
1627 2013-09-11 Paulo Andrade <pcpa@gnu.org>
1629 * doc/body.texi: Correct reversed arguments in example of
1630 usage in a (possibly) multi threaded, multiple jit_state_t
1633 * include/lightning/jit_arm.h, include/lightning/jit_private.h,
1634 lib/jit_arm-cpu.c, lib/jit_arm.c: Make a previously, non
1635 documented, global state private to the related jit_state_t
1638 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1640 * check/self.c, check/self.ok: New files implementing simple
1641 consistency check assertions. At first validating some macros
1642 that use values from different sources agree.
1644 * check/Makefile.am: Update for the new test case.
1646 * include/lightning.h, lib/lightning.c: Add the new
1647 jit_callee_save_p() call, that is intended to be used when
1648 writing complex code using lightning, so that one does not
1649 need to verify what backend is being used, or have access to
1650 private data, to query if a register is callee save or not;
1651 on several backends the scratch registers are actually callee
1654 * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
1655 include/lightning/jit_hppa.h, include/lightning/jit_mips.h,
1656 include/lightning/jit_ppc.h, include/lightning/jit_sparc.h,
1657 include/lightning/jit_x86.h: Add an explicit definition for
1658 JIT_R3-JIT_Rn, JIT_V3-JIT_Vn and JIT_F6-JIT_Fn when applicable.
1659 This allows one to write code based on "#if defined(JIT_XN)"
1660 and therefore, not need to check what is the current backend
1661 or have access to private data structures. This is particularly
1662 useful when writing virtual machines with several specialized,
1665 * lib/jit_ia64.c: Properly flag the callee save general
1666 purpose registers as such, so that jit_callee_save_p() works
1669 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1671 * check/lightning.c, configure.ac: Conditionally use the
1672 code written to workaround a bug in the Hercules emulator,
1673 as isnan and isinf are not available at least on HP-UX ia64.
1675 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1677 * lib/jit_s390x-cpu.c: Spill/reload correct callee save
1680 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1682 * lib/jit_hppa-cpu.c: Correct code to call a function stored
1683 in a register or a patched function address.
1685 2013-09-10 Paulo Andrade <pcpa@gnu.org>
1687 * lib/jit_ia64-cpu.c: Correct incorrect logic when restoring
1688 the value of the "r2" callee save register.
1690 2013-08-29 Paulo Andrade <pcpa@gnu.org>
1692 * lib/jit_arm-cpu.c, lib/jit_arm.c: Correct wrong test and update
1693 of the thumb offset information, when checking if needing to
1694 patch a jump from arm to thumb mode. The problem would happen when
1695 remapping the code buffer, and the new address being lower than
1698 2013-08-26 Paulo Andrade <pcpa@gnu.org>
1700 * configure.ac: Extend FreeBSD test to also handle NetBSD.
1702 * lib/jit_x86-cpu.c: Correct wrongly defined offset type of
1703 ldxi_ui. Problem detected when building on NetBSD.
1705 * lib/lightning.c: Adjust code to handle NetBSD mremap,
1706 where arguments do not match Linux mremap.
1708 2013-08-26 Paulo Andrade <pcpa@gnu.org>
1710 * lib/jit_ppc.c: Correct C sequence point problem miscalculating
1711 the actual function address in a function descriptor. Problem
1712 happens with gcc 4.8.1 at least.
1714 2013-08-11 Paulo Andrade <pcpa@gnu.org>
1716 * lib/jit_s390x-cpu.c: Correct code checking if immediate
1717 fits instruction, but using the negated value.
1719 2013-07-28 Paulo Andrade <pcpa@gnu.org>
1721 * include/lightning/jit_s390x.h, lib/jit_s390x-cpu.c,
1722 lib/jit_s390x-fpu.c, lib/jit_s390x.c: New files
1723 implementing the new s390x port.
1725 * configure.ac, include/lightning.h,
1726 include/lightning/Makefile.am,
1727 include/lightning/jit_private.h,
1728 lib/Makefile.am, lib/jit_disasm.c, lib/lightning.c:
1729 Minor adaptation for the new s390x backend.
1731 * check/float.tst: Update for the s390x result of
1732 truncating +Inf to integer.
1734 * check/qalu_mul.tst: Add extra test cases to better test
1735 high word of signed multiplication as the result is
1736 adjust from unsigned multiplication on s390x.
1738 2013-07-28 Paulo Andrade <pcpa@gnu.org>
1740 * check/lightning.c: Do not assume casting a double NaN or
1741 Inf to float will produce the expected float NaN or Inf.
1742 This is not true at least under s390x.
1744 2013-07-28 Paulo Andrade <pcpa@gnu.org>
1746 * check/check.arm.sh, check/check.sh, check/check.swf.sh,
1747 check/check.x87.sh: Properly check test programs output,
1748 not just rely on the test program self testing the results
1751 2013-07-28 Paulo Andrade <pcpa@gnu.org>
1753 * lib/jit_aarch64.c: Remove unused macros left from cut&paste
1756 2013-07-16 Paulo Andrade <pcpa@gnu.org>
1758 * include/lightning/jit_aarch64.h, lib/jit_aarch64-cpu.c,
1759 lib/jit_aarch64-fpu.c, lib/jit_aarch64.c: New files
1760 implementing the new aarch64 port, as a new architecture,
1761 not as an expansion of the existing armv[4-7] port.
1763 * check/lightning.c: Add aarch64 support and a small
1764 change to recognize character constants as immediate
1767 * check/float.tst: Add aarch64 preprocessor conditionals
1768 to select proper expected value when converting [+-]Inf
1771 * include/lightning/jit_arm.h, lib/jit_arm.c: Minor changes
1772 to better match the new aarch64 files.
1774 * configure.ac, include/lightning.h,
1775 include/lightning/Makefile.am, include/lightning/jit_private.h,
1776 lib/Makefile.am, lib/lightning.c: Minor adjustments
1777 for the aarch64 port.
1779 2013-07-08 Paulo Andrade <pcpa@gnu.org>
1781 * NEWS, THANKS, configure.ac, doc/version.texi: Update for
1782 the 1.99a second alpha release.
1784 2013-06-25 Paulo Andrade <pcpa@gnu.org>
1786 * lib/jit_mips.c: Correct cut&paste error that caused wrong
1787 stack offset calculation for double arguments in stack in
1789 Correct typo in the __LITTLE_ENDIAN macro name, that came
1790 from cut&paste error in the original typo in lib/jit_ppc.c.
1792 * lib/jit_ia64.c, lib/jit_ppc.c: Correct typo in the
1793 __LITTLE_ENDIAN macro name.
1795 2013-06-22 Paulo Andrade <pcpa@gnu.org>
1797 * check/lightning.c, configure.ac, include/lightning.h,
1798 lib/lightning.c: Add tests and quirks to build/detect
1799 and/or work on Irix.
1801 * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
1802 lib/jit_mips-fpu.c, lib/jit_mips.c: Adapt code to run
1803 in big endian mips, using the n32 abi.
1805 2013-06-18 Paulo Andrade <pcpa@gnu.org>
1807 * include/lightning.h: Minor extra preprocessor testing
1808 to "detect" byte order on x86 solaris, that now builds
1809 and pass all test cases.
1811 2013-06-18 Paulo Andrade <pcpa@gnu.org>
1813 * lib/jit_sparc-cpu.c: Correct compiler warning of value
1814 used before assignment. The usage is bogus as the api
1815 requires always patching jumps, but the random value used
1816 could cause an assertion due to invalid displacement.
1818 * lib/jit_sparc.c: Always load and store double arguments
1819 in stack as 2 float loads or stores, for safety, as unaligned
1820 access is not allowed in Sparc Solaris.
1822 2013-06-14 Paulo Andrade <pcpa@gnu.org>
1824 * configure.ac: Force -mlp64 to CFLAGS on HP-UX ia64 port.
1825 It is the only supported mode, and expects gcc as C compiler.
1827 * include/lightning.h, lib/jit_ia64-cpu.c, lib/jit_ia64.c:
1828 Correct ia64 port to work on HP-UX that runs it in big endian
1831 2013-06-10 Paulo Andrade <pcpa@gnu.org>
1833 * lib/jit_hppa.c: Sanitize the cache synchronization inline
1834 assembly code that was doing twice the work and redundantly
1835 flushing the end address every loop iteration.
1837 2013-06-09 Paulo Andrade <pcpa@gnu.org>
1839 * configure.ac, check/Makefile.am, doc/Makefile.am: Do not
1840 explicitly link to -ldl, but instead autodetect the library
1841 with dlopen, dlsym, etc.
1843 * check/lightning.c: Add workaround to apparently buggy
1844 getopt in HP-UX that sets optind to the wrong index, and
1845 use RTLD_NEXT on HP-UX instead of RTLD_DEFAULT to dlsym
1848 * include/lightning.h: Rework definitions of wordsize and
1849 byte order to detect proper values on HP-UX.
1851 * lib/lightning.c: Minor correction to use MAP_ANONYMOUS
1852 instead of MAP_ANON on HP-UX.
1854 * lib/jit_hppa.c: Float arguments must be passed on integer
1855 registers on HP-UX, not only for varargs functions.
1856 Add code to properly clear instruction cache. This was
1857 not required on Debian hppa port, but may have been working
1860 * lib/jit_hppa-cpu.c: Follow pattern of HP-UX binaries and
1861 use bve,n instead of bv,n to return from functions.
1863 * lib/jit_hppa-fpu.c: For some reason "fst? frX,rX,(rY)" did
1864 not work on the tested computer (HP-UX B.11.23 U 9000/785 HP-UX)
1865 so the code was changed, at first for __hpux only to add the
1866 base and offset register and use the instruction with an
1867 immediate (zero) offset.
1869 2013-06-07 Paulo Andrade <pcpa@gnu.org>
1871 * check/lightning.c, lib/jit_disasm.c, lib/jit_ppc-cpu.c,
1872 lib/jit_ppc-fpu.c, lib/jit_ppc.c, include/lightning.h,
1873 include/lightning/jit_ppc.h, include/lightning/jit_private.h:
1874 Adapt code to work on 32 bit AIX ppc using gcc. Most changes
1875 are basically to adapt the elf64 logic to 32 bit, as it does
1876 not use the same convention of 32 bit Darwin ppc.
1878 * check/stack.tst: Add a fake memcpy function to the test
1879 case if running under AIX, as it is not available to dlsym.
1881 * configure.ac: Check for getopt.h header, not available in
1884 2013-06-01 Paulo Andrade <pcpa@gnu.org>
1886 * include/lightning/jit_hppa.h, lib/jit_hppa-cpu.c,
1887 lib/jit_hppa-fpu.c, lib/jit_hppa.c: New files implementing
1888 the hppa port. Built on Debian Linux PA-RISC 2.0, 32 bit.
1890 * check/float.tst: Add preprocessor for hppa expected
1891 values when converting NaN and +-Inf to an integer.
1893 * check/ldst.inc: Ensure double load/store tests use an
1894 8 byte aligned address by default.
1896 * lib/lightning.c: Correct a bug found during tests in
1897 the new port, where qmul* and qdiv* were not properly
1898 setting one of the result registers as modified in the
1899 function, what would be a problem if the only "write"
1900 usage were the qmul* or qdiv*.
1902 * check/varargs.tst, check/varargs.ok: Add one extra
1903 interleaved integer/double test to validate proper code
1904 generation in the extra case.
1906 * check/lightning.c, configure.ac, include/lightning.h,
1907 include/lightning/Makefile.am,
1908 include/lightning/jit_private.h, lib/Makefile.am,
1909 lib/jit_disasm.c: Update for the hppa port.
1911 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1913 * check/varargs.tst: Correct misplaced .align directive
1914 that was causing the double buffer to not be aligned at
1916 * lib/jit_ia64-cpu.c:
1917 Properly implement abi for excess arguments passed on
1919 Simplify load/store with immediate displacement argument
1921 Simplify some calls to "subi" changing to "addi" with
1922 a negative argument.
1923 Remove some #if 0'ed code, that could be useful in
1924 special conditions, but the most useful one would be
1925 to "optimize" "static" jit functions, but for the sake
1926 of simplicity, jit functions are implemented in a way
1927 that can be passed back to C code as C function pointers.
1928 Add an attribute to prototypes of several unused functions.
1929 These functions are defined for the sake of implementing all
1930 Itanium documented instructions, but a significant amount of
1931 them is not used by lightning.
1932 * lib/jit_ia64-fpu.c: Simplify load/store with zero immediate
1933 displacement and add unused attribute for functions not used
1934 by lightning, but required to provide macros implementing all
1935 Itanium documented instructions.
1936 * lib/jit_ia64.c: Update for the properly implemented abi
1937 for stack arguments.
1938 * lib/lightning.c: Mark an unused function as such.
1940 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1943 Correct immediate range check of integer comparisons when
1944 inverting arguments.
1945 Correct gei_u that was not decrementing immediate when
1946 inverting arguments.
1947 Correct b?add* and b?sub* that were not properly updating
1948 the result register.
1950 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1952 * lib/jit_ia64-cpu.c: Correct wrong mapping of 2 instructions
1953 in "M-, stop, M-, stop" translation, that was ignoring the
1954 last stop (implemented as a nop I- stop).
1956 * lib/jit_ia64-fpu.c: Properly implement fnorm.s and fnorm.d,
1957 as well as the proper integer to float or double conversion.
1959 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1961 * lib/jit_ia64-cpu.c: Correct bogus implementation of ldr_T
1962 for signed integers, that was using ld1.s, ld2.s and ld4.s.
1963 The ".s" stands for speculative load, not sign extend.
1965 * lib/jit_ia64-fpu.c: Correct bogus implementation of ldxr_T
1966 for float and double. The third (actually, second) argument
1967 is indeed added to the base register, but the base register
1968 is modified. The actual M7 implementation was already correct,
1969 just the ldxr_f and ldxr_d implementation that was kept in
1970 a prototype state, misinterpreting what M7 does.
1972 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1974 * lib/jit_ia64-cpu.c: Correct X2 pattern matching by preventing
1975 it to attempt to require a stop between the L and the X
1976 instruction; that is, check the registers and predicates
1977 before emitting the L instruction, not after.
1979 * lib/jit_ia64-fpu.c: Slightly simplify and correct
1980 divr_f and divrd_d implementation.
1982 * check/lightning.c: Add __ia64__ preprocessor define
1985 * check/alu.inc, check/clobber.tst, check/float.tst: Define
1986 several macros conditionally to __ia64__. This is required
1987 because __ia64__ jit generation can use way too many memory,
1988 due to not implementing instruction reordering to avoid
1989 as much as possible "stops", what causes way too many nops
1990 to be generated, as well as the fact that division and
1991 remainder requires function calls, and float division
1992 requires significant code to implement.
1994 2013-04-27 Paulo Andrade <pcpa@gnu.org>
1996 * include/lightning.h: Add new backend specific movr_w_d,
1997 movr_d_w and movi_d_w codes as helpers to ia64 varargs
1998 functions arguments.
2000 * lib/jit_ia64-cpu.c:
2001 Correct wrong encoding of A5 small integers.
2002 Correct define of "mux" instruction modifiers.
2003 Correct ordering of arguments and predicates of cmp_xy
2004 implementation with immediate arguments; like most other
2005 codes with an immediate, the immediate is the second, not
2008 * lib/jit_ia64-fpu.c: Actual implementation of the code
2009 to move to/from gpr to/from fpr, to implement varargs abi.
2011 * lib/jit_ia64.c: Make fpr argument registers not allocatable
2012 as temporaries, no need for the extra checks when there are
2015 * lib/jit_print.c, lib/lightning.c: Minor updates for the
2016 new movr_w_d, movr_d_w and movi_d_w codes.
2018 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2020 * lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c: Correct code to
2021 also insert a stop to break an instruction group if a
2022 register is written more than once in the same group.
2023 This may happen if a register is argument and result of
2024 some lightning call (not a real instruction). The most
2025 common case should be code in the pattern:
2029 where "rn" would end up holding "largenum".
2030 But the problem possibly could happen in other circumstances.
2032 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2034 * include/lightning/jit_ia64.h, lib/jit_ia64-cpu.c,
2035 lib/jit_ia64-fpu.c, lib/jit_ia64.c:
2036 Relocate JIT_Rn registers to the local registers, as, like
2037 float registers, div/rem and sqrt are implemented as function
2038 calls, and may overwrite non saved scratch registers.
2039 Change patch_at to receive a jit_code_t instead of a
2040 jit_node_t, so that it is easier to "inline" patches when
2041 some instruction requires complex code to implement, e.g.
2043 Correct arguments to FMA and FMA like instructions that,
2044 due to a cut&paste error were passing the wrong argument
2045 to the related F- implementation function.
2046 Rewrite ltgt to return the proper result if one (or both)
2047 of the arguments is unordered.
2049 2013-04-26 Paulo Andrade <pcpa@gnu.org>
2051 * include/lightning/jit_ia64.h, include/lightning/jit_private.h,
2052 lib/jit_ia64-cpu.c, lib/jit_ia64-fpu.c, lib/jit_ia64.c,
2053 lib/lightning.c: Rework code to detect need of a "stop" to
2054 also handle predicates, as if a predicate is written, it
2055 cannot be read in the same instruction group.
2056 Use a single jit_regset_t variable for all registers when
2057 checking need for a stop (increment value by 128 for
2059 Correct wrong "subi" implementation, as the code executed
2060 is r0=im-r1, not r0=r1-im.
2061 Use standard lightning 6 fpr registers, and rework to
2062 use callee save float registers, that may be spill/reloaded
2063 in prolog/epilog. This is required because some jit
2064 instructions implementations need to call functions; currently
2065 integer div/mod and float sqrt, what may change the value of
2066 scratch float registers.
2067 Rework point of "sync" of branches that need to return a
2068 patch'able address, because the need for a "stop" before a
2069 predicate read causes all branches to be the instruction
2070 in slot 0, as there is no template to "stop" and branch
2071 in the same instruction "bundle".
2073 2013-04-25 Paulo Andrade <pcpa@gnu.org>
2075 * include/lightning/jit_ia64.h, lib/jit_ia64-cpu.c,
2076 lib/jit_ia64-fpu.c, lib/jit_ia64.c: New files implementing
2077 the basic infrastructure of an Itanium port. The code
2078 compiles and can generate jit for basic hello world like
2081 * check/lightning.c, configure.ac, include/lightning.h,
2082 include/lightning/Makefile.am, include/lightning/jit_private.h,
2083 lib/Makefile.am, lib/lightning.c: Update for the Itanium
2086 * lib/jit_mips-cpu.c, lib/jit_mips.c: Correct typo and
2087 make the jit_carry register local to the jit_state_t.
2088 This matches code reviewed in the Itanium port, that
2089 should use the same base logic to handle carry/borrow.
2091 2013-04-10 Paulo Andrade <pcpa@gnu.org>
2093 * include/lightning/jit_private.h, lib/jit_arm.c,
2094 lib/jit_mips-cpu.c, lib/jit_mips.c, lib/jit_ppc-cpu.c,
2095 lib/jit_ppc.c, lib/jit_print.c, lib/jit_sparc-cpu.c,
2096 lib/jit_sparc.c, lib/jit_x86-cpu.c, lib/jit_x86.c,
2097 lib/lightning.c: Change all jit_regset macros to take
2098 a pointer argument, to avoid structure copies when
2099 adding a port to an architecture with more than 64
2102 2013-04-08 Paulo Andrade <pcpa@gnu.org>
2104 * lib/jit_arm.c, lib/jit_ppc.c: Do not rely on __clear_cache
2105 aligning to the next page boundary the end argument. It may
2106 actually truncate it.
2108 2013-03-29 Paulo Andrade <pcpa@gnu.org>
2110 * include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_memory.c,
2111 lib/jit_mips.c, lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c,
2112 lib/lightning.c: Do not start over jit generation if can grow
2113 the code buffer with mremap without moving the base pointer.
2115 2013-03-29 Paulo Andrade <pcpa@gnu.org>
2117 * lib/jit_memory.c: Implement a simple memory allocation wrapper
2118 to allow overriding calls to malloc/calloc/realloc/free, as well
2119 as ensuring all memory containing pointers is zero or points to
2122 * include/lightning.h, include/lightning/jit_private.h: Definitions
2123 for the memory allocation wrapper.
2125 * lib/Makefile.am: Update for new jit_memory.c file.
2127 * lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_note.c,
2128 lib/jit_ppc.c, lib/jit_sparc.c, lib/jit_x86.c, lib/lightning.c:
2129 Use the new memory allocation wrapper code.
2131 2013-03-22 Paulo Andrade <pcpa@gnu.org>
2133 * configure.ac, include/lightning/jit_private.h, lib/lightning.c:
2134 Remove dependency on gmp. Only a simple bitmap was required, and
2135 that was not enough reason to force linking to gmp and possible
2136 complications caused by it.
2138 2013-03-10 Paulo Andrade <pcpa@gnu.org>
2140 * include/lightning.h: Add check for __powerpc__ defined
2141 in Linux, while Darwin defines __ppc__.
2143 * include/lightning/jit_ppc.h: Adjust register definitions
2144 for Darwin 32 bit and Linux 64 bit ppc usage and/or ABI.
2146 * include/lightning/jit_private.h: Add proper check for
2147 Linux __powerpc__ and an data definition for an workaround
2148 to properly handle code that starts with a jump to a "main"
2151 * lib/jit_disasm.c: Add extra disassembler initialization
2154 * lib/jit_ppc-cpu.c: Add extra macros and functions, and
2155 correct/adapt previous ones to handle powerpc64.
2157 * lib/jit_ppc-fpu.c: Adapt for 64 bit wordsize. Basically
2158 add conversion from/to int32/int64 and proper handling of
2159 load/store offsets too large for 32 bit.
2161 * lib/jit_ppc.c: Add calls to 64 bit codes and adaptation
2162 for the PowerPC 64 bit Linux ABI.
2164 * lib/jit_arm.c, lib/jit_mips.c, lib/jit_sparc, lib/jit_x86.c,
2165 lib/lightning.c: Correct off by one error when restarting jit
2166 of a function due to finding too late that needs to spill/reload
2167 some register. Problem was found by accident on a very special
2168 condition during PowerPC 64 code adaptation.
2170 2013-03-08 Paulo Andrade <pcpa@gnu.org>
2172 * check/lightning.c: Add missing ppc preprocessor definition.
2174 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2176 * check/float.tst: Comment out the int to negative infinity
2177 test in mips for the moment because not all Loongson agrees
2180 * lib/jit_disasm.c: Add a test instead of an assertion
2181 when loading symbols for disassembly due to a failure with
2182 a simple binutils build in Debian mipsel64.
2184 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2186 * include/lightning/jit_private.h, lib/jit_arm-cpu.c,
2187 lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips-cpu.c,
2188 lib/jit_mips.c, lib/jit_note.c, lib/jit_ppc-cpu.c,
2189 lib/jit_ppc.c, lib/jit_print.c, lib/jit_sparc-cpu.c,
2190 lib/jit_sparc.c, lib/jit_x86-cpu.c, lib/jit_x86.c,
2191 lib/lightning.c: Add an extra structure for data storage
2192 during jit generation, and release it after generating
2193 jit, to reduce a bit memory usage, and also to make it
2194 easier to understand what data is available during
2197 2013-03-06 Paulo Andrade <pcpa@gnu.org>
2199 * lib/lightning.c: Make data and code buffer readonly.
2201 2013-02-20 Paulo Andrade <pcpa@gnu.org>
2203 * doc/body.texi: Fool proof validate the examples of what
2204 an assembly-language programmer would write and correct the
2205 wrong sparc example.
2207 2013-02-19 Paulo Andrade <pcpa@gnu.org>
2209 * doc/body.texi: Add back the SPARC code generation example.
2211 2013-02-19 Paulo Andrade <pcpa@gnu.org>
2213 * check/lightning.c: Remove state flag to work with partial
2214 sparc port, by just disassembling if there was incomplete
2217 * jit_sparc-cpu.c: Correct wrong range check for immediate
2218 integer constants (off by one bit shift).
2219 Correct macro implementing equivalent "rd %y, rd" assembly.
2220 Implement qmul* and qdiv*.
2222 * jit_sparc.c: Update for qmul* and qdiv* and remove logic
2223 to handle incomplete code generation during sparc port.
2225 2013-02-18 Paulo Andrade <pcpa@gnu.org>
2227 * check/float.tst: Add sparc to list of known NaN and +-Inf
2228 to integer conversion.
2230 * check/lightning.c: Define __sparc__ to preprocessor in
2233 * include/lightning/jit_private.h: Correct wrong definition
2234 of emit_stxi_d, that has lived for a long time, but would
2235 cause problems whenever needing to spill/reload a float
2238 * include/lightning/jit_sparc.h: Can only use %g2,%g3,%g4
2239 for scratch variables, as other "global" registers are
2240 reserved for the system, e.g. libc.
2241 Reorder float register naming to make it easier to
2242 access odd float registers, so that generating code for
2243 pusharg and getarg is easier for the IR.
2245 * lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c: Update to match
2246 new code in jit_sparc-cpu.c. It must call jit_get_reg
2247 with jit_class_nospill if using the register to move
2248 an unconditional branch address to it, as the reload
2249 will not happen (actually could happen in the delay
2252 * lib/jit_sparc-cpu.c: Correct wrong macro definition for
2254 Properly implement div* and implement rem. Div* needs
2255 to use the y register, and rem* needs to be synthesized.
2256 Correct b?sub* macro definitions.
2258 * lib/jit_sparc-fpu.c: Correct reversed float to/from double
2260 Correct wrong jit_get_reg call asking for a gpr and then
2261 using the fpr with that number.
2262 Correct wrong branch displacement computation for
2263 conditional branches.
2265 * lib/jit_sparc.c: Correct getarg_d and pushargi_d implementation.
2266 Add rem* entries to the switch converting IR to machine code.
2268 * lib/lightning.c: Correct a problem detected when adding
2269 the jit_class_nospill flag to jit_get_reg, that was caused
2270 when having a branch to an "epilog" node, what would cause
2271 the code to think all registers in unknown state were live,
2272 while in truth, all registers in unknown state in the
2273 "just after return" point are actually dead.
2275 2013-02-17 Paulo Andrade <pcpa@gnu.org>
2277 * include/lightning/jit_sparc.h, lib/jit_sparc-cpu.c,
2278 lib/jit_sparc-fpu.c, lib/jit_sparc.c: New files implementing
2279 the basic framework of the sparc port.
2281 * configure.ac, include/lightning.h, include/lightning/Makefile.am,
2282 include/lightning/jit_private.h, lib/jit_disasm.c: Update
2283 for the sparc port framework.
2285 * lib/jit_mips.c: Correct reversed retr/reti logic.
2287 * lib/jit_ppc.c: Correct misspelled __LITTLE_ENDIAN.
2289 * lib/lightning.c: Always do byte hashing in hash_data, because
2290 the logic to "compress" strings causes large pointers to not
2291 be guaranteed aligned at 4 byte boundaries.
2292 Update for the sparc port framework.
2294 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2296 * lib/jit_arm.c: Correct jit_pushargi_f in the arm hardfp abi.
2297 Most of the logic uses even numbered register numbers, so that
2298 a float and a double can be used in the same register, but
2299 the abi requires packing the float arguments, so jit_pushargi_f
2300 needs to allocate a temporary register to modify only the
2301 proper register argument (or be very smart to push two
2302 immediate arguments if applicable).
2304 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2306 * include/lightning.h, lib/lightning.c: Implement the new
2307 jit_clear_state and jit_destroy_state calls. jit_clear_state
2308 releases all memory not required during jit_execution; that
2309 is, leaves only the mmap'ed data and code buffers allocated.
2310 jit_destroy_state releases the mmap'ed buffers as well as
2311 the jit_state_t object itself, that holds pointers to the
2312 code and data buffers, as well as annotation pointers (for
2313 disassembly or backtrace) in the data buffer.
2315 * lib/jit_note.c: Correct invalid vector offset access.
2317 * check/ccall.c, check/lightning.c, doc/ifib.c, doc/incr.c,
2318 doc/printf.c, doc/rfib.c, doc/rpn.c: Use the new jit_clear_state
2319 and jit_destroy_state calls, to demonstrate the new code to
2320 release all jit memory.
2322 * doc/body.texi: Add basic documentation and usage description
2323 of jit_clear_state and jit_destroy_state.
2325 2013-02-11 Paulo Andrade <pcpa@gnu.org>
2327 * include/lightning/jit_private.h, lib/jit_note.c, lib/lightning.c:
2328 Store all annotation information in the mmap'ed area reserved for
2329 read only data. This adds code to not allocate memory for jit_note_t
2330 objects, and to relocate jit_line_t objects and its contents after
2331 calculating annotation information. The jit_line_t objects are
2332 relocated because it is not possible to always calculate before
2333 hand data layout because note information may be extended or
2334 redundant entries removed, as well as allowed to be added in
2335 non sequential order.
2336 A bug was also corrected in _jit_set_note, that was causing it
2337 to allocate new jit_line_t objects when not needed. It was still
2338 working correctly, but allocating way more memory than required.
2340 2013-02-05 Paulo Andrade <pcpa@gnu.org>
2342 *include/lightning.h, lib/lightning.c: Add the new jit_live code
2343 to explicitly mark a register as live. It is required to avoid
2344 assuming functions always return a value in the gpr and fpr return
2345 register, and to avoid the need of some very specialized codes
2346 that vary too much from backend to backend, to instruct the
2347 optimization code the return register is live.
2349 * lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
2350 lib/jit_x86.c: Update for the new jit_live code.
2352 * check/ret.ok, check/ret.tst: New files implementing a simple
2353 test case that would previously fail at least in ix86/x86_64.
2355 * check/Makefile.am: Update for new "ret" test case.
2357 2013-02-05 Paulo Andrade <pcpa@gnu.org>
2359 * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Validate and correct
2360 problems in the qmul and qdiv ppc implementation.
2362 2013-02-04 Paulo Andrade <pcpa@gnu.org>
2364 * include/lightning.h, include/lightning/jit_private.h,
2365 lib/jit_arm-cpu.c, lib/jit_arm.c, lib/jit_mips-cpu.c,
2366 lib/jit_mips.c, lib/jit_ppc-cpu.c, lib/jit_ppc.c,
2367 lib/jit_x86-cpu.c, lib/jit_x86.c, lib/lightning.c:
2368 Implement the new qmul and qdiv instructions that return signed
2369 and unsigned lo/hi multiplication result and div/rem division result.
2370 These should be useful for jit translation of code that needs to
2371 know if a multiplication overflows (no branch opcode added) or if
2372 a division is exact (easy check if remainder is zero).
2374 * check/lightning.c, lib/jit_print.c, check/Makefile.am,
2375 check/all.tst: Update for the new qmul and qdiv instructions.
2377 * check/qalu.inc, check/qalu_div.ok, check/qalu_div.tst,
2378 check/qalu_mul.ok, check/qalu_mul.tst: New files implementing
2379 simple test cases for qmul and qdiv.
2381 2013-01-30 Paulo Andrade <pcpa@gnu.org>
2383 * doc/body.texi: Correct "jmpi" description that incorrectly
2384 told it was possible to pass any address as jump target. The
2385 only way to do that is "movi+jmpr".
2387 2013-01-30 Paulo Andrade <pcpa@gnu.org>
2389 * lib/jit_x86-cpu.c: Correct undefined behavior code.
2390 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56143
2392 2013-01-29 Paulo Andrade <pcpa@gnu.org>
2394 * configure.ac: Use AC_CONFIG_HEADERS instead of AC_CONFIG_HEADER
2395 to have HAVE_CONFIG_H defined with latest aclocal.
2397 * include/lightning/jit_private.h, lib/lightning.c: Add new
2398 abstraction to use an heuristic to calculate amount of space
2399 required for jit generation, and code to reallocate buffer if
2400 did miscalculate it.
2402 * lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_x86.c:
2403 Update to use new code to estimate and resize of required buffer
2406 * lib/jit_x86-cpu.c: Minor cosmetic change to avoid adding a
2407 non required rex prefix when calling a function pointer stored
2410 2013-01-24 Paulo Andrade <pcpa@gnu.org>
2412 * check/Makefile.am: "make debug" target should pass only
2413 the main test tool program as argument for running gdb
2415 * configure.ac: Add the --enable-assertions options.
2417 * doc/Makefile.am, doc/body.texi, doc/lightning.texi:
2418 Major rewrite of the documentation to match the current
2421 * doc/version.texi: Automatic date update.
2423 * doc/ifib.c, doc/incr.c, doc/printf.c, doc/rfib.c, doc/rpn.c:
2424 Implementation of the documentation examples, that are also
2425 compiled during a normal build.
2427 * doc/p-lightning.texi, doc/porting.texi, doc/toc.texi,
2428 doc/u-lightning.texi, doc/using.texi: These files were
2429 renamed in the documentation rewrite, as the documentation
2430 was significantly trimmed due to full removal of the porting
2431 chapters. Better porting documentation should be added but
2432 for the moment it was just removed the documentation not
2433 matching the implementation.
2435 2013-01-18 Paulo Andrade <pcpa@gnu.org>
2437 * lib/jit_note.c: Correct bounds check and wrong code keeping
2438 a pointer that could be changed after a realloc call.
2440 2013-01-18 Paulo Andrade <pcpa@gnu.org>
2442 * check/3to2.tst, check/add.tst, check/allocai.tst, check/bp.tst,
2443 check/call.tst, check/ccall.c, check/clobber.tst, check/divi.tst,
2444 check/fib.tst, check/ldsti.tst, check/ldstr-c.tst, check/ldstr.tst,
2445 check/ldstxi-c.tst, check/ldstxi.tst, check/ldstxr-c.tst,
2446 check/ldstxr.tst, check/lightning.c, check/rpn.tst, check/stack.tst,
2447 check/varargs.tst, include/lightning.h,
2448 include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_disasm.c,
2449 lib/jit_mips.c, lib/jit_note.c, lib/jit_ppc.c, lib/jit_print.c,
2450 lib/jit_x86.c, lib/lightning.c: Extend the "jit_note" abstraction
2451 with the new "jit_name" call, that receives a string argument, and
2452 should usually be called to mark boundaries of functions of code
2453 generating jit (that is, it is not expected that the language
2454 generating jit map its functions to jit functions).
2456 2013-01-17 Paulo Andrade <pcpa@gnu.org>
2458 * check/add.tst, check/allocai.tst, check/bp.tst, check/divi.tst,
2459 check/fib.tst, check/lightning.c, include/lightning/jit_arm.h,
2460 include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
2461 include/lightning/jit_private.h, include/lightning/jit_x86.h:
2462 Make JIT_RET, JIT_FRET and JIT_SP private. These should not be
2463 used in any operations due to frequently having special
2464 constraints (usually JIT_FRET). JIT_FP must be made available
2465 because it must be used as the base register to access stack
2466 space allocated with jit_allocai.
2468 2013-01-14 Paulo Andrade <pcpa@gnu.org>
2470 * include/lightning.h, lib/lightning.c: Add an extra align
2471 argument to the jit_data call (that should be made private),
2472 so that it should not align strings at 8 bytes.
2473 Correct the jit_note call to include the null ending byte
2474 when adding label/note names to the "jit data section".
2476 2013-01-11 Paulo Andrade <pcpa@gnu.org>
2478 * lib/jit_note.c: New file implementing a simple string+integer
2479 annotation, that should be used to map filename and line number
2480 to offsets in the generated jit.
2482 * include/lightning.h, lib/lightning.c: Update for the new
2484 Add an extra mandatory argument to init_jit, that is used
2485 as argument to bfd_openr.
2486 Change from generic void* to char* the argument to jit_note
2487 and add an extra integer argument, to map to filename and
2490 * check/ccall.c, check/lightning.c, include/lightning/jit_private.h,
2491 lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_ppc.c,
2492 lib/jit_print.c, lib/jit_x86.c: lib/Makefile.am: Update for the
2493 new annotation code.
2495 * configure.ac, check/Makefile.am: Update to work with latest
2498 2013-01-09 Paulo Andrade <pcpa@gnu.org>
2500 * include/lightning.h, lib/jit_arm.c, jit_mips-fpu.c,
2501 lib/jit_mips.c, lib/jit_print.c, lib/jit_x86.c, lib/lightning.c:
2502 Remove the jit_code_getarg_{f,d} and jit_code_pusharg{i,r}_{f,d}
2503 calls, replacing them with the new, internal only, jit_movr_w_f,
2504 jit_mov{r,i}_f_w, jit_movr_ww_d, and jit_mov{i,r}_d_ww, that
2505 better describe the operation being done, and allow removing
2506 the hackish code to detect special conditions for arm when
2507 moving from/to vfp from/to a grp register pair.
2508 Rename jit_code_retval_{f,d} to jit_code_x86_retval_{f,d} as
2509 it is specific to 32 bit x86, and used to move abi return
2510 value in x87 register to a sse register.
2512 2013-01-05 Paulo Andrade <pcpa@gnu.org>
2514 * check/cccall.c, check/ccall.ok: New test case to validate
2515 interleaved calls from/to C code and jit.
2517 * check/Makefile.am: Update for the new ccall test case.
2519 * include/lightning.h, lib/lightning.c: Add the new jit_address
2520 call that returns the real/final address of a "note" in the
2521 generated jit. It requires a jit_node_t as returned by the
2522 jit_note call, and is only valid after calling jit_emit.
2523 Add an intermediate solution to properly handle arm
2524 soft and softfp modes that move a double to an integer register
2525 pair. Currently it just adds extra tests for the condition,
2526 but the proper solution should be to have extra lightning
2527 codes for these conditions, codes which should be only used
2528 by the backends that need it, and merged with the existing
2531 * include/lightning/jit_private.h: Add new jit_state_t flag
2532 to know it finished jit_emit, so that calls to jit_address
2535 * lib/jit_mips.c: Correct abi implementation so that the
2536 new ccall test case pass. Major problem was using
2537 _jit->function.self.arg{i,f} as boolean values, but that
2538 would cause lightning.c:patch_registers() to incorrectly
2539 assume only one register was used as argument when calling
2540 jit_regarg_p(); _jit->function.self.arg{i,f} must be the
2541 number of registers used as arguments (in all backends).
2543 * lib/jit_x86.c: Add workaround, by marking %rax as used,
2544 to a special condition, when running out of registers and the
2545 allocator trying to spill and reload %rax, but %rax was used
2546 as a pointer to a function, what would cause the reload to
2547 destroy the return value. This condition can be better
2548 generalized, but the current solution is good enough.
2550 * include/lightning/jit_ppc.h, lib/jit_ppc-cpu.c, lib/jit_ppc.c:
2551 Rewrite logic to handle arguments, as the original code was
2552 written based on a SysV pdf about the generic powerpc ABI,
2553 what did "invent" a new abi for the previous test cases, but
2554 failed in the new ccall test in Darwin PPC. Now it properly
2555 handles 13 float registers for arguments, as well as proper
2556 computation of stack offsets when running out of registers
2559 2013-01-02 Paulo Andrade <pcpa@gnu.org>
2561 * check/float.tst: Correct test case to match ppc also
2562 converting positive infinity to 0x7fffffff.
2564 * lib/jit_arm-swf.c: Correct typos with double underscores.
2566 * lib/lightning.c: Correct remaining wrong reverse jump logic.
2568 2012-12-29 Paulo Andrade <pcpa@gnu.org>
2570 * lib/lightning.c: Correct both, wrong and confusing logic
2571 to compute the reverse of a jump. Now it properly matches
2572 C semantics for "eq" (==) and "ne" (!=) and correct computation
2573 of reverse of "uneq" as "gt".
2575 * check/branch.tst: Update "ne" float branch check that
2576 previously happened to be wrongly tested with a NaN argument.
2578 2012-12-29 Paulo Andrade <pcpa@gnu.org>
2580 * check/float.ok, check/float.tst: New test cases implementing
2581 extensive validation of float comparison and branch code
2582 generation as well as integer conversion, involving NaN and
2585 * lib/jit_arm-swf.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
2586 Correct bugs found by new float test case.
2588 * lib/jit_x86.c: Correct cut&paste error added in commit to
2589 convert jit_arg* return value to a jit_node_t*, that would
2590 cause it to not properly handle double arguments in ix86.
2592 * check/Makefile.am: Update for the new test case.
2594 2012-12-28 Paulo Andrade <pcpa@gnu.org>
2596 * check/lightning.c, include/lightning.h, lib/jit_arm.c,
2597 lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c, lib/jit_x86.c,
2598 lib/lightning.c: Change return value of jit_arg{,_f,_d} to
2599 a jit_node_t* object, that should be used as argument to
2600 jit_getarg_{c,uc,s,us,i,ui,l,f,d}. This just requires changing
2601 from jit_int32_t to jit_pointer_t (or jit_node_t*) the "handle"
2602 for the getarg calls, with the benefit that it makes it easy
2603 to implement patching of the stack address of non register
2604 arguments, this way allowing to implement variable size stack
2605 frames if applicable; useful if there are too many registers and
2606 jit functions uses only a few callee save registers.
2608 2012-12-27 Paulo Andrade <pcpa@gnu.org>
2610 * lib/jit_arm.c, lib/jit_mips-cpu.c, lib/jit_mips.c: Correct
2611 regressions when patching jit_calli for a forward function.
2613 * lib/jit_ppc-cpu.c: Correct wrong arguments to ANDI opcode
2614 in jit_getarg_u{c,s} implementation.
2616 2012-12-23 Paulo Andrade <pcpa@gnu.org>
2618 * check/call.ok, check/call.tst: New test cases to validate
2619 simple typed argument and return values in function calls.
2621 * check/lightning.c: Properly handle jit_movi of labels for
2622 backward and forward code labels.
2624 * check/Makefile.am: Update for new test case.
2626 2012-12-23 Paulo Andrade <pcpa@gnu.org>
2628 * check/carry.ok, check/carry.tst: New test case to validate
2629 carry condition handling.
2631 * check/Makefile.am: Update for new test case.
2633 2012-12-22 Paulo Andrade <pcpa@gnu.org>
2635 * lib/jit_ppc-cpu.c, lib/jit_ppc.c: Implement logic for
2636 jit_htonr for big endian, so that ppc (big endian) pass the
2637 new clobber.tst test case.
2639 2012-12-22 Paulo Andrade <pcpa@gnu.org>
2641 * lib/jit_arm.c: Correct use of wrong argument offset
2642 variable in armv7l or float/double argument for varargs
2643 function in armv7hl.
2644 Correct jit_getarg* logic in software float mode to
2645 match expected behavior in other backends, that is, if
2646 a function is not called, it is safe to use a few lightning
2647 calls before a next jit_getarg* call, as done in the test
2648 case check/stack.tst. The proper solution should be to
2649 extend the parser in lib/lightning.c to check if there is
2650 some float operation that will call some (libgcc?) function,
2651 but software float arm should be a very uncommon backend for
2652 lightning, so, just load the already in place arguments
2653 saved to stack, assuming the register argument was clobbered
2654 (what should not be the case most times...).
2656 2012-12-22 Paulo Andrade <pcpa@gnu.org>
2658 * check/clobber.ok, check/clobber.tst: New test case doing
2659 extensive validation tests to ensure registers not used in
2660 a operation are not clobbered.
2662 * check/Makefile.am: Update for new test case.
2664 2012-12-21 Paulo Andrade <pcpa@gnu.org>
2666 * lib/lightning.c: Partially rewrite/revert code to compute
2667 initial register live state at the start of a basic block.
2668 The original logic was corrupted when adding optimizations
2669 to do as few computations as possible in jit_update. The
2670 reglive field must be always a known set of live registers
2671 at the start of a basic block. The value that was incorrect
2672 was the regmask field, that must be the set of registers
2673 that are in unknown state, because they are not known live,
2674 neither set (or possibly not set) in the basic block, and
2675 *must* store the state at the start of the basic block.
2677 2012-12-20 Paulo Andrade <pcpa@gnu.org>
2679 * include/lightning/jit_ppc.h: Correct mismatch of JIT_F{1,5}
2680 with enum codes, that were correct, and returned by jit_f().
2682 * lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: Properly
2683 implement and better describe values when generating stack
2686 2012-12-18 Paulo Andrade <pcpa@gnu.org>
2688 * check/stack.ok, check/stack.tst: New files to test data
2689 integrity on a deep chain of stack frames.
2691 * lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
2692 lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
2693 lib/jit_x86.c, lib/jit_x86-cpu.c: Calculate _jit->function->stack
2694 in the emit stage, otherwise it will calculate it wrong if
2695 need to jit_allocai space to spill registers.
2697 * lib/lightning.c: Correct wrong offset when updating the
2698 "current" jit function pointer in the code that may need to
2699 allocate stack space to spill registers.
2701 * check/lightning.c: Correct off by one data space check.
2703 * check/Makefile.am: Update for new test case.
2705 2012-12-17 Paulo Andrade <pcpa@gnu.org>
2707 * check/fop_abs.ok, check/fop_abs.tst, check/fop_sqrt.ok,
2708 check/fop_sqrt.tst: New files implementing simple test cases
2709 for the extra float operations.
2711 * check/Makefile.am: Update for new test cases.
2713 * check/alu.inc: Add an extra macro to check for unordered
2714 equality on tests where it is expected to use NaN as an
2717 * check/lightning.c: Minor change for proper/common argument
2718 syntax handling ommiting arguments to options.
2720 2012-12-17 Paulo Andrade <pcpa@gnu.org>
2722 * check/Makefile.am: Automatically generate pattern list
2723 of tests with alternate jit generation options. This should
2724 prevent typos and needing to change multiple places after
2727 2012-12-14 Paulo Andrade <pcpa@gnu.org>
2729 * check/lightning.c: Remove the ".cpu name value" syntax,
2730 as it was not able to do proper changes before the jit
2731 internal data structure was initialized. Now it supports
2732 several getopt options to force using different jit
2733 generation options, effectively replacing the previous
2736 * check/run-test: Add simple extra logic to handle differently
2737 named test scripts, used to test things like x87 coprocessor
2738 in ix86, and arm instruction set or software float in armv7l.
2740 * configure.ac: Add some AC_RUN_IFELSE calls to figure at
2741 compile time if can test different code generation options,
2742 and update Makefile generation accordingly.
2744 * check/Makefile.am, lib/jit_arm.c, lib/jit_x86.c: Update to
2745 properly work with the test tool updating the jit_cpu global
2748 * check/check.arm.sh, check/check.swf.sh, check/check.x87.sh:
2749 New wrapper files passing -mthumb=0, mvfp=0 and -mx87=1 to
2750 the test tool, if applicable, so that it can validate alternate
2751 code generation options on test hosts that support them.
2753 2012-12-14 Paulo Andrade <pcpa@gnu.org>
2755 * lib/jit_x86-x87.c, lib/jit_x86.c: Correct test cases in ix86
2756 when using the x87 coprocessor instead of sse2+.
2758 2012-12-14 Paulo Andrade <pcpa@gnu.org>
2760 * include/lightning.h, include/lightning/jit_private.h,
2761 lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_x86.c,
2762 lib/lightning.c: Make jit_ellipsis implementation not
2763 backend specific. It is not intended to handle va_list
2764 like objects at runtime, as jit_arg* and jit_getarg*
2765 return constant values resolved at parse time, so, effectively
2766 it is not possible to create printf like jit functions, as
2767 there is no va_start, va_arg, va_end, etc, abstraction. This
2768 limitation should be kept for the sake of making new ports
2771 2012-12-14 Paulo Andrade <pcpa@gnu.org>
2773 * include/lightning.h, lib/lightning.c: Add two extra wrapper
2774 functions to avoid need for excess pointer to/from word casts.
2776 * check/lightning.c: Only need for pointer to/from word cast
2777 now is jit_movi, update accordingly.
2779 2012-12-13 Paulo Andrade <pcpa@gnu.org>
2781 * check/varargs.ok, check/varargs.tst: New test cases implementing
2782 simple varargs calls with a large amount of arguments to exercise
2783 excess arguments on stack.
2785 * include/lightning.h: Include config.h if HAVE_CONFIG_H is
2788 * lib/jit_arm.c: Allocate a fpr register, not a gpr one for
2789 temporary when pushing varargs arguments in the stack.
2791 * lib/jit_arm-swf.c: Correct code changing the wrong offset
2792 in jit_absr_d and jit_negr_d in software float.
2794 * lib/jit_mips.c: Correct calculation of offsets of arguments
2797 * lib/jit_ppc.c: Correct bogus logic for "next" offset of arguments
2798 on stack and adjust for fixed offset of stack arguments.
2800 2012-12-12 Paulo Andrade <pcpa@gnu.org>
2802 * include/lightning.h, lib/jit_arm.c, lib/jit_mips.c,
2803 lib/jit_ppc.c, lib/jit_x86.c, lib/lightning.c: Change jit_prepare
2804 to no longer receive an argument. If receiving an argument, it
2805 should be an ABI specifier, not a boolean if varargs or not,
2806 and add the new jit_ellipsis call, to specify where the
2807 ellipsis is in the C prototype of the function being called.
2808 Note that currently it is not supported to define varargs
2809 functions and it will be ignored if calling jit_ellipsis not
2810 in a prepare/finish* block, but this should be addressed.
2812 * check/allocai.tst, check/alu_add.tst, check/alu_and.tst,
2813 check/alu_com.tst, check/alu_div.tst, check/alu_lsh.tst,
2814 check/alu_mul.tst, check/alu_neg.tst, check/alu_or.tst,
2815 check/alu_rem.tst, check/alu_rsh.tst, check/alu_sub.tst,
2816 check/alu_xor.tst, check/alux_add.tst, check/alux_sub.tst,
2817 check/bp.tst, check/branch.tst, check/cvt.tst, check/divi.tst,
2818 check/fib.tst, check/ldsti.tst, check/ldstr-c.tst,
2819 check/ldstr.tst, check/ldstxi-c.tst, check/ldstxi.tst,
2820 check/ldstxr-c.tst, check/ldstxr.tst, check/rpn.tst,
2821 check/lightning.c: Update for the change to jit_prepare and
2822 addition of jit_ellipsis.
2824 2012-12-11 Paulo Andrade <pcpa@gnu.org>
2826 * lib/jit_ppc-cpu.c: Make movr a function that checks arguments
2827 so that other code can safely assume it is a noop if src and dst
2828 are the same register.
2829 Implement rem{r,i}{,_u} as a div{,u}/mul/sub.
2830 Correct ANDIS, ORIS and XORIS calls to cast the argument to
2831 unsigned before the shift to avoid an assertion if the argument
2832 had the topmost bit set.
2833 Implement lshi, rshi and rshi_u as functions to test for a
2834 zero argument, that would otherwise trigger an assertion when
2835 computing the shift value.
2836 Do a simple implementation of bm{s,c}{r,i} with a temporary,
2837 "andr" of arguments and jump based on comparison with zero.
2838 Correct typo in ldxi_c.
2840 * lib/jit_ppc-fpu.c: Correct wrong arguments to FDIV* and STF*.
2842 * lib/jit_ppc.c: Correct wrong check for 6 instead of 8 integer
2843 arguments in registers. If calling a varargs function and
2844 passing a float or double argument, also either store the
2845 value in the stack or in integer registers, as varargs functions
2846 do not fetch it from float registers.
2847 Add "case" for new functions and incorrectly missing ones.
2848 Call libgcc's __clear_cache, that should know what to do
2849 if the hardware needs flushing cache before execution.
2851 * lib/lightning.c: Do a simple/trivial logic in jit_regset_scan1,
2852 that should make it easier for the compiler to optimize it, and
2853 that also corrects the previously wrong code for big endian, and
2854 that was causing problems in ppc due to not saving all callee save
2855 registers as it was not "finding" them in the regset due to the
2856 little endian assumption bug.
2858 2012-12-11 Paulo Andrade <pcpa@gnu.org>
2860 * configure.ac: Only default to using the builtin disassembler
2861 if on GNU/Linux. This should be temporary, due to requiring
2863 Correctly check $target_cpu for powerpc.
2865 * include/lightning/jit_ppc.h: Correctly implement jit_v_num.
2867 * include/lightning/jit_private.h: Declare proper prototype
2868 for jit_init_debug and jit_finish_debug.
2870 * lib/jit_ppc-cpu.c: Remove code to save/restore callee save
2871 float registers, as it is not required since those float
2872 registers are not usable currently.
2873 Change prolog and epilog generation to, at least comparing
2874 code, match what gcc generates in "gcc -O0", but it is still
2875 failing in Darwin PPC, apparently due to the __clear_cache
2876 call not being enough, as frequently it will also fail to
2877 execute, and the code buffer is all zeroes.
2879 * lib/lightning.c: Do not fail in jit_regset_scan1 calls due
2880 to passing 64 as argument on computers with 64 registers.
2882 2012-12-10 Paulo Andrade <pcpa@gnu.org>
2884 * lib/jit_mips-cpu.c: Correct all current test cases.
2885 Call the "xori" not the "XORI" macro for jit_xori implementation,
2886 as the XORI macro handles only 16 bit unsigned values.
2887 Call the "movr" macro, not the "movi" macro in the special
2888 case of adding or subtracting zero.
2889 Use the proper temporary register in the jit_andr implementation.
2891 2012-12-09 Paulo Andrade <pcpa@gnu.org>
2893 * check/alu.inc, check/alu_add.ok, check/alu_add.tst,
2894 check/alu_and.ok, check/alu_and.tst, check/alu_com.ok,
2895 check/alu_com.tst, check/alu_div.ok, check/alu_div.tst,
2896 check/alu_lsh.ok, check/alu_lsh.tst, check/alu_mul.ok,
2897 check/alu_mul.tst, check/alu_neg.ok, check/alu_neg.tst,
2898 check/alu_or.ok, check/alu_or.tst, check/alu_rem.ok,
2899 check/alu_rem.tst, check/alu_rsh.ok, check/alu_rsh.tst,
2900 check/alu_sub.ok, check/alu_sub.tst, check/alu_xor.ok,
2901 check/alu_xor.tst, check/alux_add.ok, check/alux_add.tst,
2902 check/alux_sub.ok, check/alux_sub.tst, check/branch.ok,
2903 check/branch.tst: New test cases for arithmetic and branch
2906 * check/Makefile.am: Update for new test cases.
2908 * include/lightning/jit_private.h: Make the jit_reg_free_p
2909 macro shared by all backends. Previously was added for the
2910 arm backend, but is useful in the x86_64 backend when checking
2911 state of "special purpose register".
2912 Also add the new jit_class_named register class, that must be
2913 or'ed with the register value if calling jit_get_reg expecting
2914 an specific value, because the specific register value may be
2915 zero, that previously was treated as no register requested.
2917 * lib/jit_arm-cpu.c: Correct argument order for T2_MVN.
2919 * lib/jit_arm-swf.c: Call the proper function for double
2920 divide. The "software float" implementation just calls
2923 * lib/jit_arm.c: Return float/double values in the float
2924 register if using the hard float ABI.
2926 * lib/jit_x86-cpu.c: Change the can_sign_extend_int_p macro
2927 to not include -0x80000000L, because there is code that
2928 "abuses" it and thinks it can negate the immediate value
2929 after calling that macro.
2930 Correct implementation of jit_subi that had a wrong code
2931 patch logic doing subtraction with reversed arguments.
2932 Correct REX prefix calculation in the jit_muli implementation.
2933 Correct logic to get/unget %*ax and %*dx registers in divremr
2935 Correct divremi that was using the symbolic, unique %*ax
2936 value in on place (not using the _REGNO name suffix).
2937 Correct cut&paste error causing it to use "xor" instead of
2938 "or" in one code path of the jit_ori implementation.
2939 Correct several flaws when clobbering registers and/or when
2940 one of the arguments was %*cx in the rotshr wrapper function
2941 implementing most shift operations.
2943 * lib/lightning.c: No longer expect that the backend be smart
2944 enough to know what to do when asking for a named register
2945 if that register is already an argument or is live. It fails
2946 if it is an argument, or if register is live, fails if cannot
2948 No longer incorrectly assume that eqr_{f,d} and ltgr_{f,d} are
2949 safe to inverse value tests in jump thread optimization.
2951 2012-12-05 Paulo Andrade <pcpa@gnu.org>
2953 * check/Makefile.am, check/cvt.ok, check/cvt.tst: Add new
2954 "cvt" test case to test conversion from/to int/float types.
2956 * check/lightning.c: Only define truncr_{f,d}_l in 64 bit mode.
2958 * include/lightning.h: Correct typo that caused it to define
2959 jit_truncr_{f,d}_l in 32 bit mode.
2961 * lib/jit_arm-cpu.c: Avoid assertion failure in the signed/unsigned
2962 extend opcodes generation as it shares an interface for 3 argument
2965 * lib/jit_x86-cpu.c: Correct wrong argument passed to
2966 jit_unget_reg in the andi implementation and wrong byte
2967 unsigned extend code generation.
2969 * lib/jit_x86-sse.c: Correct conversion from "word" to float or
2970 double as is dependent on wordsize.
2972 2012-12-05 Paulo Andrade <pcpa@gnu.org>
2974 * check/ldstr-c.ok, check/ldstr-c.tst, check/ldstxi-c.ok,
2975 check/ldstxi-c.tst, check/ldstxr-c.ok, check/ldstxr-c.tst:
2976 New test case files testing load clobbering the base and/or
2979 * check/ldst.inc: New file with common definition for all the
2982 check/Makefile.am, check/ldsti.tst, check/ldstr.tst,
2983 check/ldstxi.tst, check/ldstxr.tst: Update for new common
2984 definitions file and new register clobber ldst tests.
2986 2012-12-05 Paulo Andrade <pcpa@gnu.org>
2988 * lib/jit_mips-fpu.c: Correct wrong register order in stxr_{f,d}
2989 in the mips backend.
2991 2012-12-05 Paulo Andrade <pcpa@gnu.org>
2993 * lib/jit_arm-vfp.c: Correct regression found in armv7l with
2996 2012-12-05 Paulo Andrade <pcpa@gnu.org>
2998 * check/ldstxi.tst, check/ldstxr.tst: Correct wrong argument
2999 order for 32 bit mode tests.
3001 * configure.ac: Correct check for ix86 target_cpu.
3003 2012-12-05 Paulo Andrade <pcpa@gnu.org>
3005 * check/ldstr.ok, check/ldstr.tst, check/ldsti.ok,
3006 check/ldsti.tst, check/ldstxr.ok, check/ldstxr.tst,
3007 check/ldstxi.ok, check/ldstxi.tst:
3008 New test case files exercising a very large amount of
3009 register combinations to verify load/store implementation.
3011 * check/Makefile.am: Update for new test cases.
3013 * lib/jit_x86-cpu.c: Correct wrong argument order when
3014 computing REX prefix for {ld,st}r_T codes;
3016 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3018 * lib/jit_mips-fpu.c, lib/jit_mips.c: Implement missing mips
3019 jit_sqrtr_{f,d} codes.
3021 * check/all.tst, include/lightning.h, lib/jit_print.c: Change
3022 declaration order and call order in all.tst of {add,sub}c and
3023 {add,sub}x. *c must be called before to set the carry and *x
3024 second to use the carry and keep it set. The wrong call order
3025 was causing all.tst to fail in mips, where a register is
3026 allocated to keep a global carry state.
3028 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3030 * include/lightning/jit_mips.h, lib/jit_mips-cpu.c,
3031 lib/jit_mips-fpu.c, lib/jit_mips.c: Correct float/double
3032 argument handling and make the mips backend pass the initial
3035 * include/lightning.h, ib/jit_print.c, lib/lightning.c:
3036 Add extra enum values for argument handling functions that
3037 could not be abstracted to the current codes, that is, when
3038 float values need to move from/to gpr from/to fpr. It would
3039 be more tempting to add such primitives, but they would have
3040 wordsize limitations, and it is not expected to add codes
3041 with one gpr argument for 64 bit and two for 32 bit.
3043 * lib/jit_ppc.c: Check _jit->function before calling jit_epilog()
3044 to avoid a runtime exception.
3046 2012-12-04 Paulo Andrade <pcpa@gnu.org>
3048 * include/lightning/jit_mips.h, lib/jit_mips.c: Update to
3049 make the mips backend compile in a qemu image.
3051 * lib/jit_ppc.c: Minor adaptations to help in having the
3052 ppc backend compilable.
3054 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3056 * configure.ac, include/lightning/jit_private.h, lib/jit_arm-cpu.c,
3057 lib/jit_arm-swf.c, lib/jit_arm.c, check/Makefile.am: Correct
3058 implementation of the arm backend port to build and pass the
3059 current test cases. Tested on armv7 with softfp abi.
3061 * lib/jit_disasm.c: Rename and change prototype of static
3062 disassemble function as in the arm backend it is required
3063 to access state information stored in the jit_state_t object.
3065 * check/3to2.tst, check/add.tst: Correct test case code assuming
3066 JIT_RO and JIT_RET are the same, and even if they are the same,
3067 the logic was incorrect because it must always call jit_retval*
3068 to fetch a function call return before any other instruction.
3069 The arm backend hash a special condition if jit_retval is not
3070 called, because "r0" is not JIT_R0, but is JIT_RET and *also*
3071 the first argument for a called function, so JIT_RET must be
3072 only used as an argument to jit_retval.
3074 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3076 * check/all.tst, check/lightning.c: Only declare or use 64 bit
3077 interfaces on 64 bit builds.
3079 * check/fib.tst: Use simpler logic to not need preprocessor
3080 conditionals for 32 or 64 bit.
3082 * include/lightning.h: Only declare 64 bit macros on a 64 bit
3083 build. Code using lightning must know about wordsize and the
3084 jit generation limitations, also, this way it generates a
3085 compile time failure, not a runtime assertion.
3087 * include/lightning/jit_x86.h: Correct typo in macro name.
3089 * lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
3090 lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
3091 lib/jit_x86.c, lib/jit_x86-cpu.c: Correct wrong code to get
3092 current jit function pointer.
3094 * lib/lightning.c: Move call to the simplify() optimization
3095 to after register liveness is known. Previous code did work
3096 by accident but now with proper test cases the problem was
3099 * lib/jit_disasm.c: Always cast bfd_vma to long long when
3100 passing it as printf argument.
3102 2012-12-03 Paulo Andrade <pcpa@gnu.org>
3104 * configure.ac, check/Makefile.am, check/check.sh,
3105 doc/Makefile.am, include/lightning/Makefile.am,
3106 lib/Makefile.am: Correct make distcheck.
3108 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3110 * lib/jit_ppc.c: Assign copyright ownership to FSF.
3112 * lib/jit_x86-cpu.c: Correct integer multiplication that was
3113 generating code with reversed register arguments.
3115 * check/rpn.ok, check/rpn.tst: New test case file.
3117 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3119 * lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
3120 Actually change copyright owner to FSF as avertised.
3122 * lib/jit_arm-cpu.c, lib/jit_arm-swf.c,
3123 lib/jit_arm-vfp.c, lib/jit_arm.c,
3124 lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c,
3125 lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: New
3126 files implementing initial code different jit backends.
3128 * include/lightning/jit_private.h: Add extra field to the
3129 private jit_patch_t type, required by the arm port.
3131 * lib/Makefile.am: Update for the new backend implementation
3134 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3136 * check/Makefile.am: Add proper "make clean" rule and missing
3137 check.sh to EXTRA_DIST.
3139 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3141 * .gitignore: Update pattern of ignored files.
3143 * check/Makefile.am: Add rule to build liblightning.la dependency
3144 in case of running "make check" before building the library.
3146 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3148 * lightning/Makefile.am, lightning/asm-common.h,
3149 lightning/core-common.h, lightning/fp-common.h,
3150 lightning/funcs-common.h, lightning/i386/Makefile.frag,
3151 lightning/i386/asm-32.h, lightning/i386/asm-64.h,
3152 lightning/i386/asm.h, lightning/i386/core-32.h,
3153 lightning/i386/core-64.h, lightning/i386/core.h,
3154 lightning/i386/fp-32.h, lightning/i386/fp-64.h,
3155 lightning/i386/fp.h, lightning/i386/funcs.h,
3156 lightning/ppc/asm.h, lightning/ppc/core.h,
3157 lightning/ppc/fp.h, lightning/ppc/funcs.h,
3158 lightning/sparc/asm.h, lightning/sparc/core.h,
3159 lightning/sparc/fp.h, lightning/sparc/funcs.h:
3160 Removed. The core logic is used in the new code, and new mips
3161 and arm ports will be added. At first, sparc will not be
3162 supported as it has not yet been ported to the new engine.
3164 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3166 * tests/Makefile.am, tests/3to2.c, tests/3to2.ok, tests/add.c,
3167 tests/add.ok, tests/allocai.c, tests/allocai.ok, tests/bp.c,
3168 tests/bp.ok, tests/divi.c, tests/divi.ok, tests/fib.c, tests/fib.ok,
3169 tests/fibdelay.c, tests/fibdelay.ok, tests/fibit.c, tests/fibit.ok,
3170 tests/funcfp.c, tests/funcfp.ok, tests/incr.c, tests/incr.ok,
3171 tests/ldst.c, tests/ldst.ok, tests/ldxi.c, tests/ldxi.ok,
3172 tests/modi.c, tests/modi.ok, tests/movi.c, tests/movi.ok,
3173 tests/printf.c, tests/printf.ok, tests/printf2.c, tests/printf2.ok,
3174 tests/ret.c, tests/ret.ok, tests/rpn.c, tests/rpn.ok, tests/rpnfp.c,
3175 tests/rpnfp.ok, tests/sete.c, tests/sete.ok, tests/testfp.c,
3176 tests/testfp.ok, tests-run-test: Removed previous test suite, in
3177 favor of a newer one in the check subdirectory.
3179 * check/3to2.ok, check/3to2.tst, check/add.ok, check/add.tst,
3180 check/allocai.ok, check/allocai.tst, check/bp.ok, check/bp.tst,
3181 check/divi.ok, check/divi.tst, check/fib.ok, check/fib.tst:
3182 New sample input for the new test program, loosely matching
3183 several of the previous test cases.
3185 * check/Makefile.am: New test suite makefile.
3187 * check/check.sh, check/run-test: New wrapper files for the
3190 * check/lightning.c: New file. The main driver of the new test
3191 suite, that compiles to a parser of a very simple assembly like
3192 language, generates jit and executes it.
3194 * check/all.tst: New file. A generic debug and sample test file
3195 with a directive to prevent it from being executed, and useful to
3196 read disassembly of all possible instructions, using a fixed set
3199 * include/Makefile.am, include/lightning.h,
3200 include/lightning/Makefile.am, include/lightning/jit_arm.h,
3201 include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
3202 include/lightning/jit_private.h, include/lightning/jit_x86.h,
3203 lib/Makefile.am, lib/jit_disasm.c, lib/jit_print.c,
3204 lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c,
3205 lib/jit_x86.c, lib/lightning.c: New files. These files are
3206 written from scratch, only by <pcpa@gnu.org>, and have now
3207 copyright assignment to the FSF. This is the core of the new
3208 lightning rework. Previously it was integrated in code with
3209 a garbage collector and several custom types like vectors and
3210 hash tables, so this first code merge with lightning converts
3211 that code into a library extracting only the jit bits, and at
3212 first only for x86_64 GNU/Linux.
3214 * lightning.h, m4/lightning.m4: Removed. These are no longer
3215 required in the new lightning code.
3217 .gitignore, Makefile.am, configure.ac: Update for the new
3220 2012-12-02 Paulo Andrade <pcpa@gnu.org>
3221 * .cvsignore: Removed for extra cleanup.
3223 * build-aux: Rename directory to m4.
3225 * m4: Renamed to "default" name and for consistency with merge
3226 with code rework to be imported in lightning.
3228 * .gitignore, configure.ac, Makefile.am, doc/Makefile.am:
3229 Update for build-aux to m4 rename.
3231 2012-12-01 Paulo Andrade <pcpa@gnu.org>
3233 * opcode/Makefile.am, opcode/Makefile.in, opcode/ansidecl.h,
3234 opcode/bfd.h, opcode/dis-asm.h, opcode/dis-buf.c, opcode/disass.c,
3235 opcode/i386-dis.c, opcode/i386.h, opcode/ppc-dis.c, opcode/ppc-opc.c,
3236 opcode/ppc.h, opcode/sparc-dis.c, opcode/sparc-opc.c, opcode/sparc.h,
3237 opcode/sysdep.h: Removed. Do not bundle GNU binutils files.
3239 * aclocal.m4, configure, Makefile.in, config.h.in, doc/Makefile.in,
3240 lightning/Makefile.in, tests/Makefile.in: Removed. Do not maintain
3241 autogenerated files that also generate too much diff noise when
3244 * build-aux/help2man, build-aux/texinfo.tex, build-aux/texi2dvi:
3245 Removed. Buildenvironment must have an up to date version from
3248 * build-aux/config.guess, build-aux/config.sub, build-aux/depcomp,
3249 build-aux/install-sh build-aux/mdate-sh build-aux/missing: Removed.
3250 Do not maintain a copy of automake files in git. Release tarballs
3251 must use an up to date version.
3253 * lightningize.in, doc/lightningize.1: Removed. Do not encourage
3254 bundling lightning in other packages. It should use a system package
3255 or a proper thirdy part subdirectory.
3257 * INSTALL: Removed. Autoreconf removes it and creates a symlink
3258 when regenerating files, so, avoid conflicts in git and let
3259 automake create the symlink.
3261 * .gitignore: Add INSTALL and autogenerated files.
3263 * configure.ac, Makefile.am: Update for removal of opcode subdir,
3264 auto generated files and lightningize.
3266 * tests/Makefile.am, tests/3to2.c, tests/add.c, tests/bp.c,
3267 tests/fib.c, tests/fibdelay.c, tests/fibit.c, tests/funcfp.c,
3268 tests/incr.c, tests/printf.c, tests/rpn.c, tests/rpnfp.c,
3269 tests/sete.c, tests/testfp.c: Update for removal of opcode subdir.
3271 * doc/Makefile.am: Update for removal of lightningize.
3273 * configure.ac, lightning/ppc/funcs.h, lightning/sparc/funcs.h,
3274 lightning/i386/fp.h, lightning/i386/core.h, lightning/i386/asm.h,
3275 tests/3to2.c, tests/add.c, tests/bp.c, tests/fib.c, tests/fibdelay.c,
3276 tests/fibit.c, tests/funcfp.c, tests/incr.c, tests/printf.c,
3277 tests/rpn.c, tests/rpnfp.c, tests/sete.c, tests/testfp.c:
3278 Remove LIGHTNING_CROSS, it is half supported and incomplete.
3280 * tests/3to2.c, tests/funcfp.c, tests/rpnfp.c: Remove preprocessor
3281 check on JIT_FPR. If no hardware registers are available, the backend
3282 must provide an alternative for software float.
3284 * lightning/ppc/core.h, lightning/sparc/core.h, tests/Makefile.am:
3285 Remove JIT_NEED_PUSH_POP. It is absolutely not trivial to implement
3286 properly on some backends due to stack alignment constraints, and
3287 whenever it is required, using jit_allocai and using a properly
3288 aligned stack vector, or a heap buffer, is better.
3290 * tests/push-pop.c, tests/push-pop.ok: Removed due to
3291 JIT_NEED_PUSH_POP no longer available.
3293 2011-02-28 Paolo Bonzini <bonzini@gnu.org>
3295 * lightning/i386/core-64.h: Add jit_add{c,x}{i,r}_l, jit_mulr_{l,ul}_,
3296 fix jit_mul{i,r}_{l,ul}.
3298 2010-08-20 Paolo Bonzini <bonzini@gnu.org>
3300 * lightning/i386/fp-64.h: Return patch address from jit_bXYr_{f,d}.
3301 Reported by Paulo César Pereira de Andrade.
3302 * lightning/ppc/fp.h: Likewise.
3303 * lightning/sparc/fp.h: Implement FP branches.
3305 2010-08-18 Paolo Bonzini <bonzini@gnu.org>
3307 * lightning/i386/fp-64.h: Fix jp in jit_bner_{f,d}.
3309 2010-08-18 Paolo Bonzini <bonzini@gnu.org>
3311 * lightning/i386/fp-32.h: Fix -D_ASM_SAFETY compilation.
3312 Reported by Paulo César Pereira de Andrade.
3314 2010-08-15 Paolo Bonzini <bonzini@gnu.org>
3316 * tests/ldst.c: Update.
3317 * tests/Makefile.am: Use -ffloat-store to compile it.
3319 2010-08-15 Paolo Bonzini <bonzini@gnu.org>
3321 * lightning/i386/core.h (jit_ldr_c, jit_ldxr_c, jit_ldr_s,
3322 jit_ldxr_s): Move...
3323 * lightning/i386/core-32.h: ... here.
3324 * lightning/i386/core-64.h (jit_ldr_c, jit_ldxr_c, jit_ldr_s):
3325 Use movsbq and movswq.
3327 2010-08-10 Paulo César Pereira de Andrade <pcpa@mandriva.com.br>
3329 * lightning/i386/core-32.h (jit_replace): Use MOVLrr, not MOVLir.
3330 (jit_movbrm): Check index register as well.
3331 * lightning/i386/fp-64.h: Add jit_extr_f_d and jit_extr_d_f.
3332 * lightning/fp-common.h: Add jit_extr_f_d and jit_extr_d_f.
3334 2010-07-28 Paolo Bonzini <bonzini@gnu.org>
3336 * tests/Makefile.am: Add ldst test.
3337 * tests/Makefile.in: Regenerate.
3338 * tests/ldst.c: New.
3339 * tests/ldst.ok: New.
3341 2010-07-28 Paolo Bonzini <bonzini@gnu.org>
3343 * THANKS: Add Paulo Cesar Pereira de Andrade.
3344 * doc/porting.texi: Fix ordering of arguments in jit_stxi.
3345 * lightning/i386/core-32.h (jit_replace): Remove cmp argument.
3346 * lightning/i386/fp-64.h (jit_movi_f): Fix.
3348 2010-07-26 Paolo Bonzini <bonzini@gnu.org>
3350 * lightning/i386/core-32.h (jit_replace): Move here (removed
3353 2010-07-19 Paolo Bonzini <bonzini@gnu.org>
3355 * build-aux/lightning.m4: Always set and replace lightning_frag.
3356 * Makefile.in: Regenerate.
3357 * aclocal.m4: Regenerate.
3358 * config.h.in: Regenerate.
3359 * configure: Regenerate.
3360 * doc/Makefile.in: Regenerate.
3361 * doc/lightningize.1: Regenerate.
3362 * doc/version.texi: Regenerate.
3363 * lightning/Makefile.in: Regenerate.
3364 * opcode/Makefile.in: Regenerate.
3365 * tests/Makefile.in: Regenerate.
3367 2009-03-01 Paolo Bonzini <bonzini@gnu.org>
3369 * lightning/i386/core-64.h: Use Mike's macros for x86-64 too.
3370 * lightning/i386/core.h: Remove jit_replace.
3372 2009-02-27 Mike Spivey <mike@comlab.ox.ac.uk>
3374 * lightning/i386/core.h: Rewrite shift-handling macros.
3375 * lightning/fp-common.h: Fix jit_extr_{f_d,d_f}.
3377 2009-02-17 Mike Spivey <mike@comlab.ox.ac.uk>
3379 * lightning/i386/core.h: Fix blunder in operand order.
3381 2009-02-17 Paolo Bonzini <bonzini@gnu.org>
3383 * lightning/i386/fp-32.h: Another fix to jit_fp_btest.
3385 2009-02-17 Paolo Bonzini <bonzini@gnu.org>
3387 * lightning/fp-common.h: Define double branches if missing.
3388 * lightning/i386/asm.h: Define JC and JNC mnemonics.
3389 * lightning/i386/fp-32.h: Fix jit_fp_btest. All reported
3392 2008-10-09 Paolo Bonzini <bonzini@gnu.org>
3394 * lightning/ppc/funcs.h (jit_flush_code): Subtract 1 from end.
3395 Reported by Eli Barzilay and Matthew Flatt.
3397 2008-08-23 Nix <nix@esperi.org.uk>
3399 * lightning/i386/Makefile.frag: fp-32.h and fp-64.h are target files.
3401 2008-07-02 Laurent Michel <ldm@engr.uconn.edu>
3403 * lightning/ppc/funcs.h (jit_flush_code): modified the computation
3404 of start/end. The pointer arithmetic was done without casting. It
3405 prevented compilation with recent gcc versions.
3406 * lightning/ppc/core.h (jit_pushr_i): The offset for the store was
3407 incorrect. Should have been 4 bytes below SP (not above).
3408 * lightning/ppc/core.h (jit_popr_i): The offset for the load was
3409 incorrect. Should have been 0 (not +8).
3411 2008-06-17 Paolo Bonzini <bonzini@gnu.org>
3413 * lightning/i386/asm-64.h: Forward IMULQir to IMULQirr,
3414 fix REXQ order for IMULQirr.
3416 2008-06-17 Paolo Bonzini <bonzini@gnu.org>
3418 * lightning/i386/core.h: Fix _rN vs. _rR.
3420 2008-06-16 Paolo Bonzini <bonzini@gnu.org>
3422 * lightning/i386/core.h: Use jit_save in jit_replace. Move JIT_R
3424 * lightning/i386/core-32.h: ... here; define jit_save so that
3425 the core.h has no effect on the 32-bit backend.
3426 * lightning/i386/core-64.h: Place JIT_R1/JIT_R2 in R10/R11,
3427 place outgoing arguments in the right spot from the beginning,
3428 define jit_save, fix jit_reg8/jit_reg16.
3430 2008-06-15 Paolo Bonzini <bonzini@gnu.org>
3432 * lightning/i386/core-64.h: Rewrite argument passing to
3433 support up to 6 arguments and generate less code.
3435 2008-06-14 Laurent Michel <ldm@thorgal.homelinux.org>
3437 * lightning/i386/core-64.h (jit_movi_l): When the operand is 0,
3438 the XOR should be on a quadword.
3439 * lightning/i386/core-64.h (jit_prolog): Keep 16-byte stack
3441 (jit_ret): Always use LEAVE.
3443 2008-06-13 Laurent Michel <ldm@thorgal.homelinux.org>
3445 * lightning/i386/core-64.h: Add (void) casts for C++ compatibility.
3446 * lightning/i386/asm.h: Likewise.
3448 2008-06-12 Paolo Bonzini <bonzini@gnu.org>
3450 * lightning/i386/core.h: Move JIT_V definition...
3451 * lightning/i386/core-32.h: ... here.
3452 * lightning/i386/core-64.h: ... and here. Avoid dancing between
3453 RSI/RDI and R12/R13, and place JIT_V1/JIT_V2 in R12/R13.
3455 2008-06-11 Paolo Bonzini <bonzini@gnu.org>
3457 * build-aux/lightning.m4: Adjust LIGHTNING_BACKENDS, don't
3458 use suffix support to distinguish i386/x86_64.
3459 * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES
3460 to distribute *-32.h and *-64.h files now.
3461 * lightning/i386/asm-i386: Moved to...
3462 * lightning/i386/asm.h: Include the appropriate subtarget file.
3463 * lightning/i386/core-i386: Moved to...
3464 * lightning/i386/core.h: Include the appropriate subtarget file.
3465 * lightning/i386/fp.h: New, include the appropriate subtarget file.
3466 * lightning/i386/asm-32: Do not include asm-i386.h.
3467 * lightning/i386/asm-64.h: Likewise.
3468 * lightning/i386/core-32: Do not include core-i386.h.
3469 * lightning/i386/core-64.h: Likewise.
3470 * lightning/Makefile.am: Adjust for renamed files.
3472 * configure.ac: Define LIGHTNING_TARGET here.
3473 * opcode/disass.c: Change list of valid LIGHTNING_TARGET values.
3475 * lightningize.in: Robustify against missing subtarget files.
3477 2008-06-11 Paolo Bonzini <bonzini@gnu.org>
3479 * lightning/i386/core-32.h: Use MOVLir instead of jit_movi_l
3480 to implement jit_movi_p.
3482 2008-06-11 Paolo Bonzini <bonzini@gnu.org>
3484 * lightning/i386/core-32.h: Use separate __APPLE__ and SysV
3485 prolog/ret macros. Subtract 12 bytes in __APPLE__ case to
3486 keep stack aligned, and always use LEAVE in the epilog.
3488 2008-06-11 Paolo Bonzini <bonzini@gnu.org>
3490 * lightning/i386/core-i386.h: Fix C++ incompatibility.
3492 2008-06-10 Laurent Michel <ldm@engr.uconn.edu>
3494 * lightning/i386/core-i386.h: Fix jit_replace8 for
3495 case when one of the operands is _EAX.
3497 2008-05-19 Paolo Bonzini <bonzini@gnu.org>
3499 * tests/run-test: Avoid CRLF issues on mingw.
3501 2008-03-21 Paolo Bonzini <bonzini@gnu.org>
3503 * lightning/i386/core-64.h: Fix jit_{ld,st}{,x}i_{i,l}.
3504 Remove jit_ld{,x}i_ul.
3505 * lightning/core-common.h: Make jit_ld{,x}{i,r}_ul
3506 always a synonym of the _l variant.
3507 * doc/porting.texi: Document this.
3509 2008-03-19 Paolo Bonzini <bonzini@gnu.org>
3511 * lightning/i386/core-64.h: Fix uses of jit_qop_.
3513 2008-03-19 Paolo Bonzini <bonzini@gnu.org>
3515 * lightning/i386/core-64.h: Add boolean operations.
3517 2008-03-19 Paolo Bonzini <bonzini@gnu.org>
3519 * lightning/i386/asm-64.h: Add LEAQmr.
3521 2008-03-19 Paolo Bonzini <bonzini@gnu.org>
3523 * lightning/i386/core-64.h: Misc bugfixes.
3525 2008-03-19 Paolo Bonzini <bonzini@gnu.org>
3527 * lightning/i386/core-i386.c: Remove jit_ldr_i, jit_ldxr_i.
3528 * lightning/i386/core-32.h: Add jit_ldr_i, jit_ldxr_i.
3529 * lightning/i386/core-64.h: Add jit_ld{r,xr,i,xi}_{ui,l,ul};
3530 move jit_ldr_i, jit_ldxr_i, jit_str_l, jit_stxr_l with others.
3532 2008-03-19 Paolo Bonzini <bonzini@gnu.org>
3534 * lightning/asm-common.h: Add _s32P.
3536 2008-03-19 Paolo Bonzini <bonzini@gnu.org>
3538 * lightning/i386/core-64.h: Implement long mul/div/mod.
3540 2008-03-19 Paolo Bonzini <bonzini@gnu.org>
3542 * lightning/i386/asm-i386.h: Cast memory address to long for JCCim.
3544 2008-03-15 Paolo Bonzini <bonzini@gnu.org>
3546 * lightning/asm-common.h: Add underscores around __unused__
3549 2008-03-15 Paolo Bonzini <bonzini@gnu.org>
3551 * lightning/ppc/core.h: Avoid some "value computed is not used"
3553 * lightnings/tests/allocai.c: Silence other warnings.
3555 2008-03-14 Paolo Bonzini <bonzini@gnu.org>
3557 * lightningize.in: Fix some problems (not all).
3559 2008-03-14 Paolo Bonzini <bonzini@gnu.org>
3561 * lightning/i386/core-32.h: Avoid some "value computed is not used"
3562 warnings; reported by Sam Steingold.
3564 2008-03-08 Paolo Bonzini <bonzini@gnu.org>
3566 * lightning/i386/core-32.h: Fix stxr_c(_EAX, _EBX, _ESI).
3568 2008-02-13 Paolo Bonzini <bonzini@gnu.org>
3570 * lightning/i386/asm-32.h: Avoid redefinition of _r1, reported by
3572 * lightning/i386/asm-64.h: Likewise.
3574 2008-02-08 Paolo Bonzini <bonzini@gnu.org>
3576 * lightning/i386/asm-i386.h: Don't define _VOID, reported
3579 2008-02-03 Paolo Bonzini <bonzini@gnu.org>
3581 * build-aux/lightning.m4: Add --with-lightning-prefix option, suggested
3584 2008-01-14 Paolo Bonzini <bonzini@gnu.org>
3586 * lightning/i386/core-64.h: Use CALLsr, not CALLLsr.
3588 2008-01-13 Paolo Bonzini <bonzini@gnu.org>
3590 * lightning/i386/core-i386.h: Move jit_calli and jit_callr...
3591 * lightning/i386/core-32.h: ... here.
3592 * lightning/i386/core-64.h: Redefine them.
3594 2008-01-05 Paolo Bonzini <bonzini@gnu.org>
3596 * lightning/i386/fp-32.h: Fix sub(a,0,a).
3597 * lightning/tests/3to2.c: Add new testcases.
3598 * lightning/tests/3to2.ok: Add new testcases.
3600 2008-01-02 Paolo Bonzini <bonzini@gnu.org>
3602 * lightning/i386/fp-32.h: Fix sub(a,b,a) with a ~= JIT_FPR0.
3603 * lightning/tests/3to2.c: New.
3604 * lightning/tests/3to2.ok: New.
3606 2007-11-07 Paolo Bonzini <bonzini@gnu.org>
3608 * opcode/Makefile.am: Fix AM_CPPFLAGS.
3610 2007-08-12 Paolo Bonzini <bonzini@gnu.org>
3612 * lightning/i386/core-i386.h: Improve encoding of set* instructions.
3613 * lightning/i386/core-64.h: Fix jit_bra_l.
3614 * tests/sete.c: New.
3615 * tests/sete.ok: New.
3617 2007-06-29 Paolo Bonzini <bonzini@gnu.org>
3619 * tests/bp.c: Upgrade to GPL/LGPLv3.
3620 * lightning/i386/asm-32.h: Upgrade to GPL/LGPLv3.
3621 * lightning/i386/asm-64.h: Upgrade to GPL/LGPLv3.
3622 * lightning/i386/core-32.h: Upgrade to GPL/LGPLv3.
3623 * lightning/i386/core-64.h: Upgrade to GPL/LGPLv3.
3624 * lightning/i386/fp-64.h: Upgrade to GPL/LGPLv3.
3625 * lightning/sparc/asm.h: Upgrade to GPL/LGPLv3.
3626 * lightning/sparc/core.h: Upgrade to GPL/LGPLv3.
3627 * lightning/sparc/fp.h: Upgrade to GPL/LGPLv3.
3628 * lightning/sparc/funcs.h: Upgrade to GPL/LGPLv3.
3629 * lightning/i386/asm-i386.h: Upgrade to GPL/LGPLv3.
3630 * lightning/i386/core-i386.h: Upgrade to GPL/LGPLv3.
3631 * lightning/i386/fp-32.h: Upgrade to GPL/LGPLv3.
3632 * lightning/i386/funcs.h: Upgrade to GPL/LGPLv3.
3633 * lightning/ppc/asm.h: Upgrade to GPL/LGPLv3.
3634 * lightning/ppc/core.h: Upgrade to GPL/LGPLv3.
3635 * lightning/ppc/fp.h: Upgrade to GPL/LGPLv3.
3636 * lightning/ppc/funcs.h: Upgrade to GPL/LGPLv3.
3637 * lightning.h: Upgrade to GPL/LGPLv3.
3638 * tests/add.c: Upgrade to GPL/LGPLv3.
3639 * tests/fib.c: Upgrade to GPL/LGPLv3.
3640 * tests/testfp.c: Upgrade to GPL/LGPLv3.
3641 * tests/fibdelay.c: Upgrade to GPL/LGPLv3.
3642 * tests/fibit.c: Upgrade to GPL/LGPLv3.
3643 * tests/funcfp.c: Upgrade to GPL/LGPLv3.
3644 * tests/incr.c: Upgrade to GPL/LGPLv3.
3645 * tests/printf.c: Upgrade to GPL/LGPLv3.
3646 * tests/printf2.c: Upgrade to GPL/LGPLv3.
3647 * tests/rpn.c: Upgrade to GPL/LGPLv3.
3648 * tests/rpnfp.c: Upgrade to GPL/LGPLv3.
3649 * lightning/asm-common.h: Upgrade to GPL/LGPLv3.
3650 * lightning/core-common.h: Upgrade to GPL/LGPLv3.
3651 * lightning/fp-common.h: Upgrade to GPL/LGPLv3.
3652 * lightning/funcs-common.h: Upgrade to GPL/LGPLv3.
3653 * opcode/dis-buf.c: Upgrade to GPL/LGPLv3.
3654 * opcode/disass.c: Upgrade to GPL/LGPLv3.
3655 * opcode/i386-dis.c: Upgrade to GPL/LGPLv3.
3656 * opcode/sparc-dis.c: Upgrade to GPL/LGPLv3.
3657 * opcode/sparc-opc.c: Upgrade to GPL/LGPLv3.
3658 * lightningize.in: Upgrade to GPL/LGPLv3.
3659 * opcode/bfd.h: Upgrade to GPL/LGPLv3.
3660 * opcode/i386.h: Upgrade to GPL/LGPLv3.
3661 * opcode/sparc.h: Upgrade to GPL/LGPLv3.
3663 2007-01-26 Thomas Girard <thomas.g.girard@free.fr>
3665 * lightning/Makefile.am: Add clean-local target.
3667 2006-12-02 Paolo Bonzini <bonzini@gnu.org>
3669 * lightning/i386/asm-i386.h: Add CVTTS?2SIL.
3670 * lightning/i386/asm-64.h: Add CVTTS?2SIQ.
3671 * lightning/i386/fp-64.h: Use it.
3673 * lightning/Makefile.am: Place files in nodist_lightning_HEADERS.
3675 2006-11-23 Paolo Bonzini <bonzini@gnu.org>
3677 * lightning/core-common.h: Add casts in "*i_p" variants.
3678 * lightning/i386/asm-32.h: Add _r1.
3679 * lightning/i386/asm-64.h: Likewise, and add SSE instructions.
3680 * lightning/i386/asm-i386.h: Merge SSE instructions from Gwenole.
3681 Use short form for 16-bit AX instructions. Remove _r1
3682 * lightning/i386/core-64.h: Add FP ABI support in its infancy.
3683 * lightning/i386/core-i386.h: Move jit_arg_f and jit_arg_d...
3684 * lightning/i386/core-32.h: ... and jit_prepare_f and jit_prepare_d...
3685 * lightning/i386/fp-32.h: ... here.
3686 * lightning/i386/fp-64.h: Write the code.
3687 * lightning/sparc/fp.h: Fix jit_extr_{f_d,d_f} register order.
3689 2006-11-22 Paolo Bonzini <bonzini@gnu.org>
3691 * lightning/i386/asm-i386.h: Move x86-64 instructions...
3692 * lightning/i386/asm-64.h: ... here.
3693 * lightning/i386/fp-32.h: Fix bugfixes worked around in froofyJIT.
3695 * lightning/sparc/fp.h: Likewise.
3696 * lightning/ppc/fp.h: Likewise.
3697 * lightning/fp-common.h: Adjust for JIT_FPRET.
3698 * tests/funcfp.c: Adjust for JIT_FPRET.
3699 * tests/rpnfp.c: Adjust for JIT_FPRET.
3701 2006-11-20 Paolo Bonzini <bonzini@gnu.org>
3703 * lightning/i386/asm-i386.h: Add an underscore to macros without
3706 2006-11-20 Paolo Bonzini <bonzini@gnu.org>
3708 * lightning/i386/core-i386.h: Move jit_movip, jit_check8, jit_reg8,
3709 jit_reg16, jit_movbrm...
3710 * lightning/i386/core-32.h: ... here.
3711 * lightning/i386/core-64.h: Redefine them. Fix other bugs.
3713 * tests/printf.c: Do not do a varargs call.
3715 2006-11-20 Paolo Bonzini <bonzini@gnu.org>
3717 * lightning/i386/asm-i386.h: Check in rewrite from Basilisk II.
3718 * lightning/i386/asm-32.h: Adjust.
3719 * lightning/i386/asm-64.h: Adjust.
3720 * lightning/i386/fp-32.h: Adjust.
3722 * lightning/i386/core-32.h: Adjust. Add jit_{ld,ldx,st,stx}i*.
3723 * lightning/i386/core-64.h: Adjust. Add jit_{ld,ldx,st,stx}i*.
3724 * lightning/i386/core-i386.h: Adjust. Remove these patterns.
3726 2006-11-20 Paolo Bonzini <bonzini@gnu.org>
3728 * lightning/i386/asm-i386.h: Merge 64-bit cleanliness changes from
3731 * lightning/i386/asm-64.h: Likewise.
3733 2006-11-20 Paolo Bonzini <bonzini@gnu.org>
3734 Ludovic Courtes <ludo@chbouib.org>
3736 * lightning/i386/core-32.h: Disable jit_push and jit_pop if stack not
3738 * lightning/i386/core-64.h: Disable jit_push and jit_pop if stack not
3740 * lightning/sparc/core.h: Merge final implementation of jit_pushr and
3742 * lightning/ppc/core.h: Fix implementation of jit_pushr and jit_popr to
3743 work (more or less) across function calls.
3745 * tests/push-pop.c, tests/push-pop.ok: New test.
3746 * tests/Makefile.am: Run it.
3748 2006-11-20 Paolo Bonzini <bonzini@gnu.org>
3750 * lightning/asm-common.h: Make 64-bit safe.
3751 * lightning/i386/funcs.h: Make 64-bit safe.
3753 * lightning/i386/asm-64.h: More merge from mzscheme.
3754 * lightning/i386/asm-i386.h: More merge from mzscheme.
3755 * lightning/i386/core-32.h: More merge from mzscheme.
3756 * lightning/i386/core-64.h: More merge from mzscheme.
3757 * lightning/i386/core-i386.h: More merge from mzscheme.
3759 * tests/rpnfp.c, tests/testfp.c, tests/funcfp.c: Skip if no
3760 floating-point support.
3762 2006-11-04 Paolo Bonzini <bonzini@gnu.org>
3764 * tests/rpn.c: Remove pushr/popr.
3766 2006-11-04 Paolo Bonzini <bonzini@gnu.org>
3768 * lightning/ppc/core.h: Implement jit_allocai, define JIT_FP to be R1.
3769 * lightning/ppc/funcs.h: Store frame size into _jitl. Store R1 before
3770 the STMW, so that the offset is unchanged when we patch the STMW.
3771 * lightning/i386/core.h: Define JIT_FP to be EBP.
3772 * lightning/i386/core-32.h: Implement jit_allocai, put LEAVE in the
3773 epilog if jit_allocai was used.
3774 * lightning/i386/core-64.h: Implement jit_allocai, put LEAVE in the
3775 epilog if jit_allocai was used.
3777 2006-11-04 Ludovic Courtes <ludo@chbouib.org>
3779 * lightning/sparc/core.h: Implement jit_allocai.
3780 * tests/allocai.c: New.
3781 * tests/Makefile.am: Point to new tests.
3783 2006-11-03 Paolo Bonzini <bonzini@gnu.org>
3785 * lightning/ppc/core.h: Fix jit_bms using BNE rather than BGT.
3786 "AND." does signed comparisons.
3788 2006-10-31 Paolo Bonzini <bonzini@gnu.org>
3790 * doc/porting.texi: Rename JIT_FP to JIT_AP.
3791 * lightning/core-common.h: Likewise.
3792 * lightning/i386/core-i386.h: Likewise.
3793 * lightning/fp-common.h: Provide default versions of jit_getarg_[fd].
3794 * lightning/i386/fp-32.h: Don't provide jit_getarg_[fd].
3795 * lightning/ppc/fp.h: Likewise.
3797 2006-10-31 Ludovic Courtes <ludo@chbouib.org>
3799 * doc/using.texi (The instruction set): Clarified the use of `JIT_RET' and
3800 documented `jit_retval'.
3801 * tests/ret.c (generate_function_proxy): After `jit_finish', use
3802 `jit_retval_i' to move FUNC's return value into the correct register.
3804 2006-10-31 Paolo Bonzini <bonzini@gnu.org>
3805 Ludovic Courtes <ludo@chbouib.org>
3807 * tests/divi.c, tests/divi.ok, tests/movi.c, tests/movi.ok: New.
3808 * tests/ldxi.c: Ensure large pointer is generated.
3809 * tests/Makefile.am: Point to new tests.
3810 * lightning.h: Include funcs-common.h before funcs.h.
3811 * lightning/sparc/core.h: Fix bugs in modi/divi.
3813 2006-10-30 Paolo Bonzini <bonzini@gnu.org>
3815 * lightning/Makefile.am: Use "ln -sf".
3816 * lightning/core-common.h: Define jit_negr_l if necessary.
3818 2006-10-30 Paolo Bonzini <bonzini@gnu.org>
3820 * lightning/i386/asm.h (MOVS*, MOVZ*): Use correct _r[124] macros.
3822 2006-10-29 Paolo Bonzini <bonzini@gnu.org>
3824 * configure.ac: Use lightning.m4 macros.
3825 * lightning.m4: Refactor to use common code in configure.ac. Move...
3826 * build-aux/lightning.m4: ... here.
3827 * lightningize.in: Support suffixes.
3828 * opcode/disass.in: Adapt to changes in configure.ac.
3830 * lightning/ppc/funcs.h: Use __APPLE__ instead of _CALL_DARWIN.
3831 * lightning/i386/core-32.h: Likewise.
3833 2006-10-26 Paolo Bonzini <bonzini@gnu.org>
3835 * configure.ac: Fix compilation test.
3836 * lightning/Makefile.am: Symlink LIGHTNING_TARGET_FILES in
3837 non-distribution mode.
3838 * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES.
3840 2006-10-26 Paolo Bonzini <bonzini@gnu.org>
3842 * configure.ac: Subst cpu.
3843 * lightning/core-common.h: Make tests pass on i386.
3844 * lightning/i386/asm-32.h: Make tests pass on i386.
3845 * lightning/i386/asm-64.h: Make tests pass on i386.
3846 * lightning/i386/asm-i386.h: Make tests pass on i386.
3847 * lightning/i386/core-32.h: Make tests pass on i386.
3848 * lightning/i386/core-64.h: Make tests pass on i386.
3849 * lightning/i386/core-i386.h: Make tests pass on i386.
3850 * tests/Makefile.am: Include files from cpu directory.
3852 2006-10-26 Paolo Bonzini <bonzini@gnu.org>
3854 * lightning/i386/asm.h: Move to asm-i386.h
3855 * lightning/i386/asm-32.h: New, from Matthew Flatt.
3856 * lightning/i386/asm-64.h: New, from Matthew Flatt.
3857 * lightning/i386/core.h: Move to core-i386.h
3858 * lightning/i386/core-32.h: New, from Matthew Flatt.
3859 * lightning/i386/core-64.h: New, from Matthew Flatt.
3860 * lightning/i386/fp.h: Move to fp-32.h
3861 * lightning/i386/fp-64.h: New, dummy.
3862 * lightning/i386/Makefile.frag: New.
3863 * lightning/Makefile.am: Support per-target Makefile fragments.
3864 * configure.ac: Support per-target Makefile fragments and CPU suffixes.
3866 2006-10-16 Paolo Bonzini <bonzini@gnu.org>
3868 * lightning/i386/i386.h (jit_flush_code): Fix syntax error. :-(
3870 2006-07-06 Paolo Bonzini <bonzini@gnu.org>
3871 Ludovic Courtes <ludovic.courtes@laas.fr>
3873 * doc/using.texi: Clarify "Using autoconf" section
3874 and rename it to "Bundling lightning"
3875 * lightning.m4: Work also if lightning is not bundled.
3877 2006-07-06 Paolo Bonzini <bonzini@gnu.org>
3878 Ludovic Courtes <ludovic.courtes@laas.fr>
3880 * lightning/ppc/core.h (_jit_mod): Replace with...
3881 (_jit_mod_big, _jit_mod_small): ... these.
3882 (jit_modi_i, jit_modi_ui): Rewrite.
3883 * tests/modi.c, tests/modi.ok: New tests.
3885 2006-05-18 Matthew Flatt <mflatt@cs.utah.edu>
3887 * lightning/i386/asm.h: Fix test for extending the mprotect area
3888 towards lower addresses.
3890 2006-05-16 Bruno Haible <bruno@clisp.org>
3892 * lightning/asm-common.h: Don't use __func__ nor __FUNCTION__ if
3893 not compiling with GNU C.
3895 2006-02-16 Paolo Bonzini <bonzini@gnu.org>
3897 * lightning/ppc/core.h: Fix jit_ldxi_* with big displacement.
3899 2006-01-23 Paolo Bonzini <bonzini@gnu.org>
3901 * configure.ac: Fix comments in config.h.in.
3903 2005-11-25 Paolo Bonzini <bonzini@gnu.org>
3905 * lightning/sparc/fp.h: Fix header comment.
3906 * lightning/ppc/fp.h: Fix header comment.
3908 2005-04-27 Paolo Bonzini <bonzini@gnu.org>
3910 * lightning/i386/asm.h (JCm, JCSm, JNCm, JNCSm): New.
3912 2004-11-26 Paolo Bonzini <bonzini@gnu.org>
3914 * lightning/ppc/funcs.h (_jit_epilog): Remove unused variable.
3916 2004-11-13 Paolo Bonzini <bonzini@gnu.org>
3918 * lightning/i386/funcs.h [__linux__]: Include sys/mman.h.
3920 2004-11-09 Paolo Bonzini <bonzini@gnu.org>
3922 * lightning/sparc/fp.h: Fix fp-to-integer conversions.
3923 * lightning/ppc/testfp.c: Test fp-to-integer conversions
3925 * lightning/ppc/testfp.ok: Adjust for the above.
3927 2004-11-08 Paolo Bonzini <bonzini@gnu.org>
3929 * lightning/ppc/testfp.c: Always flush code before
3932 2004-11-08 Paolo Bonzini <bonzini@gnu.org>
3934 * lightning/ppc/fp.h: Do not clobber f31.
3936 2004-11-08 Paolo Bonzini <bonzini@gnu.org>
3938 * lightning.h: New name of...
3939 * lightning-inst.h: ... this file.
3940 * lightning.h.in: Removed.
3942 * opcodes/disass.c: Include config.h.
3943 * tests/add.c: Include config.h.
3944 * tests/bp.c: Include config.h.
3945 * tests/fib.c: Include config.h.
3946 * tests/fibdelay.c: Include config.h.
3947 * tests/fibit.c: Include config.h.
3948 * tests/funcfp.c: Include config.h.
3949 * tests/incr.c: Include config.h.
3950 * tests/printf.c: Include config.h.
3951 * tests/printf2.c: Include config.h.
3952 * tests/rpn.c: Include config.h.
3953 * tests/rpnfp.c: Include config.h.
3954 * tests/testfp.c: Include config.h.
3956 2004-10-12 Paolo Bonzini <bonzini@gnu.org>
3958 * lightning/i386/fp.h: Fix bugs in conditional branches.
3960 2004-10-10 Paolo Bonzini <bonzini@gnu.org>
3962 * lightning/i386/funcs.h: Fix pasto in jit_flush_code.
3964 2004-10-08 Paolo Bonzini <bonzini@gnu.org>
3966 * lightning/ppc/fp.h: Optimized conditional branches.
3968 2004-09-20 Paolo Bonzini <bonzini@gnu.org>
3970 * lightning/ppc/asm.h: Fix more typos.
3972 2004-09-20 Paolo Bonzini <bonzini@gnu.org>
3974 * lightning/ppc/asm.h: Fix typos, replace `26' with JIT_AUX.
3976 2004-09-20 Paolo Bonzini <bonzini@gnu.org>
3978 * lightning/ppc/fp.h: Added conditional branches.
3980 2004-09-18 Laurent Michel <ldm@thorgal.homelinux.org>
3982 * lightning/ppc/fp.h (jit_unler_d, jit_unltr_d, jit_unger_d,
3983 jit_ungtr_d, jit_ltgt_d, jit_uneq_d): Implemented missing tests
3984 to fully support testfp.
3985 (jit_floorr_d_i, jit_ceilr_d_i, jit_roundr_d_i, jit_truncr_d_i):
3987 * lightning/ppc/asm.h: Added missing opcodes FCTIWZ and MTFSFI.
3988 * lightning/ppc/funcs.h (_jit_prolog): Fixed minor mistake in
3989 the initialization of _jitl.nextarg_geti, relying on the
3990 JIT_AUX macro as well to get the register offset.
3992 2004-09-07 Paolo Bonzini <bonzini@gnu.org>
3994 * lightning/ppc/funcs.h: Fix typo.
3996 2004-09-06 Paolo Bonzini <bonzini@gnu.org>
3998 * tests/funcfp.c: Use %g. Remove C99 variable declarations.
3999 * tests/testfp.c: Don't use __builtin_nan.
4001 * lightning/ppc/core.h: Add three V registers.
4002 * lightning/ppc/funcs.h: Adjust.
4004 * lightning/sparc/core.h: Some fixes related to FP argument passing.
4005 Move R0 to %g2, use %o7 for JIT_BIG2.
4006 * lightning/sparc/fp.h: Some fixes related to FP argument passing.
4008 2004-09-02 Paolo Bonzini <bonzini@gnu.org>
4010 * lightning/sparc/core.h: Add another V register,
4013 2004-07-15 Paolo Bonzini <bonzini@gnu.org>
4015 * lightning/i386/funcs.h: Implement jit_flush_code,
4016 in order to support Fedora's exec-shield.
4018 2004-07-14 Paolo Bonzini <bonzini@gnu.org>
4020 * lightning/core-common.h: Add more jit_extr_*_* macros.
4021 * lightning/doc/using.texi: Be clearer about the order
4022 of arguments in jit_extr_*_*.
4023 * lightning/doc/porting.texi: Add more jit_extr_*_* macros.
4024 * lightning/i386/fp.h: Fix typo in jit_extr_i_d.
4026 2004-07-14 Paolo Bonzini <bonzini@gnu.org>
4028 * lightning/ppc/funcs.h: Adjust offset of LR into
4029 stack frame if running under the Darwin ABI.
4031 2004-07-13 Paolo Bonzini <bonzini@gnu.org>
4033 * lightning/i386/fp.h: Rename jit_exti_d to jit_extr_i_d.
4035 2004-07-13 Paolo Bonzini <bonzini@gnu.org>
4037 * lightning/ppc/core.h: Fix thinko.
4039 * lightning/i386/core.h: Fix jit_lti_ui.
4040 * lightning/core-common.h: Add missing macros.
4042 * lightning/ppc/fp.h: Rename jit_neg_* to jit_negr_*.
4043 * lightning/i386/fp.h: Rename jit_neg_* to jit_negr_*.
4044 * lightning/sparc/fp.h: Rename jit_neg_* to jit_negr_*.
4045 * lightning/fp-common.h: Rename jit_neg_* to jit_negr_*.
4046 * doc/porting.texi: Add undocumented macros.
4048 2004-07-12 Paolo Bonzini <bonzini@gnu.org>
4050 * doc/porting.texi: Add missing macros.
4052 2004-07-12 Paolo Bonzini <bonzini@gnu.org>
4054 * lightning/ppc/funcs.h: Don't generate trampolines.
4055 Separate prolog and epilog generation.
4056 * lightning/ppc/core.h: Generate epilog explicitly.
4057 Don't reserve r31 anymore.
4058 * lightning/core-common.h: Remove call to jit_setup_code.
4060 2004-07-09 Paolo Bonzini <bonzini@gnu.org>
4062 * lightning/lightning.h.in: Avoid preprocessor warnings.
4063 * lightning/lightning-inst.h: Likewise.
4065 * lightning/i386/core.h: Define JIT_R, JIT_R_NUM, JIT_V,
4067 * lightning/ppc/core.h: Likewise.
4068 * lightning/sparc/core.h: Likewise.
4069 * lightning/i386/fp.h: Define JIT_FPR, JIT_FPR_NUM.
4070 * lightning/ppc/fp.h: Likewise.
4071 * lightning/sparc/fp.h: Likewise.
4072 * lightning/core-common.h: Define fixed register names.
4073 * lightning/fp-common.h: Likewise for FP regs.
4075 2004-07-09 Paolo Bonzini <bonzini@gnu.org>
4077 * lightning/ppc/funcs.h: Fix location where return address
4079 * lightning/i386/asm.h: Add a trailing _ to opcodes without
4081 * lightning/i386/core.h: Adjust for the above.
4083 2004-04-15 Paolo Bonzini <bonzini@gnu.org>
4085 * lightning/i386/fp.h: Change "and" to "_and"
4086 to satisfy C++ compilers.
4088 2004-04-14 Paolo Bonzini <bonzini@gnu.org>
4090 * lightning/sparc/fp.h: Use memcpy to implement jit_movi.
4091 * lightning/ppc/fp.h: Use memcpy to implement jit_movi.
4092 Move floating-point opcodes...
4093 * lightning/ppc/asm.h: ... here.
4095 2004-04-14 Paolo Bonzini <bonzini@gnu.org>
4097 * lightning/core-common.h: Add jit_finishr.
4098 * lightning/ppc/core.h: Add jit_callr and jit_finishr.
4099 * lightning/i386/core.h: Add jit_callr.
4100 * lightning/sparc/core.h: Add jit_callr. Fix typo.
4102 2004-04-14 Paolo Bonzini <bonzini@gnu.org>
4104 * lightning/i386/core.h: Fix pasto in jit_b*_ui.
4106 2004-03-30 Laurent Michel
4108 * lightning/ppc: Implement PowerPC floating point
4109 (ChangeLog entry missing).
4111 2004-03-12 Paolo Bonzini <bonzini@gnu.org>
4113 * lightning/fp-common.h: Load/store macros are not the
4114 same for floats and doubles anywhere, but jit_retval may be.
4115 * lightning/i386/asm.h: Fix = mistaken for == in ESCrri.
4116 * lightning/i386/core.h: Fix typo in jit_prepare_[fd].
4117 * lightning/i386/fp.h: Rewritten.
4118 * tests/testfp.c: Add tests for unordered comparisons.
4119 * tests/testfp.ok: Add results.
4121 2004-03-15 Paolo Bonzini <bonzini@gnu.org>
4123 Merge changes from Laurent Michel.
4125 * lightning/asm-common.h: Add _jit_I_noinc.
4126 * lightning/core-common.h: Support jit_init,
4127 jit_setup_code, jit_patch_at. Return patchable IP from
4129 * lightning/funcs-common.h: Provide defaults
4130 for jit_setup_code, jit_start_pfx, jit_end_pfx
4131 * lightning/i386/core.h: Add jit_patch_at, jit_patch_movi.
4132 * lightning/ppc/core.h: Likewise.
4133 * lightning/sparc/core.h: Likewise.
4134 * lightning/ppc/asm.h: Fix generation of branch destination
4135 displacements in _FB and _BB
4136 * lightning/ppc/core.h: Generate trampolines in the user
4138 * lightning/ppc/funcs.h: Add a few casts.
4139 * tests/bc.c: New testcase.
4141 * lightning/i386/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4142 * lightning/ppc/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4143 * lightning/sparc/asm.h: Wrap into #ifndef LIGHTNING_DEBUG.
4146 2004-03-09 Paolo Bonzini <bonzini@gnu.org>
4148 * lightning/sparc/fp.h: Rewrite. Move macros for
4149 FP code generation...
4150 * lightning/sparc/asm.h: ... here.
4151 * lightning/sparc/core.h: Rename jit_prepare to
4152 jit_prepare_i, jit_retval to jit_retval_i.
4153 * lightning/ppc/core.h: Rename jit_prepare to
4154 jit_prepare_i, jit_retval to jit_retval_i.
4155 * lightning/i386/core.h: Rename jit_prepare to
4156 jit_prepare_i, jit_retval to jit_retval_i.
4157 * lightning/core-common.h: Provide backwards
4158 compatible synonyms for the above.
4159 * lightning/fp-common.h: Rewrite.
4160 * lightning-inst.h: Include fp unconditionally.
4161 * lightning.h.in: Include fp unconditionally.
4162 * tests/Makefile.am: Enable fp tests.
4163 * tests/fib.c: Use jit_retval_i.
4164 * tests/fibit.c: Cast codeBuffer to char *.
4165 * tests/funcfp.c: Use new fp macros.
4166 * tests/printf.c: Use jit_retval_i.
4167 * tests/rpnfp.c: Use new fp macros.
4168 * tests/testfp.c: Use new fp macros.
4170 2004-03-02 Paolo Bonzini <bonzini@gnu.org>
4172 * lightning/i386/core.h: generate correct code when
4173 doing lt/le/ge/etc. on ESI and EDI. Use MOVZX/MOVSX
4175 * lightning/i386/asm.h: Add macros for MOVZX/MOVSX.
4176 Move macros for x87 here, and add many of them.
4177 * lightning/i386/fp.h: Use new macros for x87.
4179 2004-02-06 Paolo Bonzini <bonzini@gnu.org>
4181 * lightning/i386/core.h: avoid generating MOV reg, reg.
4182 * lightning/sparc/core.h: fix several bugs.
4183 * lightning/ppc/core.h: fix several bugs.
4184 * tests/rpn.c: rewritten.
4186 2004-01-08 Paolo Bonzini <bonzini@gnu.org>
4188 * tests/rpnfp.c: new example, suggested by Basile
4190 * tests/rpnfp.ok: new example.
4192 2003-12-12 Paolo Bonzini <bonzini@gnu.org>
4194 * tests/add.c: new test, suggested by Steve Dekorte.
4195 * tests/add.c: new test.
4197 2003-11-14 Paolo Bonzini <bonzini@gnu.org>
4198 John Redford <eirenik@hotmail.com>
4200 * lightning/asm-common.h: change the 'pc' field of _jit to
4201 be a union of various data types, because ISO C99 doesn't
4202 permit using ++ on a = cast. Change the incremented casts of
4203 _jit.pc to be _jit.x.uc_pc, _jit.x.us_pc, etc.
4204 * all files: change all non-cast instances of _jit.pc to be
4206 * lightning/i386/core.h: remove casts from jit_might.
4208 2003-05-25 Paolo Bonzini <bonzini@gnu.org>
4210 * lightning/i386/core.h: use JITSORRY in jit_replace
4211 * lightning/asm-common.h: define JITSORRY
4213 2003-05-14 Paolo Bonzini <bonzini@gnu.org>
4215 * lightning/i386/core.h: fix missing comma in several
4217 * lightning/core-common.h: fix long/unsigned long/pointer
4219 * lightning/ppc/funcs.h: correctly align stack pointer
4221 No changelogs for the assemblers (lightning directory) until 1.0
4223 2003-03-27 Paolo Bonzini <bonzini@gnu.org>
4225 * tests/printf2.c: new test
4227 2001-05-03 Paolo Bonzini <bonzini@gnu.org>
4229 * tests/printf.c: made the message platform independent
4231 2001-01-19 Paolo Bonzini <bonzini@gnu.org>
4233 * configure.in: support cross-assembling
4235 * disass/bfd.h, disass/dis-asm.h, disass/dis-buf.c,
4236 disass/i386-dis.c, disass/i386.h, disass/ppc-dis.c,
4237 disass/ppc.h, disass/ppc-opc.c, disass/sparc-dis.c,
4238 disass/sparc.h, disass/sparc-opc.c: new files, from GDB
4240 * disass/disass.c, disass/Makefile.am: new files
4242 * tests/fib.c, tests/fibit.c, tests/incr.c, tests/printf.c,
4243 tests/rpn.c, tests/testfp.c, tests/Makefile.am: support