Skip to content

Commit 461d95c

Browse files
committed
Add Windows x86 support
1 parent ccbb212 commit 461d95c

File tree

3 files changed

+44
-13
lines changed

3 files changed

+44
-13
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This project started as a result of my boredom, but has become a friendly compet
44
I'd like to say that it's fast, ~~but it does not have a jit (yet).~~ and that's because it is. The execution of the Mandelbrot BF application went from 11 seconds to 1.3 seconds. Scroll down if you'd like to see the comparison.
55

66
## JIT Optimizations
7-
Of course, multiple basic operations such as `>>>` and `+++` are summed together. This happens at the parsing stage and results in a free speed bonus. The JIT, if enabled, takes these summed operations and compiles them down to x86_64 machine code (only windows 64-bit for now). After a majority of the machine code is built, a peephole optimizer scans for any improvements. For now there is only one pattern that will result in a noticeable speed improvement (7%), but more can be added later.
7+
Of course, multiple basic operations such as `>>>` and `+++` are summed together. This happens at the parsing stage and results in a free speed bonus. The JIT, if enabled, takes these summed operations and compiles them down to machine code (only windows for now). After a majority of the machine code is built, a peephole optimizer scans for any improvements. For now there is only one pattern that will result in a noticeable speed improvement (7%), but more can be added later.
88

99
Lets get onto actually seeing the speed difference.
1010

jit.h

+40-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#if defined WIN64 || defined _WIN64
1212
#define X64
1313
#else
14-
#define X32
14+
#define X86
1515
#endif
1616

1717
namespace Brainfuck {
@@ -50,19 +50,26 @@ namespace Brainfuck {
5050
// RCX - RDX - R8
5151
// Therefore our cells ptr will exist in RCX, getchar in RDX, and putchar in R8
5252
0x49, 0x89, 0xCB, // mov r11, rcx
53-
#else // X32
53+
#else // x86
54+
// Most x86 calling conventions require us to save the old call frame somewhere safe
55+
0x55, // push ebp
56+
0x89, 0xE5, // mov ebp, esp // init new call frame
57+
0x56, // push esi
58+
0x57, // push edi
5459
// Windows x86 calling convention states paramaters are stored in the stack, lets grab them
60+
5561
0x8B, 0x4D, 0x08, // mov ecx, [ebp+8] // cellsptr
5662
0x8B, 0x75, 0x0C, // mov esi, [ebp+12] // getchar
5763
0x8B, 0x7D, 0x10, // mov edi, [ebp+16] // putchar
64+
5865
#endif
5966
});
6067
}
6168
inline void shiftRight(uint8_t amount) {
6269
pushBytes({
6370
#ifdef X64
6471
0x49, 0x83, 0xC3, amount, // add r11, amount
65-
#else // X32
72+
#else // x86
6673
0x83, 0xC1, amount, // add ecx, amount
6774
#endif
6875
});
@@ -71,7 +78,7 @@ namespace Brainfuck {
7178
pushBytes({
7279
#ifdef X64
7380
0x49, 0x83, 0xEB, amount, // sub r11, i.repeat
74-
#else // X32
81+
#else // x86
7582
0x83, 0xE9, amount, // sub ecx, amount
7683
#endif
7784
});
@@ -80,7 +87,7 @@ namespace Brainfuck {
8087
pushBytes({
8188
#ifdef X64
8289
0x41, 0x80, 0x03, amount, // add BYTE PTR [r11],i.repeat
83-
#else // X32
90+
#else // x86
8491
0x80, 0x01, amount, // add byte ptr[ecx], amount
8592
#endif
8693
});
@@ -89,7 +96,7 @@ namespace Brainfuck {
8996
pushBytes({
9097
#ifdef X64
9198
0x41, 0x80, 0x2B, amount, // sub BYTE PTR [r11], i.repeat
92-
#else // X32
99+
#else // x86
93100
0x80, 0x29, amount, // sub byte ptr[ecx], amount
94101
#endif
95102
});
@@ -107,15 +114,19 @@ namespace Brainfuck {
107114
0x41, 0x5B, // pop r11
108115
0x41, 0x58, // pop r8
109116
0x5A, // pop rdx
110-
#else // X32
117+
#else // x86
111118
0x51, // push ecx
112-
0x56, // push esi
113-
0x57, // push edi
119+
0x0F, 0xB6, 0x09, // movzx ecx, byte ptr[ecx]
120+
0x51, // push ecx
121+
0xFF, 0xD7, // call edi
122+
0x83, 0xC4, 0x04, // add esp, 4 // remove param from stack
123+
0x59, // pop ecx
114124
#endif
115125
});
116126
}
117127
inline void doRead() {
118128
pushBytes({
129+
#ifdef X64
119130
0x52, // push rdx
120131
0x41, 0x50, // push r8
121132
0x41, 0x53, // push r11
@@ -124,24 +135,38 @@ namespace Brainfuck {
124135
0x41, 0x5B, // pop r11
125136
0x41, 0x58, // pop r8
126137
0x5A, // pop rdx
138+
#else // x86
139+
0x51, // push ecx
140+
0xFF, 0xD6, // call esi
141+
0x59, // pop ecx
142+
0x88, 0x01, // move byte ptr[ecx], eax
143+
#endif
127144
});
128145
}
129146
inline void loopStart() {
130147
pushBytes({
148+
#ifdef X64
131149
0x41, 0x80, 0x3B, 0x00, // cmp byte ptr [r11], 0
150+
#else
151+
0x80, 0x39, 0x00, // cmp byte ptr [ecx], 0
152+
#endif
132153
0x0f, 0x84, 0xDE, 0xAD, 0xBE, 0xEF, // je 0xDEADBEEF
133154
});
134155
}
135156
inline void loopEnd() {
136157
pushBytes({
158+
#ifdef X64
137159
0x41, 0x80, 0x3B, 0x00, // cmp byte ptr [r11], 0
160+
#else
161+
0x80, 0x39, 0x00, // cmp byte ptr [ecx], 0
162+
#endif
138163
0x0f, 0x85, 0xDE, 0xAD, 0xBE, 0xEF // jne 0xDEADBEEF
139164
});
140165
}
141166

142167
inline void buildJumps(unsigned char *blob) {
143168
std::stack<int32_t> loopstack;
144-
for (int32_t pos = 0; pos < code.size()-6; pos++) {
169+
for (int32_t pos = 0; pos < (int32_t)code.size()-6; pos++) {
145170

146171
if (blob[pos] == 0x0f && blob[pos+1] == 0x84) {
147172
loopstack.push(pos+6); // mark *after* this jump instruction
@@ -171,6 +196,10 @@ namespace Brainfuck {
171196
#ifdef X64
172197
0xc3, // ret
173198
#else //X32
199+
0x5F, // pop edi
200+
0x5E, // pop esi
201+
0x89, 0xEC, // mov esp, ebp
202+
0x5D, // pop ebp
174203
0xc3,
175204
#endif
176205
});
@@ -214,7 +243,7 @@ namespace Brainfuck {
214243
std::memset(cells.get(), 0, 1024);
215244

216245
funct(cells.get(), getchar, putchar);
217-
246+
//system("pause");
218247
VirtualFree(alloc, 0, MEM_RELEASE);
219248
}
220249
protected:

test.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
//constexpr std::string_view code = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
1010
//constexpr std::string_view code = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
1111
constexpr std::string_view code = "+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>>>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<<<]>>>>>>>>>+++++++++++++++[[>>>>>>>>>]+>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>-]+[>+>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>[>->>>>[-<<<<+>>>>]<<<<[->>>>+<<<<<[->>[-<<+>>]<<[->>+>>+<<<<]+>>>>>>>>>]<<<<<<<<[<<<<<<<<<]]>>>>>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v[]) noexcept {
1315
{
1416
Brainfuck::BrainfuckVM<unsigned char> vm{ std::cout, std::cin, true};
1517

0 commit comments

Comments
 (0)