[#15359] Timeout::Error — Jeremy Thurgood <jerith@...>

Good day,

41 messages 2008/02/05
[#15366] Re: Timeout::Error — Eric Hodel <drbrain@...7.net> 2008/02/06

On Feb 5, 2008, at 06:20 AM, Jeremy Thurgood wrote:

[#15370] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/06

Eric Hodel wrote:

[#15373] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/06

Hi,

[#15374] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/06

Nobuyoshi Nakada wrote:

[#15412] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/07

Hi,

[#15413] Re: Timeout::Error — Jeremy Thurgood <jerith@...> 2008/02/07

Nobuyoshi Nakada wrote:

[#15414] Re: Timeout::Error — Nobuyoshi Nakada <nobu@...> 2008/02/07

Hi,

[#15360] reopen: can't change access mode from "w+" to "w"? — Sam Ruby <rubys@...>

I ran 'rake test' on test/spec [1], using

16 messages 2008/02/05
[#15369] Re: reopen: can't change access mode from "w+" to "w"? — Nobuyoshi Nakada <nobu@...> 2008/02/06

Hi,

[#15389] STDIN encoding differs from default source file encoding — Dave Thomas <dave@...>

This seems strange:

21 messages 2008/02/06
[#15392] Re: STDIN encoding differs from default source file encoding — Yukihiro Matsumoto <matz@...> 2008/02/06

Hi,

[#15481] very bad character performance on ruby1.9 — "Eric Mahurin" <eric.mahurin@...>

I'd like to bring up the issue of how characters are represented in

16 messages 2008/02/10

[#15528] Test::Unit maintainer — Kouhei Sutou <kou@...>

Hi Nathaniel, Ryan,

22 messages 2008/02/13

[#15551] Proc#curry — ts <decoux@...>

21 messages 2008/02/14
[#15557] Re: [1.9] Proc#curry — David Flanagan <david@...> 2008/02/15

ts wrote:

[#15558] Re: [1.9] Proc#curry — Yukihiro Matsumoto <matz@...> 2008/02/15

Hi,

[#15560] Re: Proc#curry — Trans <transfire@...> 2008/02/15

[#15585] Ruby M17N meeting summary — Martin Duerst <duerst@...>

This is a rough translation of the Japanese meeting summary

19 messages 2008/02/18

[#15596] possible bug in regexp lexing — Ryan Davis <ryand-ruby@...>

current:

17 messages 2008/02/19

[#15678] Re: [ANN] MacRuby — "Rick DeNatale" <rick.denatale@...>

On 2/27/08, Laurent Sansonetti <laurent.sansonetti@gmail.com> wrote:

18 messages 2008/02/28
[#15679] Re: [ANN] MacRuby — "Laurent Sansonetti" <laurent.sansonetti@...> 2008/02/28

On Thu, Feb 28, 2008 at 6:33 AM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#15680] Re: [ANN] MacRuby — Yukihiro Matsumoto <matz@...> 2008/02/28

Hi,

[#15683] Re: [ANN] MacRuby — "Laurent Sansonetti" <laurent.sansonetti@...> 2008/02/28

On Thu, Feb 28, 2008 at 1:51 PM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:

Instance variable implementation 1.8 vs. 1.9

From: "Rick DeNatale" <rick.denatale@...>
Date: 2008-02-08 20:21:36 UTC
List: ruby-core #15438
I've been reading the code for both 1.8 and 1.9, and I wanted to make
sure that I understand instance variable access and how it has
changed.  Here's my understanding.

1.8

Each non-immediate object or at least each object instance mapped by
RObject has a pointer iv_tbl to a hash table mapping it's instance
variable names in symbol form to the value of that particular
instance's variable for that particular instance.  The hash table will
only have entries for variables which have been either set or accessed
during execution of a method on that instance.

1.9

ROBJECT no longer has an iv_tbl, instead it has been moved to the
object's class, and instead of mapping the instance variable name to a
value, it maps it to an index, this table is shared by all direct
instances of the class, but it is NOT inherited.
      if obj->klass->iv_tbl doesn't exist when an instance variable is
being set a new empty table is created without looking up the
inheritance chain.
      If the instance variable name is not found in obj->klass->iv_tbl
it is not looked for up the chain, and the instance variable will just
be nil on a get, undefined on a defined? or for a set a new index will
be allocated and used for the instance variable.

The actual instance variable VALUEs are stored directly in  the object
if there are no instance variables in the INSTANCE with an index less
than ROBJECT_EMBED_LEN_MAX  (currently 3), or if there are more than
three, the object contains a  len field with the maximum index and a
pointer to a separate special object containing the array of values.
In either case the VALUE for an instance variable will contain the
special value q_undef which is distinct from nil.

As far as I've been able to see so far, the actual semantics are
unchanged, instances either have or don't have a given instance
variable independent of their class. The new implementation amortizes
the space of the hash table over a number of instances.  It's also the
case, I think that in a case like this:

class A
     attr_accessor :a
end

class B
    attr_accessor :b
end

a = A.new
b = B.new
b2 = B.new

a.a = 1
b.b = 2
b.a = 3
b2.a = 4

That the objects would be laid out like this:

		a --> klass -----> A.iv_tbl => {:a => 0}
slot0	1

        b --> klass -----> B.iv_tbl => {:b => 0, :a => 1}
slot0   2                  |
slot1   3                  |
                           |
        b2 -> klass -------+
slot0   qUndef
slot1   4

Do I have this basically right?

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

In This Thread

Prev Next