Author: Timm Baeder
Date: 2026-08-30T09:14:54+02:00
New Revision: 450ef6da8290db16322dcd75dbaf76634b52d5f2

URL: 
https://github.com/llvm/llvm-project/commit/450ef6da8290db16322dcd75dbaf76634b52d5f2
DIFF: 
https://github.com/llvm/llvm-project/commit/450ef6da8290db16322dcd75dbaf76634b52d5f2.diff

LOG: [clang][bytecode] Shrink `InterpFrame` size a bit (#219765)

Reorder members to reduce the size from 80 to 72 bytes (debug builds on
64bit systems).

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/InterpFrame.cpp
    clang/lib/AST/ByteCode/InterpFrame.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/InterpFrame.cpp 
b/clang/lib/AST/ByteCode/InterpFrame.cpp
index 8111cba9e319c..c41190dd26b2d 100644
--- a/clang/lib/AST/ByteCode/InterpFrame.cpp
+++ b/clang/lib/AST/ByteCode/InterpFrame.cpp
@@ -24,13 +24,14 @@ using namespace clang;
 using namespace clang::interp;
 
 InterpFrame::InterpFrame(InterpState &S)
-    : Caller(nullptr), S(S), Depth(0), Func(nullptr), RetPC(CodePtr()),
-      ArgSize(0), Args(nullptr) {}
+    : Caller(nullptr), S(S), Func(nullptr), RetPC(CodePtr()), Args(nullptr),
+      ArgSize(0), Depth(0) {}
 
 InterpFrame::InterpFrame(InterpState &S, const Function *Func,
                          InterpFrame *Caller, CodePtr RetPC, unsigned ArgSize)
-    : Caller(Caller), S(S), Depth(Caller ? Caller->Depth + 1 : 0), Func(Func),
-      RetPC(RetPC), ArgSize(ArgSize), Args(static_cast<char *>(S.Stk.top())) {
+    : Caller(Caller), S(S), Func(Func), RetPC(RetPC),
+      Args(static_cast<char *>(S.Stk.top())), ArgSize(ArgSize),
+      Depth(Caller ? Caller->Depth + 1 : 0) {
 #ifndef NDEBUG
   FrameOffset = S.Stk.size();
 #endif

diff  --git a/clang/lib/AST/ByteCode/InterpFrame.h 
b/clang/lib/AST/ByteCode/InterpFrame.h
index 3322136372846..c195165e6219f 100644
--- a/clang/lib/AST/ByteCode/InterpFrame.h
+++ b/clang/lib/AST/ByteCode/InterpFrame.h
@@ -26,9 +26,6 @@ class Pointer;
 /// Frame storing local variables.
 class InterpFrame final : public Frame {
 public:
-  /// The frame of the previous function.
-  InterpFrame *Caller;
-
   /// Bottom Frame.
   InterpFrame(InterpState &S);
 
@@ -220,23 +217,27 @@ class InterpFrame final : public Frame {
     return reinterpret_cast<InlineDescriptor *>(locals() + Offset);
   }
 
+public:
+  /// The frame of the previous function.
+  InterpFrame *Caller;
+
 private:
   /// Reference to the interpreter state.
   InterpState &S;
-  /// Depth of this frame.
-  unsigned Depth;
   /// Reference to the function being executed.
   const Function *Func;
   /// Return address.
   CodePtr RetPC;
-  /// The size of all the arguments.
-  const unsigned ArgSize;
   /// Pointer to the arguments in the callee's frame.
   char *Args = nullptr;
 #ifndef NDEBUG
   /// Offset on the stack at entry.
   size_t FrameOffset = 0;
 #endif
+  /// The size of all the arguments.
+  const unsigned ArgSize;
+  /// Depth of this frame.
+  unsigned Depth;
 
 public:
   unsigned MSVCConstexprAllowed = 0;


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to