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 upWIP smup #119
WIP smup #119
Conversation
This needs to make its way upstream
This needs to be ported over to the m-c patch queue.
…ue to Vec.
This fixes safe_extern_statics warnings; see <rust-lang/rust#36247>.
by changing it to use pointers instead. Fixes #311
We should be able to create a default value for any Heap<*mut T> where *mut T implements GCMethods<*mut T> and Copy, not just for Heap<*mut JSObject>.
Currently, to create a Heap<T>, one first has to create a Heap<T>::default, and then call Heap<T>::set. This is a common pattern and therefore should be abstracted behind a method.
We expose several JSAPI functions that are used for tracing. By abstracting these functions behind a trait we can overload them on the type to be traced.
This is what's required for catch_unwind; there's no need to be stricter.
The only remaining OOL calls are ToWindowIfWindowProxy and JS_WrapValue, like in the equivalent Gecko function.
Rust-mozjs currently does not define any methods to create instances of HandleValueArray. Consequently, consumers have to create these instances manually. This is unnecessary boilerplate, and therefore should be abstracted behind a function.
This should make it harder to use Rooted in an unsound way (when not using the rooted!() macro).
|
I totally ignored the first two commits. The rest of the changes all look pretty sensible. |
| @@ -1,12 +0,0 @@ | |||
| [package] | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
fitzgen
Jul 10, 2017
Author
Member
Cargo will complain about malformed toml files and refuse to look any further.
I upstreamed this into the js/src/make-source-package.sh bundling script that creates the source release tarballs. If we ever want to point directly at a revision of m-c, rather than snapshots in this repo, then we will need another fix.
| @@ -1,15 +0,0 @@ | |||
| [package] | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jul 10, 2017
Member
Same question - do we need to automate the removal of these each time we update SpiderMonkey?
| @@ -25,7 +26,16 @@ fn build_jsglue_cpp() { | |||
|
|
|||
| /// Find the public include directory within our mozjs-sys crate dependency. | |||
| fn get_mozjs_include_dir() -> path::PathBuf { | |||
| let entries = glob::glob("./target/*/build/mozjs_sys-*/out/dist/include") | |||
| let out_dir = env::var("OUT_DIR") | |||
This comment has been minimized.
This comment has been minimized.
jdm
Jul 10, 2017
Member
The commit message mentions the need for upstreaming. Has this happened? Is this still WIP?
This comment has been minimized.
This comment has been minimized.
fitzgen
Jul 10, 2017
Author
Member
The upstreaming is still theoretical because none of js/rust has actually landed in m-c yet. The m-c patches I had are fairly out of date now, and need to be recreated anyways, so this won't get lost.
| @@ -122,6 +122,8 @@ const WHITELIST_TYPES: &'static [&'static str] = &[ | |||
| "js::Class", | |||
| "JS::CompartmentOptions", | |||
| "JS::ContextOptions", | |||
| "js::DOMCallbacks", | |||
This comment has been minimized.
This comment has been minimized.
| @@ -160,6 +160,7 @@ const WHITELIST_TYPES: &'static [&'static str] = &[ | |||
| "JSType", | |||
| "JSValueTag", | |||
| "JSValueType", | |||
| "JSVersion", | |||
This comment has been minimized.
This comment has been minimized.
| callbacks: &jsapi::JSStructuredCloneCallbacks) | ||
| -> bool { | ||
| unsafe { | ||
| (*self.raw).read(Runtime::get(), vp, callbacks as *const _, ptr::null_mut()) |
This comment has been minimized.
This comment has been minimized.
| callbacks: &jsapi::JSStructuredCloneCallbacks) | ||
| -> bool { | ||
| unsafe { | ||
| (*self.raw).write(Runtime::get(), v, callbacks as *const _, ptr::null_mut()) |
This comment has been minimized.
This comment has been minimized.
| pub fn write(&mut self, | ||
| v: jsapi::JS::HandleValue, | ||
| callbacks: &jsapi::JSStructuredCloneCallbacks) | ||
| -> bool { |
This comment has been minimized.
This comment has been minimized.
|
|
||
| /// Copy the given slice into this buffer. Returns false when an underlying | ||
| /// JSAPI call fails. | ||
| pub fn write_bytes(&mut self, bytes: &[u8]) -> bool { |
This comment has been minimized.
This comment has been minimized.
| @@ -5,7 +5,7 @@ | |||
| extern crate num_cpus; | |||
|
|
|||
| use std::env; | |||
| use std::path; | |||
| // use std::path; | |||
This comment has been minimized.
This comment has been minimized.
|
@jdm thanks for the initial pass on review! I pushed some new commits that should address your feedback. |
|
Regarding squashing: I can squash everything that isn't a rebase from servo/rust-mozjs into a single commit before landing. That's probably easiest. |
|
Approval conditional on getting CI working again, of course. |
|
@UK992, hello! I've been informed that you have helped out with Servo + windows build issues in the past before. If you have the cycles, I'd appreciate some help here (no worries if not!). I can build SpiderMonkey on Windows with MSVC just fine from Thanks for your help!
|
|
|
atouchet
commented
Aug 21, 2018
|
Can this be closed now? |
fitzgen commentedJun 2, 2017
•
edited by larsbergstrom
This change is