diff --git a/src/ccall.cpp b/src/ccall.cpp index cb069b58c3761..24022ac19c3b5 100644 --- a/src/ccall.cpp +++ b/src/ccall.cpp @@ -1123,7 +1123,8 @@ std::string generate_func_sig(const char *fname) isboxed = false; } else { - if (jl_is_primitivetype(tti)) { + if (jl_is_primitivetype(tti) && + jl_integer_type && jl_subtype(tti, (jl_value_t*)jl_integer_type)) { // see pull req #978. need to annotate signext/zeroext for // small integer arguments. jl_datatype_t *bt = (jl_datatype_t*)tti; diff --git a/src/codegen.cpp b/src/codegen.cpp index 20f2dfe28165f..6187bf85c9da0 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -7149,7 +7149,8 @@ static jl_returninfo_t get_specsig_function(jl_codectx_t &ctx, Module *M, Value else if (isboxed && jl_is_immutable_datatype(jt)) { param.addAttribute(Attribute::ReadOnly); } - else if (jl_is_primitivetype(jt) && ty->isIntegerTy()) { + else if (jl_is_primitivetype(jt) && jl_integer_type && + jl_subtype(jt, (jl_value_t*)jl_integer_type)) { bool issigned = jl_signed_type && jl_subtype(jt, (jl_value_t*)jl_signed_type); Attribute::AttrKind attr = issigned ? Attribute::SExt : Attribute::ZExt; param.addAttribute(attr); diff --git a/src/jl_exported_data.inc b/src/jl_exported_data.inc index aa23b9d7b8205..3bb991ae82ecc 100644 --- a/src/jl_exported_data.inc +++ b/src/jl_exported_data.inc @@ -50,6 +50,7 @@ XX(jl_gotoifnot_type) \ XX(jl_gotonode_type) \ XX(jl_initerror_type) \ + XX(jl_integer_type) \ XX(jl_int16_type) \ XX(jl_int32_type) \ XX(jl_int64_type) \ diff --git a/src/jltypes.c b/src/jltypes.c index 33b52158488a3..8c005f5966d1d 100644 --- a/src/jltypes.c +++ b/src/jltypes.c @@ -3409,7 +3409,7 @@ void post_boot_hooks(void) jl_number_type = (jl_datatype_t*)core("Number"); jl_signed_type = (jl_datatype_t*)core("Signed"); jl_datatype_t *jl_unsigned_type = (jl_datatype_t*)core("Unsigned"); - jl_datatype_t *jl_integer_type = (jl_datatype_t*)core("Integer"); + jl_integer_type = (jl_datatype_t*)core("Integer"); jl_bool_type->super = jl_integer_type; jl_uint8_type->super = jl_unsigned_type; diff --git a/src/julia.h b/src/julia.h index a357bdf558360..842bc16068b76 100644 --- a/src/julia.h +++ b/src/julia.h @@ -853,6 +853,7 @@ extern JL_DLLIMPORT jl_datatype_t *jl_floatingpoint_type JL_GLOBALLY_ROOTED; extern JL_DLLIMPORT jl_datatype_t *jl_number_type JL_GLOBALLY_ROOTED; extern JL_DLLIMPORT jl_datatype_t *jl_void_type JL_GLOBALLY_ROOTED; // deprecated extern JL_DLLIMPORT jl_datatype_t *jl_nothing_type JL_GLOBALLY_ROOTED; +extern JL_DLLIMPORT jl_datatype_t *jl_integer_type JL_GLOBALLY_ROOTED; extern JL_DLLIMPORT jl_datatype_t *jl_signed_type JL_GLOBALLY_ROOTED; extern JL_DLLIMPORT jl_datatype_t *jl_voidpointer_type JL_GLOBALLY_ROOTED; extern JL_DLLIMPORT jl_datatype_t *jl_uint8pointer_type JL_GLOBALLY_ROOTED; diff --git a/src/staticdata.c b/src/staticdata.c index df5652a5719c4..4d1be4bd295e3 100644 --- a/src/staticdata.c +++ b/src/staticdata.c @@ -99,7 +99,7 @@ extern "C" { // TODO: put WeakRefs on the weak_refs list during deserialization // TODO: handle finalizers -#define NUM_TAGS 160 +#define NUM_TAGS 161 // An array of references that need to be restored from the sysimg // This is a manually constructed dual of the gvars array, which would be produced by codegen for Julia code, for C. @@ -197,6 +197,7 @@ jl_value_t **const*const get_tags(void) { INSERT_TAG(jl_bfloat16_type); INSERT_TAG(jl_floatingpoint_type); INSERT_TAG(jl_number_type); + INSERT_TAG(jl_integer_type); INSERT_TAG(jl_signed_type); INSERT_TAG(jl_pair_type);