Hi,
I found a possible problem in the compiler/VM while working on my JIT.
While I can work around it easily (so it is low priority for me), I'm suspecting this could (very rarely) cause issues in AS.
The following code:
class Foo
{
Foo() {}
string s;
}
void repro()
{
Foo f;
}
Gives the following:
Function Foo::Foo()
scriptData.variableSpace: 0
scriptData.stackNeeded: 2
Disassembly:
0007: PshVPtr 0
0008: ADDSi 32
000a: ALLOC 93874889212816 19
0015: RET 2
In the VM, in the asBC_ALLOC handler, when the object to allocate is not a script object, the pointer to the allocated value is pushed to the stack. That means that at that point, two pointers have been pushed to the stack.
This is in 64-bit. Both pointers should require 4 DWORDs on the stack, yet, scriptData.stackNeeded == 2.
Since my JIT relies on scriptData.stackNeeded to determine the size of the local stack allocation, I believe I will just add the pointer size in DWORDs to that, which should suffice to work around the issue.