Skip to content

Instantly share code, notes, and snippets.

if regexp.forced_utf8_encoding?
Encoding::UTF_8
elsif regexp.forced_binary_encoding?
Encoding::ASCII_8BIT
elsif regexp.forced_us_ascii_encoding?
Encoding::US_ASCII
elsif regexp.ascii_8bit?
Encoding::ASCII_8BIT
elsif regexp.utf_8?
Encoding::UTF_8
@nirvdrum
nirvdrum / cruby-3.3.0-yjit.txt
Last active February 15, 2024 16:22
Results of running the benchmarks for the Trilogy Ruby client
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [x86_64-linux]
Warming up --------------------------------------
trilogy connect/close
1.112k i/100ms
mysql2 connect/close 955.000 i/100ms
Calculating -------------------------------------
trilogy connect/close
12.458k (± 7.5%) i/s - 62.272k in 5.032194s
mysql2 connect/close 9.952k (± 4.9%) i/s - 49.660k in 5.001969s

Regexp Encodings

There are two string values being updated as we go along:

  • RegularExpressionNode#unescaped
  • RegularExpressionNode#source

unescaped is supposed to be the source string according to the interface. However, it doesn't adapt to many situations.

| Regex | CRuby 3.3.0 Source | Prism RegularExpressioNode#unescaped (Pre-changes) |

> ruby -v
truffleruby 24.1.0-dev-677ac08b, like ruby 3.2.2, GraalVM CE Native [x86_64-linux]
Fatal error: No exception handler registered for deopt target
encodedBci: 113 (bci 24 rethrowException)
Method info: org.truffleruby.language.RubyProcRootNode.execute(RubyProcRootNode.java:77)
Partial Deoptimized Stack
org.truffleruby.language.RubyProcRootNode.execute(RubyProcRootNode.java:77)
@nirvdrum
nirvdrum / encoding_compatibility.java
Last active October 28, 2021 14:40
Ruby Encoding Compatibility Check
@Specialization(guards = {
"firstEncoding != secondEncoding",
"!isBroken(first, codeRangeNode)",
"!isBroken(second, codeRangeNode)"
})
protected RubyEncoding commonCases(
Rope first, RubyEncoding firstEncoding, Rope second, RubyEncoding secondEncoding) {
final CodeRange firstCodeRange = getCodeRange(first);
final CodeRange secondCodeRange = getCodeRange(second);
nirvdrum.com on  gh-pages [!?]
❯ rbenv shell jruby-9.2.12.0
nirvdrum.com on  gh-pages [!?]
❯ gem install jekyll
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.ext.openssl.SecurityHelper (file:/home/nirvdrum/.rbenv/versions/jruby-9.2.12.0/lib/ruby/stdlib/jopenssl.jar) to field java.security.MessageDigest.provider
WARNING: Please consider reporting this to the maintainers of org.jruby.ext.openssl.SecurityHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
zsysd.loglevel=info msg="Building new machines list"
level=debug msg="ZFS: new scan"
level=debug msg="ZFS: refresh dataset list"
level=debug msg="New dataNew dataset found: \"rpool\""
level=debug msg="New dataNew dataset found: \"rpool/ROOT\""
level=debug msg="New dataNew dataset found: \"rpool/ROOT/ubuntu_bp7ow2\""
level=debug msg="property \"com.ubuntu.zsys:bootfs\" on dataset \"rpool/ROOT/ubuntu_bp7ow2\": value: \"yes\" source: \"local\""
level=debug msg="property \"com.ubuntu.zsys:last-used\" on dataset \"rpool/ROOT/ubuntu_bp7ow2\": value: \"1585700277\" source: \"local\""
level=debug msg="property \"com.ubuntu.zsys:last-booted-kernel\" on dataset \"rpool/ROOT/ubuntu_bp7ow2\": value: \"vmlinuz-5.4.0-18-generic\" source: \"local\""
level=debug msg="New dataNew dataset found: \"rpool/ROOT/ubuntu_bp7ow2/usr\""
@nirvdrum
nirvdrum / build-session.log
Last active January 30, 2020 23:23
TruffleRuby Nokogiri Build Issue (Ubuntu 19.10)
❯ jt gem install nokogiri
Using Interpreted TruffleRuby: mxbuild/truffleruby-jvm
$ /home/nirvdrum/dev/workspaces/truffleruby-ws/truffleruby/mxbuild/truffleruby-jvm/jre/languages/ruby/bin/ruby \
--experimental-options \
--core-load-path=/home/nirvdrum/dev/workspaces/truffleruby-ws/truffleruby/src/main/ruby/truffleruby \
-S \
gem \
install \
nokogiri
Fetching mini_portile2-2.4.0.gem
Adding file which is not in the repository: '/home/nirvdrum/dev/workspaces/truffleruby-ws/openjdk1.8.0_222-jvmci-19.3-b02' in 'graalvm-unknown-java8-19.3.0-dev'
Building graalvm-native-clang.image... [dependency SULONG_TOOLCHAIN_LAUNCHERS updated]
Building truffleruby.image... [dependency TRUFFLERUBY-LAUNCHER updated]
[graalvm-native-clang:15390] classlist: 3,371.77 ms
[truffleruby:15409] classlist: 7,098.70 ms
[graalvm-native-clang:15390] (cap): 5,654.29 ms
[truffleruby:15409] (cap): 1,798.04 ms
[graalvm-native-clang:15390] setup: 7,319.41 ms
[truffleruby:15409] setup: 3,889.54 ms
[graalvm-native-clang:15390] (typeflow): 7,884.21 ms
diff --git a/build.xml b/build.xml
index e2d57e3..790456f 100644
--- a/build.xml
+++ b/build.xml
@@ -396,11 +396,7 @@
<target name="-assemble-native-jar" depends="-init-vars, -build-platform-jar">
<jar jarfile="${native.jar}" index="true" update="true" duplicate="preserve"
filesetmanifest="skip">
- <archives>
- <zips>