{"action":"created","issue":{"url":"https://api.github.com/repos/servo/rust-mozjs/issues/150","labels_url":"https://api.github.com/repos/servo/rust-mozjs/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/servo/rust-mozjs/issues/150/comments","events_url":"https://api.github.com/repos/servo/rust-mozjs/issues/150/events","html_url":"https://github.com/servo/rust-mozjs/pull/150","id":79057512,"number":150,"title":"Upgrade to SM 39","user":{"login":"michaelwu","id":719931,"avatar_url":"https://avatars.githubusercontent.com/u/719931?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelwu","html_url":"https://github.com/michaelwu","followers_url":"https://api.github.com/users/michaelwu/followers","following_url":"https://api.github.com/users/michaelwu/following{/other_user}","gists_url":"https://api.github.com/users/michaelwu/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelwu/subscriptions","organizations_url":"https://api.github.com/users/michaelwu/orgs","repos_url":"https://api.github.com/users/michaelwu/repos","events_url":"https://api.github.com/users/michaelwu/events{/privacy}","received_events_url":"https://api.github.com/users/michaelwu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-05-21T15:58:24Z","updated_at":"2015-06-18T21:44:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/servo/rust-mozjs/pulls/150","html_url":"https://github.com/servo/rust-mozjs/pull/150","diff_url":"https://github.com/servo/rust-mozjs/pull/150.diff","patch_url":"https://github.com/servo/rust-mozjs/pull/150.patch"},"body":"Some things have been implemented in rust.rs. Where possible, things are being implemented using the structs generated by my bindgen fork (which I will call bindgen++ from now on).\r\n\r\njsapi.rs has been hand edited a bit. Note that jsapi.rs is generated from jsfriendapi.hpp so we can eliminate jsfriendapi.rs entirely. Making jsfriendapi.rs work with with jsapi.rs was a bit difficult, so I combined them to sidestep the problem.\r\n\r\nHere are the things I had to hand edit in jsapi.rs:\r\n- Adding \"unsafe impl Sync for \" for structs that are statically defined.\r\n- Adding \"pub enum Foo {}\" for types not defined in js headers. (usually mfbt)\r\n- Adding \"#[derive(Copy)]\" where necessary to those defines.\r\n- Removing derive copy from autogenerated structs that don't support it because bindgen++ doesn't fully define all the structs it depends on.\r\n- Trimming away generics for structs that didn't get converted successfully. This can happen for a number of reasons:\r\n  - bindgen++ can only convert templates that work on types\r\n  - bindgen++ can't convert the classes that a struct/class might inherit from\r\n- 64 bit issues:\r\n  - Certain types need to be converted back to size_t since bindgen++ currently replaces them with u32 or u64. This will be fixed.\r\n  - Some mangled function names are different between 32 bit and 64 bit, usually because of 64 bit types and size_t/long. In these cases, functions are hand edited to add 64bit versions. Might be fixed in the future, but for now we can only detect these problems when code doesn't link.\r\n- Spidermonkey checks for the address of JS_GlobalObjectTraceHook in globals. For now, I made the mangled name public so we can grab the real function address, but we can probably do a little bit better.\r\n- References to JSVal are replaced with Value, since jsapi.rs and jsval.rs both define JSVal. In jsapi.rs, JSVal is just a typedef to Value, so we can drop JSVal in jsapi.rs.\r\n- bindgen++ doesn't support preprocessor defines at the moment, so some defines were manually added.\r\n- JSJitMethodCallArgs was manually defined.\r\n- JS_GetRuntime wasn't converted by bindgen++, so it was manually added. Need to investigate.\r\n- Structs with unions generated by bindgen++ are generally unusable for statically defined things, so the necessary structs were modified to be more friendly for that case.\r\n\r\nhttps://github.com/servo/rust-mozjs/pull/144"},"comment":{"url":"https://api.github.com/repos/servo/rust-mozjs/issues/comments/113298035","html_url":"https://github.com/servo/rust-mozjs/pull/150#issuecomment-113298035","issue_url":"https://api.github.com/repos/servo/rust-mozjs/issues/150","id":113298035,"user":{"login":"bors-servo","id":4368172,"avatar_url":"https://avatars.githubusercontent.com/u/4368172?v=3","gravatar_id":"","url":"https://api.github.com/users/bors-servo","html_url":"https://github.com/bors-servo","followers_url":"https://api.github.com/users/bors-servo/followers","following_url":"https://api.github.com/users/bors-servo/following{/other_user}","gists_url":"https://api.github.com/users/bors-servo/gists{/gist_id}","starred_url":"https://api.github.com/users/bors-servo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bors-servo/subscriptions","organizations_url":"https://api.github.com/users/bors-servo/orgs","repos_url":"https://api.github.com/users/bors-servo/repos","events_url":"https://api.github.com/users/bors-servo/events{/privacy}","received_events_url":"https://api.github.com/users/bors-servo/received_events","type":"User","site_admin":false},"created_at":"2015-06-18T21:44:30Z","updated_at":"2015-06-18T21:44:30Z","body":":broken_heart: Test failed - [travis](https://travis-ci.org/servo/rust-mozjs/builds/67438857)"}}