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

17263 commits

Author SHA1 Message Date
Andy Wingo
a3a45279c0 Rewrite control-point? to avoid consing
* module/language/cps/dfg.scm (control-point?): Rewrite to avoid consing
  a successors list.
2014-03-31 18:21:04 +02:00
Andy Wingo
4bf757b810 Remove succs from DFG
* module/language/cps/dfg.scm ($dfg): Remove "succs" from DFG.  Instead
  we can compute the successors set on-demand.
  (lookup-successors): Adapt.
2014-03-31 18:21:04 +02:00
Andy Wingo
4926024cfb Simplify boot-9 and srfi-1 map
* module/ice-9/boot-9.scm (map):
* module/srfi/srfi-1.scm (map): Simplify the implementations to check
  for list? beforehand.  It's faster, and it will be needed if we decide
  to go recursive.
2014-03-31 18:21:04 +02:00
Andy Wingo
de3cbadcc0 Avoid consing in compute-label-and-var-ranges.
* module/language/cps/dfg.scm (compute-label-and-var-ranges): Avoid
  consing.
2014-03-31 18:21:04 +02:00
Andy Wingo
5fc403911e Scope and scope-level in DFG vector
* module/language/cps/dfg.scm ($dfg): Hoist scopes and scope levels out
  of $block and into $dfg.  Adapt all callers.
2014-03-31 18:21:04 +02:00
Andy Wingo
21d6d183a9 Predecessors and successors in DFG vectors
* module/language/cps/dfg.scm ($dfg, $block): Record predecessors and
  successors in vectors instead of in $block data structures.  Adapt
  users.
2014-03-31 18:21:04 +02:00
Andy Wingo
f49e994b52 DFG refactor
* module/language/cps/dfg.scm (lookup-cont, lookup-block):
  (lookup-def, constant-needs-allocation?): Rework these accessors to
  avoid completely destructuring the $dfg.
2014-03-31 18:21:04 +02:00
Andy Wingo
62b7180bfd Renumber functions before emitting code
* module/language/cps/compile-bytecode.scm (compile-bytecode): Renumber
  a function before going to compile it, so that the vars and labels are
  contiguous within each function.
2014-03-31 18:21:04 +02:00
Andy Wingo
f05517b24e Add renumber module
* module/language/cps/renumber.scm: New module.
* module/Makefile.am: Add to build.

fix renumber
2014-03-31 18:21:04 +02:00
Andy Wingo
98c5b69fa0 Replace use-map in DFG with separate def / use vectors
* module/language/cps/dfg.scm ($dfg, $use-map): Replace use-map vector
  with "defs" and "uses" vectors.  Adapt callers.
2014-03-31 18:21:04 +02:00
Andy Wingo
b99553301c Remove "sym" from $use-map
* module/language/cps/dfg.scm ($use-map): Remove "sym" from use-map;
  it's redundant.  Adapt callers.
2014-03-31 18:21:04 +02:00
Andy Wingo
cec43eb8f6 $use-map no longer has name member
* module/language/cps/dfg.scm ($use-map): Remove name member.  Adapt
  users.
2014-03-31 18:21:04 +02:00
Andy Wingo
29619661e4 $dfa no longer includes name vector (can get that from dfg)
* module/language/cps/dfg.scm ($dfa, dfa-var-name):
  (compute-live-variables, print-dfa): Remove "names" from DFAs.
2014-03-31 18:21:04 +02:00
Andy Wingo
5e89790896 DFG stores conts, blocks, and use-maps in vectors
* module/language/cps/dfg.scm ($dfg): Change to store conts, blocks, and
  use-maps as vectors.  A DFG also records the minimum label, minimum
  variable, and the number of labels and variables.  The first entry in
  one of these vectors corresponds to the minimum.  This can be
  optimum in the local case if the conts and variables have been renamed
  appropriately.

  Adapt callers.

  (compute-live-variables): Adapt.  This is currently suboptimal but it
  works, so it's a useful base for optimization.
2014-03-31 18:21:04 +02:00
Andy Wingo
fbdb69b21c lookup-cont takes a DFG as its argument
* module/language/cps/dfg.scm (lookup-cont): Change to take a DFG
  instead of a cont table.
  (build-cont-table): Change to return a vector.

* module/language/cps/arities.scm:
* module/language/cps/contification.scm:
* module/language/cps/dce.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/elide-values.scm:
* module/language/cps/reify-primitives.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm: Adapt to lookup-cont and
  build-cont-table changes.
2014-03-31 18:21:04 +02:00
Andy Wingo
a6f823bd02 Public make-cont-folder
* module/language/cps.scm (make-cont-folder): Add global? parameter, and
  make public.
  (fold-conts): Adapt.
  (fold-local-conts): Use make-cont-folder, and take a function instead
  of a continuation.

* module/language/cps/arities.scm (fix-clause-arities, fix-arities*):
* module/language/cps/compile-bytecode.scm (collect-conts):
* module/language/cps/elide-values.scm (elide-values*): Adapt to
  fold-local-conts change.
2014-03-31 18:21:04 +02:00
Andy Wingo
1eda52c8ad Vars and labels are separate namespaces
* module/language/cps.scm (fresh-var, with-fresh-name-state): Vars have
  their own namespace.
2014-03-31 18:21:04 +02:00
Andy Wingo
b9e601d20d Prepare for decoupling of var/label name uniqueness
* module/language/cps/simplify.scm (compute-beta-reductions):
  (beta-reduce): Separate state into two tables, so we can relax current
  guarantee that vars and labels are mutually unique.
2014-03-31 18:21:04 +02:00
Andy Wingo
eb60b4136b Update verify-cps
* module/language/cps/verify.scm (verify-cps): Vars should only be exact
  integers now.
2014-03-31 18:21:04 +02:00
Andy Wingo
e6cf744ab4 CPS conversion renames incoming gensyms to small integers
* module/language/tree-il/compile-cps.scm (fold-formals)
  (unbound?, init-default-value, convert): Arrange to rename incoming
  gensyms as small integers.
  (canonicalize): Convert vector and abort here too.
2014-03-31 18:20:55 +02:00
Andy Wingo
699ed8ce29 Less copying in tree-il pre-order / post-order.
* module/language/tree-il.scm (pre-post-order): If the pre handler
  doesn't modify the components of a tree-il expression, avoid copying a
  new one.
2014-03-31 18:20:55 +02:00
Andy Wingo
ef58442a05 Prompt-related refactor in compile-cps
* module/language/tree-il/compile-cps.scm (fix-prompts): New procedure.
  Eta-expand prompts before compiling to ensure that they have inline
  handlers.
2014-03-31 18:20:55 +02:00
Andy Wingo
cd72929e71 DCE uses fresh-var instead of gensym
* module/language/cps/dce.scm (eliminate-dead-code): Use fresh-var
  instead of gensym.
2014-03-31 18:20:55 +02:00
Andy Wingo
39056a81fc Adapt verify-cps to CPS changes
* module/language/cps/verify.scm (verify-cps): Update to expect integer
  labels, and to allow integer variables.
2014-03-31 18:20:55 +02:00
Andy Wingo
828ed94469 Replace all let-gensyms uses with let-fresh
* .dir-locals.el: Add with-fresh-name-state.
* module/language/cps.scm (fresh-label, fresh-var): Signal an error if
  the counters are not initialized.
  (with-fresh-name-state): New macro.
  (make-cont-folder): New macro, generates an n-ary folder.
  (compute-max-label-and-var): New function, uses make-cont-folder.
  (fold-conts): Use make-cont-folder.
  (let-gensyms): Remove.

* module/language/cps/arities.scm:
* module/language/cps/closure-conversion.scm:
* module/language/cps/constructors.scm:
* module/language/cps/dce.scm:
* module/language/cps/elide-values.scm:
* module/language/cps/reify-primitives.scm:
* module/language/cps/specialize-primcalls.scm: Use let-fresh instead of
  let-gensyms, and wrap in a with-fresh-name-state as needed.

* module/language/tree-il/compile-cps.scm: Remove hack to avoid
  importing let-gensyms from (language tree-il).
2014-03-31 18:20:55 +02:00
Andy Wingo
0534735314 Remove unneeded local exact-integer? definition
* module/system/vm/assembler.scm (link-debug): Remove unneeded
  exact-integer? definition.
2014-03-31 18:20:55 +02:00
Andy Wingo
9a1dfb7d2e Continuation labels and variable identifiers may be integers
* module/language/cps.scm (label-counter, var-counter): New parameters,
  for producing fresh label and var names.
  (fresh-label, fresh-var): New procedures.
  (let-fresh): New macro, will replace let-gensyms.
  (build-cps-term): Use let-fresh.

* module/language/tree-il/compile-cps.scm: Use let-fresh to generate
  fresh names.

* module/system/vm/assembler.scm (make-meta, begin-kw-arity): Allow
  exact integers as labels.
  (link-debug): Explicitly mark low-pc as being an "addr" value.
2014-03-31 18:20:55 +02:00
Andy Wingo
ecc7987427 Sloppier matching in setitimer tests
* test-suite/tests/signals.test: Update setitimer tests to sloppily
  match both times -- it seems that the interval can also be sloppy on
  some platforms, sadly.
2014-03-26 10:47:40 +01:00
Andy Wingo
56f79491c4 Adapt test-out-of-memory to work on 32-bit systems
* test-suite/standalone/test-out-of-memory (*limit*): Reduce limit to 50 MB.
  Adapt vector test to avoid exceeding maximum vector size on 32-bit
  systems.
2014-03-26 10:35:53 +01:00
Nathaniel Alderson
8d124d2077 Calculate usecs correctly in thread-sleep!
* module/srfi/srfi-18.scm (thread-sleep!): Correctly compute
  microseconds.

* test-suite/tests/srfi-18.test: Add test.
2014-03-23 21:58:54 +01:00
Andy Wingo
63b9e8b03f Fix compile warnings
* libguile/throw.c (catch): Fix bad declarations.

* libguile/stackchk.c (reset_scm_stack_checking_enabled_p): Remove
  unused static function.
2014-03-22 16:06:39 +01:00
Andy Wingo
c2247b782a Out-of-memory situations raise exceptions instead of aborting
* libguile/gc.c (scm_oom_fn, scm_init_gc): Install an out-of-memory
  handler that raises an unwind-only out-of-memory exception.
  (scm_gc_warn_proc, scm_init_gc): Install a warning proc that tries to
  print to the current warning port, if the current warning port is a
  file port.
  (scm_gc_after_nonlocal_exit): New interface.  Should be called after a
  nonlocal return to potentially collect memory; otherwise allocations
  could try to expand again when they should collect.

* libguile/continuations.c (scm_i_make_continuation):
* libguile/eval.c (eval):
* libguile/throw.c (catch):
* libguile/vm.c (scm_call_n): Call scm_gc_after_nonlocal_exit after
  nonlocal returns.

* libguile/throw.c (abort_to_prompt, throw_without_pre_unwind): Rework
  to avoid allocating memory.
  (scm_report_out_of_memory): New interface.
  (scm_init_throw): Pre-allocate the arguments for stack-overflow and
  out-of-memory errors.

* module/ice-9/boot-9.scm: Add an out-of-memory exception printer.
* module/system/repl/error-handling.scm (call-with-error-handling): Add
  out-of-memory to the report-keys set.

* libguile/gc-malloc.c (scm_realloc): Call scm_report_out_of_memory if
  realloc fails.

* libguile/error.h:
* libguile/error.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_memory_error): Deprecate.

* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-out-of-memory: New test case.
2014-03-22 15:49:31 +01:00
Andy Wingo
0463a927c4 Define a C fluid for current-warning-port
* libguile/ports.c (scm_current_input_port, scm_current_output_port)
  (scm_current_error_port): Fix declarations to C99.
  (scm_current_warning_port, scm_set_current_warning_port): Rework to
  use a C fluid, like scm_current_error_port.
  (scm_init_ports): Initialize and define the warning port fluid.

* libguile/init.c (scm_init_standard_ports): Init the current warning
  port.

* module/ice-9/boot-9.scm: Remove definitions for current-warning-port.
  Instead, steal it from the boot objtable with port-parameterize!.
2014-03-22 15:42:15 +01:00
Ludovic Courtès
972fb41f0c Bump version number for 2.0.11.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_REVISION): Increment.
2014-03-20 21:21:21 +01:00
Ludovic Courtès
d4d11cf39d Update NEWS. 2014-03-20 21:20:59 +01:00
Ludovic Courtès
0c1f2b0e0d tests: Add #undef NDEBUG when using <assert.h>.
* test-suite/standalone/test-loose-ends.c,
  test-suite/standalone/test-num2integral.c,
  test-suite/standalone/test-round.c,
  test-suite/standalone/test-scm-c-bind-keyword-arguments.c,
  test-suite/standalone/test-scm-c-read.c,
  test-suite/standalone/test-scm-values.c,
  test-suite/standalone/test-smob-mark.c,
  test-suite/standalone/test-srfi-4.c: Add #undef NDEBUG.
2014-03-20 09:43:01 +01:00
Ludovic Courtès
f2c3d29fd2 tests: Check 'simple-format' with closed current-output-port.
This is a follow-up to e26ab06.

* libguile/print.c (scm_simple_format): Pass 1 to
  SCM_VALIDATE_OPORT_VALUE, for 'destination'.
* test-suite/tests/format.test ("simple-format"): Add test.
2014-03-20 09:40:42 +01:00
Mark H Weaver
5dcbcfcef8 Fix (rnrs io simple) to open file ports in textual mode.
Fixes <http://bugs.gnu.org/17044>.
Reported and diagnosed by Xin Wang <dram.wang@gmail.com>.

* module/rnrs/io/simple.scm (open-input-file, open-output-file): Pass
  missing buffer-mode argument to open-file-{input,output}-port.
  Previously, (native-transcoder) was incorrectly passed as the
  buffer-mode argument, so no transcoder was provided, thus creating a
  binary port.
2014-03-19 23:36:46 -04:00
Mark H Weaver
e26ab067b2 simple-format: Don't assume the current output port is valid.
* libguile/print.c (scm_simple_format): Validate the current output
  port.
2014-03-19 17:55:20 -04:00
Andy Wingo
2be7131ee0 Fix breakage of SRFI-4 C accessors
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix bad assumption that
  width was a byte width.  Thanks very much to Barry Fishman for the
  report, and to Daniel Llorens for tracking it down.

* test-suite/standalone/Makefile.am (test_srfi_4_CFLAGS):
* test-suite/standalone/test-srfi-4.c: Add test.
2014-03-19 22:41:19 +01:00
Ludovic Courtès
92b793da2b Bump version number for 2.0.10.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_REVISION): Increment.
2014-03-17 23:18:38 +01:00
Ludovic Courtès
f755f14e32 Fix typo in NEWS. 2014-03-17 23:06:21 +01:00
Ludovic Courtès
6a450390ca Update NEWS.
* NEWS: Remove last 'XXX'.
2014-03-17 22:13:09 +01:00
Andy Wingo
77326d3649 Update NEWS
* NEWS: Update.
2014-03-17 22:05:39 +01:00
Ludovic Courtès
c68b9470e9 Update NEWS.
* NEWS: Move "New interfaces" higher.  Complement.
2014-03-17 21:57:38 +01:00
Andy Wingo
b7faf399c1 Fix newline preservation in @example with lines beginning with @
* module/texinfo.scm (read-char-data): Preserve newlines in @example and
  similar environments in the case when the next line starts with an @.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test.
2014-03-17 21:49:16 +01:00
Andy Wingo
48c2a5395a DFG inlines uses of for-each
* module/language/cps/dfg.scm (for-each, for-each/2): Define inline
  versions of these.  Adapt callers.
2014-03-17 10:10:36 +01:00
Mark H Weaver
679ffce89c Minor NEWS tweaks.
* NEWS: Fix typo and improve wording in custom ellipsis entry.
2014-03-17 02:54:47 -04:00
Mark H Weaver
cdf1ae8983 Add first draft of NEWS for 2.0.10.
* NEWS: Add first draft of changes in 2.0.10.
2014-03-17 02:42:38 -04:00
Mark H Weaver
580ef7fcf4 Documentation tweaks for the 'r7rs-symbols' read/print options.
* doc/ref/api-data.texi (Symbol Read Syntax): Mention the 'r7rs-symbols'
  print option, and provide example code to enable both the read and
  print options.  Add 'r7rs-symbols' to the concept index.
2014-03-17 02:40:23 -04:00