Class StringManager
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
,Integer> SequencedMap<String,
Integer>
Handle all the constant strings. The constant strings will be write into the data section. At runtime the strings will be instantiate on the fly and hold in a table.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the positive id for the string.(package private) FunctionName
Get the function name object for theinvalid reference
#stringConstant(int)
(package private) void
prepareFinish
(ModuleWriter writer) Finish the prepare.private static void
writeVaruint32
(int value, OutputStream out) Write an unsigned integer.Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, removeEldestEntry, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Field Details
-
stringConstantFunction
-
functions
-
stringMemoryOffset
private int stringMemoryOffset
-
-
Constructor Details
-
StringManager
StringManager(WasmOptions options) Create a new instance.- Parameters:
options
- compiler properties and shared managers
-
-
Method Details
-
get
Get the positive id for the string. -
getStringConstantFunction
Get the function name object for theinvalid reference
#stringConstant(int)
- Returns:
- the name
- See Also:
-
prepareFinish
Finish the prepare. Now no new strings should be added.- Parameters:
writer
- the targets for the strings- Throws:
IOException
- if any I/O error occur
-
writeVaruint32
Write an unsigned integer.- Parameters:
value
- the valueout
- target stream- Throws:
IOException
- if an I/O error occurs.
-