[Vm-dev] Suspicious typing in Cog VM

Levente Uzonyi leves at elte.hu
Wed Dec 8 12:57:45 UTC 2010


On Wed, 8 Dec 2010, David T. Lewis wrote:

>
> On Wed, Dec 08, 2010 at 11:30:19AM +0300, Aleksej Saushev wrote:
>>
>>   Hello!
>>
>> Types are inconsistent along the source, does Cog VM work on LP64 platforms?
>
> The README file at the root of the Cog distribution says this:
>
> The Cogit currently supports only x86 and the floating-point
> primitives and parts of the platform support code depend on SSE2.
> I hope members of the community will attempt to port it, e.g. to
> ARM, PowerPC and x86-64.
>
> So no, you should not expect it to work on x86-64. But it should
> work if you compile it in 32-bit mode on your x86-64 platform
> (i.e. with "-m32" in the CFLAGS and LDFLAGS).
>
> However, I have to admit that I have not yet been able to get
> this working on my own 64-bit SuSE Linux box, due to issues
> with libtool on my system. I've been assuming that this is a
> problem with my Linux system, but I cannot say for sure.

IIRC this is a problem on all 64-bit linux platforms. The trick is to add 
-m32 to CC instead of CFLAGS (CC="gcc -m32").


Levente

>
> Dave
>
>
>>
>> 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