the dreaded 64-bit compile

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark

Locked
monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: the dreaded 64-bit compile

Post by monte » Thu Apr 18, 2013 1:07 am

Wonder why it was done that way originally?

Also is there a reason we can't just include stdint.h other than the fact that we are using an old version of MSVC that doesn't have it? There's a public domain one here for windows if we need it: http://snipplr.com/view/18199/stdinth/
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1232
Joined: Thu Apr 11, 2013 11:27 am

Re: the dreaded 64-bit compile

Post by LCMark » Thu Apr 18, 2013 8:27 am

Memory overhead... A malloc'd block typically has between 8-16 bytes of overhead (depending on the system), so if you allocate 3 that 24-48 bytes gone immediately without any space for the data. Also, they are typically rounded up to the nearest 8 or 16 byte boundary size wise. At the time MCPath was written I had envisaged it being used much more than it actually is so it seem prudent to make it efficient.

In terms of using stdint.h the reason it isn't used is because it was never widely enough available at the time for it to be usable. Instead, the appropriate definitions were pulled into typedefs.h (then core.h - libcore was an attempt at a platform uniformization library to help write portable code) and we carried on. Unless there's a significant need to change that now (everything works quite well the way it is) then I'd recommend leaving things as is (at least until after the refactoring project which includes a fair amount of improvement / restructuring to the base-level on which the rest of the engine is coded against).

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: the dreaded 64-bit compile

Post by mwieder » Thu Apr 18, 2013 5:34 pm

The other reason I can think of is that it reduces the probability of error leaks if there's only one free() to take care of. But after playing around with the magic numbers in an attempt to figure out the intent of the routine, I decided it was more expedient just to rewrite it.

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1232
Joined: Thu Apr 11, 2013 11:27 am

Re: the dreaded 64-bit compile

Post by LCMark » Thu Apr 18, 2013 9:18 pm

It was just a case of me perpertrating premature optimization. Originally I had thought MCPath objects might be (a) more frequently used and (b) been around for long periods of time. As it turns out, they only ever ended up being transient, making trying to save a few bytes (at the expense of code clarity) unnecessary :)

In regards to the 64-bit changes (just to repeat what I said on the pull request) - we aren't going to have time to integrate this for 6.0.1 but can pull it in as a feature branch so more than one person can submit pull requests against it. Thoughts?

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: the dreaded 64-bit compile

Post by monte » Thu Apr 18, 2013 9:47 pm

Anybody able to help could do so by sending mwieder a pull request I guess... but probably more people will see the feature branch on your repo
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1232
Joined: Thu Apr 11, 2013 11:27 am

Re: the dreaded 64-bit compile

Post by LCMark » Thu Apr 18, 2013 9:49 pm

Very true...

I'll leave it up to Mr Wieder and see what he wants to do :)

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: the dreaded 64-bit compile

Post by mwieder » Thu Apr 18, 2013 9:56 pm

Yeah, I like the idea of a separate branch. The 64-bit branch is definitely not ready for the 6.0.1 release, so more time to poke at it and more eyes on the source would be useful.

I also didn't add error checking to the MCPath::allocate method - there wasn't any error checking on the malloc in the original, and I'm not sure what error condition would be appropriate at this level. It could possibly fail under low memory conditions and that's bound to have repercussions at some point.

I'm at the point now where I'm tracking down the cause of the graphics effects problem: both the source and destination pointers are getting set to negative values. I've tracked it with gdb now as far back as MCX11Context::getImage and they're still messed up, so it's not just the rendering functions with the problem, they just act on it. If I don't try to use graphic effects then everything seems functional so far (and that probably means I haven't tested enough).

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: the dreaded 64-bit compile

Post by mwieder » Fri Apr 19, 2013 2:39 am

I reverted the parentheses changes.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: the dreaded 64-bit compile

Post by monte » Fri Apr 19, 2013 3:59 am

You mean the ones that cause compiler warnings? && etc Damn... was hoping that would get into the engine. Maybe it should be a separate pull request...
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: the dreaded 64-bit compile

Post by mwieder » Fri Apr 19, 2013 6:58 am

Yes, those.
I messed up the parenthese, so I got rid of the changes. Mark caught my error and I've got other things do do right now instead of fixing them.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: the dreaded 64-bit compile

Post by monte » Fri Apr 19, 2013 7:33 am

fair enough... perhaps a dedicated compiler warning cleanup branch is in order... I've got 79 when I build
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1232
Joined: Thu Apr 11, 2013 11:27 am

Re: the dreaded 64-bit compile

Post by LCMark » Fri Apr 19, 2013 8:32 am

I'm not going to deny... The source-code could generally do with a 'warning cleanup' on the various different compilers that are used!

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1232
Joined: Thu Apr 11, 2013 11:27 am

Re: the dreaded 64-bit compile

Post by LCMark » Fri Apr 19, 2013 10:31 am

Looks like the 64-bit branch in Mark's repo is going well so perhaps best to leave it there for now... We'll keep an eye on the pull-request and when it seems mature enough we'll look to integrate and start producing 64-bit Linux builds (the latter will require a little bit of work internally to integrate another engine type into the build process!).

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: the dreaded 64-bit compile

Post by mwieder » Fri Apr 19, 2013 6:39 pm

I think the "warning cleanup" task should be a separate branch. I'm going to try to keep the 64-bit compile branch clean if possible. It's already got one bug fix in it, but that's the only anomaly at the moment.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: the dreaded 64-bit compile

Post by mwieder » Thu Apr 25, 2013 5:51 pm

Finally got a clean install of XCode 3.2.6 to respond. Now I get 3887 warnings. :roll: But it's progress.

Locked