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

Postrelease opts #969

Merged
merged 68 commits into from Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
a4b4d83
Optimize "hot" wval lookup into spesh slot access
jnthn Aug 13, 2018
2b09f6e
Immediately promote objects ref'd from gen2
jnthn Aug 13, 2018
0ccf889
More aggressive `set` opt of non-deopt inlinees
jnthn Aug 14, 2018
7f0d532
Fix spesh dump for when inline entirely vanishes
jnthn Aug 14, 2018
663fa2c
Mark [sp_]speshresolve as :invokish
jnthn Aug 15, 2018
58128e3
Form deopt usage information before guard inserts
jnthn Aug 15, 2018
2dd34b6
Only write guard write regsister if not deopting
jnthn Aug 15, 2018
d18d536
Propagate facts of inlined return value to inliner
jnthn Aug 15, 2018
760966c
Turn redundant sp_guard* ops into set
timo Aug 11, 2018
f9e8e44
insert null-register-ops in ascending order
timo Aug 15, 2018
6147e0e
Clear up and start improving box optimization
jnthn Aug 15, 2018
8ad1764
Fix typo in comment
MasterDuke17 Aug 15, 2018
0c7483b
Lower box_[ns] with P6opaque
jnthn Aug 15, 2018
5c75cbe
Do a dead instruction pass after post-inline pass
jnthn Aug 15, 2018
bb181aa
set type and concrete facts for fastcreate
timo Aug 16, 2018
183aff2
add type/concrete to box_* spesh, too
timo Aug 16, 2018
429139e
Box lowering for P6[int|num|str]
jnthn Aug 16, 2018
13d93ff
Re-instate use of int cache in fast boxing
jnthn Aug 16, 2018
afe8660
First attempt at a fast box for big integers
jnthn Aug 16, 2018
871dd3b
Correct somehow typo'd integer constant
jnthn Aug 16, 2018
ed888b9
Fix missing result register writes
jnthn Aug 16, 2018
63a80bc
Correct op names in error messages
jnthn Aug 16, 2018
8f3a16b
Start work towards lowering unbox operations
jnthn Aug 16, 2018
ae32ba4
Do basic block merging as the last step
jnthn Aug 16, 2018
1039733
Use mov64 to load a pointer; brrt++
jnthn Aug 17, 2018
c352746
Lower unbox of P6[int|num|str]
jnthn Aug 17, 2018
98f523d
Lower the unboxing of a bigint in a P6opaque
jnthn Aug 17, 2018
db24256
Use a cheaper op for str/num P6opaque box bind
jnthn Aug 17, 2018
2472255
Don't enforce write barrier when boxing
jnthn Aug 17, 2018
50c76e2
Subtract nested inlinees when checking inline size
jnthn Aug 17, 2018
f901ea9
Turn hllize to set if the change is a no-op
jnthn Aug 17, 2018
a06d7a8
gracefully handle out-of-bounds filename indices
timo Aug 16, 2018
ab2d58e
add spesh comments; put arbitrary strings in speshlog
timo Aug 16, 2018
39f7343
don't even need to allocate when spesh log is off
timo Aug 16, 2018
428eb63
if there's only one comment, put it after instruction
timo Aug 18, 2018
492de2e
use # rather than /* */ consistently
timo Aug 18, 2018
6b193d1
add lots of comments to some spesh'd reprops
timo Aug 18, 2018
49f1c7b
Lower add_I, sub_I, and mul_I where possible
jnthn Aug 18, 2018
fb2bdda
comment for result of optimize_method_lookup
timo Aug 18, 2018
1214353
comment on inline success/failure
timo Aug 18, 2018
7f98b3b
comment on throwcat* with category and handler id
timo Aug 18, 2018
f9ba89b
Use defined symbol rather than magic number
jnthn Aug 18, 2018
36558ca
Indicate unspecialized inlines in the inline log
jnthn Aug 20, 2018
5639a7f
Correct a typo
jnthn Aug 20, 2018
f4aff5a
Update lego JIT for updated write barriering
jnthn Aug 20, 2018
692f403
Factor out fastcreate logic
jnthn Aug 20, 2018
5e1b255
optimize bool_I to sp_bool_I
timo Aug 20, 2018
e038244
Get specialized bigint ops using the int cache
jnthn Aug 20, 2018
0b4b439
TMP4d is callee save, so save it during call
jnthn Aug 21, 2018
a7fa9e6
save 16 bytes in MVMStaticFrameBody according to pahole
timo Aug 21, 2018
a95e5f0
Correct tracking of log guards at PHI nodes
jnthn Aug 22, 2018
ebe8189
Fix JIT of specialized bigint ops
jnthn Aug 22, 2018
be4acd1
Correct indentation
jnthn Aug 23, 2018
faab5a8
Populate all deopt points with an offset
jnthn Aug 23, 2018
64941a0
Consider handler with start > end unreachable
jnthn Aug 23, 2018
81e84fe
Harden against handler start/end on same ins
jnthn Aug 23, 2018
2db224a
Bring JIT of getlexreldyn in line with interp
jnthn Aug 23, 2018
a895064
Do not inline loadbytecode
jnthn Aug 23, 2018
7b63edd
Make forceouterctx more forgiving
jnthn Aug 23, 2018
d9e9298
Revert "Do basic block merging as the last step"
jnthn Aug 23, 2018
03efc47
Fix expmod_I template
jnthn Aug 23, 2018
1d987fa
Simplify realloc_at_safepoint debug code
jnthn Aug 23, 2018
13d0b4a
Add debugging range check on SC index
jnthn Aug 23, 2018
249d182
Discover facts on fastcreate-like ops
jnthn Aug 24, 2018
e32d3bd
Try to eliminate takedispatcher during inlining
jnthn Aug 24, 2018
7ae914b
Fix and tidy up hllbool specializations
jnthn Sep 18, 2018
9e90cdd
Don't set ref'd from gen2 flag during GC
jnthn Sep 18, 2018
8aaf696
Fix SSA handling of inlinees with multiple return
jnthn Sep 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
198 changes: 145 additions & 53 deletions lib/MAST/Ops.nqp
Expand Up @@ -858,8 +858,8 @@ BEGIN {
2160,
2163,
2166,
2170,
2174,
2169,
2173,
2177,
2180,
2183,
Expand All @@ -869,27 +869,37 @@ BEGIN {
2195,
2198,
2201,
2204,
2207,
2206,
2211,
2215,
2218,
2221,
2222,
2224,
2217,
2223,
2226,
2228,
2229,
2232,
2234,
2236,
2236,
2236,
2237,
2238,
2238,
2235,
2239,
2241,
2245);
2243,
2246,
2249,
2250,
2252,
2254,
2256,
2260,
2262,
2264,
2271,
2278,
2285,
2288,
2288,
2288,
2289,
2290,
2290,
2291,
2293,
2297);
MAST::Ops.WHO<@counts> := nqp::list_i(0,
2,
2,
Expand Down Expand Up @@ -1744,6 +1754,7 @@ BEGIN {
3,
3,
3,
3,
4,
4,
3,
Expand All @@ -1754,6 +1765,11 @@ BEGIN {
3,
3,
3,
5,
5,
6,
6,
3,
3,
3,
3,
Expand All @@ -1768,6 +1784,10 @@ BEGIN {
4,
2,
2,
7,
7,
7,
3,
0,
0,
1,
Expand Down Expand Up @@ -3940,6 +3960,9 @@ BEGIN {
65,
16,
57,
65,
16,
57,
66,
65,
16,
Expand All @@ -3960,6 +3983,9 @@ BEGIN {
58,
65,
16,
34,
65,
16,
65,
16,
65,
Expand All @@ -3972,6 +3998,28 @@ BEGIN {
65,
16,
57,
66,
16,
128,
16,
33,
66,
16,
128,
16,
33,
66,
16,
128,
16,
33,
16,
66,
16,
128,
16,
33,
16,
34,
65,
16,
Expand Down Expand Up @@ -4013,6 +4061,30 @@ BEGIN {
65,
65,
65,
66,
16,
128,
65,
65,
16,
16,
66,
16,
128,
65,
65,
16,
16,
66,
16,
128,
65,
65,
16,
16,
34,
65,
16,
128,
65,
65,
Expand Down Expand Up @@ -4877,40 +4949,50 @@ BEGIN {
'sp_bind_i8', 850,
'sp_bind_n', 851,
'sp_bind_s', 852,
'sp_p6oget_o', 853,
'sp_p6ogetvt_o', 854,
'sp_p6ogetvc_o', 855,
'sp_p6oget_i', 856,
'sp_p6oget_n', 857,
'sp_p6oget_s', 858,
'sp_p6obind_o', 859,
'sp_p6obind_i', 860,
'sp_p6obind_n', 861,
'sp_p6obind_s', 862,
'sp_deref_get_i64', 863,
'sp_deref_get_n', 864,
'sp_deref_bind_i64', 865,
'sp_deref_bind_n', 866,
'sp_getlexvia_o', 867,
'sp_getlexvia_ins', 868,
'sp_getstringfrom', 869,
'sp_getwvalfrom', 870,
'sp_jit_enter', 871,
'sp_boolify_iter', 872,
'sp_boolify_iter_arr', 873,
'sp_boolify_iter_hash', 874,
'sp_cas_o', 875,
'sp_atomicload_o', 876,
'sp_atomicstore_o', 877,
'prof_enter', 878,
'prof_enterspesh', 879,
'prof_enterinline', 880,
'prof_enternative', 881,
'prof_exit', 882,
'prof_allocated', 883,
'ctw_check', 884,
'coverage_log', 885,
'breakpoint', 886);
'sp_bind_s_nowb', 853,
'sp_p6oget_o', 854,
'sp_p6ogetvt_o', 855,
'sp_p6ogetvc_o', 856,
'sp_p6oget_i', 857,
'sp_p6oget_n', 858,
'sp_p6oget_s', 859,
'sp_p6oget_bi', 860,
'sp_p6obind_o', 861,
'sp_p6obind_i', 862,
'sp_p6obind_n', 863,
'sp_p6obind_s', 864,
'sp_fastbox_i', 865,
'sp_fastbox_bi', 866,
'sp_fastbox_i_ic', 867,
'sp_fastbox_bi_ic', 868,
'sp_deref_get_i64', 869,
'sp_deref_get_n', 870,
'sp_deref_bind_i64', 871,
'sp_deref_bind_n', 872,
'sp_getlexvia_o', 873,
'sp_getlexvia_ins', 874,
'sp_getstringfrom', 875,
'sp_getwvalfrom', 876,
'sp_jit_enter', 877,
'sp_boolify_iter', 878,
'sp_boolify_iter_arr', 879,
'sp_boolify_iter_hash', 880,
'sp_cas_o', 881,
'sp_atomicload_o', 882,
'sp_atomicstore_o', 883,
'sp_add_I', 884,
'sp_sub_I', 885,
'sp_mul_I', 886,
'sp_bool_I', 887,
'prof_enter', 888,
'prof_enterspesh', 889,
'prof_enterinline', 890,
'prof_enternative', 891,
'prof_exit', 892,
'prof_allocated', 893,
'ctw_check', 894,
'coverage_log', 895,
'breakpoint', 896);
MAST::Ops.WHO<@names> := nqp::list_s('no_op',
'const_i8',
'const_i16',
Expand Down Expand Up @@ -5764,16 +5846,22 @@ BEGIN {
'sp_bind_i8',
'sp_bind_n',
'sp_bind_s',
'sp_bind_s_nowb',
'sp_p6oget_o',
'sp_p6ogetvt_o',
'sp_p6ogetvc_o',
'sp_p6oget_i',
'sp_p6oget_n',
'sp_p6oget_s',
'sp_p6oget_bi',
'sp_p6obind_o',
'sp_p6obind_i',
'sp_p6obind_n',
'sp_p6obind_s',
'sp_fastbox_i',
'sp_fastbox_bi',
'sp_fastbox_i_ic',
'sp_fastbox_bi_ic',
'sp_deref_get_i64',
'sp_deref_get_n',
'sp_deref_bind_i64',
Expand All @@ -5789,6 +5877,10 @@ BEGIN {
'sp_cas_o',
'sp_atomicload_o',
'sp_atomicstore_o',
'sp_add_I',
'sp_sub_I',
'sp_mul_I',
'sp_bool_I',
'prof_enter',
'prof_enterspesh',
'prof_enterinline',
Expand Down
4 changes: 4 additions & 0 deletions src/6model/6model.h
Expand Up @@ -149,6 +149,10 @@ typedef enum {
/* Has this item been chained into a gen2 freelist? This is only used in
* GC debug more. */
MVM_CF_DEBUG_IN_GEN2_FREE_LIST = 4096,

/* Is this object a nursery object that has been referenced from gen2?
* Used to promote it earlier. */
MVM_CF_REF_FROM_GEN2 = 8192,
} MVMCollectableFlags;

#ifdef MVM_USE_OVERFLOW_SERIALIZATION_INDEX
Expand Down
17 changes: 17 additions & 0 deletions src/6model/reprs/MVMContext.c
Expand Up @@ -346,6 +346,23 @@ MVMFrame * MVM_context_get_frame(MVMThreadContext *tc, MVMContext *ctx) {
return result;
}

/* Resolves the context to an exact frame; if the frame in question is an
* inline, takes the inline's outer. Returns NULL if neither resolves. */
MVMFrame * MVM_context_get_frame_or_outer(MVMThreadContext *tc, MVMContext *ctx) {
MVMSpeshFrameWalker fw;
MVMFrame *result = NULL;
MVM_spesh_frame_walker_init(tc, &fw, ctx->body.context, 0);
if (apply_traversals(tc, &fw, ctx->body.traversals, ctx->body.num_traversals)) {
result = MVM_spesh_frame_walker_get_frame(tc, &fw);
if (!result) {
MVM_spesh_frame_walker_move_outer(tc, &fw);
result = MVM_spesh_frame_walker_get_frame(tc, &fw);
}
}
MVM_spesh_frame_walker_cleanup(tc, &fw);
return result;
}

/* Resolves the context and gets a hash of its lexicals. */
MVMObject * MVM_context_lexicals_as_hash(MVMThreadContext *tc, MVMContext *ctx) {
MVMSpeshFrameWalker fw;
Expand Down
1 change: 1 addition & 0 deletions src/6model/reprs/MVMContext.h
Expand Up @@ -33,6 +33,7 @@ const MVMREPROps * MVMContext_initialize(MVMThreadContext *tc);
MVM_PUBLIC MVMObject * MVM_context_from_frame(MVMThreadContext *tc, MVMFrame *f);
MVMObject * MVM_context_apply_traversal(MVMThreadContext *tc, MVMContext *ctx, MVMuint8 traversal);
MVMFrame * MVM_context_get_frame(MVMThreadContext *tc, MVMContext *ctx);
MVMFrame * MVM_context_get_frame_or_outer(MVMThreadContext *tc, MVMContext *ctx);
MVMObject * MVM_context_lexicals_as_hash(MVMThreadContext *tc, MVMContext *ctx);
MVMint64 MVM_context_lexical_primspec(MVMThreadContext *tc, MVMContext *ctx, MVMString *name);
MVMObject * MVM_context_get_code(MVMThreadContext *tc, MVMContext *ctx);
Expand Down
5 changes: 5 additions & 0 deletions src/6model/reprs/MVMHash.c
Expand Up @@ -218,12 +218,17 @@ static void spesh(MVMThreadContext *tc, MVMSTable *st, MVMSpeshGraph *g, MVMSpes
if (!(st->mode_flags & MVM_FINALIZE_TYPE)) {
MVMSpeshOperand target = ins->operands[0];
MVMSpeshOperand type = ins->operands[1];
MVMSpeshFacts *tgt_facts = MVM_spesh_get_facts(tc, g, target);

ins->info = MVM_op_get_op(MVM_OP_sp_fastcreate);
ins->operands = MVM_spesh_alloc(tc, g, 3 * sizeof(MVMSpeshOperand));
ins->operands[0] = target;
ins->operands[1].lit_i16 = sizeof(MVMHash);
ins->operands[2].lit_i16 = MVM_spesh_add_spesh_slot(tc, g, (MVMCollectable *)st);
MVM_spesh_usages_delete_by_reg(tc, g, type, ins);

tgt_facts->flags |= MVM_SPESH_FACT_KNOWN_TYPE | MVM_SPESH_FACT_CONCRETE;
tgt_facts->type = st->WHAT;
}
break;
}
Expand Down