Permalink
Browse files

remove lots of NULLs to improve reflectability of method table struct…

…ures
  • Loading branch information...
1 parent f5ac988 commit a8116992c8f733a9a0959077d42e77a8a2d01abe @JeffBezanson JeffBezanson committed Apr 18, 2012
Showing with 82 additions and 71 deletions.
  1. +1 −0 src/alloc.c
  2. +3 −2 src/builtins.c
  3. +2 −2 src/dump.c
  4. +1 −0 src/gc.c
  5. +71 −67 src/gf.c
  6. +2 −0 src/jltypes.c
  7. +2 −0 src/julia.h
View
@@ -27,6 +27,7 @@ jl_struct_type_t *jl_array_type;
jl_typename_t *jl_array_typename;
jl_type_t *jl_array_uint8_type;
jl_type_t *jl_array_any_type;
+jl_function_t *jl_bottom_func;
jl_struct_type_t *jl_weakref_type;
jl_struct_type_t *jl_ascii_string_type;
jl_struct_type_t *jl_utf8_string_type;
View
@@ -1118,7 +1118,7 @@ JL_CALLABLE(jl_f_methodexists)
check_type_tuple((jl_tuple_t*)args[1], jl_gf_name(args[0]),
"method_exists");
return jl_method_lookup_by_type(jl_gf_mtable(args[0]),
- (jl_tuple_t*)args[1], 0) ?
+ (jl_tuple_t*)args[1], 0) != jl_bottom_func ?
jl_true : jl_false;
}
@@ -1128,7 +1128,8 @@ JL_CALLABLE(jl_f_applicable)
JL_TYPECHK(applicable, function, args[0]);
if (!jl_is_gf(args[0]))
jl_error("applicable: not a generic function");
- return jl_method_lookup(jl_gf_mtable(args[0]), &args[1], nargs-1, 0) ?
+ return jl_method_lookup(jl_gf_mtable(args[0]),
+ &args[1], nargs-1, 0) != jl_bottom_func ?
jl_true : jl_false;
}
View
@@ -745,8 +745,8 @@ void jl_save_system_image(char *fname, char *startscriptname)
else {
// delete cached slow ASCIIString constructor
jl_methtable_t *mt = jl_gf_mtable((jl_function_t*)jl_ascii_string_type);
- mt->cache = NULL;
- mt->cache_arg1 = NULL;
+ mt->cache = JL_NULL;
+ mt->cache_arg1 = JL_NULL;
mt->defs->func->linfo->tfunc = (jl_value_t*)jl_null;
mt->defs->func->linfo->specializations = NULL;
}
View
@@ -584,6 +584,7 @@ static void gc_mark(void)
GC_Markval(jl_exception_in_transit);
GC_Markval(jl_task_arg_in_transit);
GC_Markval(jl_unprotect_stack_func);
+ GC_Markval(jl_bottom_func);
GC_Markval(jl_typetype_type);
// constants
Oops, something went wrong.

0 comments on commit a811699

Please sign in to comment.