{"action":"created","issue":{"url":"https://api.github.com/repos/starius/lua/issues/1","repository_url":"https://api.github.com/repos/starius/lua","labels_url":"https://api.github.com/repos/starius/lua/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/starius/lua/issues/1/comments","events_url":"https://api.github.com/repos/starius/lua/issues/1/events","html_url":"https://github.com/starius/lua/pull/1","id":132155203,"number":1,"title":"add __asm__(comment) to force replicate gotos","user":{"login":"abo-junghichi","id":17121461,"avatar_url":"https://avatars.githubusercontent.com/u/17121461?v=3","gravatar_id":"","url":"https://api.github.com/users/abo-junghichi","html_url":"https://github.com/abo-junghichi","followers_url":"https://api.github.com/users/abo-junghichi/followers","following_url":"https://api.github.com/users/abo-junghichi/following{/other_user}","gists_url":"https://api.github.com/users/abo-junghichi/gists{/gist_id}","starred_url":"https://api.github.com/users/abo-junghichi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abo-junghichi/subscriptions","organizations_url":"https://api.github.com/users/abo-junghichi/orgs","repos_url":"https://api.github.com/users/abo-junghichi/repos","events_url":"https://api.github.com/users/abo-junghichi/events{/privacy}","received_events_url":"https://api.github.com/users/abo-junghichi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-02-08T14:24:38Z","updated_at":"2016-02-13T12:38:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/starius/lua/pulls/1","html_url":"https://github.com/starius/lua/pull/1","diff_url":"https://github.com/starius/lua/pull/1.diff","patch_url":"https://github.com/starius/lua/pull/1.patch"},"body":"This patch prevents  each 'vmbreak' being merged into one single place by gcc without '-fno-gcse' nor '-fno-crossjumping' options.\r\nI used gcc-4.9.3(x86_64, x86_32 and ARM), and checked it's assembler output that has individual indirect jumps for every VM instructions.\r\n\r\nUnfortunately, bench-marks on AMD FX-8350 show less difference than noises.\r\nThere was already no room left for improving branch prediction.\r\nI used your bench mark.\r\nhttps://github.com/starius/lang-bench/blob/master/f3/test.lua\r\nand tested plain Lua-5.3.2, your computed-goto branch, and mine.\r\nlinux 'perf' tools show FX-8350 misses only 0.01% branches at these bench marks, including switch based plain Lua.\r\nI wonder what on other processor."},"comment":{"url":"https://api.github.com/repos/starius/lua/issues/comments/183658752","html_url":"https://github.com/starius/lua/pull/1#issuecomment-183658752","issue_url":"https://api.github.com/repos/starius/lua/issues/1","id":183658752,"user":{"login":"abo-junghichi","id":17121461,"avatar_url":"https://avatars.githubusercontent.com/u/17121461?v=3","gravatar_id":"","url":"https://api.github.com/users/abo-junghichi","html_url":"https://github.com/abo-junghichi","followers_url":"https://api.github.com/users/abo-junghichi/followers","following_url":"https://api.github.com/users/abo-junghichi/following{/other_user}","gists_url":"https://api.github.com/users/abo-junghichi/gists{/gist_id}","starred_url":"https://api.github.com/users/abo-junghichi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abo-junghichi/subscriptions","organizations_url":"https://api.github.com/users/abo-junghichi/orgs","repos_url":"https://api.github.com/users/abo-junghichi/repos","events_url":"https://api.github.com/users/abo-junghichi/events{/privacy}","received_events_url":"https://api.github.com/users/abo-junghichi/received_events","type":"User","site_admin":false},"created_at":"2016-02-13T12:38:29Z","updated_at":"2016-02-13T12:38:29Z","body":"I tried once but failed.\n\n\"asm\" functionality require immediate string for the first argument.\nbut __LINE__ macro is represented as immediate numbers.\nAnd macro is resolved from outer to inner, preventing __LINE__ number to string with macro system.\nIf you change __LINE__ to string with macro system, it become string before providing line number.\nFor example,\n--\n#define TRY(line) asm(#line \"##line##\") \nTRY(__LINE__);\n--\nis end up as below.\n-- pre-processor is done --\nasm(\"__LINE__\" \"##line##\");\n-- assembler --\n#APP\n        __LINE__##line##\n#NO_APP\n--\nChanging __LINE__ number to string for asm argument is impossible with macro system alone.\nI settled down to use another GCC asm extention.\n--\nasm(\"%0\"::\"i\"(__LINE__));\n-- assembler --\n#APP\n        $15\n#NO_APP\n--\nAccording to gcc.info, \"i\" is a simple \"constraint\" and independent from cpu architecture.\nAs far as we stick with gcc, this code should work for all cpu architectures.\nDealing with immediate integer is almost primitive for assembler.\nI guess other compiler also has this ability.\n"}}