1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 12:35:06 +00:00

UserspaceEmulator: Avoid copies of non trivial types on invocations

These include AK::String and X86::Instruction
This commit is contained in:
Hendiadyoin1 2021-12-22 16:32:18 +01:00 committed by Brian Gianforcaro
parent 95d2feed33
commit c0d6afdc67
2 changed files with 6 additions and 6 deletions

View file

@ -70,7 +70,7 @@ Emulator::Emulator(String const& executable_path, Vector<StringView> const& argu
setup_signal_trampoline(); setup_signal_trampoline();
} }
Vector<ELF::AuxiliaryValue> Emulator::generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, String executable_path, int executable_fd) const Vector<ELF::AuxiliaryValue> Emulator::generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, String const& executable_path, int executable_fd) const
{ {
// FIXME: This is not fully compatible with the auxiliary vector the kernel generates, this is just the bare // FIXME: This is not fully compatible with the auxiliary vector the kernel generates, this is just the bare
// minimum to get the loader going. // minimum to get the loader going.
@ -486,7 +486,7 @@ void Emulator::emit_profile_sample(AK::OutputStream& output)
output.write_or_error(builder.string_view().bytes()); output.write_or_error(builder.string_view().bytes());
} }
void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_name, String contents) void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_name, String const& contents)
{ {
StringBuilder builder; StringBuilder builder;
timeval tv {}; timeval tv {};
@ -496,7 +496,7 @@ void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_nam
output.write_or_error(builder.string_view().bytes()); output.write_or_error(builder.string_view().bytes());
} }
String Emulator::create_instruction_line(FlatPtr address, X86::Instruction insn) String Emulator::create_instruction_line(FlatPtr address, X86::Instruction const& insn)
{ {
auto symbol = symbol_at(address); auto symbol = symbol_at(address);
if (!symbol.has_value() || !symbol->source_position.has_value()) if (!symbol.has_value() || !symbol->source_position.has_value())

View file

@ -122,12 +122,12 @@ private:
OwnPtr<MallocTracer> m_malloc_tracer; OwnPtr<MallocTracer> m_malloc_tracer;
void setup_stack(Vector<ELF::AuxiliaryValue>); void setup_stack(Vector<ELF::AuxiliaryValue>);
Vector<ELF::AuxiliaryValue> generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, String executable_path, int executable_fd) const; Vector<ELF::AuxiliaryValue> generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, String const& executable_path, int executable_fd) const;
void register_signal_handlers(); void register_signal_handlers();
void setup_signal_trampoline(); void setup_signal_trampoline();
void emit_profile_sample(AK::OutputStream&); void emit_profile_sample(AK::OutputStream&);
void emit_profile_event(AK::OutputStream&, StringView event_name, String contents); void emit_profile_event(AK::OutputStream&, StringView event_name, String const& contents);
int virt$accept4(FlatPtr); int virt$accept4(FlatPtr);
int virt$access(FlatPtr, size_t, int); int virt$access(FlatPtr, size_t, int);
@ -243,7 +243,7 @@ private:
MmapRegion const* load_library_from_address(FlatPtr address); MmapRegion const* load_library_from_address(FlatPtr address);
MmapRegion const* first_region_for_object(StringView name); MmapRegion const* first_region_for_object(StringView name);
String create_backtrace_line(FlatPtr address); String create_backtrace_line(FlatPtr address);
String create_instruction_line(FlatPtr address, X86::Instruction insn); String create_instruction_line(FlatPtr address, X86::Instruction const& insn);
bool m_shutdown { false }; bool m_shutdown { false };
int m_exit_status { 0 }; int m_exit_status { 0 };