[Vm-dev] Suspicious typing in Cog VM

Aleksej Saushev asau at inbox.ru
Wed Dec 8 18:01:17 UTC 2010


Eliot Miranda <eliot.miranda at gmail.com> writes:

>  On Wed, Dec 8, 2010 at 12:30 AM, Aleksej Saushev <asau at inbox.ru> wrote:
>
>      Hello!
>    
>     Types are inconsistent along the source, does Cog VM work on LP64 platforms?
>
> Please read unixbuild/HowToBuild:
>
> 3d. If you're building the VM on a 64-bit OS, you'll need a compiler which can
> compile and link to 32-bit binaries. On most Linuxes the gcc-multilib package
> provides the 32-bit compiler and the ia32-libs provides the 32-bit libraries.
> You'll also have to add the -m32 switch to all gcc & g++ invocations.  The
> easiest way to do this is to add CC="gcc -m32" & CXX="g++ -m32" to the configure
> script:
>      ../../platforms/unix/config/configure CC="gcc -m32" CXX="g++ -m32" CFLAGS="-g -O2 -msse2 -D_GNU_SOURCE -DNDEBUG
> -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0" LIBS=-lpthread
> To run a 32-bit VM on a 64-bit OS, you'll also need the 32-bit libraries
> provided by the ia32-libs package.
>
> According to Paul DeBruicker  the following packages need to be installed to
> compile in 32-bt mode on 64-bit ubuntu.  YMMV.

Perhaps I'm not clear enough. These changes are not an attempt to fix 64-bit build,
it is an attempt to fix _32-bit_ build. Functions don't match their prototypes,
and my builds (on NetBSD/i386) end with this kind of diagnostics:

/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:103: error: conflicting types for 'snd_InsertSamplesFromLeadTime'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:9: error: previous declaration of 'snd_InsertSamplesFromLeadTime' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:108: error: conflicting types for 'snd_PlaySamplesFromAtLength'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:10: error: previous declaration of 'snd_PlaySamplesFromAtLength' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:145: error: conflicting types for 'snd_RecordSamplesIntoAtLength'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:20: error: previous declaration of 'snd_RecordSamplesIntoAtLength' was here
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/unix/plugins/SoundPlugin/sqUnixSound.c:153: error: conflicting types for 'snd_SetRecordLevel'
/tmp/local/squeak-vm-cog/work/squeak-vm-cog/platforms/Cross/plugins/SoundPlugin/SoundPlugin.h:16: error: previous declaration of 'snd_SetRecordLevel' was here

That is, without these changes the build doesn't even finish (resultant
binary crashes on any image I tried: Pharo 1.0, Pharo 1.1.1, but that's
another half of the story). My point is that something is going wrong,
since the code lacks internal consistency (and I don't know what to
assign further crashes to). Since you know the code much better than me,
could you take a look?

>     I need this to make it build on NetBSD/i386:
>    
>     --- platforms/unix/plugins/SoundPlugin/sqUnixSound.c.orig       2010-12-07 17:40:51.000000000 +0000
>     +++ platforms/unix/plugins/SoundPlugin/sqUnixSound.c
>     @@ -99,12 +99,12 @@ int snd_AvailableSpace(void)
>       return snd->snd_AvailableSpace();
>      }
>    
>     -int snd_InsertSamplesFromLeadTime(int frameCount, int srcBufPtr, int samplesOfLeadTime)
>     +sqInt snd_InsertSamplesFromLeadTime(sqInt frameCount, void *srcBufPtr, sqInt samplesOfLeadTime)
>      {
>       return snd->snd_InsertSamplesFromLeadTime(frameCount, srcBufPtr, samplesOfLeadTime);
>      }
>    
>     -int snd_PlaySamplesFromAtLength(int frameCount, int arrayIndex, int startIndex)
>     +sqInt snd_PlaySamplesFromAtLength(sqInt frameCount, void *arrayIndex, sqInt startIndex)
>      {
>       return snd->snd_PlaySamplesFromAtLength(frameCount, arrayIndex, startIndex);
>      }
>     @@ -141,7 +141,7 @@ double snd_GetRecordingSampleRate(void)
>       return snd->snd_GetRecordingSampleRate();
>      }
>    
>     -int snd_RecordSamplesIntoAtLength(int buf, int startSliceIndex, int bufferSizeInBytes)
>     +sqInt snd_RecordSamplesIntoAtLength(void *buf, sqInt startSliceIndex, sqInt bufferSizeInBytes)
>      {
>       return snd->snd_RecordSamplesIntoAtLength(buf, startSliceIndex, bufferSizeInBytes);
>      }
>     @@ -150,7 +150,7 @@ int snd_RecordSamplesIntoAtLength(int bu
>    
>      void snd_Volume(double *left, double *right)                   {        snd->snd_Volume(left, right); }
>      void snd_SetVolume(double left, double right)                  {        snd->snd_SetVolume(left, right); }
>     -int  snd_SetRecordLevel(int level)                             { return snd->snd_SetRecordLevel(level); }
>     +void snd_SetRecordLevel(sqInt level)                           { return snd->snd_SetRecordLevel(level); }
>      int  snd_GetSwitch(int id, int captureFlag, int channel)       { return snd->snd_GetSwitch(id, captureFlag, channel); }
>      int  snd_SetSwitch(int id, int captureFlag, int parameter)     { return snd->snd_SetSwitch(id, captureFlag, parameter); }
>      int  snd_SetDevice(int id, char *name)                         { return snd->snd_SetDevice(id, name); }
>     --- src/vm/gcc3x-cointerp.c.orig        2010-12-07 18:00:09.000000000 +0000
>     +++ src/vm/gcc3x-cointerp.c
>     @@ -975,7 +975,7 @@ sqInt quickPrimitiveInstVarIndexFor(sqIn
>      sqInt rawHeaderOf(sqInt methodPointer);
>      void rawHeaderOfput(sqInt methodOop, void *cogMethod);
>      sqInt readableFormat(sqInt imageVersion);
>     -sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
>     +sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset);
>      sqInt remap(sqInt oop);
>      static sqInt removeFirstLinkOfList(sqInt aList);
>      EXPORT(sqInt) removeGCRoot(sqInt *varLoc);
>     @@ -37959,7 +37959,7 @@ readableFormat(sqInt imageVersion) {
>      */
>    
>      sqInt
>     -readImageFromFileHeapSizeStartingAt(sqImageFile  f, sqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>     +readImageFromFileHeapSizeStartingAt(sqImageFile  f, usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
>      DECL_MAYBE_SQ_GLOBAL_STRUCT
>         sqInt anObject;
>         sqInt aValue;


-- 
HE CE3OH...


More information about the Vm-dev mailing list