Skip to content

Commit 2ac90f3

Browse files
committed
Implement neg_I and abs_I for JVM.
1 parent d228c92 commit 2ac90f3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/vm/jvm/QAST/Compiler.nqp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,8 +1568,10 @@ QAST::OperationsJAST.map_jvm_core_op('mod_n', 'drem', [$RT_NUM, $RT_NUM], $RT_NU
15681568
QAST::OperationsJAST.map_classlib_core_op('pow_n', $TYPE_MATH, 'pow', [$RT_NUM, $RT_NUM], $RT_NUM);
15691569
QAST::OperationsJAST.map_classlib_core_op('pow_I', $TYPE_OPS, 'pow_I', [$RT_OBJ, $RT_OBJ, $RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);
15701570
QAST::OperationsJAST.map_jvm_core_op('neg_i', 'lneg', [$RT_INT], $RT_INT);
1571+
QAST::OperationsJAST.map_classlib_core_op('neg_I', $TYPE_OPS, 'neg_I', [$RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);
15711572
QAST::OperationsJAST.map_jvm_core_op('neg_n', 'dneg', [$RT_NUM], $RT_NUM);
15721573
QAST::OperationsJAST.map_classlib_core_op('abs_i', $TYPE_MATH, 'abs', [$RT_INT], $RT_INT);
1574+
QAST::OperationsJAST.map_classlib_core_op('abs_I', $TYPE_OPS, 'abs_I', [$RT_OBJ, $RT_OBJ], $RT_OBJ, :tc);
15731575
QAST::OperationsJAST.map_classlib_core_op('abs_n', $TYPE_MATH, 'abs', [$RT_NUM], $RT_NUM);
15741576

15751577
QAST::OperationsJAST.map_classlib_core_op('ceil_n', $TYPE_MATH, 'ceil', [$RT_NUM], $RT_NUM);

src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3387,6 +3387,14 @@ else if (cmp > 0) {
33873387
}
33883388
}
33893389

3390+
public static SixModelObject neg_I(SixModelObject a, SixModelObject type, ThreadContext tc) {
3391+
return makeBI(tc, type, getBI(tc, a).negate());
3392+
}
3393+
3394+
public static SixModelObject abs_I(SixModelObject a, SixModelObject type, ThreadContext tc) {
3395+
return makeBI(tc, type, getBI(tc, a).abs());
3396+
}
3397+
33903398
public static SixModelObject bitor_I(SixModelObject a, SixModelObject b, SixModelObject type, ThreadContext tc) {
33913399
return makeBI(tc, type, getBI(tc, a).or(getBI(tc, b)));
33923400
}

0 commit comments

Comments
 (0)