1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-26 13:10:22 +02:00
Commit graph

60 commits

Author SHA1 Message Date
Luke Nihlen
3f495cc5d6 set size to known value before init 2022-01-11 09:02:30 -05:00
Luke Nihlen
6cdea3995a replace use of uninitialized variable size in reset_literal_pool 2022-01-10 20:32:00 -05:00
Andy Wingo
2784bee8e5 Spill whole words to stack, even for uint8_t args
* lightening/lightening.c (abi_gpr_to_mem): Write whole words when
  spilling GPRs to the stack.  Always correct given that all Lightening
  operations that write GPRs write the whole register, and the current
  ABI targets allow writing the extra words.  Closes #15.
2020-07-30 14:26:37 +02:00
Andy Wingo
ca1cc01cdf Literal pools have word-alignment, not u64-alignment
Prevents useless over-alignment for ARM.

* lightening/lightening.c (struct jit_literal_pool_entry): Value is a
  uintptr_t.
  (emit_uintptr): New helper.
  (emit_abs_reloc): Use new helper.
  (patch_pending_literal): Value is a uintptr_t.
  (emit_literal_pool): Adapt to literal entry being uintptr_t.
2020-07-30 14:04:47 +02:00
Andy Wingo
44b07aef4b Allow jit_begin_data to declare max data size
* lightening.h:
* lightening/lightening.c (jit_begin_data): Add max data size
  parameter.  If nonzero, can allow the JIT to avoid prematurely
  emitting a constant pool.
  (jit_end_data): Allow pending literals.
* tests/jmp_table.c (run_test): Use new API.
2020-07-30 13:41:02 +02:00
Andy Wingo
91c1591e41 Add support for emitting inline data and table switches
* lightening.h:
* lightening/lightening.c (jit_begin_data, jit_end_data)
  (jit_emit_u8, jit_emit_u16, jit_emit_u32, jit_emit_u64): Add new raw
  data-emitting primitives, bracketed by begin/end so that we can flush
  constant pools first, if needed.
* lightening/lightening.c (struct jit_state): Add new emitting_data
  flag.
  (jit_begin, jit_reset, jit_end): Handle the new flag.
  (emit_abs_reloc): Move here, from x86.c.
* lightening/x86.c (emit_abs_reloc): Remove.
  (jit_try_shorten): Don't shorten if loc == start; could be raw data.
* tests/jmp_table.c: New test.
2020-07-30 13:02:46 +02:00
Andy Wingo
2c0fdb045e Fix unused variable warning for no-literal-pool targets
* lightening/lightening.c (jit_patch_there): Conditionally define
  flags.
2020-06-19 16:30:12 +02:00
Andy Wingo
6e317e70dd Merge branch 'fix-literal-pool-reset' into 'master'
Fix zeroing of literal pool entries

See merge request wingo/lightening!5
2020-06-19 14:25:36 +00:00
Andy Wingo
97212e87bd Fix zeroing of literal pool entries
* lightening/lightening.c (reset_literal_pool): Zero before setting size
  to 0.  Thanks to Dale Smith for pointing this out!
2020-06-19 16:23:36 +02:00
Icecream95
11b9d3744e
Always emit veneers for non-bl jumps to ARM code
It is unlikely for any ARM code to be close enough to not have needed
a veneer, but it is possible, especially if running in a program with
another JIT library.
2020-04-09 22:31:20 +12:00
Icecream95
8045386a45
Return a function pointer from jit_address
This will allow supporting ARM code on armv7 without having to change
any users of Lightening.
2020-04-09 20:26:35 +12:00
Icecream95
aacaa6e38c
Add separate functions for veneer patching 2020-04-06 19:52:29 +12:00
Icecream95
297ae99c3f
Add flag bits to the jit_reloc_kind enum 2020-04-06 16:04:57 +12:00
Andy Wingo
909c0077cc Correctly handle overflow when emitting literal pools 2019-05-27 11:34:13 +02:00
Andy Wingo
0b3393415e Allow add_pending_literal to return false
This avoids invalidating offsets for the reloc.
2019-05-22 17:29:10 +02:00
Andy Wingo
b67c4ed1e1 Avoid recursive pool emit for aarch64; add another overflow check 2019-05-21 16:05:03 +02:00
Andy Wingo
b7f367165f Various fixes for as-needed emission of literal pool 2019-05-21 15:25:08 +02:00
Andy Wingo
568fdecc86 Fix literal pool emission on armv7 2019-05-21 14:19:48 +02:00
Andy Wingo
0518651bfd Expose API to bless function pointers
On ARMv7, we need to set the low bit to indicate that we're in
thumb-land.
2019-05-21 14:00:04 +02:00
Andy Wingo
ef7abb568a Fix typo in previous commit, doh 2019-05-21 12:44:00 +02:00
Andy Wingo
d2c15dd6cd Clear literal pool more thoroughly 2019-05-21 12:38:53 +02:00
Andy Wingo
723f70ee11 Clear missing bit from literal pool 2019-05-21 12:24:20 +02:00
Andy Wingo
0b723c0401 ARMv7 backend passing all tests! 2019-05-20 15:20:33 +02:00
Andy Wingo
7dd18bddd7 ARMv7 backend compiling without warnings 2019-05-20 11:02:21 +02:00
Andy Wingo
1ea34693cb Port of arm-cpu.c to current lightening 2019-05-19 22:21:50 +02:00
Andy Wingo
9d4185af2b Remove jit_nop
Instead, jit_align will call nop() internally.  You can't nop 3 bytes on
most architectures.
2019-05-16 11:40:24 +02:00
Andy Wingo
9638e4f169 Fix a couple bugs related to aarch64 literal pools 2019-05-16 11:03:49 +02:00
Andy Wingo
9c9389ad2b Fix enter/leave JIT ABI 2019-05-16 10:45:44 +02:00
Andy Wingo
a643f99d68 Fix compilation on aarch64 2019-05-16 10:19:02 +02:00
Andy Wingo
7e0b0be1ba Fix GPR temporary selection 2019-05-15 16:26:18 +02:00
Andy Wingo
09e71475f4 Allow a backend to have multiple temporary registers 2019-05-15 16:19:33 +02:00
Andy Wingo
5b8262e804 Rework register saving to avoid push/pop
Push and pop are not well supported on AArch64, so we might as well just
bump the stack pointer once and fill in by offset.
2019-05-15 15:41:02 +02:00
Andy Wingo
0bfdcc7016 Refactor to add support for constant tables, shifted relocs 2019-05-14 15:53:25 +02:00
Andy Wingo
fc9b474da6 Refactor some bits from x86 to lightening 2019-05-10 14:14:32 +02:00
Andy Wingo
f7080facb4 Refactor to move temp register acquire to core 2019-05-09 16:02:39 +02:00
Andy Wingo
570f361c6c Remove Sparc support
Sadly, this is a dead architecture, without an official Debian port.
Rest in peace!
2019-05-08 21:44:03 +02:00
Andy Wingo
ced3c42dee Remove hppa support
This is a dead architecture without an official Debian port.
2019-05-08 21:44:03 +02:00
Andy Wingo
d51bd7d592 Remove alpha support
This is a dead architecture without an official Debian port.
2019-05-08 21:44:01 +02:00
Andy Wingo
80f79fca93 Remove ia64 (itanium) support
This is a dead architecture without an official Debian port.
2019-05-08 21:37:40 +02:00
Andy Wingo
2a5d315ab9 Unget temp xpr after mem->mem addend fixup 2019-04-28 16:21:09 +02:00
Andy Wingo
04cd8874de Stack alignment takes saved return address into account 2019-04-28 12:37:19 +02:00
Andy Wingo
d617315fdb Fix jit_leave_jit_abi to pop correct registers
Also relax stack alignment on 32-bit x86
2019-04-27 22:27:39 +02:00
Andy Wingo
e0cf51e482 Small bug fixes for ia32 2019-04-26 17:41:43 +02:00
Andy Wingo
42bc762d26 Add facility to enter and leave JIT ABI
This allows us to save and restore callee-save temporaries, i.e. RBP on
32-bit x86.  Otherwise it's a disaster shuffling stack arguments using
temporaries.
2019-04-26 17:28:29 +02:00
Andy Wingo
e9d1567f7f Use jit_word_t for register-sized values instead of intmax_t 2019-04-26 15:00:29 +02:00
Andy Wingo
bab1f40b5e Fix lightening to compile on 32-bit x86 2019-04-26 14:44:09 +02:00
Andy Wingo
89fd69fc00 Account for saved return address when locating args
Also, fix alignment to be in bytes rather than bits.  Oops!
2019-04-26 14:38:29 +02:00
Andy Wingo
ac972e1dba Inline some internal definitions into backend-specific files 2019-04-26 14:37:35 +02:00
Andy Wingo
04d89a7ce2 Implement reloc shortening, and remove unused functionality 2019-04-26 12:40:44 +02:00
Andy Wingo
dc28ac03c1 Make jit_align_stack and jit_shrink_stack public 2019-04-26 10:04:04 +02:00