[strongtalk] r183 committed - LargeInteger primitive support for division and bit ops

0 views
Skip to first unread message

codesite...@google.com

unread,
Dec 6, 2009, 4:17:18 PM12/6/09
to strongta...@googlegroups.com
Revision: 183
Author: StephenLRees
Date: Sun Dec 6 13:13:11 2009
Log: LargeInteger primitive support for division and bit ops
http://code.google.com/p/strongtalk/source/detail?r=183

Added:
/branches/gcc-linux/test/prims/integerOpsTests.cpp
/branches/gcc-linux/test/prims/largeIntegerByteArrayPrimTests.cpp
Modified:
/branches/gcc-linux/test/main/main.cpp
/branches/gcc-linux/vm/compiler/node.hpp
/branches/gcc-linux/vm/prims/byteArray_prims.cpp
/branches/gcc-linux/vm/prims/byteArray_prims.hpp
/branches/gcc-linux/vm/prims/integerOps.cpp
/branches/gcc-linux/vm/prims/integerOps.hpp
/branches/gcc-linux/vm/prims/prims.inc

=======================================
--- /dev/null
+++ /branches/gcc-linux/test/prims/integerOpsTests.cpp Sun Dec 6 13:13:11
2009
@@ -0,0 +1,784 @@
+# include "incls/_precompiled.incl"
+# include "incls/_integerOps.cpp.incl"
+#include "test.h"
+
+using namespace easyunit;
+
+DECLARE(IntegerOpsTest)
+ResourceMark rm;
+Integer *x, *y, *z;
+
+#define ASSERT_EQUALS_M2(expected, actual, prefix)\
+ ASSERT_EQUALS_M(expected, actual, report(prefix, expected, actual))
+#define ASSERT_EQUALS_MH(expected, actual, prefix)\
+ ASSERT_EQUALS_M(expected, actual, reportHex(prefix, expected, actual))
+#define ASSERT_EQUALS_MS(expected, actual, prefix)\
+ ASSERT_TRUE_M(!strcmp(expected, actual), report(prefix, expected,
actual))
+#define CHECK_SIZE(op, first, second, expected)\
+ IntegerOps::string_to_Integer(first, 16, *x);\
+ IntegerOps::string_to_Integer(second, 16, *y);\
+ ASSERT_EQUALS_M2(expected, IntegerOps::op(*x, *y), "Wrong size")
+#define CHECK_AND_SIZE(first, second, expected)\
+ CHECK_SIZE(and_result_size_in_bytes, first, second, expected)
+#define CHECK_OR_SIZE(first, second, expected)\
+ CHECK_SIZE(or_result_size_in_bytes, first, second, expected)
+#define CHECK_XOR_SIZE(first, second, expected)\
+ CHECK_SIZE(xor_result_size_in_bytes, first, second, expected)
+#define CHECK_OP(op, first, second, expected)\
+ IntegerOps::string_to_Integer(first, 16, *x);\
+ IntegerOps::string_to_Integer(second, 16, *y);\
+ IntegerOps::op(*x, *y, *z);\
+ char result[100];\
+ IntegerOps::Integer_to_string(*z, 16, result);\
+ ASSERT_TRUE_M(z->is_valid(), "Not a valid Integer");\
+ ASSERT_EQUALS_MS(expected, result , "Wrong result")
+#define CHECK_AND(first, second, expected)\
+ CHECK_OP(and, first, second, expected)
+#define CHECK_OR(first, second, expected)\
+ CHECK_OP(or, first, second, expected)
+#define CHECK_XOR(first, second, expected)\
+ CHECK_OP(xor, first, second, expected)
+#define CHECK_ASH_SIZE(first, second, expected)\
+ IntegerOps::string_to_Integer(first, 16, *x);\
+ ASSERT_EQUALS_M2(expected, IntegerOps::ash_result_size_in_bytes(*x,
second) , "Wrong result")
+#define CHECK_ASH(first, second, expected)\
+ IntegerOps::string_to_Integer(first, 16, *x);\
+ IntegerOps::ash(*x, second, *z);\
+ char result[100];\
+ IntegerOps::Integer_to_string(*z, 16, result);\
+ ASSERT_TRUE_M(z->is_valid(), "Not a valid Integer");\
+ ASSERT_EQUALS_MS(expected, result , "Wrong result")
+
+char message[100];
+char* reportHex(char*prefix, int expected, int actual) {
+ sprintf(message, "%s. Expected: 0x%x, but was: 0x%x", prefix, expected,
actual);
+ return message;
+}
+char* report(char*prefix, int expected, int actual) {
+ sprintf(message, "%s. Expected: %d, but was: %d", prefix, expected,
actual);
+ return message;
+}
+char* report(char*prefix, char* expected, char* actual) {
+ sprintf(message, "%s. Expected: %s, but was: %s", prefix, expected,
actual);
+ return message;
+}
+END_DECLARE
+
+SETUP(IntegerOpsTest) {
+ x = (Integer*)NEW_RESOURCE_ARRAY(Digit, 5);
+ y = (Integer*)NEW_RESOURCE_ARRAY(Digit, 5);
+ z = (Integer*)NEW_RESOURCE_ARRAY(Digit, 5);
+}
+TEARDOWN(IntegerOpsTest){
+}
+
+TESTF(IntegerOpsTest, largeIntegerDivShouldReturnZeroWhenYLargerThanX) {
+ IntegerOps::int_to_Integer(1, *x);
+ IntegerOps::int_to_Integer(2, *y);
+ IntegerOps::div(*x, *y, *z);
+
+ bool ok;
+ int result = z->as_int(ok);
+ ASSERT_TRUE_M(ok, "invalid Integer");
+ ASSERT_EQUALS_M(0, result, "wrong result");
+}
+TESTF(IntegerOpsTest, largeIntegerDivShouldReturnZeroWhenAbsYLargerThanX) {
+ IntegerOps::int_to_Integer(1, *x);
+ IntegerOps::int_to_Integer(-2, *y);
+ IntegerOps::div(*x, *y, *z);
+
+ bool ok;
+ int result = z->as_int(ok);
+ ASSERT_TRUE_M(ok, "invalid Integer");
+ ASSERT_EQUALS_M2(-1, result, "wrong result");
+}
+TESTF(IntegerOpsTest,
largeIntegerDivShouldReturnMinus1WhenYLargerThanAbsX) {
+ IntegerOps::int_to_Integer(-1, *x);
+ IntegerOps::int_to_Integer(2, *y);
+ IntegerOps::div(*x, *y, *z);
+
+ bool ok;
+ int result = z->as_int(ok);
+ ASSERT_TRUE_M(ok, "invalid Integer");
+ ASSERT_EQUALS_M2(-1, result, "wrong result");
+}
+TESTF(IntegerOpsTest,
largeIntegerDivShouldReturnZeroWhenAbsYLargerThanAbsX) {
+ IntegerOps::int_to_Integer(-1, *x);
+ IntegerOps::int_to_Integer(-2, *y);
+ IntegerOps::div(*x, *y, *z);
+
+ bool ok;
+ int result = z->as_int(ok);
+ ASSERT_TRUE_M(ok, "invalid Integer");
+ ASSERT_EQUALS_M(0, result, "wrong result");
+}
+TESTF(IntegerOpsTest, largeIntegerDivShouldReturnM1WhenAbsYEqualsX) {
+ IntegerOps::int_to_Integer(2, *x);
+ IntegerOps::int_to_Integer(-2, *y);
+ IntegerOps::div(*x, *y, *z);
+
+ bool ok;
+ int result = z->as_int(ok);
+ ASSERT_TRUE_M(ok, "invalid Integer");
+ ASSERT_EQUALS_M(-1, result, "wrong result");
+}
+TESTF(IntegerOpsTest, xpyShouldHandleAllBitsPlus1) {
+ Digit x = 0xffffffff;
+ Digit y = 1;
+ Digit c = 0;
+ ASSERT_EQUALS_M(0, IntegerOps::xpy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(1, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xpyShouldHandle1PlusAllBits) {
+ Digit x = 1;
+ Digit y = 0xffffffff;
+ Digit c = 0;
+ ASSERT_EQUALS_M(0, IntegerOps::xpy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(1, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xpyShouldHandleAllBitsPlusAllBitsPlusAllBits) {
+ Digit x = 0xffffffff;
+ Digit y = 0xffffffff;
+ Digit c = 0xffffffff;
+ ASSERT_EQUALS_M(0xfffffffd, IntegerOps::xpy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(2, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xmyShouldHandle0Minus1) {
+ Digit x = 0;
+ Digit y = 1;
+ Digit c = 0;
+ ASSERT_EQUALS_M(0xffffffff, IntegerOps::xmy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(1, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xmyShouldHandle0Minus0) {
+ Digit x = 0;
+ Digit y = 0;
+ Digit c = 0;
+ ASSERT_EQUALS_M(0, IntegerOps::xmy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(0, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xmyShouldHandle0Minus0Carry1) {
+ Digit x = 0;
+ Digit y = 0;
+ Digit c = 1;
+ ASSERT_EQUALS_M(0xffffffff, IntegerOps::xmy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(1, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xmyShouldHandle0MinusAllOnesCarry1) {
+ Digit x = 0;
+ Digit y = 0xffffffff;
+ Digit c = 1;
+ ASSERT_EQUALS_M(0, IntegerOps::xmy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(1, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, axpyShouldHandleAllOnes) {
+ Digit a = 0xffffffff;
+ Digit x = 0xffffffff;
+ Digit y = 0xffffffff;
+ Digit c = 0xffffffff;
+ ASSERT_EQUALS_M(0xffffffff, IntegerOps::axpy(a, x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(0xffffffff, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, axpyShouldHandleAllZeroes) {
+ Digit a = 0;
+ Digit x = 0;
+ Digit y = 0;
+ Digit c = 0;
+ ASSERT_EQUALS_M(0, IntegerOps::axpy(a, x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(0, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, axpyWithPieces) {
+ Digit a = 0xffff;
+ Digit x = 0x10000;
+ Digit y = 0xff00;
+ Digit c = 0x00ff;
+ ASSERT_EQUALS_M(0xffffffff, IntegerOps::axpy(a, x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(0, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xdyWithZeroShouldBeZero) {
+ Digit x = 0;
+ Digit y = 1;
+ Digit c = 0;
+ ASSERT_EQUALS_M(0, IntegerOps::xdy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(0, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xdyByTwoShouldHaveZeroCarry) {
+ Digit x = 0;
+ Digit y = 2;
+ Digit c = 1;
+ ASSERT_EQUALS_M(0x80000000, IntegerOps::xdy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(0, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xdyByTwoShouldHaveCarryWhenOdd) {
+ Digit x = 1;
+ Digit y = 2;
+ Digit c = 1;
+ ASSERT_EQUALS_M(0x80000000, IntegerOps::xdy(x, y, c), "Wrong total");
+ ASSERT_EQUALS_M(1, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, xdyWithAllOnes) {
+ Digit x = 0xffffffff;
+ Digit y = 0x80000000;
+ Digit c = 1;
+ Digit result = IntegerOps::xdy(x, y, c);
+ ASSERT_EQUALS_M(3, result, report("Wrong total", 3, result));
+ ASSERT_EQUALS_M(0x7fffffff, c, "Wrong carry");
+}
+TESTF(IntegerOpsTest, qr_decompositionSimple) {
+ IntegerOps::unsigned_int_to_Integer(0xffffffff, *x);
+ IntegerOps::unsigned_int_to_Integer(1, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0, result[0], "Wrong remainder.");
+ ASSERT_EQUALS_M(0xffffffff, result[1], "Wrong quotient.");
+}
+TESTF(IntegerOpsTest, qr_decompositionSimpleWithRemainder) {
+ IntegerOps::unsigned_int_to_Integer(0xffffffff, *x);
+ IntegerOps::unsigned_int_to_Integer(0x80000000, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0x7fffffff, result[0], report("Wrong remainder",
0x7fffffff, result[0]));
+ ASSERT_EQUALS_M(1, result[1], report("Wrong quotient", 1, result[1]));
+}
+TESTF(IntegerOpsTest, qr_decompositionTwoDigitNoRemainder) {
+ IntegerOps::string_to_Integer("FFFFFFFF80000000", 16, *x);
+ IntegerOps::unsigned_int_to_Integer(0x80000000, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0, result[0], report("Wrong remainder", 0, result[0]));
+ ASSERT_EQUALS_M(0xffffffff, result[1], report("Wrong quotient word 1",
0xffffffff, result[1]));
+ ASSERT_EQUALS_M(1, result[2], report("Wrong quotient word 2", 1,
result[2]));
+}
+TESTF(IntegerOpsTest, qr_decompositionTwoDigitWithRemainder) {
+ IntegerOps::string_to_Integer("FFFFFFFFFFFFFFFF", 16, *x);
+ IntegerOps::unsigned_int_to_Integer(0x80000000, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0x7fffffff, result[0], report("Wrong remainder",
0x7fffffff, result[0]));
+ ASSERT_EQUALS_M(0xffffffff, result[1], report("Wrong quotient word 1",
0xffffffff, result[1]));
+ ASSERT_EQUALS_M(1, result[2], report("Wrong quotient word 2", 1,
result[2]));
+}
+TESTF(IntegerOpsTest, qr_decompositionThreeDigitWithRemainder) {
+ IntegerOps::string_to_Integer("FFFFFFFFFFFFFFFFFFFFFFFF", 16, *x);
+ IntegerOps::string_to_Integer("800000000000", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0xffffffff, result[0], report("Wrong remainder word 1",
0xffffffff, result[0]));
+ ASSERT_EQUALS_M(0x7fff, result[1], report("Wrong remainder word 2",
0x7fff, result[1]));
+ ASSERT_EQUALS_M(0xffffffff, result[2], report("Wrong quotient word 1",
0xffffffff, result[2]));
+ ASSERT_EQUALS_M(0x1ffff, result[3], report("Wrong quotient word 2",
0x1ffff, result[3]));
+}
+TESTF(IntegerOpsTest, qr_decompositionTwoDigitDivisorNoRemainder) {
+ IntegerOps::string_to_Integer("800000000000000000000000", 16, *x);
+ IntegerOps::string_to_Integer("8000000000000000", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0, result[0], report("Wrong remainder low word", 0,
result[0]));
+ ASSERT_EQUALS_M(0, result[1], report("Wrong remainder high word", 0,
result[1]));
+ ASSERT_EQUALS_M(0, result[2], report("Wrong quotient low word", 0,
result[2]));
+ ASSERT_EQUALS_M(1, result[3], report("Wrong quotient high word", 1,
result[3]));
+}
+TESTF(IntegerOpsTest, qr_decompositionScaledTwoDigitDivisorNoRemainder) {
+ IntegerOps::string_to_Integer("800000000000000000000000", 16, *x);
+ IntegerOps::string_to_Integer("0800000000000000", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0, result[0], report("Wrong remainder low word", 0,
result[0]));
+ ASSERT_EQUALS_M(0, result[1], report("Wrong remainder high word", 0,
result[1]));
+ ASSERT_EQUALS_M(0, result[2], report("Wrong quotient low word", 0,
result[2]));
+ ASSERT_EQUALS_M(0x10, result[3], report("Wrong quotient high word",
0x10, result[3]));
+}
+TESTF(IntegerOpsTest, qr_decompositionTwoDigitDivisorSmallRemainder) {
+ IntegerOps::string_to_Integer("800000000000000000000001", 16, *x);
+ IntegerOps::string_to_Integer("8000000000000000", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(1, result[0], report("Wrong remainder low word", 1,
result[0]));
+ ASSERT_EQUALS_M(0, result[1], report("Wrong remainder high word", 0,
result[1]));
+ ASSERT_EQUALS_M(0, result[2], report("Wrong quotient low word", 0,
result[2]));
+ ASSERT_EQUALS_M(1, result[3], report("Wrong quotient high word", 1,
result[3]));
+}
+TESTF(IntegerOpsTest,
qr_decompositionTwoDigitDivisorSmallAllOnesRemainder) {
+ IntegerOps::string_to_Integer("8000000000000000FFFFFFFF", 16, *x);
+ IntegerOps::string_to_Integer("8000000000000000", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0xffffffff, result[0], report("Wrong remainder low
word", 0xffffffff, result[0]));
+ ASSERT_EQUALS_M(0, result[1], report("Wrong remainder high word", 0,
result[1]));
+ ASSERT_EQUALS_M(0, result[2], report("Wrong quotient low word", 0,
result[2]));
+ ASSERT_EQUALS_M(1, result[3], report("Wrong quotient high word", 1,
result[3]));
+}
+TESTF(IntegerOpsTest, qr_decompositionTwoDigitDivisorTwoDigitRemainder) {
+ IntegerOps::string_to_Integer("8000000000007FFFFFFFFFFF", 16, *x);
+ IntegerOps::string_to_Integer("8000000000000000", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0xffffffff, result[0], report("Wrong remainder low
word", 0xffffffff, result[0]));
+ ASSERT_EQUALS_M(0x7fff, result[1], report("Wrong remainder high word",
0x7fff, result[1]));
+ ASSERT_EQUALS_M(0, result[2], report("Wrong quotient low word", 0,
result[2]));
+ ASSERT_EQUALS_M(1, result[3], report("Wrong quotient high word", 1,
result[3]));
+}
+TESTF(IntegerOpsTest,
qr_decompositionTwoNonZeroDigitDivisorTwoDigitRemainder) {
+ IntegerOps::string_to_Integer("FFFFFFFFFFFFFFF1FFFFFFFF", 16, *x);
+ IntegerOps::string_to_Integer("0FFFFFFFFFFFFFFF", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0xffffffff, result[0], report("Wrong remainder low
word", 0xffffffff, result[0]));
+ ASSERT_EQUALS_M(0x1, result[1], report("Wrong remainder high word", 0x1,
result[1]));
+ ASSERT_EQUALS_M(0, result[2], report("Wrong quotient low word", 0,
result[2]));
+ ASSERT_EQUALS_M(0x10, result[3], report("Wrong quotient high word",
0x10, result[3]));
+}
+TESTF(IntegerOpsTest, qr_decompositionFirstDigitsMatch) {
+ IntegerOps::string_to_Integer("FFFFFFFF0000000000000000", 16, *x);
+ IntegerOps::string_to_Integer("FFFFFFFF00000000", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0x00000000, result[0], report("Wrong remainder low
word", 0x00000000, result[0]));
+ ASSERT_EQUALS_M(0x0, result[1], report("Wrong remainder high word", 0x0,
result[1]));
+ ASSERT_EQUALS_M(0, result[2], report("Wrong quotient low word", 0,
result[2]));
+ ASSERT_EQUALS_M(0x1, result[3], report("Wrong quotient high word", 0x1,
result[3]));
+}
+TESTF(IntegerOpsTest, qr_decompositionComplexCase) {
+ IntegerOps::string_to_Integer("121FA00AD77D7422347E9A0F6729E011", 16,
*x);
+ IntegerOps::string_to_Integer("FEDCBA9876543210", 16, *y);
+
+ Digit* result = IntegerOps::qr_decomposition(*x, *y);
+ ASSERT_EQUALS_M(0x11111111, result[0], report("Wrong remainder low
word", 0x11111111, result[0]));
+ ASSERT_EQUALS_M(0x11111111, result[1], report("Wrong remainder high
word", 0x11111111, result[1]));
+ ASSERT_EQUALS_M(0x9ABCDEF0, result[2], report("Wrong quotient low word",
0x9ABCDEF0, result[2]));
+ ASSERT_EQUALS_M(0x12345678, result[3], report("Wrong quotient high
word", 0x12345678, result[3]));
+}
+TESTF(IntegerOpsTest, unsignedQuo) {
+ IntegerOps::string_to_Integer("121FA00AD77D7422347E9A0F6729E011", 16,
*x);
+ IntegerOps::string_to_Integer("FEDCBA9876543210", 16, *y);
+
+ IntegerOps::unsigned_quo(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("123456789abcdef0", result, "Wrong quotient");
+}
+TESTF(IntegerOpsTest, unsignedRem) {
+ IntegerOps::string_to_Integer("121FA00AD77D7422347E9A0F6729E011", 16,
*x);
+ IntegerOps::string_to_Integer("FEDCBA9876543210", 16, *y);
+
+ IntegerOps::unsigned_rem(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("1111111111111111", result, "Wrong remainder");
+}
+TESTF(IntegerOpsTest, unsignedRemWhenXIsShortThanY) {
+ IntegerOps::string_to_Integer("12345678", 16, *x);
+ IntegerOps::string_to_Integer("FEDCBA9876543210", 16, *y);
+
+ IntegerOps::unsigned_rem(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("12345678", result, "Wrong remainder");
+}
+TESTF(IntegerOpsTest, unsignedRemWithNoRemainder) {
+ IntegerOps::string_to_Integer("12345678", 16, *x);
+ IntegerOps::string_to_Integer("12345678", 16, *y);
+
+ IntegerOps::unsigned_rem(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_TRUE_M(z->is_zero(), "Remainder should be zero");
+}
+TESTF(IntegerOpsTest, divWithLargeDividendNegDivisorAndRemainder) {
+ IntegerOps::string_to_Integer("1234567809abcdef", 16, *x);
+ IntegerOps::string_to_Integer("-12345678", 16, *y);
+
+ IntegerOps::div(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("-100000001", result, "Wrong quotient");
+}
+TESTF(IntegerOpsTest, modWithLargeNegDividendAndRemainder) {
+ IntegerOps::string_to_Integer("-1234567809abcdef", 16, *x);
+ IntegerOps::string_to_Integer("12345678", 16, *y);
+
+ IntegerOps::mod(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("8888889", result, "Wrong remainder");
+}
+TESTF(IntegerOpsTest, modWithLargeNegDividendNegDivisorAndRemainder) {
+ IntegerOps::string_to_Integer("-1234567809abcdef", 16, *x);
+ IntegerOps::string_to_Integer("-12345678", 16, *y);
+
+ IntegerOps::mod(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("-9abcdef", result, "Wrong remainder");
+}
+TESTF(IntegerOpsTest, modWithLargeDividendNegDivisorAndRemainder) {
+ IntegerOps::string_to_Integer("1234567809abcdef", 16, *x);
+ IntegerOps::string_to_Integer("-12345678", 16, *y);
+
+ IntegerOps::mod(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("-8888889", result, "Wrong remainder");
+}
+TESTF(IntegerOpsTest, modWithLargeDividendNegDivisorAndNoRemainder) {
+ IntegerOps::string_to_Integer("1234567800000000", 16, *x);
+ IntegerOps::string_to_Integer("-12345678", 16, *y);
+
+ IntegerOps::mod(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("0", result, "Wrong remainder");
+}
+TESTF(IntegerOpsTest, modWithLongerDivisor) {
+ IntegerOps::string_to_Integer("12345678", 16, *x);
+ IntegerOps::string_to_Integer("-100000000", 16, *y);
+
+ ASSERT_TRUE_M(y->is_negative(), "Should be negative");
+ IntegerOps::mod(*x, *y, *z);
+ char result[100];
+ IntegerOps::Integer_to_string(*z, 16, result);
+
+ ASSERT_EQUALS_MS("-edcba988", result, "Wrong remainder");
+}
+TESTF(IntegerOpsTest, divResultSizeInBytesWithTwoPositiveIntegers) {
+ IntegerOps::string_to_Integer("123456781234567812345678", 16, *x);
+ IntegerOps::string_to_Integer("12345678", 16, *y);
+
+ int result = IntegerOps::div_result_size_in_bytes(*x, *y);
+
+ ASSERT_EQUALS_M2(sizeof(int) + (3 * sizeof(Digit)), result, "Wrong
size");
+}
+TESTF(IntegerOpsTest, divResultSizeInBytesWithTwoNegativeIntegers) {
+ IntegerOps::string_to_Integer("-123456781234567812345678", 16, *x);
+ IntegerOps::string_to_Integer("-12345678", 16, *y);
+
+ int result = IntegerOps::div_result_size_in_bytes(*x, *y);
+
+ ASSERT_EQUALS_M2(sizeof(int) + (3 * sizeof(Digit)), result, "Wrong
size");
+}
+TESTF(IntegerOpsTest, divResultSizeInBytesWithPosDividendAndNegDivisor) {
+ IntegerOps::string_to_Integer("123456781234567812345678", 16, *x);
+ IntegerOps::string_to_Integer("-12345678", 16, *y);
+
+ int result = IntegerOps::div_result_size_in_bytes(*x, *y);
+
+ ASSERT_EQUALS_M2(sizeof(int) + (4 * sizeof(Digit)), result, "Wrong
size");
+}
+TESTF(IntegerOpsTest, modResultSizeInBytesWithTwoPositiveIntegers) {
+ IntegerOps::string_to_Integer("123456781234567812345678", 16, *x);
+ IntegerOps::string_to_Integer("12345678", 16, *y);
+
+ int result = IntegerOps::mod_result_size_in_bytes(*x, *y);
+
+ ASSERT_EQUALS_M2(sizeof(int) + (1 * sizeof(Digit)), result, "Wrong
size");
+}
+TESTF(IntegerOpsTest, modResultSizeInBytesWithTwoNegativeIntegers) {
+ IntegerOps::string_to_Integer("-123456781234567812345678", 16, *x);
+ IntegerOps::string_to_Integer("-1234567812345678", 16, *y);
+
+ int result = IntegerOps::mod_result_size_in_bytes(*x, *y);
+
+ ASSERT_EQUALS_M2(sizeof(int) + (2 * sizeof(Digit)), result, "Wrong
size");
+}
+TESTF(IntegerOpsTest, orWithTwoPositive) {
+ CHECK_OR("1", "FFFFFFFF", "ffffffff");
+}
+TESTF(IntegerOpsTest, orWithFirstZero) {
+ CHECK_OR("0", "FFFFFFFF", "ffffffff");
+}
+TESTF(IntegerOpsTest, orWithSecondNegative) {
+ CHECK_OR("1", "-1", "-1");
+}
+TESTF(IntegerOpsTest, orWithSecondNegativeAndTwoDigits) {
+ CHECK_OR("1000000001", "-100000001", "-100000001");
+}
+TESTF(IntegerOpsTest, orWithFirstLongerSecondNegative) {
+ CHECK_OR("123456789a", "-1", "-1");
+}
+TESTF(IntegerOpsTest, orWithSecondLongerAndNegative) {
+ CHECK_OR("1", "-100000001", "-100000001");
+}
+TESTF(IntegerOpsTest, orWithFirstZeroAndSecondNegative) {
+ CHECK_OR("0", "-100000001", "-100000001");
+}
+TESTF(IntegerOpsTest, orWithSecondZero) {
+ CHECK_OR("FFFFFFFF", "0", "ffffffff");
+}
+TESTF(IntegerOpsTest, orWithFirstNegative) {
+ CHECK_OR("-1", "1", "-1");
+}
+TESTF(IntegerOpsTest, orWithFirstNegativeAndTwoDigits) {
+ CHECK_OR("-100000001", "1000000001", "-100000001");
+}
+TESTF(IntegerOpsTest, orWithFirstNegativeAndLonger) {
+ CHECK_OR("-100000002", "1", "-100000001");
+}
+TESTF(IntegerOpsTest, orWithBothNegative) {
+ CHECK_OR("-ffff0001", "-00010000", "-1");
+}
+TESTF(IntegerOpsTest, orWithBothNegativeAndTwoDigits) {
+ CHECK_OR("-ffffffffffff0001", "-ffffffff00010000", "-ffffffff00000001");
+}
+TESTF(IntegerOpsTest, orWithBothNegativeAndTooManyDigits) {
+ CHECK_OR("-1000000000000", "-ffff000010000000", "-10000000");
+}
+TESTF(IntegerOpsTest, orWithBothZero) {
+ CHECK_OR("0", "0", "0");
+}
+TESTF(IntegerOpsTest, xorWithBothZero) {
+ CHECK_XOR("0", "0", "0");
+}
+TESTF(IntegerOpsTest, xorWithBothPositiveAndDifferent) {
+ CHECK_XOR("2", "1", "3");
+}
+TESTF(IntegerOpsTest, xorWithBothPositiveAndTheSame) {
+ CHECK_XOR("2", "2", "0");
+}
+TESTF(IntegerOpsTest, xorWithFirstNegative) {
+ CHECK_XOR("-1", "1", "-2");
+}
+TESTF(IntegerOpsTest, xorWithFirstNegativeAndLonger) {
+ CHECK_XOR("-1000000000", "1", "-fffffffff");
+}
+TESTF(IntegerOpsTest, xorWithFirstNegativeAndShorter) {
+ CHECK_XOR("-1", "1000000000", "-1000000001");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegative) {
+ CHECK_XOR("1", "-1", "-2");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeAndLonger) {
+ CHECK_XOR("1", "-1000000000", "-fffffffff");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeAndThreeDigits) {
+ CHECK_XOR("1", "-100000000000000000", "-fffffffffffffffff");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeAndShorter) {
+ CHECK_XOR("1000000000", "-1", "-1000000001");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeAndShorterWithCarry) {
+ CHECK_XOR("1fffffffe", "-2", "-200000000");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeAndBothTwoDigits) {
+ CHECK_XOR("effffffff", "-100000001", "-1000000000");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeAndSecondDigitsZero) {
+ CHECK_XOR("200000000", "-100000000", "-300000000");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeAndOverflow) {
+ CHECK_XOR("ffff0000", "-100010000", "-200000000");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeWithAllDigits) {
+ CHECK_XOR("123456789", "-876543210", "-955115587");
+}
+TESTF(IntegerOpsTest, xorWithSecondNegativeFirstThreeDigits) {
+ CHECK_XOR("10000000000000000", "-1", "-10000000000000001");
+}
+TESTF(IntegerOpsTest, xorWithTwoNegative) {
+ CHECK_XOR("-2", "-1", "1");
+}
+TESTF(IntegerOpsTest, xorWithTwoNegativeOneDigitComplex) {
+ CHECK_XOR("-f0f0f0f0", "-f0f0f0f", "ffffffe1");
+}
+TESTF(IntegerOpsTest, xorWithTwoNegativeTwoDigits) {
+ CHECK_XOR("-1234567890ABCDEF", "-FEDCBA0987654321", "ece8ec7117ce8ece");
+}
+TESTF(IntegerOpsTest, xorWithTwoNegativeFirstThreeDigits) {
+ CHECK_XOR("-123456780000000000000000", "-1", "12345677ffffffffffffffff");
+}
+TESTF(IntegerOpsTest, xorWithTwoNegativeSecondThreeDigits) {
+ CHECK_XOR("-1", "-123456780000000000000000", "12345677ffffffffffffffff");
+}
+TESTF(IntegerOpsTest, xorWithTwoNegativeTwoDigitUnderflow) {
+ CHECK_XOR("-100000000", "-ffffffff", "1");
+}
+TESTF(IntegerOpsTest, xorWithTwoNegativeFirstLonger) {
+ CHECK_XOR("-1234567890ABCDEF", "-87654321", "1234567817ce8ece");
+}
+TESTF(IntegerOpsTest, andWithTwoPositive) {
+ CHECK_AND("FFFFFFFF", "FFFFFFFF", "ffffffff");
+}
+TESTF(IntegerOpsTest, andWithFirstPositive) {
+ CHECK_AND("1", "-1", "1");
+}
+TESTF(IntegerOpsTest, andWithSecondPositive) {
+ CHECK_AND("-1", "1", "1");
+}
+TESTF(IntegerOpsTest, andWithFirstPositiveTwoDigit) {
+ CHECK_AND("FFFFFFFFF", "-1", "fffffffff");
+}
+TESTF(IntegerOpsTest, andWithFirstPositiveTwoDigit2) {
+ CHECK_AND("FFFFFFFFF", "-10", "ffffffff0");
+}
+TESTF(IntegerOpsTest, andWithSecondPositiveTwoDigit) {
+ CHECK_AND("-10", "FFFFFFFFF", "ffffffff0");
+}
+TESTF(IntegerOpsTest, andWithBothNegative) {
+ CHECK_AND("-1", "-1", "-1");
+}
+TESTF(IntegerOpsTest, andWithBothNegativeAndTwoDigits) {
+ CHECK_AND("-1ffffffff", "-100000001", "-1ffffffff");
+}
+TESTF(IntegerOpsTest, andWithBothNegativeAndFirstLonger) {
+ CHECK_AND("-1ffffffff", "-1", "-1ffffffff");
+}
+TESTF(IntegerOpsTest, andWithBothNegativeAndFirstThreeLong) {
+ CHECK_AND("-10000000000000000", "-1", "-10000000000000000");
+}
+TESTF(IntegerOpsTest, andWithBothNegativeAndSecondLonger) {
+ CHECK_AND("-1", "-100000001", "-100000001");
+}
+TESTF(IntegerOpsTest, andWithFirstZero) {
+ CHECK_AND("0", "-1", "0");
+}
+TESTF(IntegerOpsTest, andWithSecondZero) {
+ CHECK_AND("-1", "0", "0");
+}
+TESTF(IntegerOpsTest, andResultSizeInBytesWithTwoPositive) {
+ CHECK_AND_SIZE("123456781234567812345678",
+ "1234567812345678",
+ sizeof(int) + (2 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, andResultSizeInBytesWithSecondNegativeAndShorter) {
+ CHECK_AND_SIZE("123456781234567812345678",
+ "-1234567812345678",
+ sizeof(int) + (3 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, andResultSizeInBytesWithFirstLongerAndNegative) {
+ CHECK_AND_SIZE("-123456781234567812345678",
+ "1234567812345678",
+ sizeof(int) + (2 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, andResultSizeInBytesWithFirstShorterAndPositive) {
+ CHECK_AND_SIZE("1234567812345678",
+ "-123456781234567812345678",
+ sizeof(int) + (2 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, andResultSizeInBytesWithFirstZero) {
+ CHECK_AND_SIZE("0", "-123456781234567812345678", sizeof(int) + (0 *
sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, andResultSizeInBytesWithSecondZero) {
+ CHECK_AND_SIZE("-123456781234567812345678", "0", sizeof(int) + (0 *
sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, orResultSizeInBytesWithFirstLongerAndNegative) {
+ CHECK_OR_SIZE("-123456781234567812345678",
+ "1234567812345678",
+ sizeof(int) + (3 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, orResultSizeInBytesWithFirstShorterAndNegative) {
+ CHECK_OR_SIZE("-12345678",
+ "1234567812345678",
+ sizeof(int) + (1 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, orResultSizeInBytesWithFirstShorterAndBothNegative) {
+ CHECK_OR_SIZE("-12345678",
+ "-1234567812345678",
+ sizeof(int) + (1 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, orResultSizeInBytesWithSecondShorterAndBothNegative)
{
+ CHECK_OR_SIZE("-1234567812345678",
+ "-12345678",
+ sizeof(int) + (1 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, orResultSizeInBytesWithSecondShorterAndNegative) {
+ CHECK_OR_SIZE("1234567812345678",
+ "-12345678",
+ sizeof(int) + (1 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, xorResultSizeInBytesWithFirstLongerAndNegative) {
+ CHECK_XOR_SIZE("-123456781234567812345678",
+ "1234567812345678",
+ sizeof(int) + (4 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, xorResultSizeInBytesWithBothPositive) {
+ CHECK_XOR_SIZE("123456781234567812345678",
+ "1234567812345678",
+ sizeof(int) + (3 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, ashResultSizeInBytesWhenNoShift) {
+ CHECK_ASH_SIZE("2",
+ 0,
+ sizeof(int) + (1 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, ashResultSizeInBytesWhenPositive) {
+ CHECK_ASH_SIZE("2",
+ 1,
+ sizeof(int) + (1 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, ashResultSizeInBytesWhenPositiveWithUnderflow) {
+ CHECK_ASH_SIZE("1",
+ -1,
+ sizeof(int) + (1 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, ashResultSizeInBytesWhenNegativeWithUnderflow) {
+ CHECK_ASH_SIZE("-1",
+ -1,
+ sizeof(int) + (1 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, ashResultSizeInBytesWhenPositiveWithOverflow) {
+ CHECK_ASH_SIZE("2",
+ 63,
+ sizeof(int) + (3 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, ashResultSizeInBytesWhenZero) {
+ CHECK_ASH_SIZE("0",
+ 32,
+ sizeof(int) + (0 * sizeof(Digit)));
+}
+TESTF(IntegerOpsTest, ashDigitShiftSimple) {
+ CHECK_ASH("2", 1, "4");
+}
+TESTF(IntegerOpsTest, ashDigitShift) {
+ CHECK_ASH("1", 32, "100000000");
+}
+TESTF(IntegerOpsTest, ashDigitShiftWithNegative) {
+ CHECK_ASH("-1", 32, "-100000000");
+}
+TESTF(IntegerOpsTest, ashTwoAndAHalfDigitShift) {
+ CHECK_ASH("1", 80, "100000000000000000000");
+}
+TESTF(IntegerOpsTest, ashSimpleShift) {
+ CHECK_ASH("1", 16, "10000");
+}
+TESTF(IntegerOpsTest, ashOverFlow) {
+ CHECK_ASH("ffffffff", 16, "ffffffff0000");
+}
+TESTF(IntegerOpsTest, ashTwoDigitOverFlow) {
+ CHECK_ASH("ffffffffffffffff", 16, "ffffffffffffffff0000");
+}
+TESTF(IntegerOpsTest, ashNegativeBitShift) {
+ CHECK_ASH("2", -1, "1");
+}
+TESTF(IntegerOpsTest, ashNegativeBitShiftWithUnderflow) {
+ CHECK_ASH("100000000", -1, "80000000");
+}
+TESTF(IntegerOpsTest, ashNegativeBitShiftWithTwoDigitUnderflow) {
+ CHECK_ASH("1", -64, "0");
+}
+TESTF(IntegerOpsTest, ashNegativeBitShiftNegativeValueWithUnderflow) {
+ CHECK_ASH("-100000000", -1, "-80000000");
+}
+TESTF(IntegerOpsTest, ashNegativeDigitShift) {
+ CHECK_ASH("100000000", -32, "1");
+}
+TESTF(IntegerOpsTest, ashNegativeHalfDigitShift) {
+ CHECK_ASH("ffffffff0000", -16, "ffffffff");
+}
+TESTF(IntegerOpsTest, ashNegativeUnderflowShouldResultInNegativeOne) {
+ CHECK_ASH("-1", -1, "-1");
+}
+TESTF(IntegerOpsTest, hashShouldXorDigits) {
+ IntegerOps::string_to_Integer("-12345678ffffffff", 16, *x);
+
+ int result = IntegerOps::hash(*x);
+
+ ASSERT_EQUALS_M2((0x12345678 ^ 0xffffffff ^ -2) >> 2, result, "Wrong
hash");
+}
=======================================
--- /dev/null
+++ /branches/gcc-linux/test/prims/largeIntegerByteArrayPrimTests.cpp Sun
Dec 6 13:13:11 2009
@@ -0,0 +1,358 @@
+# include "incls/_precompiled.incl"
+# include "incls/_byteArray_prims.cpp.incl"
+#include "test.h"
+#include "delta.hpp"
+#include "testUtils.hpp"
+
+using namespace easyunit;
+
+extern "C" int expansion_count;
+typedef oop(PRIM_API divfn)(oop, oop);
+
+DECLARE(LargeIntegerByteArrayPrimsTests)
+ResourceMark rm;
+PersistentHandle *x, *y, *z;
+char resultString[100];
+
+#define ASSERT_EQUALS_M2(expected, actual, prefix)\
+ ASSERT_EQUALS_M(expected, actual, report(prefix, expected, actual))
+#define ASSERT_EQUALS_MH(expected, actual, prefix)\
+ ASSERT_EQUALS_M(expected, actual, reportHex(prefix, expected, actual))
+#define ASSERT_EQUALS_MS(expected, actual, prefix)\
+ ASSERT_TRUE_M(!strcmp(expected, actual), report(prefix, expected,
actual))
+#define CHECK_DIV_WITH_SMI(fn, xstring, ystring, expected)\
+ IntegerOps::string_to_Integer(xstring, 16, as_Integer(x));\
+ IntegerOps::string_to_Integer(ystring, 16, as_Integer(y));\
+\
+ smiOop result = smiOop(byteArrayPrimitives::fn(y->as_oop(),\
+ x->as_oop()));\
+\
+ ASSERT_TRUE_M(result->is_smi(), "Should be small integer");\
+ ASSERT_EQUALS_MH(expected, result->value(), "Wrong result")
+#define CHECK_DIV_WITH_LRG(fn, xstring, ystring, expected)\
+ IntegerOps::string_to_Integer(xstring, 16, as_Integer(x));\
+ IntegerOps::string_to_Integer(ystring, 16, as_Integer(y));\
+\
+ byteArrayOop result = byteArrayOop(byteArrayPrimitives::fn(y->as_oop(),\
+
x->as_oop()));\
+\
+ ASSERT_TRUE_M(result->is_byteArray(), "Should be byteArray");\
+ ASSERT_EQUALS_MS(expected, as_Hex(result->number()), "Wrong result")
+#define CHECK_ARG_TYPE(fn)\
+ IntegerOps::string_to_Integer("123456781234567812345678", 16,
as_Integer(x));\
+\
+ symbolOop result = unmarkSymbol(byteArrayPrimitives::fn(as_smiOop(10),
x->as_oop()));\
+\
+ ASSERT_TRUE_M(result->is_symbol(), "Should be symbol");\
+ ASSERT_EQUALS_MS(vmSymbols::first_argument_has_wrong_type()->chars(),\
+ result->chars(),\
+ "Wrong result")
+#define CHECK_ARG_TYPE2(fn)\
+ IntegerOps::string_to_Integer("123456781234567812345678", 16,
as_Integer(x));\
+\
+ symbolOop result = unmarkSymbol(byteArrayPrimitives::fn(x->as_oop(),
x->as_oop()));\
+\
+ ASSERT_TRUE_M(result->is_symbol(), "Should be symbol");\
+ ASSERT_EQUALS_MS(vmSymbols::first_argument_has_wrong_type()->chars(),\
+ result->chars(),\
+ "Wrong result")
+#define CHECK_INVALID(fn, x, y, errorSymbol)\
+ symbolOop result = unmarkSymbol(byteArrayPrimitives::fn(y->as_oop(),\
+ x->as_oop()));\
+\
+ ASSERT_TRUE_M(result->is_symbol(), "Should be symbol");\
+ ASSERT_EQUALS_MS(vmSymbols::errorSymbol()->chars(),\
+ result->chars(),\
+ "Wrong result")
+#define CHECK_X_INVALID(fn)\
+ ((Digit*)byteArrayOop(x->as_oop())->bytes())[0] = 1;\
+ IntegerOps::string_to_Integer("123456781234567812345678", 16,
as_Integer(y));\
+ CHECK_INVALID(fn, x, y, argument_is_invalid)
+#define CHECK_Y_INVALID(fn)\
+ ((Digit*)byteArrayOop(y->as_oop())->bytes())[0] = 1;\
+ IntegerOps::string_to_Integer("123456781234567812345678", 16,
as_Integer(x));\
+ CHECK_INVALID(fn, x, y, argument_is_invalid)
+#define CHECK_Y_ZERO(fn)\
+ IntegerOps::string_to_Integer("123456781234567812345678", 16,
as_Integer(x));\
+ CHECK_INVALID(fn, x, y, division_by_zero)
+
+char message[100];
+char* reportHex(char*prefix, int expected, int actual) {
+ sprintf(message, "%s. Expected: 0x%x, but was: 0x%x", prefix, expected,
actual);
+ return message;
+}
+char* report(char*prefix, int expected, int actual) {
+ sprintf(message, "%s. Expected: %d, but was: %d", prefix, expected,
actual);
+ return message;
+}
+char* report(char*prefix, char* expected, char* actual) {
+ sprintf(message, "%s. Expected: %s, but was: %s", prefix, expected,
actual);
+ return message;
+}
+char* as_Hex(Integer& number) {
+ IntegerOps::Integer_to_string(number, 16, resultString);
+ return resultString;
+}
+Integer& as_Integer(PersistentHandle *handle) {
+ return byteArrayOop(handle->as_oop())->number();
+}
+END_DECLARE
+
+SETUP(LargeIntegerByteArrayPrimsTests) {
+ x = new PersistentHandle(oopFactory::new_byteArray(24));
+ y = new PersistentHandle(oopFactory::new_byteArray(24));
+}
+TEARDOWN(LargeIntegerByteArrayPrimsTests){
+ delete x;
+ delete y;
+ delete z;
+}
+
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerQuoShouldReturnCorrectResultForTwoPositive) {
+ CHECK_DIV_WITH_LRG(largeIntegerQuo,
+ "123456781234567812345678",
+ "1234567812345678",
+ "100000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerQuoShouldReturnCorrectResultForTwoNegative) {
+ CHECK_DIV_WITH_LRG(largeIntegerQuo,
+ "-123456781234567812345678",
+ "-1234567812345678",
+ "100000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerQuoShouldReturnCorrectResultForNegativeDivisor) {
+ CHECK_DIV_WITH_LRG(largeIntegerQuo,
+ "123456781234567812345678",
+ "-1234567812345678",
+ "-100000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerQuoShouldReturnCorrectResultForNegativeDividend) {
+ CHECK_DIV_WITH_LRG(largeIntegerQuo,
+ "-123456781234567812345678",
+ "1234567812345678",
+ "-100000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerDivShouldReturnCorrectResultForTwoPositive) {
+ CHECK_DIV_WITH_LRG(largeIntegerDiv,
+ "123456781234567812345678",
+ "1234567812345678",
+ "100000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerDivShouldReturnCorrectResultForTwoNegative) {
+ CHECK_DIV_WITH_LRG(largeIntegerDiv,
+ "-123456781234567812345678",
+ "-1234567812345678",
+ "100000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerDivShouldReturnCorrectResultForOneNegative) {
+ CHECK_DIV_WITH_LRG(largeIntegerDiv,
+ "123456781234567812345678",
+ "-1234567812345678",
+ "-100000001");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerModShouldReturnCorrectResultForTwoPositive) {
+ CHECK_DIV_WITH_SMI(largeIntegerMod,
+ "123456781234567812345678",
+ "1234567812345678",
+ 0x12345678);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerModShouldReturnCorrectResultForTwoNegative) {
+ CHECK_DIV_WITH_SMI(largeIntegerMod,
+ "-123456781234567812345678",
+ "-1234567812345678",
+ -0x12345678);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerModShouldReturnCorrectResultForNegativeDivisor) {
+ CHECK_DIV_WITH_LRG(largeIntegerMod,
+ "123456781234567812345678",
+ "-1234567812345678",
+ "-1234567800000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerAndShouldReturnCorrectResult) {
+ CHECK_DIV_WITH_LRG(largeIntegerAnd,
+ "100000000000000000000000",
+ "-1",
+ "100000000000000000000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerAndShouldReturnSmallInteger) {
+ CHECK_DIV_WITH_SMI(largeIntegerAnd,
+ "-100000000000000000000001",
+ "1",
+ 1);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerOrShouldReturnCorrectResult) {
+ CHECK_DIV_WITH_LRG(largeIntegerOr,
+ "100000000000000000000000",
+ "1",
+ "100000000000000000000001");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerOrShouldReturnSmallInteger) {
+ CHECK_DIV_WITH_SMI(largeIntegerOr,
+ "2",
+ "1",
+ 3);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerXorShouldReturnCorrectResult) {
+ CHECK_DIV_WITH_LRG(largeIntegerXor,
+ "100000000000000000000001",
+ "1",
+ "100000000000000000000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerShiftShouldReturnSmallInteger) {
+ IntegerOps::string_to_Integer("2", 16, as_Integer(x));
+
+ smiOop result =
smiOop(byteArrayPrimitives::largeIntegerShift(as_smiOop(-1),
+
x->as_oop()));
+
+ ASSERT_TRUE_M(result->is_smi(), "Should be small integer");
+ ASSERT_EQUALS_MH(1, result->value(), "Wrong result");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerShiftShouldReturnLargeInteger) {
+ IntegerOps::string_to_Integer("1", 16, as_Integer(x));
+
+ byteArrayOop result =
byteArrayOop(byteArrayPrimitives::largeIntegerShift(as_smiOop(32),
+
x->as_oop()));
+
+ ASSERT_TRUE_M(result->is_byteArray(), "Should be byteArray");
+ ASSERT_EQUALS_MS("100000000", as_Hex(result->number()), "Wrong result");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerShiftWithUnderflowShouldReturnSmallInteger) {
+ IntegerOps::string_to_Integer("100000000", 16, as_Integer(x));
+
+ smiOop result =
smiOop(byteArrayPrimitives::largeIntegerShift(as_smiOop(-4),
+
x->as_oop()));
+
+ ASSERT_TRUE_M(result->is_smi(), "Should be small integer");
+ ASSERT_EQUALS_MH(0x10000000, result->value(), "Wrong result");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerXorShouldReturnSmallInteger) {
+ CHECK_DIV_WITH_SMI(largeIntegerXor,
+ "3",
+ "1",
+ 2);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerModShouldReturnCorrectResultForNegativeDividend) {
+ CHECK_DIV_WITH_LRG(largeIntegerMod,
+ "-123456781234567812345678",
+ "1234567812345678",
+ "1234567800000000");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerRemShouldReturnCorrectResultForTwoPositive) {
+ CHECK_DIV_WITH_SMI(largeIntegerRem,
+ "123456781234567812345678",
+ "1234567812345678",
+ 0x12345678);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerRemShouldReturnCorrectResultForTwoNegative) {
+ CHECK_DIV_WITH_SMI(largeIntegerRem,
+ "-123456781234567812345678",
+ "-1234567812345678",
+ -0x12345678);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerRemShouldReturnCorrectResultForNegativeDivisor) {
+ CHECK_DIV_WITH_SMI(largeIntegerRem,
+ "123456781234567812345678",
+ "-1234567812345678",
+ 0x12345678);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerRemShouldReturnCorrectResultForNegativeDividend) {
+ CHECK_DIV_WITH_SMI(largeIntegerRem,
+ "-123456781234567812345678",
+ "1234567812345678",
+ -0x12345678);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerShiftShouldReportErrorWhenArgWrongType) {
+ CHECK_ARG_TYPE2(largeIntegerShift);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerXorShouldReportErrorWhenArgWrongType) {
+ CHECK_ARG_TYPE(largeIntegerXor);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerOrShouldReportErrorWhenArgWrongType) {
+ CHECK_ARG_TYPE(largeIntegerOr);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerAndShouldReportErrorWhenArgWrongType) {
+ CHECK_ARG_TYPE(largeIntegerAnd);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerRemShouldReportErrorWhenArgWrongType) {
+ CHECK_ARG_TYPE(largeIntegerRem);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerModShouldReportErrorWhenArgWrongType) {
+ CHECK_ARG_TYPE(largeIntegerMod);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerDivShouldReportErrorWhenArgWrongType) {
+ CHECK_ARG_TYPE(largeIntegerDiv);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerQuoShouldReportErrorWhenArgWrongType) {
+ CHECK_ARG_TYPE(largeIntegerQuo);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerShiftShouldReportErrorWhenXInvalid) {
+ ((Digit*)byteArrayOop(x->as_oop())->bytes())[0] = 1;
+ symbolOop result =
unmarkSymbol(byteArrayPrimitives::largeIntegerShift(0, x->as_oop()));
+
+ ASSERT_TRUE_M(result->is_symbol(), "Should be symbol");
+ ASSERT_EQUALS_MS(vmSymbols::argument_is_invalid()->chars(),
+ result->chars(),
+ "Wrong result");
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerAndShouldReportErrorWhenXInvalid) {
+ CHECK_X_INVALID(largeIntegerAnd);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerXorShouldReportErrorWhenXInvalid) {
+ CHECK_X_INVALID(largeIntegerXor);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerOrShouldReportErrorWhenXInvalid) {
+ CHECK_X_INVALID(largeIntegerOr);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerQuoShouldReportErrorWhenXInvalid) {
+ CHECK_X_INVALID(largeIntegerQuo);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerDivShouldReportErrorWhenXInvalid) {
+ CHECK_X_INVALID(largeIntegerDiv);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerRemShouldReportErrorWhenXInvalid) {
+ CHECK_X_INVALID(largeIntegerRem);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerModShouldReportErrorWhenXInvalid) {
+ CHECK_X_INVALID(largeIntegerMod);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerAndShouldReportErrorWhenYInvalid) {
+ CHECK_Y_INVALID(largeIntegerAnd);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerXorShouldReportErrorWhenYInvalid) {
+ CHECK_Y_INVALID(largeIntegerXor);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerOrShouldReportErrorWhenYInvalid) {
+ CHECK_Y_INVALID(largeIntegerOr);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerModShouldReportErrorWhenYInvalid) {
+ CHECK_Y_INVALID(largeIntegerMod);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerRemShouldReportErrorWhenYInvalid) {
+ CHECK_Y_INVALID(largeIntegerRem);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerDivShouldReportErrorWhenYInvalid) {
+ CHECK_Y_INVALID(largeIntegerDiv);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerQuoShouldReportErrorWhenYInvalid) {
+ CHECK_Y_INVALID(largeIntegerQuo);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerDivShouldReportErrorWhenYZero) {
+ CHECK_Y_ZERO(largeIntegerDiv);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerQuoShouldReportErrorWhenYZero) {
+ CHECK_Y_ZERO(largeIntegerQuo);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerRemShouldReportErrorWhenYZero) {
+ CHECK_Y_ZERO(largeIntegerRem);
+}
+TESTF(LargeIntegerByteArrayPrimsTests,
largeIntegerModShouldReportErrorWhenYZero) {
+ CHECK_Y_ZERO(largeIntegerMod);
+}
+TESTF(LargeIntegerByteArrayPrimsTests, hash) {
+ IntegerOps::string_to_Integer("-12345678ffffffff", 16, as_Integer(x));
+
+ smiOop result =
smiOop(byteArrayPrimitives::largeIntegerHash(x->as_oop()));
+
+ ASSERT_TRUE_M(result->is_smi(), "Should be SMI");
+ ASSERT_EQUALS_M2((0x12345678 ^ 0xffffffff ^ -2) >> 2,
result->value(), "Wrong hash");
+}
=======================================
--- /branches/gcc-linux/test/main/main.cpp Sat Oct 17 07:54:56 2009
+++ /branches/gcc-linux/test/main/main.cpp Sun Dec 6 13:13:11 2009
@@ -4,7 +4,7 @@
#include "handle.hpp"
#include "testharness.h"
#include <windows.h>
-
+#include "testProcess.hpp"
void ostream_init();

using namespace easyunit;
@@ -64,6 +64,7 @@
set_processObj(processOop(newProcess()));
}
void initializeSmalltalkEnvironment() {
+ AddTestProcess ap;
PersistentHandle _new(oopFactory::new_symbol("new"));
PersistentHandle initialize(oopFactory::new_symbol("initialize"));
PersistentHandle
runBase(oopFactory::new_symbol("runBaseClassInitializers"));
@@ -81,10 +82,7 @@
}
int TestDeltaProcess::launch_tests(DeltaProcess *process) {
process->suspend_at_creation();
- {
- BlockScavenge bs;
- initializeSmalltalkEnvironment();
- }
+ initializeSmalltalkEnvironment();
TestRegistry::runAndPrint();
os::signal_event(done);
return 0;
=======================================
--- /branches/gcc-linux/vm/compiler/node.hpp Sun Jun 7 11:33:29 2009
+++ /branches/gcc-linux/vm/compiler/node.hpp Sun Dec 6 13:13:11 2009
@@ -640,7 +640,7 @@
// uses hardwired regs, has no src or dest
bool canCopyPropagate() const { return false; }
bool canCopyPropagateOop() const { return false; }
- bool hasSrc() const { return false; }
+ bool hasSrc() const { return true; } // otherwise breaks
nonlocal_return
bool isAssignmentLike() const { return false; }
bool hasDest() const { return false; }
bool canChangeDest() const { return false; } // has no dest
=======================================
--- /branches/gcc-linux/vm/prims/byteArray_prims.cpp Sun Sep 13 14:52:44
2009
+++ /branches/gcc-linux/vm/prims/byteArray_prims.cpp Sun Dec 6 13:13:11
2009
@@ -318,53 +318,71 @@
IntegerOps::mul(x->number(), y->number(), z->number());
return simplified(z);
}
-
+#define BIT_OP(receiver, argument, sizeFn, opFn, label)\
+ ARG_CHECK(receiver, argument, label);\
+ byteArrayOop z =
byteArrayOop(x->klass()->klass_part()->allocateObjectSize(IntegerOps::sizeFn(x->number(),
y->number())));\
+\
+ IntegerOps::opFn(x->number(), y->number(), z->number());\
+ return simplified(z)
+#define DIVISION(receiver, argument, sizeFn, divFn, label)\
+ ARG_CHECK(receiver, argument, label);\
+ if (y->number().is_zero()) return
markSymbol(vmSymbols::division_by_zero ());\
+\
+ byteArrayOop z =
byteArrayOop(x->klass()->klass_part()->allocateObjectSize(IntegerOps::sizeFn(x->number(),
y->number())));\
+\
+ IntegerOps::divFn(x->number(), y->number(), z->number());\
+ return simplified(z)
+#define ARG_CHECK(receiver, argument, label)\
+ PROLOGUE_2(label, receiver, argument);\
+ ASSERT_RECEIVER;\
+\
+ if (!argument->is_byteArray())\
+ return markSymbol(vmSymbols::first_argument_has_wrong_type());\
+\
+ byteArrayOop x = byteArrayOop(receiver);\
+ byteArrayOop y = byteArrayOop(argument);\
+\
+ if (!x->number().is_valid() || !y->number().is_valid()) return
markSymbol(vmSymbols::argument_is_invalid())
+
+PRIM_DECL_2(byteArrayPrimitives::largeIntegerQuo, oop receiver, oop
argument) {
+ DIVISION(receiver, argument, quo_result_size_in_bytes,
quo, "largeIntegerQuo");
+}
PRIM_DECL_2(byteArrayPrimitives::largeIntegerDiv, oop receiver, oop
argument) {
- PROLOGUE_2("largeIntegerDiv", receiver, argument);
- ASSERT_RECEIVER;
-
- if (!argument->is_byteArray())
- return markSymbol(vmSymbols::first_argument_has_wrong_type());
-
- BlockScavenge bs;
-
- byteArrayOop x = byteArrayOop(receiver);
- byteArrayOop y = byteArrayOop(argument);
- byteArrayOop z;
-
- if (!x->number().is_valid() || !y->number().is_valid()) return
markSymbol(vmSymbols::argument_is_invalid());
- if (y->number().is_zero() ) return
markSymbol(vmSymbols::division_by_zero ());
-
- z =
byteArrayOop(x->klass()->klass_part()->allocateObjectSize(IntegerOps::div_result_size_in_bytes(x->number(),
y->number())));
- x = byteArrayOop(receiver);
- y = byteArrayOop(argument);
- IntegerOps::div(x->number(), y->number(), z->number());
- return simplified(z);
-}
-
+ DIVISION(receiver, argument, div_result_size_in_bytes,
div, "largeIntegerDiv");
+}
PRIM_DECL_2(byteArrayPrimitives::largeIntegerMod, oop receiver, oop
argument) {
- PROLOGUE_2("largeIntegerMod", receiver, argument);
+ DIVISION(receiver, argument, mod_result_size_in_bytes,
mod, "largeIntegerMod");
+}
+PRIM_DECL_2(byteArrayPrimitives::largeIntegerRem, oop receiver, oop
argument) {
+ DIVISION(receiver, argument, rem_result_size_in_bytes,
rem, "largeIntegerRem");
+}
+PRIM_DECL_2(byteArrayPrimitives::largeIntegerAnd, oop receiver, oop
argument) {
+ BIT_OP(receiver, argument, and_result_size_in_bytes,
and, "largeIntegerAnd");
+}
+PRIM_DECL_2(byteArrayPrimitives::largeIntegerOr, oop receiver, oop
argument) {
+ BIT_OP(receiver, argument, or_result_size_in_bytes,
or, "largeIntegerOr");
+}
+PRIM_DECL_2(byteArrayPrimitives::largeIntegerXor, oop receiver, oop
argument) {
+ BIT_OP(receiver, argument, xor_result_size_in_bytes,
xor, "largeIntegerXor");
+}
+PRIM_DECL_2(byteArrayPrimitives::largeIntegerShift, oop receiver, oop
argument) {
+ PROLOGUE_2("largeIntegerShift", receiver, argument);
ASSERT_RECEIVER;
-
- if (!argument->is_byteArray())
+ if (!argument->is_smi())
return markSymbol(vmSymbols::first_argument_has_wrong_type());

- BlockScavenge bs;
-
byteArrayOop x = byteArrayOop(receiver);
- byteArrayOop y = byteArrayOop(argument);
- byteArrayOop z;
-
- if (!x->number().is_valid() || !y->number().is_valid()) return
markSymbol(vmSymbols::argument_is_invalid());
- if (y->number().is_zero() ) return
markSymbol(vmSymbols::division_by_zero ());
-
- z =
byteArrayOop(x->klass()->klass_part()->allocateObjectSize(IntegerOps::mod_result_size_in_bytes(x->number(),
y->number())));
- x = byteArrayOop(receiver);
- y = byteArrayOop(argument);
- IntegerOps::mod(x->number(), y->number(), z->number());
+ int shift = smiOop(argument)->value();
+
+ if (!byteArrayOop(receiver)->number().is_valid())
+ return markSymbol(vmSymbols::argument_is_invalid());
+
+ byteArrayOop z =
byteArrayOop(x->klass()->klass_part()->allocateObjectSize(IntegerOps::ash_result_size_in_bytes(x->number(),
shift)));
+
+ IntegerOps::ash(x->number(), shift, z->number());
+
return simplified(z);
}
-
PRIM_DECL_2(byteArrayPrimitives::largeIntegerCompare, oop receiver, oop
argument) {
PROLOGUE_2("largeIntegerCompare", receiver, argument);
ASSERT_RECEIVER;
@@ -417,6 +435,12 @@
IntegerOps::Integer_to_string(x->number(), smiOop(base)->value(),
result->chars());
return result;
}
+
+PRIM_DECL_1(byteArrayPrimitives::largeIntegerHash, oop receiver) {
+ PROLOGUE_1("largeIntegerHash", receiver);
+ ASSERT_RECEIVER;
+ return as_smiOop(IntegerOps::hash(byteArrayOop(receiver)->number()));
+}

PRIM_DECL_1(byteArrayPrimitives::hash, oop receiver) {
PROLOGUE_1("hash", receiver);
=======================================
--- /branches/gcc-linux/vm/prims/byteArray_prims.hpp Sun Sep 13 14:52:44
2009
+++ /branches/gcc-linux/vm/prims/byteArray_prims.hpp Sun Dec 6 13:13:11
2009
@@ -177,6 +177,16 @@
//%
static PRIM_DECL_2(largeIntegerMultiply, oop receiver, oop argument);

+ //%prim
+ // <IndexedByteInstanceVariables>
+ // primitiveIndexedByteLargeIntegerQuo: argument
<IndexedByteInstanceVariables>
+ // ifFail: failBlock <PrimFailBlock>
^<IndexedByteInstanceVariables|SmallInteger> =
+ // Internal { error = #(ArgumentIsInvalid DivisionByZero)
+ // flags = #(Function IndexedByte)
+ // name = 'byteArrayPrimitives::largeIntegerQuo' }
+ //%
+ static PRIM_DECL_2(largeIntegerQuo, oop receiver, oop argument);
+
//%prim
// <IndexedByteInstanceVariables>
// primitiveIndexedByteLargeIntegerDiv: argument
<IndexedByteInstanceVariables>
@@ -198,6 +208,56 @@
//%
static PRIM_DECL_2(largeIntegerMod, oop receiver, oop argument);

+ //%prim
+ // <IndexedByteInstanceVariables>
+ // primitiveIndexedByteLargeIntegerRem: argument
<IndexedByteInstanceVariables>
+ // ifFail: failBlock <PrimFailBlock>
^<IndexedByteInstanceVariables|SmallInteger> =
+ // Internal { error = #(ArgumentIsInvalid DivisionByZero)
+ // flags = #(Function IndexedByte)
+ // name = 'byteArrayPrimitives::largeIntegerRem' }
+ //%
+ static PRIM_DECL_2(largeIntegerRem, oop receiver, oop argument);
+
+ //%prim
+ // <IndexedByteInstanceVariables>
+ // primitiveIndexedByteLargeIntegerAnd: argument
<IndexedByteInstanceVariables>
+ // ifFail: failBlock <PrimFailBlock>
^<IndexedByteInstanceVariables|SmallInteger> =
+ // Internal { error = #(ArgumentIsInvalid DivisionByZero)
+ // flags = #(Function IndexedByte)
+ // name = 'byteArrayPrimitives::largeIntegerAnd' }
+ //%
+ static PRIM_DECL_2(largeIntegerAnd, oop receiver, oop argument);
+
+ //%prim
+ // <IndexedByteInstanceVariables>
+ // primitiveIndexedByteLargeIntegerXor: argument
<IndexedByteInstanceVariables>
+ // ifFail: failBlock <PrimFailBlock>
^<IndexedByteInstanceVariables|SmallInteger> =
+ // Internal { error = #(ArgumentIsInvalid DivisionByZero)
+ // flags = #(Function IndexedByte)
+ // name = 'byteArrayPrimitives::largeIntegerXor' }
+ //%
+ static PRIM_DECL_2(largeIntegerXor, oop receiver, oop argument);
+
+ //%prim
+ // <IndexedByteInstanceVariables>
+ // primitiveIndexedByteLargeIntegerOr: argument
<IndexedByteInstanceVariables>
+ // ifFail: failBlock <PrimFailBlock>
^<IndexedByteInstanceVariables|SmallInteger> =
+ // Internal { error = #(ArgumentIsInvalid DivisionByZero)
+ // flags = #(Function IndexedByte)
+ // name = 'byteArrayPrimitives::largeIntegerOr' }
+ //%
+ static PRIM_DECL_2(largeIntegerOr, oop receiver, oop argument);
+
+ //%prim
+ // <IndexedByteInstanceVariables>
+ // primitiveIndexedByteLargeIntegerShift: argument <SmallInt>
+ // ifFail: failBlock <PrimFailBlock>
^<IndexedByteInstanceVariables|SmallInteger> =
+ // Internal { error = #(ArgumentIsInvalid DivisionByZero)
+ // flags = #(Function IndexedByte)
+ // name = 'byteArrayPrimitives::largeIntegerShift' }
+ //%
+ static PRIM_DECL_2(largeIntegerShift, oop receiver, oop argument);
+
//%prim
// <IndexedByteInstanceVariables>
// primitiveIndexedByteLargeIntegerCompare: argument
<IndexedByteInstanceVariables>
@@ -232,6 +292,14 @@
//%
static PRIM_DECL_1(hash, oop receiver);

+ //%prim
+ // <IndexedByteInstanceVariables>
+ // primitiveLargeIntegerHash ^<SmallInteger> =
+ // Internal { flags = #(Pure IndexedByte)
+ // name = 'byteArrayPrimitives::largeIntegerHash' }
+ //%
+ static PRIM_DECL_1(largeIntegerHash, oop receiver);
+
// Aliens primitives

//%prim
=======================================
--- /branches/gcc-linux/vm/prims/integerOps.cpp Sun Sep 13 14:52:44 2009
+++ /branches/gcc-linux/vm/prims/integerOps.cpp Sun Dec 6 13:13:11 2009
@@ -29,7 +29,7 @@
static const int logB = sizeof(Digit)*8;
static const Digit hlfB = 0x80000000;
static const Digit oneB = 0xFFFFFFFF;
-
+static const int digitBitLength = sizeof(Digit) * 8;

// double layout
//
@@ -269,167 +269,39 @@
assert(0 <= i && i < maxD, "illegal digit");
return "0123456789abcdefghijklmnopqrstuvwxyz"[i];
}
-

inline Digit IntegerOps::xpy(Digit x, Digit y, Digit& carry) {
// returns (x + y + c) mod B; sets carry = (x + y + c) div B
- Digit c = carry; // make sure that carry is used below and not &carry
- Digit r;
- assert(c <= 1, "wrong carry");
-
- /*
- __asm {
- //push eax // save eax
- mov eax, x // eax = x
- add eax, y // eax = (x + y ) mod B, 0 <= carry = (x + y ) div B
<= 1
- adc eax, c // eax = (x + y + c) mod B, 0 <= carry = (x + y + c) div B
<= 1
- mov r, eax // eax is result
- mov eax, 0 // cannot use xor because that clears carry bit!
- adc eax, 0 // eax = carry
- mov c, eax // save carry
- //pop eax // restore eax
- }
- */
-
- // 1836311903+2971215073
-
- r = x + y + c;
- if (x == -1 || y == -1) {
- c = (x==-1) ? (y+c)>0 : (x+c)>0;
- } else {
- c = ((x>>1)+(y>>1)) > 0x80000000;
- }
- carry = c;
- return r;
-}
-
+
+ DoubleDigit lx = x;
+ DoubleDigit r = lx + y + carry;
+ carry = r >> digitBitLength;
+ return (Digit)(r & oneB);
+}

inline Digit IntegerOps::xmy(Digit x, Digit y, Digit& carry) {
// returns (x - y - c) mod B; sets carry = -((x - y - c) div B)
- Digit c = carry; // make sure that carry is used below and not &carry
- Digit r;
- assert(c <= 1, "wrong carry");
- /*
- __asm {
- //push eax // save eax
- mov eax, x // eax = x
- sub eax, y // eax = (x - y ) mod B, 0 <= carry = (x - y ) div B
<= 1
- sbb eax, c // eax = (x - y - c) mod B, 0 <= carry = (x - y - c) div B
<= 1
- mov r, eax // eax is result
- mov eax, 0 // cannot use xor because that clears carry bit!
- adc eax, 0 // eax = carry
- mov c, eax // save carry
- //pop eax // restore eax
- }
- */
-
- if (x==1836311903 || y==1836311903) {
- assert(true, "");
- }
-
- // 1836311903+2971215073-2971215073
-
- r = x - (y + c);
- if (y == -1) {
- // propagate carry ~
- } else {
- c = x < (y+c);
- }
- carry = c;
- return r;
-}
-
+ DoubleDigit lx = x;
+ DoubleDigit r = lx - y - carry;
+ carry = r >> digitBitLength & 1;
+ return Digit(r & oneB);
+}

inline Digit IntegerOps::axpy(Digit a, Digit x, Digit y, Digit& carry) {
// returns (a*x + y + c) mod B; sets carry = (a*x + y + c) div B
- Digit c = carry; // make sure that carry is used below and not &carry
- Digit r;
- /*
- __asm {
- //push eax // save eax
- //push edx // save edx
- mov eax, a // eax = a
- mul x // edx:eax = a*x
- add eax, y //
- adc edx, 0 // edx:eax = a*x + y
- add eax, c //
- adc edx, 0 // edx:eax = a*x + y + c
- mov r, eax // eax is result
- mov c, edx // save carry
- //pop edx // restore edx
- //pop eax // restore eax
- }
- */
-
- Digit la = a & 0xFFFF;
- Digit lx = x & 0xFFFF;
- Digit ha = a >> 16;
- Digit hx = x >> 16;
- Digit cross = (lx*ha + la*hx);
- Digit m1 = la*lx + (cross<<16);
- Digit m2 = ha*hx + (cross>>16);
- // r = m1 + y + c;
- Digit _c = 0;
- m1 = xpy(m1, y, _c);
- m2 = xpy(m2, 0, _c);
- _c = 0;
- m1 = xpy(m1, c, _c);
- m2 = xpy(m2, 0, _c);
-
- r = m1;
- carry = m2;
- return r;
-}
-
+ DoubleDigit lx = x;
+ DoubleDigit r = (lx * a) + y + carry;
+ carry = r >> digitBitLength;
+ return Digit(r & oneB);
+}

inline Digit IntegerOps::xdy(Digit x, Digit y, Digit& carry) {
// returns (carry*B + x) div y; sets carry = (carry*B + x) mod y
- Digit c = carry; // make sure that carry is used below and not &carry
- Digit r;
-
- /*
- __asm {
- //push eax // save eax
- //push edx // save edx
- mov eax, x // eax = x
- mov edx, c // edx:eax = carry*B + x
- div y // edx:eax = (carry*B + x) mod y : (carry*B + x) div y
- mov r, eax // eax is result
- mov c, edx // save carry
- //pop edx // restore edx
- //pop eax // restore eax
- }
- */
-
- // long division using 16-32 bit arithmetic
- // %hack: this code is incomplete, but enough to extract digits in small
bases
- assert((y>>16) == 0, "only works with small divisors")
-
- Digit xx[4] = { carry >> 16, carry & 0xFFFF, x >> 16, x & 0xFFFF };
- Digit rr[4];
-
- rr[0] = (xx[0] / y);
- xx[0] -= rr[0] * y;
-
- rr[1] = ((xx[0]<<16) + xx[1])/y;
- xx[0] -= (rr[1]*y) >>16;
- xx[1] -= (rr[1]*y) & 0xFFFF;
-
- rr[2] = ((xx[1]<<16) + xx[2])/y;
- xx[1] -= (rr[2]*y) >>16;
- xx[2] -= (rr[2]*y) & 0xFFFF;
-
- rr[3] = ((xx[2]<<16) + xx[3])/y;
- xx[2] -= (rr[3]*y) >>16;
- xx[3] -= (rr[3]*y) & 0xFFFF;
-
- r = (rr[2]<<16) + rr[3];
- c = (xx[2]<<16) + xx[3];
-
- carry = c;
- return r;
-}
-
+ DoubleDigit c = carry; // make sure that carry is used below and not
&carry
+ DoubleDigit total = ((c << digitBitLength) + x);
+ carry = total % y;
+ return Digit((total / y) & oneB);
+}

Digit IntegerOps::power(Digit x, int n) {
Digit f = x;
@@ -446,7 +318,6 @@
}
return p;
}
-

Digit IntegerOps::max_power(Digit x) {
Digit n = 1;
@@ -523,8 +394,90 @@
return c;
}

-
-Digit* IntegerOps::qr_decomposition(Integer& x0, Integer& y0) {
+Digit* IntegerOps::copyDigits(Digit* source, int length, int toCopy) {
+ Digit* x = NEW_RESOURCE_ARRAY(Digit, length);
+ for (int i = toCopy - 1; i >= 0; i--)
+ x[i] = source[i];
+ return x;
+}
+
+Digit* IntegerOps::qr_decomposition_single_digit(Digit* x, int length,
Digit divisor) {
+ Digit c = 0;
+ for (int i = length - 1; i >= 0; i--)
+ x[i+1] = xdy(x[i], divisor, c);
+ x[0] = c;
+ return x;
+}
+
+Digit IntegerOps::qr_estimate_digit_quotient(Digit& xhi, Digit xlo, Digit
y) {
+ if (xhi == y) return oneB;
+ return xdy(xlo, y, xhi);
+}
+
+Digit IntegerOps::qr_calculate_remainder(Digit* qr, Digit* divisor, Digit
q, int qrStart, int stop) {
+ Digit c = 0;
+ int j = qrStart;
+ int k = 0;
+ Digit b = 0;
+ while (k < stop) {
+ qr[j] = xmy(qr[j], 0, b);
+ Digit qyk = axpy(q, divisor[k], 0, c);
+ Digit c2 = 0;
+ qr[j] = xmy(qr[j], qyk, c2);
+ b = xpy(b, c2, c);
+ assert(c == 0, "Overflow");
+
+ j++;
+ k++;
+ }
+ return b;
+}
+
+Digit IntegerOps::qr_adjust_for_underflow(Digit* qr, Digit* divisor, Digit
q, int qrStart, int stop) {
+ int j = qrStart;
+ int k = 0;
+ Digit c = 0;
+ while(k < stop) {
+ qr[j] = xpy(qr[j], divisor[k], c);
+ j++;
+ k++;
+ }
+ assert(c == 1, "Should have carry to balance borrow"); // see Knuth p258
D6
+ return q-1; // correct estimate
+}
+
+Digit IntegerOps::qr_adjust_for_over_estimate(Digit y1, Digit y2, Digit q,
Digit xi, Digit xi2) {
+ //check if estimate is too large
+ Digit c = 0;
+ Digit y2q = axpy(y2, q, 0, c);
+ if (c > xi || (c = xi && y2q > xi2)) {
+ q--; // too large by 1
+ Digit c2 = 0;
+ xpy(xi, y1, c2); // add back divisor
+
+ if (!c2) {
+ c = 0;
+ y2q = axpy(y2, q, 0, c);
+ if (c > xi || (c = xi && y2q > xi2))
+ q--; // too large by 2
+ }
+ }
+ return q;
+}
+
+Digit IntegerOps::qr_scaling_factor(Digit firstDivisorDigit) {
+ Digit c = 1;
+ return (firstDivisorDigit == oneB) ? 1 : xdy(0, firstDivisorDigit + 1,
c); // d = B/(yn + 1)
+}
+
+void IntegerOps::qr_unscale_remainder(Digit* qr, Digit scalingFactor, int
length) {
+ Digit c = 0;
+ for (int i = length - 1; i >= 0; i--)
+ qr[i] = xdy(qr[i], scalingFactor, c); // undo scaling to get remainder
+ assert(c == 0, "qr scaling broken");
+}
+
+Digit* IntegerOps::qr_decomposition(Integer& dividend, Integer& y0) {
// qr_decomposition divides x by y (unsigned) and returns its decomposition
// into quotient (q) and remainder (r) packed into the array qr with length
// x.length() + 1. The layout of the result qr is as follows:
@@ -535,69 +488,50 @@
// length of quotient : ql = xl - yl + 1 (xl >= yl => ql >= 1)
// length of remainder: rl = yl (yl > 0 => rl >= 1)

- int xl = x0.length();
- int yl = y0.length();
- if (xl < yl) fatal("division not needed");
- if (yl == 0) fatal("division by zero");
+ int dividendLength = dividend.length();
+ int divisorLength = y0.length();
+ if (dividendLength < divisorLength) fatal("division not needed");
+ if (divisorLength == 0) fatal("division by zero");
// initialize qr
- Digit* x = NEW_RESOURCE_ARRAY(Digit, xl+1);
- int i = xl;
- while (i > 0) { i--; x[i] = x0[i]; }
- // decompose
- if (yl == 1) {
- // single-digit y => use simple division
- int i = xl;
- Digit c = 0;
- Digit d = y0._first_digit;
- while (i > 0) { i--; x[i+1] = xdy(x[i], d, c); }
- x[0] = c;
- } else if (xl >= yl) {
- missing_code_for("division by large integers");
- // full division
- x[xl] = 0;
- Digit* y = y0.digits();
- Digit d = (hlfB - 1) / y[yl-1] + 1;
-
- if (d != 1) {
- // scale x (already copied)
- x[xl] = scale(x, d, xl);
- // make a copy of y
- y = NEW_RESOURCE_ARRAY(Digit, yl);
- int i = yl;
- while (i > 0) { i--; y[i] = y0[i]; }
- // scale y
- Digit c = scale(y, d, yl);
- if (c != 0) fatal("qr_decomposition broken");
- }
-
- Digit y1 = y[yl-1];
- Digit y2 = y[yl-2];
- int i = xl;
- while (i >= yl) {
- Digit q = (x[i] == y1) ? oneB : xdy(x[i-1], y1, x[i]);
-
- while (true) {}
-
- int j = i-yl;
- int k = 0;
- Digit c = 0;
- while (k < yl) { j++; k++; }
- if (true) {
-
- } else {
- x[i] = q;
- }
- i--;
- }
- if (d != 1) {
- int i = yl;
- Digit c = 0;
- while (i > 0) { i--; x[i] = xdy(x[i], d, c); }
- }
- } else {
- // xl < yl
- //
- // add some more comments here
+ Digit* x = copyDigits(dividend.digits(), dividendLength+1,
dividendLength);
+
+ if (divisorLength == 1)
+ return qr_decomposition_single_digit(x, dividendLength,
y0._first_digit);
+
+ // full division
+ x[dividendLength] = 0;
+ Digit* y = y0.digits();
+
+ Digit d = qr_scaling_factor(y[divisorLength-1]); // d = B/(yn + 1)
+
+ if (d > 1) {
+ x[dividendLength] = scale(x, d, dividendLength);
+ y = copyDigits(y, divisorLength, divisorLength);
+ Digit c = scale(y, d, divisorLength);
+
+ if (c != 0) fatal("qr_decomposition broken");
+ }
+
+ Digit y1 = y[divisorLength-1];
+ Digit y2 = y[divisorLength-2];
+ int i = dividendLength;
+ while (i >= divisorLength) {
+ Digit xi = x[i]; //x[i] gets overwritten by remainder so save it for
later
+ Digit q = qr_estimate_digit_quotient(x[i], x[i-1], y1); // estimate q
= rem/y
+ //x[i] now contains remainder - used in test below
+ q = qr_adjust_for_over_estimate(y1, y2, q, x[i], x[i - 2]);
+
+ Digit b = qr_calculate_remainder(x, y, q, i - divisorLength,
divisorLength);
+ xmy(xi, 0, b);
+ if (b) { // underflow
+ x[i] = qr_adjust_for_underflow(x, y, q, i - divisorLength,
divisorLength);
+ } else {
+ x[i] = q;
+ }
+ i--;
+ }
+ if (d != 1) {
+ qr_unscale_remainder(x, d, divisorLength);
}
return x;
}
@@ -621,13 +555,91 @@
}
}

+bool IntegerOps::sd_all_zero(Digit* digits, int start, int stop) {
+ for (int i = start; i < stop; i++)
+ if (digits[i]) return false;
+ return true;
+}
+
+void IntegerOps::signed_div(Integer& x, Integer& y, Integer& z) {
+ int xl = x.length();
+ bool xneg = x.is_negative();
+ int yl = y.length();
+ bool yneg = y.is_negative();
+
+ if (xl < yl) {
+ // unsigned x < unsigned y => z = 0
+ if (xneg == yneg)
+ z.set_length(0);
+ else {
+ z.set_length(1);
+ z[0] = 1;
+ neg(z);
+ }
+ } else {
+ // xl >= yl
+ ResourceMark rm;
+ Digit* qr = qr_decomposition(x, y);
+
+ int i = xl;
+ while (i >= yl && qr[i] == 0) i--;
+ // i < yl || qr[i] != 0
+ Digit carry = !sd_all_zero(qr, 0, yl) && xneg != yneg;
+ int digits = i - yl + 1;
+ for (int j = 0; j < digits; j++)
+ z[j] = xpy(qr[yl + j], 0, carry);
+
+ if (carry) {
+ z.set_length(i-yl+2);
+ z[i - yl + 1] = carry;
+ } else
+ z.set_length(i-yl+1);
+ if (xneg != yneg) neg(z);
+ }
+}
+int IntegerOps::last_non_zero_index(Digit* z, int lastIndex) {
+ int i = lastIndex;
+ while (i >= 0&& z[i] == 0) i--;
+ return i;
+}
+void IntegerOps::signed_mod(Integer& x, Integer& y, Integer& z) {
+ int xl = x.length();
+ int yl = y.length();
+ if (xl < yl) {
+ // unsigned x < unsigned y => z = (y - x)
+ Digit carry = 0;
+ int i;
+ for (i = 0; i < xl; i++)
+ z[i] = xmy(y[i], x[i], carry);
+ for (i = xl; i < yl; i++)
+ z[i] = xmy(y[i], 0, carry);
+ assert(carry == 0, "Remainder too large");
+
+ z.set_length(last_non_zero_index(z.digits(), yl -1) + 1);
+ } else {
+ // xl >= yl
+ ResourceMark rm;
+ Digit* qr = qr_decomposition(x, y);
+
+ if (!sd_all_zero(qr, 0, yl)) {
+ Digit carry = 0;
+ for (int j = 0; j < yl; j++)
+ qr[j] = xmy(y[j], qr[j], carry);
+ assert(carry == 0, "Remainder too large");
+ }
+
+ int i = last_non_zero_index(qr, yl -1);
+ z.set_length(i+1);
+ while (i >= 0) { z[i] = qr[i]; i--; }
+ }
+}

void IntegerOps::unsigned_rem(Integer& x, Integer& y, Integer& z) {
int xl = x.length();
int yl = y.length();
if (xl < yl) {
- // unsigned x < unsigned y => z = y
- copy(y, z);
+ // unsigned x < unsigned y => z = x
+ copy(x, z);
} else {
// xl >= yl
ResourceMark rm;
@@ -718,62 +730,78 @@

int IntegerOps::div_result_size_in_bytes(Integer& x, Integer& y) {
int l;
- if (!x.is_negative() && y.is_positive()) {
+ if (x.is_negative() == y.is_negative()) {
l = unsigned_quo_result_length(x, y);
} else {
- missing_code_for("division with negative numbers");
+ l = unsigned_quo_result_length(x, y) + 1;
}
return Integer::length_to_size_in_bytes(l);
}


int IntegerOps::mod_result_size_in_bytes(Integer& x, Integer& y) {
- int l;
- if (!x.is_negative() && y.is_positive()) {
- l = unsigned_rem_result_length(x, y);
- } else {
- missing_code_for("division with negative numbers");
- }
- return Integer::length_to_size_in_bytes(l);
+ int digitLength = unsigned_rem_result_length(x, y);
+ return Integer::length_to_size_in_bytes(digitLength);
}


int IntegerOps::and_result_size_in_bytes(Integer& x, Integer& y) {
- int l;
- if (x.is_positive() && y.is_positive()) {
- l = min(x.length(), y.length());
+ int digitLength;
+ if (x.is_zero()||y.is_zero()) {
+ digitLength = 0;
+ } else if (x.is_positive() && y.is_positive()) {
+ digitLength = min(x.length(), y.length());
+ } else if (x.is_positive()) {
+ digitLength = x.length();
+ } else if (y.is_positive()) {
+ digitLength = y.length();
} else {
- missing_code_for("bitwise and with negative numbers");
- }
- return Integer::length_to_size_in_bytes(l);
+ digitLength = max(x.length(), y.length());
+ }
+ return Integer::length_to_size_in_bytes(digitLength);
}


int IntegerOps::or_result_size_in_bytes (Integer& x, Integer& y) {
- int l;
- if (x.is_positive() && y.is_positive()) {
- l = max(x.length(), y.length());
- } else {
- missing_code_for("bitwise or with negative numbers");
- }
- return Integer::length_to_size_in_bytes(l);
+ int digitLength;
+ if (x.is_positive() && y.is_positive())
+ digitLength = max(x.length(), y.length());
+ else if (y.is_positive())
+ digitLength = x.length();
+ else if (x.is_positive())
+ digitLength = y.length();
+ else
+ digitLength = min(x.length(), y.length());
+
+ return Integer::length_to_size_in_bytes(digitLength);
}


int IntegerOps::xor_result_size_in_bytes(Integer& x, Integer& y) {
- int l;
- if (x.is_positive() && y.is_positive()) {
- l = max(x.length(), y.length());
- } else {
- missing_code_for("bitwise xor with negative numbers");
- }
- return Integer::length_to_size_in_bytes(l);
+ int digitLength;
+ if (x.is_negative() != y.is_negative())
+ digitLength = max(x.length(), y.length()) + 1;
+ else
+ digitLength = max(x.length(), y.length());
+ return Integer::length_to_size_in_bytes(digitLength);
}


int IntegerOps::ash_result_size_in_bytes(Integer& x, int n) {
- missing_code_for("arithmetic shift");
- return 0;
+ int digitLength;
+ if (x.is_zero() || n == 0) {
+ digitLength = x.length();
+ } else if (n > 0) {
+ int rem = n % logB;
+ Digit mask = nthMask(logB - rem) ^ oneB;
+ bool overflow = (mask & x[x.length() - 1]) != 0;
+ digitLength = x.length() + (n / logB) + overflow;
+ } else {
+ int rem = (-n) % logB;
+ Digit mask = nthMask(rem) ^ oneB;
+ digitLength = max(x.length() + (n / logB), 1);
+ }
+ return Integer::length_to_size_in_bytes(digitLength);
}


@@ -861,71 +889,232 @@
if (x.is_negative()) neg(z);
}

+#define copyInteger(x)\
+ (Integer*)memcpy((void*)NEW_RESOURCE_ARRAY(Digit, x.length() + 1), \
+ (void*)&x._signed_length,\
+ (x.length() + 1) * sizeof(Digit))

void IntegerOps::div(Integer& x, Integer& y, Integer& z) {
+ ResourceMark rm;
+
if (!x.is_negative() && y.is_positive()) {
unsigned_quo(x, y, z);
} else {
- missing_code_for("division with negative numbers");
+ signed_div(x, y, z);
}
}


void IntegerOps::mod(Integer& x, Integer& y, Integer& z) {
- if (!x.is_negative() && y.is_positive()) {
+ if (x.is_negative() == y.is_negative()) {
unsigned_rem(x, y, z);
} else {
- missing_code_for("division with negative numbers");
- }
+ signed_mod(x, y, z);
+ }
+ if (y.is_negative() && z.is_not_zero()) neg(z);
}


void IntegerOps::and(Integer& x, Integer& y, Integer& z) {
- if (x.is_positive() && y.is_positive()) {
+ if (x.is_zero() || y.is_zero()) {
+ z.set_length(0);
+ } else if (x.is_positive() && y.is_positive()) {
int l = min(x.length(), y.length());
int i = 0;
while (i < l) { z[i] = x[i] & y[i]; i++; }
z.set_length(i);
+ } else if (x.is_positive()) {
+ and_one_positive(x, y, z);
+ } else if (y.is_positive()) {
+ and_one_positive(y, x, z);
} else {
- missing_code_for("bitwise and with negative numbers");
+ and_both_negative(x, y, z);
}
}
-
+void IntegerOps::and_both_negative(Integer& x, Integer& y, Integer& z) {
+ int digitLength = max(x.length(), y.length());
+
+ Digit xcarry = 1;
+ Digit ycarry = 1;
+ Digit zcarry = 1;
+ int i = 0;
+ while(i < min(x.length(), y.length())) {
+ z[i] = xpy((xpy(x[i] ^ 0xffffffff, 0, xcarry)
+ & xpy(y[i] ^ 0xffffffff, 0, ycarry)) ^ 0xffffffff, 0,
zcarry);
+ i++;
+ }
+ while(i < x.length()) {
+ z[i] = x[i];
+ i++;
+ }
+ while(i < y.length()) {
+ z[i] = y[i];
+ i++;
+ }
+ z.set_length(-digitLength);
+}
+
+void IntegerOps::and_one_positive(Integer& positive, Integer& negative,
Integer& z) {
+ int digitLength = positive.length();
+
+ Digit carry = 1;
+ int i = 0;
+ while(i < min(positive.length(), negative.length())) { // digits in both
+ z[i] = positive[i] & xpy((negative[i] ^oneB), 0, carry);
+ i++;
+ }
+ while(i < digitLength) { // remaining digits in positive
+ z[i] = positive[i];
+ i++;
+ }
+ z.set_length(digitLength);
+}

void IntegerOps::or(Integer& x, Integer& y, Integer& z) {
- if (x.is_positive() && y.is_positive()) {
- int xl = x.length();
- int yl = y.length();
- int l = min(xl, yl);
- int i = 0;
+ int xl = x.length();
+ int yl = y.length();
+ int l = min(xl, yl);
+ Digit xcarry = 1;
+ Digit ycarry = 1;
+ Digit zcarry = 1;
+ int i = 0;
+ if (!x.is_negative() && !y.is_negative()) {
while (i < l) { z[i] = x[i] | y[i]; i++; }
while (i < xl) { z[i] = x[i] ; i++; }
while (i < yl) { z[i] = y[i]; i++; }
z.set_length(i);
+ return;
+ } else if (!x.is_negative()) {
+ while (i < l) {
+ z[i] = xpy((x[i] | xpy(y[i] ^ oneB, 0, ycarry)) ^ oneB, 0, zcarry);
+ i++;
+ }
+ while (i < yl) {
+ z[i] = y[i];
+ i++;
+ }
+ } else if (!y.is_negative()) {
+ while (i < l) {
+ z[i] = xpy((y[i] | xpy(x[i] ^ oneB, 0, xcarry)) ^ oneB, 0, zcarry);
+ i++;
+ }
+ while (i < xl) {
+ z[i] = x[i];
+ i++;
+ }
} else {
- missing_code_for("bitwise or with negative numbers");
- }
+ assert(x.is_negative() && y.is_negative(), "Error invalid integers?");
+ while (i < l) {
+ z[i] = xpy((xpy(y[i] ^ oneB, 0, ycarry) | xpy(x[i] ^ oneB, 0,
xcarry)) ^ oneB, 0, zcarry);
+ i++;
+ }
+ }
+ while (i > 0 && !z[i - 1]) i--;
+ z.set_length(-i);
}


void IntegerOps::xor(Integer& x, Integer& y, Integer& z) {
- if (x.is_positive() && y.is_positive()) {
- int xl = x.length();
- int yl = y.length();
- int l = min(xl, yl);
- int i = 0;
+ int xl = x.length();
+ int yl = y.length();
+ int l = min(xl, yl);
+ int i = 0;
+ if (!x.is_negative() && !y.is_negative()) {
while (i < l) { z[i] = x[i] ^ y[i]; i++; }
while (i < xl) { z[i] = x[i] ; i++; }
while (i < yl) { z[i] = y[i]; i++; }
+ while (i > 0 && !z[i - 1]) i--;
z.set_length(i);
+ } else if (!y.is_negative()) {
+ xor_one_positive(y, x, z);
+ } else if (!x.is_negative()) {
+ xor_one_positive(x, y, z);
} else {
- missing_code_for("bitwise xor with negative numbers");
+ assert(x.is_negative() && y.is_negative(), "Error invalid integers?");
+ Digit xcarry = 1;
+ Digit ycarry = 1;
+ while(i < l) {
+ z[i] = xmy(x[i], 0, xcarry) ^ xmy(y[i], 0, ycarry);
+ i++;
+ }
+ while (i < xl) {
+ z[i] = xmy(x[i], 0, xcarry);
+ i++;
+ }
+ while (i < yl) {
+ z[i] = xmy(y[i], 0, ycarry);
+ i++;
+ }
+ while (i > 0 && z[i - 1] == 0) i--;
+ z.set_length(i);
}
}

-
+void IntegerOps::xor_one_positive(Integer& positive, Integer& negative,
Integer& z) {
+ int pl = positive.length();
+ int nl = negative.length();
+ int l = min(pl, nl);
+ int i = 0;
+ Digit ncarry = 1;
+ Digit zcarry = 1;
+ while (i < l) {
+ z[i] = xpy(positive[i] ^ xmy(negative[i], 0, ncarry), 0, zcarry);
+ i++;
+ }
+ while (i < nl) {
+ z[i] = xpy(xmy(negative[i], 0, ncarry), 0, zcarry);
+ i++;
+ }
+ while (i < pl) {
+ z[i] = xpy(positive[i], 0, zcarry);
+ i++;
+ }
+ if (zcarry) {
+ z[i] = 1;
+ i++;
+ }
+ z.set_length(-i);
+}
void IntegerOps::ash(Integer& x, int n, Integer& z) {
- missing_code_for("arithmetic shift");
+ if (n > 0) {
+ int i = 0;
+ int bitShift = n % logB;
+ int digitShift = n / logB;
+ while (i < digitShift) {
+ z[i] = 0;
+ i++;
+ }
+ Digit carry = 0;
+ while (i < x.length() + digitShift) {
+ z[i] = (x[i - digitShift] << bitShift) + carry;
+ carry = bitShift ? x[i - digitShift] >> (logB - bitShift) : 0;
+ i++;
+ }
+ if (carry) {
+ z[i] = carry;
+ i++;
+ }
+ z.set_length(i);
+ if (x.is_negative()) neg(z);
+ } else {
+ int digitShift = -n / logB;
+ int bitShift = -n % logB;
+ int i = x.length() - digitShift;
+ Digit carry = 0;
+ while (i > 0) {
+ i--;
+ z[i] = (x[i + digitShift] >> bitShift) + carry;
+ carry = bitShift ? (x[i + digitShift] & nthMask(bitShift)) << (logB
- bitShift) : 0;
+ }
+ i = x.length() - digitShift;
+ while(i > 0 && z[i - 1] == 0) i--;
+ z.set_length(max(i, 0));
+ if (x.is_negative()) neg(z);
+ if (x.is_negative() && z.is_zero()) {
+ z.set_length(-1);
+ z[0] = 1;
+ }
+ }
}


@@ -1054,6 +1243,13 @@
}
}

+int IntegerOps::hash(Integer& x) {
+ int hash = 0;
+ for (int i = x.length() - 1; i >= 0; i--)
+ hash ^= x[i];
+ hash ^= x.signum();
+ return hash>>2;
+}

// testing

=======================================
--- /branches/gcc-linux/vm/prims/integerOps.hpp Sun Sep 13 14:52:44 2009
+++ /branches/gcc-linux/vm/prims/integerOps.hpp Sun Dec 6 13:13:11 2009
@@ -32,6 +32,7 @@

class IntegerOps;
typedef unsigned int Digit;
+typedef unsigned long long DoubleDigit;

class Integer: ValueObj {
private:
@@ -78,7 +79,7 @@
// can be computed via the corresponding functions.

class IntegerOps: AllStatic {
- private:
+ public:
static inline Digit as_Digit(char c);
static inline char as_char(int i);

@@ -102,13 +103,24 @@
static void unsigned_quo(Integer& x, Integer& y, Integer& z);
static void unsigned_rem(Integer& x, Integer& y, Integer& z);
static int unsigned_cmp(Integer& x, Integer& y );
-
- static Digit scale(Digit* array, Digit factor, int length);
- static Digit* qr_decomposition(Integer& x, Integer& y);
- static Digit last_digit (Integer& x, Digit b); // divides x by b and
returns x mod b
- static void first_digit(Integer& x, Digit b, Digit c); // multiplies
x by b and adds c
-
- public:
+ static void signed_div (Integer& x, Integer& y, Integer& z);
+ static void signed_mod (Integer& x, Integer& y, Integer& z);
+
+ static int last_non_zero_index(Digit* z, int lastIndex);
+ static Digit scale(Digit* array, Digit factor, int length);
+ static bool sd_all_zero(Digit* digits, int start, int stop);
+ static Digit* copyDigits(Digit* source, int length, int toCopy);
+ static Digit* qr_decomposition(Integer& x, Integer& y);
+ static Digit qr_estimate_digit_quotient(Digit& xhi, Digit xlo, Digit y);
+ static Digit* qr_decomposition_single_digit(Digit* qr, int length, Digit
divisor);
+ static Digit qr_calculate_remainder(Digit* qr, Digit* divisor, Digit q,
int qrStart, int stop);
+ static Digit qr_adjust_for_underflow(Digit* qr, Digit* divisor, Digit
q, int qrStart, int stop);
+ static Digit qr_adjust_for_over_estimate(Digit y1, Digit y2, Digit q,
Digit xi, Digit xi2);
+ static Digit qr_scaling_factor(Digit firstDivisorDigit);
+ static void qr_unscale_remainder(Digit* qr, Digit scalingFactor, int
length);
+ static Digit last_digit (Integer& x, Digit b); // divides x by b and
returns x mod b
+ static void first_digit(Integer& x, Digit b, Digit c); // multiplies
x by b and adds c
+
// the following functions return the maximum result size
// in bytes for the operation specified in the function name
static int add_result_size_in_bytes(Integer& x, Integer& y);
@@ -124,6 +136,9 @@
static int xor_result_size_in_bytes(Integer& x, Integer& y);
static int ash_result_size_in_bytes(Integer& x, int n);

+ static void and_both_negative(Integer& x, Integer& y, Integer& z);
+ static void and_one_positive(Integer& x, Integer& y, Integer& z);
+ static void xor_one_positive(Integer& positive, Integer& negative,
Integer& z);
static int copy_result_size_in_bytes(Integer& x);
static int int_to_Integer_result_size_in_bytes(int i);
static int double_to_Integer_result_size_in_bytes(double x);
@@ -148,6 +163,7 @@

static void abs(Integer& x); // x := |x|
static void neg(Integer& x); // x := -x
+ static int hash(Integer& x);

// copy & conversion operations
static void copy(Integer& x, Integer& z);
@@ -156,7 +172,6 @@
static void double_to_Integer(double x, Integer& z);
static void string_to_Integer(char* s, int base, Integer& z);
static void Integer_to_string(Integer& x, int base, char* s);
-
// testing/debugging
static void self_test();
};
=======================================
--- /branches/gcc-linux/vm/prims/prims.inc Sat Oct 17 07:54:56 2009
+++ /branches/gcc-linux/vm/prims/prims.inc Sun Dec 6 13:13:11 2009
@@ -2008,81 +2008,81 @@
errors_200
};

-static char* signature_201[] = { "Float", "IndexedByteInstanceVariables"};
-static char* errors_201[] = {NULL};
+static char* signature_201[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* errors_201[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
static primitive_desc primitive_201 = {
- "primitiveIndexedByteLargeIntegerAsFloatIfFail:",
- fntype(&byteArrayPrimitives::largeIntegerToFloat),
- 1312257,
+ "primitiveIndexedByteLargeIntegerAnd:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerAnd),
+ 1312258,
signature_201,
errors_201
};

-static char* signature_202[] =
{ "SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* signature_202[] = { "Float", "IndexedByteInstanceVariables"};
static char* errors_202[] = {NULL};
static primitive_desc primitive_202 = {
- "primitiveIndexedByteLargeIntegerCompare:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerCompare),
- 1312258,
+ "primitiveIndexedByteLargeIntegerAsFloatIfFail:",
+ fntype(&byteArrayPrimitives::largeIntegerToFloat),
+ 1312257,
signature_202,
errors_202
};

-static char* signature_203[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
-static char* errors_203[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
+static char* signature_203[] =
{ "SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* errors_203[] = {NULL};
static primitive_desc primitive_203 = {
- "primitiveIndexedByteLargeIntegerDiv:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerDiv),
+ "primitiveIndexedByteLargeIntegerCompare:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerCompare),
1312258,
signature_203,
errors_203
};

-static char* signature_204[] =
{ "IndexedByteInstanceVariables", "IndexedByteInstanceVariables
class", "Float"};
-static char* errors_204[] = {NULL};
+static char* signature_204[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* errors_204[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
static primitive_desc primitive_204 = {
- "primitiveIndexedByteLargeIntegerFromFloat:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerFromDouble),
- 1310722,
+ "primitiveIndexedByteLargeIntegerDiv:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerDiv),
+ 1312258,
signature_204,
errors_204
};

-static char* signature_205[] =
{ "IndexedByteInstanceVariables", "IndexedByteInstanceVariables
class", "SmallInteger"};
+static char* signature_205[] =
{ "IndexedByteInstanceVariables", "IndexedByteInstanceVariables
class", "Float"};
static char* errors_205[] = {NULL};
static primitive_desc primitive_205 = {
- "primitiveIndexedByteLargeIntegerFromSmallInteger:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerFromSmallInteger),
+ "primitiveIndexedByteLargeIntegerFromFloat:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerFromDouble),
1310722,
signature_205,
errors_205
};

-static char* signature_206[] =
{ "IndexedByteInstanceVariables", "IndexedByteInstanceVariables
class", "String", "Integer"};
-static char* errors_206[] = { "ConversionFailed", NULL};
+static char* signature_206[] =
{ "IndexedByteInstanceVariables", "IndexedByteInstanceVariables
class", "SmallInteger"};
+static char* errors_206[] = {NULL};
static primitive_desc primitive_206 = {
- "primitiveIndexedByteLargeIntegerFromString:base:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerFromString),
- 1312259,
+ "primitiveIndexedByteLargeIntegerFromSmallInteger:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerFromSmallInteger),
+ 1310722,
signature_206,
errors_206
};

-static char* signature_207[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
-static char* errors_207[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
+static char* signature_207[] =
{ "IndexedByteInstanceVariables", "IndexedByteInstanceVariables
class", "String", "Integer"};
+static char* errors_207[] = { "ConversionFailed", NULL};
static primitive_desc primitive_207 = {
- "primitiveIndexedByteLargeIntegerMod:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerMod),
- 1312258,
+ "primitiveIndexedByteLargeIntegerFromString:base:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerFromString),
+ 1312259,
signature_207,
errors_207
};

static char* signature_208[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
-static char* errors_208[] = { "ArgumentIsInvalid", NULL};
+static char* errors_208[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
static primitive_desc primitive_208 = {
- "primitiveIndexedByteLargeIntegerMultiply:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerMultiply),
+ "primitiveIndexedByteLargeIntegerMod:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerMod),
1312258,
signature_208,
errors_208
@@ -2091,949 +2091,949 @@
static char* signature_209[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
static char* errors_209[] = { "ArgumentIsInvalid", NULL};
static primitive_desc primitive_209 = {
- "primitiveIndexedByteLargeIntegerSubtract:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerSubtract),
+ "primitiveIndexedByteLargeIntegerMultiply:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerMultiply),
1312258,
signature_209,
errors_209
};

-static char* signature_210[] =
{ "String", "IndexedByteInstanceVariables", "SmallInteger"};
-static char* errors_210[] = {NULL};
+static char* signature_210[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* errors_210[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
static primitive_desc primitive_210 = {
- "primitiveIndexedByteLargeIntegerToStringBase:ifFail:",
- fntype(&byteArrayPrimitives::largeIntegerToString),
+ "primitiveIndexedByteLargeIntegerOr:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerOr),
1312258,
signature_210,
errors_210
};

-static char* signature_211[] = { "Object", "IndexedByteInstanceVariables
class", "SmallInteger"};
-static char* errors_211[] = { "NegativeSize", NULL};
+static char* signature_211[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* errors_211[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
static primitive_desc primitive_211 = {
- "primitiveIndexedByteNew:ifFail:",
- fntype(&byteArrayPrimitives::allocateSize),
- 1376258,
+ "primitiveIndexedByteLargeIntegerQuo:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerQuo),
+ 1312258,
signature_211,
errors_211
};

-static char* signature_212[] = { "Object", "IndexedByteInstanceVariables
class", "SmallInteger", "Boolean"};
-static char* errors_212[] = { "NegativeSize", NULL};
+static char* signature_212[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* errors_212[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
static primitive_desc primitive_212 = {
- "primitiveIndexedByteNew:size:tenured:ifFail:",
- fntype(&byteArrayPrimitives::allocateSize2),
- 327683,
+ "primitiveIndexedByteLargeIntegerRem:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerRem),
+ 1312258,
signature_212,
errors_212
};

-static char* signature_213[] =
{ "SmallInteger", "IndexedByteInstanceVariables"};
-static char* errors_213[] = {NULL};
+static char* signature_213[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "SmallInt"};
+static char* errors_213[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
static primitive_desc primitive_213 = {
- "primitiveIndexedByteSize",
- fntype(&byteArrayPrimitives::size),
- 1574401,
+ "primitiveIndexedByteLargeIntegerShift:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerShift),
+ 1312258,
signature_213,
errors_213
};

-static char* signature_214[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables", "SmallInteger"};
-static char* errors_214[] = { "OutOfBounds", NULL};
+static char* signature_214[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* errors_214[] = { "ArgumentIsInvalid", NULL};
static primitive_desc primitive_214 = {
- "primitiveIndexedDoubleByteAt:ifFail:",
- fntype(&doubleByteArrayPrimitives::at),
- 1312514,
+ "primitiveIndexedByteLargeIntegerSubtract:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerSubtract),
+ 1312258,
signature_214,
errors_214
};

-static char* signature_215[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables", "SmallInteger", "SmallInteger"};
-static char* errors_215[] = { "OutOfBounds", "ValueOutOfBounds", NULL};
+static char* signature_215[] =
{ "String", "IndexedByteInstanceVariables", "SmallInteger"};
+static char* errors_215[] = {NULL};
static primitive_desc primitive_215 = {
- "primitiveIndexedDoubleByteAt:put:ifFail:",
- fntype(&doubleByteArrayPrimitives::atPut),
- 1312515,
+ "primitiveIndexedByteLargeIntegerToStringBase:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerToString),
+ 1312258,
signature_215,
errors_215
};

-static char* signature_216[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables", "SmallInteger"};
-static char* errors_216[] = { "OutOfBounds", NULL};
+static char* signature_216[] = { "IndexedByteInstanceVariables|
SmallInteger", "IndexedByteInstanceVariables", "IndexedByteInstanceVariables"};
+static char* errors_216[] = { "ArgumentIsInvalid", "DivisionByZero", NULL};
static primitive_desc primitive_216 = {
- "primitiveIndexedDoubleByteCharacterAt:ifFail:",
- fntype(&doubleByteArrayPrimitives::characterAt),
- 1312514,
+ "primitiveIndexedByteLargeIntegerXor:ifFail:",
+ fntype(&byteArrayPrimitives::largeIntegerXor),
+ 1312258,
signature_216,
errors_216
};

-static char* signature_217[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables", "String"};
-static char* errors_217[] = {NULL};
+static char* signature_217[] = { "Object", "IndexedByteInstanceVariables
class", "SmallInteger"};
+static char* errors_217[] = { "NegativeSize", NULL};
static primitive_desc primitive_217 = {
- "primitiveIndexedDoubleByteCompare:ifFail:",
- fntype(&doubleByteArrayPrimitives::compare),
- 1310722,
+ "primitiveIndexedByteNew:ifFail:",
+ fntype(&byteArrayPrimitives::allocateSize),
+ 1376258,
signature_217,
errors_217
};

-static char* signature_218[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables"};
-static char* errors_218[] = {NULL};
+static char* signature_218[] = { "Object", "IndexedByteInstanceVariables
class", "SmallInteger", "Boolean"};
+static char* errors_218[] = { "NegativeSize", NULL};
static primitive_desc primitive_218 = {
- "primitiveIndexedDoubleByteHash",
- fntype(&doubleByteArrayPrimitives::hash),
- 1114113,
+ "primitiveIndexedByteNew:size:tenured:ifFail:",
+ fntype(&byteArrayPrimitives::allocateSize2),
+ 327683,
signature_218,
errors_218
};

-static char* signature_219[] =
{ "CompressedSymbol", "IndexedDoubleByteInstanceVariables"};
-static char* errors_219[] = { "ValueOutOfBounds", NULL};
+static char* signature_219[] =
{ "SmallInteger", "IndexedByteInstanceVariables"};
+static char* errors_219[] = {NULL};
static primitive_desc primitive_219 = {
- "primitiveIndexedDoubleByteInternIfFail:",
- fntype(&doubleByteArrayPrimitives::intern),
- 1376257,
+ "primitiveIndexedByteSize",
+ fntype(&byteArrayPrimitives::size),
+ 1574401,
signature_219,
errors_219
};

-static char* signature_220[] =
{ "Object", "IndexedDoubleByteInstanceVariables class", "SmallInteger"};
-static char* errors_220[] = { "NegativeSize", NULL};
+static char* signature_220[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables", "SmallInteger"};
+static char* errors_220[] = { "OutOfBounds", NULL};
static primitive_desc primitive_220 = {
- "primitiveIndexedDoubleByteNew:ifFail:",
- fntype(&doubleByteArrayPrimitives::allocateSize),
- 1376258,
+ "primitiveIndexedDoubleByteAt:ifFail:",
+ fntype(&doubleByteArrayPrimitives::at),
+ 1312514,
signature_220,
errors_220
};

-static char* signature_221[] =
{ "Object", "IndexedDoubleByteInstanceVariables
class", "SmallInteger", "Boolean"};
-static char* errors_221[] = { "NegativeSize", NULL};
+static char* signature_221[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables", "SmallInteger", "SmallInteger"};
+static char* errors_221[] = { "OutOfBounds", "ValueOutOfBounds", NULL};
static primitive_desc primitive_221 = {
- "primitiveIndexedDoubleByteNew:size:tenured:ifFail:",
- fntype(&doubleByteArrayPrimitives::allocateSize2),
- 327683,
+ "primitiveIndexedDoubleByteAt:put:ifFail:",
+ fntype(&doubleByteArrayPrimitives::atPut),
+ 1312515,
signature_221,
errors_221
};

-static char* signature_222[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables"};
-static char* errors_222[] = {NULL};
+static char* signature_222[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables", "SmallInteger"};
+static char* errors_222[] = { "OutOfBounds", NULL};
static primitive_desc primitive_222 = {
- "primitiveIndexedDoubleByteSize",
- fntype(&doubleByteArrayPrimitives::size),
- 1574657,
+ "primitiveIndexedDoubleByteCharacterAt:ifFail:",
+ fntype(&doubleByteArrayPrimitives::characterAt),
+ 1312514,
signature_222,
errors_222
};

-static char* signature_223[] =
{ "Float", "IndexedFloatValueInstanceVariables", "SmallInteger"};
-static char* errors_223[] = { "OutOfBounds", NULL};
+static char* signature_223[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables", "String"};
+static char* errors_223[] = {NULL};
static primitive_desc primitive_223 = {
- "primitiveIndexedFloatValueAt:ifFail:",
- fntype(&doubleValueArrayPrimitives::at),
+ "primitiveIndexedDoubleByteCompare:ifFail:",
+ fntype(&doubleByteArrayPrimitives::compare),
1310722,
signature_223,
errors_223
};

-static char* signature_224[] =
{ "Float", "IndexedFloatValueInstanceVariables", "SmallInteger", "Float"};
-static char* errors_224[] = { "OutOfBounds", "ValueOutOfBounds", NULL};
+static char* signature_224[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables"};
+static char* errors_224[] = {NULL};
static primitive_desc primitive_224 = {
- "primitiveIndexedFloatValueAt:put:ifFail:",
- fntype(&doubleValueArrayPrimitives::atPut),
- 1310723,
+ "primitiveIndexedDoubleByteHash",
+ fntype(&doubleByteArrayPrimitives::hash),
+ 1114113,
signature_224,
errors_224
};

-static char* signature_225[] =
{ "Object", "IndexedFloatValueInstanceVariables class", "SmallInteger"};
-static char* errors_225[] = { "NegativeSize", NULL};
+static char* signature_225[] =
{ "CompressedSymbol", "IndexedDoubleByteInstanceVariables"};
+static char* errors_225[] = { "ValueOutOfBounds", NULL};
static primitive_desc primitive_225 = {
- "primitiveIndexedFloatValueNew:ifFail:",
- fntype(&doubleValueArrayPrimitives::allocateSize),
- 1376258,
+ "primitiveIndexedDoubleByteInternIfFail:",
+ fntype(&doubleByteArrayPrimitives::intern),
+ 1376257,
signature_225,
errors_225
};

-static char* signature_226[] =
{ "SmallInteger", "IndexedFloatValueInstanceVariables"};
-static char* errors_226[] = {NULL};
+static char* signature_226[] =
{ "Object", "IndexedDoubleByteInstanceVariables class", "SmallInteger"};
+static char* errors_226[] = { "NegativeSize", NULL};
static primitive_desc primitive_226 = {
- "primitiveIndexedFloatValueSize",
- fntype(&doubleValueArrayPrimitives::size),
- 1572865,
+ "primitiveIndexedDoubleByteNew:ifFail:",
+ fntype(&doubleByteArrayPrimitives::allocateSize),
+ 1376258,
signature_226,
errors_226
};

-static char* signature_227[] =
{ "SmallInteger", "IndexedInstanceVariables", "SmallInteger"};
-static char* errors_227[] = { "OutOfBounds", NULL};
+static char* signature_227[] =
{ "Object", "IndexedDoubleByteInstanceVariables
class", "SmallInteger", "Boolean"};
+static char* errors_227[] = { "NegativeSize", NULL};
static primitive_desc primitive_227 = {
- "primitiveIndexedObjectAt:ifFail:",
- fntype(&objArrayPrimitives::at),
- 1312002,
+ "primitiveIndexedDoubleByteNew:size:tenured:ifFail:",
+ fntype(&doubleByteArrayPrimitives::allocateSize2),
+ 327683,
signature_227,
errors_227
};

-static char* signature_228[] =
{ "Object", "IndexedInstanceVariables", "SmallInteger", "Object"};
-static char* errors_228[] = { "OutOfBounds", NULL};
+static char* signature_228[] =
{ "SmallInteger", "IndexedDoubleByteInstanceVariables"};
+static char* errors_228[] = {NULL};
static primitive_desc primitive_228 = {
- "primitiveIndexedObjectAt:put:ifFail:",
- fntype(&objArrayPrimitives::atPut),
- 1312003,
+ "primitiveIndexedDoubleByteSize",
+ fntype(&doubleByteArrayPrimitives::size),
+ 1574657,
signature_228,
errors_228
};

-static char* signature_229[] =
{ "Self", "IndexedInstanceVariables", "Object"};
-static char* errors_229[] = {NULL};
+static char* signature_229[] =
{ "Float", "IndexedFloatValueInstanceVariables", "SmallInteger"};
+static char* errors_229[] = { "OutOfBounds", NULL};
static primitive_desc primitive_229 = {
- "primitiveIndexedObjectAtAllPut:",
- fntype(&objArrayPrimitives::at_all_put),
- 1049858,
+ "primitiveIndexedFloatValueAt:ifFail:",
+ fntype(&doubleValueArrayPrimitives::at),
+ 1310722,
signature_229,
errors_229
};

-static char* signature_230[] =
{ "Self", "IndexedInstanceVariables", "SmallInteger", "SmallInteger", "SmallInteger"};
-static char* errors_230[] = { "OutOfBounds", "NegativeSize", NULL};
+static char* signature_230[] =
{ "Float", "IndexedFloatValueInstanceVariables", "SmallInteger", "Float"};
+static char* errors_230[] = { "OutOfBounds", "ValueOutOfBounds", NULL};
static primitive_desc primitive_230 = {
- "primitiveIndexedObjectCopyFrom:startingAt:size:ifFail:",
- fntype(&objArrayPrimitives::copy_size),
- 1377540,
+ "primitiveIndexedFloatValueAt:put:ifFail:",
+ fntype(&doubleValueArrayPrimitives::atPut),
+ 1310723,
signature_230,
errors_230
};

-static char* signature_231[] = { "Object", "IndexedInstanceVariables
class", "SmallInteger"};
+static char* signature_231[] =
{ "Object", "IndexedFloatValueInstanceVariables class", "SmallInteger"};
static char* errors_231[] = { "NegativeSize", NULL};
static primitive_desc primitive_231 = {
- "primitiveIndexedObjectNew:ifFail:",
- fntype(&objArrayPrimitives::allocateSize),
+ "primitiveIndexedFloatValueNew:ifFail:",
+ fntype(&doubleValueArrayPrimitives::allocateSize),
1376258,
signature_231,
errors_231
};

-static char* signature_232[] = { "Object", "IndexedInstanceVariables
class", "SmallInteger", "Boolean"};
-static char* errors_232[] = { "NegativeSize", NULL};
+static char* signature_232[] =
{ "SmallInteger", "IndexedFloatValueInstanceVariables"};
+static char* errors_232[] = {NULL};
static primitive_desc primitive_232 = {
- "primitiveIndexedObjectNew:size:tenured:ifFail:",
- fntype(&objArrayPrimitives::allocateSize2),
- 327683,
+ "primitiveIndexedFloatValueSize",
+ fntype(&doubleValueArrayPrimitives::size),
+ 1572865,
signature_232,
errors_232
};

-static char* signature_233[] =
{ "Self", "IndexedInstanceVariables", "SmallInteger", "SmallInteger", "IndexedInstanceVariables", "SmallInteger"};
+static char* signature_233[] =
{ "SmallInteger", "IndexedInstanceVariables", "SmallInteger"};
static char* errors_233[] = { "OutOfBounds", NULL};
static primitive_desc primitive_233 = {
- "primitiveIndexedObjectReplaceFrom:to:with:startingAt:ifFail:",
- fntype(&objArrayPrimitives::replace_from_to),
- 1377541,
+ "primitiveIndexedObjectAt:ifFail:",
+ fntype(&objArrayPrimitives::at),
+ 1312002,
signature_233,
errors_233
};

-static char* signature_234[] = { "Self", "IndexedInstanceVariables"};
-static char* errors_234[] = {NULL};
+static char* signature_234[] =
{ "Object", "IndexedInstanceVariables", "SmallInteger", "Object"};
+static char* errors_234[] = { "OutOfBounds", NULL};
static primitive_desc primitive_234 = {
- "primitiveIndexedObjectSize",
- fntype(&objArrayPrimitives::size),
- 1574145,
+ "primitiveIndexedObjectAt:put:ifFail:",
+ fntype(&objArrayPrimitives::atPut),
+ 1312003,
signature_234,
errors_234
};

-static char* signature_235[] = { "Instance", "Behavior", "SmallInt"};
+static char* signature_235[] =
{ "Self", "IndexedInstanceVariables", "Object"};
static char* errors_235[] = {NULL};
static primitive_desc primitive_235 = {
- "primitiveInlineAllocations:count:",
- fntype(&primitiveInlineAllocations),
- 4259842,
+ "primitiveIndexedObjectAtAllPut:",
+ fntype(&objArrayPrimitives::at_all_put),
+ 1049858,
signature_235,
errors_235
};

-static char* signature_236[] = { "Boolean", "Behavior", "Symbol"};
-static char* errors_236[] = {NULL};
+static char* signature_236[] =
{ "Self", "IndexedInstanceVariables", "SmallInteger", "SmallInteger", "SmallInteger"};
+static char* errors_236[] = { "OutOfBounds", "NegativeSize", NULL};
static primitive_desc primitive_236 = {
- "primitiveInliningDatabaseAddLookupEntryClass:selector:ifFail:",
- fntype(&systemPrimitives::inlining_database_add_entry),
- 327682,
+ "primitiveIndexedObjectCopyFrom:startingAt:size:ifFail:",
+ fntype(&objArrayPrimitives::copy_size),
+ 1377540,
signature_236,
errors_236
};

-static char* signature_237[] = { "Boolean"};
-static char* errors_237[] = {NULL};
+static char* signature_237[] = { "Object", "IndexedInstanceVariables
class", "SmallInteger"};
+static char* errors_237[] = { "NegativeSize", NULL};
static primitive_desc primitive_237 = {
- "primitiveInliningDatabaseCompile",
- fntype(&systemPrimitives::inlining_database_compile_next),
- 65536,
+ "primitiveIndexedObjectNew:ifFail:",
+ fntype(&objArrayPrimitives::allocateSize),
+ 1376258,
signature_237,
errors_237
};

-static char* signature_238[] = { "Object", "String"};
-static char* errors_238[] = {NULL};
+static char* signature_238[] = { "Object", "IndexedInstanceVariables
class", "SmallInteger", "Boolean"};
+static char* errors_238[] = { "NegativeSize", NULL};
static primitive_desc primitive_238 = {
- "primitiveInliningDatabaseCompile:ifFail:",
- fntype(&systemPrimitives::inlining_database_compile),
- 327681,
+ "primitiveIndexedObjectNew:size:tenured:ifFail:",
+ fntype(&objArrayPrimitives::allocateSize2),
+ 327683,
signature_238,
errors_238
};

-static char* signature_239[] = { "IndexedByteInstanceVariables", "String"};
-static char* errors_239[] = {NULL};
+static char* signature_239[] =
{ "Self", "IndexedInstanceVariables", "SmallInteger", "SmallInteger", "IndexedInstanceVariables", "SmallInteger"};
+static char* errors_239[] = { "OutOfBounds", NULL};
static primitive_desc primitive_239 = {
- "primitiveInliningDatabaseCompileDemangled:ifFail:",
- fntype(&systemPrimitives::inlining_database_demangle),
- 327681,
+ "primitiveIndexedObjectReplaceFrom:to:with:startingAt:ifFail:",
+ fntype(&objArrayPrimitives::replace_from_to),
+ 1377541,
signature_239,
errors_239
};

-static char* signature_240[] = { "Symbol"};
+static char* signature_240[] = { "Self", "IndexedInstanceVariables"};
static char* errors_240[] = {NULL};
static primitive_desc primitive_240 = {
- "primitiveInliningDatabaseDirectory",
- fntype(&systemPrimitives::inlining_database_directory),
- 65536,
+ "primitiveIndexedObjectSize",
+ fntype(&objArrayPrimitives::size),
+ 1574145,
signature_240,
errors_240
};

-static char* signature_241[] = { "SmallInteger"};
+static char* signature_241[] = { "Instance", "Behavior", "SmallInt"};
static char* errors_241[] = {NULL};
static primitive_desc primitive_241 = {
- "primitiveInliningDatabaseFileOutAllIfFail:",
- fntype(&systemPrimitives::inlining_database_file_out_all),
- 327680,
+ "primitiveInlineAllocations:count:",
+ fntype(&primitiveInlineAllocations),
+ 4259842,
signature_241,
errors_241
};

-static char* signature_242[] = { "SmallInteger", "Behavior"};
+static char* signature_242[] = { "Boolean", "Behavior", "Symbol"};
static char* errors_242[] = {NULL};
static primitive_desc primitive_242 = {
- "primitiveInliningDatabaseFileOutClass:ifFail:",
- fntype(&systemPrimitives::inlining_database_file_out_class),
- 327681,
+ "primitiveInliningDatabaseAddLookupEntryClass:selector:ifFail:",
+ fntype(&systemPrimitives::inlining_database_add_entry),
+ 327682,
signature_242,
errors_242
};

-static char* signature_243[] = { "IndexedByteInstanceVariables", "String"};
+static char* signature_243[] = { "Boolean"};
static char* errors_243[] = {NULL};
static primitive_desc primitive_243 = {
- "primitiveInliningDatabaseMangle:ifFail:",
- fntype(&systemPrimitives::inlining_database_mangle),
- 327681,
+ "primitiveInliningDatabaseCompile",
+ fntype(&systemPrimitives::inlining_database_compile_next),
+ 65536,
signature_243,
errors_243
};

-static char* signature_244[] = { "Symbol", "Symbol"};
+static char* signature_244[] = { "Object", "String"};
static char* errors_244[] = {NULL};
static primitive_desc primitive_244 = {
- "primitiveInliningDatabaseSetDirectory:ifFail:",
- fntype(&systemPrimitives::inlining_database_set_directory),
+ "primitiveInliningDatabaseCompile:ifFail:",
+ fntype(&systemPrimitives::inlining_database_compile),
327681,
signature_244,
errors_244
};

-static char* signature_245[] = { "Object", "Object", "SmallInteger"};
-static char* errors_245[] = { "OutOfBounds", NULL};
+static char* signature_245[] = { "IndexedByteInstanceVariables", "String"};
+static char* errors_245[] = {NULL};
static primitive_desc primitive_245 = {
- "primitiveInstVarAt:ifFail:",
- fntype(&oopPrimitives::instVarAt),
- 1376258,
+ "primitiveInliningDatabaseCompileDemangled:ifFail:",
+ fntype(&systemPrimitives::inlining_database_demangle),
+ 327681,
signature_245,
errors_245
};

-static char* signature_246[] =
{ "Object", "Object", "SmallInteger", "Object"};
-static char* errors_246[] = { "OutOfBounds", NULL};
+static char* signature_246[] = { "Symbol"};
+static char* errors_246[] = {NULL};
static primitive_desc primitive_246 = {
- "primitiveInstVarAt:put:ifFail:",
- fntype(&oopPrimitives::instVarAtPut),
- 1376259,
+ "primitiveInliningDatabaseDirectory",
+ fntype(&systemPrimitives::inlining_database_directory),
+ 65536,
signature_246,
errors_246
};

-static char* signature_247[] =
{ "Symbol", "Reciever", "Object", "SmallInteger"};
-static char* errors_247[] = { "OutOfBounds", NULL};
+static char* signature_247[] = { "SmallInteger"};
+static char* errors_247[] = {NULL};
static primitive_desc primitive_247 = {
- "primitiveInstVarNameFor:at:ifFail:",
- fntype(&oopPrimitives::instance_variable_name_at),
- 1376259,
+ "primitiveInliningDatabaseFileOutAllIfFail:",
+ fntype(&systemPrimitives::inlining_database_file_out_all),
+ 327680,
signature_247,
errors_247
};

-static char* signature_248[] =
{ "IndexedInstanceVariables", "Class", "SmallInteger"};
+static char* signature_248[] = { "SmallInteger", "Behavior"};
static char* errors_248[] = {NULL};
static primitive_desc primitive_248 = {
- "primitiveInstancesOf:limit:ifFail:",
- fntype(&systemPrimitives::instances_of),
- 327682,
+ "primitiveInliningDatabaseFileOutClass:ifFail:",
+ fntype(&systemPrimitives::inlining_database_file_out_class),
+ 327681,
signature_248,
errors_248
};

-static char* signature_249[] = { "SmallInteger"};
+static char* signature_249[] = { "IndexedByteInstanceVariables", "String"};
static char* errors_249[] = {NULL};
static primitive_desc primitive_249 = {
- "primitiveInterpreterInvocationCounterLimit",
- fntype(&debugPrimitives::interpreterInvocationCounterLimit),
- 65536,
+ "primitiveInliningDatabaseMangle:ifFail:",
+ fntype(&systemPrimitives::inlining_database_mangle),
+ 327681,
signature_249,
errors_249
};

-static char* signature_250[] =
{ "Boolean", "SmallInteger", "SmallInteger"};
+static char* signature_250[] = { "Symbol", "Symbol"};
static char* errors_250[] = {NULL};
static primitive_desc primitive_250 = {
- "primitiveLessThan:ifFail:",
- fntype(&smiOopPrimitives::lessThan),
- 6029570,
+ "primitiveInliningDatabaseSetDirectory:ifFail:",
+ fntype(&systemPrimitives::inlining_database_set_directory),
+ 327681,
signature_250,
errors_250
};

-static char* signature_251[] =
{ "Boolean", "SmallInteger", "SmallInteger"};
-static char* errors_251[] = {NULL};
+static char* signature_251[] = { "Object", "Object", "SmallInteger"};
+static char* errors_251[] = { "OutOfBounds", NULL};
static primitive_desc primitive_251 = {
- "primitiveLessThanOrEqual:ifFail:",
- fntype(&smiOopPrimitives::lessThanOrEqual),
- 6029570,
+ "primitiveInstVarAt:ifFail:",
+ fntype(&oopPrimitives::instVarAt),
+ 1376258,
signature_251,
errors_251
};

-static char* signature_252[] =
{ "SmallInteger", "Float", "Float", "SmallInteger"};
-static char* errors_252[] = {NULL};
+static char* signature_252[] =
{ "Object", "Object", "SmallInteger", "Object"};
+static char* errors_252[] = { "OutOfBounds", NULL};
static primitive_desc primitive_252 = {
- "primitiveMandelbrotAtRe:im:iterate:ifFail:",
- fntype(&doubleOopPrimitives::mandelbrot),
- 4980739,
+ "primitiveInstVarAt:put:ifFail:",
+ fntype(&oopPrimitives::instVarAtPut),
+ 1376259,
signature_252,
errors_252
};

-static char* signature_253[] = { "Block", "Method", "Object"};
-static char* errors_253[] = {NULL};
+static char* signature_253[] =
{ "Symbol", "Reciever", "Object", "SmallInteger"};
+static char* errors_253[] = { "OutOfBounds", NULL};
static primitive_desc primitive_253 = {
- "primitiveMethodAllocateBlock:ifFail:",
- fntype(&methodOopPrimitives::allocate_block_self),
- 1376258,
+ "primitiveInstVarNameFor:at:ifFail:",
+ fntype(&oopPrimitives::instance_variable_name_at),
+ 1376259,
signature_253,
errors_253
};

-static char* signature_254[] = { "Block", "Method"};
+static char* signature_254[] =
{ "IndexedInstanceVariables", "Class", "SmallInteger"};
static char* errors_254[] = {NULL};
static primitive_desc primitive_254 = {
- "primitiveMethodAllocateBlockIfFail:",
- fntype(&methodOopPrimitives::allocate_block),
- 1376257,
+ "primitiveInstancesOf:limit:ifFail:",
+ fntype(&systemPrimitives::instances_of),
+ 327682,
signature_254,
errors_254
};

-static char* signature_255[] = { "Object", "Method"};
+static char* signature_255[] = { "SmallInteger"};
static char* errors_255[] = {NULL};
static primitive_desc primitive_255 = {
- "primitiveMethodBody",
- fntype(&methodOopPrimitives::fileout_body),
- 1114113,
+ "primitiveInterpreterInvocationCounterLimit",
+ fntype(&debugPrimitives::interpreterInvocationCounterLimit),
+ 65536,
signature_255,
errors_255
};

-static char* signature_256[] = { "Object", "Method"};
+static char* signature_256[] =
{ "SmallInteger", "IndexedByteInstanceVariables"};
static char* errors_256[] = {NULL};
static primitive_desc primitive_256 = {
- "primitiveMethodDebugInfo",
- fntype(&methodOopPrimitives::debug_info),
- 1114113,
+ "primitiveLargeIntegerHash",
+ fntype(&byteArrayPrimitives::largeIntegerHash),
+ 1574401,
signature_256,
errors_256
};

-static char* signature_257[] = { "Method", "Behavior", "CompressedSymbol"};
-static char* errors_257[] = { "NotFound", NULL};
+static char* signature_257[] =
{ "Boolean", "SmallInteger", "SmallInteger"};
+static char* errors_257[] = {NULL};
static primitive_desc primitive_257 = {
- "primitiveMethodFor:ifFail:",
- fntype(&behaviorPrimitives::methodFor),
- 1376258,
+ "primitiveLessThan:ifFail:",
+ fntype(&smiOopPrimitives::lessThan),
+ 6029570,
signature_257,
errors_257
};

-static char* signature_258[] = { "Symbol", "Method"};
+static char* signature_258[] =
{ "Boolean", "SmallInteger", "SmallInteger"};
static char* errors_258[] = {NULL};
static primitive_desc primitive_258 = {
- "primitiveMethodInliningInfo",
- fntype(&methodOopPrimitives::inlining_info),
- 1114113,
+ "primitiveLessThanOrEqual:ifFail:",
+ fntype(&smiOopPrimitives::lessThanOrEqual),
+ 6029570,
signature_258,
errors_258
};

-static char* signature_259[] = { "SmallInteger", "Method"};
+static char* signature_259[] =
{ "SmallInteger", "Float", "Float", "SmallInteger"};
static char* errors_259[] = {NULL};
static primitive_desc primitive_259 = {
- "primitiveMethodNumberOfArguments",
- fntype(&methodOopPrimitives::numberOfArguments),
- 1114113,
+ "primitiveMandelbrotAtRe:im:iterate:ifFail:",
+ fntype(&doubleOopPrimitives::mandelbrot),
+ 4980739,
signature_259,
errors_259
};

-static char* signature_260[] = { "Symbol", "Method", "Method"};
+static char* signature_260[] = { "Block", "Method", "Object"};
static char* errors_260[] = {NULL};
static primitive_desc primitive_260 = {
- "primitiveMethodOuter:ifFail:",
- fntype(&methodOopPrimitives::setOuter),
+ "primitiveMethodAllocateBlock:ifFail:",
+ fntype(&methodOopPrimitives::allocate_block_self),
1376258,
signature_260,
errors_260
};

-static char* signature_261[] = { "Method", "Method"};
-static char* errors_261[] = { "ReceiverNotBlockMethod", NULL};
+static char* signature_261[] = { "Block", "Method"};
+static char* errors_261[] = {NULL};
static primitive_desc primitive_261 = {
- "primitiveMethodOuterIfFail:",
- fntype(&methodOopPrimitives::outer),
+ "primitiveMethodAllocateBlockIfFail:",
+ fntype(&methodOopPrimitives::allocate_block),
1376257,
signature_261,
errors_261
};

-static char* signature_262[] = { "Method", "Method", "Object"};
+static char* signature_262[] = { "Object", "Method"};
static char* errors_262[] = {NULL};
static primitive_desc primitive_262 = {
- "primitiveMethodPrettyPrintKlass:ifFail:",
- fntype(&methodOopPrimitives::prettyPrint),
- 1376258,
+ "primitiveMethodBody",
+ fntype(&methodOopPrimitives::fileout_body),
+ 1114113,
signature_262,
errors_262
};

-static char* signature_263[] =
{ "ByteIndexedInstanceVariables", "Method", "Object"};
+static char* signature_263[] = { "Object", "Method"};
static char* errors_263[] = {NULL};
static primitive_desc primitive_263 = {
- "primitiveMethodPrettyPrintSourceKlass:ifFail:",
- fntype(&methodOopPrimitives::prettyPrintSource),
- 1376258,
+ "primitiveMethodDebugInfo",
+ fntype(&methodOopPrimitives::debug_info),
+ 1114113,
signature_263,
errors_263
};

-static char* signature_264[] = { "Symbol", "Method"};
-static char* errors_264[] = {NULL};
+static char* signature_264[] = { "Method", "Behavior", "CompressedSymbol"};
+static char* errors_264[] = { "NotFound", NULL};
static primitive_desc primitive_264 = {
- "primitiveMethodPrintCodes",
- fntype(&methodOopPrimitives::printCodes),
- 1114113,
+ "primitiveMethodFor:ifFail:",
+ fntype(&behaviorPrimitives::methodFor),
+ 1376258,
signature_264,
errors_264
};

-static char* signature_265[] = { "IndexedInstanceVariables", "Method"};
+static char* signature_265[] = { "Symbol", "Method"};
static char* errors_265[] = {NULL};
static primitive_desc primitive_265 = {
- "primitiveMethodReferencedClassVarNames",
- fntype(&methodOopPrimitives::referenced_class_variable_names),
+ "primitiveMethodInliningInfo",
+ fntype(&methodOopPrimitives::inlining_info),
1114113,
signature_265,
errors_265
};

-static char* signature_266[] = { "IndexedInstanceVariables", "Method"};
+static char* signature_266[] = { "SmallInteger", "Method"};
static char* errors_266[] = {NULL};
static primitive_desc primitive_266 = {
- "primitiveMethodReferencedGlobalNames",
- fntype(&methodOopPrimitives::referenced_global_names),
+ "primitiveMethodNumberOfArguments",
+ fntype(&methodOopPrimitives::numberOfArguments),
1114113,
signature_266,
errors_266
};

-static char* signature_267[] =
{ "IndexedInstanceVariables", "Method", "Mixin"};
+static char* signature_267[] = { "Symbol", "Method", "Method"};
static char* errors_267[] = {NULL};
static primitive_desc primitive_267 = {
- "primitiveMethodReferencedInstVarNamesMixin:ifFail:",
- fntype(&methodOopPrimitives::referenced_instance_variable_names),
+ "primitiveMethodOuter:ifFail:",
+ fntype(&methodOopPrimitives::setOuter),
1376258,
signature_267,
errors_267
};

-static char* signature_268[] = { "Symbol", "Method"};
-static char* errors_268[] = {NULL};
+static char* signature_268[] = { "Method", "Method"};
+static char* errors_268[] = { "ReceiverNotBlockMethod", NULL};
static primitive_desc primitive_268 = {
- "primitiveMethodSelector",
- fntype(&methodOopPrimitives::selector),
- 1114113,
+ "primitiveMethodOuterIfFail:",
+ fntype(&methodOopPrimitives::outer),
+ 1376257,
signature_268,
errors_268
};

-static char* signature_269[] = { "Symbol", "Method", "Symbol"};
+static char* signature_269[] = { "Method", "Method", "Object"};
static char* errors_269[] = {NULL};
static primitive_desc primitive_269 = {
- "primitiveMethodSelector:ifFail:",
- fntype(&methodOopPrimitives::setSelector),
+ "primitiveMethodPrettyPrintKlass:ifFail:",
+ fntype(&methodOopPrimitives::prettyPrint),
1376258,
signature_269,
errors_269
};

-static char* signature_270[] = { "IndexedInstanceVariables", "Method"};
+static char* signature_270[] =
{ "ByteIndexedInstanceVariables", "Method", "Object"};
static char* errors_270[] = {NULL};
***The diff for this file has been truncated for email.***
Reply all
Reply to author
Forward
0 new messages