summaryrefslogtreecommitdiff
path: root/src/lem_interp
diff options
context:
space:
mode:
authorGabriel Kerneis2014-02-28 12:09:44 +0000
committerGabriel Kerneis2014-02-28 12:20:18 +0000
commit4baec1546cd0f1ddf43eba93e4daa4634ce1d9df (patch)
tree2140debc0341b33e2c197a5f8c47211254083432 /src/lem_interp
parent98231d112693ef6815e79a6aba3ba0a5b7f027a7 (diff)
Load ELF sections to virtual memory addresses
Roughly 110KB/s (~5 seconds to load "hello" test).
Diffstat (limited to 'src/lem_interp')
-rw-r--r--src/lem_interp/run_interp.ml8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lem_interp/run_interp.ml b/src/lem_interp/run_interp.ml
index 66880ade..0ed3edaa 100644
--- a/src/lem_interp/run_interp.ml
+++ b/src/lem_interp/run_interp.ml
@@ -105,11 +105,12 @@ module Mem = struct
include Map.Make(struct
type t = (id * big_int)
let compare (i1, v1) (i2, v2) =
- match id_compare i1 i2 with
- | 0 -> compare_big_int v1 v2
+ (* optimize for common case: different addresses, same id *)
+ match compare_big_int v1 v2 with
+ | 0 -> id_compare i1 i2
| n -> n
end)
- (* debugging memory accesses *)
+ (* debugging memory accesses
let add (n, idx) v m =
eprintf "%s[%s] <- %s\n" (id_to_string n) (string_of_big_int idx) (val_to_string v);
add (n, idx) v m
@@ -117,6 +118,7 @@ module Mem = struct
let v = find (n, idx) m in
eprintf "%s[%s] -> %s\n" (id_to_string n) (string_of_big_int idx) (val_to_string v);
v
+ *)
end ;;
let slice v = function