[decompiler] Jak 2 modifications, new all-types code (#1553)

* temp

* look at old game types

* clean up
This commit is contained in:
water111
2022-06-25 21:26:15 -04:00
committed by GitHub
parent c9de15ba64
commit 91fa0122d8
40 changed files with 1762 additions and 586 deletions
+10 -10
View File
@@ -128,7 +128,7 @@ std::unique_ptr<FormRegressionTest::TestData> FormRegressionTest::make_function(
auto program = parser->parse_program(code, string_label_names);
// create the test data collection
auto test = std::make_unique<TestData>(program.instructions.size());
auto test = std::make_unique<TestData>(program.instructions.size(), settings.version);
// populate the LinkedObjectFile
test->file.words_by_seg.resize(3);
test->file.labels = program.labels;
@@ -160,7 +160,7 @@ std::unique_ptr<FormRegressionTest::TestData> FormRegressionTest::make_function(
// analyze function prologue/epilogue
test->func.analyze_prologue(test->file);
// build control flow graph
test->func.cfg = build_cfg(test->file, 0, test->func, {}, {});
test->func.cfg = build_cfg(test->file, 0, test->func, {}, {}, settings.version);
EXPECT_TRUE(test->func.cfg->is_fully_resolved());
if (!test->func.cfg->is_fully_resolved()) {
fmt::print("CFG:\n{}\n", test->func.cfg->to_dot());
@@ -176,7 +176,7 @@ std::unique_ptr<FormRegressionTest::TestData> FormRegressionTest::make_function(
// convert instruction to atomic ops
DecompWarnings warnings;
auto ops = convert_function_to_atomic_ops(test->func, program.labels, warnings, false, {},
GameVersion::Jak1);
settings.version);
test->func.ir2.atomic_ops = std::make_shared<FunctionAtomicOps>(std::move(ops));
test->func.ir2.atomic_ops_succeeded = true;
test->func.ir2.env.set_end_var(test->func.ir2.atomic_ops->end_op().return_var());
@@ -280,7 +280,7 @@ void FormRegressionTest::test(const std::string& code,
EXPECT_TRUE(expected_form == actual_form);
}
void FormRegressionTest::test_final_function(
void FormRegressionTest::test_final_function_jak1(
const std::string& code,
const std::string& type,
const std::string& expected,
@@ -311,12 +311,12 @@ void FormRegressionTest::test_final_function(
EXPECT_TRUE(expected_form == actual_form);
}
void FormRegressionTest::test_with_stack_structures(const std::string& code,
const std::string& type,
const std::string& expected,
const std::string& stack_map_json,
const std::string& cast_json,
const std::string& var_map_json) {
void FormRegressionTest::test_with_stack_structures_jak1(const std::string& code,
const std::string& type,
const std::string& expected,
const std::string& stack_map_json,
const std::string& cast_json,
const std::string& var_map_json) {
TestSettings settings;
settings.do_expressions = true;
settings.stack_structure_json = stack_map_json;
+32 -31
View File
@@ -20,6 +20,7 @@ struct TestSettings {
std::string casts_json;
std::string var_map_json;
std::string stack_structure_json;
GameVersion version = GameVersion::Jak1;
};
class FormRegressionTest : public ::testing::Test {
@@ -31,7 +32,7 @@ class FormRegressionTest : public ::testing::Test {
static void TearDownTestCase();
struct TestData {
explicit TestData(int instrs) : func(0, instrs) {}
explicit TestData(int instrs, GameVersion version) : func(0, instrs, version) {}
decompiler::Function func;
decompiler::LinkedObjectFile file;
@@ -41,28 +42,28 @@ class FormRegressionTest : public ::testing::Test {
std::unique_ptr<TestData> make_function(const std::string& code,
const TypeSpec& function_type,
const TestSettings& settings);
void test(const std::string& code,
const std::string& type,
const std::string& expected,
const TestSettings& settings);
void test_final_function(const std::string& code,
const std::string& type,
const std::string& expected,
bool allow_pairs = false,
const std::vector<std::pair<std::string, std::string>>& strings = {},
const std::string& cast_json = "",
const std::string& var_map_json = "");
void test_final_function_jak1(
const std::string& code,
const std::string& type,
const std::string& expected,
bool allow_pairs = false,
const std::vector<std::pair<std::string, std::string>>& strings = {},
const std::string& cast_json = "",
const std::string& var_map_json = "");
void test_no_expr(const std::string& code,
const std::string& type,
const std::string& expected,
bool allow_pairs = false,
const std::string& method_name = "",
const std::vector<std::pair<std::string, std::string>>& strings = {},
const std::string& cast_json = "",
const std::string& var_map_json = "") {
void test_no_expr_jak1(const std::string& code,
const std::string& type,
const std::string& expected,
bool allow_pairs = false,
const std::string& method_name = "",
const std::vector<std::pair<std::string, std::string>>& strings = {},
const std::string& cast_json = "",
const std::string& var_map_json = "") {
TestSettings settings;
settings.allow_pairs = allow_pairs;
settings.method_name = method_name;
@@ -73,14 +74,14 @@ class FormRegressionTest : public ::testing::Test {
test(code, type, expected, settings);
}
void test_with_expr(const std::string& code,
const std::string& type,
const std::string& expected,
bool allow_pairs = false,
const std::string& method_name = "",
const std::vector<std::pair<std::string, std::string>>& strings = {},
const std::string& cast_json = "",
const std::string& var_map_json = "") {
void test_with_expr_jak1(const std::string& code,
const std::string& type,
const std::string& expected,
bool allow_pairs = false,
const std::string& method_name = "",
const std::vector<std::pair<std::string, std::string>>& strings = {},
const std::string& cast_json = "",
const std::string& var_map_json = "") {
TestSettings settings;
settings.allow_pairs = allow_pairs;
settings.method_name = method_name;
@@ -91,10 +92,10 @@ class FormRegressionTest : public ::testing::Test {
test(code, type, expected, settings);
}
void test_with_stack_structures(const std::string& code,
const std::string& type,
const std::string& expected,
const std::string& stack_map_json,
const std::string& cast_json = "",
const std::string& var_map_json = "");
void test_with_stack_structures_jak1(const std::string& code,
const std::string& type,
const std::string& expected,
const std::string& stack_map_json,
const std::string& cast_json = "",
const std::string& var_map_json = "");
};
+13 -13
View File
@@ -681,17 +681,17 @@ TEST_F(FormRegressionTest, ExprDisasmVif) {
" )\n"
" (- gp-0 (* arg1 4))\n"
" )";
test_with_expr(func, type, expected, false, "",
{{"L139", " #x~X:"},
{"L138", " (~s :irq ~D)~%"},
{"L137", " (~s :irq ~D :~s #x~X)~%"},
{"L136", " (~s :irq ~D :wl ~D :cl ~D)~%"},
{"L135", " (~s :irq ~D :~s "},
{"L134", "#x~X #x~X #x~X #x~X)~%"},
{"L133", " (~s :irq ~D :instructions #x~D :addr #x~X)~%"},
{"L132", " (~s :irq ~D :qwc #x~D)~%"},
{"L145", " #x~X: #x~8x #x~8x #x~8x #x~8x~%"},
{"L131", " (~s :irq ~D :num ~D :addr #x~X "},
{"L130", ":msk ~D :flg ~D :usn ~D [skip ~d])~%"},
{"L129", " (*unknown* vif-tag #x~X)~%"}});
test_with_expr_jak1(func, type, expected, false, "",
{{"L139", " #x~X:"},
{"L138", " (~s :irq ~D)~%"},
{"L137", " (~s :irq ~D :~s #x~X)~%"},
{"L136", " (~s :irq ~D :wl ~D :cl ~D)~%"},
{"L135", " (~s :irq ~D :~s "},
{"L134", "#x~X #x~X #x~X #x~X)~%"},
{"L133", " (~s :irq ~D :instructions #x~D :addr #x~X)~%"},
{"L132", " (~s :irq ~D :qwc #x~D)~%"},
{"L145", " #x~X: #x~8x #x~8x #x~8x #x~8x~%"},
{"L131", " (~s :irq ~D :num ~D :addr #x~X "},
{"L130", ":msk ~D :flg ~D :usn ~D [skip ~d])~%"},
{"L129", " (*unknown* vif-tag #x~X)~%"}});
}
+18 -18
View File
@@ -28,7 +28,7 @@ TEST_F(FormRegressionTest, SimplestTest) {
" daddu sp, sp, r0";
std::string type = "(function object object)";
std::string expected = "(begin (set! v0-0 a0-0) (ret-value v0-0))";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, Op3) {
@@ -40,7 +40,7 @@ TEST_F(FormRegressionTest, Op3) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(begin (set! v0-0 (*.si a0-0 a1-0)) (ret-value v0-0))";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, Division) {
@@ -53,7 +53,7 @@ TEST_F(FormRegressionTest, Division) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(begin (set! v0-0 (/.si a0-0 a1-0)) (ret-value v0-0))";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, Ash) {
@@ -73,7 +73,7 @@ TEST_F(FormRegressionTest, Ash) {
" sll r0, r0, 0";
std::string type = "(function int int int)";
std::string expected = "(begin (set! v1-0 a0-0) (set! v0-0 (ash.si v1-0 a1-0)) (ret-value v0-0))";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, Abs) {
@@ -89,7 +89,7 @@ TEST_F(FormRegressionTest, Abs) {
" daddu sp, sp, r0";
std::string type = "(function int int)";
std::string expected = "(begin (set! v0-0 a0-0) (set! v0-0 (abs v0-0)) (ret-value v0-0))";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, Min) {
@@ -109,7 +109,7 @@ TEST_F(FormRegressionTest, Min) {
" (set! v0-1 (min.si v0-0 v1-0))\n"
" (ret-value v0-1)\n"
" )";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, Max) {
@@ -130,7 +130,7 @@ TEST_F(FormRegressionTest, Max) {
" (set! v0-1 (max.si v0-0 v1-0))\n"
" (ret-value v0-1)\n"
" )";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, FormatString) {
@@ -169,7 +169,7 @@ TEST_F(FormRegressionTest, FormatString) {
" (set! v0-1 a0-0)\n"
" (ret-value v0-1)\n"
" )";
test_no_expr(func, type, expected, false, "", {{"L343", "~f"}});
test_no_expr_jak1(func, type, expected, false, "", {{"L343", "~f"}});
}
TEST_F(FormRegressionTest, WhileLoop) {
@@ -212,7 +212,7 @@ TEST_F(FormRegressionTest, WhileLoop) {
" (set! v0-0 #f)\n"
" (ret-value v0-0)\n"
" )";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
// Note - this test looks weird because or's aren't fully processed at this point.
@@ -278,7 +278,7 @@ TEST_F(FormRegressionTest, Or) {
" (set! v0-0 #f)\n"
" (ret-value v0-0)\n"
" )";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, DynamicMethodAccess) {
@@ -355,7 +355,7 @@ TEST_F(FormRegressionTest, DynamicMethodAccess) {
" )\n"
" (ret-value v0-0)\n"
" )";
test_no_expr(func, type, expected);
test_no_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, SimpleLoopMergeCheck) {
@@ -397,7 +397,7 @@ TEST_F(FormRegressionTest, SimpleLoopMergeCheck) {
" (set! v0-0 (car a0-0))\n"
" (ret-value v0-0)\n"
" )";
test_no_expr(func, type, expected, true);
test_no_expr_jak1(func, type, expected, true);
}
TEST_F(FormRegressionTest, And) {
@@ -467,7 +467,7 @@ TEST_F(FormRegressionTest, And) {
" )\n"
" )"
"(ret-value v0-0))\n";
test_no_expr(func, type, expected, true);
test_no_expr_jak1(func, type, expected, true);
}
TEST_F(FormRegressionTest, FunctionCall) {
@@ -548,7 +548,7 @@ TEST_F(FormRegressionTest, FunctionCall) {
" (set! v0-1 a1-0)\n" // not empty, so return the result
" )" // the (set! v0 #f) from the if is added later.
" (ret-value v0-1))\n";
test_no_expr(func, type, expected, true);
test_no_expr_jak1(func, type, expected, true);
}
TEST_F(FormRegressionTest, NestedAndOr) {
@@ -715,7 +715,7 @@ TEST_F(FormRegressionTest, NestedAndOr) {
" (set! v0-1 a0-0)\n"
" (ret-value v0-1)\n"
" )";
test_no_expr(func, type, expected, true);
test_no_expr_jak1(func, type, expected, true);
}
TEST_F(FormRegressionTest, NewMethod) {
@@ -770,7 +770,7 @@ TEST_F(FormRegressionTest, NewMethod) {
" (set! (-> v0-0 allocated-length) a2-0)\n"
" )"
" (ret-value v0-0))\n";
test_no_expr(func, type, expected, false, "inline-array-class");
test_no_expr_jak1(func, type, expected, false, "inline-array-class");
}
TEST_F(FormRegressionTest, Recursive) {
@@ -815,7 +815,7 @@ TEST_F(FormRegressionTest, Recursive) {
" )\n"
" )"
" (ret-value v0-0))\n";
test_no_expr(func, type, expected, false);
test_no_expr_jak1(func, type, expected, false);
}
TEST_F(FormRegressionTest, TypeOf) {
@@ -851,5 +851,5 @@ TEST_F(FormRegressionTest, TypeOf) {
" (set! v0-0 (call! a0-0))\n"
" (ret-value v0-0)\n"
" )";
test_no_expr(func, type, expected, false);
test_no_expr_jak1(func, type, expected, false);
}
+83 -83
View File
@@ -12,7 +12,7 @@ TEST_F(FormRegressionTest, ExprIdentity) {
" daddu sp, sp, r0";
std::string type = "(function object object)";
std::string expected = "arg0";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprFloatingPoint) {
@@ -31,7 +31,7 @@ TEST_F(FormRegressionTest, ExprFloatingPoint) {
" daddiu sp, sp, 16";
std::string type = "(function float float)";
std::string expected = "(/ 0.0 arg0)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAdditionSigned) {
@@ -42,7 +42,7 @@ TEST_F(FormRegressionTest, ExprAdditionSigned) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(+ arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAdditionUnSigned) {
@@ -53,7 +53,7 @@ TEST_F(FormRegressionTest, ExprAdditionUnSigned) {
" daddu sp, sp, r0";
std::string type = "(function uint uint uint)";
std::string expected = "(+ arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAdditionMixed1) {
@@ -64,7 +64,7 @@ TEST_F(FormRegressionTest, ExprAdditionMixed1) {
" daddu sp, sp, r0";
std::string type = "(function int uint int)";
std::string expected = "(+ arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAdditionMixed2) {
@@ -75,7 +75,7 @@ TEST_F(FormRegressionTest, ExprAdditionMixed2) {
" daddu sp, sp, r0";
std::string type = "(function uint int uint)";
std::string expected = "(+ arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAdditionSignedWrongReturn) {
@@ -86,7 +86,7 @@ TEST_F(FormRegressionTest, ExprAdditionSignedWrongReturn) {
" daddu sp, sp, r0";
std::string type = "(function int int uint)";
std::string expected = "(the-as uint (+ arg0 arg1))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAdditionUnSignedWrongReturn) {
@@ -97,7 +97,7 @@ TEST_F(FormRegressionTest, ExprAdditionUnSignedWrongReturn) {
" daddu sp, sp, r0";
std::string type = "(function uint uint int)";
std::string expected = "(the-as int (+ arg0 arg1))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAdditionMixed1WrongReturn) {
@@ -108,7 +108,7 @@ TEST_F(FormRegressionTest, ExprAdditionMixed1WrongReturn) {
" daddu sp, sp, r0";
std::string type = "(function int uint uint)";
std::string expected = "(the-as uint (+ arg0 arg1))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAdditionMixed2WrongReturn) {
@@ -119,7 +119,7 @@ TEST_F(FormRegressionTest, ExprAdditionMixed2WrongReturn) {
" daddu sp, sp, r0";
std::string type = "(function uint int int)";
std::string expected = "(the-as int (+ arg0 arg1))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprSubtraction) {
@@ -130,7 +130,7 @@ TEST_F(FormRegressionTest, ExprSubtraction) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(- arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMultiplication) {
@@ -141,7 +141,7 @@ TEST_F(FormRegressionTest, ExprMultiplication) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(* arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMultiplicationWrong1) {
@@ -152,7 +152,7 @@ TEST_F(FormRegressionTest, ExprMultiplicationWrong1) {
" daddu sp, sp, r0";
std::string type = "(function int uint int)";
std::string expected = "(* arg0 (the-as int arg1))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMultiplicationWrong2) {
@@ -163,7 +163,7 @@ TEST_F(FormRegressionTest, ExprMultiplicationWrong2) {
" daddu sp, sp, r0";
std::string type = "(function uint int int)";
std::string expected = "(* (the-as int arg0) arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMultiplicationWrong3) {
@@ -174,7 +174,7 @@ TEST_F(FormRegressionTest, ExprMultiplicationWrong3) {
" daddu sp, sp, r0";
std::string type = "(function uint uint uint)";
std::string expected = "(the-as uint (* (the-as int arg0) (the-as int arg1)))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprDivision1) {
@@ -186,7 +186,7 @@ TEST_F(FormRegressionTest, ExprDivision1) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(/ arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprDivision2) {
@@ -198,7 +198,7 @@ TEST_F(FormRegressionTest, ExprDivision2) {
" daddu sp, sp, r0";
std::string type = "(function uint int int)";
std::string expected = "(/ (the-as int arg0) arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprDivision3) {
@@ -210,7 +210,7 @@ TEST_F(FormRegressionTest, ExprDivision3) {
" daddu sp, sp, r0";
std::string type = "(function int uint int)";
std::string expected = "(/ arg0 (the-as int arg1))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprDivision4) {
@@ -222,7 +222,7 @@ TEST_F(FormRegressionTest, ExprDivision4) {
" daddu sp, sp, r0";
std::string type = "(function uint uint uint)";
std::string expected = "(the-as uint (/ (the-as int arg0) (the-as int arg1)))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAsh) {
@@ -240,7 +240,7 @@ TEST_F(FormRegressionTest, ExprAsh) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(ash arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMod) {
@@ -252,7 +252,7 @@ TEST_F(FormRegressionTest, ExprMod) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(mod arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprAbs) {
@@ -268,7 +268,7 @@ TEST_F(FormRegressionTest, ExprAbs) {
" daddu sp, sp, r0";
std::string type = "(function int int)";
std::string expected = "(abs arg0)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMin) {
@@ -282,7 +282,7 @@ TEST_F(FormRegressionTest, ExprMin) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(min arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMax) {
@@ -296,7 +296,7 @@ TEST_F(FormRegressionTest, ExprMax) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(max arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprLogior) {
@@ -307,7 +307,7 @@ TEST_F(FormRegressionTest, ExprLogior) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(logior arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprLogxor) {
@@ -318,7 +318,7 @@ TEST_F(FormRegressionTest, ExprLogxor) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(logxor arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprLognor) {
@@ -329,7 +329,7 @@ TEST_F(FormRegressionTest, ExprLognor) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(lognor arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprLogand) {
@@ -340,7 +340,7 @@ TEST_F(FormRegressionTest, ExprLogand) {
" daddu sp, sp, r0";
std::string type = "(function int int int)";
std::string expected = "(logand arg0 arg1)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprLognot) {
@@ -351,7 +351,7 @@ TEST_F(FormRegressionTest, ExprLognot) {
" daddu sp, sp, r0";
std::string type = "(function int int)";
std::string expected = "(lognot arg0)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprFalse) {
@@ -362,7 +362,7 @@ TEST_F(FormRegressionTest, ExprFalse) {
" daddu sp, sp, r0";
std::string type = "(function symbol)";
std::string expected = "#f";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprTrue) {
@@ -373,7 +373,7 @@ TEST_F(FormRegressionTest, ExprTrue) {
" daddu sp, sp, r0";
std::string type = "(function symbol)";
std::string expected = "#t";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprPrintBfloat) {
@@ -403,7 +403,7 @@ TEST_F(FormRegressionTest, ExprPrintBfloat) {
std::string type = "(function bfloat bfloat)";
std::string expected = "(begin (format #t \"~f\" (-> arg0 data)) arg0)";
test_with_expr(func, type, expected, false, "", {{"L343", "~f"}});
test_with_expr_jak1(func, type, expected, false, "", {{"L343", "~f"}});
}
TEST_F(FormRegressionTest, ExprSizeOfType) {
@@ -425,7 +425,7 @@ TEST_F(FormRegressionTest, ExprSizeOfType) {
std::string type = "(function type uint)";
std::string expected = "(logand 3 (+ (* (-> arg0 allocated-length) 4) 43))";
test_with_expr(func, type, expected, false, "");
test_with_expr_jak1(func, type, expected, false, "");
}
TEST_F(FormRegressionTest, ExprBasicTypeP) {
@@ -468,7 +468,7 @@ TEST_F(FormRegressionTest, ExprBasicTypeP) {
" )\n"
" #f\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, FinalBasicTypeP) {
@@ -511,7 +511,7 @@ TEST_F(FormRegressionTest, FinalBasicTypeP) {
" )\n"
" #f\n"
" )";
test_final_function(func, type, expected);
test_final_function_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprTypeTypep) {
@@ -565,7 +565,7 @@ TEST_F(FormRegressionTest, ExprTypeTypep) {
" )\n"
" #f\n"
" )";
test_with_expr(func, type, expected, false, "");
test_with_expr_jak1(func, type, expected, false, "");
}
TEST_F(FormRegressionTest, ExprFindParentMethod) {
@@ -629,7 +629,7 @@ TEST_F(FormRegressionTest, ExprFindParentMethod) {
" )\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected, false, "");
test_with_expr_jak1(func, type, expected, false, "");
}
TEST_F(FormRegressionTest, ExprRef) {
@@ -660,7 +660,7 @@ TEST_F(FormRegressionTest, ExprRef) {
std::string expected =
"(begin (dotimes (v1-0 arg1) (nop!) (nop!) (set! arg0 (cdr arg0))) (car arg0))";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprPairMethod4) {
@@ -728,7 +728,7 @@ TEST_F(FormRegressionTest, ExprPairMethod4) {
" )\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprPairMethod5) {
@@ -741,7 +741,7 @@ TEST_F(FormRegressionTest, ExprPairMethod5) {
std::string type = "(function pair uint)";
std::string expected = "(-> pair size)";
test_with_expr(func, type, expected, false, "");
test_with_expr_jak1(func, type, expected, false, "");
}
TEST_F(FormRegressionTest, ExprLast) {
@@ -774,7 +774,7 @@ TEST_F(FormRegressionTest, ExprLast) {
" (while (not (null? (cdr v0-0))) (nop!) (nop!) (set! v0-0 (cdr v0-0)))\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprMember) {
@@ -826,7 +826,7 @@ TEST_F(FormRegressionTest, ExprMember) {
" )\n"
" (if (not (null? v1-0)) v1-0)\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprNmember) {
@@ -888,7 +888,7 @@ TEST_F(FormRegressionTest, ExprNmember) {
" )\n"
" (if (not (null? arg1)) arg1)\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprAssoc) {
@@ -939,7 +939,7 @@ TEST_F(FormRegressionTest, ExprAssoc) {
" )\n"
" (if (not (null? v1-0)) (car v1-0))\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprAssoce) {
@@ -1007,7 +1007,7 @@ TEST_F(FormRegressionTest, ExprAssoce) {
" )\n"
" (if (not (null? v1-0)) (car v1-0))\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprNassoc) {
@@ -1098,7 +1098,7 @@ TEST_F(FormRegressionTest, ExprNassoc) {
" )\n"
" (if (not (null? arg1)) (car arg1))\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprNassoce) {
@@ -1203,7 +1203,7 @@ TEST_F(FormRegressionTest, ExprNassoce) {
" )\n"
" (if (not (null? arg1)) (car arg1))\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprAppend) {
@@ -1262,7 +1262,7 @@ TEST_F(FormRegressionTest, ExprAppend) {
" arg0\n"
" )\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprDelete) {
@@ -1339,7 +1339,7 @@ TEST_F(FormRegressionTest, ExprDelete) {
" )\n"
" )\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprDeleteCar) {
@@ -1418,7 +1418,7 @@ TEST_F(FormRegressionTest, ExprDeleteCar) {
" )\n"
" )\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprInsertCons) {
@@ -1451,7 +1451,7 @@ TEST_F(FormRegressionTest, ExprInsertCons) {
// NOTE - this appears to _not_ be a nested call.
std::string expected = "(let ((a3-0 (delete-car! (car arg0) arg1))) (cons arg0 a3-0))";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprSort) {
@@ -1587,7 +1587,7 @@ TEST_F(FormRegressionTest, ExprSort) {
" )\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, true, "");
test_with_expr_jak1(func, type, expected, true, "");
}
TEST_F(FormRegressionTest, ExprInlineArrayMethod0) {
@@ -1639,7 +1639,7 @@ TEST_F(FormRegressionTest, ExprInlineArrayMethod0) {
" )\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected, true, "inline-array-class");
test_with_expr_jak1(func, type, expected, true, "inline-array-class");
}
TEST_F(FormRegressionTest, ExprInlineArrayMethod4) {
@@ -1651,7 +1651,7 @@ TEST_F(FormRegressionTest, ExprInlineArrayMethod4) {
std::string type = "(function inline-array-class int)";
std::string expected = "(-> arg0 length)";
test_with_expr(func, type, expected, true, "inline-array-class");
test_with_expr_jak1(func, type, expected, true, "inline-array-class");
}
TEST_F(FormRegressionTest, ExprInlineArrayMethod5) {
@@ -1676,7 +1676,7 @@ TEST_F(FormRegressionTest, ExprInlineArrayMethod5) {
" (* (-> arg0 allocated-length) (the-as int (-> arg0 type heap-base)))\n"
" )\n"
" )";
test_with_expr(func, type, expected, true, "inline-array-class");
test_with_expr_jak1(func, type, expected, true, "inline-array-class");
}
TEST_F(FormRegressionTest, ExprArrayMethod0) {
@@ -1758,7 +1758,7 @@ TEST_F(FormRegressionTest, ExprArrayMethod0) {
" (set! (-> v0-1 content-type) arg2)\n"
" v0-1\n"
" )";
test_with_expr(func, type, expected, true, "array");
test_with_expr_jak1(func, type, expected, true, "array");
}
TEST_F(FormRegressionTest, ExprArrayMethod4) {
@@ -1771,7 +1771,7 @@ TEST_F(FormRegressionTest, ExprArrayMethod4) {
std::string type = "(function array int)";
std::string expected = "(-> arg0 length)";
test_with_expr(func, type, expected, true, "array");
test_with_expr_jak1(func, type, expected, true, "array");
}
TEST_F(FormRegressionTest, ExprArrayMethod5) {
@@ -1826,7 +1826,7 @@ TEST_F(FormRegressionTest, ExprArrayMethod5) {
" )\n"
" )\n"
" )";
test_with_expr(func, type, expected, true, "array");
test_with_expr_jak1(func, type, expected, true, "array");
}
TEST_F(FormRegressionTest, ExprMemCopy) {
@@ -1866,7 +1866,7 @@ TEST_F(FormRegressionTest, ExprMemCopy) {
" )\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMemSet32) {
@@ -1905,7 +1905,7 @@ TEST_F(FormRegressionTest, ExprMemSet32) {
" )\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMemOr) {
@@ -1948,7 +1948,7 @@ TEST_F(FormRegressionTest, ExprMemOr) {
" )\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprFact) {
@@ -1982,7 +1982,7 @@ TEST_F(FormRegressionTest, ExprFact) {
std::string type = "(function int int)";
std::string expected = "(if (= arg0 1) 1 (* arg0 (fact (+ arg0 -1))))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprPrint) {
@@ -2010,7 +2010,7 @@ TEST_F(FormRegressionTest, ExprPrint) {
std::string type = "(function object object)";
std::string expected = "((method-of-type (rtype-of arg0) print) arg0)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprPrintl) {
@@ -2058,7 +2058,7 @@ TEST_F(FormRegressionTest, ExprPrintl) {
" (format #t \"~%\")\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "", {{"L324", "~%"}});
test_with_expr_jak1(func, type, expected, false, "", {{"L324", "~%"}});
}
TEST_F(FormRegressionTest, ExprInspect) {
@@ -2086,7 +2086,7 @@ TEST_F(FormRegressionTest, ExprInspect) {
std::string type = "(function object object)";
std::string expected = "((method-of-type (rtype-of arg0) inspect) arg0)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprPrintTreeBitmask) {
@@ -2157,7 +2157,7 @@ TEST_F(FormRegressionTest, ExprPrintTreeBitmask) {
" )\n"
" #f\n"
" )";
test_with_expr(func, type, expected, false, "", {{"L323", " "}, {"L322", "| "}});
test_with_expr_jak1(func, type, expected, false, "", {{"L323", " "}, {"L322", "| "}});
}
TEST_F(FormRegressionTest, ExprPrintName) {
@@ -2278,9 +2278,9 @@ TEST_F(FormRegressionTest, ExprPrintName) {
"(the-as int arg0))))))\n"
" )\n"
" )";
test_with_expr(func, type, expected, false, "", {},
"[\t\t[24, \"a1\", \"symbol\"],\n"
"\t\t[39, \"a0\", \"symbol\"]]");
test_with_expr_jak1(func, type, expected, false, "", {},
"[\t\t[24, \"a1\", \"symbol\"],\n"
"\t\t[39, \"a0\", \"symbol\"]]");
}
TEST_F(FormRegressionTest, ExprProfileBarMethod9) {
@@ -2296,7 +2296,7 @@ TEST_F(FormRegressionTest, ExprProfileBarMethod9) {
std::string type = "(function profile-bar int uint)";
std::string expected = "(-> arg0 data (+ (-> arg0 profile-frame-count) -2) time-stamp)";
test_with_expr(func, type, expected, false, "");
test_with_expr_jak1(func, type, expected, false, "");
}
TEST_F(FormRegressionTest, ExprStopwatchElapsedSeconds) {
@@ -2326,7 +2326,7 @@ TEST_F(FormRegressionTest, ExprStopwatchElapsedSeconds) {
std::string type = "(function int float)";
std::string expected = "(let ((v1-0 (abs arg0))) (* 0.0 (the float v1-0)))";
test_with_expr(func, type, expected, false, "");
test_with_expr_jak1(func, type, expected, false, "");
}
TEST_F(FormRegressionTest, ExprCopyStringString) {
@@ -2374,7 +2374,7 @@ TEST_F(FormRegressionTest, ExprCopyStringString) {
" )\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "");
test_with_expr_jak1(func, type, expected, false, "");
}
TEST_F(FormRegressionTest, StringLt) {
@@ -2479,7 +2479,7 @@ TEST_F(FormRegressionTest, StringLt) {
" )\n"
" #f\n"
" )";
test_with_expr(func, type, expected, false, "");
test_with_expr_jak1(func, type, expected, false, "");
}
TEST_F(FormRegressionTest, ExprAssert) {
@@ -2510,7 +2510,7 @@ TEST_F(FormRegressionTest, ExprAssert) {
std::string type = "(function symbol string int)";
std::string expected = "(begin (if (not arg0) (format #t \"A ~A\" arg1)) 0)";
test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}});
test_with_expr_jak1(func, type, expected, false, "", {{"L17", "A ~A"}});
}
TEST_F(FormRegressionTest, ExprTerminal2) {
@@ -2547,7 +2547,7 @@ TEST_F(FormRegressionTest, ExprTerminal2) {
" ((f0-4 (sqrtf (/ (- (* 0.0 arg0) arg1) arg2))))\n"
" (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4))))\n"
" )";
test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}});
test_with_expr_jak1(func, type, expected, false, "", {{"L17", "A ~A"}});
}
TEST_F(FormRegressionTest, MoveFalse) {
@@ -2568,7 +2568,7 @@ TEST_F(FormRegressionTest, MoveFalse) {
std::string type = "(function int symbol)";
std::string expected = "(logtest? (+ arg0 12) 1)";
test_with_expr(func, type, expected, false, "", {{"L17", "A ~A"}});
test_with_expr_jak1(func, type, expected, false, "", {{"L17", "A ~A"}});
}
// Good for testing that in-place ops (+!) check the _variable_ is the same.
@@ -2620,7 +2620,7 @@ TEST_F(FormRegressionTest, QMemCpy) {
" )\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, StripStripTrailingWhitespace) {
@@ -2728,7 +2728,7 @@ TEST_F(FormRegressionTest, StripStripTrailingWhitespace) {
" )\n"
" #f\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
// Let bug (github #328)
@@ -2782,7 +2782,7 @@ TEST_F(FormRegressionTest, TimeToGround) {
" )\n"
" (the-as float v0-0)\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
// Infinite loop bug (github #196)
@@ -2815,7 +2815,7 @@ TEST_F(FormRegressionTest, LoopingCode) {
" )\n"
" (the-as symbol #f)\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, AbsAsSideEffect) {
@@ -2869,7 +2869,7 @@ TEST_F(FormRegressionTest, AbsAsSideEffect) {
" )\n"
" )\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
// for github https://github.com/water111/jak-project/issues/332
@@ -2905,7 +2905,7 @@ TEST_F(FormRegressionTest, AshPropagation) {
" (logior! (-> arg0 bytes (/ arg1 8)) (ash 1 (logand arg1 7)))\n"
" 0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
// for github https://github.com/water111/jak-project/issues/332
@@ -2939,5 +2939,5 @@ TEST_F(FormRegressionTest, AshPropagation2) {
"(let ((v1-2 (-> arg0 bytes (/ arg1 8))))\n"
" (logtest? v1-2 (ash 1 (logand arg1 7)))\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
+60 -59
View File
@@ -50,10 +50,10 @@ TEST_F(FormRegressionTest, MatrixPMult) {
" )\n"
" arg0\n"
" )";
test_with_stack_structures(func, type, expected,
"[\n"
" [16, \"matrix\"]\n"
" ]");
test_with_stack_structures_jak1(func, type, expected,
"[\n"
" [16, \"matrix\"]\n"
" ]");
}
// TODO- this should also work without the cast, but be uglier.
@@ -96,11 +96,11 @@ TEST_F(FormRegressionTest, VectorXQuaternionWithCast) {
" )\n"
" arg0\n"
" )";
test_with_stack_structures(func, type, expected,
"[\n"
" [16, \"matrix\"]\n"
" ]",
"[[10, \"v1\", \"(pointer uint128)\"]]");
test_with_stack_structures_jak1(func, type, expected,
"[\n"
" [16, \"matrix\"]\n"
" ]",
"[[10, \"v1\", \"(pointer uint128)\"]]");
}
TEST_F(FormRegressionTest, EliminateFloatDeadSet) {
@@ -227,7 +227,7 @@ TEST_F(FormRegressionTest, EliminateFloatDeadSet) {
" )\n"
" )\n"
" )";
test_with_stack_structures(func, type, expected, "[]");
test_with_stack_structures_jak1(func, type, expected, "[]");
}
TEST_F(FormRegressionTest, IterateProcessTree) {
@@ -319,7 +319,7 @@ TEST_F(FormRegressionTest, IterateProcessTree) {
" )\n"
" s4-0\n"
" )";
test_with_stack_structures(func, type, expected, "[]");
test_with_stack_structures_jak1(func, type, expected, "[]");
}
TEST_F(FormRegressionTest, InspectVifStatBitfield) {
@@ -451,18 +451,18 @@ TEST_F(FormRegressionTest, InspectVifStatBitfield) {
" (format #t \"~T ~D~%\" (-> arg0 fqc))\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "",
{{"L37", "[~8x] ~A~%"},
{"L36", "~T ~D~%"},
{"L35", "~T ~D~%"},
{"L34", "~T ~D~%"},
{"L33", "~T ~D~%"},
{"L32", "~T ~D~%"},
{"L31", "~T ~D~%"},
{"L30", "~T ~D~%"},
{"L29", "~T ~D~%"},
{"L28", "~T ~D~%"},
{"L27", "~T ~D~%"}});
test_with_expr_jak1(func, type, expected, false, "",
{{"L37", "[~8x] ~A~%"},
{"L36", "~T ~D~%"},
{"L35", "~T ~D~%"},
{"L34", "~T ~D~%"},
{"L33", "~T ~D~%"},
{"L32", "~T ~D~%"},
{"L31", "~T ~D~%"},
{"L30", "~T ~D~%"},
{"L29", "~T ~D~%"},
{"L28", "~T ~D~%"},
{"L27", "~T ~D~%"}});
}
TEST_F(FormRegressionTest, InspectHandleBitfield) {
@@ -512,8 +512,9 @@ TEST_F(FormRegressionTest, InspectHandleBitfield) {
" (format #t \"~Tpid: ~D~%\" (-> arg0 pid))\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "",
{{"L79", "[~8x] ~A~%"}, {"L32", "~Tprocess: #x~X~%"}, {"L31", "~Tpid: ~D~%"}});
test_with_expr_jak1(
func, type, expected, false, "",
{{"L79", "[~8x] ~A~%"}, {"L32", "~Tprocess: #x~X~%"}, {"L31", "~Tpid: ~D~%"}});
}
TEST_F(FormRegressionTest, InspectDmaTagBitfield) {
@@ -598,16 +599,16 @@ TEST_F(FormRegressionTest, InspectDmaTagBitfield) {
" (format #t \"~Ta: ~D~%\" (-> arg0 spr))\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "",
{
{"L65", "[~8x] ~A~%"},
{"L37", "~Ta: ~D~%"},
{"L36", "~Ta: ~D~%"},
{"L35", "~Ta: ~D~%"},
{"L34", "~Ta: ~D~%"},
{"L33", "~Ta: ~D~%"},
{"L32", "~Ta: ~D~%"},
});
test_with_expr_jak1(func, type, expected, false, "",
{
{"L65", "[~8x] ~A~%"},
{"L37", "~Ta: ~D~%"},
{"L36", "~Ta: ~D~%"},
{"L35", "~Ta: ~D~%"},
{"L34", "~Ta: ~D~%"},
{"L33", "~Ta: ~D~%"},
{"L32", "~Ta: ~D~%"},
});
}
// Tests nonzero-check on bitfield
@@ -661,7 +662,7 @@ TEST_F(FormRegressionTest, DmaSyncCrash) {
" )\n"
" 0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, DmaSend) {
@@ -742,7 +743,7 @@ TEST_F(FormRegressionTest, DmaSend) {
" (.sync.l)\n"
" 0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, DmaInitialize) {
@@ -776,9 +777,9 @@ TEST_F(FormRegressionTest, DmaInitialize) {
" (set! (-> (the-as vif-bank #x10003c00) err me0) 1)\n"
" 0\n"
" )";
test_with_expr(func, type, expected, false, "", {},
"[[1, \"v1\", \"vif-bank\"], [8, \"v1\", \"vif-bank\"], [6, \"a0\", "
"\"vif-bank\"], [13, \"a0\", \"vif-bank\"]]");
test_with_expr_jak1(func, type, expected, false, "", {},
"[[1, \"v1\", \"vif-bank\"], [8, \"v1\", \"vif-bank\"], [6, \"a0\", "
"\"vif-bank\"], [13, \"a0\", \"vif-bank\"]]");
}
// Dynamic bitfield stuff.
@@ -859,7 +860,7 @@ TEST_F(FormRegressionTest, SetDisplayEnv) {
" (set! (-> arg0 bgcolor) (new 'static 'gs-bgcolor))\n"
" arg0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, DmaBufferAddVuFunction) {
@@ -974,7 +975,7 @@ TEST_F(FormRegressionTest, DmaBufferAddVuFunction) {
" )\n"
" #f\n"
" )";
test_with_expr(func, type, expected, false, "", {}, "[[[9, 33], \"t2\", \"dma-packet\"]]");
test_with_expr_jak1(func, type, expected, false, "", {}, "[[[9, 33], \"t2\", \"dma-packet\"]]");
}
TEST_F(FormRegressionTest, DmaBucketInsertTag) {
@@ -997,11 +998,11 @@ TEST_F(FormRegressionTest, DmaBucketInsertTag) {
" )\n"
" arg2\n"
" )";
test_with_expr(func, type, expected, false, "", {},
"[\n"
" [[2, 6], \"v1\", \"dma-bucket\"],\n"
" [3, \"a0\", \"dma-bucket\"]\n"
" ]");
test_with_expr_jak1(func, type, expected, false, "", {},
"[\n"
" [[2, 6], \"v1\", \"dma-bucket\"],\n"
" [3, \"a0\", \"dma-bucket\"]\n"
" ]");
}
TEST_F(FormRegressionTest, StupidFloatMove) {
@@ -1109,7 +1110,7 @@ TEST_F(FormRegressionTest, StupidFloatMove) {
" )\n"
" 0.0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
// gpr->fpr not being propagated
@@ -1128,7 +1129,7 @@ TEST_F(FormRegressionTest, Method11FontContext) {
" (set! (-> arg0 origin z) (the float arg1))\n"
" arg0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
// 128-bit bitfields, also type for pextuw
@@ -1166,7 +1167,7 @@ TEST_F(FormRegressionTest, Method4ResTag) {
" (* (-> arg0 elt-count) (-> arg0 elt-type size))\n"
" )\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, MakeSqrtTable) {
@@ -1240,7 +1241,7 @@ TEST_F(FormRegressionTest, MakeSqrtTable) {
" 0\n"
" (none)\n"
" )";
test_with_expr(
test_with_expr_jak1(
func, type, expected, false, "",
{{"L190", "static int sqrt_table[256] =~%{~%"}, {"L189", "~D,~%"}, {"L188", "};~%"}});
}
@@ -1288,7 +1289,7 @@ TEST_F(FormRegressionTest, Method2Vec4s) {
" )\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "", {{"L344", "#<vector ~F ~F ~F ~F @ #x~X>"}});
test_with_expr_jak1(func, type, expected, false, "", {{"L344", "#<vector ~F ~F ~F ~F @ #x~X>"}});
}
TEST_F(FormRegressionTest, SoundNameEqual) {
@@ -1310,7 +1311,7 @@ TEST_F(FormRegressionTest, SoundNameEqual) {
std::string type = "(function sound-name sound-name symbol)";
std::string expected =
"(and (= (the-as uint arg0) (the-as uint arg1)) (= (-> arg0 hi) (-> arg1 hi)))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, DebugMenuFuncDecode) {
@@ -1376,7 +1377,7 @@ TEST_F(FormRegressionTest, DebugMenuFuncDecode) {
" )\n"
" )\n"
" )";
test_with_expr(func, type, expected, false, "", {}, "[[13, \"a0\", \"symbol\"]]");
test_with_expr_jak1(func, type, expected, false, "", {}, "[[13, \"a0\", \"symbol\"]]");
}
TEST_F(FormRegressionTest, MatrixNewInlineProp) {
@@ -1431,7 +1432,7 @@ TEST_F(FormRegressionTest, MatrixNewInlineProp) {
" )\n"
" arg0\n"
" )";
test_with_stack_structures(func, type, expected, R"([[16, "matrix"]])");
test_with_stack_structures_jak1(func, type, expected, R"([[16, "matrix"]])");
}
TEST_F(FormRegressionTest, VectorNewInlineProp) {
@@ -1491,7 +1492,7 @@ TEST_F(FormRegressionTest, VectorNewInlineProp) {
" )\n"
" arg0\n"
" )";
test_with_stack_structures(func, type, expected, R"([[16, "vector"]])");
test_with_stack_structures_jak1(func, type, expected, R"([[16, "vector"]])");
}
TEST_F(FormRegressionTest, Method23Trsqv) {
@@ -1517,7 +1518,7 @@ TEST_F(FormRegressionTest, Method23Trsqv) {
std::string type = "(function trsqv vector float)";
std::string expected =
"(vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg1 (-> arg0 trans)))";
test_with_stack_structures(func, type, expected, R"([[16, "vector"]])");
test_with_stack_structures_jak1(func, type, expected, R"([[16, "vector"]])");
}
TEST_F(FormRegressionTest, VectorLineDistance) {
@@ -1612,6 +1613,6 @@ TEST_F(FormRegressionTest, VectorLineDistance) {
" )\n"
" (vector-length (vector-! (new-stack-vector0) gp-1 v1-3))\n"
" )";
test_with_stack_structures(func, type, expected,
R"([[16, "vector"], [32, "vector"], [48, "vector"], [64, "vector"]])");
test_with_stack_structures_jak1(
func, type, expected, R"([[16, "vector"], [32, "vector"], [48, "vector"], [64, "vector"]])");
}
@@ -53,7 +53,7 @@ TEST_F(FormRegressionTest, VectorDegToVectorRad) {
" (none)\n"
" )\n"
" )";
test_final_function(func, type, expected);
test_final_function_jak1(func, type, expected);
}
// weird short circuit thing
@@ -141,7 +141,7 @@ TEST_F(FormRegressionTest, WeirdShortCircuit) {
" )\n"
" s5-0\n"
" )";
test_with_stack_structures(func, type, expected, "[[16, \"event-message-block\"]]");
test_with_stack_structures_jak1(func, type, expected, "[[16, \"event-message-block\"]]");
}
TEST_F(FormRegressionTest, WeirdShortCircuit2) {
@@ -162,5 +162,5 @@ TEST_F(FormRegressionTest, WeirdShortCircuit2) {
" daddu sp, sp, r0";
std::string type = "(function actor-link-info object)";
std::string expected = "(the-as object (and (-> arg0 prev) (-> arg0 prev extra process)))";
test_with_stack_structures(func, type, expected, "[[16, \"event-message-block\"]]");
test_with_stack_structures_jak1(func, type, expected, "[[16, \"event-message-block\"]]");
}
@@ -665,32 +665,32 @@ TEST_F(FormRegressionTest, ExprArrayMethod2) {
" (format #t \")\")\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, true, "array",
{{"L343", "~f"},
{"L342", "#("},
{"L341", "~D"},
{"L340", " ~D"},
{"L339", "#x~X"},
{"L338", " #x~X"},
{"L337", " ~f"},
{"L336", "~A"},
{"L335", " ~A"},
{"L334", ")"}},
"["
"\t\t[23, \"gp\", \"(array int32)\"],\n"
"\t\t[43, \"gp\", \"(array uint32)\"],\n"
"\t\t[63, \"gp\", \"(array int64)\"],\n"
"\t\t[83, \"gp\", \"(array uint64)\"],\n"
"\t\t[102, \"gp\", \"(array int8)\"],\n"
"\t\t[121, \"gp\", \"(array uint8)\"],\n"
"\t\t[141, \"gp\", \"(array int16)\"],\n"
"\t\t[161, \"gp\", \"(array uint16)\"],\n"
"\t\t[186, \"gp\", \"(array uint128)\"],\n"
"\t\t[204, \"gp\", \"(array int32)\"],\n"
"\t\t[223, \"gp\", \"(array float)\"],\n"
"\t\t[232, \"gp\", \"(array float)\"],\n"
"\t\t[249, \"gp\", \"(array basic)\"],\n"
"\t\t[258, \"gp\", \"(array basic)\"]]");
test_with_expr_jak1(func, type, expected, true, "array",
{{"L343", "~f"},
{"L342", "#("},
{"L341", "~D"},
{"L340", " ~D"},
{"L339", "#x~X"},
{"L338", " #x~X"},
{"L337", " ~f"},
{"L336", "~A"},
{"L335", " ~A"},
{"L334", ")"}},
"["
"\t\t[23, \"gp\", \"(array int32)\"],\n"
"\t\t[43, \"gp\", \"(array uint32)\"],\n"
"\t\t[63, \"gp\", \"(array int64)\"],\n"
"\t\t[83, \"gp\", \"(array uint64)\"],\n"
"\t\t[102, \"gp\", \"(array int8)\"],\n"
"\t\t[121, \"gp\", \"(array uint8)\"],\n"
"\t\t[141, \"gp\", \"(array int16)\"],\n"
"\t\t[161, \"gp\", \"(array uint16)\"],\n"
"\t\t[186, \"gp\", \"(array uint128)\"],\n"
"\t\t[204, \"gp\", \"(array int32)\"],\n"
"\t\t[223, \"gp\", \"(array float)\"],\n"
"\t\t[232, \"gp\", \"(array float)\"],\n"
"\t\t[249, \"gp\", \"(array basic)\"],\n"
"\t\t[258, \"gp\", \"(array basic)\"]]");
}
TEST_F(FormRegressionTest, ExprArrayMethod3) {
@@ -1226,28 +1226,28 @@ TEST_F(FormRegressionTest, ExprArrayMethod3) {
" )\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, true, "array",
{{"L333", "[~8x] ~A~%"},
{"L332", "~Tallocated-length: ~D~%"},
{"L331", "~Tlength: ~D~%"},
{"L330", " ~Tcontent-type: ~A~%"},
{"L329", "~Tdata[~D]: @ #x~X~%"},
{"L328", "~T [~D] ~D~%"},
{"L327", "~T [~D] #x~X~%"},
{"L326", "~T [~D] ~f~%"},
{"L325", "~T [~D] ~A~%"}},
"[\t\t[44, \"gp\", \"(array int32)\"],\n"
"\t\t[62, \"gp\", \"(array uint32)\"],\n"
"\t\t[80, \"gp\", \"(array int64)\"],\n"
"\t\t[98, \"gp\", \"(array uint64)\"],\n"
"\t\t[115, \"gp\", \"(array int8)\"],\n"
"\t\t[132, \"gp\", \"(array int8)\"],\n"
"\t\t[150, \"gp\", \"(array int16)\"],\n"
"\t\t[168, \"gp\", \"(array uint16)\"],\n"
"\t\t[191, \"gp\", \"(array uint128)\"],\n"
"\t\t[207, \"gp\", \"(array int32)\"],\n"
"\t\t[226, \"gp\", \"(array float)\"],\n"
"\t\t[243, \"gp\", \"(array basic)\"]]");
test_with_expr_jak1(func, type, expected, true, "array",
{{"L333", "[~8x] ~A~%"},
{"L332", "~Tallocated-length: ~D~%"},
{"L331", "~Tlength: ~D~%"},
{"L330", " ~Tcontent-type: ~A~%"},
{"L329", "~Tdata[~D]: @ #x~X~%"},
{"L328", "~T [~D] ~D~%"},
{"L327", "~T [~D] #x~X~%"},
{"L326", "~T [~D] ~f~%"},
{"L325", "~T [~D] ~A~%"}},
"[\t\t[44, \"gp\", \"(array int32)\"],\n"
"\t\t[62, \"gp\", \"(array uint32)\"],\n"
"\t\t[80, \"gp\", \"(array int64)\"],\n"
"\t\t[98, \"gp\", \"(array uint64)\"],\n"
"\t\t[115, \"gp\", \"(array int8)\"],\n"
"\t\t[132, \"gp\", \"(array int8)\"],\n"
"\t\t[150, \"gp\", \"(array int16)\"],\n"
"\t\t[168, \"gp\", \"(array uint16)\"],\n"
"\t\t[191, \"gp\", \"(array uint128)\"],\n"
"\t\t[207, \"gp\", \"(array int32)\"],\n"
"\t\t[226, \"gp\", \"(array float)\"],\n"
"\t\t[243, \"gp\", \"(array basic)\"]]");
}
TEST_F(FormRegressionTest, ExprValid) {
@@ -2013,7 +2013,7 @@ TEST_F(FormRegressionTest, ExprValid) {
" )\n"
" )\n"
"\n";
test_with_expr(
test_with_expr_jak1(
func, type, expected, false, "",
{{"L321", "ERROR: object #x~X ~S is not a valid object (misaligned)~%"},
{"L320", "ERROR: object #x~X ~S is not a valid object (bad address)~%"},
@@ -2397,7 +2397,7 @@ TEST_F(FormRegressionTest, ExprStringToInt) {
" )\n"
" )\n"
" )";
test_final_function(func, type, expected);
test_final_function_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, Method19ResTag) {
@@ -2888,11 +2888,11 @@ TEST_F(FormRegressionTest, Method19ResTag) {
" (logior (logand 0 t0-6) (shl v1-14 32))\n"
" )\n"
" )";
test_with_expr(func, type, expected, false, "", {},
"[\n"
" [46, \"t2\", \"(pointer uint64)\"],\n"
" [100, \"t3\", \"(pointer uint64)\"],\n"
" [184, \"t5\", \"(pointer uint64)\"],\n"
" [64, \"t6\", \"(pointer uint64)\"]\n"
" ]");
test_with_expr_jak1(func, type, expected, false, "", {},
"[\n"
" [46, \"t2\", \"(pointer uint64)\"],\n"
" [100, \"t3\", \"(pointer uint64)\"],\n"
" [184, \"t5\", \"(pointer uint64)\"],\n"
" [64, \"t6\", \"(pointer uint64)\"]\n"
" ]");
}
+60 -58
View File
@@ -12,7 +12,7 @@ TEST_F(FormRegressionTest, ExprMethod7Object) {
" daddu sp, sp, r0\n";
std::string type = "(function object int object)";
std::string expected = "arg0";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprLoadPackage) {
@@ -71,7 +71,7 @@ TEST_F(FormRegressionTest, ExprLoadPackage) {
" v0-1\n"
" )\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprUnloadPackage) {
@@ -110,7 +110,7 @@ TEST_F(FormRegressionTest, ExprUnloadPackage) {
" )\n"
" *kernel-packages*\n"
" )";
test_with_expr(func, type, expected, true);
test_with_expr_jak1(func, type, expected, true);
}
TEST_F(FormRegressionTest, ExprMethod1Thread) {
@@ -141,7 +141,7 @@ TEST_F(FormRegressionTest, ExprMethod1Thread) {
" (set! (-> arg0 process top-thread) (-> arg0 previous))\n"
" (none)\n"
" )";
test_with_expr(func, type, expected, false);
test_with_expr_jak1(func, type, expected, false);
}
TEST_F(FormRegressionTest, ExprMethod2Thread) {
@@ -187,7 +187,8 @@ TEST_F(FormRegressionTest, ExprMethod2Thread) {
" )\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "", {{"L343", "#<~A ~S of ~S pc: #x~X @ #x~X>"}});
test_with_expr_jak1(func, type, expected, false, "",
{{"L343", "#<~A ~S of ~S pc: #x~X @ #x~X>"}});
}
TEST_F(FormRegressionTest, ExprMethod9Thread) {
@@ -288,7 +289,7 @@ TEST_F(FormRegressionTest, ExprMethod9Thread) {
" 0\n"
" (none)\n"
" )";
test_with_expr(func, type, expected, false, "", {{"L342", "1 ~A ~%"}, {"L341", "2 ~A ~%"}});
test_with_expr_jak1(func, type, expected, false, "", {{"L342", "1 ~A ~%"}, {"L341", "2 ~A ~%"}});
}
TEST_F(FormRegressionTest, ExprMethod0Thread) {
@@ -363,9 +364,9 @@ TEST_F(FormRegressionTest, ExprMethod0Thread) {
" (set! (-> obj stack-size) arg4)\n"
" (the-as cpu-thread obj)\n"
" )";
test_with_expr(func, type, expected, false, "cpu-thread", {},
"[[[13, 28], \"v0\", \"cpu-thread\"]]",
"{\"vars\":{\"v0-0\":[\"obj\", \"cpu-thread\"]}}");
test_with_expr_jak1(func, type, expected, false, "cpu-thread", {},
"[[[13, 28], \"v0\", \"cpu-thread\"]]",
"{\"vars\":{\"v0-0\":[\"obj\", \"cpu-thread\"]}}");
}
TEST_F(FormRegressionTest, ExprMethod5CpuThread) {
@@ -380,7 +381,7 @@ TEST_F(FormRegressionTest, ExprMethod5CpuThread) {
" daddu sp, sp, r0";
std::string type = "(function cpu-thread int)";
std::string expected = "(the-as int (+ (-> arg0 type size) (-> arg0 stack-size)))";
test_with_expr(func, type, expected, false);
test_with_expr_jak1(func, type, expected, false);
}
TEST_F(FormRegressionTest, RemoveExit) {
@@ -406,7 +407,7 @@ TEST_F(FormRegressionTest, RemoveExit) {
" v0-0\n"
" )\n"
" )";
test_with_expr(func, type, expected, false);
test_with_expr_jak1(func, type, expected, false);
}
TEST_F(FormRegressionTest, RemoveMethod0ProcessTree) {
@@ -451,7 +452,7 @@ TEST_F(FormRegressionTest, RemoveMethod0ProcessTree) {
" (set! (-> v0-0 ppointer) (the-as (pointer process) (&-> v0-0 self)))\n"
" v0-0\n"
" )";
test_with_expr(func, type, expected, false, "process-tree");
test_with_expr_jak1(func, type, expected, false, "process-tree");
}
TEST_F(FormRegressionTest, RemoveMethod3ProcessTree) {
@@ -547,13 +548,13 @@ TEST_F(FormRegressionTest, RemoveMethod3ProcessTree) {
" (format #t \"~Tchild: ~A~%\" (ppointer->process (-> arg0 child)))\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "process-tree",
{{"L340", "[~8x] ~A~%"},
{"L339", "~Tname: ~S~%"},
{"L338", "~Tmask: #x~X~%"},
{"L337", "~Tparent: ~A~%"},
{"L336", "~Tbrother: ~A~%"},
{"L335", "~Tchild: ~A~%"}});
test_with_expr_jak1(func, type, expected, false, "process-tree",
{{"L340", "[~8x] ~A~%"},
{"L339", "~Tname: ~S~%"},
{"L338", "~Tmask: #x~X~%"},
{"L337", "~Tparent: ~A~%"},
{"L336", "~Tbrother: ~A~%"},
{"L335", "~Tchild: ~A~%"}});
}
TEST_F(FormRegressionTest, ExprMethod0Process) {
@@ -666,9 +667,9 @@ TEST_F(FormRegressionTest, ExprMethod0Process) {
" )\n"
" (the-as process v0-0)\n"
" )";
test_with_expr(func, type, expected, false, "process", {},
"[\t\t[12, \"a0\", \"int\"],\n"
"\t\t[[13, 43], \"v0\", \"process\"]]");
test_with_expr_jak1(func, type, expected, false, "process", {},
"[\t\t[12, \"a0\", \"int\"],\n"
"\t\t[[13, 43], \"v0\", \"process\"]]");
}
TEST_F(FormRegressionTest, ExprInspectProcessHeap) {
@@ -731,10 +732,10 @@ TEST_F(FormRegressionTest, ExprInspectProcessHeap) {
" )\n"
" #f\n"
" )";
test_with_expr(func, type, expected, false, "", {},
"[\t\t[[4,11], \"s5\", \"basic\"],\n"
"\t\t[[17,20], \"s5\", \"pointer\"]]",
"{\"vars\":{\"s5-0\":[\"obj\", \"pointer\"]}}");
test_with_expr_jak1(func, type, expected, false, "", {},
"[\t\t[[4,11], \"s5\", \"basic\"],\n"
"\t\t[[17,20], \"s5\", \"pointer\"]]",
"{\"vars\":{\"s5-0\":[\"obj\", \"pointer\"]}}");
}
// note: skipped method 3 process
@@ -750,7 +751,7 @@ TEST_F(FormRegressionTest, ExprMethod5Process) {
" daddu sp, sp, r0";
std::string type = "(function process int)";
std::string expected = "(the-as int (+ (-> process size) (-> arg0 allocated-length)))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod2Process) {
@@ -831,8 +832,9 @@ TEST_F(FormRegressionTest, ExprMethod2Process) {
" )\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "",
{{"L317", "#<~A ~S ~A :state ~S "}, {"L316", ":stack ~D/~D :heap ~D/~D @ #x~X>"}});
test_with_expr_jak1(
func, type, expected, false, "",
{{"L317", "#<~A ~S ~A :state ~S "}, {"L316", ":stack ~D/~D :heap ~D/~D @ #x~X>"}});
}
TEST_F(FormRegressionTest, ExprMethod0DeadPool) {
@@ -945,7 +947,7 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPool) {
" )\n"
" s3-0\n"
" )";
test_with_expr(func, type, expected, false, "dead-pool");
test_with_expr_jak1(func, type, expected, false, "dead-pool");
}
TEST_F(FormRegressionTest, ExprMethod14DeadPool) {
@@ -1085,7 +1087,7 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPool) {
" )";
// note - there's likely an actual bug here.
test_with_expr(
test_with_expr_jak1(
func, type, expected, false, "dead-pool",
{{"L315", "WARNING: ~A ~A had to be allocated from the debug pool, because ~A was empty.~%"},
{"L314", "WARNING: ~A ~A could not be allocated, because ~A was empty.~%"}},
@@ -1111,7 +1113,7 @@ TEST_F(FormRegressionTest, ExprMethod15DeadPool) {
" daddiu sp, sp, 16";
std::string type = "(function dead-pool process none)";
std::string expected = "(begin (change-parent arg1 arg0) (none))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod0DeadPoolHeap) {
@@ -1256,10 +1258,10 @@ TEST_F(FormRegressionTest, ExprMethod0DeadPoolHeap) {
" (set! (-> obj heap top-base) (-> obj heap top))\n"
" obj\n"
" )";
test_with_expr(func, type, expected, false, "dead-pool-heap", {},
"[\t\t[60, \"v0\", \"int\"],\n"
"\t\t[61, \"a0\", \"pointer\"], [61, \"v0\", \"dead-pool-heap\"]]",
"{\"vars\":{\"v0-0\":[\"obj\", \"dead-pool-heap\"]}}");
test_with_expr_jak1(func, type, expected, false, "dead-pool-heap", {},
"[\t\t[60, \"v0\", \"int\"],\n"
"\t\t[61, \"a0\", \"pointer\"], [61, \"v0\", \"dead-pool-heap\"]]",
"{\"vars\":{\"v0-0\":[\"obj\", \"dead-pool-heap\"]}}");
}
TEST_F(FormRegressionTest, ExprMethod22DeadPoolHeap) {
@@ -1296,7 +1298,7 @@ TEST_F(FormRegressionTest, ExprMethod22DeadPoolHeap) {
" (-> arg0 heap base)\n"
" )\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod21DeadPoolHeap) {
@@ -1382,10 +1384,10 @@ TEST_F(FormRegressionTest, ExprMethod21DeadPoolHeap) {
" (&- (-> arg0 heap top) (the-as uint (-> arg0 heap base)))\n"
" )\n"
" )";
test_with_expr(func, type, expected, false, "", {},
"[\t\t[5, \"v1\", \"pointer\"],\n"
"\t\t[13, \"a0\", \"pointer\"],\n"
"\t\t[25, \"v1\", \"pointer\"]]");
test_with_expr_jak1(func, type, expected, false, "", {},
"[\t\t[5, \"v1\", \"pointer\"],\n"
"\t\t[13, \"a0\", \"pointer\"],\n"
"\t\t[25, \"v1\", \"pointer\"]]");
}
TEST_F(FormRegressionTest, ExprMethod3DeadPoolHeap) {
@@ -1561,10 +1563,10 @@ TEST_F(FormRegressionTest, ExprMethod3DeadPoolHeap) {
" )\n"
" arg0\n"
" )";
test_with_expr(func, type, expected, false, "",
{{"L300", "~Tprocess-list[0] @ #x~X ~D/~D bytes used~%"},
{"L299", "~T [~3D] #<dead-pool-heap-rec @ #x~X> ~A~%"},
{"L298", "~T gap: ~D bytes @ #x~X~%"}});
test_with_expr_jak1(func, type, expected, false, "",
{{"L300", "~Tprocess-list[0] @ #x~X ~D/~D bytes used~%"},
{"L299", "~T [~3D] #<dead-pool-heap-rec @ #x~X> ~A~%"},
{"L298", "~T gap: ~D bytes @ #x~X~%"}});
}
TEST_F(FormRegressionTest, ExprMethod5DeadPoolHeap) {
@@ -1579,8 +1581,8 @@ TEST_F(FormRegressionTest, ExprMethod5DeadPoolHeap) {
std::string type = "(function dead-pool-heap int)";
std::string expected =
"(+ (the-as int (- -4 (the-as int arg0))) (the-as int (-> arg0 heap top)))";
test_with_expr(func, type, expected, false, "", {},
"[[3, \"v1\", \"int\"], [3, \"a0\", \"int\"]]");
test_with_expr_jak1(func, type, expected, false, "", {},
"[[3, \"v1\", \"int\"], [3, \"a0\", \"int\"]]");
}
TEST_F(FormRegressionTest, ExprMethod19DeadPoolHeap) {
@@ -1632,7 +1634,7 @@ TEST_F(FormRegressionTest, ExprMethod19DeadPoolHeap) {
" (- (memory-total arg0) (gap-size arg0 (-> arg0 alive-list prev)))\n"
" 0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod20DeadPoolHeap) {
@@ -1645,7 +1647,7 @@ TEST_F(FormRegressionTest, ExprMethod20DeadPoolHeap) {
" daddu sp, sp, r0";
std::string type = "(function dead-pool-heap int)";
std::string expected = "(&- (-> arg0 heap top) (the-as uint (-> arg0 heap base)))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod25DeadPoolHeap) {
@@ -1688,7 +1690,7 @@ TEST_F(FormRegressionTest, ExprMethod25DeadPoolHeap) {
" (&- v1-0 (the-as uint (-> arg0 heap base)))\n"
" )\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod26DeadPoolHeap) {
@@ -1699,7 +1701,7 @@ TEST_F(FormRegressionTest, ExprMethod26DeadPoolHeap) {
" daddu sp, sp, r0";
std::string type = "(function dead-pool-heap uint)";
std::string expected = "(-> arg0 compact-time)";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod24DeadPoolHeap) {
@@ -1756,7 +1758,7 @@ TEST_F(FormRegressionTest, ExprMethod24DeadPoolHeap) {
" (while (and gp-0 (< (gap-size arg0 gp-0) arg1)) (set! gp-0 (-> gp-0 next)))\n"
" gp-0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod14DeadPoolHeap) {
@@ -2032,7 +2034,7 @@ TEST_F(FormRegressionTest, ExprMethod14DeadPoolHeap) {
" )\n"
" s3-0\n"
" )";
test_with_expr(
test_with_expr_jak1(
func, type, expected, false, "",
{{"L315", "WARNING: ~A ~A had to be allocated from the debug pool, because ~A was empty.~%"},
{"L314", "WARNING: ~A ~A could not be allocated, because ~A was empty.~%"}});
@@ -2199,8 +2201,8 @@ TEST_F(FormRegressionTest, ExprMethod15DeadPoolHeap) {
" 0\n"
" (none)\n"
" )";
test_with_expr(func, type, expected, false, "",
{{"L297", "ERROR: process ~A does not belong to dead-pool-heap ~A.~%"}});
test_with_expr_jak1(func, type, expected, false, "",
{{"L297", "ERROR: process ~A does not belong to dead-pool-heap ~A.~%"}});
}
TEST_F(FormRegressionTest, ExprMethod17DeadPoolHeap) {
@@ -2325,7 +2327,7 @@ TEST_F(FormRegressionTest, ExprMethod17DeadPoolHeap) {
" )\n"
" arg0\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprMethod16DeadPoolHeap) {
@@ -2574,7 +2576,7 @@ TEST_F(FormRegressionTest, ExprMethod16DeadPoolHeap) {
" 0\n"
" (none)\n"
" )";
test_with_expr(func, type, expected, false, "", {{"L296", "~3LLow Actor Memory~%~0L"}});
test_with_expr_jak1(func, type, expected, false, "", {{"L296", "~3LLow Actor Memory~%~0L"}});
}
// nested method calls
@@ -2771,5 +2773,5 @@ TEST_F(FormRegressionTest, ExprMethod18DeadPoolHeap) {
" 0\n"
" (none)\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
+4 -4
View File
@@ -15,7 +15,7 @@ TEST_F(FormRegressionTest, ExprTruncate) {
" daddu sp, sp, r0";
std::string type = "(function float float)";
std::string expected = "(the float (the int arg0))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprIntegralP) {
@@ -37,7 +37,7 @@ TEST_F(FormRegressionTest, ExprIntegralP) {
" daddu sp, sp, r0";
std::string type = "(function float float)";
std::string expected = "(the-as float (= (the float (the int arg0)) arg0))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprFractionalPart) {
@@ -55,7 +55,7 @@ TEST_F(FormRegressionTest, ExprFractionalPart) {
" daddu sp, sp, r0";
std::string type = "(function float float)";
std::string expected = "(- arg0 (the float (the int arg0)))";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}
TEST_F(FormRegressionTest, ExprSeek) {
@@ -103,5 +103,5 @@ TEST_F(FormRegressionTest, ExprSeek) {
" (else (- arg0 arg2))\n"
" )\n"
" )";
test_with_expr(func, type, expected);
test_with_expr_jak1(func, type, expected);
}