@@ -1714,6 +1714,42 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
1714
1714
return rt == (jl_value_t *)jl_nothing_type ? ghostValue (jl_nothing_type) :
1715
1715
mark_or_box_ccall_result (ctx, destp, retboxed, rt, unionall, static_rt);
1716
1716
}
1717
+ else if (is_libjulia_func (memset) && (rt == (jl_value_t *)jl_nothing_type || jl_is_cpointer_type (rt))) {
1718
+ const jl_cgval_t &dst = argv[0 ];
1719
+ const jl_cgval_t &val = argv[1 ];
1720
+ const jl_cgval_t &n = argv[2 ];
1721
+ Value *destp = emit_unbox (ctx, T_size, dst, (jl_value_t *)jl_voidpointer_type);
1722
+ Value *val32 = emit_unbox (ctx, T_int32, val, (jl_value_t *)jl_uint32_type);
1723
+ Value *val8 = ctx.builder .CreateTrunc (val32, T_int8, " memset_val" );
1724
+ ctx.builder .CreateMemSet (
1725
+ emit_inttoptr (ctx, destp, T_pint8),
1726
+ val8,
1727
+ emit_unbox (ctx, T_size, n, (jl_value_t *)jl_ulong_type),
1728
+ MaybeAlign (1 )
1729
+ );
1730
+ JL_GC_POP ();
1731
+ return rt == (jl_value_t *)jl_nothing_type ? ghostValue (jl_nothing_type) :
1732
+ mark_or_box_ccall_result (ctx, destp, retboxed, rt, unionall, static_rt);
1733
+ }
1734
+ else if (is_libjulia_func (memmove) && (rt == (jl_value_t *)jl_nothing_type || jl_is_cpointer_type (rt))) {
1735
+ const jl_cgval_t &dst = argv[0 ];
1736
+ const jl_cgval_t &src = argv[1 ];
1737
+ const jl_cgval_t &n = argv[2 ];
1738
+ Value *destp = emit_unbox (ctx, T_size, dst, (jl_value_t *)jl_voidpointer_type);
1739
+
1740
+ ctx.builder .CreateMemMove (
1741
+ emit_inttoptr (ctx, destp, T_pint8),
1742
+ MaybeAlign (0 ),
1743
+ emit_inttoptr (ctx,
1744
+ emit_unbox (ctx, T_size, src, (jl_value_t *)jl_voidpointer_type),
1745
+ T_pint8),
1746
+ MaybeAlign (0 ),
1747
+ emit_unbox (ctx, T_size, n, (jl_value_t *)jl_ulong_type),
1748
+ false );
1749
+ JL_GC_POP ();
1750
+ return rt == (jl_value_t *)jl_nothing_type ? ghostValue (jl_nothing_type) :
1751
+ mark_or_box_ccall_result (ctx, destp, retboxed, rt, unionall, static_rt);
1752
+ }
1717
1753
else if (is_libjulia_func (jl_object_id) && nccallargs == 1 &&
1718
1754
rt == (jl_value_t *)jl_ulong_type) {
1719
1755
jl_cgval_t val = argv[0 ];
0 commit comments