Skip to content

Commit 1786bef

Browse files
committed
Remove export_small_typeof
I think this might have been part of a scheme to avoid an extra indirection when this symbol is exposed to the linker. We have a similar technique used for JIT'd modules, but I'm not sure how it's supposed to work here between libjulia and libjulia-internal. On Windows, this is broken for embedding currently, and on Linux this function was just copying from the `small_typeof` in libjulia to a seem- ingly unused copy of the symbol in libjulia-internal. For now, this removes the special machinery and replaces it with a single copy of the data. If we'd like to optimize this in the future, we might want to use the existing "ijl_" vs. "jl_" pattern
1 parent 80ac03b commit 1786bef

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

src/jltypes.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ extern "C" {
2020
#endif
2121

2222
_Atomic(jl_value_t*) cmpswap_names JL_GLOBALLY_ROOTED;
23-
jl_datatype_t *small_typeof[(jl_max_tags << 4) / sizeof(*small_typeof)]; // 16-bit aligned, like the GC
2423

2524
// compute empirical max-probe for a given size
2625
#define max_probe(size) ((size) <= 1024 ? 16 : (size) >> 6)
@@ -2528,17 +2527,6 @@ static jl_tvar_t *tvar(const char *name)
25282527
(jl_value_t*)jl_any_type);
25292528
}
25302529

2531-
void export_small_typeof(void)
2532-
{
2533-
void *copy;
2534-
#ifdef _OS_WINDOWS_
2535-
jl_dlsym(jl_libjulia_handle, "small_typeof", &copy, 1);
2536-
#else
2537-
jl_dlsym(jl_libjulia_internal_handle, "small_typeof", &copy, 1);
2538-
#endif
2539-
memcpy(copy, &small_typeof, sizeof(small_typeof));
2540-
}
2541-
25422530
#define XX(name) \
25432531
small_typeof[(jl_##name##_tag << 4) / sizeof(*small_typeof)] = jl_##name##_type; \
25442532
jl_##name##_type->smalltag = jl_##name##_tag;
@@ -3360,7 +3348,6 @@ void jl_init_types(void) JL_GC_DISABLED
33603348

33613349
// override the preferred layout for a couple types
33623350
jl_lineinfonode_type->name->mayinlinealloc = 0; // FIXME: assumed to be a pointer by codegen
3363-
export_small_typeof();
33643351
}
33653352

33663353
static jl_value_t *core(const char *name)
@@ -3441,7 +3428,6 @@ void post_boot_hooks(void)
34413428
}
34423429
}
34433430
}
3444-
export_small_typeof();
34453431
}
34463432

34473433
void post_image_load_hooks(void) {

src/staticdata.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,7 +2838,6 @@ JL_DLLEXPORT void jl_set_sysimg_so(void *handle)
28382838
#endif
28392839

28402840
extern void rebuild_image_blob_tree(void);
2841-
extern void export_small_typeof(void);
28422841

28432842
static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl_array_t *depmods, uint64_t checksum,
28442843
/* outputs */ jl_array_t **restored, jl_array_t **init_order,
@@ -2917,7 +2916,6 @@ static void jl_restore_system_image_from_stream_(ios_t *f, jl_image_t *image, jl
29172916
small_typeof[(jl_##name##_tag << 4) / sizeof(*small_typeof)] = jl_##name##_type;
29182917
JL_SMALL_TYPEOF(XX)
29192918
#undef XX
2920-
export_small_typeof();
29212919
jl_global_roots_table = (jl_array_t*)jl_read_value(&s);
29222920
// set typeof extra-special values now that we have the type set by tags above
29232921
jl_astaggedvalue(jl_nothing)->header = (uintptr_t)jl_nothing_type | jl_astaggedvalue(jl_nothing)->header;

0 commit comments

Comments
 (0)