Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x64Emitter: optimize immediate sizes #754

Merged
merged 1 commit into from Aug 12, 2014

Conversation

FioraAeterna
Copy link
Contributor

A nice alternative than trying to do it throughout the JIT.

// Try to save immediate size if we can
if (nops[op].simm8 != 0xCC &&
((operand.scale == SCALE_IMM16 && (s16)operand.offset == (s8)operand.offset) ||
(operand.scale == SCALE_IMM32 && (s32)operand.offset == (s8)operand.offset)))

This comment was marked as off-topic.

@FioraAeterna FioraAeterna changed the title Immediateopt x64Emitter: optimize immediate sizes Aug 6, 2014
A nice alternative than trying to do it throughout the JIT.
@Tilka
Copy link
Member

Tilka commented Aug 9, 2014

lgtm

@shuffle2
Copy link
Contributor

lgtm, however considering #749, it looks like jit statements may be implicitly written as a shorter form than the writer of a jit statement expects...? Not sure if that's an issue or not.

@FioraAeterna
Copy link
Contributor Author

Could that ever be a bad thing? I think most assemblers already do that internally -- is there some place we want longer forms?

@shuffle2
Copy link
Contributor

It depends if anyone has written jit code with presumptions about
instruction length (for example manually calculating some pointers and
placing other instructions there). I doubt it, just pointing it out.

On Tue, Aug 12, 2014 at 2:07 PM, Fiora notifications@github.com wrote:

Could that ever be a bad thing? I think most assemblers already do that
internally -- is there some place we want longer forms?


Reply to this email directly or view it on GitHub
#754 (comment).

@FioraAeterna
Copy link
Contributor Author

That sounds like it'd be really dangerous, since it'd depend on whether an instruction had a REX prefix or not

shuffle2 added a commit that referenced this pull request Aug 12, 2014
x64Emitter: optimize immediate sizes
@shuffle2 shuffle2 merged commit b8d126c into dolphin-emu:master Aug 12, 2014
@delroth
Copy link
Member

delroth commented Aug 12, 2014

FYI I know that some of the backpatch stuff has/had assumptions of
instruction size to insert NOPs. Might be worth rechecking.

On Tue, Aug 12, 2014 at 2:19 PM, shuffle2 notifications@github.com wrote:

Merged #754 #754.


Reply to this email directly or view it on GitHub
#754 (comment).

Pierre "delroth" Bourdon delroth@gmail.com
Software Engineer @ Zürich, Switzerland
http://code.delroth.net/

@FioraAeterna
Copy link
Contributor Author

I think it should be okay; the backpatch code doesn't seem to use immediates at all, and it already has a check to make sure the size of the code is sufficient (it inserts nops otherwise).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants