소스 검색

Kernel: Specify inline capacity of return type in capture_stack_trace

Since the inline capacity of the Vector return type was not specified
explicitly, the vector was automatically copied to a 0-length inline
capacity one, essentially eliminating the optimization.
Idan Horowitz 3 년 전
부모
커밋
03b7352286
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      Kernel/Arch/x86/Processor.h
  2. 1 1
      Kernel/Arch/x86/common/Processor.cpp

+ 1 - 1
Kernel/Arch/x86/Processor.h

@@ -398,7 +398,7 @@ public:
     NEVER_INLINE void switch_context(Thread*& from_thread, Thread*& to_thread);
     NEVER_INLINE void switch_context(Thread*& from_thread, Thread*& to_thread);
     [[noreturn]] static void assume_context(Thread& thread, FlatPtr flags);
     [[noreturn]] static void assume_context(Thread& thread, FlatPtr flags);
     FlatPtr init_context(Thread& thread, bool leave_crit);
     FlatPtr init_context(Thread& thread, bool leave_crit);
-    static Vector<FlatPtr> capture_stack_trace(Thread& thread, size_t max_frames = 0);
+    static Vector<FlatPtr, 32> capture_stack_trace(Thread& thread, size_t max_frames = 0);
 
 
     static StringView platform_string();
     static StringView platform_string();
 };
 };

+ 1 - 1
Kernel/Arch/x86/common/Processor.cpp

@@ -491,7 +491,7 @@ const DescriptorTablePointer& Processor::get_gdtr()
     return m_gdtr;
     return m_gdtr;
 }
 }
 
 
-Vector<FlatPtr> Processor::capture_stack_trace(Thread& thread, size_t max_frames)
+Vector<FlatPtr, 32> Processor::capture_stack_trace(Thread& thread, size_t max_frames)
 {
 {
     FlatPtr frame_ptr = 0, ip = 0;
     FlatPtr frame_ptr = 0, ip = 0;
     Vector<FlatPtr, 32> stack_trace;
     Vector<FlatPtr, 32> stack_trace;