Skip to content

Commit 4f1ba10

Browse files
committed
Remove %opaque primitive.
This was used for uncurried application, but does not seem to be needed now. And for some esoteric `Sys. opaque_identity` function.
1 parent e81ed32 commit 4f1ba10

File tree

13 files changed

+30
-63
lines changed

13 files changed

+30
-63
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
- Build the compiler libraries/tests in uncurried mode. https://github.com/rescript-lang/rescript-compiler/pull/6864
6969
- Ignore `-uncurried` command-line flag. https://github.com/rescript-lang/rescript-compiler/pull/6885
7070
- Cleanup: remove tracking of uncurried state in parser/printer. https://github.com/rescript-lang/rescript-compiler/pull/6888
71+
- Remove `%opaque` primitive. https://github.com/rescript-lang/rescript-compiler/pull/6892
7172

7273
#### :nail_care: Polish
7374

jscomp/core/lam_convert.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args loc : Lam.t =
357357
match a with
358358
| Pbigint | Pint32 -> prim ~primitive:(Pintcomp b) ~args loc
359359
| Pint64 -> prim ~primitive:(Pint64comp b) ~args loc)
360-
| Popaque -> Ext_list.singleton_exn args
361360

362361
(* Does not exist since we compile array in js backend unlike native backend *)
363362

@@ -569,7 +568,7 @@ let convert (exports : Set_ident.t) (lam : Lambda.lambda) :
569568
Lam.global_module ~dynamic_import id)
570569
| Lprim
571570
( Puncurried_apply,
572-
[ Lapply { ap_func = Lprim (Popaque, [ ap_func ], _); ap_args } ],
571+
[ Lapply { ap_func; ap_args } ],
573572
loc ) ->
574573
let ap_func = convert_aux ap_func in
575574
let ap_args = Ext_list.map ap_args convert_aux in

jscomp/ml/lambda.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ type primitive =
266266
| Pasrbint of boxed_integer
267267
| Pbintcomp of boxed_integer * comparison
268268
| Pctconst of compile_time_constant
269-
(* Inhibition of optimisation *)
270-
| Popaque
271269
| Puncurried_apply
272270
| Pcreate_extension of string
273271
and comparison =

jscomp/ml/lambda.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,6 @@ type primitive =
233233
| Pasrbint of boxed_integer
234234
| Pbintcomp of boxed_integer * comparison
235235
| Pctconst of compile_time_constant
236-
(* Inhibition of optimisation *)
237-
| Popaque
238236
| Puncurried_apply
239237
| Pcreate_extension of string
240238
and comparison =

jscomp/ml/printlambda.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ let primitive ppf = function
251251
| Pbintcomp(bi, Cgt) -> print_boxed_integer ">" ppf bi
252252
| Pbintcomp(bi, Cle) -> print_boxed_integer "<=" ppf bi
253253
| Pbintcomp(bi, Cge) -> print_boxed_integer ">=" ppf bi
254-
| Popaque -> fprintf ppf "opaque"
255254
| Pcreate_extension s -> fprintf ppf "extension[%s]" s
256255
let name_of_primitive = function
257256
| Puncurried_apply -> "Puncurried_apply"
@@ -342,7 +341,6 @@ let name_of_primitive = function
342341
| Plsrbint _ -> "Plsrbint"
343342
| Pasrbint _ -> "Pasrbint"
344343
| Pbintcomp _ -> "Pbintcomp"
345-
| Popaque -> "Popaque"
346344
| Pcreate_extension _ -> "Pcreate_extension"
347345

348346
let function_attribute ppf { inline; is_a_functor; return_unit } =

jscomp/ml/translcore.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ let primitives_table =
422422
("%int64_to_int32", Pcvtbint (Pint64, Pint32));
423423
("%int64_of_bigint", Pcvtbint (Pbigint, Pint64));
424424
("%int64_to_bigint", Pcvtbint (Pint64, Pbigint));
425-
("%opaque", Popaque);
426425
("%uncurried_apply", Puncurried_apply);
427426
]
428427

@@ -1101,8 +1100,7 @@ and transl_apply ?(inlined = Default_inline) ?(uncurried_partial_application=Non
11011100
let extra_ids = Array.init extra_arity (fun _ -> Ident.create "extra") |> Array.to_list in
11021101
let extra_args = Ext_list.map extra_ids (fun id -> Lvar id) in
11031102
let ap_args = args @ extra_args in
1104-
let lam_opaque = Lprim (Popaque, [lam], loc) in
1105-
let l0 = Lapply { ap_func = lam_opaque; ap_args; ap_inlined = inlined; ap_loc = loc } in
1103+
let l0 = Lapply { ap_func = lam; ap_args; ap_inlined = inlined; ap_loc = loc } in
11061104
let l1 = Lprim (Puncurried_apply, [l0], loc) in
11071105
Lfunction
11081106
{

jscomp/ml/typecore.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,7 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg=Rejected) env sexp ty
21782178
| _ -> false in
21792179

21802180
if fully_applied && not is_primitive then
2181-
rue (apply_internal "opaqueFullApply" (mk_apply (apply_internal "opaque" funct) args))
2181+
rue (apply_internal "opaqueFullApply" (mk_apply funct args))
21822182
else
21832183
rue (mk_apply funct args)
21842184
| Pexp_match(sarg, caselist) ->

jscomp/others/js.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ module Internal = {
8282

8383
/* Use opaque instead of [._n] to prevent some optimizations happening */
8484
external run: ((. unit) => 'a) => 'a = "#run"
85-
external opaque: 'a => 'a = "%opaque"
8685
}
8786

8887
/**

jscomp/runtime/js.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ module Internal = {
8282

8383
/* Use opaque instead of [._n] to prevent some optimizations happening */
8484
external run: ((. unit) => 'a) => 'a = "#run"
85-
external opaque: 'a => 'a = "%opaque"
8685
}
8786

8887
/**

jscomp/stdlib-406/sys.res

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,3 @@ let runtime_warnings_enabled: unit => bool = _ => false
125125
/* The version string is found in file ../VERSION */
126126

127127
let ocaml_version = "4.06.2+BS"
128-
129-
/* Optimization */
130-
131-
external opaque_identity: 'a => 'a = "%opaque"

0 commit comments

Comments
 (0)