AbstractMachine.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. /*
  2. * Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Function.h>
  8. #include <AK/HashMap.h>
  9. #include <AK/HashTable.h>
  10. #include <AK/OwnPtr.h>
  11. #include <AK/Result.h>
  12. #include <AK/StackInfo.h>
  13. #include <AK/UFixedBigInt.h>
  14. #include <LibWasm/Types.h>
  15. // NOTE: Special case for Wasm::Result.
  16. #include <LibJS/Runtime/Completion.h>
  17. namespace Wasm {
  18. class Configuration;
  19. struct Interpreter;
  20. struct InstantiationError {
  21. ByteString error { "Unknown error" };
  22. };
  23. struct LinkError {
  24. enum OtherErrors {
  25. InvalidImportedModule,
  26. };
  27. Vector<ByteString> missing_imports;
  28. Vector<OtherErrors> other_errors;
  29. };
  30. AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, FunctionAddress, Arithmetic, Comparison, Increment);
  31. AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, ExternAddress, Arithmetic, Comparison, Increment);
  32. AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, TableAddress, Arithmetic, Comparison, Increment);
  33. AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, GlobalAddress, Arithmetic, Comparison, Increment);
  34. AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, ElementAddress, Arithmetic, Comparison, Increment);
  35. AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, DataAddress, Arithmetic, Comparison, Increment);
  36. AK_TYPEDEF_DISTINCT_NUMERIC_GENERAL(u64, MemoryAddress, Arithmetic, Comparison, Increment);
  37. // FIXME: These should probably be made generic/virtual if/when we decide to do something more
  38. // fancy than just a dumb interpreter.
  39. class Reference {
  40. public:
  41. struct Null {
  42. ValueType type;
  43. };
  44. struct Func {
  45. FunctionAddress address;
  46. };
  47. struct Extern {
  48. ExternAddress address;
  49. };
  50. using RefType = Variant<Null, Func, Extern>;
  51. explicit Reference(RefType ref)
  52. : m_ref(move(ref))
  53. {
  54. }
  55. auto& ref() const { return m_ref; }
  56. private:
  57. RefType m_ref;
  58. };
  59. class Value {
  60. public:
  61. Value()
  62. : m_value(0)
  63. {
  64. }
  65. using AnyValueType = Variant<i32, i64, float, double, u128, Reference>;
  66. explicit Value(AnyValueType value)
  67. : m_value(move(value))
  68. {
  69. }
  70. template<typename T>
  71. requires(sizeof(T) == sizeof(u64)) explicit Value(ValueType type, T raw_value)
  72. : m_value(0)
  73. {
  74. switch (type.kind()) {
  75. case ValueType::Kind::ExternReference:
  76. m_value = Reference { Reference::Extern { { bit_cast<u64>(raw_value) } } };
  77. break;
  78. case ValueType::Kind::FunctionReference:
  79. m_value = Reference { Reference::Func { { bit_cast<u64>(raw_value) } } };
  80. break;
  81. case ValueType::Kind::I32:
  82. m_value = static_cast<i32>(bit_cast<i64>(raw_value));
  83. break;
  84. case ValueType::Kind::I64:
  85. m_value = static_cast<i64>(bit_cast<u64>(raw_value));
  86. break;
  87. case ValueType::Kind::F32:
  88. m_value = static_cast<float>(bit_cast<double>(raw_value));
  89. break;
  90. case ValueType::Kind::F64:
  91. m_value = bit_cast<double>(raw_value);
  92. break;
  93. case ValueType::Kind::NullFunctionReference:
  94. VERIFY(raw_value == 0);
  95. m_value = Reference { Reference::Null { ValueType(ValueType::Kind::FunctionReference) } };
  96. break;
  97. case ValueType::Kind::NullExternReference:
  98. VERIFY(raw_value == 0);
  99. m_value = Reference { Reference::Null { ValueType(ValueType::Kind::ExternReference) } };
  100. break;
  101. case ValueType::Kind::V128:
  102. m_value = u128(0ull, bit_cast<u64>(raw_value));
  103. break;
  104. default:
  105. VERIFY_NOT_REACHED();
  106. }
  107. }
  108. template<SameAs<u128> T>
  109. explicit Value(T raw_value)
  110. : m_value(raw_value)
  111. {
  112. }
  113. ALWAYS_INLINE Value(Value const& value) = default;
  114. ALWAYS_INLINE Value(Value&& value) = default;
  115. ALWAYS_INLINE Value& operator=(Value&& value) = default;
  116. ALWAYS_INLINE Value& operator=(Value const& value) = default;
  117. template<typename T>
  118. ALWAYS_INLINE Optional<T> to() const
  119. {
  120. Optional<T> result;
  121. m_value.visit(
  122. [&](auto value) {
  123. if constexpr (IsSame<T, decltype(value)> || (!IsFloatingPoint<T> && IsSame<decltype(value), MakeSigned<T>>)) {
  124. result = static_cast<T>(value);
  125. } else if constexpr (!IsFloatingPoint<T> && IsConvertible<decltype(value), T>) {
  126. // NOTE: No implicit vector <-> scalar conversion.
  127. if constexpr (!IsSame<T, u128>) {
  128. if (AK::is_within_range<T>(value))
  129. result = static_cast<T>(value);
  130. }
  131. }
  132. },
  133. [&](u128 value) {
  134. if constexpr (IsSame<T, u128>)
  135. result = value;
  136. },
  137. [&](Reference const& value) {
  138. if constexpr (IsSame<T, Reference>) {
  139. result = value;
  140. } else if constexpr (IsSame<T, Reference::Func>) {
  141. if (auto ptr = value.ref().template get_pointer<Reference::Func>())
  142. result = *ptr;
  143. } else if constexpr (IsSame<T, Reference::Extern>) {
  144. if (auto ptr = value.ref().template get_pointer<Reference::Extern>())
  145. result = *ptr;
  146. } else if constexpr (IsSame<T, Reference::Null>) {
  147. if (auto ptr = value.ref().template get_pointer<Reference::Null>())
  148. result = *ptr;
  149. }
  150. });
  151. return result;
  152. }
  153. ValueType type() const
  154. {
  155. return ValueType(m_value.visit(
  156. [](i32) { return ValueType::Kind::I32; },
  157. [](i64) { return ValueType::Kind::I64; },
  158. [](float) { return ValueType::Kind::F32; },
  159. [](double) { return ValueType::Kind::F64; },
  160. [](u128) { return ValueType::Kind::V128; },
  161. [&](Reference const& type) {
  162. return type.ref().visit(
  163. [](Reference::Func const&) { return ValueType::Kind::FunctionReference; },
  164. [](Reference::Null const& null_type) {
  165. return null_type.type.kind() == ValueType::ExternReference ? ValueType::Kind::NullExternReference : ValueType::Kind::NullFunctionReference;
  166. },
  167. [](Reference::Extern const&) { return ValueType::Kind::ExternReference; });
  168. }));
  169. }
  170. auto& value() const { return m_value; }
  171. private:
  172. AnyValueType m_value;
  173. };
  174. struct Trap {
  175. ByteString reason;
  176. };
  177. // A variant of Result that does not include external reasons for error (JS::Completion, for now).
  178. class PureResult {
  179. public:
  180. explicit PureResult(Vector<Value> values)
  181. : m_result(move(values))
  182. {
  183. }
  184. PureResult(Trap trap)
  185. : m_result(move(trap))
  186. {
  187. }
  188. auto is_trap() const { return m_result.has<Trap>(); }
  189. auto& values() const { return m_result.get<Vector<Value>>(); }
  190. auto& values() { return m_result.get<Vector<Value>>(); }
  191. auto& trap() const { return m_result.get<Trap>(); }
  192. auto& trap() { return m_result.get<Trap>(); }
  193. private:
  194. friend class Result;
  195. explicit PureResult(Variant<Vector<Value>, Trap>&& result)
  196. : m_result(move(result))
  197. {
  198. }
  199. Variant<Vector<Value>, Trap> m_result;
  200. };
  201. class Result {
  202. public:
  203. explicit Result(Vector<Value> values)
  204. : m_result(move(values))
  205. {
  206. }
  207. Result(Trap trap)
  208. : m_result(move(trap))
  209. {
  210. }
  211. Result(JS::Completion completion)
  212. : m_result(move(completion))
  213. {
  214. VERIFY(m_result.get<JS::Completion>().is_abrupt());
  215. }
  216. Result(PureResult&& result)
  217. : m_result(result.m_result.downcast<decltype(m_result)>())
  218. {
  219. }
  220. auto is_trap() const { return m_result.has<Trap>(); }
  221. auto is_completion() const { return m_result.has<JS::Completion>(); }
  222. auto& values() const { return m_result.get<Vector<Value>>(); }
  223. auto& values() { return m_result.get<Vector<Value>>(); }
  224. auto& trap() const { return m_result.get<Trap>(); }
  225. auto& trap() { return m_result.get<Trap>(); }
  226. auto& completion() { return m_result.get<JS::Completion>(); }
  227. auto& completion() const { return m_result.get<JS::Completion>(); }
  228. PureResult assert_wasm_result() &&
  229. {
  230. VERIFY(!is_completion());
  231. return PureResult(move(m_result).downcast<Vector<Value>, Trap>());
  232. }
  233. private:
  234. Variant<Vector<Value>, Trap, JS::Completion> m_result;
  235. };
  236. using ExternValue = Variant<FunctionAddress, TableAddress, MemoryAddress, GlobalAddress>;
  237. class ExportInstance {
  238. public:
  239. explicit ExportInstance(ByteString name, ExternValue value)
  240. : m_name(move(name))
  241. , m_value(move(value))
  242. {
  243. }
  244. auto& name() const { return m_name; }
  245. auto& value() const { return m_value; }
  246. private:
  247. ByteString m_name;
  248. ExternValue m_value;
  249. };
  250. class ModuleInstance {
  251. public:
  252. explicit ModuleInstance(
  253. Vector<FunctionType> types, Vector<FunctionAddress> function_addresses, Vector<TableAddress> table_addresses,
  254. Vector<MemoryAddress> memory_addresses, Vector<GlobalAddress> global_addresses, Vector<DataAddress> data_addresses,
  255. Vector<ExportInstance> exports)
  256. : m_types(move(types))
  257. , m_functions(move(function_addresses))
  258. , m_tables(move(table_addresses))
  259. , m_memories(move(memory_addresses))
  260. , m_globals(move(global_addresses))
  261. , m_datas(move(data_addresses))
  262. , m_exports(move(exports))
  263. {
  264. }
  265. ModuleInstance() = default;
  266. auto& types() const { return m_types; }
  267. auto& functions() const { return m_functions; }
  268. auto& tables() const { return m_tables; }
  269. auto& memories() const { return m_memories; }
  270. auto& globals() const { return m_globals; }
  271. auto& elements() const { return m_elements; }
  272. auto& datas() const { return m_datas; }
  273. auto& exports() const { return m_exports; }
  274. auto& types() { return m_types; }
  275. auto& functions() { return m_functions; }
  276. auto& tables() { return m_tables; }
  277. auto& memories() { return m_memories; }
  278. auto& globals() { return m_globals; }
  279. auto& elements() { return m_elements; }
  280. auto& datas() { return m_datas; }
  281. auto& exports() { return m_exports; }
  282. private:
  283. Vector<FunctionType> m_types;
  284. Vector<FunctionAddress> m_functions;
  285. Vector<TableAddress> m_tables;
  286. Vector<MemoryAddress> m_memories;
  287. Vector<GlobalAddress> m_globals;
  288. Vector<ElementAddress> m_elements;
  289. Vector<DataAddress> m_datas;
  290. Vector<ExportInstance> m_exports;
  291. };
  292. class WasmFunction {
  293. public:
  294. explicit WasmFunction(FunctionType const& type, ModuleInstance const& module, Module::Function const& code)
  295. : m_type(type)
  296. , m_module(module)
  297. , m_code(code)
  298. {
  299. }
  300. auto& type() const { return m_type; }
  301. auto& module() const { return m_module; }
  302. auto& code() const { return m_code; }
  303. private:
  304. FunctionType m_type;
  305. ModuleInstance const& m_module;
  306. Module::Function const& m_code;
  307. };
  308. class HostFunction {
  309. public:
  310. explicit HostFunction(AK::Function<Result(Configuration&, Vector<Value>&)> function, FunctionType const& type)
  311. : m_function(move(function))
  312. , m_type(type)
  313. {
  314. }
  315. auto& function() { return m_function; }
  316. auto& type() const { return m_type; }
  317. private:
  318. AK::Function<Result(Configuration&, Vector<Value>&)> m_function;
  319. FunctionType m_type;
  320. };
  321. using FunctionInstance = Variant<WasmFunction, HostFunction>;
  322. class TableInstance {
  323. public:
  324. explicit TableInstance(TableType const& type, Vector<Optional<Reference>> elements)
  325. : m_elements(move(elements))
  326. , m_type(type)
  327. {
  328. }
  329. auto& elements() const { return m_elements; }
  330. auto& elements() { return m_elements; }
  331. auto& type() const { return m_type; }
  332. bool grow(size_t size_to_grow, Reference const& fill_value)
  333. {
  334. if (size_to_grow == 0)
  335. return true;
  336. auto new_size = m_elements.size() + size_to_grow;
  337. if (auto max = m_type.limits().max(); max.has_value()) {
  338. if (max.value() < new_size)
  339. return false;
  340. }
  341. auto previous_size = m_elements.size();
  342. if (m_elements.try_resize(new_size).is_error())
  343. return false;
  344. for (size_t i = previous_size; i < m_elements.size(); ++i)
  345. m_elements[i] = fill_value;
  346. return true;
  347. }
  348. private:
  349. Vector<Optional<Reference>> m_elements;
  350. TableType const& m_type;
  351. };
  352. class MemoryInstance {
  353. public:
  354. static ErrorOr<MemoryInstance> create(MemoryType const& type)
  355. {
  356. MemoryInstance instance { type };
  357. if (!instance.grow(type.limits().min() * Constants::page_size))
  358. return Error::from_string_literal("Failed to grow to requested size");
  359. return { move(instance) };
  360. }
  361. auto& type() const { return m_type; }
  362. auto size() const { return m_size; }
  363. auto& data() const { return m_data; }
  364. auto& data() { return m_data; }
  365. enum class InhibitGrowCallback {
  366. No,
  367. Yes,
  368. };
  369. bool grow(size_t size_to_grow, InhibitGrowCallback inhibit_callback = InhibitGrowCallback::No)
  370. {
  371. if (size_to_grow == 0)
  372. return true;
  373. u64 new_size = m_data.size() + size_to_grow;
  374. // Can't grow past 2^16 pages.
  375. if (new_size >= Constants::page_size * 65536)
  376. return false;
  377. if (auto max = m_type.limits().max(); max.has_value()) {
  378. if (max.value() * Constants::page_size < new_size)
  379. return false;
  380. }
  381. auto previous_size = m_size;
  382. if (m_data.try_resize(new_size).is_error())
  383. return false;
  384. m_size = new_size;
  385. // The spec requires that we zero out everything on grow
  386. __builtin_memset(m_data.offset_pointer(previous_size), 0, size_to_grow);
  387. // NOTE: This exists because wasm-js-api wants to execute code after a successful grow,
  388. // See [this issue](https://github.com/WebAssembly/spec/issues/1635) for more details.
  389. if (inhibit_callback == InhibitGrowCallback::No && successful_grow_hook)
  390. successful_grow_hook();
  391. return true;
  392. }
  393. Function<void()> successful_grow_hook;
  394. private:
  395. explicit MemoryInstance(MemoryType const& type)
  396. : m_type(type)
  397. {
  398. }
  399. MemoryType const& m_type;
  400. size_t m_size { 0 };
  401. ByteBuffer m_data;
  402. };
  403. class GlobalInstance {
  404. public:
  405. explicit GlobalInstance(Value value, bool is_mutable)
  406. : m_mutable(is_mutable)
  407. , m_value(move(value))
  408. {
  409. }
  410. auto is_mutable() const { return m_mutable; }
  411. auto& value() const { return m_value; }
  412. GlobalType type() const { return { m_value.type(), is_mutable() }; }
  413. void set_value(Value value)
  414. {
  415. VERIFY(is_mutable());
  416. m_value = move(value);
  417. }
  418. private:
  419. bool m_mutable { false };
  420. Value m_value;
  421. };
  422. class DataInstance {
  423. public:
  424. explicit DataInstance(Vector<u8> data)
  425. : m_data(move(data))
  426. {
  427. }
  428. size_t size() const { return m_data.size(); }
  429. Vector<u8>& data() { return m_data; }
  430. Vector<u8> const& data() const { return m_data; }
  431. private:
  432. Vector<u8> m_data;
  433. };
  434. class ElementInstance {
  435. public:
  436. explicit ElementInstance(ValueType type, Vector<Reference> references)
  437. : m_type(move(type))
  438. , m_references(move(references))
  439. {
  440. }
  441. auto& type() const { return m_type; }
  442. auto& references() const { return m_references; }
  443. private:
  444. ValueType m_type;
  445. Vector<Reference> m_references;
  446. };
  447. class Store {
  448. public:
  449. Store() = default;
  450. Optional<FunctionAddress> allocate(ModuleInstance& module, Module::Function const& function);
  451. Optional<FunctionAddress> allocate(HostFunction&&);
  452. Optional<TableAddress> allocate(TableType const&);
  453. Optional<MemoryAddress> allocate(MemoryType const&);
  454. Optional<DataAddress> allocate_data(Vector<u8>);
  455. Optional<GlobalAddress> allocate(GlobalType const&, Value);
  456. Optional<ElementAddress> allocate(ValueType const&, Vector<Reference>);
  457. FunctionInstance* get(FunctionAddress);
  458. TableInstance* get(TableAddress);
  459. MemoryInstance* get(MemoryAddress);
  460. GlobalInstance* get(GlobalAddress);
  461. DataInstance* get(DataAddress);
  462. ElementInstance* get(ElementAddress);
  463. private:
  464. Vector<FunctionInstance> m_functions;
  465. Vector<TableInstance> m_tables;
  466. Vector<MemoryInstance> m_memories;
  467. Vector<GlobalInstance> m_globals;
  468. Vector<ElementInstance> m_elements;
  469. Vector<DataInstance> m_datas;
  470. };
  471. class Label {
  472. public:
  473. explicit Label(size_t arity, InstructionPointer continuation)
  474. : m_arity(arity)
  475. , m_continuation(continuation)
  476. {
  477. }
  478. auto continuation() const { return m_continuation; }
  479. auto arity() const { return m_arity; }
  480. private:
  481. size_t m_arity { 0 };
  482. InstructionPointer m_continuation { 0 };
  483. };
  484. class Frame {
  485. public:
  486. explicit Frame(ModuleInstance const& module, Vector<Value> locals, Expression const& expression, size_t arity)
  487. : m_module(module)
  488. , m_locals(move(locals))
  489. , m_expression(expression)
  490. , m_arity(arity)
  491. {
  492. }
  493. auto& module() const { return m_module; }
  494. auto& locals() const { return m_locals; }
  495. auto& locals() { return m_locals; }
  496. auto& expression() const { return m_expression; }
  497. auto arity() const { return m_arity; }
  498. private:
  499. ModuleInstance const& m_module;
  500. Vector<Value> m_locals;
  501. Expression const& m_expression;
  502. size_t m_arity { 0 };
  503. };
  504. class Stack {
  505. public:
  506. using EntryType = Variant<Value, Label, Frame>;
  507. Stack() = default;
  508. [[nodiscard]] ALWAYS_INLINE bool is_empty() const { return m_data.is_empty(); }
  509. ALWAYS_INLINE void push(EntryType entry) { m_data.append(move(entry)); }
  510. ALWAYS_INLINE auto pop() { return m_data.take_last(); }
  511. ALWAYS_INLINE auto& peek() const { return m_data.last(); }
  512. ALWAYS_INLINE auto& peek() { return m_data.last(); }
  513. ALWAYS_INLINE auto size() const { return m_data.size(); }
  514. ALWAYS_INLINE auto& entries() const { return m_data; }
  515. ALWAYS_INLINE auto& entries() { return m_data; }
  516. private:
  517. Vector<EntryType, 1024> m_data;
  518. };
  519. using InstantiationResult = AK::Result<NonnullOwnPtr<ModuleInstance>, InstantiationError>;
  520. class AbstractMachine {
  521. public:
  522. explicit AbstractMachine() = default;
  523. // Validate a module; permanently sets the module's validity status.
  524. ErrorOr<void, ValidationError> validate(Module&);
  525. // Load and instantiate a module, and link it into this interpreter.
  526. InstantiationResult instantiate(Module const&, Vector<ExternValue>);
  527. Result invoke(FunctionAddress, Vector<Value>);
  528. Result invoke(Interpreter&, FunctionAddress, Vector<Value>);
  529. auto& store() const { return m_store; }
  530. auto& store() { return m_store; }
  531. void enable_instruction_count_limit() { m_should_limit_instruction_count = true; }
  532. private:
  533. Optional<InstantiationError> allocate_all_initial_phase(Module const&, ModuleInstance&, Vector<ExternValue>&, Vector<Value>& global_values, Vector<FunctionAddress>& own_functions);
  534. Optional<InstantiationError> allocate_all_final_phase(Module const&, ModuleInstance&, Vector<Vector<Reference>>& elements);
  535. Store m_store;
  536. StackInfo m_stack_info;
  537. bool m_should_limit_instruction_count { false };
  538. };
  539. class Linker {
  540. public:
  541. struct Name {
  542. ByteString module;
  543. ByteString name;
  544. ImportSection::Import::ImportDesc type;
  545. };
  546. explicit Linker(Module const& module)
  547. : m_module(module)
  548. {
  549. }
  550. // Link a module, the import 'module name' is ignored with this.
  551. void link(ModuleInstance const&);
  552. // Link a bunch of qualified values, also matches 'module name'.
  553. void link(HashMap<Name, ExternValue> const&);
  554. auto& unresolved_imports()
  555. {
  556. populate();
  557. return m_unresolved_imports;
  558. }
  559. AK::Result<Vector<ExternValue>, LinkError> finish();
  560. private:
  561. void populate();
  562. Module const& m_module;
  563. HashMap<Name, ExternValue> m_resolved_imports;
  564. HashTable<Name> m_unresolved_imports;
  565. Vector<Name> m_ordered_imports;
  566. Optional<LinkError> m_error;
  567. };
  568. }
  569. template<>
  570. struct AK::Traits<Wasm::Linker::Name> : public AK::DefaultTraits<Wasm::Linker::Name> {
  571. static constexpr bool is_trivial() { return false; }
  572. static unsigned hash(Wasm::Linker::Name const& entry) { return pair_int_hash(entry.module.hash(), entry.name.hash()); }
  573. static bool equals(Wasm::Linker::Name const& a, Wasm::Linker::Name const& b) { return a.name == b.name && a.module == b.module; }
  574. };