* include/lightning/jit_mips.h, lib/jit_mips.c: Update to
make the mips backend compile in a qemu image.
* lib/jit_ppc.c: Minor adaptations to help in having the
ppc backend compilable.
* configure.ac, include/lightning/jit_private.h, lib/jit_arm-cpu.c,
lib/jit_arm-swf.c, lib/jit_arm.c, check/Makefile.am: Correct
implementation of the arm backend port to build and pass the
current test cases. Tested on armv7 with softfp abi.
* lib/jit_disasm.c: Rename and change prototype of static
disassemble function as in the arm backend it is required
to access state information stored in the jit_state_t object.
* check/3to2.tst, check/add.tst: Correct test case code assuming
JIT_RO and JIT_RET are the same, and even if they are the same,
the logic was incorrect because it must always call jit_retval*
to fetch a function call return before any other instruction.
The arm backend hash a special condition if jit_retval is not
called, because "r0" is not JIT_R0, but is JIT_RET and *also*
the first argument for a called function, so JIT_RET must be
only used as an argument to jit_retval.
* TODO: New file listing important tasks to be resolved.
* check/all.tst, check/lightning.c: Only declare or use 64 bit
interfaces on 64 bit builds.
* check/fib.tst: Use simpler logic to not need preprocessor
conditionals for 32 or 64 bit.
* include/lightning.h: Only declare 64 bit macros on a 64 bit
build. Code using lightning must know about wordsize and the
jit generation limitations, also, this way it generates a
compile time failure, not a runtime assertion.
* include/lightning/jit_x86.h: Correct typo in macro name.
* lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
lib/jit_x86.c, lib/jit_x86-cpu.c: Correct wrong code to get
current jit function pointer.
* lib/lightning.c: Move call to the simplify() optimization
to after register liveness is known. Previous code did work
by accident but now with proper test cases the problem was
noticed.
* lib/jit_disasm.c: Always cast bfd_vma to long long when
passing it as printf argument.
* lib/jit_ppc.c: Assign copyright ownership to FSF.
* lib/jit_x86-cpu.c: Correct integer multiplication that was
generating code with reversed register arguments.
* check/rpn.ok, check/rpn.tst: New test case file.
2012-12-02 Paulo Andrade <pcpa@gnu.org>
* lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
Actually change copyright owner to FSF as avertised.
* lib/jit_arm-cpu.c, lib/jit_arm-swf.c,
lib/jit_arm-vfp.c, lib/jit_arm.c,
lib/jit_mips-cpu.c, lib/jit_mips-fpu.c, lib/jit_mips.c,
lib/jit_ppc-cpu.c, lib/jit_ppc-fpu.c, lib/jit_ppc.c: New
files implementing initial code different jit backends.
* include/lightning/jit_private.h: Add extra field to the
private jit_patch_t type, required by the arm port.
* lib/Makefile.am: Update for the new backend implementation
files.
* .gitignore: Update pattern of ignored files.
* check/Makefile.am: Add rule to build liblightning.la dependency
in case of running "make check" before building the library.
* lightning/Makefile.am, lightning/asm-common.h,
lightning/core-common.h, lightning/fp-common.h,
lightning/funcs-common.h, lightning/i386/Makefile.frag,
lightning/i386/asm-32.h, lightning/i386/asm-64.h,
lightning/i386/asm.h, lightning/i386/core-32.h,
lightning/i386/core-64.h, lightning/i386/core.h,
lightning/i386/fp-32.h, lightning/i386/fp-64.h,
lightning/i386/fp.h, lightning/i386/funcs.h,
lightning/ppc/asm.h, lightning/ppc/core.h,
lightning/ppc/fp.h, lightning/ppc/funcs.h,
lightning/sparc/asm.h, lightning/sparc/core.h,
lightning/sparc/fp.h, lightning/sparc/funcs.h:
Removed. The core logic is used in the new code, and new mips
and arm ports will be added. At first, sparc will not be
supported as it has not yet been ported to the new engine.
2012-12-02 Paulo Andrade <pcpa@gnu.org>
* tests/Makefile.am, tests/3to2.c, tests/3to2.ok, tests/add.c,
tests/add.ok, tests/allocai.c, tests/allocai.ok, tests/bp.c,
tests/bp.ok, tests/divi.c, tests/divi.ok, tests/fib.c, tests/fib.ok,
tests/fibdelay.c, tests/fibdelay.ok, tests/fibit.c, tests/fibit.ok,
tests/funcfp.c, tests/funcfp.ok, tests/incr.c, tests/incr.ok,
tests/ldst.c, tests/ldst.ok, tests/ldxi.c, tests/ldxi.ok,
tests/modi.c, tests/modi.ok, tests/movi.c, tests/movi.ok,
tests/printf.c, tests/printf.ok, tests/printf2.c, tests/printf2.ok,
tests/ret.c, tests/ret.ok, tests/rpn.c, tests/rpn.ok, tests/rpnfp.c,
tests/rpnfp.ok, tests/sete.c, tests/sete.ok, tests/testfp.c,
tests/testfp.ok, tests-run-test: Removed previous test suite, in
favor of a newer one in the check subdirectory.
* check/3to2.ok, check/3to2.tst, check/add.ok, check/add.tst,
check/allocai.ok, check/allocai.tst, check/bp.ok, check/bp.tst,
check/divi.ok, check/divi.tst, check/fib.ok, check/fib.tst:
New sample input for the new test program, loosely matching
several of the previous test cases.
* check/Makefile.am: New test suite makefile.
* check/check.sh, check/run-test: New wrapper files for the
new test suite.
* check/lightning.c: New file. The main driver of the new test
suite, that compiles to a parser of a very simple assembly like
language, generates jit and executes it.
* check/all.tst: New file. A generic debug and sample test file
with a directive to prevent it from being executed, and useful to
read disassembly of all possible instructions, using a fixed set
of registers.
* include/Makefile.am, include/lightning.h,
include/lightning/Makefile.am, include/lightning/jit_arm.h,
include/lightning/jit_mips.h, include/lightning/jit_ppc.h,
include/lightning/jit_private.h, include/lightning/jit_x86.h,
lib/Makefile.am, lib/jit_disasm.c, lib/jit_print.c,
lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c,
lib/jit_x86.c, lib/lightning.c: New files. These files are
written from scratch, only by <pcpa@gnu.org>, and have now
copyright assignment to the FSF. This is the core of the new
lightning rework. Previously it was integrated in code with
a garbage collector and several custom types like vectors and
hash tables, so this first code merge with lightning converts
that code into a library extracting only the jit bits, and at
first only for x86_64 GNU/Linux.
* lightning.h, m4/lightning.m4: Removed. These are no longer
required in the new lightning code.
.gitignore, Makefile.am, configure.ac: Update for the new
lightning code.
2012-12-02 Paulo Andrade <pcpa@gnu.org>
* .cvsignore: Removed for extra cleanup.
* build-aux: Rename directory to m4.
* m4: Renamed to "default" name and for consistency with merge
with code rework to be imported in lightning.
* .gitignore, configure.ac, Makefile.am, doc/Makefile.am:
Update for build-aux to m4 rename.
2012-12-01 Paulo Andrade <pcpa@gnu.org>
* opcode/Makefile.am, opcode/Makefile.in, opcode/ansidecl.h,
opcode/bfd.h, opcode/dis-asm.h, opcode/dis-buf.c, opcode/disass.c,
opcode/i386-dis.c, opcode/i386.h, opcode/ppc-dis.c, opcode/ppc-opc.c,
opcode/ppc.h, opcode/sparc-dis.c, opcode/sparc-opc.c, opcode/sparc.h,
opcode/sysdep.h: Removed. Do not bundle GNU binutils files.
* aclocal.m4, configure, Makefile.in, config.h.in, doc/Makefile.in,
lightning/Makefile.in, tests/Makefile.in: Removed. Do not maintain
autogenerated files that also generate too much diff noise when
regenerated in git.
* build-aux/help2man, build-aux/texinfo.tex, build-aux/texi2dvi:
Removed. Buildenvironment must have an up to date version from
upstream installed.
* build-aux/config.guess, build-aux/config.sub, build-aux/depcomp,
build-aux/install-sh build-aux/mdate-sh build-aux/missing: Removed.
Do not maintain a copy of automake files in git. Release tarballs
must use an up to date version.
* lightningize.in, doc/lightningize.1: Removed. Do not encourage
bundling lightning in other packages. It should use a system package
or a proper thirdy part subdirectory.
* INSTALL: Removed. Autoreconf removes it and creates a symlink
when regenerating files, so, avoid conflicts in git and let
automake create the symlink.
* .gitignore: Add INSTALL and autogenerated files.
* configure.ac, Makefile.am: Update for removal of opcode subdir,
auto generated files and lightningize.
* tests/Makefile.am, tests/3to2.c, tests/add.c, tests/bp.c,
tests/fib.c, tests/fibdelay.c, tests/fibit.c, tests/funcfp.c,
tests/incr.c, tests/printf.c, tests/rpn.c, tests/rpnfp.c,
tests/sete.c, tests/testfp.c: Update for removal of opcode subdir.
* doc/Makefile.am: Update for removal of lightningize.
* configure.ac, lightning/ppc/funcs.h, lightning/sparc/funcs.h,
lightning/i386/fp.h, lightning/i386/core.h, lightning/i386/asm.h,
tests/3to2.c, tests/add.c, tests/bp.c, tests/fib.c, tests/fibdelay.c,
tests/fibit.c, tests/funcfp.c, tests/incr.c, tests/printf.c,
tests/rpn.c, tests/rpnfp.c, tests/sete.c, tests/testfp.c:
Remove LIGHTNING_CROSS, it is half supported and incomplete.
* tests/3to2.c, tests/funcfp.c, tests/rpnfp.c: Remove preprocessor
check on JIT_FPR. If no hardware registers are available, the backend
must provide an alternative for software float.
* lightning/ppc/core.h, lightning/sparc/core.h, tests/Makefile.am:
Remove JIT_NEED_PUSH_POP. It is absolutely not trivial to implement
properly on some backends due to stack alignment constraints, and
whenever it is required, using jit_allocai and using a properly
aligned stack vector, or a heap buffer, is better.
* tests/push-pop.c, tests/push-pop.ok: Removed due to
JIT_NEED_PUSH_POP no longer available.
There is no guarantee of order of jit_function calls, so, it must
reset it for every function. This should correct possible issues in
OS/X, and will be required when i386 code is updated to use MMX/SSE*
registers, possibly as some kind of extended interface, and then,
would require 16 bytes aligned stack. This is already an issue if
calling C code that uses SSE, and currently requires "manually"
padding the stack by using jit_allocai.
The problems would also happen with 32 bit unsigned operands that would
happen to have the topmost bit set, so, now it only uses 32 bit immediates
when bit 31 is not set.
This patch correct all the issues found by the test cases alu_add.tst and
alu_sub.tst in http://code.google.com/p/exl/source/browse/trunk/check/lightning
The checks were moved from i386/asm.h to i386/asm-{32,64}.h, as well
as some macros from core-{32,64}.h. Now it checks if the value is in the
range of a valid register, and in the proper register class, what should
prevent the common mistake of calling a jit*r_x macro passing an immediate
as argument.
Now it pass lightning's make check in i386/x86_64, as well as all test
cases in http://code.google.com/p/exl/source/browse/trunk/check/lightning
when compiled with -D_ASM_SAFETY.
jit_bra_l had the logic reversed, and correcting that also corrected
jit_b{lt,le,eq,ge,gt,ne}i_l.
TESTQir and _ALUQir were not properly working with 64 bit immediates,
that require using a temporary register (JIT_REXTMP) as there are no
related opcodes for 64 bit immediates. This corrected jit_bm{s,c}i_l and
jit_bo{add,sub}i_l.
Now, the tests in
http://code.google.com/p/exl/source/browse/trunk/check/lightning/branch.tst
pass.
The x86_64 correction to keep stack aligned in jit_finish* was only
correct for functions being called, but did not correctly handle alignment
of stack arguments.
This changes the usage of some of the jit_local_state fields, and add
two extra ones. Since jit_arg_x now returns either a register offset or
an stack offset, it does not add _XMM0 to nextarg_putfp to distinguish
from stack offsets.
The nextarg_puti field is used to known when run out of integer register
arguments, and should push arguments on the stack.
The new framesize field is used to keep track of jit_arg_x offset on
the stack, when jit_arg_x runs out of registers.
The argssize field is used in a slightly different way now, and is
used to keep track of number of stack slots used to pass arguments, and
nextarg_puti is used in its previous semantics, to also match nextarg_putfp
logic.
It is required to set %al to 0-8 inclusive, telling the number of
xmm registers used to pass arguments.
This also corrects the calculation of _jitl.nextarg_putfp, that
would be incorrect if calling a function with both, float and double
arguments.
Lightning provides at least 6 float registers, so, in this commit,
reduce from 8 to 7 so that code respecting JIT_FPR_NUM should be
safe again't use of JIT_FPTMP.
To not clobber JIT_R2, JIT_REXTMP is defined to the callee save register
%r12, instead of the expected, scratch register %r11.
To have JIT_V_NUM at least at 3, it now also uses %r14, but does not add
%r15, that could be JIT_V(4) to simplify logic of keeping stack 16 bytes
aligned.
2010-08-10 Paulo César Pereira de Andrade <pcpa@mandriva.com.br>
Paolo Bonzini <bonzini@gnu.org>
* lightning/i386/core-32.h (jit_replace): Use MOVLrr, not MOVLir.
(jit_movbrm): Check index register as well.
* lightning/i386/fp-64.h: Add jit_extr_f_d and jit_extr_d_f.
* lightning/fp-common.h: Add jit_extr_f_d and jit_extr_d_f.
2010-07-28 Paolo Bonzini <bonzini@gnu.org>
* THANKS: Add Paulo Cesar Pereira de Andrade.
* doc/porting.texi: Fix ordering of arguments in jit_stxi.
* lightning/i386/core-32.h (jit_replace): Remove cmp argument.
* lightning/i386/fp-64.h (jit_movi_f): Fix.
2009-02-17 Paolo Bonzini <bonzini@gnu.org>
* lightning/fp-common.h: Define double branches if missing.
* lightning/i386/asm.h: Define JC and JNC mnemonics.
* lightning/i386/fp-32.h: Fix jit_fp_btest. All reported
by Mike Spivey.
2008-07-02 Laurent Michel <ldm@engr.uconn.edu>
* lightning/ppc/funcs.h (jit_flush_code): modified the computation
of start/end. The pointer arithmetic was done without casting. It
prevented compilation with recent gcc versions.
* lightning/ppc/core.h (jit_pushr_i): The offset for the store was
incorrect. Should have been 4 bytes below SP (not above).
* lightning/ppc/core.h (jit_popr_i): The offset for the load was
incorrect. Should have been 0 (not +8).
2008-06-16 Paolo Bonzini <bonzini@gnu.org>
* lightning/i386/core.h: Use jit_save in jit_replace. Move JIT_R
definition...
* lightning/i386/core-32.h: ... here; define jit_save so that
the core.h has no effect on the 32-bit backend.
* lightning/i386/core-64.h: Place JIT_R1/JIT_R2 in R10/R11,
place outgoing arguments in the right spot from the beginning,
define jit_save, fix jit_reg8/jit_reg16.