* module/language/cps/intmap.scm (meet-error): New helper.
(intmap-add, intmap-union, intmap-intersect): The "meet" argument is
optional and defaults to meet-error.
* module/language/cps.scm ($rec): Replace $letrec with $rec, which is an
expression, not a term. This means that the names bound by the letrec
appear twice: once in the $rec term, and once in the continuation.
This is not very elegant, but the situation is better than it was
before. Adapt all callers.
* doc/ref/compiler.texi (CPS in Guile): Incomplete documentation
updates. I'll update these later when the IL settles down.
* module/ice-9/eval.scm (primitive-eval): Factor out primitive=?
helper. Simplify compile-top-call. Add compile-top-branch for
primcall branches, so the compiler can see the specialized branch
operator.
* module/ice-9/eval.scm (primitive-eval): Lazily compile lambda bodies.
Special-case calls to top-level or module variables, and recognize
some of those calls as primcalls. In that case, emit closures with
the primcalls.
* module/language/cps/compile-bytecode.scm (optimize, compile-bytecode):
Marginally improve bootstrap memory usage by not retaining stale
copies of already-rewritten terms.
* libguile/libguile-2.2-gdb.scm (vm-frame-function-name): Don't default
to the address, as we will have better identifying info via the file
name.
(vm-frame-source): New helper.
(compile-time-cond): For some reason "else" matching wasn't working;
punt and use expressions.
(snarfy-frame-decorator): Rename from decorator, and adapt to new
version of Guile frame filter patch.
(vm-frame-filter): Adapt to frame filter changes, and fill in source
info.
* libguile/arrays.c (scm_i_print_array): Print the dimension whenever
the array is a true scm_tc7_array.
* test-suite/tests/arrays.test: Check that non-vector 1D arrays print as
expected.
* include/lightning.h, include/lightning/jit_private.h,
lib/jit_aarch64-cpu.c, lib/jit_aarch64.c,
lib/jit_alpha-cpu.c, lib/jit_alpha.c,
lib/jit_arm-cpu.c, lib/jit_arm.c,
lib/jit_hppa-cpu.c, lib/jit_hppa.c,
lib/jit_ia64-cpu.c, lib/jit_ia64.c,
lib/jit_mips-cpu.c, lib/jit_mips.c,
lib/jit_ppc-cpu.c, lib/jit_ppc.c,
lib/jit_s390-cpu.c, lib/jit_s390.c,
lib/jit_sparc-cpu.c, lib/jit_sparc.c,
lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
jit_allocar(offs, size) interface, that receives
two integer registers arguments, allocates space
dynamically in the stack, returns the offset in
the first argument, and uses the second argument
for the size in bytes of the memory to be allocated.
* check/allocar.ok, check/allocar.tst: New files
implementing test cases for the new jit_allocar
interface.
* check/Makefile.am, check/lightning.c: Update for
the new test case and interface.
* doc/body.texi: Add documentation of the new
interface.
* include/lightning/jit_x86.h, lib/jit_x86-cpu.c,
lib/jit_x86-x87.c: No longer make st(7) available.
Need to keep one x87 slots empty to avoid exceptions.
This has the side effect of no longer needing the
hackish emms instruction before a function call.
* libguile/libguile-2.2-gdb.scm (make-scm-pretty-printer-worker):
(%scm-pretty-printer): Refactor to avoid printing all struct / array
fields by hinting these as arrays. The resulting print is not as
faithful to the original data, but that's probably OK.
These features depend on a patch to GDB that has not been merged yet.
If GDB doesn't support the annotator/filter interface, the code have no
effect.
* libguile/libguile-2.2-gdb.scm (compile-time-cond): New helper.
(snarfy-frame-annotator): Simple annotator that gives subr names for
snarfed gsubrs.
(vm-frame-filter): New filter that interleaves Scheme frames with C
frames on the stack when the user asks for a backtrace.
* libguile/libguile-2.2-gdb.scm: Update to work with Guile 2.2 stacks.
Represent the VM stack as a SRFI-41 stream, which will work better
with the frame filter interface. Add support for getting the vm
frame's function name, if possible.
* lib/lightning.c: Remove the jit_regno_patch bitfield
register fields before actual emit, as it is only really
used before emit, otherwise, on special conditions it
may consider live registers as dead during code emit.
* lib/jit_x86-cpu.c, lib/jit_x86-sse.c, lib/jit_x86-x87.c:
Correct encoding of ldxr* stxr* in the x32 abi. If the
displacement register is negative, it would generate
a 64 bit instruction with a 32 bit unsigned displacement.
* check/ranger.tst, check/ranger.ok: New files, implementing
a test case for negative loads and stores. This is range.tst
converted to use registers instead of immediate offsets.
check/Makefile.am: Update for the new test case.
* module/ice-9/psyntax.scm (resolve-identifier): There is a case where a
syntax object can resolve to itself. Prevent an infinite loop in that
case by continuing to resolve by name.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/syncase.test ("infinite loop bug"): Add a test.
* lib/jit_size.c: Preventively use at least 144 bytes
if JIT_INSTR_MAX is less than it. The logic is not
guaranteed to be 100% precise, it is mostly heuristics
to allocate a buffer with as close as possible size,
but a wrong value may cause code generation to write
past the end of the buffer.
* libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_STATIC): Reserve the fourth
GOOPS flag to indicate that a class has static slot allocation.
* libguile/goops.c (scm_init_goops_builtins): Define
vtable-flag-goops-static for goops.scm.
* module/oop/goops.scm (class-has-statically-allocated-slots?): New
helper.
(build-slots-list): Instead of the ad-hoc checks for <class> or
<slot>, use the new helper.
(initialize): Accept #:static-slot-allocation? keyword.
* module/system/foreign-object.scm (make-foreign-object-type): Declare
foreign object classes as having static slot allocation.
* test-suite/tests/goops.test ("static slot allocation"): Add tests.
* lib/lightning.c: Correct the reason the bug in
simplify_stxi was not triggered before, it was due to
incorrectly resetting the value->code field, what was
causing it to never properly optimize:
stxi Im0 Rb0 Rt0
ldxi Rt1 Rb1 Im1
when Rb0 == Rb1, Rt0 == Rt1 and Im0 == Im1
There was another possible issue, that has been also
addressed in this commit, that would be the case of
Rbn == Rtn, where no redundancy removal is possible.
* lib/lightning.c: Correct wrong check in simplify_stxi.
The test was incorrectly comparing the target register
and the displacement offset. This was a time bomb bug,
that would trigger in code like:
stxi Im0 Rb0 Rt0
stxi Im1 Rb1 Rt1
if Rb0 == Rb1 && Rt0 == Rt1 && Im0 == Rt1, that is,
the wrong check was Im0 == Rt1, instead of the supposed
Im0 == Imm1 (that was what the code mean't to do). It
was removing the second stxi assuming it was redundantly
generated; as that is not uncommon pattern on
translators generating jit.
* configure.ac, include/lightning/jit_private.h,
lib/jit_aarch64.c, lib/jit_alpha.c, lib/jit_arm.c,
lib/jit_disasm.c, lib/jit_hppa.c, lib/jit_ia64.c,
lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c: Add a new
--enable-devel-disassembler option, that should be used
during development, or lightning debug. This option
intermixes previous jit_print and jit_disassemble
output, making it easier to visualize what lightning
call was used, and what code was generated.
* libguile/goops.c (is_accessor_method, scm_compute_applicable_methods):
Fix regression from 51f66c9120 (2009).
Accessor methods are added on each subclass on which the slot is
present; therefore if a subclass doesn't have a method, then the
methods doesn't apply. Truly fixes#17355, unlike
583a23bf10.
* module/oop/goops.scm (compute-cmethod, compute-getter-method)
(compute-setter-method): Revert earlier changes.
* test-suite/tests/goops.test ("accessor slots"): Update for new
expectations, in agreement with Guile 1.8.