Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

125 Neutral

About m4ttbush

  • Rank

Personal Information

  1. Thanks Andreas, I was having the same issue with revision 1373, but I made the same changes in asCWriter::CalculateAdjustmentByPos() and asCReader::CalculateAdjustmentByPos() And everything seems to be working now! Does that sound right? Thanks!
  2. Thanks for the prompt fix Andreas! The bytecode saves out ok from 64 bit now. Unfortunately I'm still having issues with loading bytecode on 64 bit. The bytecode seems to load ok and it runs, but when it executes a function with an enum parameter, the other parameters get mangled. For example, I have a script function: void change_state(state_types new_state, int new_face) When the scripts are compiled on x64 it works fine, but when the bytecode is loaded again, the second parameter becomes the same value as the enum. Replacing state_types with int then casting it back to an enum to assign it fixes the problem. There was another case with a few enums and a string that caused a crash in the string assignment operator when the function was called. This was also fixed by replacing the enums with ints. The function I was originally having problems with also causes problems, so I'm assuming this is the same problem but manifesting itself in a different way. I'll see if I can isolate the problem again, I suspect it will just be a matter of reloading the bytecode in the test I posted earlier. Edit: Yep, using the same script as before but saving then loading the bytecode before executing it causes a crash, but it works if the enum is swapped for an int. Thanks for your help!
  3. Hey Andreas, I've managed to isolate the problem! Happens on both Windows and Linux 64 bit with 2.24.0a Looks like it's caused by an enum followed by a non-primitive type in a script function...: enum TestEnum { TestEnum_A } class NonPrimitive { } // Problem function void Foo( TestEnum e, NonPrimitive o ) { } void main() { NonPrimitive o; Foo( TestEnum_A, o ); // Crashes saving bytecode for where it's called } "NonPrimitive" can be value or reference, script or application class and it will crash, but primitive types work fine. Looks like it breaks in as_restore.cpp around line 3369 when it gets to the enum parameter. Maybe some kind of discrepancy in how enum parameters are treated? for( asUINT p = 0; p < calledFunc->parameterTypes.GetLength(); p++ ) { if( offset <= currOffset ) break; if( calledFunc->parameterTypes.GetObjectType() || calledFunc->parameterTypes.IsReference() ) { numPtrs++; currOffset += AS_PTR_SIZE; // offset is 1 on 32 bit and 64 bit, but this causes currOffset to be 2 on 64 bit } else { asASSERT( calledFunc->parameterTypes.IsPrimitive() ); currOffset += calledFunc->parameterTypes.GetSizeOnStackDWords(); } }
  4. m4ttbush

    Mac OS X 32-bits crash

    All of the tests passed with success.[/quote] Awesome. Thanks so much for your help with that, and I'm really glad you got it sorted without having to shell out for a new mac.
  5. m4ttbush

    Mac OS X 32-bits crash

    This is what I'm getting if I run just the native calling convention tests: Same in debug/release apple/gcc compiler AngelScript version: 2.23.1 WIP AngelScript options: AS_MAC AS_X86 -- TestExecute passed --- Assert failed --- func: void ExecuteString() mdle: ExecuteString sect: ExecuteString line: 1 --------------------- Failed on line 76 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp TestReturn: cfunction didn't return properly Failed on line 84 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp --- Assert failed --- func: void ExecuteString() mdle: ExecuteString sect: ExecuteString line: 1 --------------------- Failed on line 88 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp --- Assert failed --- func: void ExecuteString() mdle: ExecuteString sect: ExecuteString line: 1 --------------------- Failed on line 100 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp Failed on line 248 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp -------------------------------------------- One of the tests failed, see details above. [/quote] I'll see if I can get a better idea of what's going wrong, let me know if there's any other information I can give you. I don't know if you have any interest in upgrading your mac, and please don't feel obligated to do so. But I just made a small donation on behalf of Hitbox for your contribution to Dustforce, which might help out if you did want to upgrade. Thanks, Matt
  6. m4ttbush

    Mac OS X 32-bits crash

    Ah, you're right. If I put the function parameters in an array on the stack in the correct order, and pass that array in to the assembly code it works, in debug at least.
  7. m4ttbush

    Mac OS X 32-bits crash

    Unfortunately removing the UNUSED_VAR macros doesn't help. Are you sure it's not passing the address of the parameter? It looks correct here: http://snag.gy/q98dS.jpg Down the bottom of the image you can see that [font=courier new,courier,monospace]&args[/font] is [font=courier new,courier,monospace]0xbffff294[/font] [font=courier new,courier,monospace]&paramSize[/font] is [font=courier new,courier,monospace]0xbffff290 (-4)[/font] and [font=courier new,courier,monospace]&func[/font] is [font=courier new,courier,monospace]0xbffff28c (-8)[/font] And [font=courier new,courier,monospace]edx[/font] seems to be set to [font=courier new,courier,monospace]0xbffff294[/font]. Thanks for your help, and no rush, 1.22.1 is still working. And the mac build of Dustforce isn't out for another 3 weeks
  8. m4ttbush

    Mac OS X 32-bits crash

    Yep, this is in [font=courier new,courier,monospace]TestExecute()[/font] I tried that code, it still crashes. This is what it looks like when it crashes with call stack and disassembly: http://snag.gy/jDB74.jpg
  9. m4ttbush

    Mac OS X 32-bits crash

    I think I was on 10.7.2 and I updated to 10.7.3 when I updated Xcode. Can't remember if I tried 2.23.0 before updating or not, sorry. Here's the assembly for CallCDeclFunction, I think http://pastebin.com/VpMwk3HF Thanks Edit: Btw, it's crashing on line 47 of that paste, 2 lines after "[font=courier new,courier,monospace]copyloop:"[/font] at "[font=courier new,courier,monospace][color=#000000]pushl [color=#009900]([color=#339933]%[color=#00007F]eax[color=#009900])[color=#000000]"[/font]
  10. m4ttbush

    Mac OS X 32-bits crash

    Every one of the tests crashes inside [font=courier new,courier,monospace]CallSystemFunctionNative[/font] when it gets to "[font=courier new,courier,monospace]asm __volatile__[/font]" [font=courier new,courier,monospace]TestExecute [/font]crashes calling "[font=courier new,courier,monospace]cfunction[/font]" from "[font=courier new,courier,monospace]ExecuteString[/font]" [font=courier new,courier,monospace]TestCDeclReturn::Test[/font] crashes calling "[font=courier new,courier,monospace]reti64[/font]" from "[font=courier new,courier,monospace]ExecuteString[/font]" [font=courier new,courier,monospace]TestExecute1Arg [/font]crashes calling "[font=courier new,courier,monospace]cfunction[/font]" ...etc Only one that didn't crash was [font=courier new,courier,monospace]TestVirtualInheritance[/font], but I think it got skipped because virtual inheritance wasn't detected. Let me know if there's anything more I can do. Edit: I'm on OS 10.7.3 and Xcode 4.3.2 Edit 2: If I compile for 64 bit, all tests pass (Except TextVirtualInheritance which is skipped).
  11. m4ttbush

    Mac OS X 32-bits crash

    Hey Andreas, I'm having the same issue, I couldn't get the disassembly to work, but here's the assembly from what I think is the StringFactory function http://pastebin.com/UZagTvCa Let me know if there's anything else I can do.
  12. m4ttbush

    Porting Dustforce to OS X

    Thanks Andreas, I'll see if I can get a better idea of what's happening, my solution does feel like it's just hiding some underlying issue (which may well be in the compiler) I've come across some other strange behaviour, I'm not certain yet if it's related to AngelScript or not, but it also only occurs with optimisations enabled.. Will look in to it more tomorrow. Thanks
  13. m4ttbush

    Porting Dustforce to OS X

    Thanks Andreas, I'm using 32 bit Intel (i386), I haven't tried 64 bit, will do that today. I've only been using Xcode for a couple of days, so I'm not very proficient at using the debugger, but I'll try to narrow down where it's going wrong. Edit: Yep 64 bit works fine. Edit2: After some more digging around, it appears that the constructor is not returning a NULL pointer, and the value of retQW immediately after calling retQW = CallCDeclFunctionQWord(args, paramSize<<2, (size_t)func); is not 0, but if I print the value just outside the switch statement, it is 0. This might be due to some code being optimised away, but this seems to be where the pointer becomes null. Edit3: Kinda got it working, if I make retQW volatile it seems to prevent optimisations enough for it to work. This is using the GCC 4.2 compiler.
  14. m4ttbush

    Porting Dustforce to OS X

    Hey, I've started porting our game Dustforce to OS X, and it's going pretty well so far, the debug build is actually up and running. But as soon as I try to run the game with a release build of AngelScript I get a null pointer access on the first reference the code comes across which has been returned from the application (i.e. script classes being instantiated seem to work fine). And if I comment that code out, the next reference it tries to access is null, and so on. It seems to be when I enable optimisations, even the first level, if I disable optimisations in the release build it works, or enable them in the debug build it fails. To isolate the problem, I added the array add-on to the "tutorial" sample, and put this code in the script: array<uint> arr; arr.resize(5); And I get a null pointer access on arr.resize(5); I stepped in to the factory function and confirmed that it's not returning null... I'm using Xcode 4.2.1 and I've tried AngelScript 2.22.1 and 2.22.2 I've tried building from the included Xcode project file, and also just adding the AngelScript cpp files to the Dustforce project. I'll keep trying, but much of the internals of AngelScript are a bit over my head. Any help would be greatly appreciated. Thanks.
  15. m4ttbush

    Compile performance notes.

    Thanks Andreas! Your [font="Courier New"]IsKeyWord[/font] optimization is faster than mine, it's down to ~5 seconds with revision 1055 (: According to CodeAnalyst, about 30% of the remaining time is spent in [font="Courier New"]asCBuilder::GetFunctionDescriptions()[/font] And another 20% is spent in [font="Courier New"]asCompareStrings()[/font] [font="'Courier New"] [/font] Looks like speeding up those linear searches might help a bit, but don't worry about it too much if you have other things to do. Thanks for taking the time to help with this, I really appreciate it! -Matt
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!