/// <summary>Track memoization</summary> /// <remarks> /// This is not part of standard debug interface but is triggered by /// profiling. Code gen inserts an override for this method in the /// recognizer, which triggers this method. /// </remarks> public void ExamineRuleMemoization(IIntStream input, int ruleIndex, string ruleName) { int stopIndex = parser.GetRuleMemoization(ruleIndex, input.Index()); if (stopIndex == BaseRecognizer.MEMO_RULE_UNKNOWN) { numMemoizationCacheMisses++; numGuessingRuleInvocations++; // we'll have to enter } else { // regardless of rule success/failure, if in cache, we have a cache hit numMemoizationCacheHits++; } }
/** <summary> * Track memoization; this is not part of standard debug interface * but is triggered by profiling. Code gen inserts an override * for this method in the recognizer, which triggers this method. * </summary> */ public virtual void ExamineRuleMemoization(IIntStream input, int ruleIndex, string ruleName) { //System.out.println("examine memo "+ruleName); int stopIndex = parser.GetRuleMemoization(ruleIndex, input.Index); if (stopIndex == BaseRecognizer.MEMO_RULE_UNKNOWN) { //System.out.println("rule "+ruleIndex+" missed @ "+input.index()); numMemoizationCacheMisses++; numGuessingRuleInvocations++; // we'll have to enter } else { // regardless of rule success/failure, if in cache, we have a cache hit //System.out.println("rule "+ruleIndex+" hit @ "+input.index()); numMemoizationCacheHits++; } }