Hi, Does anyone tested Alien on Spur and "El capitan"? specifically callbacks? For me, a completely broken :( 1) this structure (in maybeInlinePositive32BitIntegerFor: and others): (integerValue >= 0 and: [objectMemory isIntegerValue: integerValue]) ifTrue: [^objectMemory integerObjectOf: integerValue]. Does not works if “integer value” is an unsigned long, because compiler assumes it will always be true, then remove the if, then answers a wrong value. 2) assertCStackWellAligned always fail. No idea why because if does not says anything, just jmp back to the regular flow. 3) finally, ceCaptureCStackPointers also fails… this can be because (2) or because other reasons (it also jmps back so no clue) (method generateCaptureCStackPointers: clarifies is a hack, so I suppose it stopped to work). I guess solution of (1) is easy: argument number just has to be a sqLong instead an unsigned long. But for 2 and 3 I have no idea where to start. Does anyone has an idea? Esteban |
I've changed many of these in my experimental branch when trying to remove lot of UB - but it's not up to date with latest Eliot .oscog versions... I'd like we review some of these changes, but only if Eliot is ready, he has many things cooking already.2015-10-19 18:31 GMT+02:00 Esteban Lorenzano <[hidden email]>:
|
I don’t know about Eliot, but I cannot wait. Without Alien, I have no FFI with callbacks. Without FFI with callbacks I have no replacement for NativeBoost. Without NativeBoost I have not Athens (and OSWindow) And without those, Pharo cannot migrate to Spur. So if you have a working version (or partially working), please, share it. Esteban
|
I regularly sync (merge) with Eliot branch, but I'm a few months behind, not much time recently. Also, I upgraded Xcode to latest version but did not yet tried to compile the VM, so no premature promises...2015-10-19 19:56 GMT+02:00 Esteban Lorenzano <[hidden email]>:
|
thanks!
|
In reply to this post by Nicolas Cellier
Look at Cog/build.macos32x86/squeak.cog.spur and the miosvm script or the SqueakCogSpur32x86.xcworkspace You should be able to build a 32bit cog.spur VM using the current Xcode under the current OSX On Mon, Oct 19, 2015 at 11:01 AM, Nicolas Cellier <[hidden email]> wrote:
=========================================================================== John M. McIntosh. Corporate Smalltalk Consulting Ltd https://www.linkedin.com/in/smalltalk =========================================================================== |
Ok I pushed fixes to deal with a code compile error, plus update the code base so that it does not leak memory when running under the os-x legacy 32bit objective-c runtime. Brave folks could look at Cog/build.macos32x86/squeak.cog.spur and the miosvm script or the SqueakCogSpur32x86.xcworkspace xCode project. On Mon, Oct 19, 2015 at 11:09 AM, John McIntosh <[hidden email]> wrote:
=========================================================================== John M. McIntosh. Corporate Smalltalk Consulting Ltd https://www.linkedin.com/in/smalltalk =========================================================================== |
Hi, I think this does not solves my problem :( but… do you think this leaks where present before? I’m using different way to build pharovm (using cmake to generate it, not an xcode project) so I can add the definitions there… but I tried to integrate your changes to my sources and I found that you are using newer objc instructions, so the build with sdk 10.6 (needed to still support leopard) failed (then I reverted, waiting for a better moment to perform this task) … yet, I didn’t tried too much so I don’t know if the error is not fixable in 10.6 or I just missed a configuration. Any hint? cheers, Esteban
|
No the leaks are new because I took the original code base and attempted to integrate with Pharo and other forms of the iOS tree and concert to modern obj-c and ARC Later I discover that the 32 bit OSX legacy objective c runtime does not support ARC. Which means it leaks bytes for cursor changing, file lookup and events. To fix that some defines that provide the retain, release, autorelease for 32 bit but not 64 bit Sent from my iPhone
smime.p7s (3K) Download Attachment |
In reply to this post by EstebanLM
well… I solve the problem. Everything is about the first issue report (comparison is always true). I changed first from “unsigned long” to “sqLong” but then I realised sqLong is defined as “long long” so this expression: intValue bitXor: (intValue << 1)) >= 0 since number fitted in "long long”, was also always true. Then of course it was converting into a SmallInteger a number that should be a LongPositiveInteger. my fix: just to change #maybeInlinePositive32BitIntegerFor: and around to ensure parameter is “sqInt”. That works. Now, I have this doubts: - how is possible this was working before? maybe this is a change in clang 7 (apple)? - now I have a lot of complains of “comparison of unsigned expression is always true” all around the image. Should we take care about them? I will do some tests and commit to VMMaker tomorrow. cheers, Esteban
|
In reply to this post by EstebanLM
So we can still compile a legacy MacCarbon based VM compatible with snow leopard. I ried it, it works and I can run Squeak 5.0 (spur) with such VM. I can compile with latest clang (7), but the image immediately quit when I use this VM (with a correct STARTUP/QUIT log pair in the change log though...). I'll continue to dig. 2015-10-20 8:32 GMT+02:00 Esteban Lorenzano <[hidden email]>:
|
Hi,
In Pharo we do not compile mac carbon VMs since couple of years ago so this is not a big problem for us (thankfully… at least a problem less :P) Esteban
|
In reply to this post by EstebanLM
Ok, you know there is a test plugin squeakSUnitTester (See the *m/h files) I made to check types being passed to/from the Objective-C interface to confirm things are being transferred/received correctly. However I did write something similar for the FFI interface where, or using using Smalltalk code where I iterated over the entire range of +/- 2 billion then edge cases for LargePositive/Negative integers for each point where we added another byte of accuracy for a few bytes. The reasons for that was to confirm that integer conversion was working correctly for all cases when we had migrated to 32bit clean code a decade back. On Tue, Oct 20, 2015 at 1:35 PM, Esteban Lorenzano <[hidden email]> wrote:
=========================================================================== John M. McIntosh. Corporate Smalltalk Consulting Ltd https://www.linkedin.com/in/smalltalk =========================================================================== |
In reply to this post by EstebanLM
Ok, you know you are using maybeInlinePositive32BitIntegerFor for BOTH unsigned and signed integers? That to me rings alarm bells, so do you need maybeInlinePositive32BitIntegerForSignedInteger or maybeInlinePositive32BitIntegerForUnSignedInteger or always cast the incoming value to an unsigned integer, or is it signed? If so are you sure you understand the math involved and the possible input values? On Mon, Oct 19, 2015 at 9:31 AM, Esteban Lorenzano <[hidden email]> wrote:
=========================================================================== John M. McIntosh. Corporate Smalltalk Consulting Ltd https://www.linkedin.com/in/smalltalk =========================================================================== |
I’m not using maybeInlinePositive32BitIntegerFor for anything. Is Eliot who is doing it :) But yes, I thought that first, then I followed the logic and figured out the intent was kept just changing the input type… but I might be wrong… Eliot should know better :) Esteban
|
In reply to this post by johnmci
The analysis I performed in 2013 was this one: The intention is clearly to pass a uint32 parameter, so the parameter must be unsigned and there is no point in testing if parameter is > 0.positive32BitIntegerFor: takes a positive 32 bit C integer, and make a Smalltalk integer object out of it (possibly a LargePositiveInteger in 32 bits VM) AFAIR, all the send sites in VMMaker/plugins were in accordance with this, but I changed many type int in senders I made this change and I had a working VM passing all the tests. For 64 bits VM, this should probably be an unsigned int (not a usqInt which is too long). 2015-10-20 22:59 GMT+02:00 John McIntosh <[hidden email]>:
|
In reply to this post by EstebanLM
Hi Esteban,
On Mon, Oct 19, 2015 at 9:31 AM, Esteban Lorenzano <[hidden email]> wrote:
Right, but oops are squints which are signed, so this shouldn't be a problem. We can't safely cast the value to signed because, unless we know the size of the integer, we may truncate it. e.g. (signed)integerValue is equivalent to (int)integerValue, and if integerValue were 64-bits the cast could cause the wrong answer.
Put a breakpoint in warning and then you can see what the problem is.
Right. The stack should be properly aligned on a 128-bit/16-byte boundary for SSE instructions to work correctly. So you need to step through the code generated for ceCaptureCStackPointers,and look at the execution state when assertCStackWellAlignedis evaluated. For this you must use a debugger and puzzle out the code at the machine level.
Right. Extremely important :-)
Roll your sleeves up and dive in with gdb/lldb. And you can contact me via Skype or FaceTime if you want to talk it through and let me look over your shoulder.
_,,,^..^,,,_ best, Eliot |
In reply to this post by EstebanLM
On Tue, Oct 20, 2015 at 1:35 PM, Esteban Lorenzano <[hidden email]> wrote:
No, you can't cast within maybeInlinePositive32BitIntegerFor:. That will break its use on long long values.
Unless we look in the debugger we won't know.
Looks like it.
Don't just blindly commit a fix that makes clang 7 work. It could easily break everything elsewhere. Instead, we need to understand the issues first.
_,,,^..^,,,_ best, Eliot |
In reply to this post by johnmci
Hi John,
On Tue, Oct 20, 2015 at 1:59 PM, John McIntosh <[hidden email]> wrote:
No, we don't need this. Looking at the code, it is OK for positive32BitIntegerFor: to truncate to 32-bits. But if one wants to pass in a 32-bit value form a long one should write ^self positive32BitIntegerFor: (value bitAnd: 16rFFFFFFFF) If one wants a value which is as big as a pointer one should use ^self positiveMachineIntegerFor: (value bitAnd: 16rFFFFFFFF) Only use the 32Bit conversion routines when you want a 32-bit result. There are now 32-bit, 64-bit and machine versions of the conversion routines. The machine versions answer 32 or 64 bit results as appropriate.
_,,,^..^,,,_ best, Eliot |
In reply to this post by EstebanLM
Hi Esteban,
On Tue, Oct 20, 2015 at 2:23 PM, Esteban Lorenzano <[hidden email]> wrote:
what's the context?
_,,,^..^,,,_ best, Eliot |
Free forum by Nabble | Edit this page |