Class AcyclicTypes
- All Implemented Interfaces:
Predicate<IRConstruct>
EK9_GC_ACYCLIC) and no release ever buffers it as a candidate.
The proof is local, because EK9 types are closed by default: a field declared as a closed, concrete type holds
an object of EXACTLY that type, so the field's declared type is its runtime type. A type is proven acyclic when
every field it holds - inherited ones included - is a childless closed core type, an enumeration, or a closed
concrete user class or record that is itself proven acyclic, and no chain of such fields returns to a type already
on it. Anything else may hold anything: a container (one C type for every element type), Any, a trait, an
open or abstract type, a function (a dynamic function captures), a type parameter, a parameterisation, a
constrained type (its base lives in an IR-only delegate field the symbols do not list), any other core
type, a field-bearing extern base, a dynamic class's captures. So a wrong answer can only be "not proven" - the
object is buffered and scanned, as every object was before this - never "proven" for a type that can be on a
cycle. An acyclic object can still be reached FROM a cycle; the collector walks and frees it with the island like
any other, the flag only stops it being a candidate.
A pure function of the symbols, stated in the IR as a construct fact (IRConstruct.isAcyclic, rendered
[acyclic]) by IR_OPTIMISATION, so no back end re-derives it; nothing is written to the symbol model. One
instance per compile: decisions are memoised by fully-qualified name, which is unique within one compile.
-
Field Summary
FieldsModifier and TypeFieldDescriptionCore types whose objects hold no child - their C vtable'senumerate_childrenis the noop - and that are closed, so a field of one holds exactly one. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleantest(IRConstruct construct) Is every objectconstructallocates proven never to lie on a reference cycle.
-
Field Details
-
CHILDLESS_CORE_TYPES
-
-
Constructor Details
-
AcyclicTypes
public AcyclicTypes()
-
-
Method Details
-
test
Is every objectconstructallocates proven never to lie on a reference cycle.- Specified by:
testin interfacePredicate<IRConstruct>
-