mirror of
https://github.com/fluencelabs/wasm-utils
synced 2025-06-12 22:31:25 +00:00
generate instructions on module generation
This commit is contained in:
20
src/graph.rs
20
src/graph.rs
@ -240,10 +240,8 @@ impl Module {
|
|||||||
// let location = if element_segment.passive() {
|
// let location = if element_segment.passive() {
|
||||||
// SegmentLocation::Passive
|
// SegmentLocation::Passive
|
||||||
// } else if element_segment.index() == 0 {
|
// } else if element_segment.index() == 0 {
|
||||||
// // TODO: transform instructions
|
|
||||||
// SegmentLocation::Default(Vec::new())
|
// SegmentLocation::Default(Vec::new())
|
||||||
// } else {
|
// } else {
|
||||||
// // TODO: transform instructions
|
|
||||||
// SegmentLocation::WithIndex(element_segment.index(), Vec::new())
|
// SegmentLocation::WithIndex(element_segment.index(), Vec::new())
|
||||||
// };
|
// };
|
||||||
|
|
||||||
@ -492,11 +490,10 @@ impl Module {
|
|||||||
|
|
||||||
for global in self.globals.iter() {
|
for global in self.globals.iter() {
|
||||||
match global.read().origin {
|
match global.read().origin {
|
||||||
Declared(_) => {
|
Declared(ref init_code) => {
|
||||||
globals.push(elements::GlobalEntry::new(
|
globals.push(elements::GlobalEntry::new(
|
||||||
elements::GlobalType::new(global.read().content, global.read().is_mut),
|
elements::GlobalType::new(global.read().content, global.read().is_mut),
|
||||||
// TODO: generate init expr
|
elements::InitExpr::new(self.generate_instructions(&init_code[..])),
|
||||||
elements::InitExpr::empty(),
|
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
_ => continue,
|
_ => continue,
|
||||||
@ -559,8 +556,7 @@ impl Module {
|
|||||||
element_segments.push(
|
element_segments.push(
|
||||||
elements::ElementSegment::new(
|
elements::ElementSegment::new(
|
||||||
0,
|
0,
|
||||||
// TODO: generate init expr
|
elements::InitExpr::new(self.generate_instructions(&offset_expr[..])),
|
||||||
elements::InitExpr::empty(),
|
|
||||||
element.value.clone(),
|
element.value.clone(),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -584,11 +580,10 @@ impl Module {
|
|||||||
|
|
||||||
for func in self.funcs.iter() {
|
for func in self.funcs.iter() {
|
||||||
match func.read().origin {
|
match func.read().origin {
|
||||||
Declared(_) => {
|
Declared(ref body) => {
|
||||||
// TODO: generate body
|
|
||||||
funcs.push(elements::FuncBody::new(
|
funcs.push(elements::FuncBody::new(
|
||||||
Vec::new(),
|
body.locals.clone(),
|
||||||
elements::Instructions::empty(),
|
elements::Instructions::new(self.generate_instructions(&body.code[..])),
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
_ => continue,
|
_ => continue,
|
||||||
@ -614,8 +609,7 @@ impl Module {
|
|||||||
data_segments.push(
|
data_segments.push(
|
||||||
elements::DataSegment::new(
|
elements::DataSegment::new(
|
||||||
0,
|
0,
|
||||||
// TODO: generate init expr
|
elements::InitExpr::new(self.generate_instructions(&offset_expr[..])),
|
||||||
elements::InitExpr::empty(),
|
|
||||||
data_entry.value.clone(),
|
data_entry.value.clone(),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user