OLD | NEW |
1 | 1 |
2 //===- subzero/unittest/unittest/AssemblerX8664/TestUtil.h ------*- C++ -*-===// | 2 //===- subzero/unittest/unittest/AssemblerX8664/TestUtil.h ------*- C++ -*-===// |
3 // | 3 // |
4 // The Subzero Code Generator | 4 // The Subzero Code Generator |
5 // | 5 // |
6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
8 // | 8 // |
9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
10 // | 10 // |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 694 |
695 AssembledTest(const uint8_t *Data, const size_t MySize, | 695 AssembledTest(const uint8_t *Data, const size_t MySize, |
696 const size_t ExtraStorageDwords) | 696 const size_t ExtraStorageDwords) |
697 : Size(MaximumCodeSize + 4 * ExtraStorageDwords) { | 697 : Size(MaximumCodeSize + 4 * ExtraStorageDwords) { |
698 // MaxCodeSize is needed because EXPECT_LT needs a symbol with a name -- | 698 // MaxCodeSize is needed because EXPECT_LT needs a symbol with a name -- |
699 // probably a compiler bug? | 699 // probably a compiler bug? |
700 uint32_t MaxCodeSize = MaximumCodeSize; | 700 uint32_t MaxCodeSize = MaximumCodeSize; |
701 EXPECT_LT(MySize, MaxCodeSize); | 701 EXPECT_LT(MySize, MaxCodeSize); |
702 assert(MySize < MaximumCodeSize); | 702 assert(MySize < MaximumCodeSize); |
703 ExecutableData = mmap(nullptr, Size, PROT_WRITE | PROT_READ | PROT_EXEC, | 703 ExecutableData = mmap(nullptr, Size, PROT_WRITE | PROT_READ | PROT_EXEC, |
704 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); | 704 MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0); |
705 EXPECT_NE(MAP_FAILED, ExecutableData) << strerror(errno); | 705 EXPECT_NE(MAP_FAILED, ExecutableData) << strerror(errno); |
706 assert(MAP_FAILED != ExecutableData); | 706 assert(MAP_FAILED != ExecutableData); |
707 std::memcpy(ExecutableData, Data, MySize); | 707 std::memcpy(ExecutableData, Data, MySize); |
708 } | 708 } |
709 | 709 |
710 // We allow AssembledTest to be moved so that we can return objects of | 710 // We allow AssembledTest to be moved so that we can return objects of |
711 // this type. | 711 // this type. |
712 AssembledTest(AssembledTest &&Buffer) | 712 AssembledTest(AssembledTest &&Buffer) |
713 : ExecutableData(Buffer.ExecutableData), Size(Buffer.Size) { | 713 : ExecutableData(Buffer.ExecutableData), Size(Buffer.Size) { |
714 Buffer.ExecutableData = nullptr; | 714 Buffer.ExecutableData = nullptr; |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 | 1094 |
1095 bool NeedsEpilogue; | 1095 bool NeedsEpilogue; |
1096 uint32_t NumAllocatedDwords; | 1096 uint32_t NumAllocatedDwords; |
1097 }; | 1097 }; |
1098 | 1098 |
1099 } // end of namespace Test | 1099 } // end of namespace Test |
1100 } // end of namespace X8664 | 1100 } // end of namespace X8664 |
1101 } // end of namespace Ice | 1101 } // end of namespace Ice |
1102 | 1102 |
1103 #endif // ASSEMBLERX8664_TESTUTIL_H_ | 1103 #endif // ASSEMBLERX8664_TESTUTIL_H_ |
OLD | NEW |