Skip to content

Commit

Permalink
Merge branch 'master' into fix/imported-functions-must-be-send
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkMcCaskey authored Jan 21, 2020
2 parents 8c760da + caa651c commit f1db4ae
Show file tree
Hide file tree
Showing 29 changed files with 1,421 additions and 844 deletions.
12 changes: 6 additions & 6 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ src/ @syrusakbary @MarkMcCaskey

# Backends
lib/singlepass-backend @losfair @nlewycky
lib/clif-backend @nlewycky @bjfish
lib/clif-backend @nlewycky
lib/llvm-backend @nlewycky @losfair

# Runtime
lib/runtime-core @Hywan @bjfish
lib/runtime @MarkMcCaskey @Hywan @bjfish
lib/runtime-c-api @bjfish @Hywan
lib/win-exception-handler @bjfish @losfair
lib/middleware-common @bjfish @losfair
lib/runtime-core @Hywan
lib/runtime @MarkMcCaskey @Hywan
lib/runtime-c-api @Hywan
lib/win-exception-handler @losfair
lib/middleware-common @losfair

# Frontend integrations

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## **[Unreleased]**

- [#1161](https://github.com/wasmerio/wasmer/pull/1161) Require imported functions to be `Send`. This is a breaking change that fixes a soundness issue in the API.
- [#1129](https://github.com/wasmerio/wasmer/pull/1129) Standard exception types for singlepass backend.
- [#1140](https://github.com/wasmerio/wasmer/pull/1140) Use [`blake3`](https://github.com/BLAKE3-team/BLAKE3) as default hashing algorithm for caching.

## 0.13.1 - 2020-01-16
- Fix bug in wapm related to the `package.wasmer_extra_flags` entry in the manifest
Expand Down
57 changes: 33 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 25 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,36 @@ jobs:
- template: .azure/install-rust.yml
- script: |
rustup component add rustfmt
rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
displayName: Lint dependencies
- script: cargo fmt --all -- --check
displayName: Lint
variables:
rust_toolchain: '1.39.0'

- job: clippy_lint
pool:
vmImage: "ubuntu-18.04"
steps:
- checkout: self
submodules: true
- template: .azure/install-rust.yml
- template: .azure/install-llvm.yml
- template: .azure/install-sccache.yml
- template: .azure/install-cmake.yml
- script: |
rustup component add rustfmt
rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
displayName: Lint dependencies with clippy
- script: cargo clippy --workspace
displayName: Clippy Lint
variables:
rust_toolchain: nightly-2019-12-19

- job: Test
strategy:
matrix:
linux:
imageName: "ubuntu-16.04"
imageName: "ubuntu-18.04"
rust_toolchain: nightly-2019-12-19
mac:
imageName: "macos-10.14"
Expand Down Expand Up @@ -73,7 +91,7 @@ jobs:

- job: Check
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-18.04"
variables:
rust_toolchain: nightly-2019-12-19
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying')
Expand All @@ -92,7 +110,7 @@ jobs:
strategy:
matrix:
linux:
imageName: "ubuntu-16.04"
imageName: "ubuntu-18.04"
rust_toolchain: nightly-2019-12-19
mac:
imageName: "macos-10.14"
Expand Down Expand Up @@ -159,7 +177,7 @@ jobs:
strategy:
matrix:
linux:
imageName: "ubuntu-16.04"
imageName: "ubuntu-18.04"
rust_toolchain: nightly-2019-12-19
mac:
imageName: "macos-10.14"
Expand Down Expand Up @@ -212,7 +230,7 @@ jobs:

- job: Build_Docs
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-18.04"
variables:
rust_toolchain: nightly-2019-08-15
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying')
Expand Down Expand Up @@ -287,7 +305,7 @@ jobs:
- Build_Docs
displayName: Deploy API Documentation to GitHub
pool:
vmImage: "ubuntu-16.04"
vmImage: "ubuntu-18.04"
condition: in(variables['Build.SourceBranch'], 'refs/heads/master')
steps:
- checkout: self
Expand Down
7 changes: 4 additions & 3 deletions lib/llvm-backend/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1171,9 +1171,10 @@ pub fn tbaa_label<'ctx>(

// TODO: ContextRef can't return us the lifetime from module through Deref.
// This could be fixed once generic_associated_types is stable.
let context2 = &*context;
let context = unsafe { std::mem::transmute::<&Context, &'ctx Context>(context2) };
std::mem::forget(context2);
let context = {
let context2 = &*context;
unsafe { std::mem::transmute::<&Context, &'ctx Context>(context2) }
};

// `!wasmer_tbaa_root = {}`, the TBAA root node for wasmer.
let tbaa_root = module
Expand Down
42 changes: 26 additions & 16 deletions lib/runtime-c-api/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@ pub(crate) fn take_last_error() -> Option<Box<dyn Error>> {
LAST_ERROR.with(|prev| prev.borrow_mut().take())
}

/// Gets the length in bytes of the last error.
/// Gets the length in bytes of the last error if any.
///
/// This can be used to dynamically allocate a buffer with the correct number of
/// bytes needed to store a message.
///
/// # Example
///
/// ```c
/// int error_len = wasmer_last_error_length();
/// char *error_str = malloc(error_len);
/// ```
/// See `wasmer_last_error_message()` to get a full example.
#[no_mangle]
pub extern "C" fn wasmer_last_error_length() -> c_int {
LAST_ERROR.with(|prev| match *prev.borrow() {
Expand All @@ -40,19 +36,33 @@ pub extern "C" fn wasmer_last_error_length() -> c_int {
})
}

/// Stores the last error message into the provided buffer up to the given `length`.
/// The `length` parameter must be large enough to store the last error message.
/// Gets the last error message if any into the provided buffer
/// `buffer` up to the given `length`.
///
/// Returns the length of the string in bytes.
/// Returns `-1` if an error occurs.
/// The `length` parameter must be large enough to store the last
/// error message. Ideally, the value should come from
/// `wasmer_last_error_length()`.
///
/// # Example
/// The function returns the length of the string in bytes, `-1` if an
/// error occurs. Potential errors are:
///
/// * The buffer is a null pointer,
/// * The buffer is too smal to hold the error message.
///
/// Note: The error message always has a trailing null character.
///
/// Example:
///
/// ```c
/// int error_len = wasmer_last_error_length();
/// char *error_str = malloc(error_len);
/// wasmer_last_error_message(error_str, error_len);
/// printf("Error str: `%s`\n", error_str);
/// int error_length = wasmer_last_error_length();
///
/// if (error_length > 0) {
/// char *error_message = malloc(error_length);
/// wasmer_last_error_message(error_message, error_length);
/// printf("Error message: `%s`\n", error_message);
/// } else {
/// printf("No error message\n");
/// }
/// ```
#[no_mangle]
pub unsafe extern "C" fn wasmer_last_error_message(buffer: *mut c_char, length: c_int) -> c_int {
Expand Down
Loading

0 comments on commit f1db4ae

Please sign in to comment.