Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@

jar 'org.crac:crac:1.5.0'

jar 'com.dynatrace.hash4j:hash4j:0.29.0'

plugin_management do
plugin('org.eclipse.m2e:lifecycle-mapping:1.0.0',
lifecycleMappingMetadata: {
Expand Down
5 changes: 5 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ DO NOT MODIFY - GENERATED CODE
<artifactId>crac</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.dynatrace.hash4j</groupId>
<artifactId>hash4j</artifactId>
<version>0.29.0</version>
</dependency>
</dependencies>
<build>
<defaultGoal>package</defaultGoal>
Expand Down
8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

package org.jruby;

import com.dynatrace.hash4j.hashing.Hasher64;
import com.dynatrace.hash4j.hashing.Hashing;
import jnr.posix.POSIX;

import org.jcodings.Config;
Expand Down Expand Up @@ -171,6 +173,7 @@ public class RubyString extends RubyObject implements CharSequence, EncodingCapa
// Follow-up work should reevaluate this value (Currently only explicit capacity to initialize is using
// this value).
private static final int STRING_MINIMUM_SIZE = 4;
private static final Hasher64 RAPIDHASHER = Hashing.rapidhash3(Ruby.getHashSeed0());

public static RubyString[] NULL_ARRAY = {};

Expand Down Expand Up @@ -1583,8 +1586,9 @@ public int strHashCode(Ruby runtime) {
Ruby.getHashSeed1(), value.getUnsafeBytes(), value.getBegin(),
value.getRealSize());
} else {
hash = PerlHash.hash(Ruby.getHashSeed0(),
value.getUnsafeBytes(), value.getBegin(), value.getRealSize());
// hash = PerlHash.hash(Ruby.getHashSeed0(),
// value.getUnsafeBytes(), value.getBegin(), value.getRealSize());
hash = RAPIDHASHER.hashBytesToLong(value.getUnsafeBytes(), value.getBegin(), value.getRealSize());
}
hash ^= (enc.isAsciiCompatible() && scanForCodeRange() == CR_7BIT ? 0 : enc.getIndex());
return (int) hash;
Expand Down
3 changes: 3 additions & 0 deletions shaded/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
'Enable-Native-Access' => 'ALL-UNNAMED',
}
}],
filters: [
{ artifact: 'com.dynatrace.hash4j:hash4j', excludes: '**/25/**' },
],
createSourcesJar: false,
compress: false)
end
Expand Down
6 changes: 6 additions & 0 deletions shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ DO NOT MODIFY - GENERATED CODE
</manifestEntries>
</transformer>
</transformers>
<filters>
<filter>
<artifact>com.dynatrace.hash4j:hash4j</artifact>
<excludes>**/25/**</excludes>
</filter>
</filters>
<createSourcesJar>false</createSourcesJar>
<compress>false</compress>
</configuration>
Expand Down
Loading