Skip to content

Commit

Permalink
RIP nqp::p6decodelocaltime
Browse files Browse the repository at this point in the history
It was not being used, and NQP itself provides nqp::decodelocaltime
  • Loading branch information
lizmat committed Feb 12, 2020
1 parent 9f71002 commit e2ba546
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 62 deletions.
2 changes: 0 additions & 2 deletions src/vm/js/Perl6/Ops.nqp
Expand Up @@ -152,8 +152,6 @@ $ops.add_op('p6decontrv', :!inlinable, sub ($comp, $node, :$want) {
});


$ops.add_simple_op('p6decodelocaltime', $ops.OBJ, [$ops.INT], :side_effects); # TODO not really :side_effects just needs marking as returning a fresh value

$ops.add_simple_op('p6finddispatcher', $ops.OBJ, [$ops.STR], :side_effects, sub ($usage) {
"/*await*/ nqp.op.p6finddispatcher({$*BLOCK.ctx}, $usage)"
});
Expand Down
1 change: 0 additions & 1 deletion src/vm/jvm/Perl6/Ops.nqp
Expand Up @@ -145,7 +145,6 @@ $ops.add_hll_op('Raku', 'p6argvmarray', -> $qastcomp, $op {
$ops.map_classlib_hll_op('Raku', 'p6bindattrinvres', $TYPE_P6OPS, 'p6bindattrinvres', [$RT_OBJ, $RT_OBJ, $RT_STR, $RT_OBJ], $RT_OBJ, :tc);
$ops.map_classlib_hll_op('Raku', 'p6finddispatcher', $TYPE_P6OPS, 'p6finddispatcher', [$RT_STR], $RT_OBJ, :tc);
$ops.map_classlib_hll_op('Raku', 'p6argsfordispatcher', $TYPE_P6OPS, 'p6argsfordispatcher', [$RT_OBJ], $RT_OBJ, :tc);
$ops.map_classlib_hll_op('Raku', 'p6decodelocaltime', $TYPE_P6OPS, 'p6decodelocaltime', [$RT_INT], $RT_OBJ, :tc);
$ops.map_classlib_hll_op('Raku', 'p6setautothreader', $TYPE_P6OPS, 'p6setautothreader', [$RT_OBJ], $RT_OBJ, :tc);
$ops.map_classlib_hll_op('Raku', 'tclc', $TYPE_P6OPS, 'tclc', [$RT_STR], $RT_STR, :tc);
$ops.map_classlib_hll_op('Raku', 'p6sort', $TYPE_P6OPS, 'p6sort', [$RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);
Expand Down
24 changes: 0 additions & 24 deletions src/vm/jvm/runtime/org/perl6/rakudo/RakOps.java
Expand Up @@ -623,30 +623,6 @@ public static SixModelObject p6argsfordispatcher(SixModelObject disp, ThreadCont
return result;
}

public static SixModelObject p6decodelocaltime(long sinceEpoch, ThreadContext tc) {
// Get calendar for current local host's timezone.
Calendar c = Calendar.getInstance();
c.setTimeInMillis(sinceEpoch * 1000);

// Populate result int array.
SixModelObject BOOTIntArray = tc.gc.BOOTIntArray;
SixModelObject result = BOOTIntArray.st.REPR.allocate(tc, BOOTIntArray.st);
tc.native_i = c.get(Calendar.SECOND);
result.bind_pos_native(tc, 0);
tc.native_i = c.get(Calendar.MINUTE);
result.bind_pos_native(tc, 1);
tc.native_i = c.get(Calendar.HOUR_OF_DAY);
result.bind_pos_native(tc, 2);
tc.native_i = c.get(Calendar.DAY_OF_MONTH);
result.bind_pos_native(tc, 3);
tc.native_i = c.get(Calendar.MONTH) + 1;
result.bind_pos_native(tc, 4);
tc.native_i = c.get(Calendar.YEAR);
result.bind_pos_native(tc, 5);

return result;
}

public static SixModelObject p6staticouter(SixModelObject code, ThreadContext tc) {
if (code instanceof CodeRef)
return ((CodeRef)code).staticInfo.outerStaticInfo.staticCode;
Expand Down
4 changes: 0 additions & 4 deletions src/vm/moar/Perl6/Ops.nqp
Expand Up @@ -54,9 +54,6 @@ MAST::ExtOpRegistry.register_extop('p6finddispatcher',
MAST::ExtOpRegistry.register_extop('p6argsfordispatcher',
$MVM_operand_obj +| $MVM_operand_write_reg,
$MVM_operand_obj +| $MVM_operand_read_reg);
MAST::ExtOpRegistry.register_extop('p6decodelocaltime',
$MVM_operand_obj +| $MVM_operand_write_reg,
$MVM_operand_int64 +| $MVM_operand_read_reg);
MAST::ExtOpRegistry.register_extop('p6staticouter',
$MVM_operand_obj +| $MVM_operand_write_reg,
$MVM_operand_obj +| $MVM_operand_read_reg);
Expand Down Expand Up @@ -236,7 +233,6 @@ $ops.add_hll_op('Raku', 'p6bindattrinvres', -> $qastcomp, $op {
});
$ops.add_hll_moarop_mapping('Raku', 'p6finddispatcher', 'p6finddispatcher');
$ops.add_hll_moarop_mapping('Raku', 'p6argsfordispatcher', 'p6argsfordispatcher');
$ops.add_hll_moarop_mapping('Raku', 'p6decodelocaltime', 'p6decodelocaltime');
$ops.add_hll_moarop_mapping('Raku', 'p6staticouter', 'p6staticouter');
$ops.add_hll_op('Raku', 'p6invokehandler', -> $qastcomp, $op {
$qastcomp.as_mast(QAST::Op.new( :op('call'), $op[0], $op[1] ));
Expand Down
31 changes: 0 additions & 31 deletions src/vm/moar/ops/perl6_ops.c
Expand Up @@ -354,36 +354,6 @@ static void p6argsfordispatcher(MVMThreadContext *tc, MVMuint8 *cur_op) {
MVM_exception_throw_adhoc(tc, "Could not find arguments for dispatcher");
}

static MVMuint8 s_p6decodelocaltime[] = {
MVM_operand_obj | MVM_operand_write_reg,
MVM_operand_int64 | MVM_operand_read_reg
};
static void p6decodelocaltime(MVMThreadContext *tc, MVMuint8 *cur_op) {
MVMObject *result = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTIntArray);
const time_t t = (time_t)GET_REG(tc, 2).i64;
struct tm tm;
#ifdef _WIN32
tm = *localtime(&t);
#else
localtime_r(&t, &tm);
#endif

MVMROOT(tc, result, {
REPR(result)->pos_funcs.set_elems(tc, STABLE(result), result, OBJECT_BODY(result), 9);
MVM_repr_bind_pos_i(tc, result, 0, (&tm)->tm_sec);
MVM_repr_bind_pos_i(tc, result, 1, (&tm)->tm_min);
MVM_repr_bind_pos_i(tc, result, 2, (&tm)->tm_hour);
MVM_repr_bind_pos_i(tc, result, 3, (&tm)->tm_mday);
MVM_repr_bind_pos_i(tc, result, 4, (&tm)->tm_mon + 1);
MVM_repr_bind_pos_i(tc, result, 5, (&tm)->tm_year + 1900);
MVM_repr_bind_pos_i(tc, result, 6, (&tm)->tm_wday);
MVM_repr_bind_pos_i(tc, result, 7, (&tm)->tm_yday);
MVM_repr_bind_pos_i(tc, result, 8, (&tm)->tm_isdst);
});

GET_REG(tc, 0).o = result;
}

static MVMuint8 s_p6staticouter[] = {
MVM_operand_obj | MVM_operand_write_reg,
MVM_operand_obj | MVM_operand_read_reg
Expand Down Expand Up @@ -447,7 +417,6 @@ MVM_DLL_EXPORT void Rakudo_ops_init(MVMThreadContext *tc) {
MVM_ext_register_extop(tc, "p6inpre", p6inpre, 1, s_p6inpre, NULL, NULL, 0);
MVM_ext_register_extop(tc, "p6finddispatcher", p6finddispatcher, 2, s_p6finddispatcher, NULL, NULL, MVM_EXTOP_NO_JIT);
MVM_ext_register_extop(tc, "p6argsfordispatcher", p6argsfordispatcher, 2, s_p6argsfordispatcher, NULL, NULL, 0);
MVM_ext_register_extop(tc, "p6decodelocaltime", p6decodelocaltime, 2, s_p6decodelocaltime, NULL, NULL, MVM_EXTOP_ALLOCATING);
MVM_ext_register_extop(tc, "p6staticouter", p6staticouter, 2, s_p6staticouter, NULL, NULL, 0);
MVM_ext_register_extop(tc, "p6invokeunder", p6invokeunder, 3, s_p6invokeunder, NULL, NULL, MVM_EXTOP_NO_JIT);
}

0 comments on commit e2ba546

Please sign in to comment.