x86 registers are used in this manner:
| Register | Usage | Function Entry | Function Return | Function Code |
| esp | Stack pointer. Used for local variables and arguments. | Pointer to arguments. | Pointer to return location | Local stack usage |
| ebp | Contains a copy of esp after function entry. | ignored | Restored by function before return to caller. | Holds pointer to arguments and locals. |
| eip | n/a | n/a | n/a | |
| eax | not used | Return value | General usage | |
| ebx | not used | Return value for 8 byte returns. | General usage | |
| ecx | not used | Function return flags | General usage | |
| edx | not used | not used | General usage | |
| esi | not used | not used | General usage | |
| edi | not used | not used | General usage | |
Arguments are passed right to left. So if foo(int a, int b) then:
EBP is used because it is initialized to ESP on function entry and ESP is further used for stack work in each method. Objects are stored on the stack as pointers. All pointers are 32 bit as currently we only support x86. In the future we will support x64.
Registers marked as general usage may be used in the function, however their values will not be preserved when other functions are called as they can make use of these registers as well.
Currently we use a fairly standard calling convention for x86 processors. However initial tests show that it is extremely inefficient and we believe large gains can be made by creating a custom calling convention, beyond even possible register call semantics which we may also use.
Overhead for exceptions is acceptable when exceptions are active, but exception checking code that must occur when no exceptions occur should be minimal.
| Bit | Meaning |
| All bits = 0 | No action required. |
| Bit 0 | 0 = No action required. If this bit is 0, all other bits should be 0 to allow more efficient
testing of the value without the need to check the individual bit. 1 = Remaining bits contain values in need of attention. This bit is used so that if all other bits happen to be 0, but 0 is meaningful this flag can be set to trigger their inspection. |
| Bit 1 | 0 = No exception is active |