1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-06 07:30:28 +02:00
Commit graph

20154 commits

Author SHA1 Message Date
Andy Wingo
048d5d340e Intset-next micro-optimizations
* module/language/cps/intset.scm (intset-next): Micro-optimizations.
2015-04-01 10:53:23 +02:00
Andy Wingo
9c8d2b85e8 Add intset-fold, intset-fold2
* module/language/cps/intset.scm (intset-fold, intset-fold2): New
  functions.
2015-04-01 10:53:23 +02:00
Andy Wingo
b7668bd949 Add intmap-fold.
* module/language/cps/intmap.scm (intmap-fold): New function.
2015-04-01 10:53:21 +02:00
Andy Wingo
2a24395a0f Add intmap-prev
* module/language/cps/intmap.scm (intmap-next): Starting index is
  optional.
  (intmap-prev): New function.
2015-04-01 10:28:19 +02:00
Andy Wingo
33ab2838de Default "meet" operator is meet-error for intmap
* 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.
2015-04-01 10:28:19 +02:00
Andy Wingo
50fcdfece3 Remove "free" field of $fun
* module/language/cps.scm ($fun): Remove unused "free" field.
* module/language/cps/arities.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/constructors.scm:
* module/language/cps/contification.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/dfg.scm:
* module/language/cps/elide-values.scm:
* module/language/cps/prune-bailouts.scm:
* module/language/cps/prune-top-level-scopes.scm:
* module/language/cps/renumber.scm:
* module/language/cps/self-references.scm:
* module/language/cps/simplify.scm:
* module/language/cps/specialize-primcalls.scm:
* module/language/cps/type-fold.scm:
* module/language/cps/verify.scm:
* module/language/tree-il/compile-cps.scm: Adapt all callers.
2015-04-01 10:10:10 +02:00
Andy Wingo
34ff3af9f0 Replace $letrec with $rec
* 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.
2015-04-01 10:10:10 +02:00
Andy Wingo
4ce1857019 Precise range inference on <, <=, >=, > branches
* module/language/cps/types.scm (restricted-comparison-ranges): New
  helper.
  (define-comparison-inferrer): New helper.
  (<, <=, >=, >): Infer ranges precisely.
2015-04-01 10:10:10 +02:00
Andy Wingo
ef7a71b768 Fix intmap bug for maps with only one element
* module/language/cps/intmap.scm (intmap-ref): Fix bug referencing
  values when there is only one value in the map.
2015-04-01 10:10:10 +02:00
Ludovic Courtès
dfa11aa3f6 elf: Add missing argument in 'elf-segment'.
* module/system/vm/elf.scm (elf-segment): Add missing argument N.
2015-03-30 15:19:58 +02:00
Andy Wingo
fe7ecee820 Only lazily compile where profitable
* module/ice-9/eval.scm (primitive-eval): Only lazily compile box-ref on
  toplevel variables; otherwise compile eagerly to avoid the
  indirection.
2015-03-12 14:48:03 +01:00
Andy Wingo
7fee63b947 Optimize branches in the evaluator
* 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.
2015-03-12 14:26:24 +01:00
Andy Wingo
d76d80d23c Primcall inlining in eval.scm, lazy function body compilation
* 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.
2015-03-12 14:06:15 +01:00
Andy Wingo
eb0376567d Remove unused "nargs" field of memoized call expressions
* libguile/eval.c (eval):
* libguile/memoize.c (MAKMEMO_CALL, memoize, unmemoize):
* module/ice-9/eval.scm (primitive-eval): Remove "nargs" field from
  memoized call expressions, and adapt callers.
2015-03-12 08:37:04 +01:00
Andy Wingo
af082f9b1c Marginal bootstrap memory improvements
* module/language/cps/compile-bytecode.scm (optimize, compile-bytecode):
  Marginally improve bootstrap memory usage by not retaining stale
  copies of already-rewritten terms.
2015-03-12 08:20:58 +01:00
Andy Wingo
a9ec16f9c5 Remove $void CPS expression type
* module/language/cps.scm: Remove the $void expression type, replaced by
  $const of the unspecified value.
* module/language/cps/arities.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/compile-bytecode.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/dfg.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/reify-primitives.scm:
* module/language/cps/renumber.scm:
* module/language/cps/self-references.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/specialize-primcalls.scm:
* module/language/cps/types.scm:
* module/language/cps/verify.scm:
* module/language/tree-il/compile-cps.scm: Update callers.
2015-03-11 21:51:33 +01:00
Andy Wingo
1f3babaaef Adapt GDB integration to newest patches
* 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.
2015-03-09 13:48:38 +01:00
Andy Wingo
aead655a45 Re-implement (ice-9 streams) in terms of (srfi srfi-41)
* module/ice-9/streams.scm: Re-implement in terms of SRFI-41.  Passes
  tests.
2015-03-09 13:48:38 +01:00
pcpa
1507bc7ee5 Properly correct read of freed memory 2015-03-08 16:22:10 -03:00
Mark H Weaver
9331f40a2d build: Use pipe symbol instead of comma for substitutions.
* meta/Makefile.am (substitute): Use pipe symbol instead of comma for
  substitutions.
2015-03-07 00:13:36 -05:00
pcpa
20955b2bfc Correct read of freed memory 2015-03-01 11:38:41 -03:00
Daniel Llorens
eb3d623da5 Non-vector 1D arrays print as #1()
* 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.
2015-02-18 09:32:30 +01:00
pcpa
531a88aeeb Add missing ellipsis in allocar.tst 2015-02-17 17:39:58 -02:00
pcpa
d462a4f85f Correct typo in x87.nodata test list 2015-02-17 14:39:08 -02:00
pcpa
ad589fbb0a Implement jit_allocar for dynamic stack allocation
* 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.
2015-02-17 14:37:57 -02:00
pcpa
9f72e66116 X86: No longer make st7 available as a temporary
* 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.
2015-02-17 13:55:01 -02:00
Andy Wingo
c4c21de44f Struct and array GDB pretty printers hint as arrays
* 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.
2015-02-17 11:53:03 +01:00
Andy Wingo
47612fd68a GDB support: add frame annotators and filters
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.
2015-02-17 11:02:52 +01:00
Andy Wingo
ef52b3992c De-bitrot libguile-2.2-gdb.scm
* 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.
2015-02-17 11:00:21 +01:00
Andy Wingo
577eab817c (system base types) knows about variables
* module/system/base/types.scm (%tc7-variable): New tc7.
  (cell->object): Handle tc7-variable.

* test-suite/tests/types.test ("opaque objects"): Add a test.
2015-02-17 10:58:29 +01:00
pcpa
2597bf3c13 Correct inconsistency with jit_regno_patch
* 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.
2015-02-16 15:07:36 -02:00
pcpa
3a03feae5d X86: Correct load and store in the x32 abi
* 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.
2015-02-15 23:14:27 -02:00
Andy Wingo
37ae02ffa0 Fix infinite loop in expander
* 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.
2015-02-13 16:43:01 +01:00
Andy Wingo
1bbf7f7580 Add `scm_smob_type_class()'.
* libguile/smob.h:
* libguile/smob.c (scm_smob_type_class): New function, to access the
  GOOPS class for a SMOB type.
2015-02-10 14:35:35 +01:00
Andy Wingo
22c9e769f1 NEWS and doc updates
* doc/ref/vm.texi: Update for new instructions.
* doc/ref/web.texi: Update for URI-reference support.
* NEWS: Update.
2015-02-09 22:43:20 +01:00
Andy Wingo
d64146f210 Document support for URI references.
* doc/ref/web.texi (URIs): Update for URI reference changes.
2015-02-08 13:14:00 +01:00
pcpa
7fdbc5b84a GNU lightning 2.1.0 release 2015-02-07 17:10:37 -02:00
pcpa
26c28beeeb Correct typo 2015-02-07 17:09:22 -02:00
pcpa
fb21cf9f38 Avoid problems if JIT_INSTR_MAX is miscalculated
* 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.
2015-02-07 17:08:43 -02:00
Andy Wingo
e87f059319 Reify bytevector? in the correct module
* module/language/cps/reify-primitives.scm (primitive-module): Reify
  bytevector? in the correct module.  Thanks to Nala Ginrut for the
  report.
2015-02-06 15:13:32 +01:00
Andy Wingo
26350edcac Add #:static-slot-allocation?
* 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.
2015-02-06 13:25:17 +01:00
Andy Wingo
05d0cdf18e Fix foreign objects for getter method change
* module/system/foreign-object.scm: Fix getters after change to make
  <accessor-method> instances only apply to their precise specializer
  types.
2015-02-06 12:27:56 +01:00
Paulo Andrade
f6970c62cf Correct the reason the simplify_stxi bug was not noticed before
* 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.
2015-02-03 15:42:50 -02:00
Paulo Andrade
5724068b1c Correct wrong check in simplify_stxi.
* 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.
2015-02-03 15:19:21 -02:00
Paulo Andrade
cdf5b785eb ARM: Regenerate size table for hard float armv7 or newer. 2015-02-02 20:49:48 -02:00
Paulo Andrade
678280734e Add new --enable-devel-disassembler configure option
* 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.
2015-02-02 20:49:22 -02:00
Paulo Andrade
1b055bf0d8 Make more readable always true test 2015-02-01 13:04:38 -02:00
Paulo Andrade
6db38b75e9 ARM: Do not limit to 24 bit displacement jump to unknown address
* lib/jit_arm-cpu.c, lib/jit_arm.c: Only limit to 24 bit
	displacement non conditional jump in the same jit_state_t.
2015-01-31 15:59:25 -02:00
Andy Wingo
7b0a8dfb75 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/goops.c
	libguile/vm-engine.h
	module/oop/goops.scm
	module/oop/goops/compile.scm
	module/oop/goops/dispatch.scm
	test-suite/tests/goops.test
2015-01-26 18:13:38 +01:00
Andy Wingo
649ec8d823 Accessor methods only apply to subclasses with their slot
* 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.
2015-01-26 17:57:44 +01:00