123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657(************************************************************************)(* * The Coq Proof Assistant / The Coq 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_->true|_->falseletget_valuelc=matchlcwith|Lvalv->v|Linttag->Nativevalues.mk_inttag|Luinti->Nativevalues.mk_uinti|Lfloatf->Nativevalues.mk_floatf|_->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