Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memoize more type properties #16320

Merged
merged 4 commits into from
May 13, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix lowering of TypeVar in TypeConstructor typealias expression
have lowering emit the correct TypeVar expression instead of fixing it
in the TypeConstructor constructor
  • Loading branch information
vtjnash committed May 12, 2016
commit 98159c75b30e741fadd049808e84a06c2056b965
18 changes: 4 additions & 14 deletions src/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,25 +1017,15 @@ JL_DLLEXPORT jl_datatype_t *jl_new_bitstype(jl_value_t *name, jl_datatype_t *sup

JL_DLLEXPORT jl_value_t *jl_new_type_constructor(jl_svec_t *p, jl_value_t *body)
{
#ifndef NDEBUG
size_t i, np = jl_svec_len(p);
jl_value_t **env;
JL_GC_PUSHARGS(env, np * 2 + 2);
jl_svec_t *params = jl_alloc_svec(np);
env[np * 2] = (jl_value_t*)params;
for (i = 0; i < np; i++) {
// recreate body with the TypeVar unbound
jl_tvar_t *tv = (jl_tvar_t*)jl_svecref(p, i);
assert(jl_is_typevar(tv));
env[2 * i] = (jl_value_t*)tv;
tv = jl_new_typevar(tv->name, tv->lb, tv->ub);
env[2 * i + 1] = (jl_value_t*)tv;
jl_svecset(params, i, tv);
assert(jl_is_typevar(tv) && !tv->bound);
}
body = jl_instantiate_type_with(body, env, np);
env[np * 2 + 1] = body;

#endif
jl_typector_t *tc = (jl_typector_t*)newobj((jl_value_t*)jl_typector_type, NWORDS(sizeof(jl_typector_t)));
tc->parameters = params;
tc->parameters = p;
tc->body = body;
return (jl_value_t*)tc;
}
Expand Down
2 changes: 1 addition & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@
,@(map (lambda (v) `(local ,v)) params)
,@(map (lambda (l r) (make-assignment l (expand-forms r)))
params
(symbols->typevars params bounds #t))
(symbols->typevars params bounds #f))
(call (core TypeConstructor)
(call (core svec) ,@params)
,(expand-forms type-ex))))))))
Expand Down