Commit a6fe748d authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Exporting i64 globals causes a link error.

R=titzer@chromium.org

Review-Url: https://codereview.chromium.org/2627723007
Cr-Commit-Position: refs/heads/master@{#42333}
parent cb80ef31
......@@ -1923,6 +1923,10 @@ class WasmInstanceBuilder {
case kWasmF64:
num = *GetRawGlobalPtr<double>(global);
break;
case kWasmI64:
thrower_->LinkError(
"export of globals of type I64 is not allowed.");
break;
default:
UNREACHABLE();
}
......
......@@ -44,6 +44,17 @@ TestExported(kWasmI32, 455.5, 455);
TestExported(kWasmF32, -999.34343, Math.fround(-999.34343));
TestExported(kWasmF64, 87347.66666, 87347.66666);
(function TestI64Exported() {
var builder = new WasmModuleBuilder();
var sig = makeSig([kWasmI64], []);
builder.addGlobal(kWasmI32); // pad
var g = builder.addGlobal(kWasmI64, false)
.exportAs("foo");
g.init = 1234;
builder.addGlobal(kWasmI32); // pad
assertThrows(()=> {builder.instantiate()}, WebAssembly.LinkError);
})();
function TestImportedExported(type, val, expected) {
print("TestImportedExported " + type + "(" + val +")" + " = " + expected);
......
......@@ -359,7 +359,7 @@ class WasmModuleBuilder {
break;
case kWasmI64:
section.emit_u8(kExprI64Const);
section.emit_u8(global.init);
section.emit_u32v(global.init);
break;
case kWasmF32:
section.emit_u8(kExprF32Const);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment