diff --git a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml index 4335935509a9f3e390246ba7fdd5d0c3319ee89f..6ae814811e9d54330f6464ab12ba3d1bd1cdb7ec 100644 --- a/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml +++ b/src/proto_alpha/lib_benchmarks_proto/interpreter_benchmarks.ml @@ -850,9 +850,8 @@ module Registration_section = struct else match comb_acc with | Ex_value {value; ty} -> - make_comb - (comb_width - 1) - (Ex_value {value = ((), value); ty = pair unit ty}) + let ty = pair unit ty in + make_comb (comb_width - 1) (Ex_value {value = ((), value); ty}) let () = let unpair n = @@ -937,25 +936,25 @@ module Registration_section = struct let () = simple_benchmark ~name:Interpreter_workload.N_ICons_pair - ~kinstr:(ICons_pair (kinfo_unitunit, halt (pair unit unit @$ bot))) + ~kinstr:(ICons_pair (kinfo_unitunit, halt (cpair unit unit @$ bot))) () let () = simple_benchmark ~name:Interpreter_workload.N_ICar - ~kinstr:(ICar (kinfo (pair unit unit @$ bot), halt_unit)) + ~kinstr:(ICar (kinfo (cpair unit unit @$ bot), halt_unit)) () let () = simple_benchmark ~name:Interpreter_workload.N_ICdr - ~kinstr:(ICdr (kinfo (pair unit unit @$ bot), halt_unit)) + ~kinstr:(ICdr (kinfo (cpair unit unit @$ bot), halt_unit)) () let () = simple_benchmark ~name:Interpreter_workload.N_IUnpair - ~kinstr:(IUnpair (kinfo (pair unit unit @$ bot), halt_unitunit)) + ~kinstr:(IUnpair (kinfo (cpair unit unit @$ bot), halt_unitunit)) () end @@ -1018,13 +1017,13 @@ module Registration_section = struct let () = simple_benchmark ~name:Interpreter_workload.N_ILeft - ~kinstr:(ICons_left (kinfo_unit, halt (union unit unit @$ bot))) + ~kinstr:(ICons_left (kinfo_unit, halt (cunion unit unit @$ bot))) () let () = simple_benchmark ~name:Interpreter_workload.N_IRight - ~kinstr:(ICons_right (kinfo_unit, halt (union unit unit @$ bot))) + ~kinstr:(ICons_right (kinfo_unit, halt (cunion unit unit @$ bot))) () let () = @@ -1033,7 +1032,7 @@ module Registration_section = struct ~kinstr: (IIf_left { - kinfo = kinfo (union unit unit @$ bot); + kinfo = kinfo (cunion unit unit @$ bot); branch_if_left = halt_unit; branch_if_right = halt_unit; k = halt_unit; @@ -1255,14 +1254,14 @@ module Registration_section = struct let map_map_code = IMap_map ( kinfo (map int_cmp unit @$ unit @$ bot), - ICdr (kinfo (pair int unit @$ unit @$ bot), halt_unitunit), + ICdr (kinfo (cpair int unit @$ unit @$ bot), halt_unitunit), halt (map int_cmp unit @$ unit @$ bot) ) *) let map_map_code = IMap_map ( kinfo (map int_cmp unit @$ unit @$ bot), - IFailwith (kinfo (pair int unit @$ unit @$ bot), 0, pair int unit), + IFailwith (kinfo (cpair int unit @$ unit @$ bot), 0, cpair int unit), halt (map int_cmp unit @$ unit @$ bot) ) let () = @@ -1283,7 +1282,7 @@ module Registration_section = struct let kmap_iter_code = IMap_iter ( kinfo (map int_cmp unit @$ unit @$ bot), - IDrop (kinfo (pair int unit @$ unit @$ bot), halt_unit), + IDrop (kinfo (cpair int unit @$ unit @$ bot), halt_unit), halt_unit ) let () = @@ -1746,7 +1745,7 @@ module Registration_section = struct ~kinstr: (IEdiv_teznat ( kinfo (mutez @$ nat @$ bot), - halt (option (pair mutez mutez) @$ bot) )) + halt (option (cpair mutez mutez) @$ bot) )) ~stack_sampler:(fun cfg rng_state -> let (_, samplers) = make_default_samplers cfg.sampler in fun () -> @@ -1761,7 +1760,7 @@ module Registration_section = struct ~kinstr: (IEdiv_tez ( kinfo (mutez @$ mutez @$ bot), - halt (option (pair nat mutez) @$ bot) )) + halt (option (cpair nat mutez) @$ bot) )) () end @@ -1871,7 +1870,7 @@ module Registration_section = struct ~intercept_stack:(zero, (zero, eos)) ~kinstr: (IEdiv_int - (kinfo (int @$ int @$ bot), halt (option (pair int nat) @$ bot))) + (kinfo (int @$ int @$ bot), halt (option (cpair int nat) @$ bot))) () let () = @@ -1880,7 +1879,7 @@ module Registration_section = struct ~intercept_stack:(zero_n, (zero, eos)) ~kinstr: (IEdiv_nat - (kinfo (nat @$ int @$ bot), halt (option (pair int nat) @$ bot))) + (kinfo (nat @$ int @$ bot), halt (option (cpair int nat) @$ bot))) () let () = @@ -1984,10 +1983,11 @@ module Registration_section = struct ICons_right -> IHalt *) - let cons_r = ICons_right (kinfo_unit, halt (union unit unit @$ bot)) in + let cons_r = ICons_right (kinfo_unit, halt (cunion unit unit @$ bot)) in simple_benchmark ~name:Interpreter_workload.N_ILoop_left - ~kinstr:(ILoop_left (kinfo (union unit unit @$ bot), cons_r, halt_unit)) + ~kinstr: + (ILoop_left (kinfo (cunion unit unit @$ bot), cons_r, halt_unit)) () let () = @@ -2035,9 +2035,9 @@ module Registration_section = struct let descr = { kloc = 0; - kbef = pair unit unit @$ bot; + kbef = cpair unit unit @$ bot; kaft = unit @$ bot; - kinstr = ICdr (kinfo (pair unit unit @$ bot), halt_unit); + kinstr = ICdr (kinfo (cpair unit unit @$ bot), halt_unit); } in Lam (descr, Micheline.Int (0, Z.zero)) @@ -2046,7 +2046,7 @@ module Registration_section = struct ~name:Interpreter_workload.N_IApply ~kinstr: (IApply - ( kinfo (unit @$ lambda (pair unit unit) unit @$ bot), + ( kinfo (unit @$ lambda (cpair unit unit) unit @$ bot), unit, halt (lambda unit unit @$ bot) )) ~stack_sampler:(fun _cfg _rng_state () -> ((), (code, eos))) @@ -2178,20 +2178,20 @@ module Registration_section = struct let () = let lambda = let open Script_typed_ir in + let pair_list_operation_unit = pair (list operation) unit in let descr = { kloc = 0; - kbef = pair unit unit @$ bot; - kaft = pair (list operation) unit @$ bot; + kbef = cpair unit unit @$ bot; + kaft = pair_list_operation_unit @$ bot; kinstr = ICdr - ( kinfo (pair unit unit @$ bot), + ( kinfo (cpair unit unit @$ bot), INil ( kinfo (unit @$ bot), ICons_pair ( kinfo (list operation @$ unit @$ bot), - IHalt (kinfo (pair (list operation) unit @$ bot)) ) ) - ); + IHalt (kinfo (pair_list_operation_unit @$ bot)) ) ) ); } in Lam (descr, Micheline.Int (0, Z.zero)) @@ -2462,9 +2462,10 @@ module Registration_section = struct let kinstr = let spl_state = sapling_state memo_size in let spl_tx = sapling_transaction memo_size in + let pair_int_spl_state = pair int spl_state in ISapling_verify_update ( kinfo (spl_tx @$ spl_state @$ bot), - halt (option (pair int spl_state) @$ bot) ) + halt (option pair_int_spl_state @$ bot) ) let prepare_sapling_execution_environment sapling_forge_rng_seed sapling_transition = @@ -2666,12 +2667,12 @@ module Registration_section = struct () let () = + let pair_bls12_381_g1_g2 = pair bls12_381_g1 bls12_381_g2 in simple_benchmark ~name:Interpreter_workload.N_IPairing_check_bls12_381 ~kinstr: (IPairing_check_bls12_381 - ( kinfo (list (pair bls12_381_g1 bls12_381_g2) @$ bot), - halt (bool @$ bot) )) + (kinfo (list pair_bls12_381_g1_g2 @$ bot), halt (bool @$ bot))) () end @@ -2689,13 +2690,16 @@ module Registration_section = struct ~kinstr: (IRead_ticket ( kinfo (ticket unit_cmp @$ bot), - halt (pair address (pair unit nat) @$ ticket unit_cmp @$ bot) )) + halt (cpair address (cpair unit nat) @$ ticket unit_cmp @$ bot) + )) () let split_ticket_instr = + let ticket_unit = ticket unit_cmp in + let pair_ticket_unit_ticket_unit = pair ticket_unit ticket_unit in ISplit_ticket - ( kinfo (ticket unit_cmp @$ pair nat nat @$ bot), - halt (option (pair (ticket unit_cmp) (ticket unit_cmp)) @$ bot) ) + ( kinfo (ticket_unit @$ cpair nat nat @$ bot), + halt (option pair_ticket_unit_ticket_unit @$ bot) ) let () = let zero = Alpha_context.Script_int.zero_n in @@ -2739,10 +2743,12 @@ module Registration_section = struct () let join_tickets_instr = + let ticket_str = ticket string_cmp in + let pair_ticket_str_ticket_str = pair ticket_str ticket_str in IJoin_tickets - ( kinfo (pair (ticket string_cmp) (ticket string_cmp) @$ bot), + ( kinfo (pair_ticket_str_ticket_str @$ bot), string_cmp, - halt (option (ticket string_cmp) @$ bot) ) + halt (option ticket_str @$ bot) ) let () = benchmark @@ -2792,7 +2798,7 @@ module Registration_section = struct IOpen_chest ( kinfo (Michelson_types.chest_key @$ Michelson_types.chest @$ nat @$ bot), - halt (union bytes bool @$ bot) ) + halt (cunion bytes bool @$ bot) ) let resulting_stack chest chest_key time = let chest = Script_timelock.make_chest chest in @@ -2941,7 +2947,7 @@ module Registration_section = struct ~cont_and_stack_sampler:(fun _cfg _rng_state -> let cont = KLoop_in_left - (ICons_right (kinfo_unit, halt (union unit unit @$ bot)), KNil) + (ICons_right (kinfo_unit, halt (cunion unit unit @$ bot)), KNil) in let stack = (R (), eos) in fun () -> Ex_stack_and_cont {stack; cont}) @@ -3072,7 +3078,7 @@ module Registration_section = struct () let map_enter_body_code = - let kbody = ICdr (kinfo (pair int unit @$ unit @$ bot), halt_unitunit) in + let kbody = ICdr (kinfo (cpair int unit @$ unit @$ bot), halt_unitunit) in fun accu -> KMap_enter_body (kbody, accu, Script_map.empty int_cmp, KNil) let () = @@ -3122,7 +3128,7 @@ module Registration_section = struct ~name:Interpreter_workload.N_KMap_exit_body ~cont_and_stack_sampler:(fun cfg rng_state -> let kbody = - ICdr (kinfo (pair int unit @$ unit @$ bot), halt_unitunit) + ICdr (kinfo (cpair int unit @$ unit @$ bot), halt_unitunit) in fun () -> let (key, map) = Maps.generate_map_and_key_in_map cfg rng_state in diff --git a/src/proto_alpha/lib_benchmarks_proto/michelson_types.ml b/src/proto_alpha/lib_benchmarks_proto/michelson_types.ml index 0e659cc97c91f52514d1680aa606280f7180da2d..48cc403e04292faf276482658d26e874b9c50792 100644 --- a/src/proto_alpha/lib_benchmarks_proto/michelson_types.ml +++ b/src/proto_alpha/lib_benchmarks_proto/michelson_types.ml @@ -96,10 +96,18 @@ let set k = match set_t (-1) k with Error _ -> assert false | Ok t -> t let pair k1 k2 = match pair_t (-1) k1 k2 with Error _ -> assert false | Ok t -> t +(* (will become) comparable pair type constructor *) +let cpair k1 k2 = + match pair_t (-1) k1 k2 with Error _ -> assert false | Ok t -> t + (* union type constructor*) let union k1 k2 = match union_t (-1) k1 k2 with Error _ -> assert false | Ok t -> t +(* (will become) comparable union type constructor *) +let cunion k1 k2 = + match union_t (-1) k1 k2 with Error _ -> assert false | Ok t -> t + let lambda x y = match lambda_t (-1) x y with Error _ -> assert false | Ok t -> t