angelscript and xcode 2.4
http://www.outoforder.cc/downloads/patches/
PPCfix3.diff is the difference from current trunk to my changes
angelscript-2006-10-09.zip is the entire local WC.
Every test is working in AS_MAX_PORTABILITY except for the _switch2() function and the uint8 problem.
all instructions seem to be working fine except for the INCi8 which assumes an 8bit variable where as w/ the case of the switch you are using a 32bit var on the l_fp being treated as an 8bit. And I can not just change the INCi8 to assume it's a 32bit (and cast it) as if a real native 8bit variable were to be incremented it would not work. correct me if I'm wrong, however. As a nice simple fix would be
case BC_INCi8:
((char)(**(asDWORD**)®ister1))++
thus treating it as a word and only casting as a char, so it would increment correctly in both environments.
Right now I'm at a standstill until we figure how to resolve these byte conversions. I may try making some more tests to test other crazy scenarios.
Oh, BTW. All my changes work perfectly on my linux x86 box in AS_MAX_PORTABILITY mode. (have not tested regular mode).
There were a couple of errors though:
case BC_INCi:- ++(*(int*)(size_t)register1);+ ++(*(int*)(size_t*)& register1); l_bc++; break; case BC_DECi:- --(*(int*)(size_t)register1);+ --(*(int*)(size_t*)& register1); l_bc++; break;
You forgot to dereference the pointer before casting to (int*) in these two changes. But you probably already noticed that.
I added a couple of new asserts in the asCreateScriptEngine() function so that we can validate the assumptions taken in the library code. If what you're saying, that sizeof(bool) is 4 then the assert will fail, which means that I'll have to adopt the code for this.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
The problem with _switch2() can only be solved with the proper conversion of the 8bit value to 32bit before comparison. Which means that I'll have to implement the changes that I planned out before.
In either case it feels very good that the library is now working on PPC as well. (At least if you're careful when mixing variables of different sizes. [wink])
A big thank you for your efforts with this port. I'll add your name to the list of contributors. [smile]
Regards,
Andreas
PS. I also need to verify that all these changes haven't broken the 64bit support. But hopefully it should only have caused a few compiler warnings.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Quote: Original post by WitchLord
There were a couple of errors though:case BC_INCi:- ++(*(int*)(size_t)register1);+ ++(*(int*)(size_t*)& register1); l_bc++; break; case BC_DECi:- --(*(int*)(size_t)register1);+ --(*(int*)(size_t*)& register1); l_bc++; break;
You forgot to dereference the pointer before casting to (int*) in these two changes. But you probably already noticed that.
I noticed that already and it's fixed in the last update you have.
Quote: Original post by WitchLord
I added a couple of new asserts in the asCreateScriptEngine() function so that we can validate the assumptions taken in the library code. If what you're saying, that sizeof(bool) is 4 then the assert will fail, which means that I'll have to adopt the code for this.
PPC has a 4 byte bool (no clue why but it does), thus it fails the assert.
hmm.. excerpt from the Apple manual
Quote:
A long double is 16 bytes on both architectures, but only 80 bits are significant in long double data types on Intel-based Macintosh computers.
A bool data type is a single byte on an x86 system, but four bytes on a PowerPC architecture. This size difference can cause alignment problems. You should use fixed-size data types to avoid alignment problems. (The bool data type is not the Carbon Boolean type, which is a fixed size of 1 byte.)
And you can't rely on the fact that the PPC has a 4 byte bool either.. AS there is a compiler option to turn it into a one byte bool. However the likelyhood of that setting being enabled is very rare as it can introduce binary compatability problems with other libraries.
Oh and an interesting bit of random information from the Apple manual
Quote:
The terms big-endian and little-endian come from Jonathan Swift’s eighteenth-century satire Gulliver’s Travels. The subjects of the empire of Blefuscu were divided into two factions: those who ate eggs starting from the big end and those who ate eggs starting from the little end.
Windows x86 with MSVC -- all tests passedLinux AMD64 with gnuc -- all tests passedLinux PPC with gnuc -- test_conversion and test_switch failed, the rest passed
I didn't have time to check out exactly why the test_conversion failed. But it is likely due to the mix of datatypes, which still needs to be fixed. In test_switch it is the _switch2 that fails, much as you reported.
Did test_conversion work for you, or did you comment out some part of it?
When I get the time I'll implement the proper conversion between types of different sizes so that this too will work on PPC (and other big-endian CPUs).
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Quote: Original post by WitchLord
I've updated the SVN with your latest changes. And also made the size of bool configurable, so that it is now correct on MacOSX with PPC. I also ran some tests on a couple of different systems (thanks to SourceForge.net's compile farm).Windows x86 with MSVC -- all tests passedLinux AMD64 with gnuc -- all tests passedLinux PPC with gnuc -- test_conversion and test_switch failed, the rest passed
I didn't have time to check out exactly why the test_conversion failed. But it is likely due to the mix of datatypes, which still needs to be fixed. In test_switch it is the _switch2 that fails, much as you reported.
Did test_conversion work for you, or did you comment out some part of it?
Yes, test_conversion worked for me without any changes.. hmm. I'll have to log into the compile farm myself and test it.
I guess the next step for me is to disable the MAX PORTABILITY option and try and get native calling working..
I haven't finished the changes needed to literal constants however, so any tests involving 8bit or 16bit literals are likely to break at the moment. I've added a new set of TODO: PPC: for these changes however, if anyone is interested in taking a look at it.
Soon everything should be working smoothly even on PPC. :D (native calling conventions will be a bit longer)
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Anyway, I'm happy you have the patience to really look into this. It's really appreciated.
Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game