Skip to content

Commit

Permalink
Inline call [Stylistic Refactoring] (#982)
Browse files Browse the repository at this point in the history
  • Loading branch information
typerSniper authored Nov 12, 2024
1 parent 29a06a9 commit 92e40bd
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions Source/Core/Inline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,42 @@ protected class UnrollDepthTracker
protected Dictionary<string, int> procUnrollDepth = new();
protected Dictionary<string, CallCmd> procUnrollSrc = new();

private string getName (Implementation impl) {
private string GetName (Implementation impl) {
string procName = impl.Name;
Contract.Assert(procName != null);
return procName;
}

public int getDepth(Implementation impl) {
var procName = getName(impl);
public int GetDepth(Implementation impl) {
var procName = GetName(impl);
if (procUnrollDepth.TryGetValue(procName, out var c)) {
return c;
}
return -1;
}

public void setDepth (CallCmd cmd, Implementation impl, int depth) {
var procName = getName(impl);
public void SetDepth (CallCmd cmd, Implementation impl, int depth) {
var procName = GetName(impl);
procUnrollSrc[procName] = cmd;
procUnrollDepth[procName] = depth;
}

public void increment(Implementation impl) {
var procName = getName(impl);
public void Increment(Implementation impl) {
var procName = GetName(impl);
Debug.Assert (procUnrollSrc.ContainsKey(procName));
Debug.Assert (procUnrollDepth.ContainsKey(procName));
procUnrollDepth[procName] = procUnrollDepth[procName] + 1;
}

public void decrement(Implementation impl) {
var procName = getName(impl);
public void Decrement(Implementation impl) {
var procName = GetName(impl);
Debug.Assert (procUnrollSrc.ContainsKey(procName));
Debug.Assert (procUnrollDepth.ContainsKey(procName));
procUnrollDepth[procName] = procUnrollDepth[procName] - 1;
}

public void popCmd(CallCmd cmd, Implementation impl) {
var procName = getName(impl);
public void PopCmd(CallCmd cmd, Implementation impl) {
var procName = GetName(impl);
if (procUnrollSrc.ContainsKey(procName) && procUnrollSrc[procName] == cmd) {
Debug.Assert (procUnrollDepth.ContainsKey(procName));
procUnrollSrc.Remove(procName);
Expand Down Expand Up @@ -298,7 +298,7 @@ protected int TryDefineCount(CallCmd callCmd, Implementation impl)
Contract.Requires(impl.Proc != null);

// getDepth returns -1 when depth for this impl is not defined
var depth = depthTracker.getDepth(impl);
var depth = depthTracker.GetDepth(impl);
if (depth >= 0)
{
return depth;
Expand All @@ -316,7 +316,7 @@ int callInlineDepth (CallCmd cmd) {
impl.Proc.CheckIntAttribute("inline", ref depth);
}
if (depth >= 0) {
depthTracker.setDepth (callCmd, impl, depth);
depthTracker.SetDepth (callCmd, impl, depth);
}
return depth;
}
Expand Down Expand Up @@ -377,7 +377,7 @@ private int InlineCallCmd(Block block, CallCmd callCmd, Implementation impl, Lis
}
else
{
depthTracker.decrement(impl);
depthTracker.Decrement(impl);
}

bool inlinedSomething = true;
Expand All @@ -389,7 +389,7 @@ private int InlineCallCmd(Block block, CallCmd callCmd, Implementation impl, Lis
}
else
{
depthTracker.increment(impl);
depthTracker.Increment(impl);
}

Block /*!*/
Expand Down Expand Up @@ -464,7 +464,7 @@ private int InlineCallCmd(Block block, CallCmd callCmd, Implementation impl, Lis
{
newCmds.Add(codeCopier.CopyCmd(callCmd));
}
depthTracker.popCmd(callCmd, impl);
depthTracker.PopCmd(callCmd, impl);
}
else if (cmd is PredicateCmd)
{
Expand Down

0 comments on commit 92e40bd

Please sign in to comment.