Something wrong in latest code generation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Something wrong in latest code generation

Nicolas Cellier
 
Hi Eliot,
if i look at spur64src/vm/cointerp.c generated from VMMaker.oscog-eem.2277
i see something wrong in primitiveAdd:

static void
primitiveAdd(void)
{   DECL_MAYBE_SQ_GLOBAL_STRUCT
    sqInt integerResult;
    char *sp;

    /* begin pop2AndPushIntegerIfOK: */
======================================
See below: we test if primitive failed before we tried...
======================================
    if (!GIV(primFailCode)) {
        integerResult = (stackIntegerValue(1)) + (stackIntegerValue(0));
        if ((((((usqInt) integerResult) >> 60) + 1) & 15) <= 1) {
            /* begin pop:thenPush: */
            longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), (((usqInt)integerResult << 3) | 1));
            GIV(stackPointer) = sp;
        }
        else {
            /* begin success: */
           
            /* Don't overwrite an error code that has already been set. */
            if (!GIV(primFailCode)) {
                GIV(primFailCode) = 1;
            }

        }
    }
}


Note that I could comment the commit in github API.
Unfortunately, diff are too big, and comments uneasy to find/view/scan.

Reply | Threaded
Open this post in threaded view
|

Re: Something wrong in latest code generation

Nicolas Cellier
 
This wrong generation is what makes the mac osx 64bits cog spur SEGV...

2017-11-24 14:13 GMT+01:00 Nicolas Cellier <[hidden email]>:
Hi Eliot,
if i look at spur64src/vm/cointerp.c generated from VMMaker.oscog-eem.2277
i see something wrong in primitiveAdd:

static void
primitiveAdd(void)
{   DECL_MAYBE_SQ_GLOBAL_STRUCT
    sqInt integerResult;
    char *sp;

    /* begin pop2AndPushIntegerIfOK: */
======================================
See below: we test if primitive failed before we tried...
======================================
    if (!GIV(primFailCode)) {
        integerResult = (stackIntegerValue(1)) + (stackIntegerValue(0));
        if ((((((usqInt) integerResult) >> 60) + 1) & 15) <= 1) {
            /* begin pop:thenPush: */
            longAtput((sp = GIV(stackPointer) + ((2 - 1) * BytesPerWord)), (((usqInt)integerResult << 3) | 1));
            GIV(stackPointer) = sp;
        }
        else {
            /* begin success: */
           
            /* Don't overwrite an error code that has already been set. */
            if (!GIV(primFailCode)) {
                GIV(primFailCode) = 1;
            }

        }
    }
}


Note that I could comment the commit in github API.
Unfortunately, diff are too big, and comments uneasy to find/view/scan.