{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3508","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3508/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3508/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3508/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/3508","id":46552042,"number":3508,"title":"Instability in code output with compiler cache","user":{"login":"ncannasse","id":1022912,"avatar_url":"https://avatars.githubusercontent.com/u/1022912?v=3","gravatar_id":"","url":"https://api.github.com/users/ncannasse","html_url":"https://github.com/ncannasse","followers_url":"https://api.github.com/users/ncannasse/followers","following_url":"https://api.github.com/users/ncannasse/following{/other_user}","gists_url":"https://api.github.com/users/ncannasse/gists{/gist_id}","starred_url":"https://api.github.com/users/ncannasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncannasse/subscriptions","organizations_url":"https://api.github.com/users/ncannasse/orgs","repos_url":"https://api.github.com/users/ncannasse/repos","events_url":"https://api.github.com/users/ncannasse/events{/privacy}","received_events_url":"https://api.github.com/users/ncannasse/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"Simn","id":634365,"avatar_url":"https://avatars.githubusercontent.com/u/634365?v=3","gravatar_id":"","url":"https://api.github.com/users/Simn","html_url":"https://github.com/Simn","followers_url":"https://api.github.com/users/Simn/followers","following_url":"https://api.github.com/users/Simn/following{/other_user}","gists_url":"https://api.github.com/users/Simn/gists{/gist_id}","starred_url":"https://api.github.com/users/Simn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Simn/subscriptions","organizations_url":"https://api.github.com/users/Simn/orgs","repos_url":"https://api.github.com/users/Simn/repos","events_url":"https://api.github.com/users/Simn/events{/privacy}","received_events_url":"https://api.github.com/users/Simn/received_events","type":"User","site_admin":false},"milestone":null,"comments":31,"created_at":"2014-10-22T19:47:39Z","updated_at":"2015-01-12T17:46:49Z","closed_at":null,"body":"I had some guesses about it while working in JS, but working in C++ confirmed it : we have a significant amount of instability with our code output due to more or less recent changes.\r\n\r\nWhat I mean by \"instability\" is that depending either in the compilation order or the usage of compilation server (which also changes compilation order), we will get a different output for the same code base.\r\n\r\nHere's an example, the method `setAlpha` of `h2d.Drawable`, is declared as:\r\n\r\n```\r\ninline function set_alpha(v) {\r\n\treturn color.a = v;\r\n}\r\n```\r\n\r\nColor is an h3d.Vector, and the `a` component is a mapping to `w` (see https://github.com/ncannasse/heaps/blob/master/h3d/Vector.hx)\r\n\r\nA compilation to C++ gave me the following output:\r\n\r\n```\r\nFloat Drawable_obj::set_alpha( Float v){\r\n\tHX_STACK_FRAME(\"h2d.Drawable\",\"set_alpha\",0x2a19a8a5,\"h2d.Drawable.set_alpha\",\"h2d/Drawable.hx\",83,0xa05adb4b)\r\n\tHX_STACK_THIS(this)\r\n\tHX_STACK_ARG(v,\"v\")\r\n\tHX_STACK_LINE(84)\r\n\tFloat _g2;\t\tHX_STACK_VAR(_g2,\"_g2\");\r\n\tHX_STACK_LINE(84)\r\n\t{\r\n\t\tHX_STACK_LINE(84)\r\n\t\t::h3d::Vector _g = this->color;\t\tHX_STACK_VAR(_g,\"_g\");\r\n\t\tHX_STACK_LINE(84)\r\n\t\tFloat _g1 = _g->w = v;\t\tHX_STACK_VAR(_g1,\"_g1\");\r\n\t\tHX_STACK_LINE(84)\r\n\t\tFloat _g3 = _g1;\t\tHX_STACK_VAR(_g3,\"_g3\");\r\n\t\tHX_STACK_LINE(84)\r\n\t\t_g2 = _g3;\r\n\t}\r\n\tHX_STACK_LINE(84)\r\n\treturn _g2;\r\n}\r\n```\r\n\r\nAnd another one this one:\r\n\r\n```\r\nFloat Drawable_obj::set_alpha( Float v){\r\n\tHX_STACK_FRAME(\"h2d.Drawable\",\"set_alpha\",0x2a19a8a5,\"h2d.Drawable.set_alpha\",\"h2d/Drawable.hx\",83,0xa05adb4b)\r\n\tHX_STACK_THIS(this)\r\n\tHX_STACK_ARG(v,\"v\")\r\n\tHX_STACK_LINE(84)\r\n\t::h3d::Vector _g = this->color;\t\tHX_STACK_VAR(_g,\"_g\");\r\n\tHX_STACK_LINE(84)\r\n\tFloat _g1 = _g->w = v;\t\tHX_STACK_VAR(_g1,\"_g1\");\r\n\tHX_STACK_LINE(84)\r\n\treturn _g1;\r\n}\r\n```\r\n\r\nBoth are correct, but they have different code output. It is particularly important for platforms such as C++ to have a high stability since changing even a local variable name will mean recompiling the whole file.\r\n\r\nAssigning to @Simn since this is something important to fix before 3.2 release.\r\n"},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/comments/69611773","html_url":"https://github.com/HaxeFoundation/haxe/issues/3508#issuecomment-69611773","issue_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/3508","id":69611773,"user":{"login":"ncannasse","id":1022912,"avatar_url":"https://avatars.githubusercontent.com/u/1022912?v=3","gravatar_id":"","url":"https://api.github.com/users/ncannasse","html_url":"https://github.com/ncannasse","followers_url":"https://api.github.com/users/ncannasse/followers","following_url":"https://api.github.com/users/ncannasse/following{/other_user}","gists_url":"https://api.github.com/users/ncannasse/gists{/gist_id}","starred_url":"https://api.github.com/users/ncannasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncannasse/subscriptions","organizations_url":"https://api.github.com/users/ncannasse/orgs","repos_url":"https://api.github.com/users/ncannasse/repos","events_url":"https://api.github.com/users/ncannasse/events{/privacy}","received_events_url":"https://api.github.com/users/ncannasse/received_events","type":"User","site_admin":false},"created_at":"2015-01-12T17:46:49Z","updated_at":"2015-01-12T17:46:49Z","body":"I will check again asap"}}