Justin L. Kennedy
2004-11-19 22:59:11 UTC
I am preparing to write a simple JIT compiler in ANSI C89 (compiled by
GCC) for simple floating point arithmetic expressions. I want to add
support so that users can ask for operations that aren't done directly in
assembly such as C's arcsin and pow functions. This means that the
function the JIT writes will be inserting calls to functions in libc which
I have no control over.
Since the x86 floating point stack is only 8 operands high, how do I make
sure that the operands I put on the stack along with the operands these
other functions may put on the stack will not be more than 8? Does the
processor spill those registers onto the call stack automatically when I
use the CALL instruction, or is it controlled by call conventions specific
to processors? I haven't seen this issue addressed in the tutorials I
have looked at. All the examples just add onto the stack when their
functions enter and do nothing when they call other functions, which
leads me to believe that either the processor handles this automatically
or they are just really bad examples.
GCC) for simple floating point arithmetic expressions. I want to add
support so that users can ask for operations that aren't done directly in
assembly such as C's arcsin and pow functions. This means that the
function the JIT writes will be inserting calls to functions in libc which
I have no control over.
Since the x86 floating point stack is only 8 operands high, how do I make
sure that the operands I put on the stack along with the operands these
other functions may put on the stack will not be more than 8? Does the
processor spill those registers onto the call stack automatically when I
use the CALL instruction, or is it controlled by call conventions specific
to processors? I haven't seen this issue addressed in the tutorials I
have looked at. All the examples just add onto the stack when their
functions enter and do nothing when they call other functions, which
leads me to believe that either the processor handles this automatically
or they are just really bad examples.
--
Justin L. Kennedy
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: ***@prism.gatech.edu
Justin L. Kennedy
Georgia Institute of Technology, Atlanta Georgia, 30332
Email: ***@prism.gatech.edu