Closed
Bug 1445592
Opened 6 years ago
Closed 6 years ago
Generate LOpcodes.h and MOpcodes.h at compile-time
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla61
Tracking | Status | |
---|---|---|
firefox61 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(3 files, 2 obsolete files)
61.38 KB,
patch
|
nbp
:
review+
froydnj
:
review+
|
Details | Diff | Splinter Review |
6.03 KB,
text/plain
|
Details | |
3.20 KB,
patch
|
froydnj
:
review+
|
Details | Diff | Splinter Review |
The attached patch does this and it seems to work for all platforms (including 'none'). 13 files changed, 89 insertions(+), 1030 deletions(-) r? nbp for JIT changes, r? nfroyd for build system changes.
Attachment #8958765 -
Flags: review?(nicolas.b.pierron)
Attachment #8958765 -
Flags: review?(nfroyd)
Assignee | ||
Comment 1•6 years ago
|
||
This is what the generated MOpcodes.h looks like.
Assignee | ||
Updated•6 years ago
|
Attachment #8958766 -
Attachment mime type: text/x-chdr → text/plain
Assignee | ||
Comment 2•6 years ago
|
||
It just occurred to me we don't need the jit namespace in the generated file because it's a macro, of course.
Attachment #8958765 -
Attachment is obsolete: true
Attachment #8958765 -
Flags: review?(nicolas.b.pierron)
Attachment #8958765 -
Flags: review?(nfroyd)
Attachment #8958772 -
Flags: review?(nicolas.b.pierron)
Attachment #8958772 -
Flags: review?(nfroyd)
Assignee | ||
Comment 3•6 years ago
|
||
Attachment #8958766 -
Attachment is obsolete: true
Comment 4•6 years ago
|
||
Comment on attachment 8958772 [details] [diff] [review] Patch v2 Review of attachment 8958772 [details] [diff] [review]: ----------------------------------------------------------------- This is pretty cool! I have general comments which you are free to ignore, since you are the expert here and I am not! ::: js/src/jit/GenerateOpcodeFiles.py @@ +26,5 @@ > + for inputfile in inputs: > + for line in open(inputfile): > + match = pat.match(line) > + if match: > + ops.append(match.group('name')) Do you think it's worth checking for duplicate names here, just to provide early warning to people that something is going to go wrong later? @@ +39,5 @@ > + 'listname': listname, > + }) > + > +def generate_mir_header(c_out, *inputs): > + pat = re.compile(r"^\s*INSTRUCTION_HEADER(_WITHOUT_TYPEPOLICY)?\((?P<name>\w+)\);?$") Do you think it's worth writing a comment associated with this macro that codegen looks for this macro specifically? @@ +43,5 @@ > + pat = re.compile(r"^\s*INSTRUCTION_HEADER(_WITHOUT_TYPEPOLICY)?\((?P<name>\w+)\);?$") > + generate_header(c_out, inputs, pat, 'jit_MOpcodes_h', 'MIR_OPCODE_LIST') > + > +def generate_lir_header(c_out, *inputs): > + pat = re.compile(r"^\s*LIR_HEADER\((?P<name>\w+)\);?$") Likewise for this one.
Attachment #8958772 -
Flags: review?(nfroyd) → review+
Comment 5•6 years ago
|
||
Comment on attachment 8958772 [details] [diff] [review] Patch v2 Review of attachment 8958772 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit/GenerateOpcodeFiles.py @@ +14,5 @@ > + > +#ifndef %(includeguard)s > +#define %(includeguard)s > + > +#define %(listname)s(_) \\ nit: Add a comment to mention that the content of this file is generated by jit/GenerateOpcodeFiles.py , this would be helpful for anybody who look at searchfox / dxr. ::: js/src/moz.build @@ +491,5 @@ > 'jit/x64/SharedIC-x64.cpp', > 'jit/x64/Trampoline-x64.cpp', > ] > else: > + LOpcodesGenerated.inputs += ['jit/x86/LIR-x86.h'] Nice!
Attachment #8958772 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Comment 6•6 years ago
|
||
Checking for duplicates might be nice to catch copy-paste issues... I'd like to preserve the original order, but I can add a set() in addition to the array, or use an OrderedDict. Even an O(n^2) check on the array is probably fine because we don't have thousands of instructions, but that still feels wrong :) Good suggestions; I'll post a follow-up patch later today.
Assignee | ||
Comment 7•6 years ago
|
||
Here's a patch addressing the review comments. I verified this works as expected.
Attachment #8958854 -
Flags: review?(nfroyd)
Comment 8•6 years ago
|
||
Comment on attachment 8958854 [details] [diff] [review] Follow-up patch Review of attachment 8958854 [details] [diff] [review]: ----------------------------------------------------------------- Great, thank you!
Attachment #8958854 -
Flags: review?(nfroyd) → review+
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/bd889e36b937 Generate Ion LOpcodes.h and MOpcodes.h instead of updating them manually. r=nbp,froydnj
Updated•6 years ago
|
Priority: -- → P3
Comment 10•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bd889e36b937
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox61:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in
before you can comment on or make changes to this bug.
Description
•