forked from eclipse-omr/omr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve x86 code generation for constant null compression sequences
...as they occur in plain stores (as opposed to write barriers, or elsewhere). Usually a compression (not decompression) sequence feeds directly into some kind of store, and usually write barriers storing null should have already been changed into plain stores before code generation. Consider this sequence of stores that set an object's fields to null: foo.f1 = null; foo.f2 = null; foo.f3 = null; We've been generating code that looks something like this: xor ecx, ecx mov rdx, rcx shr rdx, 0x03 mov dword ptr [rax+0x8], edx mov rdx, rcx shr rdx, 0x03 mov dword ptr [rax+0xc], edx shr rcx, 0x03 mov dword ptr [rax+0x10], ecx With this commit we'll now use immediates, like so: mov dword ptr [rax+0x8], 0 mov dword ptr [rax+0xc], 0 mov dword ptr [rax+0x10], 0 or, if the null constant has already been evaluated into a register, then that register will be used directly, like so: mov dword ptr [rax+0x8], edi mov dword ptr [rax+0xc], edi mov dword ptr [rax+0x10], edi This eliminates the unnecessary shift (if present) and a reg-reg move that would previously result from evaluating a2l. Additionally, only because it was easy to make the improvement slightly more general, any other compression sequence that occurs as the child of a plain store and that doesn't contain a shift is also improved through the direct use of the register from the original reference node, eliminating a reg-reg move. This will only benefit small heaps and for the most part only in GC modes that don't require write barriers.
- Loading branch information
Showing
1 changed file
with
44 additions
and
63 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