Skip to content

Commit fd03b3e

Browse files
committed
Document TStringCache
1 parent 77e53f9 commit fd03b3e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/org/truffleruby/core/string/TStringCache.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
import com.oracle.truffle.api.CompilerDirectives;
2222
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
2323

24+
/** This cache caches (byte[], encoding) to TruffleString. The main value is from using it for string literals in files
25+
* without {@code # frozen_string_literal: true}, so equivalent string literals are shared. For most other usages there
26+
* is another higher-level cache but this cache then helps to deduplicate TruffleString's across the different
27+
* higher-level caches. */
2428
public final class TStringCache {
2529

2630
private final WeakValueCache<TBytesKey, TruffleString> bytesToTString = new WeakValueCache<>();

0 commit comments

Comments
 (0)