Fixed-width strings: Difference between revisions

Jump to navigation Jump to search
m
Line 12: Line 12:
# String APIs should be as close to SpiderMonkey string APIs as possible to make ActionMonkey implementation easy.
# String APIs should be as close to SpiderMonkey string APIs as possible to make ActionMonkey implementation easy.


=== String types ===
=== Tagged instance contents ===


Strings are immutable, but their contents may be different. String data can be 8, 16, or 32 bits wide; A string may contain a pointer to a string buffer, which may need to be deleted or not; or the string data may immediately follow the String instance in memory (by doing a raw allocate followed by an in-place constructor call); or it can hold two String references if is the result of a concat operation. The contents may change dynamically during a flatten operation. Therefore, a String instance contains a <tt>union</tt> with a tag.
Strings are immutable, but their contents may be different. String data can be 8, 16, or 32 bits wide; A string may contain a pointer to a string buffer, which may need to be deleted or not; or the string data may immediately follow the String instance in memory (by doing a raw allocate followed by an in-place constructor call); or it can hold two String references if is the result of a concat operation. Finally, a string can be the result of a substring operation. The contents may change dynamically during a flatten operation. Therefore, a String instance contains a <tt>union</tt> with a tag.


=== String creation ===
=== String creation ===
55

edits

Navigation menu