WebAssembly / component-model

Repository for design and specification of the Component Model
Other
933 stars 79 forks source link

Canonical ABI for load_string_from_range looks wrong? #217

Closed GordonSmith closed 1 year ago

GordonSmith commented 1 year ago

Assuming tagged_code_units is meant to be the string length, then the byte_length calculation for utf8 looks wrong here: https://github.com/WebAssembly/component-model/blob/main/design/mvp/canonical-abi/definitions.py#L448C1-L474C57

lukewagner commented 1 year ago

I might be missing your point, but tagged_code_units is meant to be the number of code units relative to the selected encoding. Since the code unit (not to be confused with code point for UTF-8 is a byte, then tagged_code_units for UTF-8 is indeed the byte length of the string in memory.

GordonSmith commented 1 year ago

@lukewagner thanks for clarifying that!