Add a FuncEnvironment::make_indirect_sig() callback.

The function environment is now expected to keep track of the function
signatures in the module, and it is asked to generate Cretonne
signatures to be used for indirect calls.

The combination of make_indirect_sig() and translate_call_indirect()
callbacks allow the runtime to insert additional function arguments for
indirect calls such as vmctx pointers and CFI-style signature identifiers.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-06 10:28:11 -07:00
parent 320c88f365
commit 27e9e16077
7 changed files with 103 additions and 37 deletions

View File

@@ -81,7 +81,7 @@ pub fn translate_module(
loop {
match *parser.read_with_input(next_input) {
ParserState::BeginSection { code: SectionCode::Type, .. } => {
match parse_function_signatures(&mut parser) {
match parse_function_signatures(&mut parser, runtime) {
Ok(sigs) => signatures = Some(sigs),
Err(SectionParsingError::WrongSectionContent(s)) => {
return Err(format!("wrong content in the type section: {}", s))