Why does the Mac ABI require 16-byte stack alignment for x86-32?

From “Intel®64 and IA-32 Architectures Optimization Reference Manual”, section 4.4.2: “For best performance, the Streaming SIMD Extensions and Streaming SIMD Extensions 2 require their memory operands to be aligned to 16-byte boundaries. Unaligned data can cause significant performance penalties compared to aligned data.” From Appendix D: “It is important to ensure that the stack frame … Read more

Does java have any mechanism for a VM to trace method calls on itself, without using javaagent, etc?

There is no such API provided by the JVM— even for agents started with -javaagent. The JVM TI is a native interface provided for native agents started with the -agent option or for debuggers. Java agents might use the Instrumentation API which provides the lowlevel feature of class instrumentation but no direct profiling capability. There … Read more

How do I print functions as they are called?

You can do this with a trace function (props to Spacedman for improving the original version of this to trace returns and use some nice indenting): def tracefunc(frame, event, arg, indent=[0]): if event == “call”: indent[0] += 2 print(“-” * indent[0] + “> call function”, frame.f_code.co_name) elif event == “return”: print(“<” + “-” * indent[0], … Read more