From 876638f8fb5bfc8b264eddc6c0c0d54ed40d0095 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 6 Jul 2022 08:48:12 -0700 Subject: [Strings] Add string.const (#4768) This is more work than a typical instruction because it also adds a new section: all the (string.const "foo") strings are put in a new "strings" section in the binary, and the instructions refer to them by index. --- src/wasm.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/wasm.h') diff --git a/src/wasm.h b/src/wasm.h index 6d0733d34..3032b4ac1 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -686,6 +686,7 @@ public: ArrayCopyId, RefAsId, StringNewId, + StringConstId, NumExpressionIds }; Id _id; @@ -1664,6 +1665,18 @@ public: void finalize(); }; +class StringConst : public SpecificExpression { +public: + StringConst(MixedArena& allocator) {} + + // TODO: Use a different type to allow null bytes in the middle - + // ArenaVector perhaps? However, Name has the benefit of being + // interned and immutable (which is appropriate here). + Name string; + + void finalize(); +}; + // Globals struct Named { -- cgit v1.2.3