Skip to content

Commit cf56c4b

Browse files
committed
---
yaml --- r: 3953 b: refs/heads/master c: 69abf0a h: refs/heads/master i: 3951: b50983c v: v3
1 parent 5fefffb commit cf56c4b

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 0bd7b803f697e9ee10f44c80a34a1abccf933555
2+
refs/heads/master: 69abf0a5ffc20854f18a1fd720906c4f94cae7f7

trunk/src/test/run-pass/anon-obj-backwarding.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ fn main() {
5050
expect. When we call my_outer.z(), we should also get 3, because
5151
at no point is z being overridden.
5252
53-
To fix this bug, we need to add a second level of forwarding
54-
functions (let's call them "backwarding functions") on the inner
55-
object. Every time an object is extended with another object, we
56-
have to rewrite the inner object's vtable to account for the fact
57-
that future self-calls will get a larger object. The inner
58-
object's vtable will need to have five slots, too. The ones for b
59-
and n will point right back at the outer object. (These are the
60-
"backwarding" ones.) And the ones for a, m, and z will point at
61-
the original, real vtable for inner.
53+
To fix this bug, we need to make the vtable slots on the inner
54+
object match whatever the object being passed in at runtime has.
55+
My first instinct was to change the vtable to match the runtime
56+
object, but vtables are already baked into RO memory. So, instead,
57+
we're going to tweak the object being passed in at runtime to match
58+
the vtable that inner already has. That is, it needs to only have
59+
a, m, and z slots in its vtable, and each one of those slots will
60+
forward to the *outer* object's a, m, and z slots, respectively.
61+
From there they will either head right back to inner, or they'll be
62+
overridden.
6263
6364
Adding support for this is issue #702.
6465

0 commit comments

Comments
 (0)