// and which callee is used.
internal const int Seed = 0xeadbeef;
internal const int MinParams = 1;
- internal const int MaxParams = 25;
+ internal static int MaxParams { get; set; } = 25;
// The number of callees to use. When stressing tailcalls, this is the number of tailcallee parameter lists to pregenerate.
// These parameter lists are pregenerated because we generate tailcallers
// by first selecting a random parameter list. A callee is then
// This class allows us to generate random values of specified types.
internal static class Gen
{
- private static unsafe TVec GenConstantVector<TVec, TElem>(Random rand) where TVec : unmanaged where TElem : unmanaged
+ private static unsafe TVec GenConstantVector<TVec, TElem>(Random rand)
+ where TVec : unmanaged where TElem : unmanaged
{
int outerSize = sizeof(TVec);
int innerSize = sizeof(TElem);
{
static void Usage()
{
- Console.WriteLine("Usage: [--verbose] [--caller-index <number>] [--num-calls <number>] [--tailcalls] [--pinvokes] [--no-ctrlc-summary]");
+ Console.WriteLine("Usage: [--verbose] [--caller-index <number>] [--num-calls <number>] [--tailcalls] [--pinvokes] [--max-params <number>] [--no-ctrlc-summary]");
Console.WriteLine("Either --caller-index or --num-calls must be specified.");
Console.WriteLine("Example: --num-calls 100");
Console.WriteLine(" Stress first 100 tailcalls and pinvokes");
Console.WriteLine(" Stress tailcaller 37, verbose output");
Console.WriteLine("Example: --pinvokes --num-calls 1000");
Console.WriteLine(" Stress first 1000 pinvokes");
+ Console.WriteLine("Example: --tailcalls --num-calls 100 --max-params 2");
+ Console.WriteLine(" Stress 100 tailcalls with either 1 or 2 parameters");
}
if (args.Contains("-help") || args.Contains("--help") || args.Contains("-h"))
callerIndex = int.Parse(args[argIndex + 1]);
if ((argIndex = Array.IndexOf(args, "--num-calls")) != -1)
numCalls = int.Parse(args[argIndex + 1]);
+ if ((argIndex = Array.IndexOf(args, "--max-params")) != -1)
+ Config.MaxParams = int.Parse(args[argIndex + 1]);
if ((callerIndex == -1) == (numCalls == -1))
{
private static List<TypeEx> RandomParameters(TypeEx[] candidateParamTypes, Random rand)
{
- List<TypeEx> pms = new List<TypeEx>(rand.Next(Config.MinParams, Config.MaxParams));
+ List<TypeEx> pms = new List<TypeEx>(rand.Next(Config.MinParams, Config.MaxParams + 1));
for (int j = 0; j < pms.Capacity; j++)
pms.Add(candidateParamTypes[rand.Next(candidateParamTypes.Length)]);