Skip to content

Commit

Permalink
Don't enforce write barrier when boxing
Browse files Browse the repository at this point in the history
The object was only just created. It must be in the nursery, since
that's a rule for using `fastcreate`. Thus it can not be a gen2
object pointing to a nursery object, which is when the barrier would
trigger.
  • Loading branch information
jnthn committed Aug 17, 2018
1 parent 3edfdf2 commit a302b04
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 101 deletions.
123 changes: 65 additions & 58 deletions lib/MAST/Ops.nqp
Expand Up @@ -855,8 +855,8 @@ BEGIN {
2153,
2156,
2159,
2163,
2167,
2162,
2166,
2170,
2173,
2176,
Expand All @@ -865,33 +865,34 @@ BEGIN {
2185,
2188,
2191,
2196,
2201,
2207,
2213,
2194,
2199,
2204,
2210,
2216,
2219,
2222,
2225,
2229,
2233,
2228,
2232,
2236,
2239,
2240,
2242,
2244,
2246,
2250,
2252,
2254,
2254,
2254,
2243,
2245,
2247,
2249,
2253,
2255,
2256,
2256,
2257,
2257,
2257,
2258,
2259,
2263);
2259,
2260,
2262,
2266);
MAST::Ops.WHO<@counts> := nqp::list_i(0,
2,
2,
Expand Down Expand Up @@ -1743,6 +1744,7 @@ BEGIN {
3,
3,
3,
3,
4,
4,
3,
Expand Down Expand Up @@ -3937,6 +3939,9 @@ BEGIN {
65,
16,
57,
65,
16,
57,
66,
65,
16,
Expand Down Expand Up @@ -4896,45 +4901,46 @@ BEGIN {
'sp_bind_i8', 847,
'sp_bind_n', 848,
'sp_bind_s', 849,
'sp_p6oget_o', 850,
'sp_p6ogetvt_o', 851,
'sp_p6ogetvc_o', 852,
'sp_p6oget_i', 853,
'sp_p6oget_n', 854,
'sp_p6oget_s', 855,
'sp_p6oget_bi', 856,
'sp_p6obind_o', 857,
'sp_p6obind_i', 858,
'sp_p6obind_n', 859,
'sp_p6obind_s', 860,
'sp_fastbox_i', 861,
'sp_fastbox_bi', 862,
'sp_fastbox_i_ic', 863,
'sp_fastbox_bi_ic', 864,
'sp_deref_get_i64', 865,
'sp_deref_get_n', 866,
'sp_deref_bind_i64', 867,
'sp_deref_bind_n', 868,
'sp_getlexvia_o', 869,
'sp_getlexvia_ins', 870,
'sp_getstringfrom', 871,
'sp_getwvalfrom', 872,
'sp_jit_enter', 873,
'sp_boolify_iter', 874,
'sp_boolify_iter_arr', 875,
'sp_boolify_iter_hash', 876,
'sp_cas_o', 877,
'sp_atomicload_o', 878,
'sp_atomicstore_o', 879,
'prof_enter', 880,
'prof_enterspesh', 881,
'prof_enterinline', 882,
'prof_enternative', 883,
'prof_exit', 884,
'prof_allocated', 885,
'ctw_check', 886,
'coverage_log', 887,
'breakpoint', 888);
'sp_bind_s_nowb', 850,
'sp_p6oget_o', 851,
'sp_p6ogetvt_o', 852,
'sp_p6ogetvc_o', 853,
'sp_p6oget_i', 854,
'sp_p6oget_n', 855,
'sp_p6oget_s', 856,
'sp_p6oget_bi', 857,
'sp_p6obind_o', 858,
'sp_p6obind_i', 859,
'sp_p6obind_n', 860,
'sp_p6obind_s', 861,
'sp_fastbox_i', 862,
'sp_fastbox_bi', 863,
'sp_fastbox_i_ic', 864,
'sp_fastbox_bi_ic', 865,
'sp_deref_get_i64', 866,
'sp_deref_get_n', 867,
'sp_deref_bind_i64', 868,
'sp_deref_bind_n', 869,
'sp_getlexvia_o', 870,
'sp_getlexvia_ins', 871,
'sp_getstringfrom', 872,
'sp_getwvalfrom', 873,
'sp_jit_enter', 874,
'sp_boolify_iter', 875,
'sp_boolify_iter_arr', 876,
'sp_boolify_iter_hash', 877,
'sp_cas_o', 878,
'sp_atomicload_o', 879,
'sp_atomicstore_o', 880,
'prof_enter', 881,
'prof_enterspesh', 882,
'prof_enterinline', 883,
'prof_enternative', 884,
'prof_exit', 885,
'prof_allocated', 886,
'ctw_check', 887,
'coverage_log', 888,
'breakpoint', 889);
MAST::Ops.WHO<@names> := nqp::list_s('no_op',
'const_i8',
'const_i16',
Expand Down Expand Up @@ -5785,6 +5791,7 @@ BEGIN {
'sp_bind_i8',
'sp_bind_n',
'sp_bind_s',
'sp_bind_s_nowb',
'sp_p6oget_o',
'sp_p6ogetvt_o',
'sp_p6ogetvc_o',
Expand Down
2 changes: 1 addition & 1 deletion src/6model/reprs/P6opaque.c
Expand Up @@ -1691,7 +1691,7 @@ static void spesh(MVMThreadContext *tc, MVMSTable *st, MVMSpeshGraph *g, MVMSpes

/* Change instruction to a bind. */
MVM_spesh_usages_delete_by_reg(tc, g, ins->operands[2], ins);
ins->info = MVM_op_get_op(MVM_OP_sp_bind_s);
ins->info = MVM_op_get_op(MVM_OP_sp_bind_s_nowb);
ins->operands[2] = ins->operands[1];
ins->operands[1].lit_i16 = sizeof(MVMObject) +
repr_data->attribute_offsets[repr_data->unbox_str_slot];
Expand Down
2 changes: 1 addition & 1 deletion src/6model/reprs/P6str.c
Expand Up @@ -88,7 +88,7 @@ static void spesh(MVMThreadContext *tc, MVMSTable *st, MVMSpeshGraph *g, MVMSpes

/* Change instruction to a bind. */
MVM_spesh_usages_delete_by_reg(tc, g, ins->operands[2], ins);
ins->info = MVM_op_get_op(MVM_OP_sp_bind_s);
ins->info = MVM_op_get_op(MVM_OP_sp_bind_s_nowb);
ins->operands[2] = ins->operands[1];
ins->operands[1].lit_i16 = offsetof(MVMP6str, body.value);
MVM_spesh_usages_add_by_reg(tc, g, ins->operands[0], ins);
Expand Down
7 changes: 7 additions & 0 deletions src/core/interp.c
Expand Up @@ -5705,6 +5705,13 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
cur_op += 6;
goto NEXT;
}
OP(sp_bind_s_nowb): {
MVMObject *o = GET_REG(cur_op, 0).o;
MVMString *value = GET_REG(cur_op, 4).s;
*((MVMString **)((char *)o + GET_UI16(cur_op, 2))) = value;
cur_op += 6;
goto NEXT;
}
OP(sp_p6oget_o): {
MVMObject *o = GET_REG(cur_op, 2).o;
MVMObject *val = MVM_p6opaque_read_object(tc, o, GET_UI16(cur_op, 4));
Expand Down
2 changes: 1 addition & 1 deletion src/core/oplabels.h
Expand Up @@ -851,6 +851,7 @@ static const void * const LABELS[] = {
&&OP_sp_bind_i8,
&&OP_sp_bind_n,
&&OP_sp_bind_s,
&&OP_sp_bind_s_nowb,
&&OP_sp_p6oget_o,
&&OP_sp_p6ogetvt_o,
&&OP_sp_p6ogetvc_o,
Expand Down Expand Up @@ -1024,7 +1025,6 @@ static const void * const LABELS[] = {
NULL,
NULL,
NULL,
NULL,
&&OP_CALL_EXTOP,
&&OP_CALL_EXTOP,
&&OP_CALL_EXTOP,
Expand Down
1 change: 1 addition & 0 deletions src/core/oplist
Expand Up @@ -958,6 +958,7 @@ sp_bind_i16 .s r(obj) int16 r(int64)
sp_bind_i8 .s r(obj) int16 r(int64)
sp_bind_n .s r(obj) int16 r(num64)
sp_bind_s .s r(obj) int16 r(str)
sp_bind_s_nowb .s r(obj) int16 r(str)

# Same as above, but for p6opaques, handling the NULL sentinel and the
# real_data thing for mixins. The vt variant vivifies a NULL with a
Expand Down
17 changes: 16 additions & 1 deletion src/core/ops.c
Expand Up @@ -12742,6 +12742,21 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
{ MVM_operand_read_reg | MVM_operand_obj, MVM_operand_int16, MVM_operand_read_reg | MVM_operand_str }
},
{
MVM_OP_sp_bind_s_nowb,
"sp_bind_s_nowb",
".s",
3,
0,
0,
0,
0,
0,
0,
0,
0,
{ MVM_operand_read_reg | MVM_operand_obj, MVM_operand_int16, MVM_operand_read_reg | MVM_operand_str }
},
{
MVM_OP_sp_p6oget_o,
"sp_p6oget_o",
Expand Down Expand Up @@ -13326,7 +13341,7 @@ static const MVMOpInfo MVM_op_infos[] = {
},
};

static const unsigned short MVM_op_counts = 889;
static const unsigned short MVM_op_counts = 890;

MVM_PUBLIC const MVMOpInfo * MVM_op_get_op(unsigned short op) {
if (op >= MVM_op_counts)
Expand Down
79 changes: 40 additions & 39 deletions src/core/ops.h
Expand Up @@ -851,45 +851,46 @@
#define MVM_OP_sp_bind_i8 847
#define MVM_OP_sp_bind_n 848
#define MVM_OP_sp_bind_s 849
#define MVM_OP_sp_p6oget_o 850
#define MVM_OP_sp_p6ogetvt_o 851
#define MVM_OP_sp_p6ogetvc_o 852
#define MVM_OP_sp_p6oget_i 853
#define MVM_OP_sp_p6oget_n 854
#define MVM_OP_sp_p6oget_s 855
#define MVM_OP_sp_p6oget_bi 856
#define MVM_OP_sp_p6obind_o 857
#define MVM_OP_sp_p6obind_i 858
#define MVM_OP_sp_p6obind_n 859
#define MVM_OP_sp_p6obind_s 860
#define MVM_OP_sp_fastbox_i 861
#define MVM_OP_sp_fastbox_bi 862
#define MVM_OP_sp_fastbox_i_ic 863
#define MVM_OP_sp_fastbox_bi_ic 864
#define MVM_OP_sp_deref_get_i64 865
#define MVM_OP_sp_deref_get_n 866
#define MVM_OP_sp_deref_bind_i64 867
#define MVM_OP_sp_deref_bind_n 868
#define MVM_OP_sp_getlexvia_o 869
#define MVM_OP_sp_getlexvia_ins 870
#define MVM_OP_sp_getstringfrom 871
#define MVM_OP_sp_getwvalfrom 872
#define MVM_OP_sp_jit_enter 873
#define MVM_OP_sp_boolify_iter 874
#define MVM_OP_sp_boolify_iter_arr 875
#define MVM_OP_sp_boolify_iter_hash 876
#define MVM_OP_sp_cas_o 877
#define MVM_OP_sp_atomicload_o 878
#define MVM_OP_sp_atomicstore_o 879
#define MVM_OP_prof_enter 880
#define MVM_OP_prof_enterspesh 881
#define MVM_OP_prof_enterinline 882
#define MVM_OP_prof_enternative 883
#define MVM_OP_prof_exit 884
#define MVM_OP_prof_allocated 885
#define MVM_OP_ctw_check 886
#define MVM_OP_coverage_log 887
#define MVM_OP_breakpoint 888
#define MVM_OP_sp_bind_s_nowb 850
#define MVM_OP_sp_p6oget_o 851
#define MVM_OP_sp_p6ogetvt_o 852
#define MVM_OP_sp_p6ogetvc_o 853
#define MVM_OP_sp_p6oget_i 854
#define MVM_OP_sp_p6oget_n 855
#define MVM_OP_sp_p6oget_s 856
#define MVM_OP_sp_p6oget_bi 857
#define MVM_OP_sp_p6obind_o 858
#define MVM_OP_sp_p6obind_i 859
#define MVM_OP_sp_p6obind_n 860
#define MVM_OP_sp_p6obind_s 861
#define MVM_OP_sp_fastbox_i 862
#define MVM_OP_sp_fastbox_bi 863
#define MVM_OP_sp_fastbox_i_ic 864
#define MVM_OP_sp_fastbox_bi_ic 865
#define MVM_OP_sp_deref_get_i64 866
#define MVM_OP_sp_deref_get_n 867
#define MVM_OP_sp_deref_bind_i64 868
#define MVM_OP_sp_deref_bind_n 869
#define MVM_OP_sp_getlexvia_o 870
#define MVM_OP_sp_getlexvia_ins 871
#define MVM_OP_sp_getstringfrom 872
#define MVM_OP_sp_getwvalfrom 873
#define MVM_OP_sp_jit_enter 874
#define MVM_OP_sp_boolify_iter 875
#define MVM_OP_sp_boolify_iter_arr 876
#define MVM_OP_sp_boolify_iter_hash 877
#define MVM_OP_sp_cas_o 878
#define MVM_OP_sp_atomicload_o 879
#define MVM_OP_sp_atomicstore_o 880
#define MVM_OP_prof_enter 881
#define MVM_OP_prof_enterspesh 882
#define MVM_OP_prof_enterinline 883
#define MVM_OP_prof_enternative 884
#define MVM_OP_prof_exit 885
#define MVM_OP_prof_allocated 886
#define MVM_OP_ctw_check 887
#define MVM_OP_coverage_log 888
#define MVM_OP_breakpoint 889

#define MVM_OP_EXT_BASE 1024
#define MVM_OP_EXT_CU_LIMIT 1024
Expand Down
1 change: 1 addition & 0 deletions src/jit/graph.c
Expand Up @@ -1729,6 +1729,7 @@ static MVMint32 consume_ins(MVMThreadContext *tc, MVMJitGraph *jg,
case MVM_OP_sp_bind_i64:
case MVM_OP_sp_bind_n:
case MVM_OP_sp_bind_s:
case MVM_OP_sp_bind_s_nowb:
case MVM_OP_sp_bind_o:
case MVM_OP_sp_get_i64:
case MVM_OP_sp_get_n:
Expand Down
1 change: 1 addition & 0 deletions src/jit/x64/emit.dasc
Expand Up @@ -760,6 +760,7 @@ void MVM_jit_emit_primitive(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJ
case MVM_OP_sp_bind_i64:
case MVM_OP_sp_bind_n:
case MVM_OP_sp_bind_s:
case MVM_OP_sp_bind_s_nowb:
case MVM_OP_sp_bind_o: {
MVMint16 obj = ins->operands[0].reg.orig;
MVMint16 offset = ins->operands[1].lit_i16;
Expand Down

0 comments on commit a302b04

Please sign in to comment.