New issue
Advanced search Search tips

Issue 644717 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

current_memory (0x3b) reports size in bytes rather than pages

Project Member Reported by mscales@chromium.org, Sep 7 2016

Issue description

Version: 55.0.2853.0 canary (64-bit)
OS: Mac OSX

# What steps will reproduce the problem?
Execute the current_memory instruction. With WASM enabled in flags, try:

var bytes = new Uint8Array([
  0x00, 0x61, 0x73, 0x6d, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x74, 0x79, 0x70, 0x65,
  0x05, 0x01, 0x40, 0x00, 0x01, 0x01, 0x08, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
  0x6f, 0x6e, 0x03, 0x02, 0x00, 0x00, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79,
  0x03, 0x01, 0x0a, 0x01, 0x06, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x0d, 0x02,
  0x00, 0x04, 0x67, 0x72, 0x6f, 0x77, 0x01, 0x04, 0x63, 0x75, 0x72, 0x72, 0x04,
  0x63, 0x6f, 0x64, 0x65, 0x09, 0x02, 0x04, 0x00, 0x10, 0x01, 0x39, 0x02, 0x00,
  0x3b
]);

var module = Wasm.instantiateModule(bytes);

console.log(module.exports.curr());

# What is the expected output?
1

# What do you see instead?
65536

The spec says that the number returned should be the number of *pages* allocated, not the number of bytes. https://github.com/WebAssembly/design/blob/master/AstSemantics.md#resizing
 
Status: Available (was: Untriaged)
Status: Fixed (was: Available)
Looks like this is fixed in 58

Sign in to add a comment