Improve riscv64 instruction class
Categories
(Core :: JavaScript Engine: JIT, task, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(26 external files)
Improve the riscv64 Instruction class and code using Instruction:
- Move all manual
Instrbitwise manipulations intoInstructionBase. - Use fewer
reinterpret_castforInstruction. - Avoid duplicated code to split immediates into smaller bit ranges.
- And more clean-ups..
| Assignee | ||
Comment 1•6 months ago
|
||
It's confusing that the base assemblers were placed in the "extension" directory.
| Assignee | ||
Comment 2•6 months ago
|
||
This will allow to reuse them in InstructionBase in a later patch in this stack.
I've used the 2012 copyright notice matching both V8 source files (common/globals.h and utils/utils.h).
| Assignee | ||
Comment 3•6 months ago
|
||
Drive-by change:
- Remove unused
EmbeddedVectormethods which don't compile anyway. - Move constant and comments from Constant-riscv64.h to correct locations.
| Assignee | ||
Comment 4•6 months ago
|
||
Moving Instruction into a separate header will allow to add more convenience
methods in later patches, because it's now decoupled from the "constants" headers.
| Assignee | ||
Comment 5•6 months ago
|
||
Move trivial methods into the header file to ensure they can get fully inlined.
Drive-by change:
- Add missing definitions for
Funct7ValueandFunct2Value. - Add missing instruction type check in
Funct3Value.
| Assignee | ||
Comment 6•6 months ago
|
||
Directly inline InstructionGetters into InstructionBase to simplify the class
inheritance structure.
| Assignee | ||
Comment 7•6 months ago
|
||
This is no longer needed since C++11.
| Assignee | ||
Comment 8•6 months ago
|
||
This makes the intent more clear.
| Assignee | ||
Comment 9•6 months ago
|
||
This follows ARM64 instead of ARM32.
Also start with replacing reinterpret_cast with SetInstructionBits.
| Assignee | ||
Comment 10•6 months ago
|
||
Prefer Instruction::At to keep reinterpret_cast in a single place.
| Assignee | ||
Comment 11•6 months ago
|
||
Use InstructionBits() to get instruction bits and SetInstructionBits() to set
instruction bits instead of using reinterpret_cast.
| Assignee | ||
Comment 12•6 months ago
|
||
Instead of duplicating the same code in multiple places.
| Assignee | ||
Comment 13•6 months ago
|
||
Instead of using static methods on the assembler to determine the instruction kind,
add them as getters to InstructionBase.
| Assignee | ||
Comment 14•6 months ago
|
||
Use the existing getter functions from InstructionBase instead of manually
extracting the immediate values.
| Assignee | ||
Comment 15•6 months ago
|
||
| Assignee | ||
Comment 16•6 months ago
|
||
Remove dead code so we don't have to update it in the next part.
| Assignee | ||
Comment 17•6 months ago
|
||
Add proper setter methods instead of manually constructing the instruction bit encoding.
| Assignee | ||
Comment 18•6 months ago
|
||
Also move get_pc_as closer to get_pc to make it more discoverable.
| Assignee | ||
Comment 19•6 months ago
|
||
This avoids more reinterpret_casts and further reduces the calls to InstructionBits().
| Assignee | ||
Comment 20•6 months ago
|
||
It's RO_FSGNJX instead of RO_FSQNJX.
| Assignee | ||
Comment 21•6 months ago
|
||
The same code was repeated in multiple places, sometimes in a slightly different form.
| Assignee | ||
Comment 22•6 months ago
|
||
| Assignee | ||
Comment 23•6 months ago
|
||
| Assignee | ||
Comment 24•6 months ago
|
||
is_int32(int32) is trivially true.
| Assignee | ||
Comment 25•6 months ago
|
||
| Assignee | ||
Comment 26•6 months ago
|
||
The comments were copied from ARM64, but not updated for RISCV64.
Comment 27•6 months ago
|
||
Updated•6 months ago
|
Comment 28•5 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/edaada7978cf
https://hg.mozilla.org/mozilla-central/rev/240401ef9876
https://hg.mozilla.org/mozilla-central/rev/b2bf3ebfe59d
https://hg.mozilla.org/mozilla-central/rev/5ebf7531613d
https://hg.mozilla.org/mozilla-central/rev/fd611af48a61
https://hg.mozilla.org/mozilla-central/rev/8ea81d2ba65d
https://hg.mozilla.org/mozilla-central/rev/94119e1cb190
https://hg.mozilla.org/mozilla-central/rev/669430f3c42d
https://hg.mozilla.org/mozilla-central/rev/2276bab5ea05
https://hg.mozilla.org/mozilla-central/rev/54c69f8069bc
https://hg.mozilla.org/mozilla-central/rev/fa7e23f8f52c
https://hg.mozilla.org/mozilla-central/rev/e4197f63517f
https://hg.mozilla.org/mozilla-central/rev/4a6bf537155c
https://hg.mozilla.org/mozilla-central/rev/2c5e0a33a0e2
https://hg.mozilla.org/mozilla-central/rev/5e947ec3efb8
https://hg.mozilla.org/mozilla-central/rev/1fcedf032075
https://hg.mozilla.org/mozilla-central/rev/7bc140b7dbc5
https://hg.mozilla.org/mozilla-central/rev/97a06f94ee41
https://hg.mozilla.org/mozilla-central/rev/21055d8100f6
https://hg.mozilla.org/mozilla-central/rev/a1f95b23891e
https://hg.mozilla.org/mozilla-central/rev/15ecfa3ea309
https://hg.mozilla.org/mozilla-central/rev/886886449fe7
https://hg.mozilla.org/mozilla-central/rev/a04e5b6d5530
https://hg.mozilla.org/mozilla-central/rev/ec137022ae7c
https://hg.mozilla.org/mozilla-central/rev/e318f667b9f7
https://hg.mozilla.org/mozilla-central/rev/01ec19e20414
Updated•4 months ago
|
Description
•