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

Add MiddlewareChain and StreamingCompiler to runtime #490

Merged
merged 1 commit into from
Jun 10, 2019

Conversation

bjfish
Copy link
Contributor

@bjfish bjfish commented Jun 10, 2019

It would be nice to add MiddlewareChain and StreamingCompiler to runtime to be able to use these without having to include the runtime-core as a dependency. For example:

use wasmer_runtime::{MiddlewareChain, StreamingCompiler};
use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG;
use wasmer_middleware_common::metering::Metering;
let limit = 1_000_000;
let c: StreamingCompiler<SinglePassMCG, _, _, _, _> = StreamingCompiler::new(move || {
    let mut chain = MiddlewareChain::new();
    chain.push(Metering::new(limit));
    chain
});            
wasmer_runtime::compile_with(&prepared_code, &c)
    .map_err(|e| Error::Wasmer(format!("{}", e)))
            chain
        });            
wasmer_runtime::compile_with(&prepared_code, &c)
    .map_err(|e| Error::Wasmer(format!("{}", e)))

@bjfish bjfish requested a review from losfair June 10, 2019 04:27
@bjfish
Copy link
Contributor Author

bjfish commented Jun 10, 2019

bors try

bors bot added a commit that referenced this pull request Jun 10, 2019
@bors
Copy link
Contributor

bors bot commented Jun 10, 2019

@syrusakbary
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Jun 10, 2019
490: Add MiddlewareChain and StreamingCompiler to runtime r=syrusakbary a=bjfish

It would be nice to add `MiddlewareChain` and `StreamingCompiler` to runtime to be able to use these without having to include the `runtime-core` as a dependency. For example:
```rust
use wasmer_runtime::{MiddlewareChain, StreamingCompiler};
use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG;
use wasmer_middleware_common::metering::Metering;
let limit = 1_000_000;
let c: StreamingCompiler<SinglePassMCG, _, _, _, _> = StreamingCompiler::new(move || {
    let mut chain = MiddlewareChain::new();
    chain.push(Metering::new(limit));
    chain
});            
wasmer_runtime::compile_with(&prepared_code, &c)
    .map_err(|e| Error::Wasmer(format!("{}", e)))
            chain
        });            
wasmer_runtime::compile_with(&prepared_code, &c)
    .map_err(|e| Error::Wasmer(format!("{}", e)))
```

Co-authored-by: Brandon Fish <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jun 10, 2019

@bors bors bot merged commit c678647 into master Jun 10, 2019
@bors bors bot deleted the feature/add-middleware-compiler-to-runtime branch June 10, 2019 10:12
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.

2 participants