[Vm-dev] Re: [squeak-dev] VM 4.4 build nastinesses - part 1 of probably many

Eliot Miranda eliot.miranda at gmail.com
Tue Feb 12 23:06:15 UTC 2013


On Tue, Feb 12, 2013 at 2:47 PM, tim Rowledge <tim at rowledge.org> wrote:

>
>
> On 12-02-2013, at 12:38 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
> >
> >
> > On Tue, Feb 12, 2013 at 12:30 PM, Eliot Miranda <eliot.miranda at gmail.com>
> wrote:
> >
> >
> > On Tue, Feb 12, 2013 at 11:48 AM, tim Rowledge <tim at rowledge.org> wrote:
> >
> > I never knew that you could declare an argument in C with "sqInt
> (*thingy[])(void)" ! I hope it actually does what i think it oughta.
> >
> > yes it does :)
> >
> > see e.g.
> http://stackoverflow.com/questions/5488608/how-define-an-array-of-function-pointers-in-c.
>  But what's the relevance?  I don't see any obvious candidates in the VM
> source.  Can you point me to the example?
>
> The primitive table is (or should be) typed as an array of pointers to
> function with void arg and sqInt return (although I think that likely
> really ought to be void return, requiring some other fixes in the
> translator code depths).


This is fixed in the Cog branch.  primitives therein are void
primitiveFunc(void).

static void (*primitiveFunctionPointer)();
static void (*primitiveTable[MaxPrimitiveIndex + 2 /* 577 */])(void) = {
...

And the bug that excludes primitiveFunctionPointer from the struct is the
includes: $( in CCodeGeneratorGlobalStructure>>placeInStructure:.

Following from that you need to suitably match types all over the place -
> which is why the original slang code wimped out and used int *everywhere*
> and cast things if really, really needed. Which lead to some really ugly
> code.
> Example - dispatchFunctionPointerOn:in:
>

Again fixed in the Cog branch.


>
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Useful Latin Phrases:- Aio, quantitas magna frumentorum est. = Yes, that
> is a very large amount of corn.
>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20130212/faa3f7ee/attachment.htm


More information about the Vm-dev mailing list