Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUpgrade to SM 39 #144
Closed
Upgrade to SM 39 #144
Conversation
|
That sounds exactly like what I ran into for Root vs Root<*mut T> in the previous upgrade attempt. |
29082a1
to
9dbf6fe
Merged
bors-servo
pushed a commit
that referenced
this pull request
Jun 18, 2015
Upgrade to SM 39
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).
jsapi.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.
Here are the things I had to hand edit in jsapi.rs:
- Adding "unsafe impl Sync for " for structs that are statically defined.
- Adding "pub enum Foo {}" for types not defined in js headers. (usually mfbt)
- Adding "#[derive(Copy)]" where necessary to those defines.
- Removing derive copy from autogenerated structs that don't support it because bindgen++ doesn't fully define all the structs it depends on.
- Trimming away generics for structs that didn't get converted successfully. This can happen for a number of reasons:
- bindgen++ can only convert templates that work on types
- bindgen++ can't convert the classes that a struct/class might inherit from
- 64 bit issues:
- Certain types need to be converted back to size_t since bindgen++ currently replaces them with u32 or u64. This will be fixed.
- 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.
- 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.
- 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.
- bindgen++ doesn't support preprocessor defines at the moment, so some defines were manually added.
- JSJitMethodCallArgs was manually defined.
- JS_GetRuntime wasn't converted by bindgen++, so it was manually added. Need to investigate.
- 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.
#144
mmatyas
pushed a commit
to mmatyas/rust-mozjs
that referenced
this pull request
Jul 30, 2015
Add Crates dependency for libc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
michaelwu commentedApr 24, 2015
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).
jsapi.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.
Here are the things I had to hand edit in jsapi.rs: