Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline call [Stylistic Refactoring] #982

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading