Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for JavascriptCore #3825

Merged
merged 91 commits into from
May 3, 2023
Merged

Added support for JavascriptCore #3825

merged 91 commits into from
May 3, 2023

Conversation

syrusakbary
Copy link
Member

Added support for JavascriptCore as a backend in Wasmer, and available through the jsc feature in the wasmer crate

@@ -1,5 +1,7 @@
#[cfg(feature = "js")]
use crate::js::externals::table as table_impl;
#[cfg(feature = "jsc")]
Copy link
Contributor

Choose a reason for hiding this comment

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

If we introduce jsc as a feature, perhaps js needs to be renamed to jsb (JavascriptBrowser)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd call it web.

But that'll need to wait for 4.0.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer not to change current feature flags

@@ -0,0 +1,39 @@
use std::any::Any;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can any of these files be made common between jsc and js? Perhaps using a #[path()] attribute?

// });
// structuredClone(memory)
// ```
unsafe impl Send for Memory {}
Copy link
Contributor

Choose a reason for hiding this comment

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

If we can avoid this it would be better

Ok(())
}

pub(crate) fn read_uninit<'b>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this code common between js and jsc? It's an area that can easily get bugs so making its footprint smaller will help

/// Set a global, at index idx. Will panic if idx is out of range
/// Safety: the caller should check taht the raw value is compatible
/// with destination VMGlobal type
pub fn set_global_unchecked(&self, idx: usize, new_val: u128) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is not implemented then won't it break threading and forking?

@@ -1,5 +1,7 @@
#[cfg(feature = "js")]
use crate::js::externals::table as table_impl;
#[cfg(feature = "jsc")]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd call it web.

But that'll need to wait for 4.0.

lib/cli/src/bin/wasmer-jsc.rs Outdated Show resolved Hide resolved
lib/cli/Cargo.toml Outdated Show resolved Hide resolved
lib/api/src/jsc/module.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@ptitSeb ptitSeb left a comment

Choose a reason for hiding this comment

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

If some of the code could be mutualised with the js backend, that would be great for future maintenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants