Skip to content

Commit 9e8af64

Browse files
committed
next round of fixes
1 parent 66e6a66 commit 9e8af64

File tree

7 files changed

+37
-38
lines changed

7 files changed

+37
-38
lines changed

base/markdown/Julia/interp.jl

+1-4
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,8 @@ toexpr(x) = x
4141

4242
toexpr(xs::Vector{Any}) = Expr(:call, GlobalRef(Base,:vector_any), map(toexpr, xs)...)
4343

44-
function deftoexpr(T)
44+
for T in Any[MD, Paragraph, Header, Link, Bold, Italic]
4545
@eval function toexpr(md::$T)
4646
Expr(:call, typeof(md), $(map(x->:(toexpr(md.$x)), fieldnames(T))...))
4747
end
4848
end
49-
50-
map(deftoexpr, [MD, Paragraph, Header,
51-
Link, Bold, Italic])

base/reducedim.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ reducedim_initarray0{T}(A::AbstractArray, region, v0::T) = reducedim_initarray0(
9292
#
9393
# The current scheme is basically following Steven G. Johnson's original implementation
9494
#
95-
promote_union(T::Union) = promote_type(T.types...)
95+
promote_union(T::Union) = promote_type(promote_union(T.a), promote_union(T.b))
9696
promote_union(T) = T
9797

9898
function reducedim_init{S}(f, op::typeof(+), A::AbstractArray{S}, region)
@@ -129,7 +129,7 @@ reducedim_init(f, op::typeof(|), A::AbstractArray, region) = reducedim_initarray
129129
# specialize to make initialization more efficient for common cases
130130

131131
for (IT, RT) in ((CommonReduceResult, :(eltype(A))), (SmallSigned, :Int), (SmallUnsigned, :UInt))
132-
T = Union{[AbstractArray{t} for t in IT.types]..., [AbstractArray{Complex{t}} for t in IT.types]...}
132+
T = Union{[AbstractArray{t} for t in uniontypes(IT)]..., [AbstractArray{Complex{t}} for t in uniontypes(IT)]...}
133133
@eval begin
134134
reducedim_init(f::typeof(identity), op::typeof(+), A::$T, region) =
135135
reducedim_initarray(A, region, zero($RT))

src/builtins.c

+1
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,7 @@ void jl_init_primitives(void)
11761176
add_builtin("TypeVar", (jl_value_t*)jl_tvar_type);
11771177
add_builtin("UnionAll", (jl_value_t*)jl_unionall_type);
11781178
add_builtin("Union", (jl_value_t*)jl_uniontype_type);
1179+
add_builtin("BottomType", (jl_value_t*)jl_bottomtype_type);
11791180
add_builtin("Tuple", (jl_value_t*)jl_anytuple_type);
11801181
add_builtin("Vararg", (jl_value_t*)jl_vararg_type);
11811182
add_builtin("SimpleVector", (jl_value_t*)jl_simplevector_type);

src/dump.c

+19-19
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ typedef struct {
127127
} jl_serializer_state;
128128

129129
static jl_value_t *jl_idtable_type = NULL;
130-
static arraylist_t builtin_types;
130+
static arraylist_t builtin_typenames;
131131

132132
#define write_uint8(s, n) ios_putc((n), (s))
133133
#define read_uint8(s) ((uint8_t)ios_getc(s))
@@ -2062,9 +2062,9 @@ static void jl_save_system_image_to_stream(ios_t *f)
20622062
jl_prune_type_cache(jl_type_typename->cache);
20632063

20642064
intptr_t i;
2065-
for (i = 0; i < builtin_types.len; i++) {
2066-
jl_serialize_value(&s, ((jl_datatype_t*)builtin_types.items[i])->name->cache);
2067-
jl_serialize_value(&s, ((jl_datatype_t*)builtin_types.items[i])->name->linearcache);
2065+
for (i = 0; i < builtin_typenames.len; i++) {
2066+
jl_serialize_value(&s, ((jl_typename_t*)builtin_typenames.items[i])->cache);
2067+
jl_serialize_value(&s, ((jl_typename_t*)builtin_typenames.items[i])->linearcache);
20682068
}
20692069

20702070
// ensure everything in deser_tag is reassociated with its GlobalValue
@@ -2164,8 +2164,8 @@ static void jl_restore_system_image_from_stream(ios_t *f)
21642164
jl_module_type->name->mt = (jl_methtable_t*)jl_deserialize_value(&s, NULL);
21652165

21662166
intptr_t i;
2167-
for(i=0; i < builtin_types.len; i++) {
2168-
jl_typename_t *tn = ((jl_datatype_t*)builtin_types.items[i])->name;
2167+
for(i=0; i < builtin_typenames.len; i++) {
2168+
jl_typename_t *tn = (jl_typename_t*)builtin_typenames.items[i];
21692169
tn->cache = (jl_svec_t*)jl_deserialize_value(&s, NULL); jl_gc_wb(tn, tn->cache);
21702170
tn->linearcache = (jl_svec_t*)jl_deserialize_value(&s, NULL); jl_gc_wb(tn, tn->linearcache);
21712171
jl_resort_type_cache(tn->cache);
@@ -2654,7 +2654,7 @@ void jl_init_serializer(void)
26542654
jl_box_int32(33), jl_box_int32(34), jl_box_int32(35),
26552655
jl_box_int32(36), jl_box_int32(37), jl_box_int32(38),
26562656
jl_box_int32(39), jl_box_int32(40), jl_box_int32(41),
2657-
jl_box_int32(42), jl_box_int32(43),
2657+
jl_box_int32(42),
26582658
#endif
26592659
jl_box_int64(0), jl_box_int64(1), jl_box_int64(2),
26602660
jl_box_int64(3), jl_box_int64(4), jl_box_int64(5),
@@ -2671,7 +2671,7 @@ void jl_init_serializer(void)
26712671
jl_box_int64(33), jl_box_int64(34), jl_box_int64(35),
26722672
jl_box_int64(36), jl_box_int64(37), jl_box_int64(38),
26732673
jl_box_int64(39), jl_box_int64(40), jl_box_int64(41),
2674-
jl_box_int64(42), jl_box_int64(43),
2674+
jl_box_int64(42),
26752675
#endif
26762676
jl_labelnode_type, jl_linenumbernode_type, jl_gotonode_type,
26772677
jl_quotenode_type, jl_type_type, jl_bottom_type, jl_ref_type,
@@ -2683,7 +2683,7 @@ void jl_init_serializer(void)
26832683
jl_typemap_entry_type, jl_voidpointer_type, jl_newvarnode_type,
26842684
jl_array_symbol_type, jl_anytuple_type, jl_tparam0(jl_anytuple_type),
26852685
jl_typeof(jl_emptytuple), jl_array_uint8_type, jl_symbol_type->name,
2686-
jl_ssavalue_type->name, jl_tuple_typename,
2686+
jl_ssavalue_type->name, jl_tuple_typename, jl_bottomtype_type,
26872687
((jl_datatype_t*)jl_unwrap_unionall(jl_ref_type))->name,
26882688
jl_pointer_typename, jl_simplevector_type->name, jl_datatype_type->name,
26892689
jl_uniontype_type->name, jl_array_typename, jl_expr_type->name,
@@ -2696,7 +2696,7 @@ void jl_init_serializer(void)
26962696
jl_abstractslot_type->name, jl_slotnumber_type->name, jl_unionall_type->name,
26972697
jl_intrinsic_type->name, jl_task_type->name, jl_labelnode_type->name,
26982698
jl_linenumbernode_type->name, jl_builtin_type->name, jl_gotonode_type->name,
2699-
jl_quotenode_type->name, jl_globalref_type->name,
2699+
jl_quotenode_type->name, jl_globalref_type->name, jl_bottomtype_type->name,
27002700

27012701
ptls->root_task,
27022702

@@ -2731,15 +2731,15 @@ void jl_init_serializer(void)
27312731
}
27322732
assert(i <= 256);
27332733

2734-
arraylist_new(&builtin_types, 0);
2735-
arraylist_push(&builtin_types, jl_array_type);
2736-
arraylist_push(&builtin_types, jl_ref_type);
2737-
arraylist_push(&builtin_types, jl_pointer_type);
2738-
arraylist_push(&builtin_types, jl_type_type);
2739-
arraylist_push(&builtin_types, jl_abstractarray_type);
2740-
arraylist_push(&builtin_types, jl_densearray_type);
2741-
arraylist_push(&builtin_types, jl_tuple_type);
2742-
arraylist_push(&builtin_types, jl_vararg_type);
2734+
arraylist_new(&builtin_typenames, 0);
2735+
arraylist_push(&builtin_typenames, jl_array_typename);
2736+
arraylist_push(&builtin_typenames, ((jl_datatype_t*)jl_ref_type->body)->name);
2737+
arraylist_push(&builtin_typenames, jl_pointer_typename);
2738+
arraylist_push(&builtin_typenames, jl_type_typename);
2739+
arraylist_push(&builtin_typenames, ((jl_datatype_t*)jl_unwrap_unionall(jl_abstractarray_type))->name);
2740+
arraylist_push(&builtin_typenames, ((jl_datatype_t*)jl_unwrap_unionall(jl_densearray_type))->name);
2741+
arraylist_push(&builtin_typenames, jl_tuple_typename);
2742+
arraylist_push(&builtin_typenames, jl_vararg_typename);
27432743
}
27442744

27452745
#ifdef __cplusplus

src/gf.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,8 @@ static jl_lambda_info_t *cache_method(jl_methtable_t *mt, union jl_typemap_t *ca
672672
jl_svecset(limited, i, jl_wrap_vararg(lasttype, (jl_value_t*)NULL));
673673
}
674674
else {
675-
jl_value_t *lastdeclt = jl_tparam(decl, jl_nparams(decl) - 1);
675+
jl_value_t *unw = jl_unwrap_unionall(decl);
676+
jl_value_t *lastdeclt = jl_tparam(unw, jl_nparams(unw) - 1);
676677
int nsp = jl_svec_len(sparams);
677678
if (nsp > 0) {
678679
jl_svec_t *env = jl_alloc_svec_uninit(2 * nsp);
@@ -1765,15 +1766,14 @@ void jl_precompile(int all) {
17651766
jl_compile_specializations();
17661767
}
17671768

1768-
//
1769-
17701769
#ifdef JL_TRACE
17711770
static int trace_en = 0;
17721771
static int error_en = 1;
17731772
static void __attribute__ ((unused)) enable_trace(int x) { trace_en=x; }
17741773
static void show_call(jl_value_t *F, jl_value_t **args, uint32_t nargs)
17751774
{
1776-
jl_printf(JL_STDOUT, "%s(", jl_symbol_name(jl_gf_name(F)));
1775+
jl_static_show(JL_STDOUT, F);
1776+
jl_printf(JL_STDOUT, "(");
17771777
for(size_t i=0; i < nargs; i++) {
17781778
if (i > 0) jl_printf(JL_STDOUT, ", ");
17791779
jl_static_show(JL_STDOUT, jl_typeof(args[i]));
@@ -1926,7 +1926,7 @@ JL_DLLEXPORT jl_value_t *jl_apply_generic(jl_value_t **args, uint32_t nargs)
19261926
if (mfunc == NULL) {
19271927
#ifdef JL_TRACE
19281928
if (error_en)
1929-
show_call(F, args, nargs);
1929+
show_call(args[0], args, nargs);
19301930
#endif
19311931
jl_method_error((jl_function_t*)args[0], args, nargs);
19321932
// unreachable
@@ -1935,7 +1935,7 @@ JL_DLLEXPORT jl_value_t *jl_apply_generic(jl_value_t **args, uint32_t nargs)
19351935

19361936
#ifdef JL_TRACE
19371937
if (traceen)
1938-
jl_printf(JL_STDOUT, " at %s:%d\n", jl_symbol_name(mfunc->file), mfunc->line);
1938+
jl_printf(JL_STDOUT, " at %s:%d\n", jl_symbol_name(mfunc->def->file), mfunc->def->line);
19391939
#endif
19401940
jl_value_t *res = jl_call_method_internal(mfunc, args, nargs);
19411941
return verify_type(res);

src/jltypes.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2610,7 +2610,7 @@ static int jl_tuple_morespecific(jl_datatype_t *cdt, jl_datatype_t *pdt, int inv
26102610
if (ci >= clenf && !cseq)
26112611
return 1;
26122612
if (pi >= plenf && !pseq)
2613-
return some_morespecific;
2613+
return 0;
26142614
if (ci < clenr) {
26152615
ce = child[ci];
26162616
if (jl_is_vararg_type(ce)) ce = jl_unwrap_vararg(ce);
@@ -3359,7 +3359,7 @@ void jl_init_types(void)
33593359
jl_void_type->instance = jl_nothing;
33603360

33613361
jl_datatype_t *type_type = (jl_datatype_t*)jl_type_type;
3362-
jl_bottomtype_type = jl_new_datatype(jl_symbol("Bottom"), type_type, jl_emptysvec,
3362+
jl_bottomtype_type = jl_new_datatype(jl_symbol("BottomType"), type_type, jl_emptysvec,
33633363
jl_emptysvec, jl_emptysvec, 0, 0, 0);
33643364
jl_bottom_type = jl_new_struct(jl_bottomtype_type);
33653365
jl_bottomtype_type->instance = jl_bottom_type;

src/julia-syntax.scm

+6-5
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,13 @@
341341
,body ,isstaged)
342342
`(method ,name
343343
(block
344-
,@(map make-assignment temps (symbols->typevars names bounds))
344+
,@(map (lambda (l r) (make-assignment l (replace-vars r renames)))
345+
temps (symbols->typevars names bounds))
345346
(call (core svec) (curly Tuple
346-
,@(dots->vararg
347-
(map (lambda (ty)
348-
(replace-vars ty renames))
349-
types)))
347+
,@(dots->vararg
348+
(map (lambda (ty)
349+
(replace-vars ty renames))
350+
types)))
350351
(call (core svec) ,@temps)))
351352
,body ,isstaged))))
352353
(if (and iscall (not (null? argl)))

0 commit comments

Comments
 (0)