1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 21:10:27 +02:00
Commit graph

20710 commits

Author SHA1 Message Date
Andy Wingo
b116314591 Fix compile warnings for 32-bit tests 2019-04-26 15:56:08 +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
14e64a8b57 Ensure stack alignment in JIT code.
* libguile/jit.c (emit_entry_trampoline): Explicitly align stack.
2019-04-26 12:45:16 +02:00
Andy Wingo
5b45f04cc8 Merge from upstream Lightening 2019-04-26 12:41:47 +02:00
Andy Wingo
04d89a7ce2 Implement reloc shortening, and remove unused functionality 2019-04-26 12:40:44 +02:00
Andy Wingo
796f263ed8 Remove unused jit_epilog definition 2019-04-26 11:40:06 +02:00
Andy Wingo
4e5329676b Fix backtraces with call-with-values during bootstrap
* libguile/programs.c (scm_i_program_name): Use scm_i_primitive_name for
  primitives.  No functional change though.
* libguile/vm.c (DEFINE_BUILTIN): Mark builtins as primitives.
2019-04-26 11:15:49 +02:00
Andy Wingo
dc28ac03c1 Make jit_align_stack and jit_shrink_stack public 2019-04-26 10:04:04 +02:00
Andy Wingo
c54c248bc9 Track frame size to more reliably align stack before calls 2019-04-26 09:56:46 +02:00
Andy Wingo
a3e044c808 Move jit_move_operands etc to common lightening.c file 2019-04-26 09:09:50 +02:00
Andy Wingo
52248cf622 Adapt to changes in upstream lightening
* libguile/jit.c (emit_entry_trampoline): Adapt to change in callee-save
  predicates.
2019-04-25 23:47:27 +02:00
Andy Wingo
5622396cd9 Merge from upstream lightening 2019-04-25 23:24:27 +02:00
Andy Wingo
e29977a82b Simplify register representation even more
The register structures just contain the regno.  Since the only flag is
the callee-save flag, we can punt that to a separate per-backend,
per-target predicate.
2019-04-25 23:22:44 +02:00
Andy Wingo
2602f17fb4 Simplify register representation again
There's only one flag, "callee-save".  Also the regno range is limited
to 0-63 inclusive, to allow for cheap register sets as uint64_t values.
2019-04-25 19:12:55 +02:00
Andy Wingo
4088915a7e Lower default JIT threshold as JIT is cheaper now
* libguile/jit.c (default_jit_threshold): Lower from 50000 to 1000.
2019-04-25 18:41:03 +02:00
Andy Wingo
e9a372b020 Re-enable fixnum less-than JIT fast-path
* libguile/jit.c (compile_less): Re-enable fast-path for fixnums, now
  that the JIT library works :)
2019-04-25 18:24:20 +02:00
Andy Wingo
f0be544463 Merge from upstream lightening 2019-04-25 18:12:42 +02:00
Andy Wingo
af4e0422ae Align stack on 64-bit targets for calls 2019-04-25 18:12:23 +02:00
Andy Wingo
b0cd9c0b77 Merge from upstream lightening 2019-04-25 17:16:54 +02:00
Andy Wingo
99e5672726 Renumber x86 registers
Now that there's no hazard to using a register used for passing
arguments, renumber to give JIT_R/JIT_F/JIT_V names to all registers.

Choose a temp register that's not used for passing arguments.  Our
previous choice was an argument register (doh!) which made function
calls with many arguments fail.
2019-04-25 17:14:28 +02:00
Andy Wingo
ddd66a2f34 Simplify register representation
Instead of JIT_R0 being a wrapped index into a table which then gives
the regno and class, just have JIT_R0 be the wrapped regno and class.
2019-04-25 17:03:46 +02:00
Andy Wingo
fa6093c4ef Merge from upstream lightening 2019-04-24 22:57:26 +02:00
Andy Wingo
b34e230413 Fix apply_addend bug
* lightening/x86.c (jit_move_operands): Fix bug when calling
  apply_addend.
2019-04-24 22:56:48 +02:00
Andy Wingo
0ef614ecf9 Fix a JIT bug
* libguile/jit.c (compile): Reset frame size as well when restarting
  compilation.  Fixes JIT errors.
2019-04-24 22:20:00 +02:00
Andy Wingo
9a32b4b1ad Adapt to new lightening call API
* libguile/jit.c: Operands have their ABI in them.  We can now have
  addends on GPR and MEM operands, which can improve register
  allocation.  Use new jit_calli_3, etc helper APIs.
2019-04-24 16:02:33 +02:00
Andy Wingo
d75303780b Merge from upstream lightening 2019-04-24 15:53:22 +02:00
Andy Wingo
4db777e12e Add support for operand addends
This can allow for better register allocation around calls for field
locations.
2019-04-24 15:52:07 +02:00
Andy Wingo
d07dac40ad Add proper parallel-moves solver
Add parallel assignment serializer from Guile, originating in the Caml
paper by Rideau et al.
2019-04-24 15:08:35 +02:00
Andy Wingo
609df9ea55 Merge from upstream lightening 2019-04-22 09:17:26 +02:00
Andy Wingo
0be4f7a2a1 Simplify API for loading call arguments 2019-04-22 09:15:03 +02:00
Mark H Weaver
63818453ad Reimplement SCM_MAKE_CHAR to evaluate its argument only once.
The motivation for this change is that SCM_MAKE_CHAR is sometimes passed
an expression that involves a procedure call that is not always trivial.
In other cases, the results are not guaranteed to be the same both
times, which could lead to the creation of invalid SCM objects.

* libguile/chars.h (SCM_MAKE_CHAR): Reimplement.
2019-04-17 03:02:55 -04:00
Andrea Azzarone
546b0e8729 Fix gc.test "after-gc-hook gets called" failures.
* libguile/scmsigs.c (signal_delivery_thread): Call scm_async_tick to
give any pending asyncs a chance to run before we block indefinitely
waiting for a signal to arrive.
2019-04-16 16:54:55 -04:00
Mark H Weaver
423ad3632f Update user-visible copyright years.
* doc/ref/guile.texi: Update years in copyright notice.
* module/ice-9/command-line.scm (version-etc): Update 'copyright-year'.
* module/system/repl/common.scm (*version*): Update copyright years.
2019-04-16 16:54:55 -04:00
Mark H Weaver
6b1de860ab Avoid passing NULL to 'memcpy' and 'memcmp'.
Reported by Jeffrey Walton <noloader@gmail.com> in
<https://lists.gnu.org/archive/html/guile-devel/2019-03/msg00001.html>.

Note that C11 section 7.1.4 (Use of library functions) states that:
"unless explicitly stated otherwise in the detailed descriptions [of
library functions] that follow: If an argument to a function has an
invalid value (such as ... a null pointer ...) ..., the behavior is
undefined."  Note that 'strxfrm' is an example of a standard C function
that explicitly states otherwise, allowing NULL to be passed in the
first argument if the size argument is zero, but no similar allowance is
specified for 'memcpy' or 'memcmp'.

* libguile/bytevectors.c (scm_uniform_array_to_bytevector): Call memcpy
only if 'byte_len' is non-zero.
* libguile/srfi-14.c (charsets_equal): Call memcmp only if the number of
ranges is non-zero.
* libguile/stime.c (setzone): Pass 1-character buffer to
'scm_to_locale_stringbuf', instead of NULL.
* libguile/strings.c (scm_to_locale_stringbuf): Call memcpy only if the
number of bytes to copy is non-zero.
2019-04-16 16:54:55 -04:00
Mark H Weaver
275c96dd1f Remove vestigial comment in tags.h.
* libguile/tags.h: Remove a vestigial comment which seems to have been
separated from its associated code long ago.
2019-04-16 16:54:55 -04:00
Andy Wingo
668196aa27 Fix lightening name 2019-04-05 16:25:22 +02:00
Andy Wingo
a45d651755 Add support for "make test-ia32" in tests/ 2019-04-05 16:24:21 +02:00
Andy Wingo
e6ac66a348 Allow test suite to test multiple targets.
* tests/Makefile: Allow for testing multiple targets.
2019-04-05 16:07:01 +02:00
Andy Wingo
b35662fb4e Merge from upstream Lightening 2019-04-04 17:07:09 +02:00
Andy Wingo
4e1876f294 Support spilling args to stack 2019-04-04 17:06:57 +02:00
Andy Wingo
cfffd5b241 Fix compilation of call-scm<-u64
* libguile/jit.c (compile_call_scm_from_u64): Fix to take operands from
  the right place.
2019-04-04 16:35:44 +02:00
Andy Wingo
5df432b763 Fix arena expansion logic
* libguile/jit.c (compile): Fix logic to clear old labels.
2019-04-04 14:59:38 +02:00
Andy Wingo
891e7600f4 JIT fixes for arena overflow
* libguile/jit.c (compute_mcode): Move analysis outside the code
emitter, as it doesn't need to re-run on overflow.
(compile): Clear labels before emitting, as they may have changed if we
overflowed.
2019-04-04 14:32:05 +02:00
Andy Wingo
9ff21412ff Minor JIT cleanups
* libguile/jit.c (fp_scm_operand): Fix assertion about register state.
(compile_call_scm_sz_u32): Fix ABI declaration for immediate.
Some whitespace cleanups as well.
2019-04-04 12:48:37 +02:00
Andy Wingo
39d1ed3c27 Merge from upstream Lightening 2019-04-04 12:11:08 +02:00
Andy Wingo
89de2cb286 More various JIT fixen
* libguile/jit.c (prepare_jit_state): Remove unused function.
(initialize_thread_jit_state): Since the lightening state is allocated
using GC memory, trace the JIT state.
(compute_mcode): Avoid double-compile.
2019-04-04 12:10:13 +02:00
Andy Wingo
ede10b101b Support immediate arguments 2019-04-04 12:09:41 +02:00