Open
Description
- When allocating a new
InterpFrame
, we do that as aunique_ptr
, which causes a heap allocation. In the constructor, we immediately do another heap allocation forLocals
. Can we do this in one allocation? Does it make sense to add an allocator for this toInterpState
? Does the fact that we have a stack based allocation scheme (LIFO basically) help us at all here? We currently createFunction
instances for all builtin functions. However, we rarely use them later, since the classified argument calls, etc. don't always match what we actually have on the stack and we instead need to look at theirCallExpr
. Can we do without theFunction
instance for builtins?OffsetHelper
inInterp.h
currently pushes the new value to the stack, but some callers pop it immediately again to use the new pointer (e.g. inArrayElemPtr
, we callNarrowPtr
). Stop doing that and instead return the new value.- In
Block::invokeCtor
, we callmemset()
on the entire data of the block, and then follow it by calling the ctor function, which will overwrite the entire data again (hopefully). Remove that memset call. Simply doing that caused some problems for me in the past, so there's more to it than just that. - We do create full
Block
s for dummy pointers these days, even though we can never actually access their data. We only ever look at theInlineDescriptors
we set via theirCtorFn
. Does it improve performance if we don't initialize the data fields of dummy blocks? - The implementation for
__builtin_bit_cast
copies everything bit-by-bit into a buffer and out again. However, the majority of cases uses full byte values. We could optimize that. Probably even the target-endianness==host-endianness case. - When copying
Pointer
instances (e.g. when iterating up the hierarchy of aPointer
), the pointer adds itself to the pointer chain of the block. This is often unnecessary.