diff options
author | Hendiadyoin1 <leon2002.la@gmail.com> | 2021-12-22 16:32:18 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-23 12:45:36 -0800 |
commit | c0d6afdc670d42bd89ff47718109625cf7c7231c (patch) | |
tree | 53d1f9bd915362d480baad9373b2340a0b4ab71e | |
parent | 95d2feed33047509d1fc3aa5eab3540d46a835c5 (diff) | |
download | serenity-c0d6afdc670d42bd89ff47718109625cf7c7231c.zip |
UserspaceEmulator: Avoid copies of non trivial types on invocations
These include AK::String and X86::Instruction
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.cpp | 6 | ||||
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.h | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index b38d26af97..829dca0a26 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -70,7 +70,7 @@ Emulator::Emulator(String const& executable_path, Vector<StringView> const& argu 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 // 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()); } -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; 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()); } -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); if (!symbol.has_value() || !symbol->source_position.has_value()) diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.h b/Userland/DevTools/UserspaceEmulator/Emulator.h index a39e13b888..90c4d8644f 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.h +++ b/Userland/DevTools/UserspaceEmulator/Emulator.h @@ -122,12 +122,12 @@ private: OwnPtr<MallocTracer> m_malloc_tracer; 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 setup_signal_trampoline(); 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$access(FlatPtr, size_t, int); @@ -243,7 +243,7 @@ private: MmapRegion const* load_library_from_address(FlatPtr address); MmapRegion const* first_region_for_object(StringView name); 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 }; int m_exit_status { 0 }; |