这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
265 commits
Select commit Hold shift + click to select a range
105ff1c
revert this_is_ocamlj flag
smjleo Jul 14, 2025
cddc5a8
add lambda->flambda2 pass
smjleo Jul 11, 2025
fc002db
merge
smjleo Jul 14, 2025
5c3cd33
add comment
smjleo Jul 14, 2025
350bb29
format
smjleo Jul 14, 2025
d1c17a8
address review
smjleo Jul 14, 2025
b1c2db1
add jsir-related files
smjleo Jul 14, 2025
231f408
ocamlformat
smjleo Jul 15, 2025
c7a3ab8
scaffold structure
smjleo Jul 15, 2025
f1b0cc7
WIP let bindings
smjleo Jul 15, 2025
cedb9d8
Enable 32-bit support for Targetint_31_63
smjleo Jul 9, 2025
e28056d
ocamlformat
smjleo Jul 9, 2025
4a1a731
Create ocamlj executable
smjleo Jul 9, 2025
3752634
Raise error at the right place
smjleo Jul 10, 2025
e128014
stray whitespace
smjleo Jul 11, 2025
1c1939e
typo
smjleo Jul 11, 2025
ff62908
ocamlformat
smjleo Jul 11, 2025
2aee9e3
typo
smjleo Jul 11, 2025
be39df2
stray conflict marker
smjleo Jul 11, 2025
cea219f
address reviews
smjleo Jul 11, 2025
6823bbf
address comments
smjleo Jul 14, 2025
5f64071
revert this_is_ocamlj flag
smjleo Jul 14, 2025
5a39397
add lambda->flambda2 pass
smjleo Jul 11, 2025
fde1167
add jsir-related files
smjleo Jul 14, 2025
a7b0b90
ocamlformat
smjleo Jul 15, 2025
4c6c40b
bad rebase
smjleo Jul 15, 2025
d1f8bec
change stdlib name
smjleo Jul 15, 2025
9b9c134
ignore variables
smjleo Jul 15, 2025
298e969
fix build issues
smjleo Jul 16, 2025
427f7b1
merge
smjleo Jul 16, 2025
201542a
merge
smjleo Jul 16, 2025
a2eaef3
bad merge: remove stdlib
smjleo Jul 16, 2025
5bd149e
Merge branch 'selee.jsir-translation-structure' of github.com:oxcaml/…
smjleo Jul 16, 2025
434848f
(wrongly) compile empty file
smjleo Jul 17, 2025
27d1735
renaming
smjleo Jul 17, 2025
2d31986
handle continuations more correctly
smjleo Jul 17, 2025
6851ea3
add comment
smjleo Jul 17, 2025
6a169cc
fix caml_register_global
smjleo Jul 18, 2025
df6d2c1
merge
smjleo Jul 18, 2025
ab837cc
output marshalled jsir file
smjleo Jul 18, 2025
bb7c1ae
improve magic number description
smjleo Jul 18, 2025
dfd6466
format
smjleo Jul 18, 2025
368b21a
add flag for dumping jsir
smjleo Jul 18, 2025
ed2cf5f
merge
smjleo Jul 18, 2025
7452b18
format
smjleo Jul 18, 2025
e3aad1f
merge
smjleo Jul 18, 2025
52c24e7
leave CR about metadata
smjleo Jul 18, 2025
d9c0db1
simplify imports
smjleo Jul 21, 2025
9d22835
remove qualifications
smjleo Jul 21, 2025
f748ea2
Merge branch 'selee.jsir-translation-stub' of github.com:oxcaml/oxcam…
smjleo Jul 21, 2025
fa93718
WIP closures
smjleo Jul 21, 2025
a8b7a3f
basic support for closures
smjleo Jul 22, 2025
76cba5c
process static lets twice
smjleo Jul 22, 2025
3cbaba0
janky apply
smjleo Jul 23, 2025
68feae3
fix fold order
smjleo Jul 23, 2025
d57ac09
Merge branch 'selee.jsir-translation-stub' of github.com:oxcaml/oxcam…
smjleo Jul 23, 2025
7e2a662
sweep up symbols before translating to support recursive closures
smjleo Jul 23, 2025
6ce67a6
Merge branch 'selee.jsir-dump-file' of github.com:oxcaml/oxcaml into …
smjleo Jul 23, 2025
37ef65e
remove CR
smjleo Jul 23, 2025
8961268
define continuations properly
smjleo Jul 23, 2025
eccc130
implement proper CPS for apply
smjleo Jul 23, 2025
02fbe92
pass highest var in .cmj file
smjleo Jul 24, 2025
55f6ea3
Merge branch 'selee.jsir-dump-file' of github.com:oxcaml/oxcaml into …
smjleo Jul 24, 2025
ae92409
Merge branch 'selee.jsir-closures' of github.com:oxcaml/oxcaml into s…
smjleo Jul 24, 2025
951d324
recursive continuations
smjleo Jul 24, 2025
6cf109a
refactor
smjleo Jul 24, 2025
f3d6d36
Merge branch 'selee.jsir-closures' of github.com:oxcaml/oxcaml into s…
smjleo Jul 24, 2025
d9ae707
Merge branch 'selee.jsir-apply' of github.com:oxcaml/oxcaml into sele…
smjleo Jul 24, 2025
40ac92a
typo
smjleo Jul 24, 2025
e574856
handle invariant params
smjleo Jul 24, 2025
8f70ea5
avoid using closures
smjleo Jul 24, 2025
1b69bbe
merge
smjleo Jul 24, 2025
6016653
fix build errors
smjleo Jul 24, 2025
a6c3b90
fix recursive continuations
smjleo Jul 24, 2025
8c6a601
cleanup
smjleo Jul 24, 2025
566a2d9
cleanup
smjleo Jul 24, 2025
8b40026
cleanup
smjleo Jul 24, 2025
a6a4880
merge
smjleo Jul 24, 2025
126f194
edit comment
smjleo Jul 24, 2025
39a5eae
Merge branch 'selee.jsir-apply' of github.com:oxcaml/oxcaml into sele…
smjleo Jul 24, 2025
f5d564b
implement switches
smjleo Jul 24, 2025
0403fa7
WIP primitives
smjleo Jul 25, 2025
c0192f9
get rid of negative arm cases
smjleo Jul 25, 2025
83e74c6
Merge branch 'selee.jsir-switch' of github.com:oxcaml/oxcaml into sel…
smjleo Jul 25, 2025
3113396
generate conds for special case
smjleo Jul 25, 2025
9d37182
Merge branch 'selee.jsir-switch' of github.com:oxcaml/oxcaml into sel…
smjleo Jul 25, 2025
73de70a
archived_blocks -> complete_blocks
smjleo Jul 25, 2025
aa8641d
Merge branch 'selee.jsir-translation-stub' of github.com:oxcaml/oxcam…
smjleo Jul 25, 2025
8822133
merge
smjleo Jul 25, 2025
9a94627
Merge branch 'selee.jsir-closures' of github.com:oxcaml/oxcaml into s…
smjleo Jul 25, 2025
278088e
merge
smjleo Jul 25, 2025
cf2c91f
merge
smjleo Jul 25, 2025
a7328a6
Merge branch 'selee.jsir-switch' of github.com:oxcaml/oxcaml into sel…
smjleo Jul 25, 2025
e953bd4
output a marshaled record instead
smjleo Jul 25, 2025
aff5e4c
call runtime function for invalid switch arms
smjleo Jul 25, 2025
744c01e
WIP primitives
smjleo Jul 25, 2025
1411d7b
0 is false not true
smjleo Jul 25, 2025
8a474fe
Merge branch 'selee.jsir-switch' of github.com:oxcaml/oxcaml into sel…
smjleo Jul 25, 2025
0060b7b
WIP
smjleo Jul 25, 2025
55eeed0
merge
smjleo Jul 25, 2025
ebca814
merge
smjleo Jul 25, 2025
c029688
WIP
smjleo Jul 28, 2025
fb8ddf3
address comments
smjleo Jul 28, 2025
0351a8b
Merge branch 'selee.jsir-from-flambda2' of github.com:oxcaml/oxcaml i…
smjleo Jul 28, 2025
72ea7d8
address review
smjleo Jul 28, 2025
fbd0387
fix
smjleo Jul 28, 2025
b47ec1f
change variable names
smjleo Jul 28, 2025
5fdf855
merge
smjleo Jul 28, 2025
be63444
no printing
smjleo Jul 28, 2025
35aa023
WIP
smjleo Jul 28, 2025
f0b6215
Merge branch 'selee.jsir-recursive-continuations' of github.com:oxcam…
smjleo Jul 28, 2025
3b1b7d7
Merge branch 'selee.jsir-apply' of github.com:oxcaml/oxcaml into sele…
smjleo Jul 28, 2025
fe4a043
Merge branch 'selee.jsir-recursive-continuations' of github.com:oxcam…
smjleo Jul 28, 2025
f2ab1c8
Merge branch 'selee.jsir-switch' of github.com:oxcaml/oxcaml into sel…
smjleo Jul 28, 2025
4133d2f
Merge branch 'selee.jsir-more-primitives' of github.com:oxcaml/oxcaml…
smjleo Jul 28, 2025
8ce334c
exceptions
smjleo Jul 29, 2025
0a3bd50
WIP untested
smjleo Jul 30, 2025
81962f7
works?
smjleo Jul 31, 2025
72e0fab
changes
smjleo Aug 1, 2025
3becd17
add CR
smjleo Aug 1, 2025
38b2e4f
change evaluation order
smjleo Aug 1, 2025
d7888e8
add parameter
smjleo Aug 1, 2025
554a885
merge
smjleo Aug 1, 2025
ab0efe4
edit comment
smjleo Aug 1, 2025
8fd23f7
WIP
smjleo Aug 1, 2025
01c5006
fix comment
smjleo Aug 4, 2025
43b4111
Merge branch 'selee.jsir-let-cont-eval-order' of github.com:oxcaml/ox…
smjleo Aug 4, 2025
ac40483
edit comment
smjleo Aug 4, 2025
600cea2
Merge branch 'selee.jsir-exceptions-extra-args' of github.com:oxcaml/…
smjleo Aug 4, 2025
f4f8a9c
Merge branch 'selee.jsir-exceptions-extra-args' of github.com:oxcaml/…
smjleo Aug 4, 2025
ae71cc8
add jsir flag in clflags
smjleo Aug 4, 2025
c72d8c1
add oclassic
smjleo Aug 4, 2025
d69967c
shuffle order
smjleo Aug 4, 2025
7b1b1b0
Merge branch 'selee.jsir-let-cont-eval-order' of github.com:oxcaml/ox…
smjleo Aug 4, 2025
dffb8b3
WIP
smjleo Aug 4, 2025
3d1aeed
use helper errors
smjleo Aug 4, 2025
041b76d
WIP
smjleo Aug 4, 2025
2f36f77
cleanup
smjleo Aug 4, 2025
3433137
WIP
smjleo Aug 4, 2025
c6e21c9
WIP
smjleo Aug 5, 2025
cc8f899
remove CR
smjleo Aug 5, 2025
697ea1b
some no-ops should be identities
smjleo Aug 5, 2025
1f30469
num_conv
smjleo Aug 5, 2025
ae8faec
fix
smjleo Aug 5, 2025
ab1fe8e
reorganise
smjleo Aug 5, 2025
2772c21
add missing primitives
smjleo Aug 6, 2025
905d1f0
add more static consts
smjleo Aug 6, 2025
c809526
handle block access kinds properly
smjleo Aug 6, 2025
1362254
Merge branch 'selee.jsir-even-more-primitives' of github.com:oxcaml/o…
smjleo Aug 6, 2025
037e2e8
add external module symbols
smjleo Aug 6, 2025
dff68b9
disallow variables in static consts
smjleo Aug 7, 2025
535b82f
error on variables in static const
smjleo Aug 7, 2025
363f648
Merge branch 'selee.jsir-static-consts' of github.com:oxcaml/oxcaml i…
smjleo Aug 7, 2025
e64ed2a
a hack
smjleo Aug 7, 2025
17d7c8e
address reviews
smjleo Aug 7, 2025
3450e2a
load symbols only as needed
smjleo Aug 8, 2025
e87ad65
WIP
smjleo Aug 8, 2025
7a5a6e3
merge
smjleo Aug 8, 2025
6fcf761
Merge branch 'selee.jsir-recursive-continuations' of github.com:oxcam…
smjleo Aug 8, 2025
87cf1a2
Merge branch 'selee.jsir-switch' of github.com:oxcaml/oxcaml into sel…
smjleo Aug 8, 2025
ac4b8b2
Merge branch 'selee.jsir-more-primitives' of github.com:oxcaml/oxcaml…
smjleo Aug 8, 2025
5dc36cc
Merge branch 'selee.jsir-exceptions' of github.com:oxcaml/oxcaml into…
smjleo Aug 8, 2025
a69a361
Merge branch 'selee.jsir-exceptions-extra-args' of github.com:oxcaml/…
smjleo Aug 8, 2025
ab50629
Merge branch 'selee.jsir-let-cont-eval-order' of github.com:oxcaml/ox…
smjleo Aug 8, 2025
e6ffc99
merge
smjleo Aug 8, 2025
2b1060d
revert prim changes
smjleo Aug 8, 2025
160a8ee
Merge branch 'selee.jsir-even-more-primitives' of github.com:oxcaml/o…
smjleo Aug 8, 2025
fd2be1d
merge
smjleo Aug 8, 2025
fb8a78e
handle my closures
smjleo Aug 8, 2025
8bfe5d2
get rid of debug outputs
smjleo Aug 8, 2025
9034aaf
fix
smjleo Aug 11, 2025
da8f4cf
clean up diff
smjleo Aug 11, 2025
e1581ed
add empty arrays
smjleo Aug 11, 2025
75a53d5
adjust branch
smjleo Aug 11, 2025
1b75631
fix
smjleo Aug 11, 2025
795e11b
merge
smjleo Aug 11, 2025
9f88488
add immutable value array
smjleo Aug 11, 2025
7ac6475
disable inlining
smjleo Aug 11, 2025
2a9d782
shift right fix
smjleo Aug 13, 2025
320584e
Merge branch 'selee.jsir-even-more-primitives' of github.com:oxcaml/o…
smjleo Aug 13, 2025
0a5fea8
undo flambda changes
smjleo Aug 13, 2025
fbb26cd
support non-constant static consts
smjleo Aug 13, 2025
f1dadb8
refactoring
smjleo Aug 13, 2025
bfd3afd
ocamlformat
smjleo Aug 13, 2025
c9c035e
disable inlining
smjleo Aug 11, 2025
9aeae03
add empty arrays
smjleo Aug 11, 2025
65ac14b
adjust branch
smjleo Aug 11, 2025
51e5289
fix
smjleo Aug 11, 2025
1ba8997
add immutable value array
smjleo Aug 11, 2025
5c8e473
fix bugs
smjleo Aug 11, 2025
9d2ada9
merge
smjleo Aug 13, 2025
eec9798
get rid of my_closure related things
smjleo Aug 13, 2025
976cb98
edit comment
smjleo Aug 13, 2025
c68dec4
typo
smjleo Aug 13, 2025
a68cf18
handle my closures by preemptively creating fresh closure variables
smjleo Aug 13, 2025
9c05427
merge
smjleo Aug 13, 2025
3227c32
we should register slots too
smjleo Aug 13, 2025
1486202
merge
smjleo Aug 13, 2025
d7b9453
Merge branch 'selee.jsir-my-closure' of github.com:oxcaml/oxcaml into…
smjleo Aug 13, 2025
5016840
symbols too
smjleo Aug 13, 2025
48b7e01
merge
smjleo Aug 13, 2025
4aaa0cc
Merge branch 'selee.jsir-code-id-scope' of github.com:oxcaml/oxcaml i…
smjleo Aug 13, 2025
749781e
merge
smjleo Aug 13, 2025
320ef33
fix
smjleo Aug 13, 2025
69dd09c
Merge branch 'selee.jsir-disable-inlining' of github.com:oxcaml/oxcam…
smjleo Aug 14, 2025
1f50bea
address reviews
smjleo Aug 14, 2025
90367df
address reviews
smjleo Aug 14, 2025
3588e19
that shouldn't be there
smjleo Aug 14, 2025
19ec7e8
oops
smjleo Aug 14, 2025
d61082b
revert back method disabling
smjleo Aug 14, 2025
375b99a
no need to check whether symbol exists
smjleo Aug 14, 2025
da0bb19
merge
smjleo Aug 14, 2025
7b36880
Merge branch 'selee.jsir-let-cont-eval-order' of github.com:oxcaml/ox…
smjleo Aug 14, 2025
1c5cf5e
Merge branch 'selee.jsir-o3' of github.com:oxcaml/oxcaml into selee.j…
smjleo Aug 14, 2025
9893907
Merge branch 'selee.jsir-even-more-primitives' of github.com:oxcaml/o…
smjleo Aug 14, 2025
e6ea592
Merge branch 'selee.jsir-static-consts' of github.com:oxcaml/oxcaml i…
smjleo Aug 14, 2025
78fd473
Merge branch 'selee.jsir-code-id-scope' of github.com:oxcaml/oxcaml i…
smjleo Aug 14, 2025
2a78cb6
merge
smjleo Aug 15, 2025
1c2c07d
Merge branch 'selee.jsir-from-flambda2' of github.com:oxcaml/oxcaml i…
smjleo Aug 15, 2025
3d6a565
Merge branch 'selee.jsir-even-more-primitives' of github.com:oxcaml/o…
smjleo Aug 15, 2025
171a7c0
Merge branch 'selee.jsir-static-consts' of github.com:oxcaml/oxcaml i…
smjleo Aug 15, 2025
f47a707
Merge branch 'selee.jsir-code-id-scope' of github.com:oxcaml/oxcaml i…
smjleo Aug 15, 2025
c31e65f
Merge branch 'selee.jsir-my-closure' of github.com:oxcaml/oxcaml into…
smjleo Aug 15, 2025
e8ea8a7
WIP
smjleo Aug 14, 2025
37b969b
WIP
smjleo Aug 14, 2025
da3b1a0
Merge branch 'selee.jsir-targetint-actually-32' of github.com:oxcaml/…
smjleo Aug 15, 2025
8acb80d
format
smjleo Aug 15, 2025
4e155f6
Merge branch 'selee.jsir-targetint-actually-32' of github.com:oxcaml/…
smjleo Aug 15, 2025
4586a7a
remove CR
smjleo Aug 15, 2025
59458aa
Merge branch 'selee.jsir-my-closure' of github.com:oxcaml/oxcaml into…
smjleo Aug 15, 2025
ff7a0df
Merge branch 'selee.jsir-targetint-actually-32' of github.com:oxcaml/…
smjleo Aug 15, 2025
6b430f2
properly add invalid primitive
smjleo Aug 15, 2025
d57ca7d
targetint -> targetint_32_64
smjleo Aug 15, 2025
18ef4b2
Merge branch 'selee.jsir-targetint-actually-32' of github.com:oxcaml/…
smjleo Aug 15, 2025
458dc5c
merge
smjleo Aug 18, 2025
3346fde
optional arguments fix
smjleo Aug 18, 2025
a2b2561
clean up diff
smjleo Aug 18, 2025
39d6425
better errors
smjleo Aug 18, 2025
bacc097
better comments
smjleo Aug 18, 2025
95fabcd
improve comment for primitive check
smjleo Aug 18, 2025
68dcaa7
WIP
smjleo Aug 18, 2025
58e90ba
WIP
smjleo Aug 19, 2025
0fbb221
licensing rearrangements
smjleo Aug 19, 2025
7b0f038
add git readme
smjleo Aug 19, 2025
486fb30
don't rename
smjleo Aug 19, 2025
e4c1c79
Merge branch 'selee.jsir-licensing' of github.com:oxcaml/oxcaml into …
smjleo Aug 19, 2025
52e569a
debuginfo wip
smjleo Aug 19, 2025
71bbb7b
format
smjleo Aug 19, 2025
2ae3780
WIP
smjleo Aug 21, 2025
aec5463
move things around
smjleo Aug 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion driver/dune
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
(modes byte native)
(ocamlopt_flags
(:include %{project_root}/ocamlopt_flags.sexp))
(libraries ocamloptcomp flambda2 gc_timings)
(libraries ocamloptcomp flambda2 gc_timings jsoo_imports)
(modules optcompile))
7 changes: 3 additions & 4 deletions driver/jscompile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ let raw_lambda_to_jsir i raw_lambda ~as_arg_for =
~reachable_names:flambda_result.reachable_names
flambda_result.flambda
|> print_if i.ppf_dump Clflags.dump_jsir (fun ppf jsir ->
Flambda2_to_jsir.Jsir.Print.program ppf (fun _ _ -> "") jsir)
Jsoo_imports.Code.Print.program ppf (fun _ _ -> "") jsir)
in
jsir, program.main_module_block_format, arg_descr)

Expand All @@ -83,10 +83,9 @@ let emit_jsir i jsir_program =
output_string oc Config.cmj_magic_number;
(* We include the highest used variable in the translation, so that Js_of_ocaml
can read this number and update its own state accordingly. *)
let cmj_body : Flambda2_to_jsir.Jsir.cmj_body =
let cmj_body : Jsoo_imports.Code.cmj_body =
{ program = jsir_program;
last_var =
Flambda2_to_jsir.Jsir.Var.idx (Flambda2_to_jsir.Jsir.Var.last ())
last_var = Jsoo_imports.Code.Var.idx (Jsoo_imports.Code.Var.last ())
}
in
output_value oc cmj_body)
Expand Down
2 changes: 1 addition & 1 deletion driver/jscompile.mli
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ val to_jsir :
Compile_common.info ->
Typedtree.implementation ->
as_arg_for:Global_module.Parameter_name.t option ->
Flambda2_to_jsir.Jsir.program
Jsoo_imports.Code.program
2 changes: 1 addition & 1 deletion lambda/matching.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3243,7 +3243,7 @@ let transl_match_on_option value_kind arg loc ~if_some ~if_none =
(* Keeping the Pisint test would make the bytecode
slightly worse, but it lets the native compiler generate
better code -- see #10681. *)
if !Clflags.native_code then
if !Clflags.native_code || Clflags.is_flambda2 () then
Lifthenelse(Lprim (Pisint { variant_only = true }, [ arg ], loc),
if_none, if_some, value_kind)
else
Expand Down
111 changes: 110 additions & 1 deletion middle_end/flambda2/numbers/targetint_31_63.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,100 @@
silently truncates the input int to make it fit, whereas we probably want to
make it produce an error ? *)

module type S = sig
type t

include Container_types.S with type t := t

val min_value : t

val max_value : t

val minus_one : t

val zero : t

val one : t

val ten : t

val hex_ff : t

val bool : bool -> t

val bool_true : t

val bool_false : t

val ( <= ) : t -> t -> bool

val ( >= ) : t -> t -> bool

val ( < ) : t -> t -> bool

val bottom_byte_to_int : t -> int

val of_char : char -> t

val of_int : int -> t

val of_int_option : int -> t option

val to_int : t -> int

val to_int_option : t -> int option

val to_int_exn : t -> int

val of_int32 : int32 -> t

val to_int32 : t -> int32

val of_int64 : int64 -> t

val to_int64 : t -> int64

val of_targetint : Targetint_32_64.t -> t

val to_targetint : t -> Targetint_32_64.t

val of_float : float -> t

val to_float : t -> float

val neg : t -> t

val get_least_significant_16_bits_then_byte_swap : t -> t

val add : t -> t -> t

val sub : t -> t -> t

val mul : t -> t -> t

val mod_ : t -> t -> t

val div : t -> t -> t

val and_ : t -> t -> t

val or_ : t -> t -> t

val xor : t -> t -> t

val shift_left : t -> int -> t

val shift_right : t -> int -> t

val shift_right_logical : t -> int -> t

val min : t -> t -> t

val max : t -> t -> t

val is_non_negative : t -> bool
end

module T0 = struct
include Targetint_32_64

Expand Down Expand Up @@ -98,7 +192,7 @@ module T0 = struct
let is_non_negative t = t >= zero
end

module Self = struct
module With_gc_bit = struct
include T0

(* Note: the [include T0] must be first so that the [One_bit_fewer] functions
Expand All @@ -107,6 +201,21 @@ module Self = struct
include Container_types.Make (T0)
end

module Without_gc_bit = struct
include T0
include Container_types.Make (T0)
end

(* CR selee: this is extremely sad, and should be replaced with a proper config
variable in the future *)
let has_gc_bit_in_int =
let compiler_name = Filename.basename Sys.argv.(0) in
match compiler_name with "ocamlj" | "ocamlj.opt" -> false | _ -> true

module Self = (val if has_gc_bit_in_int
then (module With_gc_bit)
else (module Without_gc_bit) : S)

include Self

let all_bools = Set.of_list [bool_true; bool_false]
Expand Down
11 changes: 6 additions & 5 deletions middle_end/flambda2/numbers/targetint_32_64.ml
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ module type S = sig
module Targetint_set = Set
end

(* CR selee: this is extremely sad *)
let size =
let compiler_name = Filename.basename Sys.argv.(0) in
match compiler_name with "ocamlj" | "ocamlj.opt" -> 32 | _ -> Sys.word_size

module Int32 = struct
include Int32

Expand Down Expand Up @@ -260,6 +255,12 @@ module Int64 = struct
external swap_byte_endianness : t -> t = "%bswap_int64"
end

(* CR selee: this is extremely sad, and should be replaced with a proper config
variable in the future *)
let size =
let compiler_name = Filename.basename Sys.argv.(0) in
match compiler_name with "ocamlj" | "ocamlj.opt" -> 32 | _ -> Sys.word_size

include (val match size with
| 32 -> (module Int32)
| 64 -> (module Int64)
Expand Down
1 change: 1 addition & 0 deletions middle_end/flambda2/to_jsir/dune
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
(libraries
ocamlcommon
ocamloptcomp
jsoo_imports
flambda2_bound_identifiers
flambda2_cmx
flambda2_identifiers
Expand Down
6 changes: 6 additions & 0 deletions middle_end/flambda2/to_jsir/jsoo_imports/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The files in this subdirectory (except import.ml) were imported from js_of_ocaml, with modifications:
https://github.com/ocsigen/js_of_ocaml

Originating from git revision:
246df644334aa97103d1051aec128337ea1868f9

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2010 Jérôme Vouillon
Expand All @@ -22,7 +20,7 @@

[@@@warning "-4-18-44"]

open! Jsoo_stdlib
open! Stdlib

let stats = Debug.find "stats"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2010 Jérôme Vouillon
Expand All @@ -19,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
open! Jsoo_stdlib
open! Stdlib

module Addr : sig
type t = int
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
*
Expand All @@ -18,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open! Jsoo_stdlib
open! Stdlib

let series = ref None

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
*
Expand Down
12 changes: 12 additions & 0 deletions middle_end/flambda2/to_jsir/jsoo_imports/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(include_subdirs no)

(library
(name jsoo_imports)
(wrapped true)
(instrumentation (backend bisect_ppx))
(flags
(:standard))
(ocamlopt_flags
(:standard -O3))
(libraries
ocamlcommon))
30 changes: 30 additions & 0 deletions middle_end/flambda2/to_jsir/jsoo_imports/import.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(******************************************************************************
* OxCaml *
* Leo Lee, Jane Street *
* -------------------------------------------------------------------------- *
* MIT License *
* *
* Copyright (c) 2025 Jane Street Group LLC *
* opensource-contacts@janestreet.com *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
* DEALINGS IN THE SOFTWARE. *
******************************************************************************)

module Jsir = Code
module Parse_info = Parse_info
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2013 Hugo Heuzard
Expand All @@ -20,7 +18,7 @@
*)
[@@@warning "-18"]

open! Jsoo_stdlib
open! Stdlib

type t =
{ src : string option;
Expand Down Expand Up @@ -68,3 +66,12 @@ let to_string { name; src; line; col; _ } =
| None, None -> assert false
in
Format.sprintf "%s:%d:%d" file line col

let t_of_debuginfo dbg ~pos =
if Debuginfo.is_none dbg
then None
else
let loc = Debuginfo.to_location dbg in
match pos with
| `Start -> Some (t_of_pos loc.loc_start)
| `End -> Some (t_of_pos loc.loc_end)
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2013 Hugo Heuzard
Expand Down Expand Up @@ -38,3 +36,5 @@ val start_position : t -> Lexing.position
val t_of_position : src:string option -> Lexing.position -> t

val to_string : t -> string

val t_of_debuginfo : Debuginfo.t -> pos:[`Start | `End] -> t option
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2013 Hugo Heuzard
Expand All @@ -19,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open! Jsoo_stdlib
open! Stdlib

let keyword =
List.fold_left
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
* Copyright (C) 2013 Hugo Heuzard
Expand All @@ -18,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
open Jsoo_stdlib
open Stdlib

val keyword : StringSet.t

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
(* CR selee: clarify licensing permissions *)

(* Js_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
*
Expand Down
Loading
Loading