Skip to content

Instantly share code, notes, and snippets.

@calavera
Created June 18, 2010 15:51
Show Gist options
  • Select an option

  • Save calavera/443814 to your computer and use it in GitHub Desktop.

Select an option

Save calavera/443814 to your computer and use it in GitHub Desktop.
diff --git a/src/org/jruby/ast/executable/RuntimeCache.java b/src/org/jruby/ast/executable/RuntimeCache.java
index 73effad..2f114a8 100644
--- a/src/org/jruby/ast/executable/RuntimeCache.java
+++ b/src/org/jruby/ast/executable/RuntimeCache.java
@@ -135,8 +135,9 @@ public class RuntimeCache {
public final RubyRegexp cacheRegexp(int index, RubyString pattern, int options) {
RubyRegexp regexp = regexps[index];
- if (regexp == null) {
- regexp = RubyRegexp.newRegexp(pattern.getRuntime(), pattern.getByteList(), options);
+ Ruby runtime = pattern.getRuntime();
+ if (regexp == null || runtime.getKCode() != regexp.getKCode()) {
+ regexp = RubyRegexp.newRegexp(runtime, pattern.getByteList(), options);
regexps[index] = regexp;
}
return regexp;
--
1.6.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment