{"action":"created","issue":{"url":"https://api.github.com/repos/WebAssembly/sexpr-wasm-prototype/issues/32","repository_url":"https://api.github.com/repos/WebAssembly/sexpr-wasm-prototype","labels_url":"https://api.github.com/repos/WebAssembly/sexpr-wasm-prototype/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/WebAssembly/sexpr-wasm-prototype/issues/32/comments","events_url":"https://api.github.com/repos/WebAssembly/sexpr-wasm-prototype/issues/32/events","html_url":"https://github.com/WebAssembly/sexpr-wasm-prototype/issues/32","id":130988121,"number":32,"title":"tableswitch block depth?","user":{"login":"JSStats","id":11826073,"avatar_url":"https://avatars.githubusercontent.com/u/11826073?v=3","gravatar_id":"","url":"https://api.github.com/users/JSStats","html_url":"https://github.com/JSStats","followers_url":"https://api.github.com/users/JSStats/followers","following_url":"https://api.github.com/users/JSStats/following{/other_user}","gists_url":"https://api.github.com/users/JSStats/gists{/gist_id}","starred_url":"https://api.github.com/users/JSStats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JSStats/subscriptions","organizations_url":"https://api.github.com/users/JSStats/orgs","repos_url":"https://api.github.com/users/JSStats/repos","events_url":"https://api.github.com/users/JSStats/events{/privacy}","received_events_url":"https://api.github.com/users/JSStats/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-03T10:45:39Z","updated_at":"2016-02-03T20:08:41Z","closed_at":"2016-02-03T20:08:41Z","body":"The following code fails to encode with sexp-wasm with: t60.wast:7:37: label variable out of range (max 1)\r\n\r\nIf an explicit label is added to the `tableswitch` it succeeds. I've seen other cases where this changes the depths. Does v8 always have an implicit block for a `tableswitch`? If so then adding an explicit label should make no difference, and if not then how is the difference encoded?\r\n\r\nThe v8 encoding seems to accept just one expression per case, so emits a block if there are more than one statement. I assume there is some logic to offset the `br` depths and might it only be in this case that the depths would be modified?\r\n\r\n```\r\n(module\r\n  (func $f1 (param $i i32) (result i32)\r\n    (block $l1\r\n      (i32.add (tableswitch (get_local $i)\r\n                 (table (case $0)) (case $default)\r\n                 (case $0 (br 0 (i32.const 1)))\r\n                 (case $default (br 1 (i32.const 2))))\r\n               (i32.const 3))))\r\n  (export \"f1\" $f1))\r\n(invoke \"f1\" (i32.const 0))\r\n(invoke \"f1\" (i32.const 1))\r\n\r\n4 : i32\r\n2 : i32\r\n```"},"comment":{"url":"https://api.github.com/repos/WebAssembly/sexpr-wasm-prototype/issues/comments/179435654","html_url":"https://github.com/WebAssembly/sexpr-wasm-prototype/issues/32#issuecomment-179435654","issue_url":"https://api.github.com/repos/WebAssembly/sexpr-wasm-prototype/issues/32","id":179435654,"user":{"login":"binji","id":1245315,"avatar_url":"https://avatars.githubusercontent.com/u/1245315?v=3","gravatar_id":"","url":"https://api.github.com/users/binji","html_url":"https://github.com/binji","followers_url":"https://api.github.com/users/binji/followers","following_url":"https://api.github.com/users/binji/following{/other_user}","gists_url":"https://api.github.com/users/binji/gists{/gist_id}","starred_url":"https://api.github.com/users/binji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binji/subscriptions","organizations_url":"https://api.github.com/users/binji/orgs","repos_url":"https://api.github.com/users/binji/repos","events_url":"https://api.github.com/users/binji/events{/privacy}","received_events_url":"https://api.github.com/users/binji/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T20:08:40Z","updated_at":"2016-02-03T20:08:40Z","body":"Fixed in aa3940ba53d039aed322abb2e7aba3716f755890."}}