mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 10:27:35 +00:00
LibWasm: Implement Element section segment type 4
This commit is contained in:
parent
aafef1e92d
commit
59e8f713db
2 changed files with 18 additions and 6 deletions
|
@ -1047,9 +1047,20 @@ ParseResult<ElementSection::SegmentType3> ElementSection::SegmentType3::parse(St
|
||||||
|
|
||||||
ParseResult<ElementSection::SegmentType4> ElementSection::SegmentType4::parse(Stream& stream)
|
ParseResult<ElementSection::SegmentType4> ElementSection::SegmentType4::parse(Stream& stream)
|
||||||
{
|
{
|
||||||
dbgln("Type 4");
|
auto expression = Expression::parse(stream);
|
||||||
(void)stream;
|
if (expression.is_error())
|
||||||
return ParseError::NotImplemented;
|
return expression.error();
|
||||||
|
auto initializers = parse_vector<Expression>(stream);
|
||||||
|
if (initializers.is_error())
|
||||||
|
return initializers.error();
|
||||||
|
|
||||||
|
return SegmentType4 {
|
||||||
|
.mode = Active {
|
||||||
|
.index = 0,
|
||||||
|
.expression = expression.release_value(),
|
||||||
|
},
|
||||||
|
.initializer = initializers.release_value(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ParseResult<ElementSection::SegmentType5> ElementSection::SegmentType5::parse(Stream& stream)
|
ParseResult<ElementSection::SegmentType5> ElementSection::SegmentType5::parse(Stream& stream)
|
||||||
|
@ -1117,7 +1128,7 @@ ParseResult<ElementSection::Element> ElementSection::Element::parse(Stream& stre
|
||||||
if (auto result = SegmentType4::parse(stream); result.is_error()) {
|
if (auto result = SegmentType4::parse(stream); result.is_error()) {
|
||||||
return result.error();
|
return result.error();
|
||||||
} else {
|
} else {
|
||||||
return ParseError::NotImplemented;
|
return Element { ValueType(ValueType::FunctionReference), move(result.value().initializer), move(result.value().mode) };
|
||||||
}
|
}
|
||||||
case 0x05:
|
case 0x05:
|
||||||
if (auto result = SegmentType5::parse(stream); result.is_error()) {
|
if (auto result = SegmentType5::parse(stream); result.is_error()) {
|
||||||
|
|
|
@ -737,7 +737,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SegmentType0 {
|
struct SegmentType0 {
|
||||||
// FIXME: Implement me!
|
|
||||||
static ParseResult<SegmentType0> parse(Stream& stream);
|
static ParseResult<SegmentType0> parse(Stream& stream);
|
||||||
|
|
||||||
Vector<FunctionIndex> function_indices;
|
Vector<FunctionIndex> function_indices;
|
||||||
|
@ -757,8 +756,10 @@ public:
|
||||||
static ParseResult<SegmentType3> parse(Stream& stream);
|
static ParseResult<SegmentType3> parse(Stream& stream);
|
||||||
};
|
};
|
||||||
struct SegmentType4 {
|
struct SegmentType4 {
|
||||||
// FIXME: Implement me!
|
|
||||||
static ParseResult<SegmentType4> parse(Stream& stream);
|
static ParseResult<SegmentType4> parse(Stream& stream);
|
||||||
|
|
||||||
|
Active mode;
|
||||||
|
Vector<Expression> initializer;
|
||||||
};
|
};
|
||||||
struct SegmentType5 {
|
struct SegmentType5 {
|
||||||
// FIXME: Implement me!
|
// FIXME: Implement me!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue