truffle/src/main/ruby/core/rubinius/api/shims/marshal.rb
# Rubinius stores three main values in Range (begin, end, excl) as instance variables and as such, can use the
# normal, generic object deserializer. In JRuby+Truffle, we do not expose these values as instance variables, in
# keeping with MRI. Moreover, we have specialized versions of Ranges depending on these values, so changing them
# after object construction would create optimization problems. Instead, we patch the Rubinius marshal loader here
# to specifically handle Ranges by constructing a Range of the proper type using the deserialized main values and
# then setting any custom instance variables afterward.
Rubinius stores three main values in Range (begin, end, excl) as instance variables and as such, can use the
normal, generic object deserializer. In JRuby+Truffle, we do not expose these values as instance variables, in
keeping with MRI. Moreover, we have specialized versions of Ranges depending on these values, so changing them
after object construction would create optimization problems. Instead, we patch the Rubinius marshal loader here
to specifically handle Ranges by constructing a Range of the proper type using the deserialized main values and
then setting any custom instance variables afterward.
Rubinius stores three main values in Range ( begin end excl ) as instance variables and as such can use the normal generic object deserializer . In JRuby + Truffle we do not expose these values as instance variables in keeping with MRI . Moreover we have specialized versions of Ranges depending on these values so changing them after object construction would create optimization problems . Instead we patch the Rubinius marshal loader here to specifically handle Ranges by constructing a Range of the proper type using the deserialized main values and then setting any custom instance variables afterward .
def construct_range(klass)
      range_begin = nil
      range_end = nil
      range_exclude_end = false
      ivars = {}
      construct_integer.times do
        ivar = prepare_ivar(get_symbol)
        value = construct
        case ivar
          when :@begin then range_begin = value
          when :@end then range_end = value
          when :@excl then range_exclude_end = value
          else ivars[ivar] = value
        end
      end
      range = klass.new(range_begin, range_end, range_exclude_end)
      store_unique_object range
      ivars.each { |name, value| range.__instance_variable_set__ name, value }
      range
    end
def construct_range ( klass ) range_begin = nil range_end = nil range_exclude_end = false ivars = { } construct_integer . times do ivar = prepare_ivar ( get_symbol ) value = construct case ivar when :@begin then range_begin = value when :@end then range_end = value when :@excl then range_exclude_end = value else ivars [ ivar ] = value end end range = klass . new ( range_begin , range_end , range_exclude_end ) store_unique_object range ivars . each { | name , value | range . __instance_variable_set__ name , value } range end
Rubinius stores three main values in Range (begin, end, excl) as instance variables and as such, can use the
normal, generic object deserializer.
Rubinius stores three main values in Range ( begin end excl ) as instance variables and as such can use the normal generic object deserializer .
klass
<not_specific>