Skip to content
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
85bacaf
First attempt at hash table (local)
BioTurboNick Nov 7, 2023
039ed85
egalhash seems to work
BioTurboNick Nov 8, 2023
491f6d1
Move the table into jl_method_t
BioTurboNick Nov 8, 2023
e94da03
fix
BioTurboNick Nov 8, 2023
a769017
Fix? null logic
BioTurboNick Nov 8, 2023
65db925
Switch to iddict
BioTurboNick Nov 9, 2023
c94120a
Switch to iddict
BioTurboNick Nov 9, 2023
ad870f2
Try adding jl_gc_wb
BioTurboNick Nov 9, 2023
3cac759
Try adding jl_gc_wb
BioTurboNick Nov 9, 2023
7db6f68
fix
BioTurboNick Nov 9, 2023
5d86ede
attempt to be defensive with GC?
BioTurboNick Nov 9, 2023
cd0b9b3
Add back todo
BioTurboNick Nov 9, 2023
b3c0855
roots_table needs to be visible as part of Julia type for GC
BioTurboNick Nov 9, 2023
66ba7d6
Remove the tentative jl_gc_wb calls
BioTurboNick Nov 9, 2023
df28a17
Remove unneeded regeneration loops, simplify
BioTurboNick Nov 9, 2023
e272a80
whitespace, simplify
BioTurboNick Nov 9, 2023
97e10da
Reorder jl_gc_wb
BioTurboNick Nov 10, 2023
a452ca6
Change another loop to a hash lookup
BioTurboNick Nov 10, 2023
b1f7da1
Avoid boxing an int just to provide a default
BioTurboNick Nov 10, 2023
f976920
Try rooting the boxed entries
BioTurboNick Nov 10, 2023
7861156
Move hashtable from jl_method_t and into jl_ircode_state
BioTurboNick Nov 11, 2023
d59678d
Refinement and comment
BioTurboNick Nov 11, 2023
6dba6ac
Revert unneeded changes
BioTurboNick Nov 11, 2023
5acd6dc
Simplify
BioTurboNick Nov 11, 2023
18c0888
Switch to idset implementation
BioTurboNick Nov 27, 2023
2134d46
Simplify
BioTurboNick Nov 27, 2023
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
35 changes: 19 additions & 16 deletions src/ircode.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ typedef struct {
jl_method_t *method;
jl_ptls_t ptls;
uint8_t relocatability;
jl_genericmemory_t *roots_ids; // idset for method root ids; only needed during compression
} jl_ircode_state;

// type => tag hash for a few core types (e.g., Expr, PhiNode, etc)
Expand Down Expand Up @@ -71,21 +72,17 @@ static void tagged_root(rle_reference *rr, jl_ircode_state *s, int i)
static void literal_val_id(rle_reference *rr, jl_ircode_state *s, jl_value_t *v) JL_GC_DISABLED
{
jl_array_t *rs = s->method->roots;
int i, l = jl_array_nrows(rs);
if (jl_is_symbol(v) || jl_is_concrete_type(v)) {
for (i = 0; i < l; i++) {
if (jl_array_ptr_ref(rs, i) == v)
return tagged_root(rr, s, i);
}
}
else {
for (i = 0; i < l; i++) {
if (jl_egal(jl_array_ptr_ref(rs, i), v))
return tagged_root(rr, s, i);
}
jl_genericmemory_t *rt = s->roots_ids;

ssize_t i = jl_idset_peek_bp(rs->ref.mem, rt, v);

if (i == -1) {
i = jl_array_nrows(rs);
jl_add_method_root(s->method, jl_precompile_toplevel_module, v);
s->roots_ids = rt = jl_idset_put_idx(rs->ref.mem, rt, i);
}
jl_add_method_root(s->method, jl_precompile_toplevel_module, v);
return tagged_root(rr, s, jl_array_nrows(rs) - 1);

return tagged_root(rr, s, i);
}

static void jl_encode_int32(jl_ircode_state *s, int32_t x)
Expand Down Expand Up @@ -819,8 +816,13 @@ JL_DLLEXPORT jl_string_t *jl_compress_ir(jl_method_t *m, jl_code_info_t *code)
&dest,
m,
jl_current_task->ptls,
1
1,
jl_alloc_memory_any(0)
};
// generate hash table to lookup root indexes
for (int i = 0; i < jl_array_nrows(m->roots); i++) {
s.roots_ids = jl_idset_put_idx(m->roots->ref.mem, s.roots_ids, i);
}

jl_code_info_flags_t flags = code_info_flags(code->inferred, code->propagate_inbounds, code->has_fcall,
code->nospecializeinfer, code->inlining, code->constprop);
Expand Down Expand Up @@ -915,7 +917,8 @@ JL_DLLEXPORT jl_code_info_t *jl_uncompress_ir(jl_method_t *m, jl_code_instance_t
&src,
m,
jl_current_task->ptls,
1
1,
NULL
};

jl_code_info_t *code = jl_new_code_info_uninit();
Expand Down