From b04ea0d1fc191c4cd26f8ca89f6fd3fa7cd5938f Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Sat, 6 Jun 2015 15:14:06 -0400 Subject: [PATCH] Do not cache the type before we finish constructing it. --- src/jltypes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jltypes.c b/src/jltypes.c index 68577700700d1f..211ede15b9733f 100644 --- a/src/jltypes.c +++ b/src/jltypes.c @@ -2008,8 +2008,6 @@ static jl_value_t *inst_datatype(jl_datatype_t *dt, jl_svec_t *p, jl_value_t **i ndt->size = 0; ndt->alignment = 1; - if (cacheable) jl_cache_type_(ndt); - if (istuple) ndt->super = jl_any_type; else @@ -2047,6 +2045,10 @@ static jl_value_t *inst_datatype(jl_datatype_t *dt, jl_svec_t *p, jl_value_t **i ndt->ninitialized = ntp; else ndt->ninitialized = dt->ninitialized; + + if (cacheable) + jl_cache_type_(ndt); + JL_GC_POP(); return (jl_value_t*)ndt; }