Reachability logic, formalized #1483
dmlloyd
started this conversation in
Design discussions
Replies: 1 comment 3 replies
-
For dispatching, I think we are missing the rule that connects a reachable
I think there's a chance that the logic that says that accessing a static field causes the enclosing class to be reachable is a relic of when we were also tracking class initialization as part of reachability. However, if the static field is reachable we do need "somewhere" to put its declaration, so we need the ProgramModule for the class (or need somewhere else to put the declaration). |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As a part of the work being done in #1059 it would be useful to formalize the existing reachability logic into a series of pseudo-Prolog-style rules to describe the conditions under which a fact can become known, because the Facts API establishes logical relationships in a way that is structurally similar to this. However, since I have not actually touched Prolog syntax in many years, I've modified it for simplicity (and so I'm off the hook for any incorrectness).
The rule syntax used below is as follows:
a :- b
-a
is true whenb
is true.a :- b,c
-a
is true whenb
andc
are true (conjunction).a :- b;c
-a
is true whenb
orc
or bothb
andc
are true (disjunction).Some basic functors are assumed:
Encloses(t, m)
is true when typet
contains a memberm
.IsSuperClass(x, y)
is true when classx
is a superclass of classy
.IsArray(x, y)
is true when classx
is an array of typey
.IsSuperInterface(x, y)
is true when interfacex
is a superinterface of class or interfacey
.HasInvokeStaticNode(m)
is true when memberm
is directly invoked by a reachable static invocation node.HasInvokeExactNode(m)
is true when memberm
is directly invoked by a reachable exact invocation node (including constructors).HasInvokeVirtualNode(m)
is true when memberm
is indirectly invoked by a reachable virtual invocation node.HasInvokeInterfaceNode(m)
is true when memberm
is indirectly invoked by a reachable interface invocation node.HasNewNode(t)
is true when typet
is used with aNew
node.IsClassOf(o, t)
is true when the type of objecto
ist
.HasLiteral(o)
is true when objecto
appears by way of a reachable object literal.RefersTo(oa, ob)
is true when objectoa
refers to objectob
.RefersToMethod(o, m)
is true when objecto
contains a pointer to methodm
.IsInherited(m, t)
is true when methodm
is inherited from supertypet
.This is the initial, mostly-complete set that I've gleaned from the existing code. I've used the term "provisionally" instead of "deferred" in some places.
Beta Was this translation helpful? Give feedback.
All reactions