Module Flambda2_to_jsir.To_jsir_result
Result structure used during Flambda to Js_of_ocaml IR translation.
An accumulator for the JSIR blocks and instructions.
Values of type t store complete/archived blocks, as well as a stack of "current" blocks that is still being worked on.
val create : unit -> tCreate a new result structure. It is not initialised with any blocks.
Add a Jsir.instr to the top of the stack of current blocks and return the address of the new block. This function raises if there are no blocks being worked on.
val maybe_add_debuginfo_exn : t -> Debuginfo.t -> pos:[ `Start | `End ] -> tAdd debugging information as an Event if it is not _none_. Raises if there are no blocks being worked on. pos controls whether we log the start of the region or the end.
val with_debuginfo_exn : t -> Debuginfo.t -> f:(t -> 'a * t) -> 'a * tWrap any result changes between `Start and `End debuginfos. Raises if there are no blocks being worked on.
val new_block :
t ->
params:Jsoo_imports.Import.Jsir.Var.t list ->
t * Jsoo_imports.Import.Jsir.Addr.tPush a new block to the stack of current blocks.
Return a new address without actually creating a block corresponding to that address. This is used for recursive continuations, where we need to use the address of a continuation before actually translating the body. The caller should promise that they call new_block_with_addr with the returned address at some point before to_program_exn is called.
val new_block_with_addr_exn :
t ->
params:Jsoo_imports.Import.Jsir.Var.t list ->
addr:Jsoo_imports.Import.Jsir.Addr.t ->
tMake a new block, but using addr. Raises if addr is not a reserved address.
End the block at the top of the current stack, setting last to the given argument. This function raises if there are no blocks being worked on.
Returns the address for a special block for invalid switches, creating one if it doesn't exist already.
val get_public_method :
t ->
obj:Jsoo_imports.Import.Jsir.Var.t ->
field:Jsoo_imports.Import.Jsir.Var.t ->
t * Jsoo_imports.Import.Jsir.Var.tGet a public method and return the function. Increments the method cache ID.
val import_compilation_unit : t -> Compilation_unit.t -> tRegister the fact that we import the (toplevel module of the) given compilation unit from the JSOO global data table. This is used to inform Js_of_ocaml that it needs to add this compilation unit to the global data table.
type program = {program : Jsoo_imports.Import.Jsir.program;imported_compilation_units : Compilation_unit.Set.t;
}