Skip to content

Commit

Permalink
Merge branch 'lazier_inline_fixups'
Browse files Browse the repository at this point in the history
  • Loading branch information
timo committed Apr 14, 2018
2 parents 4034d9d + 9655e15 commit fa0fc18
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 125 deletions.
66 changes: 40 additions & 26 deletions lib/MAST/Ops.nqp
Expand Up @@ -852,21 +852,23 @@ BEGIN {
2144,
2148,
2152,
2153,
2155,
2157,
2158,
2159,
2161,
2163,
2165,
2167,
2167,
2167,
2168,
2169,
2169,
2170,
2172,
2176);
2171,
2173,
2173,
2173,
2174,
2175,
2175,
2176,
2178,
2182);
MAST::Ops.WHO<@counts> := nqp::list_i(0,
2,
2,
Expand Down Expand Up @@ -1715,6 +1717,8 @@ BEGIN {
3,
4,
4,
3,
3,
1,
2,
2,
Expand Down Expand Up @@ -3883,6 +3887,12 @@ BEGIN {
16,
16,
65,
58,
128,
24,
66,
128,
32,
66,
34,
65,
Expand Down Expand Up @@ -4757,22 +4767,24 @@ BEGIN {
'sp_deref_bind_n', 845,
'sp_getlexvia_o', 846,
'sp_getlexvia_ins', 847,
'sp_jit_enter', 848,
'sp_boolify_iter', 849,
'sp_boolify_iter_arr', 850,
'sp_boolify_iter_hash', 851,
'sp_cas_o', 852,
'sp_atomicload_o', 853,
'sp_atomicstore_o', 854,
'prof_enter', 855,
'prof_enterspesh', 856,
'prof_enterinline', 857,
'prof_enternative', 858,
'prof_exit', 859,
'prof_allocated', 860,
'ctw_check', 861,
'coverage_log', 862,
'breakpoint', 863);
'sp_getstringfrom', 848,
'sp_getwvalfrom', 849,
'sp_jit_enter', 850,
'sp_boolify_iter', 851,
'sp_boolify_iter_arr', 852,
'sp_boolify_iter_hash', 853,
'sp_cas_o', 854,
'sp_atomicload_o', 855,
'sp_atomicstore_o', 856,
'prof_enter', 857,
'prof_enterspesh', 858,
'prof_enterinline', 859,
'prof_enternative', 860,
'prof_exit', 861,
'prof_allocated', 862,
'ctw_check', 863,
'coverage_log', 864,
'breakpoint', 865);
MAST::Ops.WHO<@names> := nqp::list_s('no_op',
'const_i8',
'const_i16',
Expand Down Expand Up @@ -5621,6 +5633,8 @@ BEGIN {
'sp_deref_bind_n',
'sp_getlexvia_o',
'sp_getlexvia_ins',
'sp_getstringfrom',
'sp_getwvalfrom',
'sp_jit_enter',
'sp_boolify_iter',
'sp_boolify_iter_arr',
Expand Down
14 changes: 14 additions & 0 deletions src/core/interp.c
Expand Up @@ -5761,6 +5761,20 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
cur_op += 8;
goto NEXT;
}
OP(sp_getstringfrom): {
MVMCompUnit *dep = (MVMCompUnit *)tc->cur_frame->effective_spesh_slots[GET_UI16(cur_op, 2)];
MVMuint16 idx = GET_UI32(cur_op, 4);
GET_REG(cur_op, 0).s = MVM_cu_string(tc, dep, idx);
cur_op += 8;
goto NEXT;
}
OP(sp_getwvalfrom): {
MVMSerializationContext *dep = (MVMSerializationContext *)tc->cur_frame->effective_spesh_slots[GET_UI16(cur_op, 2)];
MVMuint64 idx = MVM_BC_get_I64(cur_op, 4);
GET_REG(cur_op, 0).o = MVM_sc_get_object(tc, dep, idx);
cur_op += 12;
goto NEXT;
}
OP(sp_jit_enter): {
if (tc->cur_frame->spesh_cand->jitcode == NULL) {
MVM_exception_throw_adhoc(tc, "Try to enter NULL jitcode");
Expand Down
4 changes: 2 additions & 2 deletions src/core/oplabels.h
Expand Up @@ -849,6 +849,8 @@ static const void * const LABELS[] = {
&&OP_sp_deref_bind_n,
&&OP_sp_getlexvia_o,
&&OP_sp_getlexvia_ins,
&&OP_sp_getstringfrom,
&&OP_sp_getwvalfrom,
&&OP_sp_jit_enter,
&&OP_sp_boolify_iter,
&&OP_sp_boolify_iter_arr,
Expand Down Expand Up @@ -1023,8 +1025,6 @@ static const void * const LABELS[] = {
NULL,
NULL,
NULL,
NULL,
NULL,
&&OP_CALL_EXTOP,
&&OP_CALL_EXTOP,
&&OP_CALL_EXTOP,
Expand Down
3 changes: 3 additions & 0 deletions src/core/oplist
Expand Up @@ -951,6 +951,9 @@ sp_deref_bind_n .s r(obj) r(num64) int16
sp_getlexvia_o .s w(obj) int16 int16 r(obj) :pure
sp_getlexvia_ins .s w(`1) int16 int16 r(obj) :pure

sp_getstringfrom .s w(str) sslot int32 :pure
sp_getwvalfrom .s w(obj) sslot int64 :pure

# Enter the JIT
sp_jit_enter .s w(obj)

Expand Down
28 changes: 27 additions & 1 deletion src/core/ops.c
Expand Up @@ -11016,6 +11016,32 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
{ MVM_operand_write_reg | MVM_operand_type_var, MVM_operand_int16, MVM_operand_int16, MVM_operand_read_reg | MVM_operand_obj }
},
{
MVM_OP_sp_getstringfrom,
"sp_getstringfrom",
".s",
3,
1,
0,
0,
0,
0,
0,
{ MVM_operand_write_reg | MVM_operand_str, MVM_operand_spesh_slot, MVM_operand_int32 }
},
{
MVM_OP_sp_getwvalfrom,
"sp_getwvalfrom",
".s",
3,
1,
0,
0,
0,
0,
0,
{ MVM_operand_write_reg | MVM_operand_obj, MVM_operand_spesh_slot, MVM_operand_int64 }
},
{
MVM_OP_sp_jit_enter,
"sp_jit_enter",
Expand Down Expand Up @@ -11223,7 +11249,7 @@ static const MVMOpInfo MVM_op_infos[] = {
},
};

static const unsigned short MVM_op_counts = 864;
static const unsigned short MVM_op_counts = 866;

MVM_PUBLIC const MVMOpInfo * MVM_op_get_op(unsigned short op) {
if (op >= MVM_op_counts)
Expand Down
34 changes: 18 additions & 16 deletions src/core/ops.h
Expand Up @@ -849,22 +849,24 @@
#define MVM_OP_sp_deref_bind_n 845
#define MVM_OP_sp_getlexvia_o 846
#define MVM_OP_sp_getlexvia_ins 847
#define MVM_OP_sp_jit_enter 848
#define MVM_OP_sp_boolify_iter 849
#define MVM_OP_sp_boolify_iter_arr 850
#define MVM_OP_sp_boolify_iter_hash 851
#define MVM_OP_sp_cas_o 852
#define MVM_OP_sp_atomicload_o 853
#define MVM_OP_sp_atomicstore_o 854
#define MVM_OP_prof_enter 855
#define MVM_OP_prof_enterspesh 856
#define MVM_OP_prof_enterinline 857
#define MVM_OP_prof_enternative 858
#define MVM_OP_prof_exit 859
#define MVM_OP_prof_allocated 860
#define MVM_OP_ctw_check 861
#define MVM_OP_coverage_log 862
#define MVM_OP_breakpoint 863
#define MVM_OP_sp_getstringfrom 848
#define MVM_OP_sp_getwvalfrom 849
#define MVM_OP_sp_jit_enter 850
#define MVM_OP_sp_boolify_iter 851
#define MVM_OP_sp_boolify_iter_arr 852
#define MVM_OP_sp_boolify_iter_hash 853
#define MVM_OP_sp_cas_o 854
#define MVM_OP_sp_atomicload_o 855
#define MVM_OP_sp_atomicstore_o 856
#define MVM_OP_prof_enter 857
#define MVM_OP_prof_enterspesh 858
#define MVM_OP_prof_enterinline 859
#define MVM_OP_prof_enternative 860
#define MVM_OP_prof_exit 861
#define MVM_OP_prof_allocated 862
#define MVM_OP_ctw_check 863
#define MVM_OP_coverage_log 864
#define MVM_OP_breakpoint 865

#define MVM_OP_EXT_BASE 1024
#define MVM_OP_EXT_CU_LIMIT 1024
Expand Down
13 changes: 0 additions & 13 deletions src/spesh/candidate.c
Expand Up @@ -61,19 +61,6 @@ void MVM_spesh_candidate_add(MVMThreadContext *tc, MVMSpeshPlanned *p) {
MVM_spesh_facts_discover(tc, sg, p);
MVM_spesh_optimize(tc, sg, p);

if (sg->sc_idx_resolve_used > 0) {
MVMuint32 idxidx;
#if MVM_GC_DEBUG
tc->in_spesh = 0;
#endif

if (tc->instance->spesh_log_fh)
fprintf(tc->instance->spesh_log_fh,
"Specialization bailed out due to %u unresolved WVals\n",
sg->sc_idx_resolve_used);
return;
}

if (tc->instance->spesh_log_fh) {
char *after = MVM_spesh_dump(tc, sg);
fprintf(tc->instance->spesh_log_fh, "After:\n%s", after);
Expand Down
6 changes: 5 additions & 1 deletion src/spesh/graph.c
Expand Up @@ -1255,11 +1255,15 @@ MVMSpeshGraph * MVM_spesh_graph_create_from_cand(MVMThreadContext *tc, MVMStatic
g->deopt_named_used_bit_field = cand->deopt_named_used_bit_field;
g->local_types = cand->local_types;
g->lexical_types = cand->lexical_types;
g->spesh_slots = cand->spesh_slots;
g->num_spesh_slots = cand->num_spesh_slots;
g->alloc_spesh_slots = cand->num_spesh_slots;
g->phi_infos = MVM_spesh_alloc(tc, g, MVMPhiNodeCacheSize * sizeof(MVMOpInfo));
g->cand = cand;

g->spesh_slots = MVM_malloc(g->alloc_spesh_slots * sizeof(MVMCollectable *));

memcpy(g->spesh_slots, cand->spesh_slots, sizeof(MVMCollectable *) * g->num_spesh_slots);

/* Ensure the frame is validated, since we'll rely on this. */
if (sf->body.instrumentation_level == 0) {
MVM_spesh_graph_destroy(tc, g);
Expand Down
6 changes: 0 additions & 6 deletions src/spesh/graph.h
Expand Up @@ -105,12 +105,6 @@ struct MVMSpeshGraph {

/* Did we specialize on the invocant type? */
MVMuint8 specialized_on_invocant;

MVMSerializationContext **scs_to_resolve_from;
MVMuint64 *sc_idx_to_resolve;

MVMuint32 sc_idx_resolve_alloc;
MVMuint32 sc_idx_resolve_used;
};

/* A temporary register, added to support transformations. */
Expand Down

0 comments on commit fa0fc18

Please sign in to comment.