Auto-generate CacheIR boilerplate
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox77 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 1 open bug)
Details
Attachments
(26 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
We should try to move the CacheIR definitions into a Python script, so that we can auto-generate some C++ headers for things like:
- Instruction-specific parts of CacheIRWriter
- Method definitions for CacheIRCompiler and WarpCacheIRTranspiler that get passed the operands as arguments instead of requiring manual
reader.readFoo()
calls. - A CacheIR logger, useful for
WarpCacheIR::dumpData
.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Most other generated SpiderMonkey files have the 'Generated' suffix too so let's
follow that convention.
Assignee | ||
Comment 2•5 years ago
|
||
Depends on D70993
Assignee | ||
Comment 3•5 years ago
|
||
For now this generates just CACHE_IR_OPS and CACHE_IR_SHARED_OPS in CacheIROpsGenerated.h
but the plan is to use this to generate parts of the IR writer and compiler/transpiler
interface. The spewer could also potentially be improved now that each operand has a name
and more precise type.
Generating the IR writer will likely happen incrementally so that will give us
another chance to double check the precise types match what's in the YAML file.
Depends on D70994
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c98945218181 part 1 - Rename MOpcodes.h to MOpcodesGenerated.h and LOpcodes to LOpcodesGenerated.h. r=iain https://hg.mozilla.org/integration/autoland/rev/bf1ac8000d98 part 2 - Remove unnecessary condition operand from GuardSpecificInt32Immediate. r=iain https://hg.mozilla.org/integration/autoland/rev/ae75073d8f75 part 3 - Define CacheIR ops in a YAML file and use that to generate a header file. r=iain
Assignee | ||
Comment 5•5 years ago
|
||
For ops that are implemented in the base class, we used to generate an emitFoo
implementation in BaselineCacheIRCompiler and IonCacheIRCompiler that forwarded
to the base class method.
Now that we can easily codegen, it's nicer to generate a list of unshared ops
and use it so that we can call the base class methods directly. This generates
a lot less C++ code in the CacheIR compilers and is easier on the C++ compiler.
Eventually both the shared and unshared lists will be replaced with generated
boilerplate, but for now this is an improvement.
Assignee | ||
Comment 6•5 years ago
|
||
For ops with the gen_boilerplate attribute, this auto-generates the writer and compiler
boilerplate code. The attribute has been added to some arbitrary ops to test this.
CacheIRWriter methods that return a new OperandId are not supported yet.
Initially I wanted to generate multiple header files and classes, but the current
approach works fine and is probably a bit easier to reason about. Because the
code generation itself is pretty simple it should be easy to experiment with different
codegen strategies in the future.
Comment 7•5 years ago
|
||
bugherder |
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Comment 9•5 years ago
|
||
Depends on D71280
Assignee | ||
Comment 10•5 years ago
|
||
Depends on D71281
Assignee | ||
Comment 11•5 years ago
|
||
Depends on D71282
Assignee | ||
Comment 12•5 years ago
|
||
The PropertyNameField type behaves just like StringField, except the generated writer
method takes a PropertyName* instead of JSString* for better type safety.
Depends on D71283
Comment 13•5 years ago
|
||
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/219a8f2d153f part 4 - Stop generating implementations forwarding to the base class. r=iain https://hg.mozilla.org/integration/autoland/rev/667744615032 part 5 - Auto-generate CacheIRWriter and CacheIRCompiler code for a handful of ops. r=iain
Assignee | ||
Comment 14•5 years ago
|
||
RawWordField had to be split in RawWordField (writer takes uintptr_t) and
RawPointerField (writer takes const void*
).
Assignee | ||
Comment 15•5 years ago
|
||
Assignee | ||
Comment 16•5 years ago
|
||
Comment 17•5 years ago
|
||
bugherder |
Comment 18•5 years ago
|
||
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f4e8a57794bd part 6 - Auto-generate boilerplate for more ops. r=iain https://hg.mozilla.org/integration/autoland/rev/3622d13a47ba part 7 - Auto-generate boilerplate for more ops. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/1b564951f425 part 8 - Auto-generate boilerplate for more ops. r=iain https://hg.mozilla.org/integration/autoland/rev/2171f97d659b part 9 - Auto-generate boilerplate for more ops. r=evilpie https://hg.mozilla.org/integration/autoland/rev/6edde7bdb088 part 10 - Auto-generate boilerplate for more ops. r=tcampbell
Comment 19•5 years ago
|
||
bugherder |
Comment 20•5 years ago
|
||
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/31756f82b699 part 11 - Auto-generate boilerplate for more ops. r=iain https://hg.mozilla.org/integration/autoland/rev/ef3ad9976f50 part 12 - Auto-generate boilerplate for more ops. r=evilpie https://hg.mozilla.org/integration/autoland/rev/0bede83bebb6 part 13 - Auto-generate boilerplate for more ops. r=mgaudet
Comment 21•5 years ago
|
||
Backed out 3 changesets (bug 1629791) for bustages complaining about CacheIR.h
Backout link: https://hg.mozilla.org/integration/autoland/rev/ee7a427d7af1ccb7ab79fb8ac869e4a8f647f77e
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=298286274&repo=autoland&lineNumber=8688
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - make[4]: Entering directory '/builds/worker/workspace/obj-build/js/src/jit'
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - /builds/worker/fetches/sccache/sccache /builds/worker/fetches/gcc/bin/g++ -std=gnu++17 -o Unified_cpp_js_src_jit0.o -c -I/builds/worker/workspace/obj-build/dist/system_wrappers -include /builds/worker/checkouts/gecko/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DDEBUG=1 -DWASM_SUPPORTS_HUGE_MEMORY -DJS_CACHEIR_SPEW -DJS_STRUCTURED_SPEW -DJS_HAS_CTYPES -DFFI_BUILDING -DEXPORT_JS_API -DMOZ_HAS_MOZGLUE -I/builds/worker/checkouts/gecko/js/src/jit -I/builds/worker/workspace/obj-build/js/src/jit -I/builds/worker/workspace/obj-build/js/src -I/builds/worker/checkouts/gecko/js/src -I/builds/worker/workspace/obj-build/dist/include -I/builds/worker/workspace/obj-build/dist/include/nspr -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/obj-build/js/src/js-confdefs.h -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wduplicated-cond -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wformat -Wformat-overflow=2 -Wno-noexcept-type -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -fno-aligned-new -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -freorder-blocks -O3 -fno-omit-frame-pointer -funwind-tables -Werror -fno-strict-aliasing -Werror=format -Wno-shadow -Wno-attributes -MD -MP -MF .deps/Unified_cpp_js_src_jit0.o.pp Unified_cpp_js_src_jit0.cpp
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/Array.h:17:0,
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - from /builds/worker/checkouts/gecko/js/src/jit/MIR.h:16,
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - from /builds/worker/checkouts/gecko/js/src/jit/AliasAnalysis.h:10,
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - from /builds/worker/checkouts/gecko/js/src/jit/AliasAnalysis.cpp:7,
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - from Unified_cpp_js_src_jit0.cpp:2:
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - /builds/worker/checkouts/gecko/js/src/jit/CacheIR.h: In member function 'void js::jit::CacheIRWriter::loadTypedObjectResult(js::jit::ObjOperandId, uint32_t, js::jit::TypedThingLayout, uint32_t)':
[task 2020-04-19T13:15:38.583Z] 13:15:38 ERROR - /builds/worker/checkouts/gecko/js/src/jit/CacheIR.h:1275:33: error: comparison is always true due to limited range of data type [-Werror=type-limits]
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - MOZ_ASSERT(uint32_t(layout) <= UINT8_MAX);
[task 2020-04-19T13:15:38.583Z] 13:15:38 INFO - ^
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:445:58: note: in definition of macro 'MOZ_VALIDATE_ASSERT_CONDITION_TYPE'
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - mozilla::detail::AssertionConditionType<decltype(x)>::isValid, \
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - ^
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:482:31: note: in expansion of macro 'MOZ_ASSERT_HELPER1'
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - #define MOZ_ASSERT_GLUE(a, b) a b
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - ^
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:490:5: note: in expansion of macro 'MOZ_ASSERT_GLUE'
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - MOZ_ASSERT_GLUE( \
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - ^~~~~~~~~~~~~~~
[task 2020-04-19T13:15:38.585Z] 13:15:38 INFO - /builds/worker/checkouts/gecko/js/src/jit/CacheIR.h:1275:5: note: in expansion of macro 'MOZ_ASSERT'
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - MOZ_ASSERT(uint32_t(layout) <= UINT8_MAX);
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - ^
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:18:0,
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - from /builds/worker/workspace/obj-build/dist/include/mozilla/Array.h:17,
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - from /builds/worker/checkouts/gecko/js/src/jit/MIR.h:16,
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - from /builds/worker/checkouts/gecko/js/src/jit/AliasAnalysis.h:10,
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - from /builds/worker/checkouts/gecko/js/src/jit/AliasAnalysis.cpp:7,
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - from Unified_cpp_js_src_jit0.cpp:2:
[task 2020-04-19T13:15:38.586Z] 13:15:38 ERROR - /builds/worker/checkouts/gecko/js/src/jit/CacheIR.h:1275:33: error: comparison is always true due to limited range of data type [-Werror=type-limits]
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - MOZ_ASSERT(uint32_t(layout) <= UINT8_MAX);
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - ^
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - /builds/worker/workspace/obj-build/dist/include/mozilla/Likely.h:17:48: note: in definition of macro 'MOZ_UNLIKELY'
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - # define MOZ_UNLIKELY(x) (__builtin_expect(!!(x), 0))
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - ^
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:464:23: note: in expansion of macro 'MOZ_CHECK_ASSERT_ASSIGNMENT'
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - if (MOZ_UNLIKELY(!MOZ_CHECK_ASSERT_ASSIGNMENT(expr))) { \
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - ^~~~~~~~~~~~~~~~~~~~~~~~~~~
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:482:31: note: in expansion of macro 'MOZ_ASSERT_HELPER1'
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - #define MOZ_ASSERT_GLUE(a, b) a b
[task 2020-04-19T13:15:38.586Z] 13:15:38 INFO - ^
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:490:5: note: in expansion of macro 'MOZ_ASSERT_GLUE'
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - MOZ_ASSERT_GLUE( \
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - ^~~~~~~~~~~~~~~
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - /builds/worker/checkouts/gecko/js/src/jit/CacheIR.h:1275:5: note: in expansion of macro 'MOZ_ASSERT'
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - MOZ_ASSERT(uint32_t(layout) <= UINT8_MAX);
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - ^
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - cc1plus: all warnings being treated as errors
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - /builds/worker/checkouts/gecko/config/rules.mk:750: recipe for target 'Unified_cpp_js_src_jit0.o' failed
[task 2020-04-19T13:15:38.587Z] 13:15:38 ERROR - make[4]: *** [Unified_cpp_js_src_jit0.o] Error 1
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - make[4]: Leaving directory '/builds/worker/workspace/obj-build/js/src/jit'
[task 2020-04-19T13:15:38.587Z] 13:15:38 INFO - make[4]: *** Waiting for unfinished jobs....
Assignee | ||
Updated•5 years ago
|
Comment 22•5 years ago
|
||
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/72a8b31446c5 part 11 - Auto-generate boilerplate for more ops. r=iain https://hg.mozilla.org/integration/autoland/rev/ac8a7040a530 part 12 - Auto-generate boilerplate for more ops. r=evilpie https://hg.mozilla.org/integration/autoland/rev/7c7f5c9ca443 part 13 - Auto-generate boilerplate for more ops. r=mgaudet
Comment 23•5 years ago
|
||
bugherder |
Assignee | ||
Comment 24•5 years ago
|
||
Assignee | ||
Comment 25•5 years ago
|
||
Depends on D71515
Assignee | ||
Comment 26•5 years ago
|
||
Depends on D71516
Assignee | ||
Comment 27•5 years ago
|
||
Depends on D71517
Assignee | ||
Comment 28•5 years ago
|
||
Depends on D71518
Assignee | ||
Comment 29•5 years ago
|
||
Depends on D71519
Assignee | ||
Comment 30•5 years ago
|
||
This adds support for instructions that return a new value. In this case the
CacheIRWriter returns a new id of this kind.
Depends on D71520
Assignee | ||
Comment 31•5 years ago
|
||
Depends on D71521
Comment 32•5 years ago
|
||
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1c58c2dfbcac part 14 - Auto-generate boilerplate for more ops. r=evilpie https://hg.mozilla.org/integration/autoland/rev/08d33b0602d6 part 15 - Auto-generate boilerplate for more ops. r=evilpie https://hg.mozilla.org/integration/autoland/rev/ad647c87f939 part 16 - Auto-generate boilerplate for more ops. r=iain https://hg.mozilla.org/integration/autoland/rev/a2cf06ed6d52 part 17 - Auto-generate boilerplate for more ops. r=tcampbell https://hg.mozilla.org/integration/autoland/rev/b08f2511e2cc part 18 - Auto-generate boilerplate for more ops. r=iain https://hg.mozilla.org/integration/autoland/rev/ea5473ff6eb9 part 19 - Auto-generate boilerplate for more ops. r=evilpie https://hg.mozilla.org/integration/autoland/rev/f1a789f5b8fd part 20 - Auto-generate boilerplate for more ops. r=iain https://hg.mozilla.org/integration/autoland/rev/bf1fed0570d7 part 21 - Auto-generate boilerplate for more ops. r=evilpie
Assignee | ||
Comment 33•5 years ago
|
||
This adds the custom_writer
attribute for ops that need custom writer code.
In this case the generated method is private and its name has a trailing _
.
Assignee | ||
Comment 34•5 years ago
|
||
These are a bit special because the type of ths RHS is not statically know, so
we use RawId.
Depends on D71717
Assignee | ||
Comment 35•5 years ago
|
||
Reusing stub fields is a bit difficult with the code generator. I have a TODO
item to add some code to addStubField to do this dynamically.
Depends on D71718
Assignee | ||
Comment 36•5 years ago
|
||
Depends on D71719
Assignee | ||
Comment 37•5 years ago
|
||
Make the reader a local passed to the auto-generated emitFoo methods, instead
of exposing it to all CacheIRCompiler methods. This is nice because only
auto-generated code now has access to it.
This also removes the assertAllArgumentsConsumed mechanism because the reader
code is auto-generated from the same information.
Comment 38•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1c58c2dfbcac
https://hg.mozilla.org/mozilla-central/rev/08d33b0602d6
https://hg.mozilla.org/mozilla-central/rev/ad647c87f939
https://hg.mozilla.org/mozilla-central/rev/a2cf06ed6d52
https://hg.mozilla.org/mozilla-central/rev/b08f2511e2cc
https://hg.mozilla.org/mozilla-central/rev/ea5473ff6eb9
https://hg.mozilla.org/mozilla-central/rev/f1a789f5b8fd
https://hg.mozilla.org/mozilla-central/rev/bf1fed0570d7
Comment 39•5 years ago
|
||
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d53bf7023c65 part 22 - Auto-generate boilerplate for some ops with custom CacheIRWriter logic. r=iain https://hg.mozilla.org/integration/autoland/rev/f2bfc40e38b6 part 23 - Auto-generate boilerplate for some TypedObject ops. r=iain https://hg.mozilla.org/integration/autoland/rev/c3ba1ac51e15 part 24 - Auto-generate boilerplate for MetaTwoByte. r=iain https://hg.mozilla.org/integration/autoland/rev/0804ac69cd9c part 25 - Remove the gen_boilerplate attribute now that all ops have it. r=iain https://hg.mozilla.org/integration/autoland/rev/ab943bedecaf part 26 - Remove CacheIRReader field from CacheIRCompiler. r=iain
Assignee | ||
Comment 40•5 years ago
|
||
This is done. There's some follow-up work in bug 1632067 and we can now hook this up to the transpiler too.
Comment 41•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d53bf7023c65
https://hg.mozilla.org/mozilla-central/rev/f2bfc40e38b6
https://hg.mozilla.org/mozilla-central/rev/c3ba1ac51e15
https://hg.mozilla.org/mozilla-central/rev/0804ac69cd9c
https://hg.mozilla.org/mozilla-central/rev/ab943bedecaf
Description
•