mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 21:48:12 +08:00
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:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
00fd701f66
commit
c814abc347
@@ -68,7 +68,16 @@ macro_rules! register_node {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
macro_rules! raster_node {
|
macro_rules! raster_node {
|
||||||
($path:ty, params: [$($type:ty),*]) => {
|
($path:ty, params: [$($type:ty),*]) => {{
|
||||||
|
// this function could also be inlined but serves as a workaround for
|
||||||
|
// [wasm-pack#981](https://github.com/rustwasm/wasm-pack/issues/981).
|
||||||
|
// The non-inlining function leads to fewer locals in the resulting
|
||||||
|
// wasm binary. This issue currently only applies to debug builds, so
|
||||||
|
// we guard inlining to only happen on production builds for
|
||||||
|
// optimization purposes.
|
||||||
|
#[cfg_attr(debug_assertions, inline(never))]
|
||||||
|
#[cfg_attr(not(debug_assertions), inline)]
|
||||||
|
fn generate_triples() -> Vec<(NodeIdentifier, NodeConstructor, NodeIOTypes)> {
|
||||||
vec![
|
vec![
|
||||||
(
|
(
|
||||||
NodeIdentifier::new(stringify!($path)),
|
NodeIdentifier::new(stringify!($path)),
|
||||||
@@ -110,6 +119,8 @@ macro_rules! raster_node {
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
generate_triples()
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: turn into hashmap
|
//TODO: turn into hashmap
|
||||||
|
|||||||
Reference in New Issue
Block a user