[dylan-lang/opendylan] f01c35: [dylan, tests] Test instance? on <limited-integer>.

GitHub <[email protected]> Sun, 26 Jul 2015 07:13:15 -0700
Newsgroups gmane.comp.lang.dylan.gwydion.cvs
Message-ID <55b4eafb50b82_6f8f3ffb640072c075077@hookshot-fe1-cp1-prd.iad.github.net.mail>
  Branch: refs/heads/master
  Home:   https://github.com/dylan-lang/opendylan
  Commit: f01c350fbb64d966d51de183c6681f48a3d061f0
      https://github.com/dylan-lang/opendylan/commit/f01c350fbb64d966d51de183c6681f48a3d061f0
  Author: Bruce Mitchener <[email protected]>
  Date:   2015-07-25 (Sat, 25 Jul 2015)

  Changed paths:
    M sources/dylan/tests/module.dylan
    M sources/dylan/tests/numbers.dylan

  Log Message:
  -----------
  [dylan,tests] Test instance? on <limited-integer>.

This is in preparation for making changes to how the instance?
checks are handled.

* sources/dylan/tests/numbers.dylan
  (test-number-class on <integer>): New specialization to call
    test-limited-integers.
  (test-limited-integers, test-limited-integer-instance?,
    check-limited-integer-instance?): New functions to test
    instance? on <limited-integer>.

* sources/dylan/tests/module.dylan
  (module dylan-test-suite): Import <limited-integer>, limited-integer-min,
    and limited-integer-max for use in testing instance? on <limited-integer>.


  Commit: 76ac0b7a4436c78e57963759aed377b586ecf248
      https://github.com/dylan-lang/opendylan/commit/76ac0b7a4436c78e57963759aed377b586ecf248
  Author: Bruce Mitchener <[email protected]>
  Date:   2015-07-25 (Sat, 25 Jul 2015)

  Changed paths:
    M sources/dfmc/modeling/namespaces.dylan
    M sources/dylan/limited-integer.dylan
    M sources/dylan/machine-word-lowlevel.dylan

  Log Message:
  -----------
  [dylan] Specialize limited-integer instance? checks.

Instead of checking at run-time whether or not we need to check min,
max or both, we can set this correctly when the type is created as
we have sufficient knowledge at that point to do so.

In LLVM, some type checks would have this inlined and most of the
overhead would be constant folded away, however this is still useful
for direct calls to instance?.

* sources/dylan/limited-integer.dylan
  (limited on <integer>): Call instance?-function to calculate the correct
    function to use.
  (limited-integer-instance?-function): Delete as it has been split up.
  (min+max-limited-integer-instance?-function,
   min-only-limited-integer-instance?-function,
   max-only-limited-integer-instance?-function): Specialized functions
    that only do the required work. The min+max function will be further
    optimized in a subsequent commit.
  (instance?-function on <limited-integer>): Return the specialized
    instance? function based upon the configuration of the limited
    integer type.

* sources/dylan/machine-word-lowlevel.dylan
  (machine-word-not-greater-than?): New raw comparison function.

* sources/dfmc/modeling/namespaces.dylan
  (&module internal): No longer export limited-integer-instance?-function
    as it no longer exists.


  Commit: 645168f0edb876579a4ec2e03f39cc0dfd09dee6
      https://github.com/dylan-lang/opendylan/commit/645168f0edb876579a4ec2e03f39cc0dfd09dee6
  Author: Bruce Mitchener <[email protected]>
  Date:   2015-07-25 (Sat, 25 Jul 2015)

  Changed paths:
    M sources/dylan/limited-integer.dylan
    M sources/dylan/machine-word-lowlevel.dylan

  Log Message:
  -----------
  [dylan] Optimize min+max limited integer instance?.

A negative signed number, treated as an unsigned value, will
be greater than all positive signed numbers. Due to this,
we can transform the min/max bounding check to use one
fewer branch.

This check:

   min <= i <= max

Can be turned into:

   unsigned(i - min) <= unsigned(max - min)

This is described in Chapter 4 of Hacker's Delight.

Fixes #912.

* sources/dylan/limited-integer.dylan
  (min+max-limited-integer-instance?-function): Re-implement using
    fewer branches.

* sources/dylan/machine-word-lowlevel.dylan
  (machine-word-unsigned-less-than?): Remove manual definition and
    use comparison-definer to define it.
  (machine-word-unsigned-not-greater-than?): New. Used for the <=
    check in min+max-limited-integer-instance?-function.


  Commit: 1a1b7533d52fa6752d82cfbd0051f8e1acf1ad81
      https://github.com/dylan-lang/opendylan/commit/1a1b7533d52fa6752d82cfbd0051f8e1acf1ad81
  Author: Bruce Mitchener <[email protected]>
  Date:   2015-07-25 (Sat, 25 Jul 2015)

  Changed paths:
    M sources/dylan/tests/numbers.dylan

  Log Message:
  -----------
  [dylan,tests] Improve limited integer instance? tests.

* sources/dylan/tests/numbers.dylan
  (hide-type-info): New function to avoid compile-time warnings
    about some invalid constructs so that we can more readily
    test the run-time failures.
  (check-limited-integer-instance?): Convert to a macro so that we
    can construct inline type checks as well. We want to make sure
    that the type of the type constraint is available at compile
    time so that the compiler back-end can emit optimal code and
    we're testing that code path. (In particular, we want to do
    this in the LLVM back-end.)
  (test-limited-integer-instance?) Update to use the new call
    signature for the macro.


  Commit: 0e021d3297537cb24cf813999c1c63ccdb7803d3
      https://github.com/dylan-lang/opendylan/commit/0e021d3297537cb24cf813999c1c63ccdb7803d3
  Author: Bruce Mitchener <[email protected]>
  Date:   2015-07-26 (Sun, 26 Jul 2015)

  Changed paths:
    M sources/dfmc/llvm-back-end/llvm-emit-type-check.dylan

  Log Message:
  -----------
  [dfmc-llvm-back-end] Optimize inline limited integer instance test.

* sources/dfmc/llvm-back-end/llvm-emit-type-check.dylan
  (do-emit-instance-cmp on <&limited-integer>): Optimize to eliminate
    a branch when both min and max have been set. This matches the
    changes to the instance? functions.


  Commit: 64ee4023d1ee586b590c4d4cb898c1b4f7d9c492
      https://github.com/dylan-lang/opendylan/commit/64ee4023d1ee586b590c4d4cb898c1b4f7d9c492
  Author: Bruce Mitchener <[email protected]>
  Date:   2015-07-26 (Sun, 26 Jul 2015)

  Changed paths:
    M documentation/release-notes/source/2015.1.rst

  Log Message:
  -----------
  [release-notes] Update for limited integer instance optimizations.

* documentation/release-notes/source/2015.1.rst: Update.


  Commit: eb6e3f6a4ef9bd82f01179d4d945f9d69c5e8db3
      https://github.com/dylan-lang/opendylan/commit/eb6e3f6a4ef9bd82f01179d4d945f9d69c5e8db3
  Author: Peter S. Housel <[email protected]>
  Date:   2015-07-26 (Sun, 26 Jul 2015)

  Changed paths:
    M documentation/release-notes/source/2015.1.rst
    M sources/dfmc/llvm-back-end/llvm-emit-type-check.dylan
    M sources/dfmc/modeling/namespaces.dylan
    M sources/dylan/limited-integer.dylan
    M sources/dylan/machine-word-lowlevel.dylan
    M sources/dylan/tests/module.dylan
    M sources/dylan/tests/numbers.dylan

  Log Message:
  -----------
  Merge pull request #946 from waywardmonkeys/limited-integer-instance-checks

Limited integer instance checks


Compare: https://github.com/dylan-lang/opendylan/compare/0cacb40eaefc...eb6e3f6a4ef9

_______________________________________________
chatter mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/chatter