History

trivial jump size optimization

bellard committed 24 years ago

Commit 37489751 parent 1cb35571 file · +9 −2Browse files

Unified · Split

i386-gen.c+9−2
@@ -233,7 +233,7 @@ void load(int r, SValue *sv) · 232 unmodified lines
233 } else if (v == VT_JMP || v == VT_JMPI) {233 } else if (v == VT_JMP || v == VT_JMPI) {
234 t = v & 1;234 t = v & 1;
235 oad(0xb8 + r, t); /* mov $1, r */235 oad(0xb8 + r, t); /* mov $1, r */
236 oad(0xe9, 5); /* jmp after */236 o(0x05eb); /* jmp after */
237 gsym(fc);237 gsym(fc);
238 oad(0xb8 + r, t ^ 1); /* mov $0, r */238 oad(0xb8 + r, t ^ 1); /* mov $0, r */
239 } else if (v != r) {239 } else if (v != r) {
@@ -479,7 +479,14 @@ int gjmp(int t) · 239 unmodified lines
479/* generate a jump to a fixed address */479/* generate a jump to a fixed address */
480void gjmp_addr(int a)480void gjmp_addr(int a)
481{481{
482 oad(0xe9, a - ind - 5);482 int r;
483 r = a - ind - 2;
484 if (r == (char)r) {
485 g(0xeb);
486 g(r);
487 } else {
488 oad(0xe9, a - ind - 5);
489 }
483}490}
484 491
485/* generate a test. set 'inv' to invert test. Stack entry is popped */492/* generate a test. set 'inv' to invert test. Stack entry is popped */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t