Fixing tests.

This commit is contained in:
Ben Vanik 2015-05-21 07:51:56 -07:00
parent fc4727c339
commit bac3f8c3bd
7 changed files with 23 additions and 6 deletions

View File

@ -37,10 +37,10 @@ X64CodeCache::~X64CodeCache() {
RtlDeleteGrowableFunctionTable(unwind_table_handle_); RtlDeleteGrowableFunctionTable(unwind_table_handle_);
} }
if (indirection_table_base_) { if (indirection_table_base_) {
VirtualFree(indirection_table_base_, kIndirectionTableSize, MEM_RELEASE); VirtualFree(indirection_table_base_, 0, MEM_RELEASE);
} }
if (generated_code_base_) { if (generated_code_base_) {
VirtualFree(generated_code_base_, kIndirectionTableSize, MEM_RELEASE); VirtualFree(generated_code_base_, 0, MEM_RELEASE);
} }
} }

View File

@ -37,3 +37,14 @@ Disassembly of section .text:
10004c: 54 a5 f8 7e rlwinm r5,r5,31,1,31 10004c: 54 a5 f8 7e rlwinm r5,r5,31,1,31
100050: 7c a6 00 34 cntlzw r6,r5 100050: 7c a6 00 34 cntlzw r6,r5
100054: 4e 80 00 20 blr 100054: 4e 80 00 20 blr
0000000000100058 <test_cntlzw_5>:
100058: 7c a6 00 34 cntlzw r6,r5
10005c: 4e 80 00 20 blr
0000000000100060 <test_cntlzw_5_constant>:
100060: 38 a0 ff ff li r5,-1
100064: 78 a5 07 c6 rldicr r5,r5,32,31
100068: 38 a5 00 01 addi r5,r5,1
10006c: 7c a6 00 34 cntlzw r6,r5
100070: 4e 80 00 20 blr

View File

@ -6,3 +6,5 @@
0000000000000030 t test_cntlzw_3_constant 0000000000000030 t test_cntlzw_3_constant
0000000000000040 t test_cntlzw_4 0000000000000040 t test_cntlzw_4
0000000000000048 t test_cntlzw_4_constant 0000000000000048 t test_cntlzw_4_constant
0000000000000058 t test_cntlzw_5
0000000000000060 t test_cntlzw_5_constant

View File

@ -35,7 +35,7 @@ using xe::cpu::Runtime;
typedef std::vector<std::pair<std::string, std::string>> AnnotationList; typedef std::vector<std::pair<std::string, std::string>> AnnotationList;
const uint32_t START_ADDRESS = 0x100000; const uint32_t START_ADDRESS = 0x80000000;
struct TestCase { struct TestCase {
TestCase(uint32_t address, std::string& name) TestCase(uint32_t address, std::string& name)
@ -194,6 +194,9 @@ class TestRunner {
} }
processor->AddModule(std::move(module)); processor->AddModule(std::move(module));
processor->backend()->CommitExecutableRange(START_ADDRESS,
START_ADDRESS + 1024 * 1024);
// Simulate a thread. // Simulate a thread.
uint32_t stack_size = 64 * 1024; uint32_t stack_size = 64 * 1024;
uint32_t stack_address = START_ADDRESS - stack_size; uint32_t stack_address = START_ADDRESS - stack_size;

View File

@ -47,12 +47,13 @@ class TestFunction {
for (auto& processor : processors) { for (auto& processor : processors) {
auto module = std::make_unique<xe::cpu::TestModule>( auto module = std::make_unique<xe::cpu::TestModule>(
processor.get(), "Test", processor.get(), "Test",
[](uint64_t address) { return address == 0x1000; }, [](uint64_t address) { return address == 0x80000000; },
[generator](hir::HIRBuilder& b) { [generator](hir::HIRBuilder& b) {
generator(b); generator(b);
return true; return true;
}); });
processor->AddModule(std::move(module)); processor->AddModule(std::move(module));
processor->backend()->CommitExecutableRange(0x80000000, 0x80010000);
} }
} }
@ -65,7 +66,7 @@ class TestFunction {
std::function<void(PPCContext*)> post_call) { std::function<void(PPCContext*)> post_call) {
for (auto& processor : processors) { for (auto& processor : processors) {
xe::cpu::Function* fn; xe::cpu::Function* fn;
processor->ResolveFunction(0x1000, &fn); processor->ResolveFunction(0x80000000, &fn);
uint32_t stack_size = 64 * 1024; uint32_t stack_size = 64 * 1024;
uint32_t stack_address = memory_size - stack_size; uint32_t stack_address = memory_size - stack_size;

2
xb.bat
View File

@ -299,7 +299,7 @@ FOR %%G in (*.s) DO (
REM Eat the first 4 lines to kill the file path that'll differ across machines. REM Eat the first 4 lines to kill the file path that'll differ across machines.
MORE +4 %TEST_BIN_WIN%\!SRC_NAME!.dis.tmp > %TEST_BIN_WIN%\!SRC_NAME!.dis MORE +4 %TEST_BIN_WIN%\!SRC_NAME!.dis.tmp > %TEST_BIN_WIN%\!SRC_NAME!.dis
DEL %TEST_BIN_WIN%\!SRC_NAME!.dis.tmp DEL %TEST_BIN_WIN%\!SRC_NAME!.dis.tmp
%PPC_LD% -A powerpc:common64 -melf64ppc -EB -nostdlib --oformat binary -Ttext 0x100000 -e 0x100000 -o %TEST_BIN%/!SRC_NAME!.bin !OBJ_FILE! %PPC_LD% -A powerpc:common64 -melf64ppc -EB -nostdlib --oformat binary -Ttext 0x80000000 -e 0x80000000 -o %TEST_BIN%/!SRC_NAME!.bin !OBJ_FILE!
IF !ERRORLEVEL! NEQ 0 ( IF !ERRORLEVEL! NEQ 0 (
SET ANY_ERRORS=1 SET ANY_ERRORS=1
) )