Commit Graph

38 Commits

Author SHA1 Message Date
Fedor Isakov 2e5517271d Drop deprecated code marked for removal 2024-06-13 11:02:34 +02:00
Fedor Isakov f965c6636d Drop obsolete incremental and principal stuff 2022-04-20 12:42:20 +02:00
Fedor Isakov c90382ec8f Cleanup code, drop obsolete classes 2022-03-14 18:10:43 +01:00
Fedor Isakov ef3aec13d5 Drop obsolete features, cleanup code 2022-03-14 11:24:22 +01:00
Fedor Isakov 945088f72e Drop obsolete deprecated class, simplify code 2022-03-07 19:16:05 +01:00
Grigorii Kirgizov e73394863e minor: Remove ignored test for not implemented and not needed feature of MatchJournal 2020-12-15 17:59:10 +03:00
Fedor Isakov f6123273d4 Minor refactoring: drop usages of Program.rulesLists() method. 2020-12-01 21:55:17 +01:00
Grigorii Kirgizov da27c7ccd4 Fix some tests given changes in Journal
Also enable old incr tests that failed b/of missing features.
Remove old flaky disabled test.
2020-09-01 17:01:06 +03:00
Grigorii Kirgizov 54335cb2fd Introduce incrementality-allowed levels: No, Unsafe, Yes
Instead of simple allowed/not option sometimes Unsafe
is useful. 'Unsafe' status may be present when there're
few "bad" rules.
With this level end code may resolve to go with
incrementality without strict guarantees.
2020-07-28 18:53:41 +03:00
Grigorii Kirgizov 0d0813d352 Add logical incr contract assertions as observers (implements MPSCR-66) 2020-07-22 15:51:56 +03:00
Grigorii Kirgizov 8629e5abfc Properly handle non-principal rules with origins in incremental algo
Fixes IncrClassHierarchy.modifyClsHierarchyTypeParams test.

Key point is that changes to rules causing their
regeneration must be reflected in program.
There appeared to be cases when it's not true.
It's a case of non-principal rules with origins.
Such rules are called "weak principal" rules.

Matches of weak principal rules are not recorded
in Journal (as is for principal rules), but instead
they become part of their parent MatchChunk.
(In essense, tags of weak principal rules are
recorded in parent chunk).
With this, when a weak principal rule changes,
matches of all principal rules whose computation
depends on them are correctly invalidated.
(Example rules: findHierarchy_Classifier)

Relevant for MPSCR-62.
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov a2675351b5 Track justifications for all occurrences, but weaken information they carry.
Now Evidence isn't unique for each Chunk: Occurrence Chunks fully
share evidence and justifications with their activating match.
So, less collections of justifications are created, approx. 2 times less.
2020-03-26 13:40:41 +03:00
Grigorii Kirgizov 6a53d15a21 Refactor: move logic related to tracking parent match from ControllerImpl to MatchJournal
Relates to machinery introduced in MPSCR-47.
Previously parent match was maintained in Controller on Java call stack.
Now this stack of parent matches is maintained manually in MatchJournal.

So MatchJournal gains new invariant: parentChunk()
returns correct parent after each logMatch() call.
Several tests fail, also need to maintain this
invariant after logActivation() calls.
2020-03-26 13:40:41 +03:00
Grigorii Kirgizov 591865b9cb Small opt: skip traversing journal when there're no rules to invalidate/add 2020-03-10 13:31:34 +03:00
Grigorii Kirgizov 81721a0067 Ensure MatchJournalImpl.replay is idempotent operation, add test for it
Add another test for replaying inside Chunk.
Doesn't pass for now for the lack of machinery for tracking precise Pos.
2020-03-02 22:03:05 +03:00
Grigorii Kirgizov 2b92e5df04 minor: rename test method princConstraint to pconstraint 2020-03-02 17:58:05 +03:00
Grigorii Kirgizov 37dd3ee4a8 Refactoring: extract Justified interface and hide lower-level work with Int sets behind it
Make Occurrence a Justified entity and drop .justifications() from
ConstraintOccurrence.java because justifications are used only internally.
A single justification is now called Evidence (typealias to Int),
so Justified entities are justified by Evidence-s.
2020-03-01 17:12:15 +03:00
Fedor Isakov 8af582f9b2 Refactoring: simplify contract b/w controller and logical state. 2020-01-14 15:34:54 +01:00
Fedor Isakov d208e802b9 Remove unnecessary feature: StateFrameStack is no longer used.
StateFrameStack adds no functionality but requires too much processing.
Rename StateFrameStack -> LogicalState.
Rename ProcessingStateImpl -> ConstraintsProcessing.
Simplify occurrence's logical observer.
Introduce transient dependency on controller to LogicalState.
Keep logical state as part of session token, avoid re-initializing
all logical observers.
Make replaying of match journal independent of controller.
2020-01-10 13:51:07 +01:00
Grigorii Kirgizov cf5d2ae712 Fix incorrect behavior in journal.reset() in some cases, reenable tests for that. 2019-07-26 17:00:31 +02:00
Grigorii Kirgizov 769e7fd2ba Fix small issue related to mutable justifications in Occurrence. Upd tests with latest changes. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov ed93865359 Refactor MatchJournal.Pos. Make RulesDiff usable in coderules mps code. Extend EvaluationTrace. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 49aa913556 Move MatchJournalImpl to its own file. Some docs for it. Hide underlying mutable history behind immutable List. Add string tag() to Rule. 2019-07-26 17:00:30 +02:00
Grigorii Kirgizov 5995b3a2f9 Simplify last test in TestStoreAwareJournal 2019-06-17 19:31:43 +03:00
Grigorii Kirgizov 2a5f9e28dc Fix handling of postponed matches (match order comparison was slightly wrong) 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 8b4d98f6e2 Add few more checks in TestIncrementalProgram tests and one test in TestStoreAwareJournal 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 8d615852c6 Remove Controller from Occurrence and instead pass a new one each time through OccurrenceObserver
It caused a situation when on the very next incremental evaluation session
occurrences carried a stale Controller along with all the state from previous session.
As a result, incorrect logic of program evaluation.
2019-06-12 13:28:06 +03:00
Grigorii Kirgizov 95b5f97869 Add equals() to MatchJournal.Pos. Handle corner case in 'replay', when it happens to the same pos. Same for 'reset'. 2019-06-12 13:28:06 +03:00
Grigorii Kirgizov c9b486c170 Fix StoreAwareJournal test given updated journal's iterator starting pos 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 76194a62ae Refactor tests to make them more readable. Remove unsafe cast from journal's reset. 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 11bec29410 Use journal for aborting execution of alternative branches, fix 'reset' method
All tests for Controller pass, but one test from StoreAwareJournal fails, mute for now
2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 0fb54fc5ba Add invariant to Journal that it always has at least initial chunk, with EmptyRuleMatch
Also slightly fix tests and add tracking (i.e. using journal) to ProcessingStateImpl
2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 225bd9861e Separate concerns b/w ProcessingStateImpl and StateAwareJournal, construct in a new way
ProcessingStateImpl has only processing logic and inherits frame stack logic from StateAwareJournal
2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 77bc7538a4 Prepare before merging StoreAwareJournal & ProcessingStateImpl: extract FrameStack from ProcState, inherit StoreAwareJ from MatchJ by delegation 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 799b57c74e minor: remove usages of rule.tag() in tests 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov 52fd54afce Hide use of TIntSet from trove behind typealias; one usage in ConstraintOccurrence.java is left 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov f8b7ac1d50 Few renames in MatchJournal; throw exceptions at invalid iteration states 2019-06-12 13:28:05 +03:00
Grigorii Kirgizov d3883effaf Extract frame-independent logic from MatchHistory to its base class MatchJournal
Small changes: rename MatchHistory -> StateAwareJournal; use referential
eq when iterating through chunks; provide only Pos, not Chunk from
current()/currentPos(); fix tests according to all this.
2019-06-12 13:28:05 +03:00