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

2773 commits

Author SHA1 Message Date
Andy Wingo
e68ed8397d statprof uses new setitimer magical usecs ability
* module/statprof.scm (sample-stack-procs): Take advantage of setitimer
  allowing usecs >= 1e6.
2014-02-28 10:36:21 +01:00
Andy Wingo
fc2b8f6c6d 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-02-27 17:16:29 +01:00
Andy Wingo
fd953d7a10 gcprof tweaks
* module/statprof.scm (gcprof): No need to reset in gcprof; the fresh
  profiler state and the parameterize handle that.  Fix mistaken
  set-vm-trace-level! as well.
2014-02-25 22:46:32 +01:00
Andy Wingo
19bf8caff3 Refactor representation of sampling periods in statprof
* module/statprof.scm (<state>): The sampling frequency is actually a
  period; label it as such, and express in microseconds instead of as a
  pair.  Likewise for remaining-prof-time.
  (fresh-profiler-state): Adapt.
  (reset-sigprof-timer): New helper.
  (profile-signal-handler): Use the new helper.
  (statprof-start): Use the new helper.
  (statprof-stop): Here too.
  (statprof-reset): Adapt to <state> change.
  (gcprof): Set remaining prof time to 0.
2014-02-25 22:40:32 +01:00
Andy Wingo
fd5dfcce80 statprof and gcprof procedures use a fresh statprof state
* module/statprof.scm (statprof, gcprof): Create a fresh statprof
  state.
2014-02-25 22:16:49 +01:00
Andy Wingo
4b3d7a2b7c Simplification pass prunes all unreachable continuations
* module/language/cps/simplify.scm (prune-continuations): Prune
  continuations as a post-pass with a fresh DFG.  Using a
  pre-eta-conversion DFG as we were doing before missed some cases.
2014-02-25 21:32:36 +01:00
Andy Wingo
546efe2514 simplify profile-signal-handler
* module/statprof.scm (profile-signal-handler): Don't bother detecting
  if we were in a count-call call or not; it doesn't matter, and we
  should accumulate time in any case.
2014-02-22 17:02:53 +01:00
Andy Wingo
3476a3692e statprof: accumulated-time is in jiffies
* module/statprof.scm (fresh-profiler-state): accumulated-time and
  gc-time-taken are in jiffies, not seconds, so they are exact.
  (statprof-accumulated-time): Divide by 1.0 so that we get a flonum.

  Also refactor use of assq to get the gc-time-taken.
2014-02-22 16:31:31 +01:00
Andy Wingo
90c8094aec Avoid attempting to eta-reduce self-loops.
* module/language/cps/simplify.scm (compute-eta-reductions): Avoid
  trying to eta-reduce a jump-to-self, as in (let lp () (lp)).  This
  caused the compiler to hang.
2014-02-22 15:34:46 +01:00
Andy Wingo
e4a8775ddb Pass state around statprof in more places
* module/statprof.scm (get-call-data, sample-stack-procs): Take the
  state as an argument.
  (profile-signal-handler, count-call, statprof-proc-call-data)
  (gcprof): Adapt.
2014-02-22 15:09:54 +01:00
Andy Wingo
e70a42d4c9 statprof: call-data is a record type
* module/statprof.scm (call-data): Reimplement as a record type.
2014-02-22 14:59:21 +01:00
Andy Wingo
cad444e31a statprof: when/unless instead of if.
* module/statprof.scm: Use when or unless instead of if, where
  appropriate.
2014-02-22 14:54:17 +01:00
Andy Wingo
d20dd74eca add a statprof fixme
* module/statprof.scm: Add a fixme.
2014-02-21 22:18:02 +01:00
Andy Wingo
4d0c358b4c statprof-active? instead of checking profile level
* module/statprof.scm (statprof-reset, statprof-fold-call-data):
  (statprof-proc-call-data, statprof-accumulated-time):
  (statprof-sample-count): Refactor some things to use statprof-active?
  instead of checking the profile level manually.
2014-02-21 22:12:47 +01:00
Andy Wingo
4eb1fb9b8a statprof-reset creates a new state
* module/statprof.scm (fresh-profiler-state): New helper.
  (ensure-profiler-state): Use it.
  (accumulate-time): No need to add 0.0 here.
  (statprof-reset): Create a new state instead of mutating the existing
  one.
2014-02-21 21:56:01 +01:00
Andy Wingo
45a7de8268 More statprof state refactorings
* module/statprof.scm (existing-profiler-state): New helper, gets the
  profiler state or fails if there is no state.
  (sample-stack-procs, profile-signal-handler, count-call)
  (statprof-fold-call-data, statprof-proc-call-data)
  (statprof-call-data->stats, statprof-display)
  (statprof-display-anomolies, statprof-accumulated-time)
  (statprof-sample-count, statprof-fetch-stacks)
  (statprof-fetch-call-tree): Use the new helper.
  (statprof-active?): Don't create a state if there isn't one already.
2014-02-21 21:43:39 +01:00
Andy Wingo
56bfce7c5d inside-profiler? to parameter instead of global variable
* module/statprof.scm (<state>): Add inside-profiler? member.  Move
  mutations of inside-profiler? here.
2014-02-21 21:25:50 +01:00
Andy Wingo
62fd93e242 Beginnings of statprof threadsafety
* module/statprof.scm (<state>, profiler-state, ensure-profiler-state):
  A mostly-mechanical refactor to encapsulate profiler state in a
  parameter and a record instead of global variables.
2014-02-21 21:01:10 +01:00
Andy Wingo
998f8494b7 reform statprof commentary
* module/statprof.scm: Reformat the commentary.
2014-02-21 19:20:16 +01:00
Andy Wingo
7e2fd4e7f5 Unwind-only stack overflow exceptions
* module/ice-9/boot-9.scm (catch): Signal an early error if the handler
  or pre-unwind handler types aren't right.  This is more important than
  it was, given that we dispatch on type now when finding matching catch
  clauses.

* libguile/vm.c (vm_expand_stack): Use the standard
  scm_report_stack_overflow to signal stack overflow.  This will avoid
  running pre-unwind handlers.

* libguile/throw.h: Move scm_report_stack_overflow here.

* libguile/throw.c (catch): Define a version of catch in C.
  (throw_without_pre_unwind): New helper.  Besides serving as the
  pre-boot "throw" binding, it allows stack overflow to throw without
  running pre-unwind handlers.
  (scm_catch, scm_catch_with_pre_unwind_handler)
  (scm_with_throw_handler): Use the new catch in C.
  (scm_report_stack_overflow): Moved from stackchk.c; throws an
  unwind-only exception.

* libguile/stackchk.h:
* libguile/stackchk.c: Remove the scm_report_stack_overflow bits.
2014-02-20 09:45:01 +01:00
Andy Wingo
5d20fd49fe %exception-handler fluid refactor
* libguile/throw.c (scm_init_throw): Define %exception-handler here.
* module/ice-9/boot-9.scm (%eh): Use the incoming %exception-handler,
  and then delete it.  This way we should be able to do unwind-only
  exceptions from C.
2014-02-19 21:57:40 +01:00
Andy Wingo
0f0b6f2d86 Reimplement catch, throw, and with-throw-handler
* module/ice-9/boot-9.scm: Reimplement catch, throw, and
  with-throw-handler in such a way that the exception handler is
  threaded not through the exception-handling closures, but through a
  data structure in the exception-handler fluid.  This will allow us to
  do unwind-only exception dispatch on stack overflow.
2014-02-19 19:43:48 +01:00
Andy Wingo
440392fa2d boot-9 boot order refactor for catch, throw, and such
* module/ice-9/boot-9.scm: Move error-handling initialization after
  psyntax initialization.  Only "throw" is used before psyntax, and both
  throw and catch have pre-boot variants in C.
2014-02-19 16:54:45 +01:00
Andy Wingo
82490a665c Don't peval-penalize let-bound lambdas only referenced once
* module/language/tree-il/peval.scm (peval): When going to peval a call
  whose operator isn't just a lambda but is a let-bound lambda, as one
  bound via define-inlinable, don't create a new counter if the lambda
  is only referenced once in the source.  Avoids needless failure to
  inline once-referenced procedures.

* test-suite/tests/peval.test ("partial evaluation"): Wheeeee
2014-02-17 22:23:40 +01:00
Andy Wingo
26c19d79d9 PT_DYNAMIC inside some other PT_LOAD segment
* libguile/loader.c (load_thunk_from_memory): Only load PT_LOAD
  segments, as libc does.  The PT_DYNAMIC segment should be inside some
  other PT_LOAD segment.

* module/system/vm/linker.scm (segment-kind): Give the .dynamic segment
  PT_LOAD kind, so that it is written in a PT_LOAD segment.
  (count-segments): Add one if there is a SHT_DYNAMIC segment.
  (allocate-segment): Set the paddr to the addr, as binutils do.
  (record-special-segments): New routine, to write out special segments
  like PT_DYNAMIC.
  (allocate-elf): Call record-special-segments.
2014-02-17 14:15:34 +01:00
Andy Wingo
3c08b6c1b2 Add elf-symbol-value-offset, for properly relocating symtab entries
* module/system/vm/elf.scm (elf-symbol-value-offset): New export.
2014-02-16 15:58:44 +01:00
Andy Wingo
c90c81898e ELF linker can produce objects with native ABI
* module/system/vm/elf.scm: Define more ABI types and ELF object types.
  Export the ABI, object type, and machine type values.

* module/system/vm/linker.scm (<linker-reloc>, process-reloc): Allow
  rel32/1 relocs.
  (add-elf-objects, allocate-elf, link-elf): Allow the user to set an
  ABI, type, and machine-type.
2014-02-16 12:18:44 +01:00
Andy Wingo
a104380d53 bytevector-length reifies to correct module
* module/language/cps/reify-primitives.scm (primitive-module): Whoops,
  bytevector-length is needs to map to the (rnrs bytevectors) module.
2014-02-14 10:49:45 +01:00
Andy Wingo
a694809e3a bytevector-length is an interesting primitive.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect-free-primitives*):
* module/language/cps/effects-analysis.scm: bytevector-length is an
  interesting primitive.
2014-02-13 17:51:20 +01:00
Andy Wingo
9b3c4cedd4 sqrt and abs are interesting primitives
* module/language/cps/effects-analysis.scm:
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect-free-primitives*): Add sqrt and abs.
2014-02-13 11:04:55 +01:00
Andy Wingo
dd692618b8 Add prune-top-level-scopes pass
* module/language/cps/prune-top-level-scopes.scm: New pass, to prune
  unneeded "cache-current-module!" forms.

* module/language/cps/compile-bytecode.scm:
* module/Makefile.am: Add the new pass to the build and enable by
  default.
2014-02-13 09:30:39 +01:00
Andy Wingo
9253198baf Bytevector f32 an f64 ops actually map to VM primitives
* module/language/cps/primitives.scm (*instruction-aliases*): Whoops!
  Fix mapping of f32 and f64 instructions to VM primitives.
2014-02-11 21:54:05 +01:00
Andy Wingo
8051cf2304 Merge commit 'fb7dd00169'
This commit also renames uniform-vector-element-type-code to
array-type-code.

Conflicts:
	libguile/uniform.c
	libguile/uniform.h
	test-suite/tests/arrays.test
2014-02-08 15:31:37 +01:00
Andy Wingo
5fc051babe Merge commit '2f3b7e9a41'
Conflicts:
	module/ice-9/pretty-print.scm
2014-02-08 14:44:11 +01:00
Andy Wingo
730639e9a7 Merge commit 'a675a2e81b' 2014-02-08 14:31:42 +01:00
Mark H Weaver
5bc7c6dbab Avoid using 'eval-when' with 'expand' in (oop goops).
* module/oop/goops.scm: Avoid using 'eval-when' with 'expand'.
2014-02-07 20:05:17 -05:00
Andy Wingo
2f3b7e9a41 Fix truncated-print for uniform vectors
* module/ice-9/pretty-print.scm (truncated-print): Use bytevector?
  instead of uniform-vector?; the latter could be true for shared arrays
  with non-zero lower bounds.
2014-02-07 18:04:20 +01:00
Andy Wingo
85d3339d7e (srfi srfi-4 gnu) uses private define-bytevector-type from (srfi srfi-4)
* module/srfi/srfi-4/gnu.scm: Re-use implementation of
  define-bytevector-type from srfi-4.
2014-02-07 18:00:04 +01:00
Andy Wingo
b5f9ba49db Remove private unused duplicate c32/c64vector definitions
* module/srfi/srfi-4.scm: Remove vestigial definitions for c32vectors
  and c64vectors.  Those are defined in (srfi srfi-4 gnu).
2014-02-07 17:57:30 +01:00
Andy Wingo
a675a2e81b SRFI-4 predicates, length accessors only accept bytevectors (not arrays)
* module/srfi/srfi-4.scm (define-bytevector-type): For the predicates
  and length accessors, only accept bytevectors.  Since arrays don't
  work for u32vector-ref et al, they shouldn't pass u32vector?.
2014-02-07 17:53:01 +01:00
Andy Wingo
7affd3141b Merge commit '40a723a922' 2014-02-07 15:26:18 +01:00
Andy Wingo
b00c9b2214 Merge commit '866af5da3d'
Removes the special arity handler, and instead relies on the procedure
returning the correct number of values.
2014-02-07 15:24:43 +01:00
Andy Wingo
cd36c69619 Merge commit '34e8987734'
Conflicts:
	module/Makefile.am
2014-02-07 15:13:22 +01:00
Andy Wingo
04f59ec2e7 Merge commit '58147d6780' 2014-02-07 15:12:35 +01:00
Andy Wingo
ae7f13be4b Merge commit 'ca5e0414e9'
Conflicts:
	module/language/tree-il/primitives.scm
2014-02-07 15:05:55 +01:00
Andy Wingo
a1aae2c3a0 Merge commit 'f6ddf827f8'
Conflicts:
	module/ice-9/boot-9.scm
	module/oop/goops.scm
2014-02-07 14:51:42 +01:00
Andy Wingo
7d484bfa15 Merge commit 'a5cbbaa66a' 2014-02-07 14:43:23 +01:00
Andy Wingo
c9647bfb7e Add weak-vector-length, weak-vector-ref, weak-vector-set!
* libguile/weak-vectors.h:
* libguile/weak-vectors.c (scm_is_weak_vector, scm_c_weak_vector_length):
  (scm_c_weak_vector_ref, scm_c_weak_vector_set_x): New interfaces for
  dealing with weak vectors from C.
  (scm_weak_vector_length, scm_weak_vector_ref, scm_weak_vector_set_x):
  New Scheme interfaces to weak vectors; to be used instead of
  vector-length, vector-ref, etc.

* module/ice-9/weak-vector.scm: Export the new interfaces.
2014-02-07 13:00:41 +01:00
Andy Wingo
1e3fd6a0c8 Add weak-vector-length, weak-vector-ref, weak-vector-set!
* libguile/weaks.c (scm_is_weak_vector, scm_c_weak_vector_length):
  (scm_c_weak_vector_ref, scm_c_weak_vector_set_x): New interfaces for
  dealing with weak vectors from C.
  (scm_weak_vector_length, scm_weak_vector_ref, scm_weak_vector_set_x):
  New Scheme interfaces to weak vectors; to be used instead of
  vector-length, vector-ref, etc.

* module/ice-9/weak-vector.scm: Export the new interfaces.

* doc/ref/api-memory.texi (Weak vectors): Document them.
2014-02-07 12:25:05 +01:00
Mark H Weaver
8a114e1b54 REPL Server: Remove unneeded error case in 'run-server'.
* module/system/repl/server.scm (run-server): Remove case that handled
  'interrupt' exceptions specially.  It is no longer needed since
  e6c8e6047e (REPL Server: Don't establish
  a SIGINT handler.)
2014-02-04 15:15:12 -05:00