mit-scheme.git
5 years agoRewrite the NFA regexp interpreter into epsilon/matcher phases.
Chris Hanson [Sat, 30 Nov 2019 08:08:01 +0000 (00:08 -0800)]
Rewrite the NFA regexp interpreter into epsilon/matcher phases.

This greatly simplifies the interpreter's operation, and isolates the state
elision in the epsilon phase where it belongs.

Also added hash-consing of states, so that we can use eq? to compare them.

5 years agoChange NFS nodes to have a clearer set of types.
Chris Hanson [Sat, 30 Nov 2019 06:01:48 +0000 (22:01 -0800)]
Change NFS nodes to have a clearer set of types.

This also allows more detailed analysis of the graph: we can now write a program
that will determine the initial character(s) of a regexp and use that to speed
up search.

5 years agoMarkup and tweaks for partial SRFI 14 support.
Chris Hanson [Sat, 30 Nov 2019 06:01:06 +0000 (22:01 -0800)]
Markup and tweaks for partial SRFI 14 support.

5 years agoImplement NFA regexp engine and change srfi-115 to use it.
Chris Hanson [Sat, 30 Nov 2019 01:20:26 +0000 (17:20 -0800)]
Implement NFA regexp engine and change srfi-115 to use it.

5 years agoImplement char-set-size and update char-set:newline.
Chris Hanson [Sat, 30 Nov 2019 01:19:48 +0000 (17:19 -0800)]
Implement char-set-size and update char-set:newline.

5 years agoPartial implementation of SRFI 115.
Chris Hanson [Wed, 27 Nov 2019 08:09:29 +0000 (00:09 -0800)]
Partial implementation of SRFI 115.

5 years agoAdd character sets needed for SRFI 115.
Chris Hanson [Mon, 25 Nov 2019 21:39:17 +0000 (13:39 -0800)]
Add character sets needed for SRFI 115.

5 years agoRefactor regsexp for simplicity and future sharing.
Chris Hanson [Mon, 25 Nov 2019 09:33:26 +0000 (01:33 -0800)]
Refactor regsexp for simplicity and future sharing.

* The rule engine has been moved to its own file, rewritten, and generalized.

* The recursive implementation has been moved to its own file and slightly
  edited.

* There's new support for match replacement.

5 years agoAdd define-deferred-procedure to capture a common pattern.
Chris Hanson [Wed, 27 Nov 2019 06:27:27 +0000 (22:27 -0800)]
Add define-deferred-procedure to capture a common pattern.

5 years agoImplement complement, a predicate inverter.
Chris Hanson [Mon, 25 Nov 2019 05:50:53 +0000 (21:50 -0800)]
Implement complement, a predicate inverter.

5 years agoFix typo from earlier commit.
Chris Hanson [Mon, 25 Nov 2019 07:38:32 +0000 (23:38 -0800)]
Fix typo from earlier commit.

5 years agoImplementation of the immutable strings of SRFI 140.
Chris Hanson [Tue, 19 Nov 2019 06:48:40 +0000 (22:48 -0800)]
Implementation of the immutable strings of SRFI 140.

This does not include the mutable strings from SRFI 118.

5 years agoTighten up testing of duplicate imports to ensure R7RS compatibility.
Chris Hanson [Wed, 20 Nov 2019 05:23:06 +0000 (21:23 -0800)]
Tighten up testing of duplicate imports to ensure R7RS compatibility.

5 years agoChange list->string to take optional start and end args.
Chris Hanson [Tue, 19 Nov 2019 06:47:50 +0000 (22:47 -0800)]
Change list->string to take optional start and end args.

This extension matches SRFI 140.

5 years agoAllow string-builder to take a zero argument.
Chris Hanson [Tue, 19 Nov 2019 06:46:03 +0000 (22:46 -0800)]
Allow string-builder to take a zero argument.

This simplifies cases where the length of the result is known in advance and
passed as the buffer size.

5 years agoOn error, show a condition report instead of a condition object.
Chris Hanson [Tue, 19 Nov 2019 06:45:25 +0000 (22:45 -0800)]
On error, show a condition report instead of a condition object.

5 years agoUpdate reference manual with changes to string-{splitter,trimmer}.
Chris Hanson [Tue, 19 Nov 2019 02:15:06 +0000 (18:15 -0800)]
Update reference manual with changes to string-{splitter,trimmer}.

5 years agoModify string-splitter and string-trimmer to accept copier arg.
Chris Hanson [Mon, 18 Nov 2019 07:42:20 +0000 (23:42 -0800)]
Modify string-splitter and string-trimmer to accept copier arg.

5 years agoChange string-builder to use a vector as its buffer.
Chris Hanson [Mon, 18 Nov 2019 04:12:39 +0000 (20:12 -0800)]
Change string-builder to use a vector as its buffer.

Hopefully this will be generally faster since it's slower to copy characters
into a mutable string than it is into a vector.

5 years agoImplement UTF-{16,32} converters that use BOM.
Chris Hanson [Mon, 18 Nov 2019 00:48:18 +0000 (16:48 -0800)]
Implement UTF-{16,32} converters that use BOM.

This is needed for support of SRFI 140.

5 years agoFix bug in parsing of cond-expand.
Chris Hanson [Mon, 18 Nov 2019 00:35:53 +0000 (16:35 -0800)]
Fix bug in parsing of cond-expand.

5 years agoFix warning about re-exporting imported names from libraries.
Chris Hanson [Mon, 18 Nov 2019 00:14:20 +0000 (16:14 -0800)]
Fix warning about re-exporting imported names from libraries.

5 years agoFix typo.
Chris Hanson [Sun, 17 Nov 2019 22:51:36 +0000 (14:51 -0800)]
Fix typo.

5 years agoUse euclidean/ from division package as pointed out by Taylor.
Chris Hanson [Sat, 16 Nov 2019 23:01:40 +0000 (15:01 -0800)]
Use euclidean/ from division package as pointed out by Taylor.

Also fix typo.

5 years agoRegister srfi-133 and srfi-143 for cond-expand.
Chris Hanson [Mon, 11 Nov 2019 08:42:50 +0000 (00:42 -0800)]
Register srfi-133 and srfi-143 for cond-expand.

5 years agoFinish implementing SRFI 143.
Chris Hanson [Mon, 11 Nov 2019 08:39:10 +0000 (00:39 -0800)]
Finish implementing SRFI 143.

5 years agoAdd usual-integrations for SRFI-143 bindings.
Chris Hanson [Tue, 5 Nov 2019 04:19:26 +0000 (20:19 -0800)]
Add usual-integrations for SRFI-143 bindings.

5 years agoAdd some SRFI-143 renames to primitive arithmetic.
Chris Hanson [Tue, 5 Nov 2019 04:06:03 +0000 (20:06 -0800)]
Add some SRFI-143 renames to primitive arithmetic.

5 years agoIntegrate inline tests into testing framework.
Chris Hanson [Mon, 28 Oct 2019 01:08:29 +0000 (18:08 -0700)]
Integrate inline tests into testing framework.

5 years agoImplement as-needed loading of libraries on import.
Chris Hanson [Mon, 28 Oct 2019 00:48:07 +0000 (17:48 -0700)]
Implement as-needed loading of libraries on import.

This does topological sorting to do the loads in the right order, but doesn't
handle dependency loops (yet).

5 years agoAdd implementation of simple directed graph algorithms.
Chris Hanson [Sun, 27 Oct 2019 22:07:00 +0000 (15:07 -0700)]
Add implementation of simple directed graph algorithms.

5 years agoAdd ability to import a library into an existing environment.
Chris Hanson [Sun, 27 Oct 2019 20:52:55 +0000 (13:52 -0700)]
Add ability to import a library into an existing environment.

5 years agoAutomatically pre-register libraries in standard places.
Chris Hanson [Sun, 27 Oct 2019 05:50:52 +0000 (22:50 -0700)]
Automatically pre-register libraries in standard places.

5 years agoAdd param:hide-notifications?.
Chris Hanson [Sun, 27 Oct 2019 05:50:11 +0000 (22:50 -0700)]
Add param:hide-notifications?.

5 years agoCreate a new directory src/libraries, to hold R7RS libraries.
Chris Hanson [Wed, 23 Oct 2019 07:29:52 +0000 (00:29 -0700)]
Create a new directory src/libraries, to hold R7RS libraries.

Initially populate this with (srfi 133) and (mit inline-testing), plus unit
tests for the former.

5 years agoPreserve the initial host-library-db.
Chris Hanson [Tue, 22 Oct 2019 07:16:20 +0000 (00:16 -0700)]
Preserve the initial host-library-db.

5 years agoCreate a "standard" library providing access to the library database.
Chris Hanson [Tue, 22 Oct 2019 06:00:09 +0000 (23:00 -0700)]
Create a "standard" library providing access to the library database.

This is useful for programs that want to work directly on libraries.

5 years agoFix problems with reporting why an auto property isn't available.
Chris Hanson [Tue, 22 Oct 2019 05:58:01 +0000 (22:58 -0700)]
Fix problems with reporting why an auto property isn't available.

The previous approach was not filtering the dependencies right.

5 years agoEliminate duplicate binding.
Chris Hanson [Tue, 22 Oct 2019 05:13:46 +0000 (22:13 -0700)]
Eliminate duplicate binding.

5 years agoDon't rewrite library imports after parsing them.
Chris Hanson [Tue, 22 Oct 2019 05:12:36 +0000 (22:12 -0700)]
Don't rewrite library imports after parsing them.

It's more convenient to have the retain their syntax, so that they can be used
by programs using reflective access to the libraries.

5 years agoBe more careful when checking for unquote in repl eval.
Chris Hanson [Tue, 22 Oct 2019 03:43:19 +0000 (20:43 -0700)]
Be more careful when checking for unquote in repl eval.

5 years agoFurthur improve error reporting for libraries.
Chris Hanson [Mon, 21 Oct 2019 05:37:00 +0000 (22:37 -0700)]
Furthur improve error reporting for libraries.

5 years agoJust have one legacy library: (mit legacy runtime)
Chris Hanson [Sun, 20 Oct 2019 23:33:52 +0000 (16:33 -0700)]
Just have one legacy library: (mit legacy runtime)

Otherwise it's a pain to figure out where all the exports are, since they aren't
necessarily where you might think.

Also, this eliminates deprecated bindings.

5 years agoImprove error reporting for library imports.
Chris Hanson [Sun, 20 Oct 2019 20:07:17 +0000 (13:07 -0700)]
Improve error reporting for library imports.

5 years agoFix problem with syntaxing of DO.
Chris Hanson [Sun, 20 Oct 2019 05:41:51 +0000 (22:41 -0700)]
Fix problem with syntaxing of DO.

This wouldn't work correctly in some weird edge cases.  Specifically, it was
trying to detect the 'else and '=> keywords, but comparing them in the syntactic
environment outside of the DO, not the one inside of it.  Fixed by rewriting the
macro to defer the cond-clause processing until the interior environment was
available.

5 years agoFix typo in earlier change.
Chris Hanson [Sun, 20 Oct 2019 05:20:19 +0000 (22:20 -0700)]
Fix typo in earlier change.

5 years agoAdd printer for bytevectors and limit printing of vectors.
Chris Hanson [Mon, 7 Oct 2019 05:10:28 +0000 (01:10 -0400)]
Add printer for bytevectors and limit printing of vectors.

5 years agoChange debug printer to print vectors correctly.
Chris Hanson [Mon, 7 Oct 2019 04:34:47 +0000 (00:34 -0400)]
Change debug printer to print vectors correctly.

5 years agoFix cold-load problems when cross-compiling from 10.1.10.
Chris Hanson [Mon, 7 Oct 2019 04:34:26 +0000 (00:34 -0400)]
Fix cold-load problems when cross-compiling from 10.1.10.

5 years agoA reader has alerted me to a caveat about IEEE 754 min/max.
Taylor R Campbell [Thu, 3 Oct 2019 16:23:03 +0000 (16:23 +0000)]
A reader has alerted me to a caveat about IEEE 754 min/max.

5 years agoFix bugs in min/max on signalling NaN inputs.
Taylor R Campbell [Thu, 3 Oct 2019 15:39:13 +0000 (15:39 +0000)]
Fix bugs in min/max on signalling NaN inputs.

5 years agoFix floating-point min/max tests, and mark them xfail.
Taylor R Campbell [Thu, 3 Oct 2019 14:49:34 +0000 (14:49 +0000)]
Fix floating-point min/max tests, and mark them xfail.

I misread IEEE 754 semantics on min/max for _signalling_ NaN.

If given a number and a _quiet_ NaN, min/max are to return the
_number_.  But if given a _signalling_ NaN, min/max are to return a
quiet version of the NaN.

References:

Sec. 5.3 `Homogeneous general-computational operations',
subsec. 5.3.1 `General operations',
on minNum/maxNum/minNumMag/maxNumMag reads:

  `minNum(x, y) is...the canonicalized number if one operand is a
   number and the other is a quiet NaN.'

  `When either x or y is a signaling NaN, then the result is according
   to 6.2.'

Sec. 6.2 `Operations with NaNs' reads:

  `Under default exception handling, any operation signaling an invalid
   operation exception and for which a floating-point result is to be
   delivered shall deliver a quiet NaN.'

     [Consequently, _if_ min/max raise invalid-operation and
      nevertheless return a result, they shall return a quiet NaN.]

  `Signaling NaNs shall be reserved operands that, under default
   exception handling, signal the invalid operation exception (see 7.2)
   for every general-computational and signaling-computational
   operation except for the conversions described in 5.12.'

     [min/max (i.e., minNum/maxNum/minNumMag/maxNumMag) are listed
      under homogeneous general-computational, so this clause applies.]

Subsec. 6.2.3 `NaN propagation' further reads:

  `An operation that propagates a NaN operand to its result and has a
   single NaN as an input should produce a NaN with the payload of the
   input NaN.'

  `If two or more inputs are NaN, then the payload of the resulting NaN
   should be identical to the payload of one of the input NaNs if
   representable in the destination format.'

5 years agoChange record types to be immutable.
Chris Hanson [Tue, 24 Sep 2019 07:35:38 +0000 (00:35 -0700)]
Change record types to be immutable.

The primary reason for this is to make the predicates slightly faster,
eliminating the need to look up the type markers in the predicates.

Additionally, make-record-type now accepts these additional options using a
keyword list.  The define-record-type macro has not been updated to support
these new options, but that will come soon.  Consequently the files using these
options have been modified to use make-record-type directly.

Finally, a small tweak was needed so that multiple values are available earlier
in the cold load.

5 years agoFix aliasing problem with sub-record predicates.
Chris Hanson [Mon, 23 Sep 2019 20:41:39 +0000 (13:41 -0700)]
Fix aliasing problem with sub-record predicates.

Add test to check that it works.

5 years agoRestore compatibility with SRFI 131.
Chris Hanson [Sun, 22 Sep 2019 21:14:02 +0000 (14:14 -0700)]
Restore compatibility with SRFI 131.

Also add some tests for records, and fix several bugs revealed by them.

5 years agoRefactor record layout following a suggestion from Taylor.
Chris Hanson [Sun, 22 Sep 2019 05:54:01 +0000 (22:54 -0700)]
Refactor record layout following a suggestion from Taylor.

New layout is identical for records that don't have a parent type.  For those
that do have a parent type, the layout is like this:

    root-marker
    root-fields
    sub1-marker
    sub1-fields
    sub2-marker
    sub2-fields
    ...

The primary advantage of this layout is to make the record predicate be constant
time, as opposed to the previous design in which it could be linear in the depth
of the parent chain.

In addition, a number of record operations have been bummed for slightly better
performance, and the layout of record types has been altered to keep track of
the type information in a way that's better organized for generating the record
operations.

There are some behavioral changes:

* This implementation is slightly incompatible with SRFI 131, since it prohibits
  a child from having a field name that's the same as one of its ancestors.
  I'll probably change this for compatibility.

* Only a root record type can have an applicability method, and that method is
  called for all sub-types of that root type.  Arguably this is reasonable
  behavior.

* Non-root fasdumpable records must have proxy markers for all of their
  component types.  Previously, only the record type stored in slot 0 needed to
  have a fasdumpable proxy.  This isn't an immediate issue since fasdumpable
  records are used very sparingly at the moment and probably won't be supported
  outside of the runtime system.

5 years agoTweak my special hack.
Chris Hanson [Sun, 22 Sep 2019 04:09:13 +0000 (21:09 -0700)]
Tweak my special hack.

5 years agoImplement any-duplicates?.
Chris Hanson [Sat, 21 Sep 2019 07:02:15 +0000 (00:02 -0700)]
Implement any-duplicates?.

5 years agoFix syntax bug that showed up in syntax-rules.
Chris Hanson [Sat, 21 Sep 2019 06:16:04 +0000 (23:16 -0700)]
Fix syntax bug that showed up in syntax-rules.

5 years agoMerge branch 'riastradh-20190917-fixamd64uuojmp'
Taylor R Campbell [Wed, 18 Sep 2019 14:40:06 +0000 (14:40 +0000)]
Merge branch 'riastradh-20190917-fixamd64uuojmp'

5 years agoFix tospace/newspace confusion.
Taylor R Campbell [Wed, 18 Sep 2019 01:50:37 +0000 (01:50 +0000)]
Fix tospace/newspace confusion.

This did not manifest in my testing on NetBSD because it happened
that on NetBSD, the tospace and newspace are always separated by more
than 4 GB, so the bogus jmprel32_offset was never used during GC,
e.g.:

   newspace=0x17dd7f8 tospace=0x7f7feeb00000 delta=17523427132673

I suspect it is the cause of Chris's problems on macOS, so this
should fix Chris's issue on macOS and speed things up even more for
everyone.

5 years agoRevert "Workaround for inexplicable fatal error on macOS."
Taylor R Campbell [Wed, 18 Sep 2019 01:44:15 +0000 (01:44 +0000)]
Revert "Workaround for inexplicable fatal error on macOS."

This reverts commit 689da8bf97534063f1800caf544a694de81d511e.

Will fix in a subsequent commit.

5 years agoWorkaround for inexplicable fatal error on macOS.
Chris Hanson [Tue, 17 Sep 2019 06:50:23 +0000 (23:50 -0700)]
Workaround for inexplicable fatal error on macOS.

5 years agoUpdate incorrect comments.
Chris Hanson [Tue, 17 Sep 2019 06:16:14 +0000 (23:16 -0700)]
Update incorrect comments.

5 years agoTeach fasload about cc_return objects.
Chris Hanson [Tue, 17 Sep 2019 06:13:44 +0000 (23:13 -0700)]
Teach fasload about cc_return objects.

Otherwise fasload gets SIGSEGV when the memory addresses are different.

5 years agoAdapt fegetexcept etc. workarounds to work when debugging turned on.
Chris Hanson [Sun, 8 Sep 2019 07:31:51 +0000 (00:31 -0700)]
Adapt fegetexcept etc. workarounds to work when debugging turned on.

5 years agoDon't use MAP_TRYFIXED unless is it defined; otherwise the assert fails.
Chris Hanson [Sun, 8 Sep 2019 07:30:51 +0000 (00:30 -0700)]
Don't use MAP_TRYFIXED unless is it defined; otherwise the assert fails.

5 years agoMark floenv in use so exceptions stay cleared if preempted.
Taylor R Campbell [Tue, 3 Sep 2019 13:37:25 +0000 (13:37 +0000)]
Mark floenv in use so exceptions stay cleared if preempted.

Otherwise, we might do:

T1: clear-float-exceptions
    preempt and switch
T2: floating-point operation that raises exceptions
    preempt and switch
T1: use-floating-point-environment!

and the exceptions may remain raised from T2.

5 years agoOpen-code flonum-fma (fused multiply-add) on aarch64.
Taylor R Campbell [Mon, 26 Aug 2019 04:50:32 +0000 (04:50 +0000)]
Open-code flonum-fma (fused multiply-add) on aarch64.

The fused multiply-subtract doesn't kick in right now for reasons I
don't understand in rcompr.scm; maybe someone who understands that
code better can help.

5 years agoFix missing ELSE (error).
Taylor R Campbell [Mon, 26 Aug 2019 03:20:37 +0000 (03:20 +0000)]
Fix missing ELSE (error).

5 years agoFix leak of floating-point environment in test-arith.scm.
Taylor R Campbell [Mon, 26 Aug 2019 03:15:43 +0000 (03:15 +0000)]
Fix leak of floating-point environment in test-arith.scm.

5 years agoIf enabling fp traps for first time, clear sticky exceptions.
Taylor R Campbell [Mon, 26 Aug 2019 03:14:22 +0000 (03:14 +0000)]
If enabling fp traps for first time, clear sticky exceptions.

Otherwise, the indeterminate state of the sticky exceptions --
possibly from another thread -- may cause the machine to trap merely
by enabling traps.

Also, don't bother marking the floating-point environment in use when
disabling traps.

5 years agoCache cleared exceptions to prevent SIGFPE loop on trap.
Taylor R Campbell [Mon, 26 Aug 2019 02:59:12 +0000 (02:59 +0000)]
Cache cleared exceptions to prevent SIGFPE loop on trap.

fesetenv, as used by fixup_float_environment at the top of Interpret,
will trap any trapped and raised exceptions in the floating-point
environment it is restoring, which is bad news during a trap.

Not really sure how this managed to work in the past...

5 years agoTeach continuation parser about last return code offsets.
Taylor R Campbell [Mon, 26 Aug 2019 02:48:45 +0000 (02:48 +0000)]
Teach continuation parser about last return code offsets.

This fixes a thirty-year-old (!) bug with creating continuations that
return into compiled code with #f as the last return code offset for
reenter-compiled-code.  Manifests only with debugging enabled.

5 years agoFix store-value restarts for unassigned/unbound variable references.
Taylor R Campbell [Mon, 26 Aug 2019 00:21:27 +0000 (00:21 +0000)]
Fix store-value restarts for unassigned/unbound variable references.

Turns out these have been busted since 2007...

5 years agoNew primitive PRIMITIVE-PROCEDURE-OPEN-CODED?.
Taylor R Campbell [Sun, 25 Aug 2019 21:20:39 +0000 (21:20 +0000)]
New primitive PRIMITIVE-PROCEDURE-OPEN-CODED?.

Usage:

(define (foo x y)
  (if ((ucode-primitive primitive-procedure-open-coded? 1)
       (ucode-primitive xyz 2))
      ((ucode-primitive xyz 2) x y)
      ... Scheme alternative implementation ...))

5 years agoUse paxctl on NetBSD to allow PROT_WRITE|PROT_EXEC.
Taylor R Campbell [Sun, 25 Aug 2019 20:27:53 +0000 (20:27 +0000)]
Use paxctl on NetBSD to allow PROT_WRITE|PROT_EXEC.

5 years agoUse proper m4 quotation for AC_CHECK_TOOL usage.
Taylor R Campbell [Sun, 25 Aug 2019 20:27:05 +0000 (20:27 +0000)]
Use proper m4 quotation for AC_CHECK_TOOL usage.

5 years agoTweak workaround for floating exceptions on macOS.
Chris Hanson [Mon, 26 Aug 2019 03:16:36 +0000 (20:16 -0700)]
Tweak workaround for floating exceptions on macOS.

5 years agoMerge branch 'riastradh-20190113-aarch64-v6'
Taylor R Campbell [Sun, 25 Aug 2019 19:49:44 +0000 (19:49 +0000)]
Merge branch 'riastradh-20190113-aarch64-v6'

5 years agoOpen-code floating-point arithmetic on aarch64.
Taylor R Campbell [Sun, 25 Aug 2019 19:48:23 +0000 (19:48 +0000)]
Open-code floating-point arithmetic on aarch64.

Disabled by default for now due to limited testing.

5 years agoReduce some extraneous MOVK instructions in immediate loads.
Taylor R Campbell [Sun, 25 Aug 2019 19:25:34 +0000 (19:25 +0000)]
Reduce some extraneous MOVK instructions in immediate loads.

5 years agoFix set of architectures with busted fp compare exceptions.
Taylor R Campbell [Sun, 25 Aug 2019 19:03:51 +0000 (19:03 +0000)]
Fix set of architectures with busted fp compare exceptions.

5 years agoWork around buggy libm on NetBSD/aarch64.
Taylor R Campbell [Sun, 25 Aug 2019 19:03:01 +0000 (19:03 +0000)]
Work around buggy libm on NetBSD/aarch64.

Will be fixed upstream but it doesn't hurt to add one more bit here.

5 years agoShow for which parameters the test failed.
Taylor R Campbell [Sun, 25 Aug 2019 18:35:37 +0000 (18:35 +0000)]
Show for which parameters the test failed.

5 years agoSimplify flo:-inf.0 and flo:+inf.0.
Taylor R Campbell [Sun, 25 Aug 2019 18:32:03 +0000 (18:32 +0000)]
Simplify flo:-inf.0 and flo:+inf.0.

We have put out a release now whose reader understands +inf.0/-inf.0,
so we should be able to use the notation.

Fixes bugs with incorrectly raising the divide-by-zero exception flag
(even if no trap), e.g.:

;|log1mexp-invalid/(4.9406564584124654e-324)| failed 1 sub-tests out of 1 in 0. seconds:
     assertion 3: value was 3 but expected an object eqv? to 1

Here 3 = (invalid-operation divide-by-zero), 1 = (invalid-operation)
[aarch64].

5 years agoFix missing #include.
Taylor R Campbell [Sun, 25 Aug 2019 18:25:43 +0000 (18:25 +0000)]
Fix missing #include.

Mistake failed silently because it only changed #ifdef outcome.

5 years agoLet caller specify how to get a temporary in ADD-IMMEDIATE.
Taylor R Campbell [Sun, 25 Aug 2019 15:40:15 +0000 (15:40 +0000)]
Let caller specify how to get a temporary in ADD-IMMEDIATE.

Fixes

;  Compiling file: "test-hack.bin" => "test-hack.com"...
;Unassigned variable: *needed-registers*

because of attempt to allocate a temporary in ADD-IMMEDIATE during
GENERATE/REMOTE-LINKS.

5 years agoNew GENERAL-TEMPORARY! shorthand.
Taylor R Campbell [Sun, 25 Aug 2019 15:38:25 +0000 (15:38 +0000)]
New GENERAL-TEMPORARY! shorthand.

5 years agoFix units for cc_entry_to_block_offset/cc_return_to_block_offset.
Taylor R Campbell [Sun, 25 Aug 2019 15:09:11 +0000 (15:09 +0000)]
Fix units for cc_entry_to_block_offset/cc_return_to_block_offset.

It would make more sense for the compiler to generate debug data
labels in instruction units, but this is a simpler change and is what
was done in the past on machines like mips with 32-bit aligned
instructions.

aarch64 now has functioning debug data!

5 years agoFix comment about odd rounding mode.
Taylor R Campbell [Sat, 24 Aug 2019 07:10:39 +0000 (07:10 +0000)]
Fix comment about odd rounding mode.

5 years agoAdd missing include guards.
Taylor R Campbell [Sat, 24 Aug 2019 07:09:39 +0000 (07:09 +0000)]
Add missing include guards.

5 years agoUpdate and clarify fp-env documentation.
Taylor R Campbell [Sat, 24 Aug 2019 07:07:11 +0000 (07:07 +0000)]
Update and clarify fp-env documentation.

5 years agoSimplify flo:update-environment!.
Taylor R Campbell [Sat, 24 Aug 2019 04:32:50 +0000 (04:32 +0000)]
Simplify flo:update-environment!.

Caller is interested in exceptions afterward, so it is not sensible
to deregister interest in the floating-point environment afterward.
If you really want that, surround it in flo:preserving-environment.

5 years agoFix two bugs in floating-point environment.
Taylor R Campbell [Sat, 24 Aug 2019 04:26:31 +0000 (04:26 +0000)]
Fix two bugs in floating-point environment.

1. Don't cache it in the current thread.

   We can't mark everywhere the cache needs to be invalidated --
   i.e., every floating-point instruction -- and it's not clear
   there's any performance benefit to the cache anyway.  The main
   performance cost, as I recall, was swapping environments on every
   thread switch, which we avoid for all threads in the default
   environment.

2. The default environment initialization left the machine in a wacky
   state after reset-package!, which caused many spurious exception
   traps once I undid the cache.  There's no need to preserve the
   machine environment here; we are setting up the default
   environment, after all, so the environment we're in when done
   should be the default one.

5 years agoTest busted flo:set-environment!.
Taylor R Campbell [Sat, 24 Aug 2019 01:40:11 +0000 (01:40 +0000)]
Test busted flo:set-environment!.

5 years agoSimplify some logic by using dedicated scratch registers or targets.
Taylor R Campbell [Sat, 20 Apr 2019 19:48:07 +0000 (19:48 +0000)]
Simplify some logic by using dedicated scratch registers or targets.

No need to allocate temporaries except when we need more than two or
three of them.

5 years agoUse AC_CHECK_TOOL for as and allow configure parameter.
Taylor R Campbell [Thu, 22 Aug 2019 14:23:08 +0000 (14:23 +0000)]
Use AC_CHECK_TOOL for as and allow configure parameter.

This way we auto-detect a cross-assembler more easily with, e.g.,
--build=aarch64--netbsd.

5 years agoFix sign error in previous.
Taylor R Campbell [Mon, 22 Apr 2019 04:07:27 +0000 (04:07 +0000)]
Fix sign error in previous.

5 years agoLink the endian-independent cmpauxmd for aarch64.
Taylor R Campbell [Sat, 20 Apr 2019 20:09:12 +0000 (20:09 +0000)]
Link the endian-independent cmpauxmd for aarch64.