New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructors are broken in 2.27.0 #4
Comments
I'm seeing this same behavior with 2.27.1 |
Which case within context->GetAddressOfReturnValue() is returning the null? I compared everywhere that those returns are set within AngelScript and the jit and didn't see a disagreement, so it would help to narrow it down. |
I'll try to come up with a small test case, maybe Justin has one handy, I only ran into this problem about 30 mins ago.. |
The jit seems to not compile any scripts at all in 2.27.1 for me at this point. This is the very first script that is compiled in my engine: shared class Base_Object //=========== Events =============
//======= Collision =========
//========== Misc ===========
//======= Variables ========= //******************************************************************************************************************* I'm thinking there's problem with classes because it doesn't fail when compiling just a simple function. The assert in the following code section fails because there is a null pointer to scriptData: void asCScriptFunction::JITCompile()
.......... Even something as simple as this doesn't compile: class test Now with further investigation I found that the function for "t()" in the virtual function table of asIObjectType is valid. Shouldn't angelscript be calling JITCompile() on this function? |
Ok, forget everything above. That was a bug in 2.27.1. Now that I've updated to the WIP version, the problem is back. The context never sets a valid pointer to the object register, so in turn GetAddressOfReturnValue only returns a null pointer. This doesn't happen with the jit disabled, so I'm assuming something changed with the way classes are constructed. |
As far as I can see objectRegister is set by the JIT in identical ways to AngelScript. I need to know which return "void *asCContext::GetAddressOfReturnValue()" is returning 0 from. |
if( !dt->IsObjectHandle() )
|
Very few areas touch objectRegister, and they're very simple, so I can't see what's going wrong. Is the function returning 0, or a pointer to a 0? |
It returns the null pointer that is stored in the object register. This seems to happen with all of my constructors. |
This line: |
Sorry for the confusion. It returns a null pointer, not a value of 0. |
So you're saying "return &m_regs.objectRegister" is returning a null pointer? That shouldn't be possible. |
That's what's happening. |
I don't see what that could have to do with the jit. That statement cannot return a null pointer unless "this" is null and both m_regs and objectRegister are at 0 offset of their base class. Have you tried recompiling AngelScript/your project? |
I've recompiled both AngelScript and my project numerous times and the results are still the same. The "this" pointer checks fine, both in the context and in my code, and m_regs is fine as far as I can tell, I.E. it holds similar values as it would without JIT instructions enabled, but m_regs.objectRegister points to a null address. I tried this simple test case: SCRIPT: CODE: CreateScriptObject nearly uses identical code to that of which I was using the call the "test" class' constructor. As I figured, it fails after attempting to increase the reference counter of the script object because it points to a null address. This same code works without JIT instructions enabled. |
asIScriptEngine::CreateScriptObject works for me. I am unable to reproduce your issue. |
In 2.27.1 correct? |
Can you upload an executable and the source or a msvc project? |
We're using the SVN build which has variably been 2.26, 2.27, and 2.28 over time. I cannot provide executable or source for our project. |
I didn't mean upload your major project (by all means, don't do that lol), but a test program and/or its source where you've gotten it to work with the latest version of AS. I've gone as far as integrating the jit code directly into the angelscript project and recompiling the libs, but I'm still getting the same problem. I hope I'm not asking for too much. |
I've pushed all of our local changes to the JIT. We are using the most recent SVN version of AngelScript, and experience no issues with CreateScriptObejct or similar code. |
I'm still having the same problem, so I've made a simple Console app that isolates the issue: This is with angelscript revision 1725 and your updated JIT code. |
That is built with Visual Studio 2012, which I am not using. It is possible 2012 has some incompatibility with the jit that 2010 does not have. |
I don't know what the problem could be. I get the same error even when compiling with the Visual Studio 2010 platform toolset. Here is the VS 2010 version of things: |
Adding the following JIT setting temporarily fixed my problem: JIT_NO_SCRIPT_CALLS Don't know if that helps or not, but figured I would mention it.. |
I knew of an issue during jit-compile with script calls, but I wasn't aware they were having destructive side effects during execution. I'll look into it. |
Angelscript's callstack size changed and that value is not accessible from outside as_context.cpp. I updated the value for the JIT which should fix script calls, and hopefully the issue in general. Please reopen if the issue persists. |
Apparently, a null pointer is stored in the object register after the constructor of a script class is executed. I'm using the method outlined in the manual to instantiate a script class from C++. The code worked fine in 2.26.3, but it does not in 2.27.0 with JIT enabled.
void Object::CallConstructor()
{
if (constructorCalled)
return;
}
The text was updated successfully, but these errors were encountered: