diff --git a/src/Makefile b/src/Makefile index 257152d24e63aa..20da34dd99d558 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,6 +21,9 @@ FLAGS := \ ifneq ($(USEMSVC), 1) FLAGS += -Wall -Wno-strict-aliasing -fno-omit-frame-pointer -fvisibility=hidden -fno-common \ -Wpointer-arith -Wundef +ifeq ($(USEGCC),1) # GCC bug #25509 (void)__attribute__((warn_unused_result)) +FLAGS += -Wno-unused-result +endif override CFLAGS += -Wold-style-definition -Wstrict-prototypes -Wc++-compat endif diff --git a/src/cgutils.cpp b/src/cgutils.cpp index 231655db1f4696..9a91f571d2df56 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -1632,32 +1632,6 @@ static bool arraytype_constshape(jl_value_t *ty) jl_is_long(jl_tparam1(ty)) && jl_unbox_long(jl_tparam1(ty)) != 1); } -static void maybe_alloc_arrayvar(jl_codectx_t &ctx, int s) -{ - jl_value_t *jt = ctx.slots[s].value.typ; - if (arraytype_constshape(jt)) { - // TODO: this optimization does not yet work with 1-d arrays, since the - // length and data pointer can change at any time via push! - // we could make it work by reloading the metadata when the array is - // passed to an external function (ideally only impure functions) - int ndims = jl_unbox_long(jl_tparam1(jt)); - jl_value_t *jelt = jl_tparam0(jt); - bool isboxed = !jl_array_store_unboxed(jelt); - Type *elt = julia_type_to_llvm(jelt); - if (type_is_ghost(elt)) - return; - if (isboxed) - elt = T_prjlvalue; - // CreateAlloca is OK here because maybe_alloc_arrayvar is only called in the prologue setup - jl_arrayvar_t &av = (*ctx.arrayvars)[s]; - av.dataptr = ctx.builder.CreateAlloca(PointerType::get(elt, 0)); - av.len = ctx.builder.CreateAlloca(T_size); - for (int i = 0; i < ndims - 1; i++) - av.sizes.push_back(ctx.builder.CreateAlloca(T_size)); - av.ty = jt; - } -} - static Value *emit_arraysize(jl_codectx_t &ctx, const jl_cgval_t &tinfo, Value *dim) { Value *t = boxed(ctx, tinfo); @@ -1669,20 +1643,6 @@ static Value *emit_arraysize(jl_codectx_t &ctx, const jl_cgval_t &tinfo, Value * tbaa, T_psize); } -static jl_arrayvar_t *arrayvar_for(jl_codectx_t &ctx, jl_value_t *ex) -{ - if (ex == NULL) - return NULL; - if (!jl_is_slot(ex)) - return NULL; - int sl = jl_slot_number(ex) - 1; - auto av = ctx.arrayvars->find(sl); - if (av != ctx.arrayvars->end()) - return &av->second; - //TODO: ssavalue case - return NULL; -} - static Value *emit_arraysize(jl_codectx_t &ctx, const jl_cgval_t &tinfo, int dim) { return emit_arraysize(ctx, tinfo, ConstantInt::get(T_int32, dim)); @@ -1721,9 +1681,6 @@ static Value *emit_arraylen_prim(jl_codectx_t &ctx, const jl_cgval_t &tinfo) static Value *emit_arraylen(jl_codectx_t &ctx, const jl_cgval_t &tinfo, jl_value_t *ex) { - jl_arrayvar_t *av = arrayvar_for(ctx, ex); - if (av != NULL) - return ctx.builder.CreateLoad(av->len); return emit_arraylen_prim(ctx, tinfo); } @@ -1747,17 +1704,11 @@ static Value *emit_arrayptr(jl_codectx_t &ctx, const jl_cgval_t &tinfo, bool isb static Value *emit_arrayptr(jl_codectx_t &ctx, const jl_cgval_t &tinfo, jl_value_t *ex, bool isboxed = false) { - jl_arrayvar_t *av = arrayvar_for(ctx, ex); - if (av!=NULL) - return ctx.builder.CreateLoad(av->dataptr); return emit_arrayptr(ctx, tinfo, isboxed); } static Value *emit_arraysize(jl_codectx_t &ctx, const jl_cgval_t &tinfo, jl_value_t *ex, int dim) { - jl_arrayvar_t *av = arrayvar_for(ctx, ex); - if (av != NULL && dim <= (int)av->sizes.size()) - return ctx.builder.CreateLoad(av->sizes[dim - 1]); return emit_arraysize(ctx, tinfo, dim); } @@ -1790,17 +1741,6 @@ static Value *emit_arrayelsize(jl_codectx_t &ctx, const jl_cgval_t &tinfo) return tbaa_decorate(tbaa_const, ctx.builder.CreateLoad(addr)); } -static void assign_arrayvar(jl_codectx_t &ctx, jl_arrayvar_t &av, const jl_cgval_t &ainfo) -{ - Value *aptr = emit_bitcast(ctx, - emit_arrayptr(ctx, ainfo), - av.dataptr->getType()->getContainedType(0)); - tbaa_decorate(tbaa_arrayptr, ctx.builder.CreateStore(aptr, av.dataptr)); - ctx.builder.CreateStore(emit_arraylen_prim(ctx, ainfo), av.len); - for (size_t i = 0; i < av.sizes.size(); i++) - ctx.builder.CreateStore(emit_arraysize(ctx, ainfo, i + 1), av.sizes[i]); -} - // Returns the size of the array represented by `tinfo` for the given dimension `dim` if // `dim` is a valid dimension, otherwise returns constant one. static Value *emit_arraysize_for_unsafe_dim(jl_codectx_t &ctx, diff --git a/src/codegen.cpp b/src/codegen.cpp index 496acdc8155861..af98933bc71ca7 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -494,14 +494,6 @@ struct jl_varinfo_t { } }; -// aggregate of array metadata -typedef struct { - Value *dataptr; - Value *len; - std::vector sizes; - jl_value_t *ty; -} jl_arrayvar_t; - struct jl_returninfo_t { Function *decl; enum CallingConv { @@ -530,7 +522,6 @@ class jl_codectx_t { std::vector SAvalues; std::vector> PhiNodes; std::vector ssavalue_assigned; - std::map *arrayvars = NULL; jl_module_t *module = NULL; jl_method_instance_t *linfo = NULL; jl_code_info_t *source = NULL; @@ -3637,15 +3628,6 @@ static void emit_varinfo_assign(jl_codectx_t &ctx, jl_varinfo_t &vi, jl_cgval_t if (rval_info.typ == jl_bottom_type) return; - // add info to arrayvar list - if (l && rval_info.isboxed) { - // check isboxed in case rval isn't the right type (for example, on a dead branch), - // so we don't try to assign it to the arrayvar info - jl_arrayvar_t *av = arrayvar_for(ctx, l); - if (av != NULL) - assign_arrayvar(ctx, *av, rval_info); - } - // compute / store tindex info if (vi.pTIndex) { Value *tindex; @@ -5269,9 +5251,7 @@ static std::unique_ptr emit_function( //jl_static_show(JL_STDOUT, (jl_value_t*)ast); //jl_printf(JL_STDOUT, "\n"); - std::map arrayvars; std::map labels; - ctx.arrayvars = &arrayvars; ctx.module = jl_is_method(lam->def.method) ? lam->def.method->module : lam->def.module; ctx.linfo = lam; ctx.source = src; @@ -5703,7 +5683,6 @@ static std::unique_ptr emit_function( continue; } allocate_local(varinfo, s); - maybe_alloc_arrayvar(ctx, i); } std::map upsilon_to_phic; @@ -5826,11 +5805,6 @@ static std::unique_ptr emit_function( Value *argp = boxed(ctx, theArg); ctx.builder.CreateStore(argp, vi.boxroot); } - // get arrayvar data if applicable - if (arrayvars.find(i) != arrayvars.end()) { - jl_arrayvar_t av = arrayvars[i]; - assign_arrayvar(ctx, av, theArg); - } } } diff --git a/src/dump.c b/src/dump.c index c9ae8a2159fed4..fe64c52701d133 100644 --- a/src/dump.c +++ b/src/dump.c @@ -1834,10 +1834,10 @@ static jl_value_t *jl_deserialize_typemap_entry(jl_serializer_state *s) jl_deserialize_struct(s, v, 1); #ifndef NDEBUG if (te->func.value && jl_typeis(te->func.value, jl_method_instance_type)) { - assert((te->func.linfo->max_world == 0 && + assert(((te->func.linfo->max_world == 0 && te->func.linfo->min_world == 1) || - (te->func.linfo->max_world >= te->max_world && - te->func.linfo->min_world <= te->min_world) && + (te->func.linfo->max_world >= te->max_world && + te->func.linfo->min_world <= te->min_world)) && "corrupt typemap entry structure"); } #endif diff --git a/src/intrinsics.cpp b/src/intrinsics.cpp index 0d423a9d6b428d..c7879992ae0754 100644 --- a/src/intrinsics.cpp +++ b/src/intrinsics.cpp @@ -1325,15 +1325,5 @@ static Function *boxfunc_llvm(FunctionType *ft, const std::string &cname, static FunctionType *ft1arg(Type *ret, Type *arg) { - std::vector args1(0); - args1.push_back(arg); - return FunctionType::get(ret, args1, false); -} - -static FunctionType *ft2arg(Type *ret, Type *arg1, Type *arg2) -{ - std::vector args2(0); - args2.push_back(arg1); - args2.push_back(arg2); - return FunctionType::get(ret, args2, false); + return FunctionType::get(ret, { arg }, false); } diff --git a/src/jloptions.c b/src/jloptions.c index d6a8356e79645b..7013973e57c081 100644 --- a/src/jloptions.c +++ b/src/jloptions.c @@ -31,12 +31,12 @@ jl_options_t jl_options = { 0, // quiet -1, // banner NULL, // julia_bindir NULL, // julia_bin - NULL, // project NULL, // cmds NULL, // image_file (will be filled in below) NULL, // cpu_target ("native", "core2", etc...) 0, // nprocs NULL, // machine_file + NULL, // project 0, // isinteractive 0, // color JL_OPTIONS_HISTORYFILE_ON, // history file