Skip to content

Commit

Permalink
Add a way to specify a type needs finalization.
Browse files Browse the repository at this point in the history
Nothing is done with this information as of yet, except storing it on
the type's STable.
  • Loading branch information
jnthn committed Sep 5, 2014
1 parent 64f5ecb commit 92a3472
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 130 deletions.
2 changes: 2 additions & 0 deletions build/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ OBJECTS = src/core/callsite@obj@ \
src/gc/gen2@obj@ \
src/gc/wb@obj@ \
src/gc/objectid@obj@ \
src/gc/finalize@obj@ \
src/io/io@obj@ \
src/io/eventloop@obj@ \
src/io/syncfile@obj@ \
Expand Down Expand Up @@ -239,6 +240,7 @@ HEADERS = src/moar.h \
src/gc/gen2.h \
src/gc/wb.h \
src/gc/objectid.h \
src/gc/finalize.h \
src/6model/reprs.h \
src/6model/reprconv.h \
src/6model/bootstrap.h \
Expand Down
164 changes: 85 additions & 79 deletions lib/MAST/Ops.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -620,50 +620,51 @@ BEGIN {
1480,
1482,
1484,
1484,
1486,
1486,
1488,
1491,
1494,
1490,
1493,
1496,
1498,
1500,
1502,
1504,
1507,
1510,
1513,
1516,
1517,
1506,
1509,
1512,
1515,
1518,
1519,
1523,
1526,
1529,
1532,
1535,
1538,
1541,
1544,
1547,
1550,
1553,
1557,
1561,
1564,
1567,
1570,
1573,
1576,
1579,
1582,
1583,
1521,
1525,
1528,
1531,
1534,
1537,
1540,
1543,
1546,
1549,
1552,
1555,
1559,
1563,
1566,
1569,
1572,
1575,
1578,
1581,
1584,
1585,
1587,
1589,
1589,
1589,
1590,
1590);
1591,
1591,
1591,
1592,
1592);
MAST::Ops.WHO<@counts> := nqp::list_i(0,
2,
2,
Expand Down Expand Up @@ -1280,6 +1281,7 @@ BEGIN {
1,
2,
2,
2,
0,
2,
2,
Expand Down Expand Up @@ -2808,6 +2810,8 @@ BEGIN {
34,
65,
65,
33,
65,
128,
65,
128,
Expand Down Expand Up @@ -3531,52 +3535,53 @@ BEGIN {
'startprofile', 612,
'endprofile', 613,
'objectid', 614,
'sp_log', 615,
'sp_osrfinalize', 616,
'sp_guardconc', 617,
'sp_guardtype', 618,
'sp_guardcontconc', 619,
'sp_guardconttype', 620,
'sp_getarg_o', 621,
'sp_getarg_i', 622,
'sp_getarg_n', 623,
'sp_getarg_s', 624,
'sp_fastinvoke_v', 625,
'sp_fastinvoke_i', 626,
'sp_fastinvoke_n', 627,
'sp_fastinvoke_s', 628,
'sp_fastinvoke_o', 629,
'sp_namedarg_used', 630,
'sp_getspeshslot', 631,
'sp_findmeth', 632,
'sp_fastcreate', 633,
'sp_get_o', 634,
'sp_get_i', 635,
'sp_get_n', 636,
'sp_get_s', 637,
'sp_bind_o', 638,
'sp_bind_i', 639,
'sp_bind_n', 640,
'sp_bind_s', 641,
'sp_p6oget_o', 642,
'sp_p6ogetvt_o', 643,
'sp_p6ogetvc_o', 644,
'sp_p6oget_i', 645,
'sp_p6oget_n', 646,
'sp_p6oget_s', 647,
'sp_p6obind_o', 648,
'sp_p6obind_i', 649,
'sp_p6obind_n', 650,
'sp_p6obind_s', 651,
'sp_jit_enter', 652,
'sp_boolify_iter', 653,
'sp_boolify_iter_arr', 654,
'sp_boolify_iter_hash', 655,
'prof_enter', 656,
'prof_enterspesh', 657,
'prof_enterinline', 658,
'prof_exit', 659,
'prof_allocated', 660);
'settypefinalize', 615,
'sp_log', 616,
'sp_osrfinalize', 617,
'sp_guardconc', 618,
'sp_guardtype', 619,
'sp_guardcontconc', 620,
'sp_guardconttype', 621,
'sp_getarg_o', 622,
'sp_getarg_i', 623,
'sp_getarg_n', 624,
'sp_getarg_s', 625,
'sp_fastinvoke_v', 626,
'sp_fastinvoke_i', 627,
'sp_fastinvoke_n', 628,
'sp_fastinvoke_s', 629,
'sp_fastinvoke_o', 630,
'sp_namedarg_used', 631,
'sp_getspeshslot', 632,
'sp_findmeth', 633,
'sp_fastcreate', 634,
'sp_get_o', 635,
'sp_get_i', 636,
'sp_get_n', 637,
'sp_get_s', 638,
'sp_bind_o', 639,
'sp_bind_i', 640,
'sp_bind_n', 641,
'sp_bind_s', 642,
'sp_p6oget_o', 643,
'sp_p6ogetvt_o', 644,
'sp_p6ogetvc_o', 645,
'sp_p6oget_i', 646,
'sp_p6oget_n', 647,
'sp_p6oget_s', 648,
'sp_p6obind_o', 649,
'sp_p6obind_i', 650,
'sp_p6obind_n', 651,
'sp_p6obind_s', 652,
'sp_jit_enter', 653,
'sp_boolify_iter', 654,
'sp_boolify_iter_arr', 655,
'sp_boolify_iter_hash', 656,
'prof_enter', 657,
'prof_enterspesh', 658,
'prof_enterinline', 659,
'prof_exit', 660,
'prof_allocated', 661);
MAST::Ops.WHO<@names> := nqp::list('no_op',
'const_i8',
'const_i16',
Expand Down Expand Up @@ -4192,6 +4197,7 @@ BEGIN {
'startprofile',
'endprofile',
'objectid',
'settypefinalize',
'sp_log',
'sp_osrfinalize',
'sp_guardconc',
Expand Down
7 changes: 5 additions & 2 deletions src/6model/6model.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@
* While a normal type check asks a value if it supports another type, the
* TYPE_CHECK_NEEDS_ACCEPTS flag results in a call to .accepts_type on the
* HOW of the thing we're checking the value against, giving it a chance to
* decide answer. */
* decide answer. These are set as the lower bits of mode_flags in MVMSTable. */
#define MVM_TYPE_CHECK_CACHE_DEFINITIVE 0
#define MVM_TYPE_CHECK_CACHE_THEN_METHOD 1
#define MVM_TYPE_CHECK_NEEDS_ACCEPTS 2
#define MVM_TYPE_CHECK_CACHE_FLAG_MASK 3

/* This flag is set if we consider the method cache authoritative. */
/* This STable mode flag is set if we consider the method cache authoritative. */
#define MVM_METHOD_CACHE_AUTHORITATIVE 4

/* This STable mode flag is set if the type needs finalization. */
#define MVM_FINALIZE_TYPE 8

/* HLL type roles. */
#define MVM_HLL_ROLE_NONE 0
#define MVM_HLL_ROLE_INT 1
Expand Down
4 changes: 4 additions & 0 deletions src/core/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4302,6 +4302,10 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
GET_REG(cur_op, 0).i64 = (MVMint64)MVM_gc_object_id(tc, GET_REG(cur_op, 2).o);
cur_op += 4;
goto NEXT;
OP(settypefinalize):
MVM_gc_finalize_set(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).i64);
cur_op += 4;
goto NEXT;
OP(sp_log):
if (tc->cur_frame->spesh_log_idx >= 0) {
MVM_ASSIGN_REF(tc, &(tc->cur_frame->static_info->common.header),
Expand Down
2 changes: 1 addition & 1 deletion src/core/oplabels.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ static const void * const LABELS[] = {
&&OP_startprofile,
&&OP_endprofile,
&&OP_objectid,
&&OP_settypefinalize,
&&OP_sp_log,
&&OP_sp_osrfinalize,
&&OP_sp_guardconc,
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
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ killprocasync r(obj) r(int64)
startprofile r(obj)
endprofile w(obj)
objectid w(int64) r(obj)
settypefinalize r(obj) r(int64)

# Spesh ops. Naming convention: start with sp_. Must all be marked .s, which
# is how the validator knows to exclude them.
Expand Down
14 changes: 12 additions & 2 deletions src/core/ops.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "moar.h"

/* This file is generated from src/core/oplist by tools/update_ops.p6. */
static const MVMOpInfo MVM_op_infos[] = {
{
Expand Down Expand Up @@ -6758,6 +6757,17 @@ static const MVMOpInfo MVM_op_infos[] = {
0,
{ MVM_operand_write_reg | MVM_operand_int64, MVM_operand_read_reg | MVM_operand_obj }
},
{
MVM_OP_settypefinalize,
"settypefinalize",
" ",
2,
0,
0,
0,
0,
{ MVM_operand_read_reg | MVM_operand_obj, MVM_operand_read_reg | MVM_operand_int64 }
},
{
MVM_OP_sp_log,
"sp_log",
Expand Down Expand Up @@ -7262,7 +7272,7 @@ static const MVMOpInfo MVM_op_infos[] = {
},
};

static const unsigned short MVM_op_counts = 661;
static const unsigned short MVM_op_counts = 662;

MVM_PUBLIC const MVMOpInfo * MVM_op_get_op(unsigned short op) {
if (op >= MVM_op_counts)
Expand Down

0 comments on commit 92a3472

Please sign in to comment.