[Vm-dev] intAt from sqMemoryAccess.h does not extend sign

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Nov 8 20:40:34 UTC 2016


It makes IntegerArrayTest green on MacOSX Spur64bits and does not seem to
break anything else, so I will commit this evening.
Linux and Windows which take the other compiler branch are not concerned,
as well as 32 bits VM for which the change is transparent.

2016-11-08 19:10 GMT+01:00 David T. Lewis <lewis at mail.msen.com>:

>
> On Tue, Nov 08, 2016 at 12:57:26PM -0500, David T. Lewis wrote:
> >
> > On Tue, Nov 08, 2016 at 06:21:04PM +0100, Nicolas Cellier wrote:
> > >
> > > 2016-11-08 16:08 GMT+01:00 David T. Lewis <lewis at mail.msen.com>:
> > >
> > > >
> > > > On Tue, Nov 08, 2016 at 03:19:50PM +0100, Nicolas Cellier wrote:
> > > > >
> > > > > Hi David,
> > > > > Sorry, I've no linux/mac vm available currently to exhibit the
> problem.
> > > >
> > > > Hi Nicolas,
> > > >
> > > > I was using this pre-built Spur VM:
> > > >
> > > > Virtual Machine
> > > > ---------------
> > > > /usr/local/lib/squeak/5.0-201607171247_64/squeak
> > > > Croquet Closure Cog[Spur] VM [CoInterpreterPrimitives
> > > > VMMaker.oscog-eem.1902]
> > > > Unix built on Jul 17 2016 14:02:20 Compiler: 4.6.3
> > > > platform sources revision VM: r201607171247 https://github.com/
> > > > OpenSmalltalk/opensmalltalk-vm.git $ Date: Sun Jul 17 14:47:17 2016
> +0200
> > > > $ Plugins: r201607171247 https://github.com/
> OpenSmalltalk/opensmalltalk-
> > > > vm.git $
> > > > CoInterpreter VMMaker.oscog-eem.1902 uuid: d5860bb5-b41c-4337-90d4-
> c2abc979248d
> > > > Jul 17 2016
> > > > StackToRegisterMappingCogit VMMaker.oscog-eem.1902 uuid:
> > > > d5860bb5-b41c-4337-90d4-c2abc979248d Jul 17 2016
> > > >
> > > >
> > > > Unfortunately I cannot compile Cog/Spur on my Ubuntu PC (build system
> > > > issues),
> > > > so I cannot be of much help beyond that.
> > > >
> > > > But just for my own understanding, is it the case that IntegerArray
> access
> > > > does not work for you on a 64 bit image on Windows?
> > > >
> > > > Note, the #ifdef USE_INLINE_MEMORY_ACCESSORS is very old. I think
> that Ian
> > > > wrote it (Tim might know better). The only memory access code that I
> wrote
> > > > is the Smalltalk (slang) version in the VMMaker repository, but that
> is
> > > > not relevant here.
> > > >
> > > > Dave
> > > >
> > > >
> > > So this path is forced on macosx 32 & 64 bits via
> > > https://raw.githubusercontent.com/OpenSmalltalk/
> opensmalltalk-vm/Cog/build.macos64x64/common/Makefile.vm
> > >
> > > DEFS:=    $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
> > >         -DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \
> > >         $(INTERPFLAGS)
> > >
> > > Linux does not have it set... That explains the difference, I tested
> 64bits
> > > spur on mac...
> > >
> >
> > I compiled a VM with USE_INLINE_MEMORY_ACCESSORS defined, and I still
> see no
> > failures. This is 64-bit image and VM, sizeof(sqInt) is 8 and
> sizeof(void *)
> > is 8. I can only test this with interpreter VM but it should be the same
> for
> > 64-bit Spur.
> >
> > I think that I must be looking at the wrong thing. Do you have a code
> example
> > that fails in your image?
> >
>
> Before I drag this discussion too far off topic, I should add that I think
> you
> are right about the sign extension issue. I also tried a VM compiled with
> this,
> which also works fine:
>
> //# define intAtPointer(ptr)            ((sqInt)(*((unsigned int *)(ptr))))
> //# define intAtPointerput(ptr, val)    ((sqInt)(*((unsigned int *)(ptr))=
> (int)(val)))
> # define intAtPointer(ptr)              ((sqInt)(*((int *)(ptr))))
> # define intAtPointerput(ptr, val)      ((sqInt)(*((int *)(ptr))=
> (int)(val)))
>
> So your original point seems right to me, I just am having a hard time
> reproducing
> any kind of real error in practice.
>
> Dave
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20161108/b86af834/attachment.html>


More information about the Vm-dev mailing list