Commit graph

23 commits

Author SHA1 Message Date
Mario Carneiro
ced436a707 fix(library/vm/vm_nat): fix VM definition of nat.shiftr
fixes #1723
2017-07-11 20:53:15 +01:00
Mario Carneiro
e705d89490 feat(init/data/int): bitwise ops for integers 2017-06-27 18:55:52 -07:00
Mario Carneiro
ebf15e34cb feat(library/vm/vm_nat): implementation of new bitwise ops 2017-06-27 18:55:52 -07:00
Leonardo de Moura
dc1a1c8540 refactor(library): has_to_string ==> has_repr
See issue #1664

This is just the first step to implement proposal described at issue #1664.
2017-06-18 18:29:19 -07:00
Leonardo de Moura
d489955600 fix(library/vm/vm_nat): bitwise operators 2017-05-30 13:09:17 -07:00
Mario Carneiro
9d676776b5 feat(library/vm/vm_nat): implementations of bitwise ops 2017-05-30 12:47:44 -07:00
Leonardo de Moura
ad713c81b4 perf(library/vm/vm_nat): use __builtin_expect to optimize nat operations
@gebner I used the __builtin_expect trick to optimize the vm_nat module.
Most of the time, we are processing small numbers.
In the following example, the runtime went from 7.27 secs to 6.6 secs
on my machine.

def mk (a : nat) : nat → list nat
| 0     := []
| (nat.succ n) := a :: mk n

def Sum : list nat → nat → nat
| []      r := r
| (n::ns) r := Sum ns (r + n)

def loop : nat → nat → nat
| s 0            := s
| s (nat.succ n) := loop (s + (Sum (mk (n % 2) 1000000) 0)) n

vm_eval timeit "time" $ loop 0 30
2017-02-15 23:25:26 -08:00
Leonardo de Moura
ba3303163d fix(library/vm/vm_nat): nat.has_decidable_eq has been renamed 2016-11-15 14:41:04 -08:00
Leonardo de Moura
b28e724709 feat(library/vm): expose 'environment' C++ object 2016-06-07 17:01:17 -07:00
Leonardo de Moura
fb6c9f2879 feat(library/vm/vm_expr): add more functions to 'expr' API 2016-06-06 11:26:19 -07:00
Leonardo de Moura
fe4fafd95d chore(library/vm): remove unnecessary includes 2016-06-03 13:07:06 -07:00
Leonardo de Moura
924f3629ee feat(library/vm): expose name of the C++ functions that implement builtins 2016-06-02 12:48:43 -07:00
Leonardo de Moura
a6a7daff59 refactor(library/vm): avoid constants.txt when creating bindings 2016-06-02 11:45:56 -07:00
Leonardo de Moura
8bccfc23da feat(library/vm): add example of C function invoking Lean closure 2016-05-31 18:45:14 -07:00
Leonardo de Moura
b31a7bd3e7 feat(library/vm): use cfunction style for nat and IO primitives 2016-05-31 17:22:27 -07:00
Leonardo de Moura
cc4b70e5e5 feat(library/vm/vm_nat): add native support for nat.to_string 2016-05-26 10:55:22 -07:00
Leonardo de Moura
af1908be94 feat(frontends/lean/decl_cmds): do not generate warning for definitions that are implemented in the VM 2016-05-13 18:17:20 -07:00
Leonardo de Moura
2bd400964c feat(library/vm/vm): store arguments in reverse order on the stack
It simplifies the code for handling closures.
2016-05-13 10:54:29 -07:00
Leonardo de Moura
a533cc56ec fix(library/vm/vm_nat): typo 2016-05-12 19:34:06 -07:00
Leonardo de Moura
9fbf3f2921 feat(library/vm): encode small numerals using scnstr instead of num operation 2016-05-12 16:43:21 -07:00
Leonardo de Moura
de327c0c20 feat(library/vm/vm_nat): add builtin support for nat lt 2016-05-12 16:36:37 -07:00
Leonardo de Moura
1393238c9d fix(library/vm/vm_nat): fix constant name 2016-05-12 15:29:14 -07:00
Leonardo de Moura
399b83122c refactor(library): move vm to a separate directory 2016-05-12 14:45:06 -07:00