Skip to content

Instantly share code, notes, and snippets.

@Simn

Simn/GCstats.md Secret

Created April 23, 2017 10:39
Show Gist options
  • Save Simn/96237cb536ba8e24e270405b604d127c to your computer and use it in GitHub Desktop.
Save Simn/96237cb536ba8e24e270405b604d127c to your computer and use it in GitHub Desktop.
what before after
minor_words 273818219 273740071
promoted_words 28656518 28640399
major_words 30266199 30250080
minor_collections 1046 1046
major_collections 18 19
heap_words 16229888 16229888
heap_chunks 26 26
top_heap_words 16229888 16229888
live_words 11213820 12092495
live_blocks 3155707 3420954
free_words 4990229 4098040
free_blocks 292424 201564
largest_free 383867 1645678
fragments 25839 39353
compactions 0 0
diff --git a/src/macro/eval/evalDecode.ml b/src/macro/eval/evalDecode.ml
index f138cb8..2028ba8 100644
--- a/src/macro/eval/evalDecode.ml
+++ b/src/macro/eval/evalDecode.ml
@@ -27,19 +27,19 @@ let decode_pos v = match v with
| _ -> raise MacroApi.Invalid_expr (* maybe_decode_pos relies on this being raised *)
let decode_array v = match v with
- | VArray(va,_) -> EvalArray.to_list va
+ | VArray va -> EvalArray.to_list va
| _ -> unexpected_value v "array"
let decode_varray v = match v with
- | VArray(va,_) -> va
+ | VArray va -> va
| _ -> unexpected_value v "array"
let decode_string v = match v with
- | VString(s,_) -> Rope.to_string s
+ | VString s -> Rope.to_string s
| _ -> unexpected_value v "string"
let decode_rope v = match v with
- | VString(s,_) -> s
+ | VString s -> s
| _ -> unexpected_value v "string"
let decode_bytes v = match v with
diff --git a/src/macro/eval/evalEmitter.ml b/src/macro/eval/evalEmitter.ml
index 45c7b51..e8de4b6 100644
--- a/src/macro/eval/evalEmitter.ml
+++ b/src/macro/eval/evalEmitter.ml
@@ -309,11 +309,11 @@ let emit_local_read i env = env.locals.(i)
let emit_capture_read i env = !(env.captures.(i))
let emit_array_length_read exec env = match exec env with
- | VArray(va,_) -> vint (va.EvalArray.alength)
+ | VArray va -> vint (va.EvalArray.alength)
| v -> unexpected_value v "array"
let emit_string_length_read exec env = match exec env with
- | VString(s,_) -> vint (Rope.length s)
+ | VString s -> vint (Rope.length s)
| v -> unexpected_value v "array"
let emit_bytes_length_read exec env = match exec env with
@@ -480,9 +480,9 @@ let op_add v1 v2 = match v1,v2 with
| VInt32 i1,VInt32 i2 -> vint32 (Int32.add i1 i2)
| VFloat f1,VFloat f2 -> vfloat (f1 +. f2)
| VInt32 i,VFloat f | VFloat f,VInt32 i -> vfloat ((Int32.to_float i) +. f)
- | VString(s1,_),VString(s2,_) -> encode_rope (Rope.concat2 s1 s2)
- | VString(s1,_),v2 -> encode_rope (Rope.concat2 s1 (RopePrinting.value_string v2))
- | v1,VString(s2,_) -> encode_rope (Rope.concat2 (RopePrinting.value_string v1) s2)
+ | VString s1,VString s2 -> encode_rope (Rope.concat2 s1 s2)
+ | VString s1,v2 -> encode_rope (Rope.concat2 s1 (RopePrinting.value_string v2))
+ | v1,VString s2 -> encode_rope (Rope.concat2 (RopePrinting.value_string v1) s2)
| v1,v2 -> encode_rope (Rope.concat2 (RopePrinting.value_string v1) (RopePrinting.value_string v2))
let op_mult p v1 v2 = match v1,v2 with
diff --git a/src/macro/eval/evalEncode.ml b/src/macro/eval/evalEncode.ml
index 6184c97..f5e7088 100644
--- a/src/macro/eval/evalEncode.ml
+++ b/src/macro/eval/evalEncode.ml
@@ -107,16 +107,16 @@ let encode_instance ?(kind=INormal) path =
VInstance (create_instance ~kind path)
let encode_array_instance a =
- VArray (a,(get_ctx()).array_prototype)
+ VArray a
let encode_array l =
encode_array_instance (EvalArray.create (Array.of_list l))
let encode_string s =
- VString(Rope.of_string s,(get_ctx()).string_prototype)
+ VString (Rope.of_string s)
let encode_rope s =
- VString(s,(get_ctx()).string_prototype)
+ VString s
let encode_bytes s =
encode_instance key_haxe_io_Bytes ~kind:(IBytes s)
diff --git a/src/macro/eval/evalMain.ml b/src/macro/eval/evalMain.ml
index 95bbabf..2641784 100644
--- a/src/macro/eval/evalMain.ml
+++ b/src/macro/eval/evalMain.ml
@@ -101,8 +101,8 @@ let rec value_to_expr v p =
| VFalse -> (EConst (Ident "false"),p)
| VInt32 i -> (EConst (Int (Int32.to_string i)),p)
| VFloat f -> haxe_float f p
- | VString(s,_) -> (EConst (String (Rope.to_string s)),p)
- | VArray(va,_) -> (EArrayDecl (List.map (fun v -> value_to_expr v p) (EvalArray.to_list va)),p)
+ | VString s -> (EConst (String (Rope.to_string s)),p)
+ | VArray va -> (EArrayDecl (List.map (fun v -> value_to_expr v p) (EvalArray.to_list va)),p)
| _ -> exc_string ("Cannot convert " ^ (value_string v) ^ " to expr")
let encode_obj = encode_obj_s
diff --git a/src/macro/eval/evalMisc.ml b/src/macro/eval/evalMisc.ml
index ddf008c..9c79d93 100644
--- a/src/macro/eval/evalMisc.ml
+++ b/src/macro/eval/evalMisc.ml
@@ -45,10 +45,10 @@ let field_raise v f =
| VInstance {ikind = IBytes s} when f = key_length -> vint (Bytes.length s)
| VInstance vi -> (try instance_field vi f with Not_found -> proto_field_raise vi.iproto f)
| VPrototype proto -> proto_field_raise proto f
- | VArray(va,_) ->
+ | VArray va ->
if f = key_length then vint (va.EvalArray.alength)
else proto_field_direct (get_ctx()).array_prototype f
- | VString(s,_) ->
+ | VString s ->
if f = key_length then vint (Rope.length s)
else proto_field_direct (get_ctx()).string_prototype f
| _ -> raise Not_found
@@ -64,7 +64,7 @@ let set_field v1 name v2 = match v1 with
| VObject o -> set_object_field o name v2
| VInstance vi -> set_instance_field vi name v2
| VPrototype proto -> set_proto_field proto name v2
- | VArray(va,_) ->
+ | VArray va ->
(* Vector.new does this *)
if name = key_length then begin
EvalArray.set_length va vnull (decode_int v2);
@@ -86,14 +86,14 @@ let rec compare a b =
| VTrue,VTrue | VFalse,VFalse -> CEq
| VFalse,VTrue -> CInf
| VTrue,VFalse -> CSup
- | VString(s1,_),VString(s2,_) ->
+ | VString s1,VString s2 ->
let r = Rope.compare s1 s2 in
if r = 0 then CEq else if r < 0 then CInf else CSup
| VFunction a,VFunction b ->
if a == b then CEq else CUndef
| VStaticFunction a, VStaticFunction b ->
if a == b then CEq else CUndef
- | VArray(va1,_),VArray(va2,_) ->
+ | VArray va1,VArray va2 ->
if va1 == va2 then CEq else CUndef
| VObject a,VObject b ->
if a == b then CEq else CUndef
@@ -120,13 +120,13 @@ let rec equals a b =
| VFloat a,VInt32 b -> a = (Int32.to_float b)
| VInt32 a,VFloat b -> (Int32.to_float a) = b
| VTrue,VTrue | VFalse,VFalse -> true
- | VString(s1,_),VString(s2,_) ->
+ | VString s1,VString s2 ->
Rope.equal s1 s2
| VFunction a,VFunction b ->
a == b
| VStaticFunction a,VStaticFunction b ->
a == b
- | VArray(va1,_),VArray(va2,_) ->
+ | VArray va1,VArray va2 ->
a == b
| VObject a,VObject b ->
a == b
@@ -179,9 +179,9 @@ let rec equals_structurally a b =
equals a b || match a,b with
| VEnumValue ev1,VEnumValue ev2 ->
ev1.eindex = ev2.eindex && arrays_equal ev1.eargs ev2.eargs
- | VString(s1,_),VString(s2,_) ->
+ | VString s1,VString s2 ->
s1 = s2
- | VArray(va1,_),VArray(va2,_) ->
+ | VArray va1,VArray va2 ->
varrays_equal va1 va2
| VObject o1,VObject o2 ->
if IntMap.cardinal o1.ofields <> IntMap.cardinal o2.ofields then
diff --git a/src/macro/eval/evalPrinting.ml b/src/macro/eval/evalPrinting.ml
index 193eb98..1a8e2c7 100644
--- a/src/macro/eval/evalPrinting.ml
+++ b/src/macro/eval/evalPrinting.ml
@@ -40,8 +40,8 @@ and s_value depth v =
| VFunction _ -> "#function"
| VStaticFunction _ -> "#staticfunction"
| VFieldClosure _ -> "#closure"
- | VString(s,_) -> Rope.to_string s
- | VArray(va,_) -> s_array (depth + 1) va
+ | VString s -> Rope.to_string s
+ | VArray va -> s_array (depth + 1) va
| VEnumValue ve -> s_enum_value depth ve
| VInstance {ikind=IDate d} -> s_date d
| VInstance {ikind=IPos p} -> "#pos(" ^ Lexer.get_error_pos (Printf.sprintf "%s:%d:") p ^ ")"
@@ -127,8 +127,8 @@ module RopePrinting = struct
| VFunction _ -> rfunction
| VStaticFunction _ -> rstaticfunction
| VFieldClosure _ -> rclosure
- | VString(s,_) -> s
- | VArray(va,_) -> s_array (depth + 1) va
+ | VString s -> s
+ | VArray va -> s_array (depth + 1) va
| VEnumValue ve ->
s_enum_value depth ve
| VInstance {ikind=IDate d} -> s_date d
diff --git a/src/macro/eval/evalStdLib.ml b/src/macro/eval/evalStdLib.ml
index 5e61684..020ee49 100644
--- a/src/macro/eval/evalStdLib.ml
+++ b/src/macro/eval/evalStdLib.ml
@@ -243,7 +243,7 @@ let create_empty_instance path =
module StdArray = struct
let this this = match this with
- | VArray(va,_) -> va
+ | VArray va -> va
| v -> unexpected_value v "array"
let concat = vifun1 (fun vthis a2 ->
@@ -786,7 +786,7 @@ module StdLog = struct
let file_name = decode_string (object_field infos key_fileName) in
let line_number = decode_int (object_field infos key_lineNumber) in
let l = match object_field infos key_customParams with
- | VArray(va,_) -> s :: (List.map value_string (EvalArray.to_list va))
+ | VArray va -> s :: (List.map value_string (EvalArray.to_list va))
| _ -> [s]
in
((get_ctx()).curapi.MacroApi.get_com()).Common.print (Printf.sprintf "%s:%i: %s\n" file_name line_number (String.concat "," l));
@@ -1086,7 +1086,7 @@ module StdString = struct
)
let this vthis = match vthis with
- | VString(s,_) -> s
+ | VString s -> s
| v -> unexpected_value v "string"
let charAt = vifun1 (fun vthis index ->
@@ -1231,7 +1231,7 @@ module StdStringBuf = struct
let add = vifun1 (fun vthis x ->
let this = this vthis in
begin match x with
- | VString(s,_) -> Buffer.add_rope this s
+ | VString s -> Buffer.add_rope this s
| _ -> Buffer.add_string this (value_string x)
end;
vnull;
@@ -1331,7 +1331,7 @@ module StdSys = struct
let command = vfun2 (fun cmd args ->
let cmd = decode_string cmd in
let args = match args with
- | VArray(va,_) -> List.map value_string (EvalArray.to_list va)
+ | VArray va -> List.map value_string (EvalArray.to_list va)
| _ -> []
in
let command = String.concat " " (cmd :: args) in
@@ -1438,8 +1438,8 @@ module StdType = struct
let vf = field v constr in
match vf,params with
| VEnumValue _,VNull -> vf
- | VEnumValue _,VArray(va,_) when va.EvalArray.alength = 0 -> vf
- | VStaticFunction f,VArray(va,_) -> f (EvalArray.to_list va)
+ | VEnumValue _,VArray va when va.EvalArray.alength = 0 -> vf
+ | VStaticFunction f,VArray va -> f (EvalArray.to_list va)
| _ -> unexpected_value params "array"
let allEnums = vfun1 (fun v ->
@@ -1534,7 +1534,7 @@ module StdType = struct
let enumParameters = vfun1 (fun v -> match v with
| VEnumValue ev ->
let va = EvalArray.create ev.eargs in
- VArray(va,(get_ctx()).array_prototype)
+ VArray va
| v -> unexpected_value v "enum value"
)
diff --git a/src/macro/eval/evalValue.ml b/src/macro/eval/evalValue.ml
index 12a4e2c..418ab1a 100644
--- a/src/macro/eval/evalValue.ml
+++ b/src/macro/eval/evalValue.ml
@@ -25,8 +25,8 @@ module Make (ValueHashtbl : Hashtbl.S) = struct
| VFalse
| VInt32 of int32
| VFloat of float
- | VString of Rope.t * vprototype
- | VArray of value EvalArray.t * vprototype
+ | VString of Rope.t
+ | VArray of value EvalArray.t
| VEnumValue of venum_value
| VObject of vobject
| VInstance of vinstance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment