Skip to content

Commit

Permalink
Simplify bytelist keying for cache in JIT.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Mar 18, 2015
1 parent c62422d commit c1dc6e5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter6.java
Expand Up @@ -109,7 +109,7 @@ public void run() {
}

public void pushByteList(final ByteList bl) {
cacheValuePermanently("byteList", ByteList.class, keyFor("bytelist", bl), new Runnable() {
cacheValuePermanently("bytelist", ByteList.class, keyFor("bytelist", bl), new Runnable() {
@Override
public void run() {
loadRuntime();
Expand Down Expand Up @@ -168,13 +168,8 @@ public void run() {
private static String keyFor(Object... objs) {
StringBuilder sb = new StringBuilder();
for (Object obj : objs) {
if (obj instanceof ByteList) {
for (byte b : ((ByteList)obj).bytes()) sb.append(String.format("%2x", b));
sb.append('_');
sb.append(((ByteList)obj).getEncoding());
} else {
sb.append(obj.toString());
}
sb.append(obj.toString());
if (obj instanceof ByteList) sb.append('_').append(((ByteList) obj).getEncoding());
sb.append("_");
}
return sb.toString();
Expand Down

0 comments on commit c1dc6e5

Please sign in to comment.