{"action":"opened","issue":{"url":"https://api.github.com/repos/typelead/intellij-eta/issues/1","repository_url":"https://api.github.com/repos/typelead/intellij-eta","labels_url":"https://api.github.com/repos/typelead/intellij-eta/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/typelead/intellij-eta/issues/1/comments","events_url":"https://api.github.com/repos/typelead/intellij-eta/issues/1/events","html_url":"https://github.com/typelead/intellij-eta/issues/1","id":297742614,"number":1,"title":"Incorrect bytecode while using Int64/Long in FFI export","user":{"login":"jarekratajski","id":6316808,"avatar_url":"https://avatars1.githubusercontent.com/u/6316808?v=4","gravatar_id":"","url":"https://api.github.com/users/jarekratajski","html_url":"https://github.com/jarekratajski","followers_url":"https://api.github.com/users/jarekratajski/followers","following_url":"https://api.github.com/users/jarekratajski/following{/other_user}","gists_url":"https://api.github.com/users/jarekratajski/gists{/gist_id}","starred_url":"https://api.github.com/users/jarekratajski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarekratajski/subscriptions","organizations_url":"https://api.github.com/users/jarekratajski/orgs","repos_url":"https://api.github.com/users/jarekratajski/repos","events_url":"https://api.github.com/users/jarekratajski/events{/privacy}","received_events_url":"https://api.github.com/users/jarekratajski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-16T10:40:05Z","updated_at":"2018-02-16T10:40:05Z","closed_at":null,"author_association":"NONE","body":"The Eta Programming Language Compiler, Version 0.7.0b2, Git Revision e1e86240442f4c4eb8dc6348f06ae901a11b65e5\r\n\r\nCompiling Eta code that effectively export function  with 2 **long** arguments :\r\n```\r\nf3::Int64->Int64->Int64\r\nf3 v1 v2  =  v1 + v2\r\n\r\nforeign export java \"@static test.T.f3\"  f3::Int64->Int64-> Int64\r\n```\r\n\r\nCreates such bytecode:\r\n```\r\npublic static long f3(long, long);\r\n    Code:\r\n       0: new           #11                 // class eta/runtime/thunk/Ap2Upd\r\n       3: dup\r\n       4: invokestatic  #13                 // Method base/ghc/TopHandler.runNonIO:()Leta/runtime/stg/Closure;\r\n       7: new           #21                 // class eta/runtime/thunk/Ap3Upd\r\n      10: dup\r\n      11: invokestatic  #23                 // Method main/Main.$fe_f3:()Leta/runtime/stg/Closure;\r\n      14: new           #28                 // class base/ghc/int/datacons/I64zh\r\n      17: dup\r\n      18: lload_0\r\n      19: invokespecial #30                 // Method base/ghc/int/datacons/I64zh.\"<init>\":(J)V\r\n      22: new           #28                 // class base/ghc/int/datacons/I64zh\r\n      25: dup\r\n      26: lload_1\r\n      27: invokespecial #30                 // Method base/ghc/int/datacons/I64zh.\"<init>\":(J)V\r\n      30: invokespecial #33                 // Method eta/runtime/thunk/Ap3Upd.\"<init>\":(Leta/runtime/stg/Closure;Leta/runtime/stg/Closure;Leta/runtime/stg/Closure;)V\r\n      33: invokespecial #36                 // Method eta/runtime/thunk/Ap2Upd.\"<init>\":(Leta/runtime/stg/Closure;Leta/runtime/stg/Closure;)V\r\n      36: invokestatic  #39                 // Method eta/runtime/Runtime.evalIO:(Leta/runtime/stg/Closure;)Leta/runtime/stg/Closure;\r\n      39: checkcast     #28                 // class base/ghc/int/datacons/I64zh\r\n      42: getfield      #45                 // Field base/ghc/int/datacons/I64zh.x1:J\r\n      45: lreturn\r\n\r\n```\r\n\r\nWhichfails upon calling/loading with :\r\n```\r\nException in thread \"main\" java.lang.VerifyError: Bad local variable type\r\nException Details:\r\n  Location:\r\n    test/T.f3(JJ)J @26: lload_1\r\n  Reason:\r\n    Type long_2nd (current frame, locals[1]) is not assignable to long\r\n  Current Frame:\r\n    bci: @26\r\n    flags: { }\r\n    locals: { long, long_2nd, long, long_2nd }\r\n    stack: { uninitialized 0, uninitialized 0, 'eta/runtime/stg/Closure', uninitialized 7, uninitialized 7, 'eta/runtime/stg/Closure', 'base/ghc/int/datacons/I64zh', uninitialized 22, uninitialized 22 }\r\n  Bytecode:\r\n    0x0000000: bb00 0b59 b800 0dbb 0015 59b8 0017 bb00\r\n    0x0000010: 1c59 1eb7 001e bb00 1c59 1fb7 001e b700\r\n    0x0000020: 21b7 0024 b800 27c0 001c b400 2dad    \r\n```\r\n\r\nCorrect bytecode would be changine line 26: to\r\n```\r\n      25: dup\r\n      26: lload_2                                   //longs occupy 2 slots on stack!\r\n      27: invokespecial #30                 // Method base/ghc/int/datacons/I64zh.\"<init>\":(J)V\r\n```"}}
{"actor":{"display_login":"jarekratajski"}}