Fix too many locals in wasm binary (#1159)
Split function into smaller non-inlinable ones this fixes the issue that rust creates too many wasm locals in non-optimized builds. That lead to a compile error in such builds. Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
00fd701f66
commit
c814abc347
|
|
@ -68,48 +68,59 @@ macro_rules! register_node {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
macro_rules! raster_node {
|
macro_rules! raster_node {
|
||||||
($path:ty, params: [$($type:ty),*]) => {
|
($path:ty, params: [$($type:ty),*]) => {{
|
||||||
vec.
|
||||||
NodeIdentifier::new(stringify!($path)),
|
// The non-inlining function leads to fewer locals in the resulting
|
||||||
|args| {
|
// wasm binary. This issue currently only applies to debug builds, so
|
||||||
let node = construct_node!(args, $path, [$($type),*]);
|
// we guard inlining to only happen on production builds for
|
||||||
let any: DynAnyNode<Color, _, _> = graphene_std::any::DynAnyNode::new(graphene_core::value::ValueNode::new(node));
|
// optimization purposes.
|
||||||
Box::pin(any)
|
#[cfg_attr(debug_assertions, inline(never))]
|
||||||
},
|
#[cfg_attr(not(debug_assertions), inline)]
|
||||||
{
|
fn generate_triples() -> Vec<(NodeIdentifier, NodeConstructor, NodeIOTypes)> {
|
||||||
let params = vec![$(value_fn!($type)),*];
|
vec![
|
||||||
NodeIOTypes::new(concrete!(Color), concrete!(Color), params)
|
(
|
||||||
},
|
NodeIdentifier::new(stringify!($path)),
|
||||||
),
|
|args| {
|
||||||
(
|
let node = construct_node!(args, $path, [$($type),*]);
|
||||||
NodeIdentifier::new(stringify!($path)),
|
let any: DynAnyNode<Color, _, _> = graphene_std::any::DynAnyNode::new(graphene_core::value::ValueNode::new(node));
|
||||||
|args| {
|
Box::pin(any)
|
||||||
let node = construct_node!(args, $path, [$($type),*]);
|
},
|
||||||
let map_node = graphene_std::raster::MapImageNode::new(graphene_core::value::ValueNode::new(node));
|
{
|
||||||
let any: DynAnyNode<Image<Color>, _, _> = graphene_std::any::DynAnyNode::new(graphene_core::value::ValueNode::new(map_node));
|
let params = vec![$(value_fn!($type)),*];
|
||||||
Box::pin(any)
|
NodeIOTypes::new(concrete!(Color), concrete!(Color), params)
|
||||||
},
|
},
|
||||||
{
|
),
|
||||||
let params = vec![$(value_fn!($type)),*];
|
(
|
||||||
NodeIOTypes::new(concrete!(Image<Color>), concrete!(Image<Color>), params)
|
NodeIdentifier::new(stringify!($path)),
|
||||||
},
|
|args| {
|
||||||
),
|
let node = construct_node!(args, $path, [$($type),*]);
|
||||||
(
|
let map_node = graphene_std::raster::MapImageNode::new(graphene_core::value::ValueNode::new(node));
|
||||||
NodeIdentifier::new(stringify!($path)),
|
let any: DynAnyNode<Image<Color>, _, _> = graphene_std::any::DynAnyNode::new(graphene_core::value::ValueNode::new(map_node));
|
||||||
|args| {
|
Box::pin(any)
|
||||||
let node = construct_node!(args, $path, [$($type),*]);
|
},
|
||||||
let map_node = graphene_std::raster::MapImageNode::new(graphene_core::value::ValueNode::new(node));
|
{
|
||||||
let any: DynAnyNode<ImageFrame<Color>, _, _> = graphene_std::any::DynAnyNode::new(graphene_core::value::ValueNode::new(map_node));
|
let params = vec![$(value_fn!($type)),*];
|
||||||
Box::pin(any)
|
NodeIOTypes::new(concrete!(Image<Color>), concrete!(Image<Color>), params)
|
||||||
},
|
},
|
||||||
{
|
),
|
||||||
let params = vec![$(value_fn!($type)),*];
|
(
|
||||||
NodeIOTypes::new(concrete!(ImageFrame<Color>), concrete!(ImageFrame<Color>), params)
|
NodeIdentifier::new(stringify!($path)),
|
||||||
},
|
|args| {
|
||||||
)
|
let node = construct_node!(args, $path, [$($type),*]);
|
||||||
]
|
let map_node = graphene_std::raster::MapImageNode::new(graphene_core::value::ValueNode::new(node));
|
||||||
}
|
let any: DynAnyNode<ImageFrame<Color>, _, _> = graphene_std::any::DynAnyNode::new(graphene_core::value::ValueNode::new(map_node));
|
||||||
|
Box::pin(any)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
let params = vec![$(value_fn!($type)),*];
|
||||||
|
NodeIOTypes::new(concrete!(ImageFrame<Color>), concrete!(ImageFrame<Color>), params)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
generate_triples()
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: turn into hashmap
|
//TODO: turn into hashmap
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue