chore: update stage0
This commit is contained in:
parent
d71aab5dc4
commit
1941081059
7 changed files with 2048 additions and 1552 deletions
19
stage0/src/Lean/Compiler/IR/Checker.lean
generated
19
stage0/src/Lean/Compiler/IR/Checker.lean
generated
|
|
@ -8,6 +8,18 @@ import Lean.Compiler.IR.Format
|
|||
|
||||
namespace Lean.IR.Checker
|
||||
|
||||
@[extern c inline "lean_box(LEAN_MAX_CTOR_FIELDS)"]
|
||||
constant getMaxCtorFields : Unit → Nat
|
||||
def maxCtorFields := getMaxCtorFields ()
|
||||
|
||||
@[extern c inline "lean_box(LEAN_MAX_CTOR_SCALARS_SIZE)"]
|
||||
constant getMaxCtorScalarsSize : Unit → Nat
|
||||
def maxCtorScalarsSize := getMaxCtorScalarsSize ()
|
||||
|
||||
@[extern c inline "lean_box(sizeof(size_t))"]
|
||||
constant getUSizeSize : Unit → Nat
|
||||
def usizeSize := getUSizeSize ()
|
||||
|
||||
structure CheckerContext where
|
||||
env : Environment
|
||||
localCtx : LocalContext := {}
|
||||
|
|
@ -97,7 +109,12 @@ def checkExpr (ty : IRType) : Expr → M Unit
|
|||
| Expr.pap f ys => checkPartialApp f ys *> checkObjType ty -- partial applications should always produce a closure object
|
||||
| Expr.ap x ys => checkObjVar x *> checkArgs ys
|
||||
| Expr.fap f ys => checkFullApp f ys
|
||||
| Expr.ctor c ys => when (!ty.isStruct && !ty.isUnion && c.isRef) (checkObjType ty) *> checkArgs ys
|
||||
| Expr.ctor c ys => do
|
||||
if c.size > maxCtorFields then
|
||||
throw s!"constructor '{c.name}' has too many fields"
|
||||
if c.ssize + c.usize * usizeSize > maxCtorScalarsSize then
|
||||
throw s!"constructor '{c.name}' has too many scalar fields"
|
||||
when (!ty.isStruct && !ty.isUnion && c.isRef) (checkObjType ty) *> checkArgs ys
|
||||
| Expr.reset _ x => checkObjVar x *> checkObjType ty
|
||||
| Expr.reuse x i u ys => checkObjVar x *> checkArgs ys *> checkObjType ty
|
||||
| Expr.box xty x => checkObjType ty *> checkScalarVar x *> checkVarType x (fun t => t == xty)
|
||||
|
|
|
|||
19
stage0/src/Lean/Compiler/IR/EmitC.lean
generated
19
stage0/src/Lean/Compiler/IR/EmitC.lean
generated
|
|
@ -16,6 +16,18 @@ import Lean.Compiler.IR.Boxing
|
|||
namespace Lean.IR.EmitC
|
||||
open ExplicitBoxing (requiresBoxedVersion mkBoxedName isBoxedName)
|
||||
|
||||
@[extern c inline "lean_box(LEAN_MAX_SMALL_OBJECT_SIZE)"]
|
||||
constant getMaxSmallObjectSize : Unit → Nat
|
||||
def maxSmallObjectSize := getMaxSmallObjectSize ()
|
||||
|
||||
@[extern c inline "lean_box(sizeof(lean_ctor_object))"]
|
||||
constant getCtorHeaderSize : Unit → Nat
|
||||
def ctorHeaderSize := getCtorHeaderSize ()
|
||||
|
||||
@[extern c inline "lean_box(sizeof(size_t))"]
|
||||
constant getUSizeSize : Unit → Nat
|
||||
def usizeSize := getUSizeSize ()
|
||||
|
||||
def leanMainFn := "_lean_main"
|
||||
|
||||
structure Context where
|
||||
|
|
@ -321,13 +333,18 @@ def emitArgs (ys : Array Arg) : M Unit :=
|
|||
if i > 0 then emit ", "
|
||||
emitArg ys[i]
|
||||
|
||||
private def isSmallCtor (c : CtorInfo) : Bool :=
|
||||
let total := ctorHeaderSize + c.size * usizeSize + c.usize * usizeSize + c.ssize
|
||||
total <= maxSmallObjectSize
|
||||
|
||||
def emitCtorScalarSize (usize : Nat) (ssize : Nat) : M Unit := do
|
||||
if usize == 0 then emit ssize
|
||||
else if ssize == 0 then emit "sizeof(size_t)*"; emit usize
|
||||
else emit "sizeof(size_t)*"; emit usize; emit " + "; emit ssize
|
||||
|
||||
def emitAllocCtor (c : CtorInfo) : M Unit := do
|
||||
emit "lean_alloc_ctor("; emit c.cidx; emit ", "; emit c.size; emit ", ";
|
||||
emit <| if isSmallCtor c then "lean_alloc_ctor" else "lean_alloc_ctor_big"
|
||||
emit "("; emit c.cidx; emit ", "; emit c.size; emit ", "
|
||||
emitCtorScalarSize c.usize c.ssize; emitLn ");"
|
||||
|
||||
def emitCtorSetArgs (z : VarId) (ys : Array Arg) : M Unit :=
|
||||
|
|
|
|||
13
stage0/src/include/lean/lean.h
generated
13
stage0/src/include/lean/lean.h
generated
|
|
@ -67,6 +67,9 @@ extern "C" {
|
|||
#define LeanExternal 254
|
||||
#define LeanReserved 255
|
||||
|
||||
#define LEAN_MAX_CTOR_FIELDS 256
|
||||
#define LEAN_MAX_CTOR_SCALARS_SIZE 1024
|
||||
|
||||
static inline bool lean_is_big_object_tag(uint8_t tag) {
|
||||
return tag == LeanArray || tag == LeanStructArray || tag == LeanScalarArray || tag == LeanString;
|
||||
}
|
||||
|
|
@ -689,12 +692,20 @@ static inline uint8_t * lean_ctor_scalar_cptr(lean_object * o) {
|
|||
}
|
||||
|
||||
static inline lean_object * lean_alloc_ctor(unsigned tag, unsigned num_objs, unsigned scalar_sz) {
|
||||
assert(tag <= LeanMaxCtorTag && num_objs < 256 && scalar_sz < 1024);
|
||||
assert(tag <= LeanMaxCtorTag && num_objs < LEAN_MAX_CTOR_FIELDS && scalar_sz < LEAN_MAX_CTOR_SCALARS_SIZE);
|
||||
lean_object * o = lean_alloc_ctor_memory(sizeof(lean_ctor_object) + sizeof(void*)*num_objs + scalar_sz);
|
||||
lean_set_st_header(o, tag, num_objs);
|
||||
return o;
|
||||
}
|
||||
|
||||
/* Similar to lean_alloc_ctor_big, but does not assume ctor is a small object */
|
||||
static inline lean_object * lean_alloc_ctor_big(unsigned tag, unsigned num_objs, unsigned scalar_sz) {
|
||||
assert(tag <= LeanMaxCtorTag && num_objs < LEAN_MAX_CTOR_FIELDS && scalar_sz < LEAN_MAX_CTOR_SCALARS_SIZE);
|
||||
lean_object * o = lean_alloc_object(sizeof(lean_ctor_object) + sizeof(void*)*num_objs + scalar_sz);
|
||||
lean_set_st_header(o, tag, num_objs);
|
||||
return o;
|
||||
}
|
||||
|
||||
static inline b_lean_obj_res lean_ctor_get(b_lean_obj_arg o, unsigned i) {
|
||||
assert(i < lean_ctor_num_objs(o));
|
||||
return lean_ctor_obj_cptr(o)[i];
|
||||
|
|
|
|||
1
stage0/src/include/lean/object.h
generated
1
stage0/src/include/lean/object.h
generated
|
|
@ -79,6 +79,7 @@ inline unsigned cnstr_num_objs(object * o) { return lean_ctor_num_objs(o); }
|
|||
inline object ** cnstr_obj_cptr(object * o) { return lean_ctor_obj_cptr(o); }
|
||||
inline uint8 * cnstr_scalar_cptr(object * o) { return lean_ctor_scalar_cptr(o); }
|
||||
inline obj_res alloc_cnstr(unsigned tag, unsigned num_objs, unsigned scalar_sz) { return lean_alloc_ctor(tag, num_objs, scalar_sz); }
|
||||
inline obj_res alloc_cnstr_big(unsigned tag, unsigned num_objs, unsigned scalar_sz) { return lean_alloc_ctor_big(tag, num_objs, scalar_sz); }
|
||||
inline unsigned cnstr_tag(b_obj_arg o) { lean_assert(is_cnstr(o)); return lean_ptr_tag(o); }
|
||||
inline void cnstr_set_tag(b_obj_arg o, unsigned tag) { lean_ctor_set_tag(o, tag); }
|
||||
inline b_obj_res cnstr_get(b_obj_arg o, unsigned i) { return lean_ctor_get(o, i); }
|
||||
|
|
|
|||
3
stage0/src/library/compiler/ir_interpreter.cpp
generated
3
stage0/src/library/compiler/ir_interpreter.cpp
generated
|
|
@ -385,7 +385,8 @@ private:
|
|||
// a constructor without data is optimized to a tagged pointer
|
||||
return box(tag);
|
||||
} else {
|
||||
object *o = alloc_cnstr(tag, size, usize * sizeof(void *) + ssize);
|
||||
// alloc_cnstr_big does not assume the constructors fits in a small object
|
||||
object *o = alloc_cnstr_big(tag, size, usize * sizeof(void *) + ssize);
|
||||
for (size_t i = 0; i < args.size(); i++) {
|
||||
cnstr_set(o, i, eval_arg(args[i]).m_obj);
|
||||
}
|
||||
|
|
|
|||
3234
stage0/stdlib/Lean/Compiler/IR/Checker.c
generated
3234
stage0/stdlib/Lean/Compiler/IR/Checker.c
generated
File diff suppressed because it is too large
Load diff
311
stage0/stdlib/Lean/Compiler/IR/EmitC.c
generated
311
stage0/stdlib/Lean/Compiler/IR/EmitC.c
generated
|
|
@ -80,6 +80,7 @@ lean_object* l_Nat_forM_loop___at_Lean_IR_EmitC_emitFnDeclAux___spec__2(lean_obj
|
|||
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__2;
|
||||
extern lean_object* l_Lean_Parser_Syntax_addPrec___closed__2;
|
||||
lean_object* lean_name_mk_string(lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitAllocCtor___closed__2;
|
||||
lean_object* l_Lean_IR_EmitC_emitCtor(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
uint8_t l_USize_decEq(size_t, size_t);
|
||||
lean_object* lean_array_uget(lean_object*, size_t);
|
||||
|
|
@ -100,6 +101,7 @@ lean_object* l_Lean_IR_EmitC_emitDeclInit_match__1(lean_object*);
|
|||
lean_object* l_Nat_forM_loop___at_Lean_IR_EmitC_emitArgs___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_collectUsedDecls(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitSSet___closed__6;
|
||||
lean_object* l_Lean_IR_EmitC_getCtorHeaderSize(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitInc___closed__5;
|
||||
lean_object* l_Lean_IR_EmitC_isTailCall_match__1(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitSProj___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
|
|
@ -137,6 +139,7 @@ lean_object* l_Lean_IR_EmitC_emitApp___closed__3;
|
|||
lean_object* lean_ir_emit_c(lean_object*, lean_object*);
|
||||
uint8_t l_Nat_anyAux___at_Lean_IR_EmitC_overwriteParam___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitApp___closed__5;
|
||||
lean_object* l_Lean_IR_EmitC_maxSmallObjectSize;
|
||||
lean_object* l_Lean_IR_EmitC_emitLhs___boxed(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
extern lean_object* l_String_quote___closed__2;
|
||||
|
|
@ -282,6 +285,7 @@ lean_object* l_Lean_IR_EmitC_emitJmp(lean_object*, lean_object*, lean_object*, l
|
|||
lean_object* l_List_map___at_Lean_IR_EmitC_toStringArgs___spec__1(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__1___closed__6;
|
||||
lean_object* l_Lean_IR_EmitC_emitDeclAux___lambda__3___closed__1;
|
||||
lean_object* l_Lean_IR_EmitC_getUSizeSize___boxed(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFnIfNeeded(lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__13;
|
||||
lean_object* l_Lean_IR_EmitC_hasMainFn(lean_object*, lean_object*);
|
||||
|
|
@ -327,9 +331,11 @@ lean_object* l_Lean_IR_EmitC_emitDeclInit(lean_object*, lean_object*, lean_objec
|
|||
lean_object* l_Lean_IR_EmitC_emitIf___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__2___closed__12;
|
||||
lean_object* l_Lean_IR_EmitC_usizeSize;
|
||||
lean_object* l_Lean_IR_EmitC_emitIf___closed__1;
|
||||
lean_object* l_Lean_IR_EmitC_toCName___boxed(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitDeclAux___lambda__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l___private_Lean_Compiler_IR_EmitC_0__Lean_IR_EmitC_isSmallCtor___boxed(lean_object*);
|
||||
lean_object* lean_array_to_list(lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitFnDeclAux___lambda__1___boxed(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__2;
|
||||
|
|
@ -340,6 +346,7 @@ lean_object* l_Lean_IR_EmitC_toCType___closed__1;
|
|||
lean_object* l_Lean_IR_EmitC_emitInc(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_leanMainFn;
|
||||
lean_object* l_Lean_IR_EmitC_emitNumLit___closed__4;
|
||||
lean_object* l_Lean_IR_EmitC_getMaxSmallObjectSize(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitDecl___closed__1;
|
||||
lean_object* l_Lean_IR_EmitC_emitSSet_match__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_emitC_match__1(lean_object*);
|
||||
|
|
@ -369,6 +376,7 @@ lean_object* l_Lean_IR_EmitC_toCType___closed__4;
|
|||
lean_object* l_Std_RBTree_toList___at_Lean_IR_EmitC_emitFnDecls___spec__3(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitProj___closed__1;
|
||||
lean_object* l_Lean_IR_EmitC_emitIsShared___closed__1;
|
||||
uint8_t l___private_Lean_Compiler_IR_EmitC_0__Lean_IR_EmitC_isSmallCtor(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitCase_match__1___rarg(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__1___closed__5;
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__2___closed__1;
|
||||
|
|
@ -377,12 +385,15 @@ lean_object* l_Lean_IR_EmitC_emitVDecl___boxed(lean_object*, lean_object*, lean_
|
|||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__2___closed__17;
|
||||
lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitC_emitFileHeader___spec__1(lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_isTailCall_match__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_usizeSize___closed__1;
|
||||
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__14;
|
||||
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__7;
|
||||
lean_object* l_Lean_IR_EmitC_ctorHeaderSize;
|
||||
lean_object* l_Lean_IR_EmitC_toCInitName_match__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitUProj___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_List_foldr___at_Lean_IR_EmitC_hasMainFn___spec__1___boxed(lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitCInitName___boxed(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_getUSizeSize(lean_object*);
|
||||
size_t lean_usize_of_nat(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitReuse___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
extern lean_object* l_Lean_NameSet_empty;
|
||||
|
|
@ -413,11 +424,13 @@ lean_object* l_Lean_IR_EmitC_declareParams(lean_object*, lean_object*, lean_obje
|
|||
lean_object* l_List_foldl___at_Lean_IR_EmitC_emitFnDecls___spec__2(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitC_emitInitFn___spec__3___closed__1;
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__2___closed__2;
|
||||
lean_object* l_Lean_IR_EmitC_getMaxSmallObjectSize___boxed(lean_object*);
|
||||
lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitC_emitInitFn___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitReset___closed__2;
|
||||
lean_object* l_Lean_IR_EmitC_emitMainFn___lambda__1___closed__3;
|
||||
lean_object* l_Lean_IR_EmitC_emitAllocCtor(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitLn___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_ctorHeaderSize___closed__1;
|
||||
lean_object* l_Lean_IR_EmitC_toCName_match__1(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_quoteString___lambda__1___boxed(lean_object*, lean_object*);
|
||||
uint8_t l_UInt32_decEq(uint32_t, uint32_t);
|
||||
|
|
@ -450,6 +463,7 @@ lean_object* lean_mk_module_initialization_function_name(lean_object*);
|
|||
lean_object* l_Lean_IR_EmitC_toCType___closed__11;
|
||||
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__3;
|
||||
lean_object* l_Lean_IR_EmitC_emitReuse(lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_getCtorHeaderSize___boxed(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitLns(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_paramEqArg___boxed(lean_object*, lean_object*);
|
||||
uint8_t lean_nat_dec_le(lean_object*, lean_object*);
|
||||
|
|
@ -495,6 +509,7 @@ lean_object* l_Lean_IR_EmitC_emitNumLit___closed__1;
|
|||
lean_object* l_Lean_IR_EmitC_emitSSet___closed__5;
|
||||
lean_object* l_Lean_IR_EmitC_emitTailCall_match__1(lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitApp(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* lean_nat_mul(lean_object*, lean_object*);
|
||||
lean_object* l_Nat_forM_loop___at_Lean_IR_EmitC_emitArgs___spec__1___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Nat_foldM_loop___at_Lean_IR_EmitC_emitSimpleExternalCall___spec__1___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Nat_foldM_loop___at_Lean_IR_EmitC_emitSimpleExternalCall___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*);
|
||||
|
|
@ -590,6 +605,7 @@ lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitC_emitInitFn___spec__3(l
|
|||
lean_object* l_Lean_IR_EmitC_emitSSet___closed__4;
|
||||
lean_object* l_Nat_forM_loop___at_Lean_IR_EmitC_emitTailCall___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__2;
|
||||
lean_object* l_Lean_IR_EmitC_maxSmallObjectSize___closed__1;
|
||||
extern lean_object* l_Lean_Parser_Syntax_addPrec___closed__11;
|
||||
lean_object* l_List_forM___at_Lean_IR_EmitC_emitMainFn___spec__3(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_emitLn(lean_object*);
|
||||
|
|
@ -654,6 +670,81 @@ lean_object* l_Lean_IR_EmitC_emitCtorSetArgs___boxed(lean_object*, lean_object*,
|
|||
lean_object* l_Nat_forM_loop___at_Lean_IR_EmitC_emitDeclAux___spec__3(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_getDecl(lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitC_declareParams___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
|
||||
lean_object* l_Lean_IR_EmitC_getMaxSmallObjectSize___boxed(lean_object* x_1) {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_2;
|
||||
x_2 = lean_box(LEAN_MAX_SMALL_OBJECT_SIZE);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_maxSmallObjectSize___closed__1() {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_1; lean_object* x_2;
|
||||
x_1 = lean_box(0);
|
||||
x_2 = lean_box(LEAN_MAX_SMALL_OBJECT_SIZE);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_maxSmallObjectSize() {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_1;
|
||||
x_1 = l_Lean_IR_EmitC_maxSmallObjectSize___closed__1;
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
lean_object* l_Lean_IR_EmitC_getCtorHeaderSize___boxed(lean_object* x_1) {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_2;
|
||||
x_2 = lean_box(sizeof(lean_ctor_object));
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_ctorHeaderSize___closed__1() {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_1; lean_object* x_2;
|
||||
x_1 = lean_box(0);
|
||||
x_2 = lean_box(sizeof(lean_ctor_object));
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_ctorHeaderSize() {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_1;
|
||||
x_1 = l_Lean_IR_EmitC_ctorHeaderSize___closed__1;
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
lean_object* l_Lean_IR_EmitC_getUSizeSize___boxed(lean_object* x_1) {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_2;
|
||||
x_2 = lean_box(sizeof(size_t));
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_usizeSize___closed__1() {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_1; lean_object* x_2;
|
||||
x_1 = lean_box(0);
|
||||
x_2 = lean_box(sizeof(size_t));
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_usizeSize() {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_1;
|
||||
x_1 = l_Lean_IR_EmitC_usizeSize___closed__1;
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_leanMainFn___closed__1() {
|
||||
_start:
|
||||
{
|
||||
|
|
@ -1372,7 +1463,7 @@ _start:
|
|||
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
|
||||
x_1 = l_Lean_IR_EmitC_toCType___closed__8;
|
||||
x_2 = l_Lean_IR_EmitC_toCType___closed__9;
|
||||
x_3 = lean_unsigned_to_nat(65u);
|
||||
x_3 = lean_unsigned_to_nat(77u);
|
||||
x_4 = lean_unsigned_to_nat(25u);
|
||||
x_5 = l_Lean_IR_EmitC_toCType___closed__10;
|
||||
x_6 = l___private_Init_Util_0__mkPanicMessageWithDecl(x_1, x_2, x_3, x_4, x_5);
|
||||
|
|
@ -1385,7 +1476,7 @@ _start:
|
|||
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
|
||||
x_1 = l_Lean_IR_EmitC_toCType___closed__8;
|
||||
x_2 = l_Lean_IR_EmitC_toCType___closed__9;
|
||||
x_3 = lean_unsigned_to_nat(66u);
|
||||
x_3 = lean_unsigned_to_nat(78u);
|
||||
x_4 = lean_unsigned_to_nat(25u);
|
||||
x_5 = l_Lean_IR_EmitC_toCType___closed__10;
|
||||
x_6 = l___private_Init_Util_0__mkPanicMessageWithDecl(x_1, x_2, x_3, x_4, x_5);
|
||||
|
|
@ -6500,6 +6591,40 @@ lean_dec(x_1);
|
|||
return x_4;
|
||||
}
|
||||
}
|
||||
uint8_t l___private_Lean_Compiler_IR_EmitC_0__Lean_IR_EmitC_isSmallCtor(lean_object* x_1) {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; uint8_t x_13;
|
||||
x_2 = lean_ctor_get(x_1, 2);
|
||||
x_3 = l_Lean_IR_EmitC_usizeSize;
|
||||
x_4 = lean_nat_mul(x_2, x_3);
|
||||
x_5 = l_Lean_IR_EmitC_ctorHeaderSize;
|
||||
x_6 = lean_nat_add(x_5, x_4);
|
||||
lean_dec(x_4);
|
||||
x_7 = lean_ctor_get(x_1, 3);
|
||||
x_8 = lean_nat_mul(x_7, x_3);
|
||||
x_9 = lean_nat_add(x_6, x_8);
|
||||
lean_dec(x_8);
|
||||
lean_dec(x_6);
|
||||
x_10 = lean_ctor_get(x_1, 4);
|
||||
x_11 = lean_nat_add(x_9, x_10);
|
||||
lean_dec(x_9);
|
||||
x_12 = l_Lean_IR_EmitC_maxSmallObjectSize;
|
||||
x_13 = lean_nat_dec_le(x_11, x_12);
|
||||
lean_dec(x_11);
|
||||
return x_13;
|
||||
}
|
||||
}
|
||||
lean_object* l___private_Lean_Compiler_IR_EmitC_0__Lean_IR_EmitC_isSmallCtor___boxed(lean_object* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8_t x_2; lean_object* x_3;
|
||||
x_2 = l___private_Lean_Compiler_IR_EmitC_0__Lean_IR_EmitC_isSmallCtor(x_1);
|
||||
lean_dec(x_1);
|
||||
x_3 = lean_box(x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_emitCtorScalarSize___closed__1() {
|
||||
_start:
|
||||
{
|
||||
|
|
@ -6581,66 +6706,134 @@ static lean_object* _init_l_Lean_IR_EmitC_emitAllocCtor___closed__1() {
|
|||
_start:
|
||||
{
|
||||
lean_object* x_1;
|
||||
x_1 = lean_mk_string("lean_alloc_ctor(");
|
||||
x_1 = lean_mk_string("lean_alloc_ctor_big");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
static lean_object* _init_l_Lean_IR_EmitC_emitAllocCtor___closed__2() {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_1;
|
||||
x_1 = lean_mk_string("lean_alloc_ctor");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
lean_object* l_Lean_IR_EmitC_emitAllocCtor(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
|
||||
_start:
|
||||
{
|
||||
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18;
|
||||
x_4 = l_Lean_IR_EmitC_emitAllocCtor___closed__1;
|
||||
x_5 = lean_string_append(x_3, x_4);
|
||||
x_6 = lean_ctor_get(x_1, 1);
|
||||
lean_inc(x_6);
|
||||
x_7 = l_Nat_repr(x_6);
|
||||
x_8 = lean_string_append(x_5, x_7);
|
||||
lean_dec(x_7);
|
||||
x_9 = l_term_x5b___x5d___closed__5;
|
||||
x_10 = lean_string_append(x_8, x_9);
|
||||
x_11 = lean_ctor_get(x_1, 2);
|
||||
lean_inc(x_11);
|
||||
x_12 = l_Nat_repr(x_11);
|
||||
x_13 = lean_string_append(x_10, x_12);
|
||||
lean_dec(x_12);
|
||||
x_14 = lean_string_append(x_13, x_9);
|
||||
x_15 = lean_ctor_get(x_1, 3);
|
||||
lean_inc(x_15);
|
||||
x_16 = lean_ctor_get(x_1, 4);
|
||||
lean_inc(x_16);
|
||||
lean_dec(x_1);
|
||||
x_17 = l_Lean_IR_EmitC_emitCtorScalarSize(x_15, x_16, x_2, x_14);
|
||||
x_18 = !lean_is_exclusive(x_17);
|
||||
if (x_18 == 0)
|
||||
uint8_t x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
|
||||
x_4 = l___private_Lean_Compiler_IR_EmitC_0__Lean_IR_EmitC_isSmallCtor(x_1);
|
||||
x_5 = lean_ctor_get(x_1, 1);
|
||||
lean_inc(x_5);
|
||||
x_6 = l_Nat_repr(x_5);
|
||||
x_7 = lean_ctor_get(x_1, 2);
|
||||
lean_inc(x_7);
|
||||
x_8 = l_Nat_repr(x_7);
|
||||
if (x_4 == 0)
|
||||
{
|
||||
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
|
||||
x_19 = lean_ctor_get(x_17, 1);
|
||||
x_20 = lean_ctor_get(x_17, 0);
|
||||
lean_dec(x_20);
|
||||
x_21 = l_Lean_IR_EmitC_emitInc___lambda__1___closed__1;
|
||||
x_22 = lean_string_append(x_19, x_21);
|
||||
x_23 = l___private_Init_Data_Format_Basic_0__Std_Format_pushNewline___closed__1;
|
||||
x_24 = lean_string_append(x_22, x_23);
|
||||
x_25 = lean_box(0);
|
||||
lean_ctor_set(x_17, 1, x_24);
|
||||
lean_ctor_set(x_17, 0, x_25);
|
||||
return x_17;
|
||||
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; uint8_t x_21;
|
||||
x_9 = lean_ctor_get(x_1, 3);
|
||||
lean_inc(x_9);
|
||||
x_10 = lean_ctor_get(x_1, 4);
|
||||
lean_inc(x_10);
|
||||
lean_dec(x_1);
|
||||
x_11 = l_Lean_IR_EmitC_emitAllocCtor___closed__1;
|
||||
x_12 = lean_string_append(x_3, x_11);
|
||||
x_13 = l_prec_x28___x29___closed__3;
|
||||
x_14 = lean_string_append(x_12, x_13);
|
||||
x_15 = lean_string_append(x_14, x_6);
|
||||
lean_dec(x_6);
|
||||
x_16 = l_term_x5b___x5d___closed__5;
|
||||
x_17 = lean_string_append(x_15, x_16);
|
||||
x_18 = lean_string_append(x_17, x_8);
|
||||
lean_dec(x_8);
|
||||
x_19 = lean_string_append(x_18, x_16);
|
||||
x_20 = l_Lean_IR_EmitC_emitCtorScalarSize(x_9, x_10, x_2, x_19);
|
||||
x_21 = !lean_is_exclusive(x_20);
|
||||
if (x_21 == 0)
|
||||
{
|
||||
lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28;
|
||||
x_22 = lean_ctor_get(x_20, 1);
|
||||
x_23 = lean_ctor_get(x_20, 0);
|
||||
lean_dec(x_23);
|
||||
x_24 = l_Lean_IR_EmitC_emitInc___lambda__1___closed__1;
|
||||
x_25 = lean_string_append(x_22, x_24);
|
||||
x_26 = l___private_Init_Data_Format_Basic_0__Std_Format_pushNewline___closed__1;
|
||||
x_27 = lean_string_append(x_25, x_26);
|
||||
x_28 = lean_box(0);
|
||||
lean_ctor_set(x_20, 1, x_27);
|
||||
lean_ctor_set(x_20, 0, x_28);
|
||||
return x_20;
|
||||
}
|
||||
else
|
||||
{
|
||||
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
|
||||
x_26 = lean_ctor_get(x_17, 1);
|
||||
lean_inc(x_26);
|
||||
lean_dec(x_17);
|
||||
x_27 = l_Lean_IR_EmitC_emitInc___lambda__1___closed__1;
|
||||
x_28 = lean_string_append(x_26, x_27);
|
||||
x_29 = l___private_Init_Data_Format_Basic_0__Std_Format_pushNewline___closed__1;
|
||||
x_30 = lean_string_append(x_28, x_29);
|
||||
x_31 = lean_box(0);
|
||||
x_32 = lean_alloc_ctor(0, 2, 0);
|
||||
lean_ctor_set(x_32, 0, x_31);
|
||||
lean_ctor_set(x_32, 1, x_30);
|
||||
return x_32;
|
||||
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
|
||||
x_29 = lean_ctor_get(x_20, 1);
|
||||
lean_inc(x_29);
|
||||
lean_dec(x_20);
|
||||
x_30 = l_Lean_IR_EmitC_emitInc___lambda__1___closed__1;
|
||||
x_31 = lean_string_append(x_29, x_30);
|
||||
x_32 = l___private_Init_Data_Format_Basic_0__Std_Format_pushNewline___closed__1;
|
||||
x_33 = lean_string_append(x_31, x_32);
|
||||
x_34 = lean_box(0);
|
||||
x_35 = lean_alloc_ctor(0, 2, 0);
|
||||
lean_ctor_set(x_35, 0, x_34);
|
||||
lean_ctor_set(x_35, 1, x_33);
|
||||
return x_35;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; uint8_t x_48;
|
||||
x_36 = lean_ctor_get(x_1, 3);
|
||||
lean_inc(x_36);
|
||||
x_37 = lean_ctor_get(x_1, 4);
|
||||
lean_inc(x_37);
|
||||
lean_dec(x_1);
|
||||
x_38 = l_Lean_IR_EmitC_emitAllocCtor___closed__2;
|
||||
x_39 = lean_string_append(x_3, x_38);
|
||||
x_40 = l_prec_x28___x29___closed__3;
|
||||
x_41 = lean_string_append(x_39, x_40);
|
||||
x_42 = lean_string_append(x_41, x_6);
|
||||
lean_dec(x_6);
|
||||
x_43 = l_term_x5b___x5d___closed__5;
|
||||
x_44 = lean_string_append(x_42, x_43);
|
||||
x_45 = lean_string_append(x_44, x_8);
|
||||
lean_dec(x_8);
|
||||
x_46 = lean_string_append(x_45, x_43);
|
||||
x_47 = l_Lean_IR_EmitC_emitCtorScalarSize(x_36, x_37, x_2, x_46);
|
||||
x_48 = !lean_is_exclusive(x_47);
|
||||
if (x_48 == 0)
|
||||
{
|
||||
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55;
|
||||
x_49 = lean_ctor_get(x_47, 1);
|
||||
x_50 = lean_ctor_get(x_47, 0);
|
||||
lean_dec(x_50);
|
||||
x_51 = l_Lean_IR_EmitC_emitInc___lambda__1___closed__1;
|
||||
x_52 = lean_string_append(x_49, x_51);
|
||||
x_53 = l___private_Init_Data_Format_Basic_0__Std_Format_pushNewline___closed__1;
|
||||
x_54 = lean_string_append(x_52, x_53);
|
||||
x_55 = lean_box(0);
|
||||
lean_ctor_set(x_47, 1, x_54);
|
||||
lean_ctor_set(x_47, 0, x_55);
|
||||
return x_47;
|
||||
}
|
||||
else
|
||||
{
|
||||
lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62;
|
||||
x_56 = lean_ctor_get(x_47, 1);
|
||||
lean_inc(x_56);
|
||||
lean_dec(x_47);
|
||||
x_57 = l_Lean_IR_EmitC_emitInc___lambda__1___closed__1;
|
||||
x_58 = lean_string_append(x_56, x_57);
|
||||
x_59 = l___private_Init_Data_Format_Basic_0__Std_Format_pushNewline___closed__1;
|
||||
x_60 = lean_string_append(x_58, x_59);
|
||||
x_61 = lean_box(0);
|
||||
x_62 = lean_alloc_ctor(0, 2, 0);
|
||||
lean_ctor_set(x_62, 0, x_61);
|
||||
lean_ctor_set(x_62, 1, x_60);
|
||||
return x_62;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15418,6 +15611,18 @@ lean_dec_ref(res);
|
|||
res = initialize_Lean_Compiler_IR_Boxing(lean_io_mk_world());
|
||||
if (lean_io_result_is_error(res)) return res;
|
||||
lean_dec_ref(res);
|
||||
l_Lean_IR_EmitC_maxSmallObjectSize___closed__1 = _init_l_Lean_IR_EmitC_maxSmallObjectSize___closed__1();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_maxSmallObjectSize___closed__1);
|
||||
l_Lean_IR_EmitC_maxSmallObjectSize = _init_l_Lean_IR_EmitC_maxSmallObjectSize();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_maxSmallObjectSize);
|
||||
l_Lean_IR_EmitC_ctorHeaderSize___closed__1 = _init_l_Lean_IR_EmitC_ctorHeaderSize___closed__1();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_ctorHeaderSize___closed__1);
|
||||
l_Lean_IR_EmitC_ctorHeaderSize = _init_l_Lean_IR_EmitC_ctorHeaderSize();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_ctorHeaderSize);
|
||||
l_Lean_IR_EmitC_usizeSize___closed__1 = _init_l_Lean_IR_EmitC_usizeSize___closed__1();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_usizeSize___closed__1);
|
||||
l_Lean_IR_EmitC_usizeSize = _init_l_Lean_IR_EmitC_usizeSize();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_usizeSize);
|
||||
l_Lean_IR_EmitC_leanMainFn___closed__1 = _init_l_Lean_IR_EmitC_leanMainFn___closed__1();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_leanMainFn___closed__1);
|
||||
l_Lean_IR_EmitC_leanMainFn = _init_l_Lean_IR_EmitC_leanMainFn();
|
||||
|
|
@ -15660,6 +15865,8 @@ l_Lean_IR_EmitC_emitCtorScalarSize___closed__1 = _init_l_Lean_IR_EmitC_emitCtorS
|
|||
lean_mark_persistent(l_Lean_IR_EmitC_emitCtorScalarSize___closed__1);
|
||||
l_Lean_IR_EmitC_emitAllocCtor___closed__1 = _init_l_Lean_IR_EmitC_emitAllocCtor___closed__1();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_emitAllocCtor___closed__1);
|
||||
l_Lean_IR_EmitC_emitAllocCtor___closed__2 = _init_l_Lean_IR_EmitC_emitAllocCtor___closed__2();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_emitAllocCtor___closed__2);
|
||||
l_Lean_IR_EmitC_emitCtor___closed__1 = _init_l_Lean_IR_EmitC_emitCtor___closed__1();
|
||||
lean_mark_persistent(l_Lean_IR_EmitC_emitCtor___closed__1);
|
||||
l_Nat_forM_loop___at_Lean_IR_EmitC_emitReset___spec__1___closed__1 = _init_l_Nat_forM_loop___at_Lean_IR_EmitC_emitReset___spec__1___closed__1();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue