dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.06k stars 1.56k forks source link

VM: Ideas for speeding up integers #32582

Open ErikCorryGoogle opened 6 years ago

ErikCorryGoogle commented 6 years ago

Smaller Smis can slow down some integer operations, but with tighter types for ints in Dart2, there should be some opportunities to speed up integer operations in the VM and produce tighter code. This bug collects ideas for doing this.

ErikCorryGoogle commented 6 years ago

From Martin Kustermann: LoadIndexedInstr could return a kUnboxedInt64 on 64 bit platforms.

ErikCorryGoogle commented 6 years ago

In Dartino the front-end desugared optional arguments and variable length argument lists into multiple copies of methods. A similar desugaring could duplicate methods that take ints and doubles into a copy where ints and doubles are passed unboxed on the stack, and a more conservative copy that expects tagged ints.

mkustermann commented 6 years ago

Currently we manually mark some Smi operations as truncating when we know they don't overflow. With smaller Smis, we have to additionally sign-extend. So instead of marking these instructions as truncating we should give them a range so the range analysis will conclude it they cannot overflow.