Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e7d2524157b1
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 41abe4504ac7
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 26, 2015

  1. Copy the full SHA
    d21a001 View commit details
  2. [Truffle] Update default external in internal encodings in JRuby as w…

    …ell.
    
    While we're using Rubinius's encoding subsystem substantially, we still delegate to JRuby methods in various places.  JRuby's runtime is unaware of any encoding values set via Rubinius and as a result, we can generate strings with incorrect encodings if we don't take care to update JRuby's runtime as well.
    nirvdrum committed Mar 26, 2015
    Copy the full SHA
    41abe45 View commit details
Original file line number Diff line number Diff line change
@@ -287,7 +287,8 @@ public Object defaultInternal() {

}

@CoreMethod(names = "default_external=", onSingleton = true, required = 1)
@RubiniusOnly
@CoreMethod(names = "default_external_jruby=", onSingleton = true, required = 1)
public abstract static class SetDefaultExternalNode extends CoreMethodNode {

public SetDefaultExternalNode(RubyContext context, SourceSection sourceSection) {
@@ -324,7 +325,8 @@ public RubyEncoding defaultExternal(RubyNilClass nil) {

}

@CoreMethod(names = "default_internal=", onSingleton = true, required = 1)
@RubiniusOnly
@CoreMethod(names = "default_internal_jruby=", onSingleton = true, required = 1)
public abstract static class SetDefaultInternalNode extends CoreMethodNode {

@Child private ToStrNode toStrNode;
6 changes: 3 additions & 3 deletions truffle/src/main/ruby/core/rubinius/common/encoding.rb
Original file line number Diff line number Diff line change
@@ -579,9 +579,9 @@ def self.find(name)
# EncodingList
#end

def self.locale_charmap
LocaleCharmap
end
#def self.locale_charmap
# LocaleCharmap
#end

def self.name_list
EncodingMap.map do |n, r|
20 changes: 20 additions & 0 deletions truffle/src/main/ruby/core/shims.rb
Original file line number Diff line number Diff line change
@@ -217,3 +217,23 @@ class IO
SEEK_SET = 0

end

# We use Rubinius's encoding subsystem for the most part, but we need to keep JRuby's up to date in case we
# delegate to any of their methods. Otherwise, they won't see the updated encoding and return incorrect results.
class Encoding
class << self
alias_method :default_external_rubinius=, :default_external=

def default_external=(enc)
self.default_external_rubinius = enc
self.default_external_jruby = enc
end

alias_method :default_internal_rubinius=, :default_internal=

def default_internal=(enc)
self.default_internal_rubinius = enc
self.default_internal_jruby = enc
end
end
end