Integrated wasm test suite translation as cretonne test

This commit is contained in:
Denis Merigoux
2017-08-10 16:30:09 -07:00
parent 234e72a5b3
commit dfdab56a54
376 changed files with 116 additions and 8 deletions

View File

@@ -420,8 +420,8 @@ fn translate_operator(op: &Operator,
// We take the control frame pushed by the if, use its ebb as the else body
// and push a new control frame with a new ebb for the code after the if/then/else
// At the end of the then clause we jump to the destination
let (destination, return_values, branch_inst) = match &control_stack[control_stack.len() -
1] {
let i = control_stack.len() - 1;
let (destination, return_values, branch_inst) = match &control_stack[i] {
&ControlStackFrame::If {
destination,
ref return_values,

View File

@@ -239,7 +239,8 @@ pub fn parse_data_section(parser: &mut Parser,
let offset = match *parser.read() {
ParserState::InitExpressionOperator(Operator::I32Const { value }) => {
if value < 0 {
return Err(SectionParsingError::WrongSectionContent(String::from("negative offset value",),),);
return Err(SectionParsingError::WrongSectionContent(String::from("negative \
offset value")));
} else {
value as usize
}
@@ -248,13 +249,15 @@ pub fn parse_data_section(parser: &mut Parser,
match globals[global_index as usize].initializer {
GlobalInit::I32Const(value) => {
if value < 0 {
return Err(SectionParsingError::WrongSectionContent(String::from("negative offset value",),),);
return Err(SectionParsingError::WrongSectionContent(String::from("\
negative offset value")));
} else {
value as usize
}
}
GlobalInit::Import() => {
return Err(SectionParsingError::WrongSectionContent(String::from("imported globals not supported",),),)
return Err(SectionParsingError::WrongSectionContent(String::from("\
imported globals not supported")))
} // TODO: add runtime support
_ => panic!("should not happen"),
}
@@ -326,7 +329,8 @@ pub fn parse_elements_section(parser: &mut Parser,
let offset = match *parser.read() {
ParserState::InitExpressionOperator(Operator::I32Const { value }) => {
if value < 0 {
return Err(SectionParsingError::WrongSectionContent(String::from("negative offset value",),),);
return Err(SectionParsingError::WrongSectionContent(String::from("negative \
offset value")));
} else {
value as usize
}
@@ -335,7 +339,8 @@ pub fn parse_elements_section(parser: &mut Parser,
match globals[global_index as usize].initializer {
GlobalInit::I32Const(value) => {
if value < 0 {
return Err(SectionParsingError::WrongSectionContent(String::from("negative offset value",),),);
return Err(SectionParsingError::WrongSectionContent(String::from("\
negative offset value")));
} else {
value as usize
}