12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758(************************************************************************)(* * The Rocq Prover / The Rocq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)openUtilopenGenlambda(** This file defines the lambda code generation phase of the native compiler *)typelambda=Nativevalues.tGenlambda.lambda(*s Constructors *)(** Simplification of lambda expression *)letis_valuelc=matchlcwith|Lval_|Lint_|Luint_|Lfloat_|Lstring_->true|_->falseletget_valuelc=matchlcwith|Lvalv->v|Linttag->Nativevalues.mk_inttag|Luinti->Nativevalues.mk_uinti|Lfloatf->Nativevalues.mk_floatf|Lstrings->Nativevalues.mk_strings|_->raiseNot_foundletas_valuetagargs=ifArray.for_allis_valueargsthenletdummy_val=Obj.magic0inletargs=(* Don't simplify this to Array.map, cf. the related comment in
function eval_to_patch, file kernel/csymtable.ml *)leta=Array.make(Array.lengthargs)dummy_valinArray.iteri(funiv->a.(i)<-get_valuev)args;ainSome(Nativevalues.mk_blocktagargs)elseNonemoduleVal=structtypevalue=Nativevalues.tletas_value=as_valueletcheck_inductive__=()endmoduleLambda=Genlambda.Make(Val)letlambda_of_constrenvsigmac=letlam=Lambda.lambda_of_constrenvsigmacinoptimizelam