http://bugs.squeak.org/view.php?id=3929 has been identified as a problem of FPU register stack overflow on linux VM. A single change of line 51 of x86-sysv-asm.S solved this problem: fstpl ffiFloatReturnValue Though I did not write extensive tests, I used modified VM a while without problems. What do you think of inclusion in svn trunk ? Nicolas |
On Wed, Sep 09, 2009 at 10:50:07PM +0200, Nicolas Cellier wrote: > > http://bugs.squeak.org/view.php?id=3929 has been identified as a > problem of FPU register stack overflow on linux VM. > > A single change of line 51 of x86-sysv-asm.S solved this problem: > > fstpl ffiFloatReturnValue > > Though I did not write extensive tests, I used modified VM a while > without problems. > > What do you think of inclusion in svn trunk ? I recall some extensive discussion of this (some of which is documented on the Mantis page), but no action since then. Barring any objections, it sounds like this should be included in the svn trunk. Ian, you may have missed the earlier discussions. caveat: I have no expertise with FPUs and the subject is not the sort of thing that would be improved by a democratic process, so I'll refrain from casting my "+1" vote. Dave |
On 10.09.2009, at 02:32, David T. Lewis wrote: > > caveat: I have no expertise with FPUs and the subject is not the sort > of thing that would be improved by a democratic process, so I'll > refrain > from casting my "+1" vote. +1 to that. - Bert - |
Bert Freudenberg wrote: > On 10.09.2009, at 02:32, David T. Lewis wrote: >> caveat: I have no expertise with FPUs and the subject is not the sort >> of thing that would be improved by a democratic process, so I'll refrain >> from casting my "+1" vote. > > +1 to that. Ditto. The +1 is well-deserved. The problem is that the FPU stack isn't popped when returning from a call that has a float return. It needs to be popped; on x86 the FPU is organized as a stack. The difference between "fstl" and "fstpl" is the ->p<- which stands for "pop" ;-) Cheers, - Andreas |
In reply to this post by David T. Lewis
In looking at this I should point out I made a number of changes to my version of x86-sysv-asm.S Oddly I already had the fstpl But my other changes might be of interest and or for comment. (a) usage of REG_TO_EXTERN, PICIFY, and NON_LAZY_STUB to make it compile/link on some variation of gcc in 10.3.x at some point (b) and $0xFFFFFFF0,%esp /*align to 128-bits*/ This was required to properly align the stack for vector logic and to make quicktime call FFI calls happy (otherwise at some point a quicktime FFI call trashes a value on the stack). (c) cld "Clear Direction" I at some point added this based on: http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/Mac_OS_X_ABI_Function_Calls.pdf Contains system flags, such as the direction flag and the carry flag. The direction flag must be set to the “forward” direction (that is, 0) before entry to and upon exit from a routine. Other user flags have no specified role in the standard calling sequence and are not preserved. On 2009-09-09, at 5:32 PM, David T. Lewis wrote: > > On Wed, Sep 09, 2009 at 10:50:07PM +0200, Nicolas Cellier wrote: >> >> http://bugs.squeak.org/view.php?id=3929 has been identified as a >> problem of FPU register stack overflow on linux VM. >> >> A single change of line 51 of x86-sysv-asm.S solved this problem: >> >> fstpl ffiFloatReturnValue >> >> Though I did not write extensive tests, I used modified VM a while >> without problems. >> >> What do you think of inclusion in svn trunk ? > > I recall some extensive discussion of this (some of which is > documented > on the Mantis page), but no action since then. Barring any objections, > it sounds like this should be included in the svn trunk. > > Ian, you may have missed the earlier discussions. > > caveat: I have no expertise with FPUs and the subject is not the sort > of thing that would be improved by a democratic process, so I'll > refrain > from casting my "+1" vote. > > Dave > > -- = = = ======================================================================== John M. McIntosh <[hidden email]> Twitter: squeaker68882 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com = = = ======================================================================== #import <architecture/i386/asm_help.h> .text .globl _ffiCallAddressOf _ffiCallAddressOf: /* 8=addr, 12=stack, 16=stackSize */ pushl %ebp movl %esp, %ebp movl 16(%ebp), %ecx testl %ecx, %ecx je 2f subl %ecx, %esp and $0xFFFFFFF0,%esp /*align to 128-bits*/ subl $4, %ecx movl 12(%ebp), %edx 1: movl (%edx,%ecx,1), %eax movl %eax, (%esp,%ecx,1) subl $4, %ecx jnc 1b jmp 3f 2: and $0xFFFFFFF0,%esp /*align to 128-bits*/ 3: cld call *8(%ebp) REG_TO_EXTERN (%eax, _intReturnValue) REG_TO_EXTERN (%edx, _intReturnValue2) PICIFY(_floatReturnValue) fstpl (%edx) NON_LAZY_STUB(_floatReturnValue) movl %ebp, %esp popl %ebp ret |
Free forum by Nabble | Edit this page |