public static CallSite getRegexpBootstrap(Lookup lookup, String name, MethodType type, String asString, String encodingName, int options) {
byte[] bytes = RuntimeHelpers.stringToRawBytes(asString);
Encoding encoding = EncodingDB.getEncodings().get(encodingName.getBytes()).getEncoding();
ByteList byteList = new ByteList(bytes, encoding);
MutableCallSite site = new MutableCallSite(type);
MethodHandle init = findStatic(
InvokeDynamicSupport.class,
"initRegexp",
methodType(RubyRegexp.class, MutableCallSite.class, ThreadContext.class, ByteList.class, int.class));
init = insertArguments(init, 2, byteList, options);
init = insertArguments(
init,
0,
site);
site.setTarget(init);
return site;
}