mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWasm: Utilise direct threading if/when possible
~50% performance improvement on coremark.
This commit is contained in:
parent
cf30d61d8b
commit
02b3c4f8a9
File diff suppressed because it is too large
Load Diff
|
|
@ -61,10 +61,9 @@ struct WASM_API BytecodeInterpreter final : public Interpreter {
|
|||
IndirectCall,
|
||||
};
|
||||
|
||||
template<bool HasCompiledList, bool HasDynamicInsnLimit>
|
||||
template<bool HasCompiledList, bool HasDynamicInsnLimit, bool HaveDirectThreadingInfo>
|
||||
void interpret_impl(Configuration&, Expression const&);
|
||||
|
||||
protected:
|
||||
InstructionPointer branch_to_label(Configuration&, LabelIndex);
|
||||
template<typename ReadT, typename PushT>
|
||||
bool load_and_push(Configuration&, Instruction const&, SourcesAndDestination const&);
|
||||
|
|
@ -97,6 +96,12 @@ protected:
|
|||
template<typename PopType, typename PushType, typename Operator, typename... Args>
|
||||
bool unary_operation(Configuration&, SourcesAndDestination const&, Args&&...);
|
||||
|
||||
ALWAYS_INLINE bool set_trap(StringView reason)
|
||||
{
|
||||
m_trap = Trap { ByteString(reason) };
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T read_value(ReadonlyBytes data);
|
||||
|
||||
|
|
@ -119,6 +124,7 @@ protected:
|
|||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
Variant<Trap, Empty> m_trap;
|
||||
StackInfo const& m_stack_info;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@ public:
|
|||
|
||||
void set_frame(Frame frame)
|
||||
{
|
||||
Label label(frame.arity(), frame.expression().instructions().size() - 1, m_value_stack.size());
|
||||
auto continuation = frame.expression().instructions().size() - 1;
|
||||
if (auto size = frame.expression().compiled_instructions.dispatches.size(); size > 0)
|
||||
continuation = size - 1;
|
||||
Label label(frame.arity(), continuation, m_value_stack.size());
|
||||
frame.label_index() = m_label_stack.size();
|
||||
if (auto hint = frame.expression().stack_usage_hint(); hint.has_value())
|
||||
m_value_stack.ensure_capacity(*hint + m_value_stack.size());
|
||||
|
|
|
|||
|
|
@ -535,7 +535,10 @@ struct Dispatch {
|
|||
Stack = CountRegisters,
|
||||
};
|
||||
|
||||
OpCode instruction_opcode;
|
||||
union {
|
||||
OpCode instruction_opcode;
|
||||
FlatPtr handler_ptr;
|
||||
};
|
||||
Instruction const* instruction { nullptr };
|
||||
union {
|
||||
struct {
|
||||
|
|
@ -548,6 +551,7 @@ struct Dispatch {
|
|||
struct CompiledInstructions {
|
||||
Vector<Dispatch> dispatches;
|
||||
Vector<Instruction, 0, FastLastAccess::Yes> extra_instruction_storage;
|
||||
bool direct = false; // true if all dispatches contain handler_ptr, otherwise false and all contain instruction_opcode.
|
||||
};
|
||||
|
||||
struct SectionId {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user