-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[JSC] Add wasm fixed-sized FuncRefTable #9092
[JSC] Add wasm fixed-sized FuncRefTable #9092
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
@@ -88,9 +89,14 @@ RefPtr<Table> Table::tryCreate(uint32_t initial, std::optional<uint32_t> maximum | |||
switch (type) { | |||
case TableElementType::Externref: | |||
return adoptRef(new ExternRefTable(initial, maximum)); | |||
case TableElementType::Funcref: | |||
case TableElementType::Funcref: { | |||
if (maximum && maximum.value() == initial) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check if (isFixedSized())
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is static function, to create a table, so isFixedSized is not computed (it is computed after creating a table).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right. I mistook this for being part of the constructor above.
static ptrdiff_t offsetOfTail() { return WTF::roundUpToMultipleOf<sizeof(Function)>(sizeof(FuncRefTable)); } | ||
static ptrdiff_t offsetOfFunctionsForFixedSizedTable() { return offsetOfTail(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
3bbddb3
to
a47ec34
Compare
EWS run on current version of this PR (hash a47ec34)
|
a47ec34
to
7c17226
Compare
https://bugs.webkit.org/show_bug.cgi?id=251136 rdar://104634169 Reviewed by Mark Lam. In many cases, FuncRefTable is fixed-sized (initial size matches against maximum size). This patch adds FixedSized optimization for FuncRefTable: 1. We allocate function's buffer as a tail of FuncRefTable memory. 2. In BBQ and OMG code, we avoid one-level indirection of load if we know that table is fixed-sized and it is not imported table. * Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h: (JSC::Wasm::ExpressionType>::addCallIndirect): * Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::addCallIndirect): * Source/JavaScriptCore/wasm/WasmTable.cpp: (JSC::Wasm::Table::Table): (JSC::Wasm::Table::tryCreate): (JSC::Wasm::FuncRefTable::FuncRefTable): (JSC::Wasm::FuncRefTable::~FuncRefTable): (JSC::Wasm::FuncRefTable::createFixedSized): * Source/JavaScriptCore/wasm/WasmTable.h: (JSC::Wasm::Table::isFixedSized const): Canonical link: https://commits.webkit.org/259363@main
7c17226
to
0ebf892
Compare
Committed 259363@main (0ebf892): https://commits.webkit.org/259363@main Reviewed commits have been landed. Closing PR #9092 and removing active labels. |
0ebf892
a47ec34
π π§ͺ jsc