What is a stack map frame

Java requires all classes that are loaded to be verified, in order to maintain the security of the sandbox and ensure that the code is safe to optimize. Note that this is done on the bytecode level, so the verification does not verify invariants of the Java language, it merely verifies that the bytecode makes … Read more

“enter” vs “push ebp; mov ebp, esp; sub esp, imm” and “leave” vs “mov esp, ebp; pop ebp”

There is a performance difference, especially for enter. On modern processors this decodes to some 10 to 20 µops, while the three instruction sequence is about 4 to 6, depending on the architecture. For details consult Agner Fog’s instruction tables. Additionally the enter instruction usually has a quite high latency, for example 8 clocks on … Read more

Function Prologue and Epilogue in C

There are lots of resources out there that explain this: Function prologue (Wikipedia) x86 Disassembly/Calling Conventions (WikiBooks) Considerations for Writing Prolog/Epilog Code (MSDN) to name a few. Basically, as you somewhat described, “the stack” serves several purposes in the execution of a program: Keeping track of where to return to, when calling a function Storage … Read more

What is the difference between parent.frame() and parent.env() in R; how do they differ in call by reference?

parent.env is the environment in which a closure (e.g., function) is defined. parent.frame is the environment from which the closure was invoked. f = function() c(f=environment(), defined_in=parent.env(environment()), called_from=parent.frame()) g = function() c(g=environment(), f()) and then > g() $g <environment: 0x14060e8> $f <environment: 0x1405f28> $defined_in <environment: R_GlobalEnv> $called_from <environment: 0x14060e8> I’m not sure when a mere … Read more