-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a4ad9d
commit 72cf02b
Showing
5 changed files
with
54 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1463 | ||
1464 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python | ||
# coding: utf-8 | ||
"""Test Symbolic Optimizations.""" | ||
|
||
import unittest | ||
from triton import * | ||
|
||
|
||
class TestSymbolicOptimizations(unittest.TestCase): | ||
|
||
"""Testing ALIGNED_MEMORY.""" | ||
|
||
def setUp(self): | ||
self.ctx = TritonContext(ARCH.X86_64) | ||
|
||
|
||
def test_without_optim(self): | ||
self.ctx.setMode(MODE.ALIGNED_MEMORY, False) | ||
|
||
self.ctx.processing(Instruction(b"\x48\xc7\xc0\x01\x00\x00\x00")) # mov rax, 1 | ||
self.ctx.processing(Instruction(b"\x48\x89\x03")) # mov [rbx], rax | ||
self.ctx.processing(Instruction(b"\x48\x8b\x0b")) # mov rcx, [rbx] | ||
|
||
rcx = self.ctx.getMemoryAst(MemoryAccess(0, CPUSIZE.QWORD)) | ||
self.assertEqual(rcx.getType(), AST_NODE.CONCAT) | ||
self.assertEqual(rcx.evaluate(), 1) | ||
return | ||
|
||
|
||
def test_with_optim(self): | ||
self.ctx.setMode(MODE.ALIGNED_MEMORY, True) | ||
|
||
self.ctx.processing(Instruction(b"\x48\xc7\xc0\x01\x00\x00\x00")) # mov rax, 1 | ||
self.ctx.processing(Instruction(b"\x48\x89\x03")) # mov [rbx], rax | ||
self.ctx.processing(Instruction(b"\x48\x8b\x0b")) # mov rcx, [rbx] | ||
|
||
rcx = self.ctx.getMemoryAst(MemoryAccess(0, CPUSIZE.QWORD)) | ||
self.assertEqual(rcx.getType(), AST_NODE.REFERENCE) | ||
self.assertEqual(rcx.evaluate(), 1) | ||
return |