Skip to content

Commit

Permalink
Hook up indy ChilledString logic
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Oct 14, 2024
1 parent e4e0967 commit 01216ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void pushString(ByteList bl, int cr) {

public void pushChilledString(ByteList bl, int cr) {
compiler.loadContext();
compiler.adapter.invokedynamic("string", sig(RubyString.class, ThreadContext.class), StringBootstrap.CSTRING_BOOTSTRAP, RubyEncoding.decodeRaw(bl), bl.getEncoding().toString(), cr);
compiler.adapter.invokedynamic("chilled", sig(RubyString.class, ThreadContext.class), StringBootstrap.CSTRING_BOOTSTRAP, RubyEncoding.decodeRaw(bl), bl.getEncoding().toString(), cr);
}

public void pushFrozenString(ByteList bl, int cr, String file, int line) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class StringBootstrap {
private static final MethodHandle CSTRING_HANDLE =
Binder
.from(RubyString.class, ThreadContext.class, ByteList.class, int.class)
.invokeStaticQuiet(LOOKUP, StringBootstrap.class, "string");
.invokeStaticQuiet(LOOKUP, StringBootstrap.class, "chilledString");

private static final MethodHandle FSTRING_HANDLE =
Binder
Expand Down Expand Up @@ -136,6 +136,10 @@ public static RubyString string(ThreadContext context, ByteList value, int cr) {
return RubyString.newStringShared(context.runtime, value, cr);
}

public static RubyString chilledString(ThreadContext context, ByteList value, int cr) {
return RubyString.newChilledString(context.runtime, value, cr);
}

public static RubyString bufferString(ThreadContext context, Encoding encoding, int size, int cr) {
return RubyString.newString(context.runtime, new ByteList(size, encoding), cr);
}
Expand Down

0 comments on commit 01216ab

Please sign in to comment.