diff --git a/fvtest/compilertriltest/ArithmeticTest.cpp b/fvtest/compilertriltest/ArithmeticTest.cpp index 69fff8ab999..694aa8809e8 100644 --- a/fvtest/compilertriltest/ArithmeticTest.cpp +++ b/fvtest/compilertriltest/ArithmeticTest.cpp @@ -87,7 +87,7 @@ TEST_P(Int32Arithmetic, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32" " (block" " (ireturn" @@ -116,7 +116,7 @@ TEST_P(Int32Arithmetic, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32]" " (block" " (ireturn" @@ -141,7 +141,7 @@ TEST_P(Int32Arithmetic, UsingLoadParamAndLoadConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -171,7 +171,7 @@ TEST_P(UInt32Arithmetic, UsingConst) { << "The Power codegen does not yet support iudiv/iurem (see issue #3673)"; char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32" " (block" " (ireturn" @@ -204,7 +204,7 @@ TEST_P(UInt32Arithmetic, UsingLoadParam) { << "The Power codegen does not yet support iudiv/iurem (see issue #3673)"; char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32]" " (block" " (ireturn" @@ -233,7 +233,7 @@ TEST_P(UInt32Arithmetic, UsingLoadParamAndLoadConst) { << "The Power codegen does not yet support iudiv/iurem (see issue #3673)"; char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -259,7 +259,7 @@ TEST_P(Int64Arithmetic, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64" " (block" " (lreturn" @@ -288,7 +288,7 @@ TEST_P(Int64Arithmetic, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64, Int64]" " (block" " (lreturn" @@ -313,7 +313,7 @@ TEST_P(Int64Arithmetic, UsingLoadParamAndLoadConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64]" " (block" " (lreturn" @@ -343,7 +343,7 @@ TEST_P(UInt64Arithmetic, UsingConst) { << "The Power codegen does not yet support ludiv (see issue #2227)"; char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64" " (block" " (lreturn" @@ -376,7 +376,7 @@ TEST_P(UInt64Arithmetic, UsingLoadParam) { << "The Power codegen does not yet support ludiv (see issue #2227)"; char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64, Int64]" " (block" " (lreturn" @@ -405,7 +405,7 @@ TEST_P(UInt64Arithmetic, UsingLoadParamAndLoadConst) { << "The Power codegen does not yet support ludiv (see issue #2227)"; char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64]" " (block" " (lreturn" @@ -431,7 +431,7 @@ TEST_P(Int16Arithmetic, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16" " (block" " (ireturn" @@ -460,7 +460,7 @@ TEST_P(Int16Arithmetic, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16, Int16]" " (block" " (ireturn" @@ -485,7 +485,7 @@ TEST_P(Int16Arithmetic, UsingLoadParamAndLoadConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16]" " (block" " (ireturn" @@ -511,7 +511,7 @@ TEST_P(Int8Arithmetic, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8" " (block" " (ireturn" @@ -540,7 +540,7 @@ TEST_P(Int8Arithmetic, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8, Int8]" " (block" " (ireturn" @@ -565,7 +565,7 @@ TEST_P(Int8Arithmetic, UsingLoadParamAndLoadConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8]" " (block" " (ireturn" @@ -700,7 +700,7 @@ TEST_P(FloatArithmetic, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float" " (block" " (freturn" @@ -729,7 +729,7 @@ TEST_P(FloatArithmetic, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Float, Float]" " (block" " (freturn" @@ -761,7 +761,7 @@ TEST_P(FloatArithmetic, UsingLoadParamAndLoadConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Float]" " (block" " (freturn" @@ -805,7 +805,7 @@ class AddressInt64Arithmetic : public TRTest::OpCodeTest(GetParam()); auto offset = std::get<1>(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Address, Address]" " (block" " (ireturn" @@ -175,7 +175,7 @@ TEST_P(ArraycmpNotEqualTest, ArraycmpGreaterThanVariableLen) { auto length = std::get<0>(GetParam()); auto offset = std::get<1>(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Address, Address, Int32]" " (block" " (ireturn" @@ -207,7 +207,7 @@ TEST_P(ArraycmpNotEqualTest, ArraycmpLessThanConstLen) { auto length = std::get<0>(GetParam()); auto offset = std::get<1>(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Address, Address]" " (block" " (ireturn" @@ -240,7 +240,7 @@ TEST_P(ArraycmpNotEqualTest, ArraycmpLessThanVariableLen) { auto length = std::get<0>(GetParam()); auto offset = std::get<1>(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Address, Address, Int32]" " (block" " (ireturn" @@ -318,7 +318,7 @@ TEST_P(ArraycmplenEqualTest, ArraycmpLenSameArray) { /* * "address=0" parameter is needed for arraycmp opcode because "Call" property is set to the opcode. */ - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Address, Address]" " (block" " (lreturn" @@ -347,7 +347,7 @@ TEST_P(ArraycmplenEqualTest, ArraycmpLenEqualConstLen) { auto length = GetParam(); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Address, Address]" " (block" " (lreturn" @@ -377,7 +377,7 @@ TEST_P(ArraycmplenEqualTest, ArraycmpLenEqualVariableLen) { auto length = GetParam(); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Address, Address, Int64]" " (block" " (lreturn" @@ -409,7 +409,7 @@ TEST_P(ArraycmplenNotEqualTest, ArraycmpLenNotEqualConstLen) { auto length = std::get<0>(GetParam()); auto offset = std::get<1>(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Address, Address]" " (block" " (lreturn" @@ -442,7 +442,7 @@ TEST_P(ArraycmplenNotEqualTest, ArraycmpLenNotEqualVariableLen) { auto length = std::get<0>(GetParam()); auto offset = std::get<1>(GetParam()); char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Address, Address, Int64]" " (block" " (lreturn" diff --git a/fvtest/compilertriltest/BitPermuteTest.cpp b/fvtest/compilertriltest/BitPermuteTest.cpp index 19934932a21..a8bac11cbea 100644 --- a/fvtest/compilertriltest/BitPermuteTest.cpp +++ b/fvtest/compilertriltest/BitPermuteTest.cpp @@ -141,7 +141,7 @@ TEST_P(lBitPermuteTest, ConstAddressLengthTest) auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64] " " (block " " (lreturn " @@ -173,7 +173,7 @@ TEST_P(lBitPermuteTest, ConstAddressTest) auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64, Int32] " " (block " " (lreturn " @@ -204,7 +204,7 @@ TEST_P(lBitPermuteTest, NoConstTest) auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64, Address, Int32] " " (block " " (lreturn " @@ -240,7 +240,7 @@ TEST_P(iBitPermuteTest, ConstAddressLengthTest) maskedIndices[i] = param.arrayAddress[i] & 0x1F; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32] " " (block " " (ireturn " @@ -276,7 +276,7 @@ TEST_P(iBitPermuteTest, ConstAddressTest) maskedIndices[i] = param.arrayAddress[i] & 0x1F; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32] " " (block " " (ireturn " @@ -311,7 +311,7 @@ TEST_P(iBitPermuteTest, NoConstTest) maskedIndices[i] = param.arrayAddress[i] & 0x1F; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Address, Int32] " " (block " " (ireturn " @@ -347,7 +347,7 @@ TEST_P(sBitPermuteTest, ConstAddressLengthTest) maskedIndices[i] = param.arrayAddress[i] & 0xF; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int16] " " (block " " (ireturn " @@ -384,7 +384,7 @@ TEST_P(sBitPermuteTest, ConstAddressTest) maskedIndices[i] = param.arrayAddress[i] & 0xF; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int16, Int32] " " (block " " (ireturn " @@ -420,7 +420,7 @@ TEST_P(sBitPermuteTest, NoConstTest) maskedIndices[i] = param.arrayAddress[i] & 0xF; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int16, Address, Int32] " " (block " " (ireturn " @@ -457,7 +457,7 @@ TEST_P(bBitPermuteTest, ConstAddressLengthTest) maskedIndices[i] = param.arrayAddress[i] & 0x7; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int8] " " (block " " (ireturn " @@ -494,7 +494,7 @@ TEST_P(bBitPermuteTest, ConstAddressTest) maskedIndices[i] = param.arrayAddress[i] & 0x7; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int8, Int32] " " (block " " (ireturn " @@ -530,7 +530,7 @@ TEST_P(bBitPermuteTest, NoConstTest) maskedIndices[i] = param.arrayAddress[i] & 0x7; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int8, Address, Int32] " " (block " " (ireturn " diff --git a/fvtest/compilertriltest/CallTest.cpp b/fvtest/compilertriltest/CallTest.cpp index a22653d0159..37de8f5471c 100644 --- a/fvtest/compilertriltest/CallTest.cpp +++ b/fvtest/compilertriltest/CallTest.cpp @@ -37,8 +37,8 @@ TEST_F(CallTest, icallOracle) { SKIP_ON_AARCH64(MissingImplementation) << "Test is skipped on AArch64 because calls are not currently supported (see issue #1645)"; char inputTrees[200] = {0}; - const auto format_string = "(method return=Int32 args=[Int32] (block (ireturn (icall address=0x%jX args=[Int32] (iload parm=0)) ) ))"; - std::snprintf(inputTrees, 200, format_string, reinterpret_cast(&oracleBoracle)); + const auto format_string = "(method return=Int32 args=[Int32] (block (ireturn (icall address=0x%X args=[Int32] (iload parm=0)) ) ))"; + Tril::format(inputTrees, 200, format_string, &oracleBoracle); auto trees = parseString(inputTrees); ASSERT_NOTNULL(trees) << "Trees failed to parse\n" << inputTrees; diff --git a/fvtest/compilertriltest/CompareTest.cpp b/fvtest/compilertriltest/CompareTest.cpp index 3fefa1b1ab9..eb6a52c7d2e 100644 --- a/fvtest/compilertriltest/CompareTest.cpp +++ b/fvtest/compilertriltest/CompareTest.cpp @@ -54,7 +54,7 @@ TEST_P(Int32Compare, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int32 " "(block " "(ireturn " @@ -80,7 +80,7 @@ TEST_P(Int32Compare, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int32 args=[Int32] " "(block " "(ireturn " @@ -106,7 +106,7 @@ TEST_P(Int32Compare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int32 args=[Int32, Int32] " "(block " "(ireturn " @@ -161,7 +161,7 @@ TEST_P(UInt32Compare, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int32 " "(block " "(ireturn " @@ -187,7 +187,7 @@ TEST_P(UInt32Compare, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int32 args=[Int32] " "(block " "(ireturn " @@ -213,7 +213,7 @@ TEST_P(UInt32Compare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int32 args=[Int32, Int32] " "(block " "(ireturn " @@ -278,7 +278,7 @@ TEST_P(Int64Compare, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 " "(block " "(ireturn " @@ -304,7 +304,7 @@ TEST_P(Int64Compare, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 args=[Int64] " "(block " "(ireturn " @@ -330,7 +330,7 @@ TEST_P(Int64Compare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 args=[Int64, Int64] " "(block " "(ireturn " @@ -387,7 +387,7 @@ TEST_P(UInt64Compare, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 " "(block " "(ireturn " @@ -413,7 +413,7 @@ TEST_P(UInt64Compare, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 args=[Int64] " "(block " "(ireturn " @@ -439,7 +439,7 @@ TEST_P(UInt64Compare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 args=[Int64, Int64] " "(block " "(ireturn " @@ -503,7 +503,7 @@ TEST_P(Int32IfCompare, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 " "(block " "(%s target=b1 (iconst %d) (iconst %d))) " @@ -531,7 +531,7 @@ TEST_P(Int32IfCompare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 args=[Int32, Int32] " "(block " "(%s target=b1 (iload parm=0) (iload parm=1))) " @@ -588,7 +588,7 @@ TEST_P(UInt32IfCompare, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 " "(block " "(%s target=b1 (iconst %d) (iconst %d))) " @@ -616,7 +616,7 @@ TEST_P(UInt32IfCompare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 args=[Int32, Int32] " "(block " "(%s target=b1 (iload parm=0) (iload parm=1))) " @@ -679,7 +679,7 @@ TEST_P(Int64IfCompare, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 " "(block " "(%s target=b1 (lconst %" OMR_PRId64 ") (lconst %" OMR_PRId64 "))) " @@ -707,7 +707,7 @@ TEST_P(Int64IfCompare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 args=[Int64, Int64] " "(block " "(%s target=b1 (lload parm=0) (lload parm=1))) " @@ -764,7 +764,7 @@ TEST_P(UInt64IfCompare, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 " "(block " "(%s target=b1 (lconst %" OMR_PRIu64 ") (lconst %" OMR_PRIu64 "))) " @@ -792,7 +792,7 @@ TEST_P(UInt64IfCompare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 args=[Int64, Int64] " "(block " "(%s target=b1 (lload parm=0) (lload parm=1))) " @@ -899,7 +899,7 @@ TEST_P(FloatCompare, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 " "(block " "(ireturn " @@ -930,7 +930,7 @@ TEST_P(FloatCompare, UsingRhsConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 args=[Float] " "(block " "(ireturn " @@ -956,7 +956,7 @@ TEST_P(FloatCompare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 args=[Float, Float] " "(block " "(ireturn " @@ -1057,7 +1057,7 @@ TEST_P(DoubleCompare, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 " "(block " "(ireturn " @@ -1088,7 +1088,7 @@ TEST_P(DoubleCompare, UsingRhsConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 args=[Double] " "(block " "(ireturn " @@ -1114,7 +1114,7 @@ TEST_P(DoubleCompare, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 args=[Double, Double] " "(block " "(ireturn " @@ -1202,7 +1202,7 @@ TEST_P(FloatIfCompare, UsingConst) { } char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 " "(block " "(%s target=b1 (fconst %f) (fconst %f))) " @@ -1236,7 +1236,7 @@ TEST_P(FloatIfCompare, UsingLoadParam) { } char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 args=[Float, Float] " "(block " "(%s target=b1 (fload parm=0) (fload parm=1))) " @@ -1324,7 +1324,7 @@ TEST_P(DoubleIfCompare, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 " "(block " "(%s target=b1 (dconst %f) (dconst %f))) " @@ -1358,7 +1358,7 @@ TEST_P(DoubleIfCompare, UsingLoadParam) { } char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 args=[Double, Double] " "(block " "(%s target=b1 (dload parm=0) (dload parm=1))) " @@ -1443,7 +1443,7 @@ TEST_P(FloatCompareOrUnordered, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 " "(block " "(ireturn " @@ -1476,7 +1476,7 @@ TEST_P(FloatCompareOrUnordered, UsingRhsConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 args=[Float] " "(block " "(ireturn " @@ -1504,7 +1504,7 @@ TEST_P(FloatCompareOrUnordered, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 args=[Float, Float] " "(block " "(ireturn " @@ -1587,7 +1587,7 @@ TEST_P(DoubleCompareOrUnordered, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 " "(block " "(ireturn " @@ -1620,7 +1620,7 @@ TEST_P(DoubleCompareOrUnordered, UsingRhsConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 args=[Double] " "(block " "(ireturn " @@ -1648,7 +1648,7 @@ TEST_P(DoubleCompareOrUnordered, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32 args=[Double, Double] " "(block " "(ireturn " @@ -1733,7 +1733,7 @@ TEST_P(FloatIfCompareOrUnordered, UsingConst) { } char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 " "(block " "(%s target=b1 (fconst %f) (fconst %f))) " @@ -1764,7 +1764,7 @@ TEST_P(FloatIfCompareOrUnordered, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 args=[Float, Float] " "(block " "(%s target=b1 (fload parm=0) (fload parm=1))) " @@ -1850,7 +1850,7 @@ TEST_P(DoubleIfCompareOrUnordered, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, 1024, + Tril::format(inputTrees, 1024, "(method return=Int32 " "(block " "(%s target=b1 (dconst %f) (dconst %f))) " @@ -1881,7 +1881,7 @@ TEST_P(DoubleIfCompareOrUnordered, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32 args=[Double, Double] " "(block " "(%s target=b1 (dload parm=0) (dload parm=1))) " diff --git a/fvtest/compilertriltest/IfxcmpgeReductionTest.cpp b/fvtest/compilertriltest/IfxcmpgeReductionTest.cpp index 14269bdaf3f..56de96d421f 100644 --- a/fvtest/compilertriltest/IfxcmpgeReductionTest.cpp +++ b/fvtest/compilertriltest/IfxcmpgeReductionTest.cpp @@ -98,7 +98,7 @@ TEST_P(Int8ReductionTest, Reduction) auto param = to_struct(GetParam()); char inputTrees[600] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block name=\"b\" fallthrough=\"f\"" " (ifbcmpge target=\"t\"" @@ -145,7 +145,7 @@ TEST_P(UInt8ReductionTest, Reduction) auto param = to_struct(GetParam()); char inputTrees[600] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block name=\"b\" fallthrough=\"f\"" " (ifbucmpge target=\"t\"" @@ -192,7 +192,7 @@ TEST_P(Int16ReductionTest, Reduction) auto param = to_struct(GetParam()); char inputTrees[600] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block name=\"b\" fallthrough=\"f\"" " (ifscmpge target=\"t\"" @@ -239,7 +239,7 @@ TEST_P(UInt16ReductionTest, Reduction) auto param = to_struct(GetParam()); char inputTrees[600] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block name=\"b\" fallthrough=\"f\"" " (ifsucmpge target=\"t\"" @@ -283,7 +283,7 @@ TEST_P(Int32ReductionTest, Reduction) auto param = to_struct(GetParam()); char inputTrees[600] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block name=\"b\" fallthrough=\"f\"" " (ificmpge target=\"t\"" @@ -326,7 +326,7 @@ TEST_P(UInt32ReductionTest, Reduction) auto param = to_struct(GetParam()); char inputTrees[600] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block name=\"b\" fallthrough=\"f\"" " (ifiucmpge target=\"t\"" @@ -369,7 +369,7 @@ TEST_P(Int64ReductionTest, Reduction) auto param = to_struct(GetParam()); char inputTrees[600] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int64]" " (block name=\"b\" fallthrough=\"f\"" " (iflcmpge target=\"t\"" @@ -412,7 +412,7 @@ TEST_P(UInt64ReductionTest, Reduction) auto param = to_struct(GetParam()); char inputTrees[600] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int64]" " (block name=\"b\" fallthrough=\"f\"" " (iflucmpge target=\"t\"" diff --git a/fvtest/compilertriltest/JitTest.hpp b/fvtest/compilertriltest/JitTest.hpp index 9ac78f95182..97dfbef6b6a 100644 --- a/fvtest/compilertriltest/JitTest.hpp +++ b/fvtest/compilertriltest/JitTest.hpp @@ -31,6 +31,7 @@ #include "optimizer/Optimizer.hpp" #include "ilgen/MethodBuilder.hpp" #include "omrport.h" +#include "format.hpp" #include "Jit.hpp" #define ASSERT_NULL(pointer) ASSERT_EQ(NULL, (pointer)) diff --git a/fvtest/compilertriltest/LinkageTest.cpp b/fvtest/compilertriltest/LinkageTest.cpp index 8e982b183a5..c552304b4cd 100644 --- a/fvtest/compilertriltest/LinkageTest.cpp +++ b/fvtest/compilertriltest/LinkageTest.cpp @@ -21,6 +21,7 @@ #include "JitTest.hpp" #include "default_compiler.hpp" +#include "format.hpp" /* Template for mapping a C/C++ type to * a TR type, and type prefix. @@ -91,14 +92,14 @@ TYPED_TEST(LinkageTest, InvalidLinkageTest) { SKIP_ON_AARCH64(MissingImplementation) << "Test is skipped on AArch64 because calls are not currently supported (see issue #1645)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" " (icall address=0x%jX args=[Int32] linkage=noexist" " (iload parm=0) ) ) ) )", - reinterpret_cast(static_cast(return1stArgument)) // address + static_cast(return1stArgument) // address ); auto trees = parseString(inputTrees); @@ -120,7 +121,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing1Arg) { SKIP_ON_AARCH64(MissingImplementation) << "Test is skipped on AArch64 because calls are not currently supported (see issue #1645)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s]" " (block" " (%sreturn" @@ -131,7 +132,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing1Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return1stArgument)), // address + static_cast(return1stArgument), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -165,7 +166,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing2Arg) { SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s]" " (block" " (%sreturn" @@ -178,7 +179,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing2Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return2ndArgument)), // address + static_cast(return2ndArgument), // address TypeToString::type, // args TypeToString::type, // args TypeToString::prefix, // load @@ -214,7 +215,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing3Arg) { SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s]" " (block" " (%sreturn" @@ -229,7 +230,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing3Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return3rdArgument)), // address + static_cast(return3rdArgument), // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -267,7 +268,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing4Arg) { SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s]" " (block" " (%sreturn" @@ -284,7 +285,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing4Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return4thArgument)), // address + static_cast(return4thArgument), // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -324,7 +325,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing5Arg) { SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -343,7 +344,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing5Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return5thArgument)), // address + static_cast(return5thArgument), // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -385,7 +386,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing6Arg) { SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -406,7 +407,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing6Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return6thArgument)), // address + static_cast(return6thArgument), // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -450,7 +451,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing7Arg) { SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -473,7 +474,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing7Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return7thArgument)), // address + static_cast(return7thArgument), // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -519,7 +520,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing8Arg) { SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -544,7 +545,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing8Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return8thArgument)), // address + static_cast(return8thArgument), // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -592,7 +593,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing9Arg) { SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -619,7 +620,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToNativeParameterPassing9Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return9thArgument)), // address + static_cast(return9thArgument), // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -699,7 +700,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing2A SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,%s]" " (block" " (%sreturn" @@ -711,7 +712,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing2A TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return2ndArgumentFromMixedTypes)), // address + static_cast(return2ndArgumentFromMixedTypes), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -745,7 +746,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing3A SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,%s]" " (block" " (%sreturn" @@ -758,7 +759,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing3A TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return3rdArgumentFromMixedTypes)), // address + static_cast(return3rdArgumentFromMixedTypes), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -792,7 +793,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing4A SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int64,Float,%s]" " (block" " (%sreturn" @@ -806,7 +807,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing4A TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return4thArgumentFromMixedTypes)), // address + static_cast(return4thArgumentFromMixedTypes), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -840,7 +841,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing5A SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Float,Int32,Float,Int64,%s]" " (block" " (%sreturn" @@ -855,7 +856,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing5A TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return5thArgumentFromMixedTypes)), // address + static_cast(return5thArgumentFromMixedTypes), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -889,7 +890,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing6A SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Float,Int32,Double,Int32,Int64,%s]" " (block" " (%sreturn" @@ -905,7 +906,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing6A TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return6thArgumentFromMixedTypes)), // address + static_cast(return6thArgumentFromMixedTypes), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -939,7 +940,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing7A SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,Double,Int32,Int32,Int64,%s]" " (block" " (%sreturn" @@ -956,7 +957,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing7A TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return7thArgumentFromMixedTypes)), // address + static_cast(return7thArgumentFromMixedTypes), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -990,7 +991,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing8A SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Int64,Int64,Float,Double,Int32,Int64,Int32,%s]" " (block" " (%sreturn" @@ -1008,7 +1009,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing8A TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return8thArgumentFromMixedTypes)), // address + static_cast(return8thArgumentFromMixedTypes), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -1042,7 +1043,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing9A SKIP_ON_WINDOWS(KnownBug) << "The x86_64 code generator crashes (see issue #5324)"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,Float,Int32,Int32,Float,Int64,Int32,%s]" " (block" " (%sreturn" @@ -1061,7 +1062,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing9A TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(static_cast(return9thArgumentFromMixedTypes)), // address + static_cast(return9thArgumentFromMixedTypes), // address TypeToString::type, // args TypeToString::prefix // load ); @@ -1085,7 +1086,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToNativeParameterPassing9A template T (*getJitCompiledMethodReturning1stArgument())(T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s]" " (block" " (%sreturn" @@ -1113,7 +1114,7 @@ T (*getJitCompiledMethodReturning1stArgument())(T) { template T (*getJitCompiledMethodReturning2ndArgument())(T, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s]" " (block" " (%sreturn" @@ -1142,7 +1143,7 @@ T (*getJitCompiledMethodReturning2ndArgument())(T, T) { template T (*getJitCompiledMethodReturning3rdArgument())(T, T, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s]" " (block" " (%sreturn" @@ -1172,7 +1173,7 @@ T (*getJitCompiledMethodReturning3rdArgument())(T, T, T) { template T (*getJitCompiledMethodReturning4thArgument())(T, T, T, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1203,7 +1204,7 @@ T (*getJitCompiledMethodReturning4thArgument())(T, T, T, T) { template T (*getJitCompiledMethodReturning5thArgument())(T, T, T, T, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1235,7 +1236,7 @@ T (*getJitCompiledMethodReturning5thArgument())(T, T, T, T, T) { template T (*getJitCompiledMethodReturning6thArgument())(T, T, T, T, T, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1268,7 +1269,7 @@ T (*getJitCompiledMethodReturning6thArgument())(T, T, T, T, T, T) { template T (*getJitCompiledMethodReturning7thArgument())(T, T, T, T, T, T, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1302,7 +1303,7 @@ T (*getJitCompiledMethodReturning7thArgument())(T, T, T, T, T, T, T) { template T (*getJitCompiledMethodReturning8thArgument())(T, T, T, T, T, T, T, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1337,7 +1338,7 @@ T (*getJitCompiledMethodReturning8thArgument())(T, T, T, T, T, T, T, T) { template T (*getJitCompiledMethodReturning9thArgument())(T, T, T, T, T, T, T, T, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1385,7 +1386,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing1Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s]" " (block" " (%sreturn" @@ -1396,7 +1397,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing1Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -1433,7 +1434,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing2Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s]" " (block" " (%sreturn" @@ -1446,7 +1447,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing2Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::type, // args TypeToString::prefix, // load @@ -1485,7 +1486,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing3Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s]" " (block" " (%sreturn" @@ -1500,7 +1501,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing3Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -1541,7 +1542,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing4Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1558,7 +1559,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing4Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -1601,7 +1602,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing5Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1620,7 +1621,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing5Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -1665,7 +1666,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing6Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1686,7 +1687,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing6Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -1733,7 +1734,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing7Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1756,7 +1757,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing7Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -1805,7 +1806,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing8Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1830,7 +1831,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing8Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -1881,7 +1882,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing9Arg) { ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s,%s,%s,%s,%s,%s,%s,%s,%s]" " (block" " (%sreturn" @@ -1908,7 +1909,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing9Arg) { TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::type, // args TypeToString::type, // args @@ -1948,7 +1949,7 @@ TYPED_TEST(LinkageTest, SystemLinkageJitToJitParameterPassing9Arg) { template T (*getJitCompiledMethodReturning2ndArgumentFromMixedTypes())(double, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,%s]" " (block" " (%sreturn" @@ -1976,7 +1977,7 @@ T (*getJitCompiledMethodReturning2ndArgumentFromMixedTypes())(double, T) { template T (*getJitCompiledMethodReturning3rdArgumentFromMixedTypes())(double, int32_t, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,%s]" " (block" " (%sreturn" @@ -2004,7 +2005,7 @@ T (*getJitCompiledMethodReturning3rdArgumentFromMixedTypes())(double, int32_t, T template T (*getJitCompiledMethodReturning4thArgumentFromMixedTypes())(double, int64_t, float, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int64,Float,%s]" " (block" " (%sreturn" @@ -2032,7 +2033,7 @@ T (*getJitCompiledMethodReturning4thArgumentFromMixedTypes())(double, int64_t, f template T (*getJitCompiledMethodReturning5thArgumentFromMixedTypes())(float, int32_t, float, int64_t, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Float,Int32,Float,Int64,%s]" " (block" " (%sreturn" @@ -2060,7 +2061,7 @@ T (*getJitCompiledMethodReturning5thArgumentFromMixedTypes())(float, int32_t, fl template T (*getJitCompiledMethodReturning6thArgumentFromMixedTypes())(float, int32_t, double, int32_t, int64_t, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Float,Int32,Double,Int32,Int64,%s]" " (block" " (%sreturn" @@ -2088,7 +2089,7 @@ T (*getJitCompiledMethodReturning6thArgumentFromMixedTypes())(float, int32_t, do template T (*getJitCompiledMethodReturning7thArgumentFromMixedTypes())(double, int32_t, double, int32_t, int32_t, int64_t, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,Double,Int32,Int32,Int64,%s]" " (block" " (%sreturn" @@ -2116,7 +2117,7 @@ T (*getJitCompiledMethodReturning7thArgumentFromMixedTypes())(double, int32_t, d template T (*getJitCompiledMethodReturning8thArgumentFromMixedTypes())(int64_t, int64_t, float, double, int32_t, int64_t, int32_t, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Int64,Int64,Float,Double,Int32,Int64,Int32,%s]" " (block" " (%sreturn" @@ -2144,7 +2145,7 @@ T (*getJitCompiledMethodReturning8thArgumentFromMixedTypes())(int64_t, int64_t, template T (*getJitCompiledMethodReturning9thArgumentFromMixedTypes())(double, int32_t, float, int32_t, int32_t, float, int64_t, int32_t, T) { char inputTrees[400] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,Float,Int32,Int32,Float,Int64,Int32,%s]" " (block" " (%sreturn" @@ -2185,7 +2186,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing2ArgW ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,%s]" " (block" " (%sreturn" @@ -2197,7 +2198,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing2ArgW TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -2234,7 +2235,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing3ArgW ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,%s]" " (block" " (%sreturn" @@ -2247,7 +2248,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing3ArgW TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -2284,7 +2285,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing4ArgW ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int64,Float,%s]" " (block" " (%sreturn" @@ -2298,7 +2299,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing4ArgW TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -2335,7 +2336,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing5ArgW ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Float,Int32,Float,Int64,%s]" " (block" " (%sreturn" @@ -2350,7 +2351,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing5ArgW TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -2387,7 +2388,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing6ArgW ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Float,Int32,Double,Int32,Int64,%s]" " (block" " (%sreturn" @@ -2403,7 +2404,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing6ArgW TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -2440,7 +2441,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing7ArgW ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,Double,Int32,Int32,Int64,%s]" " (block" " (%sreturn" @@ -2457,7 +2458,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing7ArgW TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -2494,7 +2495,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing8ArgW ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Int64,Int64,Float,Double,Int32,Int64,Int32,%s]" " (block" " (%sreturn" @@ -2512,7 +2513,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing8ArgW TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -2549,7 +2550,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing9ArgW ASSERT_NOTNULL(callee_entry_point) << "Compilation of the callee failed unexpectedly\n"; char inputTrees[600] = { 0 }; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[Double,Int32,Float,Int32,Int32,Float,Int64,Int32,%s]" " (block" " (%sreturn" @@ -2568,7 +2569,7 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing9ArgW TypeToString::type, // args TypeToString::prefix, // return TypeToString::prefix, //call - reinterpret_cast(callee_entry_point), // address + callee_entry_point, // address TypeToString::type, // args TypeToString::prefix // load ); @@ -2587,4 +2588,4 @@ TYPED_TEST(LinkageWithMixedTypesTest, SystemLinkageJitToJitParameterPassing9ArgW SCOPED_TRACE(*i); EXPECT_EQ(static_cast(*i), entry_point(0, 1, 2, 3, 4, 5, 6, 7, *i)) << "Input Trees: " << inputTrees; } -} \ No newline at end of file +} diff --git a/fvtest/compilertriltest/LogicalTest.cpp b/fvtest/compilertriltest/LogicalTest.cpp index 6a908fdf0f6..7ba8fcbbe08 100644 --- a/fvtest/compilertriltest/LogicalTest.cpp +++ b/fvtest/compilertriltest/LogicalTest.cpp @@ -97,7 +97,7 @@ TEST_P(Int16LogicalUnary, UsingConst) { } char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int16" " (block" " (ireturn" @@ -131,7 +131,7 @@ TEST_P(Int16LogicalUnary, UsingLoadParam) { } char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int16 args=[Int16]" " (block" " (ireturn" @@ -170,7 +170,7 @@ TEST_P(Int32LogicalUnary, UsingConst) { } char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, "(method return=Int32 (block (ireturn (%s (iconst %d) ) )))", param.opcode.c_str(), param.value); + Tril::format(inputTrees, 120, "(method return=Int32 (block (ireturn (%s (iconst %d) ) )))", param.opcode.c_str(), param.value); auto trees = parseString(inputTrees); ASSERT_NOTNULL(trees); @@ -194,7 +194,7 @@ TEST_P(Int32LogicalUnary, UsingLoadParam) { } char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, "(method return=Int32 args=[Int32] (block (ireturn (%s (iload parm=0) ) )))", param.opcode.c_str()); + Tril::format(inputTrees, 120, "(method return=Int32 args=[Int32] (block (ireturn (%s (iload parm=0) ) )))", param.opcode.c_str()); auto trees = parseString(inputTrees); @@ -222,7 +222,7 @@ TEST_P(Int32LogicalBinary, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, "(method return=Int32 (block (ireturn (%s (iconst %d) (iconst %d)) )))", param.opcode.c_str(), param.lhs, param.rhs); + Tril::format(inputTrees, 120, "(method return=Int32 (block (ireturn (%s (iconst %d) (iconst %d)) )))", param.opcode.c_str(), param.lhs, param.rhs); auto trees = parseString(inputTrees); ASSERT_NOTNULL(trees); @@ -241,7 +241,7 @@ TEST_P(Int32LogicalBinary, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, "(method return=Int32 args=[Int32, Int32] (block (ireturn (%s (iload parm=0) (iload parm=1)) )))", param.opcode.c_str()); + Tril::format(inputTrees, 120, "(method return=Int32 args=[Int32, Int32] (block (ireturn (%s (iload parm=0) (iload parm=1)) )))", param.opcode.c_str()); auto trees = parseString(inputTrees); @@ -269,7 +269,7 @@ TEST_P(Int64LogicalBinary, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64" " (block" " (lreturn" @@ -295,7 +295,7 @@ TEST_P(Int64LogicalBinary, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64 args=[Int64, Int64]" " (block" " (lreturn" @@ -336,7 +336,7 @@ TEST_P(Int64LogicalUnary, UsingConst) { } char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int64" " (block" " (lreturn" @@ -369,7 +369,7 @@ TEST_P(Int64LogicalUnary, UsingLoadParam) { } char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, + Tril::format(inputTrees, 120, "(method return=Int64 args=[Int64]" " (block" " (lreturn" diff --git a/fvtest/compilertriltest/LongAndAsRotateTest.cpp b/fvtest/compilertriltest/LongAndAsRotateTest.cpp index 5062afaf3e6..db9d9b492e7 100644 --- a/fvtest/compilertriltest/LongAndAsRotateTest.cpp +++ b/fvtest/compilertriltest/LongAndAsRotateTest.cpp @@ -113,7 +113,7 @@ TEST_P(i2lLongAndAsRotateTest, SimpleTest) auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32] " " (block " " (lreturn " @@ -148,7 +148,7 @@ TEST_P(i2lLongAndAsRotateTest, iConstTest) const int32_t constValue = 0x4321; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32] " " (block " " (lreturn " @@ -189,7 +189,7 @@ TEST_P(i2lLongAndAsRotateTest, GreaterThanOneRefCount1) const uint64_t constLongValue = 0xFFFFFFFFFFFF0000; char inputTrees[2048] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method name=\"AddAndLand\" return=Int64 args=[Int32]" " (block " " (lstore temp=\"x\" " @@ -239,7 +239,7 @@ TEST_P(i2lLongAndAsRotateTest, GreaterThanOneRefCount2) const int32_t constValue2 = 0x1234; char inputTrees[2048] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method name=\"AddAndLand\" return=Int64 args=[Int32]" " (block " " (lstore temp=\"x\" " @@ -296,7 +296,7 @@ TEST_P(iu2lLongAndAsRotateTest, SimpleTest) auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32] " " (block " " (lreturn " @@ -333,7 +333,7 @@ TEST_P(iu2lLongAndAsRotateTest, iConstTest) const uint32_t constValue = 0x4321; char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32] " " (block " " (lreturn " @@ -375,7 +375,7 @@ TEST_P(iu2lLongAndAsRotateTest, GreaterThanOneRefCount1) const uint64_t constLongValue = 0xFFFFFFFFFFFF0000; char inputTrees[2048] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method name=\"AddAndLand\" return=Int64 args=[Int32]" " (block " " (lstore temp=\"x\" " @@ -426,7 +426,7 @@ TEST_P(iu2lLongAndAsRotateTest, GreaterThanOneRefCount2) const uint32_t constValue2 = 0x1234; char inputTrees[2048] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method name=\"AddAndLand\" return=Int64 args=[Int32]" " (block " " (lstore temp=\"x\" " diff --git a/fvtest/compilertriltest/MaxMinTest.cpp b/fvtest/compilertriltest/MaxMinTest.cpp index 16fa6275dfb..ac369056980 100644 --- a/fvtest/compilertriltest/MaxMinTest.cpp +++ b/fvtest/compilertriltest/MaxMinTest.cpp @@ -78,7 +78,7 @@ TEST_P(Int32MaxMin, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[150] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32" " (block" " (ireturn" @@ -105,7 +105,7 @@ TEST_P(Int32MaxMin, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[150] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32]" " (block" " (ireturn" @@ -139,7 +139,7 @@ TEST_P(Int64MaxMin, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[150] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64" " (block" " (lreturn" @@ -166,7 +166,7 @@ TEST_P(Int64MaxMin, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[150] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64, Int64]" " (block" " (lreturn" @@ -208,7 +208,7 @@ TEST_P(FloatMaxMin, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float" " (block" " (freturn" @@ -243,7 +243,7 @@ TEST_P(FloatMaxMin, UsingLoadParam) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Float, Float]" " (block" " (freturn" @@ -286,7 +286,7 @@ TEST_P(DoubleMaxMin, UsingConst) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Double" " (block" " (dreturn" @@ -322,7 +322,7 @@ TEST_P(DoubleMaxMin, UsingLoadParam) { } char inputTrees[1024] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Double args=[Double, Double]" " (block" " (dreturn" diff --git a/fvtest/compilertriltest/SelectTest.cpp b/fvtest/compilertriltest/SelectTest.cpp index cd640db1892..56fa516c03d 100644 --- a/fvtest/compilertriltest/SelectTest.cpp +++ b/fvtest/compilertriltest/SelectTest.cpp @@ -184,7 +184,7 @@ TEST_P(Int8SelectTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int32, Int8, Int8]" " (block" " (ireturn" @@ -212,7 +212,7 @@ TEST_P(Int8SelectTest, UsingConstSelector) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8, Int8]" " (block" " (ireturn" @@ -241,7 +241,7 @@ TEST_P(Int8SelectTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int32]" " (block" " (ireturn" @@ -278,7 +278,7 @@ TEST_P(Int16SelectTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int32, Int16, Int16]" " (block" " (ireturn" @@ -306,7 +306,7 @@ TEST_P(Int16SelectTest, UsingConstSelector) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16, Int16]" " (block" " (ireturn" @@ -335,7 +335,7 @@ TEST_P(Int16SelectTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int32]" " (block" " (ireturn" @@ -370,7 +370,7 @@ TEST_P(Int32SelectTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32, Int32]" " (block" " (ireturn" @@ -395,7 +395,7 @@ TEST_P(Int32SelectTest, UsingConstSelector) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32]" " (block" " (ireturn" @@ -421,7 +421,7 @@ TEST_P(Int32SelectTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -455,7 +455,7 @@ TEST_P(Int64SelectTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32, Int64, Int64]" " (block" " (lreturn" @@ -480,7 +480,7 @@ TEST_P(Int64SelectTest, UsingConstSelector) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64, Int64]" " (block" " (lreturn" @@ -506,7 +506,7 @@ TEST_P(Int64SelectTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32]" " (block" " (lreturn" @@ -544,7 +544,7 @@ TEST_P(FloatSelectTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Int32, Float, Float]" " (block" " (freturn" @@ -573,7 +573,7 @@ TEST_P(FloatSelectTest, UsingConstSelector) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Float, Float]" " (block" " (freturn" @@ -603,7 +603,7 @@ TEST_P(FloatSelectTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Int32]" " (block" " (freturn" @@ -641,7 +641,7 @@ TEST_P(DoubleSelectTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Double args=[Int32, Double, Double]" " (block" " (dreturn" @@ -670,7 +670,7 @@ TEST_P(DoubleSelectTest, UsingConstSelector) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Double args=[Double, Double]" " (block" " (dreturn" @@ -700,7 +700,7 @@ TEST_P(DoubleSelectTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Double args=[Int32]" " (block" " (dreturn" @@ -736,7 +736,7 @@ TEST_P(Int8SelectInt32CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int32, Int32, Int8, Int8]" " (block" " (ireturn" @@ -767,7 +767,7 @@ TEST_P(Int8SelectInt32CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int32, Int8, Int8]" " (block" " (ireturn" @@ -799,7 +799,7 @@ TEST_P(Int8SelectInt32CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int32, Int32]" " (block" " (ireturn" @@ -840,7 +840,7 @@ TEST_P(Int16SelectInt32CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int32, Int32, Int16, Int16]" " (block" " (ireturn" @@ -871,7 +871,7 @@ TEST_P(Int16SelectInt32CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int32, Int16, Int16]" " (block" " (ireturn" @@ -903,7 +903,7 @@ TEST_P(Int16SelectInt32CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int32, Int32]" " (block" " (ireturn" @@ -944,7 +944,7 @@ TEST_P(Int32SelectInt32CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32, Int32, Int32]" " (block" " (ireturn" @@ -974,7 +974,7 @@ TEST_P(Int32SelectInt32CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32, Int32]" " (block" " (ireturn" @@ -1005,7 +1005,7 @@ TEST_P(Int32SelectInt32CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32]" " (block" " (ireturn" @@ -1045,7 +1045,7 @@ TEST_P(Int64SelectInt32CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32, Int32, Int64, Int64]" " (block" " (lreturn" @@ -1075,7 +1075,7 @@ TEST_P(Int64SelectInt32CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32, Int64, Int64]" " (block" " (lreturn" @@ -1106,7 +1106,7 @@ TEST_P(Int64SelectInt32CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32, Int32]" " (block" " (lreturn" @@ -1148,7 +1148,7 @@ TEST_P(FloatSelectInt32CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Int32, Int32, Float, Float]" " (block" " (freturn" @@ -1180,7 +1180,7 @@ TEST_P(FloatSelectInt32CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Int32, Float, Float]" " (block" " (freturn" @@ -1213,7 +1213,7 @@ TEST_P(FloatSelectInt32CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Float args=[Int32, Int32]" " (block" " (freturn" @@ -1255,7 +1255,7 @@ TEST_P(DoubleSelectInt32CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Double args=[Int32, Int32, Double, Double]" " (block" " (dreturn" @@ -1287,7 +1287,7 @@ TEST_P(DoubleSelectInt32CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Double args=[Int32, Double, Double]" " (block" " (dreturn" @@ -1320,7 +1320,7 @@ TEST_P(DoubleSelectInt32CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Double args=[Int32, Int32]" " (block" " (dreturn" @@ -1365,7 +1365,7 @@ TEST_P(Int32SelectInt8CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int8, Int8, Int32, Int32]" " (block" " (ireturn" @@ -1400,7 +1400,7 @@ TEST_P(Int32SelectInt8CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int8, Int32, Int32]" " (block" " (ireturn" @@ -1436,7 +1436,7 @@ TEST_P(Int32SelectInt8CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int8, Int8]" " (block" " (ireturn" @@ -1481,7 +1481,7 @@ TEST_P(Int32SelectInt16CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int16, Int16, Int32, Int32]" " (block" " (ireturn" @@ -1516,7 +1516,7 @@ TEST_P(Int32SelectInt16CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int16, Int32, Int32]" " (block" " (ireturn" @@ -1552,7 +1552,7 @@ TEST_P(Int32SelectInt16CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int16, Int16]" " (block" " (ireturn" @@ -1592,7 +1592,7 @@ TEST_P(Int32SelectInt64CompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int64, Int64, Int32, Int32]" " (block" " (ireturn" @@ -1622,7 +1622,7 @@ TEST_P(Int32SelectInt64CompareTest, UsingConstCompare) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int64, Int32, Int32]" " (block" " (ireturn" @@ -1653,7 +1653,7 @@ TEST_P(Int32SelectInt64CompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int64, Int64]" " (block" " (ireturn" @@ -1693,7 +1693,7 @@ TEST_P(Int32SelectFloatCompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Float, Float, Int32, Int32]" " (block" " (ireturn" @@ -1728,7 +1728,7 @@ TEST_P(Int32SelectFloatCompareTest, UsingConstCompare) { } char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Float, Int32, Int32]" " (block" " (ireturn" @@ -1759,7 +1759,7 @@ TEST_P(Int32SelectFloatCompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Float, Float]" " (block" " (ireturn" @@ -1799,7 +1799,7 @@ TEST_P(Int32SelectDoubleCompareTest, UsingLoadParam) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Double, Double, Int32, Int32]" " (block" " (ireturn" @@ -1834,7 +1834,7 @@ TEST_P(Int32SelectDoubleCompareTest, UsingConstCompare) { } char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Double, Int32, Int32]" " (block" " (ireturn" @@ -1865,7 +1865,7 @@ TEST_P(Int32SelectDoubleCompareTest, UsingConstValues) { auto param = to_struct(GetParam()); char inputTrees[512] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Double, Double]" " (block" " (ireturn" diff --git a/fvtest/compilertriltest/ShiftAndRotateTest.cpp b/fvtest/compilertriltest/ShiftAndRotateTest.cpp index eb36d2fbe24..13c030dbae7 100644 --- a/fvtest/compilertriltest/ShiftAndRotateTest.cpp +++ b/fvtest/compilertriltest/ShiftAndRotateTest.cpp @@ -91,7 +91,7 @@ TEST_P(Int32ShiftAndRotate, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[120] = {0}; - std::snprintf(inputTrees, 120, "(method return=Int32 (block (ireturn (%s (iconst %d) (iconst %d)))))", param.opcode.c_str(), param.lhs, param.rhs); + Tril::format(inputTrees, 120, "(method return=Int32 (block (ireturn (%s (iconst %d) (iconst %d)))))", param.opcode.c_str(), param.lhs, param.rhs); auto trees = parseString(inputTrees); ASSERT_NOTNULL(trees); @@ -108,7 +108,7 @@ TEST_P(Int32ShiftAndRotate, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -133,7 +133,7 @@ TEST_P(Int32ShiftAndRotate, UsingLhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -158,7 +158,7 @@ TEST_P(Int32ShiftAndRotate, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32]" " (block" " (ireturn" @@ -191,7 +191,7 @@ TEST_P(Int64ShiftAndRotate, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64" " (block" " (lreturn" @@ -217,7 +217,7 @@ TEST_P(Int64ShiftAndRotate, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64]" " (block" " (lreturn" @@ -242,7 +242,7 @@ TEST_P(Int64ShiftAndRotate, UsingLhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32]" " (block" " (lreturn" @@ -267,7 +267,7 @@ TEST_P(Int64ShiftAndRotate, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64, Int32]" " (block" " (lreturn" @@ -300,7 +300,7 @@ TEST_P(Int8ShiftAndRotate, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8" " (block" " (ireturn" @@ -327,7 +327,7 @@ TEST_P(Int8ShiftAndRotate, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8]" " (block" " (ireturn" @@ -353,7 +353,7 @@ TEST_P(Int8ShiftAndRotate, UsingLhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int32]" " (block" " (ireturn" @@ -379,7 +379,7 @@ TEST_P(Int8ShiftAndRotate, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8, Int32]" " (block" " (ireturn" @@ -412,7 +412,7 @@ TEST_P(Int16ShiftAndRotate, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16" " (block" " (ireturn" @@ -439,7 +439,7 @@ TEST_P(Int16ShiftAndRotate, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16]" " (block" " (ireturn" @@ -465,7 +465,7 @@ TEST_P(Int16ShiftAndRotate, UsingLhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int32]" " (block" " (ireturn" @@ -491,7 +491,7 @@ TEST_P(Int16ShiftAndRotate, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16, Int32]" " (block" " (ireturn" @@ -524,7 +524,7 @@ TEST_P(UInt32ShiftAndRotate, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32" " (block" " (ireturn" @@ -550,7 +550,7 @@ TEST_P(UInt32ShiftAndRotate, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -575,7 +575,7 @@ TEST_P(UInt32ShiftAndRotate, UsingLhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -600,7 +600,7 @@ TEST_P(UInt32ShiftAndRotate, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32, Int32]" " (block" " (ireturn" @@ -631,7 +631,7 @@ TEST_P(UInt64ShiftAndRotate, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64" " (block" " (lreturn" @@ -657,7 +657,7 @@ TEST_P(UInt64ShiftAndRotate, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64]" " (block" " (lreturn" @@ -682,7 +682,7 @@ TEST_P(UInt64ShiftAndRotate, UsingLhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int32]" " (block" " (lreturn" @@ -707,7 +707,7 @@ TEST_P(UInt64ShiftAndRotate, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64, Int32]" " (block" " (lreturn" @@ -738,7 +738,7 @@ TEST_P(UInt8ShiftAndRotate, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8" " (block" " (ireturn" @@ -765,7 +765,7 @@ TEST_P(UInt8ShiftAndRotate, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8]" " (block" " (ireturn" @@ -791,7 +791,7 @@ TEST_P(UInt8ShiftAndRotate, UsingLhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int32]" " (block" " (ireturn" @@ -817,7 +817,7 @@ TEST_P(UInt8ShiftAndRotate, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8, Int32]" " (block" " (ireturn" @@ -849,7 +849,7 @@ TEST_P(UInt16ShiftAndRotate, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16" " (block" " (ireturn" @@ -876,7 +876,7 @@ TEST_P(UInt16ShiftAndRotate, UsingRhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16]" " (block" " (ireturn" @@ -902,7 +902,7 @@ TEST_P(UInt16ShiftAndRotate, UsingLhsConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int32]" " (block" " (ireturn" @@ -928,7 +928,7 @@ TEST_P(UInt16ShiftAndRotate, UsingLoadParam) { auto param = TRTest::to_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16, Int32]" " (block" " (ireturn" @@ -1131,7 +1131,7 @@ TEST_P(UInt64MaskThenShift, UsingLoadParam) { auto param = to_mask_then_shift_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64]" " (block" " (lreturn" @@ -1166,7 +1166,7 @@ TEST_P(Int64MaskThenShift, UsingLoadParam) { auto param = to_mask_then_shift_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64]" " (block" " (lreturn" @@ -1203,7 +1203,7 @@ TEST_P(UInt32MaskThenShift, UsingLoadParam) { auto param = to_mask_then_shift_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -1238,7 +1238,7 @@ TEST_P(Int32MaskThenShift, UsingLoadParam) { auto param = to_mask_then_shift_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -1273,7 +1273,7 @@ TEST_P(UInt16MaskThenShift, UsingLoadParam) { auto param = to_mask_then_shift_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16]" " (block" " (ireturn" @@ -1309,7 +1309,7 @@ TEST_P(Int16MaskThenShift, UsingLoadParam) { auto param = to_mask_then_shift_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int16 args=[Int16]" " (block" " (ireturn" @@ -1345,7 +1345,7 @@ TEST_P(UInt8MaskThenShift, UsingLoadParam) { auto param = to_mask_then_shift_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8]" " (block" " (ireturn" @@ -1381,7 +1381,7 @@ TEST_P(Int8MaskThenShift, UsingLoadParam) { auto param = to_mask_then_shift_struct(GetParam()); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int8 args=[Int8]" " (block" " (ireturn" diff --git a/fvtest/compilertriltest/SimplifierFoldAbsNegTest.cpp b/fvtest/compilertriltest/SimplifierFoldAbsNegTest.cpp index 37f49f8238e..e2d3eb79150 100644 --- a/fvtest/compilertriltest/SimplifierFoldAbsNegTest.cpp +++ b/fvtest/compilertriltest/SimplifierFoldAbsNegTest.cpp @@ -128,7 +128,7 @@ class NoAbsAbsIlVerifier : public SimplifierFoldAbsNegTestIlVerifierBase */ TYPED_TEST(SimplifierFoldAbsNegTest, FoldAbsAbs) { char inputTrees[256]; - std::snprintf(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s] " + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s] " " (block " " (%sreturn " " (%sabs " @@ -171,7 +171,7 @@ class NoAbsNegIlVerifier : public SimplifierFoldAbsNegTestIlVerifierBase */ TYPED_TEST(SimplifierFoldAbsNegTest, FoldAbsNeg) { char inputTrees[256]; - std::snprintf(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s] " + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s] " " (block " " (%sreturn " " (%sabs " @@ -214,7 +214,7 @@ class NoNegNegIlVerifier : public SimplifierFoldAbsNegTestIlVerifierBase */ TYPED_TEST(SimplifierFoldAbsNegTest, FoldNegNeg) { char inputTrees[256]; - std::snprintf(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s] " + Tril::format(inputTrees, sizeof(inputTrees), "(method return=%s args=[%s] " " (block " " (%sreturn " " (%sneg " diff --git a/fvtest/compilertriltest/TypeConversionTest.cpp b/fvtest/compilertriltest/TypeConversionTest.cpp index 70e3f2f2500..001ef6af902 100644 --- a/fvtest/compilertriltest/TypeConversionTest.cpp +++ b/fvtest/compilertriltest/TypeConversionTest.cpp @@ -79,7 +79,7 @@ TEST_P(Int8ToInt32, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32" " (block" " (ireturn" @@ -136,7 +136,7 @@ TEST_P(UInt8ToInt32, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32" " (block" " (ireturn" @@ -193,7 +193,7 @@ TEST_P(Int8ToInt64, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64" " (block" " (lreturn" @@ -250,7 +250,7 @@ TEST_P(UInt8ToInt64, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64" " (block" " (lreturn" @@ -307,7 +307,7 @@ TEST_P(Int16ToInt32, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32" " (block" " (ireturn" @@ -364,7 +364,7 @@ TEST_P(UInt16ToInt32, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32" " (block" " (ireturn" @@ -421,7 +421,7 @@ TEST_P(Int16ToInt64, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64" " (block" " (lreturn" @@ -478,7 +478,7 @@ TEST_P(UInt16ToInt64, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64" " (block" " (lreturn" @@ -535,7 +535,7 @@ TEST_P(Int32ToInt64, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64" " (block" " (lreturn" @@ -591,7 +591,7 @@ TEST_P(UInt32ToInt64, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64" " (block" " (lreturn" @@ -653,7 +653,7 @@ TEST_P(Int64ToInt32, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32" " (block" " (ireturn" @@ -726,7 +726,7 @@ TEST_P(Int32ToFloat, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Float" " (block" " (freturn" @@ -782,7 +782,7 @@ TEST_P(Int64ToFloat, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Float" " (block" " (freturn" @@ -838,7 +838,7 @@ TEST_P(Int32ToDouble, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Double" " (block" " (dreturn" @@ -894,7 +894,7 @@ TEST_P(Int64ToDouble, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Double" " (block" " (dreturn" @@ -990,7 +990,7 @@ TEST_P(FloatToInt32, UsingConst) { } char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int32" " (block" " (ireturn" @@ -1057,7 +1057,7 @@ TEST_P(FloatToInt64, UsingConst) { } char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Int64" " (block" " (lreturn" @@ -1119,7 +1119,7 @@ TEST_P(DoubleToInt32, UsingConst) { } char inputTrees[512] = {0}; - std::snprintf(inputTrees, 512, + Tril::format(inputTrees, 512, "(method return=Int32" " (block" " (ireturn" @@ -1181,7 +1181,7 @@ TEST_P(DoubleToInt64, UsingConst) { } char inputTrees[512] = {0}; - std::snprintf(inputTrees, 512, + Tril::format(inputTrees, 512, "(method return=Int64" " (block" " (lreturn" @@ -1258,7 +1258,7 @@ TEST_P(FloatToDouble, UsingConst) { } char inputTrees[160] = {0}; - std::snprintf(inputTrees, 160, + Tril::format(inputTrees, 160, "(method return=Double" " (block" " (dreturn" @@ -1328,7 +1328,7 @@ TEST_P(DoubleToFloat, UsingConst) { } char inputTrees[512] = {0}; - std::snprintf(inputTrees, 512, + Tril::format(inputTrees, 512, "(method return=Float" " (block" " (freturn" @@ -1505,7 +1505,7 @@ TEST_P(FloatNormalizeNan, UsingLoadConst) { uint32_t value = GetParam(); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int32 args=[Int32]" " (block" " (ireturn" @@ -1588,7 +1588,7 @@ TEST_P(DoubleNormalizeNan, UsingLoadConst) { uint64_t value = GetParam(); char inputTrees[300] = {0}; - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=Int64 args=[Int64]" " (block" " (lreturn" @@ -1622,7 +1622,7 @@ TEST_P(Int32BitsToFloat, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Float" " (block" " (freturn" @@ -1693,7 +1693,7 @@ TEST_P(FloatBitsToInt32, UsingConst) { } char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Int32" " (block" " (ireturn" @@ -1755,7 +1755,7 @@ TEST_P(Int64BitsToDouble, UsingConst) { auto param = TRTest::to_struct(GetParam()); char inputTrees[256] = {0}; - std::snprintf(inputTrees, 256, + Tril::format(inputTrees, 256, "(method return=Double" " (block" " (dreturn" @@ -1830,7 +1830,7 @@ TEST_P(DoubleBitsToInt64, UsingConst) { } char inputTrees[512] = {0}; - std::snprintf(inputTrees, 512, + Tril::format(inputTrees, 512, "(method return=Int64" " (block" " (lreturn" diff --git a/fvtest/compilertriltest/VectorTest.cpp b/fvtest/compilertriltest/VectorTest.cpp index 59ac4e586e0..371b57765fc 100644 --- a/fvtest/compilertriltest/VectorTest.cpp +++ b/fvtest/compilertriltest/VectorTest.cpp @@ -140,7 +140,7 @@ void generateIO(TR::ILOpCode scalarOpcode, TR::VectorLength vl, void *output, vo char inputTrees[1024]; if (inputB) { - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=NoType args=[Address, Address, Address]" " (block" " (%s" @@ -155,7 +155,7 @@ void generateIO(TR::ILOpCode scalarOpcode, TR::VectorLength vl, void *output, vo loadOpcode.getName() ); } else { - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return=NoType args=[Address, Address]" " (block" " (%s" @@ -226,7 +226,7 @@ void generateAndExecuteVectorTest(TR::ILOpCode vectorOpcode, void *expected, voi std::snprintf(type, sizeof(type), "Vector%i%s", vectorSize(vl) * 8, TR::DataType::getName(elementType)); if (vectorOpcode.expectedChildCount() == 1) { - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return= NoType args=[Address,Address] " " (block " " (%s%s offset=0 " @@ -243,7 +243,7 @@ void generateAndExecuteVectorTest(TR::ILOpCode vectorOpcode, void *expected, voi type ); } else if (vectorOpcode.expectedChildCount() == 2) { - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return= NoType args=[Address,Address,Address] " " (block " " (%s%s offset=0 " @@ -263,7 +263,7 @@ void generateAndExecuteVectorTest(TR::ILOpCode vectorOpcode, void *expected, voi type ); } else if (vectorOpcode.expectedChildCount() == 3) { - std::snprintf(inputTrees, sizeof(inputTrees), + Tril::format(inputTrees, sizeof(inputTrees), "(method return= NoType args=[Address,Address,Address,Address] " " (block " " (%s%s offset=0 " diff --git a/fvtest/tril/test/CMakeLists.txt b/fvtest/tril/test/CMakeLists.txt index c42794da85a..9d1168b7d62 100644 --- a/fvtest/tril/test/CMakeLists.txt +++ b/fvtest/tril/test/CMakeLists.txt @@ -35,6 +35,7 @@ omr_add_executable(triltest NOWARNINGS MethodInfoTest.cpp IlGenTest.cpp CompileTest.cpp + FormatTest.cpp ) target_link_libraries(triltest diff --git a/fvtest/tril/test/FormatTest.cpp b/fvtest/tril/test/FormatTest.cpp new file mode 100644 index 00000000000..ffa76cc5570 --- /dev/null +++ b/fvtest/tril/test/FormatTest.cpp @@ -0,0 +1,232 @@ +/******************************************************************************* + * Copyright (c) 2020, 2020 IBM Corp. and others + * + * This program and the accompanying materials are made available under + * the terms of the Eclipse Public License 2.0 which accompanies this + * distribution and is available at http://eclipse.org/legal/epl-2.0 + * or the Apache License, Version 2.0 which accompanies this distribution + * and is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception [1] and GNU General Public + * License, version 2 with the OpenJDK Assembly Exception [2]. + * + * [1] https://www.gnu.org/software/classpath/license.html + * [2] http://openjdk.java.net/legal/assembly-exception.html + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception + *******************************************************************************/ + +#include +#include "gtest/gtest.h" +#include "format.hpp" + +#define ASSERT_ERROR(expr) ASSERT_THROW({ expr; }, std::runtime_error) + +TEST(FormatTest, FormatString) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), ">>%s<<", "nejaky retezec"); + ASSERT_STREQ(buffer, ">>nejaky retezec<<"); +} + +TEST(FormatTest, FormatStringBad) { + char buffer[1024] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%s<<", (int)123)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%s<<", (unsigned)123)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%s<<", 1.3)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%s<<", &buffer)); +} + + + +TEST(FormatTest, FormatInt) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), ">>%d<<", (int8_t)42); + ASSERT_STREQ(buffer, ">>42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%d<<", (int16_t)-42); + ASSERT_STREQ(buffer, ">>-42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%d<<", (int32_t)42); + ASSERT_STREQ(buffer, ">>42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%d<<", (int64_t)-42); + ASSERT_STREQ(buffer, ">>-42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%d<<", (uint8_t)255); + ASSERT_STREQ(buffer, ">>-1<<"); + + Tril::format(buffer, sizeof(buffer), ">>%d<<", (uint16_t)0xFFFE); + ASSERT_STREQ(buffer, ">>-2<<"); + + Tril::format(buffer, sizeof(buffer), ">>%d<<", (uint32_t)0xFFFFFFFD); + ASSERT_STREQ(buffer, ">>-3<<"); + + Tril::format(buffer, sizeof(buffer), ">>%d<<", (uint64_t)0xFFFFFFFFFFFFFFFC); + ASSERT_STREQ(buffer, ">>-4<<"); +} + +TEST(FormatTest, FormatIntWithPrefix) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), ">>%hhd<<", (int8_t)42); + ASSERT_STREQ(buffer, ">>42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%hd<<", (int16_t)-42); + ASSERT_STREQ(buffer, ">>-42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%ld<<", (int32_t)42); + ASSERT_STREQ(buffer, ">>42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%lld<<", (int64_t)-42); + ASSERT_STREQ(buffer, ">>-42<<"); + +} + +TEST(FormatTest, FormatIntBad) { + char buffer[1024] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%d<<", "nejaky retezec")); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%d<<", 1.3)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%d<<", &buffer)); +} + +TEST(FormatTest, FormatUInt) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), ">>%u<<", (uint8_t)42); + ASSERT_STREQ(buffer, ">>42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%u<<", (uint16_t)42); + ASSERT_STREQ(buffer, ">>42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%u<<", (uint32_t)42); + ASSERT_STREQ(buffer, ">>42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%u<<", (uint64_t)42); + ASSERT_STREQ(buffer, ">>42<<"); + + Tril::format(buffer, sizeof(buffer), ">>%u<<", (uint32_t)2147483646); + ASSERT_STREQ(buffer, ">>2147483646<<"); + + +} + +TEST(FormatTest, FormatUIntBad) { + char buffer[1024] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%u<<", "nejaky retezec")); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%u<<", (int)123)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%u<<", 1.3)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%u<<", &buffer)); +} + +TEST(FormatTest, FormatFloatingPoint) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), ">>%f<<", (float)1.2); + ASSERT_STREQ(buffer, ">>1.200000<<"); + + Tril::format(buffer, sizeof(buffer), ">>%f<<", (double)1.2); + ASSERT_STREQ(buffer, ">>1.200000<<"); + +} + +TEST(FormatTest, FormatFloatingPointBad) { + char buffer[1024] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%f<<", "nejaky retezec")); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%f<<", (int)123)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%f<<", (unsigned)123)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%f<<", &buffer)); +} + +TEST(FormatTest, FormatPtr) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), ">>%X<<", (void*)0xCAFE); + ASSERT_STREQ(buffer, ">>CAFE<<"); +} + +TEST(FormatTest, FormatPtrBad) { + char buffer[1024] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%X<<", (int)123)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%X<<", 1.3)); +} + +TEST(FormatTest, FormatBad) { + char buffer[1024] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), ">>%b<<", (int)123)); +} + +TEST(FormatTest, Percent) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), "%d%%", (int8_t)100); + ASSERT_STREQ(buffer, "100%"); + + Tril::format(buffer, sizeof(buffer), "%% (percent)"); + ASSERT_STREQ(buffer, "% (percent)"); +} + +TEST(FormatTest, Multiple) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), "None"); + ASSERT_STREQ(buffer, "None"); + + Tril::format(buffer, sizeof(buffer), "%d, %d", 1, 2); + ASSERT_STREQ(buffer, "1, 2"); + + Tril::format(buffer, sizeof(buffer), "%d, %d, %d", 1, 2, 3); + ASSERT_STREQ(buffer, "1, 2, 3"); +} + +TEST(FormatTest, NotEnough) { + char buffer[1024] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), "%d")); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), "%d, %d", 1)); +} + +TEST(FormatTest, TooMany) { + char buffer[1024] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), "None", 1)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), "%d, %d", 1, 2, 3)); +} + +TEST(FormatTest, BufferTooSmall) { + char buffer[2] = { '\0' }; + + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), "None")); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), "%d", 12)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), "%d", 1234)); + ASSERT_ERROR(Tril::format(buffer, sizeof(buffer), "%d%d", 123, 456)); +} + +TEST(FormatTest, IgnorePrefixes) { + char buffer[1024] = { '\0' }; + + Tril::format(buffer, sizeof(buffer), "%ld", 1); + ASSERT_STREQ(buffer, "1"); + + Tril::format(buffer, sizeof(buffer), "%lld", 1); + ASSERT_STREQ(buffer, "1"); + + Tril::format(buffer, sizeof(buffer), "%hd", 1); + ASSERT_STREQ(buffer, "1"); + + Tril::format(buffer, sizeof(buffer), "%hhd", 1); + ASSERT_STREQ(buffer, "1"); + + Tril::format(buffer, sizeof(buffer), "%jX", (char*)1); + ASSERT_STREQ(buffer, "1"); +} diff --git a/fvtest/tril/tril/format.hpp b/fvtest/tril/tril/format.hpp new file mode 100644 index 00000000000..8b9f0979af1 --- /dev/null +++ b/fvtest/tril/tril/format.hpp @@ -0,0 +1,503 @@ +/******************************************************************************* + * Copyright (c) 2020, 2020 IBM Corp. and others + * + * This program and the accompanying materials are made available under + * the terms of the Eclipse Public License 2.0 which accompanies this + * distribution and is available at http://eclipse.org/legal/epl-2.0 + * or the Apache License, Version 2.0 which accompanies this distribution + * and is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception [1] and GNU General Public + * License, version 2 with the OpenJDK Assembly Exception [2]. + * + * [1] https://www.gnu.org/software/classpath/license.html + * [2] http://openjdk.java.net/legal/assembly-exception.html + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception + *******************************************************************************/ + +#ifndef FORMAT_HPP +#define FORMAT_HPP + +#include +#include +#include + +#include "omrformatconsts.h" + +namespace Tril +{ + +/* + * Following is poor man's version of std::make_signed which is used below + * in reinterpret_as_signed(). We cannot use std::make_signed() as the XLC + * compiler used at a time on AIX and ZOS does not support it. Once XLC start + * supporting it, the below make_signed can be removed in favour of + * std::make_signed. + */ +template +struct make_signed; + +template<> +struct make_signed + { + typedef signed char type; + }; + +template<> +struct make_signed + { + typedef signed char type; + }; + +template<> +struct make_signed + { + typedef signed short type; + }; + +template<> +struct make_signed + { + typedef signed short type; + }; + +template<> +struct make_signed + { + typedef signed int type; + }; + +template<> +struct make_signed + { + typedef signed int type; + }; + +template<> +struct make_signed + { + typedef signed long int type; + }; + +template<> +struct make_signed + { + typedef signed long int type; + }; + +template<> +struct make_signed + { + typedef signed long long int type; + }; + +template<> +struct make_signed + { + typedef signed long long int type; + }; + +/* + * Poor man's version of std::is_same - see comment above. + */ +template +struct is_same + { + static const bool value = false; + }; +template +struct is_same + { + static const bool value = true; + }; +/* + * Poor man's version of std::is_integral - see comment above. + */ +template +struct is_integral + { + static const bool value = false; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +template<> +struct is_integral + { + static const bool value = true; + }; + +/* + * Poor man's version of std::is_unsigned - see comment above. + */ +template +struct is_unsigned + { + static const bool value = false; + }; + +template<> +struct is_unsigned + { + static const bool value = true; + }; + +template<> +struct is_unsigned + { + static const bool value = true; + }; + +template<> +struct is_unsigned + { + static const bool value = true; + }; + +template<> +struct is_unsigned + { + static const bool value = true; + }; + +template<> +struct is_unsigned + { + static const bool value = true; + }; + +/* + * Poor man's version of std::is_pointer - see comment above. + */ +template +struct is_pointer + { + static const bool value = false; + }; + +template +struct is_pointer + { + static const bool value = true; + }; + +template +struct is_pointer + { + static const bool value = true; + }; + +/* + * Poor man's version of std::is_floating_point - see comment above. + */ +template +struct is_floating_point + { + static const bool value = false; + }; + +template<> +struct is_floating_point + { + static const bool value = true; + }; + +template<> +struct is_floating_point + { + static const bool value = true; + }; + +template<> +struct is_floating_point + { + static const bool value = true; + }; + +template +inline Out reinterpret_as(const In value) + { + static_assert(sizeof(In) == sizeof(Out), "Both types must be of the same size"); + union { + In in; + Out out; + } u; + u.in = value; + return u.out; + } + + +template +inline typename Tril::make_signed::type reinterpret_as_signed(const U value) + { + typedef typename Tril::make_signed::type S; + return reinterpret_as(value); + } + +template +inline int64_t reinterpret_as_signed_int64(const T value) + { + throw std::runtime_error("Invalid parameter type"); + } + +template <> +inline int64_t reinterpret_as_signed_int64(const int8_t value) + { + return static_cast(reinterpret_as_signed(value)); + } + +template <> +inline int64_t reinterpret_as_signed_int64(const int16_t value) + { + return static_cast(reinterpret_as_signed(value)); + } + +template <> +inline int64_t reinterpret_as_signed_int64(const int32_t value) + { + return static_cast(reinterpret_as_signed(value)); + } + +template <> +inline int64_t reinterpret_as_signed_int64(const int64_t value) + { + return static_cast(reinterpret_as_signed(value)); + } + +template <> +inline int64_t reinterpret_as_signed_int64(const uint8_t value) + { + return static_cast(reinterpret_as_signed(value)); + } + +template <> +inline int64_t reinterpret_as_signed_int64(const uint16_t value) + { + return static_cast(reinterpret_as_signed(value)); + } + +template <> +inline int64_t reinterpret_as_signed_int64(const uint32_t value) + { + return static_cast(reinterpret_as_signed(value)); + } + +template <> +inline int64_t reinterpret_as_signed_int64(const uint64_t value) + { + return static_cast(reinterpret_as_signed(value)); + } + +inline void format(char* dst, size_t size, const char *fmt) + { + auto rem = size; + for ( ; *fmt != '\0'; fmt++ ) + { + if (*fmt == '%' && *++fmt != '%') + { + throw std::runtime_error("found conversion specifier but not enough value(s) given"); + } + else + { + *dst = *fmt; + dst++; + rem--; + } + + if (rem == 0) + { + throw std::runtime_error("buffer too small"); + } + + } + *dst = '\0'; + } + +template +inline void format(char* dst, size_t size, const char *fmt, V value, Rest... rest) + { + for ( ; *fmt != '\0'; fmt++ ) + { + if (*fmt == '%') + { + fmt++; + if (*fmt == '%') + { + *dst = '%'; + dst++; + size--; + } + else + { + /* + * Ignore l, ll, h, hh, j, I, I32 and I64 prefixes + */ + if (*fmt == 'l') + { + fmt++; + if (*fmt == 'l') + fmt++; + } + else if (*fmt == 'h') + { + fmt++; + if (*fmt == 'h') + fmt++; + } + else if (*fmt == 'j') + fmt++; + else if (*fmt == 'I') + { + fmt++; + if ( (*(fmt+0) == '3' && *(fmt+1) == '2') + || (*(fmt+0) == '6' && *(fmt+1) == '4') ) + fmt+=2; + } + + size_t consumed = 0; + switch (*fmt) { + case 's': + { + if (!(Tril::is_same::value || Tril::is_same::value)) + throw std::runtime_error("%s conversion specified but given value is not of a string type"); + + consumed = std::snprintf(dst, size, "%s", value); + } + break; + + case 'd': + { + if (! Tril::is_integral::value) + throw std::runtime_error("%d conversion specified but given value is not of an integral type"); + + /* + * TODO: If an unsigned type is to be formated using %d, interpret the bits as + * signed. This is to handle tests for unsigned ops that load data (typed in + * test param tuple as unsigned) using "(iconst %d)" which takes signed value. + * Hence the as_signed(). + * + * This is questionable: (i) is it at all good idea to allow %d with unsigned type? + * (ii) is all the machinery behind reinterpret_as_signed_int64() legit and/or necessary? + */ + consumed = std::snprintf(dst, size, "%" OMR_PRId64, reinterpret_as_signed_int64(value)); + } + break; + + case 'u': + { + if (!Tril::is_integral::value) + throw std::runtime_error("%u conversion specified but given value is not of an integral type"); + if (!Tril::is_unsigned::value) + throw std::runtime_error("%u conversion specified but given value is not of an unsigned type"); + + consumed = std::snprintf(dst, size, "%" OMR_PRIu64, (uint64_t)value); + } + break; + + case 'X': + case 'p': + { + if (!Tril::is_pointer::value) + throw std::runtime_error("%X / %p conversion specified but given value is not of a pointer type"); + + consumed = std::snprintf(dst, size, "%" OMR_PRIXPTR, (uintptr_t)value); + } + break; + + case 'f': + { + if (!Tril::is_floating_point::value) + throw std::runtime_error("%f conversion specified but given value is not of a floating-point type"); + + // FIXME: Handle NaN values on zOS and on Windows(see issue #5183 and #5324) + consumed = std::snprintf(dst, size, "%f" , value); + } + break; + + default: + throw std::runtime_error("unknown conversion specifier (only %%, %s, %d, %u, %X / %p and %f are supported, with optional j, l, ll, h or hh prefix)"); + } + + if (consumed > size - 1) + { + throw std::runtime_error("buffer too small"); + } + dst += consumed; + size -= consumed; + fmt++; + format(dst, size, fmt, rest...); + return; + } + } + else + { + *dst = *fmt; + dst++; + size--; + if (size < 0) + { + throw std::runtime_error("buffer too small"); + } + } + } + throw std::runtime_error("no conversion specifier found but value(s) given"); + } +} // namespace Tril + +#endif /* FORMAT_HPP */