本文整理汇总了C#中ProtoCore.RuntimeCore.AddCallSiteGCRoot方法的典型用法代码示例。如果您正苦于以下问题:C# RuntimeCore.AddCallSiteGCRoot方法的具体用法?C# RuntimeCore.AddCallSiteGCRoot怎么用?C# RuntimeCore.AddCallSiteGCRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProtoCore.RuntimeCore
的用法示例。
在下文中一共展示了RuntimeCore.AddCallSiteGCRoot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecWithRISlowPath
//.........这里部分代码省略.........
{
switch (algorithm)
{
case ZipAlgorithm.Shortest:
//If the shortest algorithm is selected this would
newFormalParams[repIndecies[repIi]] = parameters[repIi][i];
break;
case ZipAlgorithm.Longest:
int length = parameters[repIi].Length;
if (i < length)
{
newFormalParams[repIndecies[repIi]] = parameters[repIi][i];
}
else
{
newFormalParams[repIndecies[repIi]] = parameters[repIi].Last();
}
break;
}
}
List<ReplicationInstruction> newRIs = new List<ReplicationInstruction>();
newRIs.AddRange(replicationInstructions);
newRIs.RemoveAt(0);
SingleRunTraceData cleanRetTrace = new SingleRunTraceData();
retSVs[i] = ExecWithRISlowPath(functionEndPoint, c, newFormalParams, newRIs, stackFrame, runtimeCore,
funcGroup, lastExecTrace, cleanRetTrace);
runtimeCore.AddCallSiteGCRoot(CallSiteID, retSVs[i]);
retTrace.NestedData[i] = cleanRetTrace;
}
StackValue ret = runtimeCore.RuntimeMemory.Heap.AllocateArray(retSVs);
return ret;
}
else
{
//With a cartesian product over an array, we are going to create an array of n
//where the n is the product of the next item
//We will call the subsequent reductions n times
int cartIndex = ri.CartesianIndex;
//this will hold the heap elements for all the arrays that are going to be replicated over
bool supressArray = false;
int retSize;
StackValue[] parameters = null;
if (formalParameters[cartIndex].IsArray)
{
DSArray array = runtimeCore.Heap.ToHeapObject<DSArray>(formalParameters[cartIndex]);
parameters = array.Values.ToArray();
retSize = parameters.Length;
}
else
{
retSize = 1;
supressArray = true;
}
示例2: DispatchNew
//Dispatch
private StackValue DispatchNew(
Context context,
List<StackValue> arguments,
List<List<ReplicationGuide>> partialReplicationGuides,
List<AtLevel> atLevels,
StackFrame stackFrame, RuntimeCore runtimeCore)
{
// Update the CallsiteExecutionState with
// TODO: Replace this with the real data
UpdateCallsiteExecutionState(null, runtimeCore);
Stopwatch sw = new Stopwatch();
sw.Start();
StringBuilder log = new StringBuilder();
log.AppendLine("Method name: " + methodName);
#region Get Function Group
//@PERF: Possible optimisation point here, to deal with static dispatches that don't need replication analysis
//Handle resolution Pass 1: Name -> Method Group
FunctionGroup funcGroup = GetFuncGroup(runtimeCore);
if (funcGroup == null)
{
log.AppendLine("Function group not located");
log.AppendLine("Resolution failed in: " + sw.ElapsedMilliseconds);
if (runtimeCore.Options.DumpFunctionResolverLogic)
runtimeCore.DSExecutable.EventSink.PrintMessage(log.ToString());
return ReportFunctionGroupNotFound(runtimeCore, arguments);
}
//check accesibility of function group
bool methodAccessible = IsFunctionGroupAccessible(runtimeCore, ref funcGroup);
if (!methodAccessible)
{
return ReportMethodNotAccessible(runtimeCore);
}
//If we got here then the function group got resolved
log.AppendLine("Function group resolved: " + funcGroup);
#endregion
arguments = GetArgumentsAtLevels(arguments, atLevels, runtimeCore).Select(a => a.Argument).ToList();
partialReplicationGuides = PerformRepGuideDemotion(arguments, partialReplicationGuides, runtimeCore);
//Replication Control is an ordered list of the elements that we have to replicate over
//Ordering implies containment, so element 0 is the outer most forloop, element 1 is nested within it etc.
//Take the explicit replication guides and build the replication structure
//Turn the replication guides into a guide -> List args data structure
var partialInstructions = Replicator.BuildPartialReplicationInstructions(partialReplicationGuides);
//Get the fep that are resolved
List<FunctionEndPoint> resolvesFeps;
List<ReplicationInstruction> replicationInstructions;
arguments = PerformRepGuideForcedPromotion(arguments, partialReplicationGuides, runtimeCore);
ComputeFeps(log, context, arguments, funcGroup, partialInstructions, partialReplicationGuides, stackFrame, runtimeCore, out resolvesFeps, out replicationInstructions);
if (resolvesFeps.Count == 0)
{
log.AppendLine("Resolution Failed");
if (runtimeCore.Options.DumpFunctionResolverLogic)
runtimeCore.DSExecutable.EventSink.PrintMessage(log.ToString());
return ReportMethodNotFoundForArguments(runtimeCore, arguments);
}
arguments.ForEach(x => runtimeCore.AddCallSiteGCRoot(CallSiteID, x));
StackValue ret = Execute(resolvesFeps, context, arguments, replicationInstructions, stackFrame, runtimeCore, funcGroup);
runtimeCore.RemoveCallSiteGCRoot(CallSiteID);
return ret;
}