Usefulness of VHfilter ?

10 views
Skip to first unread message

Zell

unread,
Jan 4, 2012, 9:31:21 AM1/4/12
to chord-discuss
Hello, Consider the two rules of
"chord_analyses_alias_cipa_0cfa.dlog".
*************
VHfilter(v,h) :- VT(v,t), HT(h,s), sub(s,t).
...
VH(l,h) :- objVarAsgnInst(l,r), VH(r,h), VHfilter(l,h).
******************

Would you like to show me a small example how VHfilter works?

I have strange impression that VHfilter has no effet for the strongly-
type language:
--- with objVarAsgnInst(l,r), the compiler requires l has the same
declared type as r, or l is of a supertype.
-- with VH(r,h), r's declared type is a supertype of h's run-time
type. By transitivity, I conclude l is of supertype w.r.t. h or l has
the same type as h. Thus VHfilter(l,h) seems to be true for always.

Sorry this must be naively wrong. But I do like to see an example that
shows the usefulness of VHfilter. Thanks.

Ariel Rabkin

unread,
Jan 4, 2012, 1:00:14 PM1/4/12
to chord-...@googlegroups.com
VHFilter matters when there are downcasts and when the points-to
analysis is imprecise. Consider this code fragment:

HashMap map = new HashMap()
hs.put("base", new Base())
hs.put("derived", new Derived())
Derived d = hs.get("derived")

Reference 'd' can only point to the Derived at runtime, even though
the internal structures of the map will have references to both base
and derived, but r. VHFilter enforces this constraint.

--Ari

> --
> You received this message because you are subscribed to the Google Groups "chord-discuss" group.
> To post to this group, send email to chord-...@googlegroups.com.
> To unsubscribe from this group, send email to chord-discus...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/chord-discuss?hl=en.
>

--
Ari Rabkin asra...@gmail.com
UC Berkeley Computer Science Department

Reply all
Reply to author
Forward
0 new messages