Skip to content

WIP smup#17143

Closed
fitzgen wants to merge 1 commit intoservo:masterfrom
fitzgen:smup
Closed

WIP smup#17143
fitzgen wants to merge 1 commit intoservo:masterfrom
fitzgen:smup

Conversation

@fitzgen
Copy link
Contributor

@fitzgen fitzgen commented Jun 2, 2017

So this compiles and stuff, but not yet passing tests.

Here are the results of the DOM wpt, which I haven't started digging into yet:

Ran 285 tests finished in 104.0 seconds.
  • 21 ran as expected. 15 tests skipped.
  • 31 tests crashed unexpectedly
  • 233 tests timed out unexpectedly

This change is Reviewable

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #17104) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jun 5, 2017
@jdm jdm self-assigned this Jun 5, 2017
@jdm jdm added the S-awaiting-review There is new code that needs to be reviewed. label Jun 5, 2017
@fitzgen
Copy link
Contributor Author

fitzgen commented Jun 6, 2017

Fixed some issues in CodegenRust.py causing bad *const jsapi::JSJitInfo pointers; now seeing some MOZ_CRASHes inside spidermonkey.

@fitzgen
Copy link
Contributor Author

fitzgen commented Jun 8, 2017

Ok, fixed some more things to do with proxies, which upstream SpiderMonkey had changed where expandos and private objects are stored and I got subtly wrong when rebasing.

New dom WPT results are pretty close to passing:

Ran 285 tests finished in 81.0 seconds.
  • 248 ran as expected. 15 tests skipped.
  • 7 tests crashed unexpectedly
  • 30 tests timed out unexpectedly

@fitzgen
Copy link
Contributor Author

fitzgen commented Jun 16, 2017

No more crashes!

Ran 285 tests finished in 79.0 seconds.
  • 272 ran as expected. 15 tests skipped.
  • 13 tests timed out unexpectedly
  • 7 tests had unexpected subtest results

@fitzgen
Copy link
Contributor Author

fitzgen commented Jun 16, 2017

Seems like the timeouts and unexpected results were because I was using a debug + debugmozjs build \o/

Ran 285 tests finished in 26.0 seconds.
  • 285 ran as expected. 15 tests skipped.

@fitzgen fitzgen force-pushed the smup branch 2 times, most recently from f4aefda to ecde05f Compare June 22, 2017 21:46
@KiChjang
Copy link
Contributor

Huh, autospider is requiring gcc 4.9 or newer, and travis CI uses 4.8.4...

@jdm
Copy link
Member

jdm commented Jun 23, 2017

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #17472) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jun 23, 2017
Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All pretty minor changes that I've suggested.

pub fn leak_as_static<T>(t: T) -> &'static T {
let boxed = Box::new(t);
let ptr = &*boxed as *const T;
mem::forget(boxed);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let ptr = Box::into_raw(Box::new(t));

if descriptor.weakReferenceable:
create += """
JS_SetReservedSlot(obj.get(), DOM_WEAK_SLOT, PrivateValue(ptr::null()));"""
jsapi::JS_SetReservedSlot(obj.get(), DOM_WEAK_SLOT, &PrivateValue(ptr::null()) as *const _);"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cast would not be necessary.

JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT,
ObjectValue(unforgeable_holder.get()))"""))
jsapi::JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT,
&ObjectValue(unforgeable_holder.get()) as *const _)"""))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary cast.

unsafe extern "C" fn(*mut jsapi::JSContext,
jsapi::JS::HandleObject,
_,
_) -> bool) },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this transmute required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's there to change the *const ActualType parameter into a *const std::os::raw::c_void. Upon reflection this is better done with as.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm nevermind, as doesn't work here:

error[E0605]: non-primitive cast: `unsafe extern "C" fn(*mut js::jsapi::JSContext, js::jsapi::JS::Handle<*mut js::jsapi::JSObject>, *const dom::xmlhttprequesteventtarget::XMLHttpRequestEventTarget, js::jsapi::JSJitSetterCallArgs) -> bool {dom::bindings::codegen::Bindings::XMLHttpRequestEventTargetBinding::XMLHttpRequestEventTargetBinding::set_onloadend}` as `unsafe extern "C" fn(*mut js::jsapi::JSContext, js::jsapi::JS::Handle<*mut js::jsapi::JSObject>, *mut std::os::raw::c_void, *const js::jsapi::JSJitMethodCallArgs) -> bool`
   --> /home/fitzgen/servo/target/debug/build/script-11a815433a47bb39/out/Bindings/XMLHttpRequestEventTargetBinding.rs:885:22
    |
885 |           method: Some(set_onloadend as
    |  ______________________^
886 | |             unsafe extern "C" fn(*mut jsapi::JSContext,
887 | |                                  jsapi::JS::Handle<*mut jsapi::JSObject>,
888 | |                                  _,
889 | |                                  _) -> bool),
    | |___________________________________________^
    |
    = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait

//! | USVString | `USVString` |
//! | ByteString | `ByteString` |
//! | object | `*mut JSObject` |
//! | object | `*mut jsapi::JSObject` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the alignment in this table is now off.

let proto_array = PrivateValue(Box::into_raw(proto_array) as *const libc::c_void);
jsapi::JS_SetReservedSlot(rval.get(),
DOM_PROTOTYPE_SLOT,
&proto_array as *const _);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary cast.

});
JS_SetReservedSlot(object, DOM_WEAK_SLOT, PrivateValue(ptr as *const c_void));
let ptr = PrivateValue(ptr as *const c_void);
jsapi::JS_SetReservedSlot(object, DOM_WEAK_SLOT, &ptr as *const _);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary cast.

// When we finalize the window proxy, it drops the browsing context it owns.
SetProxyExtra(js_proxy.get(), 0, &PrivateValue((&*window_proxy).as_void_ptr()));
let private = js::jsval::PrivateValue((&*window_proxy).as_void_ptr());
SetProxyReservedSlot(js_proxy.get(), 0, &private as *const _);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary cast.

assert!(!window_jsobject.get().is_null());
assert!(((*get_object_class(window_jsobject.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoCompartment::new(cx, window_jsobject.get());
assert!(((*js::rust::get_object_class(window_jsobject.get())).flags & jsapi::JSCLASS_IS_GLOBAL) != 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should use the new helper that was added for this.

let mode = if val {
JSGCMode::JSGC_MODE_INCREMENTAL
jsapi::JSGCMode::JSGC_MODE_INCREMENTAL
} else if compartment {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps rename this now.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jul 13, 2017
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Aug 28, 2017
@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #18361) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Sep 3, 2017
@jdm jdm removed the S-awaiting-review There is new code that needs to be reviewed. label Sep 7, 2017
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Sep 20, 2017
@fitzgen
Copy link
Contributor Author

fitzgen commented Sep 20, 2017

Feedback addressed. Need to rebase again. Still blocked on windows stuff in servo/mozjs#119.

@jdm jdm added S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 2, 2017
@nox
Copy link
Contributor

nox commented Oct 3, 2017

Could you please revert all the qualified paths to jsapi items you introduced?

@fabricedesre
Copy link
Contributor

Is anyone still working on that?

@jdm
Copy link
Member

jdm commented Mar 18, 2018

@fabricedesre @asajeffrey is going to be resuming this work.

@asajeffrey
Copy link
Contributor

I'm going to talk to @nox in Berlin about how to move forward; I'm happy to look at smup, but the problem is that I have approximately zero windows experience.

@nox
Copy link
Contributor

nox commented Mar 19, 2018

@asajeffrey For Windows support I haven't much to say but "good luck".

@asajeffrey
Copy link
Contributor

Er, thanks.

@asajeffrey
Copy link
Contributor

#20585

@jdm
Copy link
Member

jdm commented Jun 19, 2018

Superseded.

@jdm jdm closed this Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. S-needs-rebase There are merge conflict errors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants