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

static compile part 3 (modules) #8656

Merged
merged 6 commits into from
Oct 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 9 additions & 1 deletion src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,12 @@ DLLEXPORT size_t jl_static_show(JL_STREAM *out, jl_value_t *v)
if (v == NULL) {
n += JL_PRINTF(out, "#<null>");
}
else if (v->type == NULL) {
n += JL_PRINTF(out, "<?::#null>");
}
else if ((uptrint_t)v->type < 4096U) {
n += JL_PRINTF(out, "<?::#%d>", (int)(uptrint_t)v->type);
}
else if (jl_is_lambda_info(v)) {
jl_lambda_info_t *li = (jl_lambda_info_t*)v;
n += jl_static_show(out, (jl_value_t*)li->module);
Expand All @@ -1141,6 +1147,8 @@ DLLEXPORT size_t jl_static_show(JL_STREAM *out, jl_value_t *v)
else {
n += JL_PRINTF(out, "(?)");
}
JL_PRINTF(out, " -> ");
jl_static_show(out, !jl_is_expr(li->ast) ? jl_uncompress_ast(li, li->ast) : li->ast);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this means jl_static_show now might allocate memory, do we need a GC root for the uncompressed ast?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessarily, since jl_uncompress_ast typically roots it in li->ast. but perhaps we don't actually want this just because of the allocation (hitting the gc) and the uncompress_ast call (hitting the not-quite-reentrant serializer) and should comment it back out?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, jl_uncompress_ast does not touch li->ast.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right. i'm preparing another (mostly doc) commit to comment this out

}
else if (jl_is_tuple(v)) {
n += jl_show_tuple(out, (jl_tuple_t*)v, "(", ")", 1);
Expand Down Expand Up @@ -1239,7 +1247,7 @@ DLLEXPORT size_t jl_static_show(JL_STREAM *out, jl_value_t *v)
}
else if (jl_is_typevar(v)) {
n += jl_static_show(out, ((jl_tvar_t*)v)->lb);
n += JL_PRINTF(out, "<:%s<:", ((jl_tvar_t*)v)->name->name);
n += JL_PRINTF(out, "<:%s%s<:", (((jl_tvar_t*)v)->bound)?"#":"", ((jl_tvar_t*)v)->name->name);
n += jl_static_show(out, ((jl_tvar_t*)v)->ub);
}
else if (jl_is_module(v)) {
Expand Down
Loading