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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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-ais true whenbis true.a :- b,c-ais true whenbandcare true (conjunction).a :- b;c-ais true whenborcor bothbandcare true (disjunction).Some basic functors are assumed:
Encloses(t, m)is true when typetcontains a memberm.IsSuperClass(x, y)is true when classxis a superclass of classy.IsArray(x, y)is true when classxis an array of typey.IsSuperInterface(x, y)is true when interfacexis a superinterface of class or interfacey.HasInvokeStaticNode(m)is true when membermis directly invoked by a reachable static invocation node.HasInvokeExactNode(m)is true when membermis directly invoked by a reachable exact invocation node (including constructors).HasInvokeVirtualNode(m)is true when membermis indirectly invoked by a reachable virtual invocation node.HasInvokeInterfaceNode(m)is true when membermis indirectly invoked by a reachable interface invocation node.HasNewNode(t)is true when typetis used with aNewnode.IsClassOf(o, t)is true when the type of objectoist.HasLiteral(o)is true when objectoappears by way of a reachable object literal.RefersTo(oa, ob)is true when objectoarefers to objectob.RefersToMethod(o, m)is true when objectocontains a pointer to methodm.IsInherited(m, t)is true when methodmis 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