Skip to content

Commit a84fc45

Browse files
Add several improvements to DerivedClass_F (#262)
* Add several improvements to DerivedClass_F
1 parent eeb1b52 commit a84fc45

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

share/prolog/oorules/rules.pl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,12 +1941,19 @@
19411941
reasonDerivedClass_F(DerivedClass, BaseClass, Offset) :-
19421942
factObjectInObject(DerivedClass, BaseClass, Offset),
19431943
% There's an entry in some VBTable somehere (only unified by Offset so far).
1944-
factVBTableEntry(VBTableAddress, _TableObjectOffset, Offset),
1944+
factVBTableEntry(VBTableAddress, TableOffset, OffsetFromVBPtr),
1945+
% The first offset of a VBTable is the offset from the vbptr to the object start.
1946+
TableOffset > 0,
19451947
% And that VBTable is installed into an object in some Method.
1946-
factVBTableWrite(_Insn, Method, _VBTableOffset, VBTableAddress),
1948+
factVBTableWrite(_Insn, Method, VBPtrOffset, VBTableAddress),
19471949
% Finally, check that the method is assigned to the Derived class.
19481950
% This is the unification that makes the VBTableEntry relevant.
19491951
find(Method, DerivedClass),
1952+
1953+
% ejs 8/13/22 The offsets in a vbtable are offsets from the location of the vbptr, not from
1954+
% the beginning of the class. Sometimes the vbptr is at offset zero, but not always.
1955+
Offset is OffsetFromVBPtr + VBPtrOffset,
1956+
19501957
% Debugging
19511958
logtraceln('~@~Q.', [not(factDerivedClass(DerivedClass, BaseClass, Offset)),
19521959
reasonDerivedClass_F(DerivedClass, BaseClass, Offset,

0 commit comments

Comments
 (0)