[dylan-lang/opendylan] 225574: [dylan] Remove overflow checks in linear-class-key...

GitHub <[email protected]> Wed, 27 Jan 2016 20:08:42 -0800
Newsgroups gmane.comp.lang.dylan.gwydion.cvs
Message-ID <56a9944a9ad86_66913f9338a7b2b867089@hookshot-fe3-cp1-prd.iad.github.net.mail>
----==_mimepart_56a9944a9a585_66913f9338a7b2b8669ae
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

  Branch: refs/heads/master
  Home:   https://github.com/dylan-lang/opendylan
  Commit: 225574f12ff9531036d08532bcba210b715c5e94
      https://github.com/dylan-lang/opendylan/commit/225574f12ff9531036d08532bcba210b715c5e94
  Author: Bruce Mitchener <[email protected]>
  Date:   2016-01-28 (Thu, 28 Jan 2016)

  Changed paths:
    M sources/dfmc/modeling/namespaces.dylan
    M sources/dylan/new-dispatch.dylan

  Log Message:
  -----------
  [dylan] Remove overflow checks in linear-class-key-lookup

The loop in linear-class-key-lookup is known to be correct and
we don't need overflow checks when we're getting the new index
values. Removing this overflow turns the inner loop from:

    00000210  cmpl  %edi, %esi
    00000212  je  0x226
    00000214  movl  %esi, %ebx
    00000216  andl  $-0x4, %ebx
    00000219  cmpl  %ecx, 0x1c(%eax,%ebx)
    0000021d  je  0x22e
    0000021f  addl  $0x8, %esi
    00000222  jno 0x210

into:

    00000210  leal  0x1(%edi), %ebx
    00000213  andl  $-0x4, %ebx
    00000216  cmpl  %ecx, 0x1c(%edx,%ebx)
    0000021a  je  0x22b
    0000021c  addl  $0x8, %edi
    0000021f  cmpl  %edi, %esi
    00000221  jne 0x210

Here, we avoid the jno and perform the loop check at the end
of the loop rather than the start (with the LLVM back-end).

This helps lay the ground for some further optimizations in
subsequent commits.

* sources/dfmc/modeling/namespaces.dylan
  (&module machine-word-lowlevel): Export machine-word-add and
   machine-word-subtract so that other modules may use them.

* sources/dylan/new-dispatch.dylan
  (add-without-overflow): New helper function.
  (linear-class-key-lookup): Call add-without-overflow to avoid
   integer overflow checks.


  Commit: 4f6d912849a4c8f32cf8da155ff8a898b5b9ec3a
      https://github.com/dylan-lang/opendylan/commit/4f6d912849a4c8f32cf8da155ff8a898b5b9ec3a
  Author: Peter S. Housel <[email protected]>
  Date:   2016-01-27 (Wed, 27 Jan 2016)

  Changed paths:
    M sources/dfmc/modeling/namespaces.dylan
    M sources/dylan/new-dispatch.dylan

  Log Message:
  -----------
  Merge pull request #1033 from waywardmonkeys/avoid-overflow-checks-in-linear-dispatch-lookup

[dylan] Remove overflow checks in linear-class-key-lookup


Compare: https://github.com/dylan-lang/opendylan/compare/7df9935dac2e...4f6d912849a4
----==_mimepart_56a9944a9a585_66913f9338a7b2b8669ae
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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