New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emscripten and spec disagree about mutability of foreign imports. #64

Closed
cscott opened this Issue Jun 7, 2013 · 1 comment

Comments

Projects
None yet
1 participant
@cscott

cscott commented Jun 7, 2013

The spec says:

A foreign import is of one of the following three forms:

var x:Identifier = foreign:Identifier.y:Identifier;
var x:Identifier = foreign:Identifier.y:Identifier|0;
var x:Identifier = +foreign:Identifier.y:Identifier;

The variable foreign must match the second parameter of the module declaration. The global variable x is stored in the global environment with type imm Function for the first form, imm int for the second, and imm double for the third.

The spec should probably read "mut int for the second and mut double for the third", since emscripten generates the following code (this is from https://github.com/dvander/arewefastyet/blob/9de7037324e0b5b155b761225f26f94fff5c76f5/benchmarks/asmjs-apps/box2d.js):

    var i = env.STACKTOP | 0;
    function a5(a) {
        a = a | 0;
        var b = 0;
        b = i;
        i = i + a | 0;
        i = i + 3 >> 2 << 2;
        return b | 0
    }
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Aug 12, 2014

This has been fixed in Section 5.5.

ghost commented Aug 12, 2014

This has been fixed in Section 5.5.

@ghost ghost closed this Aug 12, 2014

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment