You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the start of Chasm, all Transformers are created, usually read from Chassembly files. They can declare ordering relative to other transformers. According to the specified ordering, Transformers are sorted into (as few as possible!) so-called "Rounds". The rounds are then applied one after the other. Therefore, a Transformer experiences the following relevant steps in its lifetime:
Creation (Start of Chasm)
Application (Start of Round)
Completion (End of Round)
Destruction (End of Chasm)
At the start of a round, during transformer application, a Transformer can create any number of Transformations. A Transformation declares during creation which segments of code it requires read access to, called Sources, as well as one primary Target it will replace on application. The Transformations of allTransformers that are running in the current round are then sorted to ordering implied by the Sources and the Target.
Analog to the Transformer, a Transformationat most lives through the following steps during its lifetime:
Creation (Transformer application)
Application (Replacing Target)
Completion (End of Round)
Destruction (End of Chasm)
Internally, Chasm only differentiates between Target and Sources by their writability. For the remainder of this discussion, Target therefore either refers to the single writeable Target or any one of the read-only Sources.
Locking
The idea of locking is, to allow a Transformation to declare restrictions on which Targets and Sources may be modified by other Transformations. In theory, locking can be performed on different levels:
Transformer-level locking
Transformation-level locking
More granular targets are preferable, but a lock may only use lifetime events from its current level.
Affects on Ordering
The fundamental goal of Chasm is to apply as many Transformations as possible without violating any contracts. Some contracts are implied by the specified Targets (write inner before outer), but many of them are defined via locking. Therefore, locking on Transformation-level is a fundamental requirement as it is the primary way to affect ordering.
Locking on Transformer-level would allow the possibility to also affect ordering of Transformers, but it is unclear if this is something that is wanted.
Current Locking
Currently, we only use Transformation-level locking. Additionally, Locks can't outlive a Transformation, so we're limited to the following lock options:
Lock from start of round until Transformation application (Lock.Before)
Lock from Transformation application until end of round (Lock.After)
Questions
With this background, the following questions require discussion
Is current locking sufficient?
Imagine a mod that has only a single transformer for it's entire functionality. A different mod might modify the same code, silently overwriting the original mod. This is a conflict that would be currently detected, but only if they both run in the same round.
The current solution would be to have the first mod generate an additional transformer running in the very last round, which verifies correct application or crashes otherwise.
Do we want longer lived locking?
This would allow us to create locks that last past the end of the current round. The above example could instead create a lock that last from after application to the very end of Chasm.
Do we want Transformer-level locking?
Declaring locks on Transformer-level would allow us to create earlier locks, e.g. from that start of Chasm until Transformer application. I'm not sure this is sueful in any way, but if someone has a usecase, let me know.
The text was updated successfully, but these errors were encountered:
Background and Terminology
At the start of Chasm, all
Transformer
s are created, usually read from Chassembly files. They can declare ordering relative to other transformers. According to the specified ordering,Transformer
s are sorted into (as few as possible!) so-called "Rounds". The rounds are then applied one after the other. Therefore, aTransformer
experiences the following relevant steps in its lifetime:At the start of a round, during transformer application, a
Transformer
can create any number ofTransformation
s. ATransformation
declares during creation which segments of code it requires read access to, calledSources
, as well as one primaryTarget
it will replace on application. TheTransformation
s of allTransformer
s that are running in the current round are then sorted to ordering implied by theSources
and theTarget
.Analog to the
Transformer
, aTransformation
at most lives through the following steps during its lifetime:Transformer
application)Target
)Internally, Chasm only differentiates between
Target
andSources
by their writability. For the remainder of this discussion,Target
therefore either refers to the single writeableTarget
or any one of the read-onlySources
.Locking
The idea of locking is, to allow a
Transformation
to declare restrictions on whichTarget
s andSources
may be modified by otherTransformation
s. In theory, locking can be performed on different levels:Transformer
-level lockingTransformation
-level lockingMore granular targets are preferable, but a lock may only use lifetime events from its current level.
Affects on Ordering
The fundamental goal of Chasm is to apply as many
Transformation
s as possible without violating any contracts. Some contracts are implied by the specified Targets (write inner before outer), but many of them are defined via locking. Therefore, locking onTransformation
-level is a fundamental requirement as it is the primary way to affect ordering.Locking on
Transformer
-level would allow the possibility to also affect ordering ofTransformers
, but it is unclear if this is something that is wanted.Current Locking
Currently, we only use
Transformation
-level locking. Additionally,Lock
s can't outlive aTransformation
, so we're limited to the following lock options:Transformation
application (Lock.Before
)Transformation
application until end of round (Lock.After
)Questions
With this background, the following questions require discussion
Is current locking sufficient?
Imagine a mod that has only a single transformer for it's entire functionality. A different mod might modify the same code, silently overwriting the original mod. This is a conflict that would be currently detected, but only if they both run in the same round.
The current solution would be to have the first mod generate an additional transformer running in the very last round, which verifies correct application or crashes otherwise.
Do we want longer lived locking?
This would allow us to create locks that last past the end of the current round. The above example could instead create a lock that last from after application to the very end of Chasm.
Do we want
Transformer
-level locking?Declaring locks on
Transformer
-level would allow us to create earlier locks, e.g. from that start of Chasm untilTransformer
application. I'm not sure this is sueful in any way, but if someone has a usecase, let me know.The text was updated successfully, but these errors were encountered: