From e70a4f31f4b5d367668d9bcd7404a0dc374e63cb Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 31 Oct 2020 16:47:30 +0300 Subject: [PATCH 1/3] coreclr copying --- src/jit-diff/diff.cs | 71 +++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 41 deletions(-) diff --git a/src/jit-diff/diff.cs b/src/jit-diff/diff.cs index d2d943d7..0884529b 100644 --- a/src/jit-diff/diff.cs +++ b/src/jit-diff/diff.cs @@ -612,6 +612,7 @@ public class PmiDiffTool : DiffTool string m_corerunPath; string m_defaultJitName; string m_testJitName; + string m_testCoreclrName = "coreclr.dll"; public PmiDiffTool(Config config) : base(config) { @@ -663,57 +664,45 @@ protected override List ConstructArgs(List commandArgs, string c return dasmArgs; } - void InstallBaseJit() + void InstallLibs(string libPath) { - string existingJitPath = Path.Combine(m_config.CoreRoot, m_testJitName); - string backupJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_testJitName); - string testJitPath = Path.Combine(m_config.BasePath, m_testJitName); - if (File.Exists(existingJitPath)) + var libs = new[] { ("jit", m_testJitName), ("coreclr", m_testCoreclrName) }; + foreach (var (lib, libName) in libs) { - if (m_config.Verbose) + string existingLibPath = Path.Combine(m_config.CoreRoot, libName); + string backupLibPath = Path.Combine(m_config.CoreRoot, "backup-" + libName); + string testLibPath = Path.Combine(libPath, libName); + if (File.Exists(existingLibPath)) { - Console.WriteLine($"Saving off existing jit: {existingJitPath} ==> {backupJitPath}"); + if (m_config.Verbose) + { + Console.WriteLine($"Saving off existing {lib}: {existingLibPath} ==> {backupLibPath}"); + } + File.Copy(existingLibPath, backupLibPath, true); } - File.Copy(existingJitPath, backupJitPath, true); - } - if (m_config.Verbose) - { - Console.WriteLine($"Copying in the test jit: {testJitPath} ==> {existingJitPath}"); - } - File.Copy(testJitPath, existingJitPath, true); - } - - void InstallDiffJit() - { - string exitingJitPath = Path.Combine(m_config.CoreRoot, m_testJitName); - string backupJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_testJitName); - string testJitPath = Path.Combine(m_config.DiffPath, m_testJitName); - if (File.Exists(exitingJitPath)) - { if (m_config.Verbose) { - Console.WriteLine($"Saving off existing jit: {exitingJitPath} ==> {backupJitPath}"); + Console.WriteLine($"Copying in the test {lib}: {testLibPath} ==> {existingLibPath}"); } - File.Copy(exitingJitPath, backupJitPath, true); - } - if (m_config.Verbose) - { - Console.WriteLine($"Copying in the test jit: {testJitPath} ==> {exitingJitPath}"); + File.Copy(testLibPath, existingLibPath, true); } - File.Copy(testJitPath, exitingJitPath, true); } - void RestoreDefaultJit() + void RestoreLibs() { - string existingJitPath = Path.Combine(m_config.CoreRoot, m_testJitName); - string backupJitPath = Path.Combine(m_config.CoreRoot, "backup-" + m_testJitName); - if (File.Exists(backupJitPath)) + var libs = new[] { ("jit", m_testJitName), ("coreclr", m_testCoreclrName) }; + foreach (var (lib, libName) in libs) { - if (m_config.Verbose) + string existingLibPath = Path.Combine(m_config.CoreRoot, libName); + string backupLibPath = Path.Combine(m_config.CoreRoot, "backup-" + libName); + if (File.Exists(backupLibPath)) { - Console.WriteLine($"Restoring existing jit: {backupJitPath} ==> {existingJitPath}"); + if (m_config.Verbose) + { + Console.WriteLine($"Restoring existing {lib}: {backupLibPath} ==> {backupLibPath}"); + } + File.Copy(backupLibPath, backupLibPath, true); } - File.Copy(backupJitPath, existingJitPath, true); } } @@ -727,7 +716,7 @@ protected override void StartDasmWorkBaseDiff(List commandArgs, List commandArgs, List commandArgs, List commandArgs, List Date: Sat, 31 Oct 2020 17:01:47 +0300 Subject: [PATCH 2/3] xplat coreclr name --- src/jit-diff/diff.cs | 3 ++- src/jit-diff/jit-diff.cs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/jit-diff/diff.cs b/src/jit-diff/diff.cs index 0884529b..34131cdb 100644 --- a/src/jit-diff/diff.cs +++ b/src/jit-diff/diff.cs @@ -612,7 +612,7 @@ public class PmiDiffTool : DiffTool string m_corerunPath; string m_defaultJitName; string m_testJitName; - string m_testCoreclrName = "coreclr.dll"; + string m_testCoreclrName; public PmiDiffTool(Config config) : base(config) { @@ -620,6 +620,7 @@ public PmiDiffTool(Config config) : base(config) m_commandName = s_asmToolJit; m_corerunPath = Path.Combine(m_config.CoreRoot, GetCorerunExecutableName(m_config.PlatformMoniker)); m_defaultJitName = GetJitLibraryName(m_config.PlatformMoniker); + m_testCoreclrName = GetCoreClrLibraryName(m_config.PlatformMoniker); if (m_config.AltJit != null) { m_testJitName = m_config.AltJit; diff --git a/src/jit-diff/jit-diff.cs b/src/jit-diff/jit-diff.cs index b44e8260..f6ae2ff7 100755 --- a/src/jit-diff/jit-diff.cs +++ b/src/jit-diff/jit-diff.cs @@ -59,6 +59,22 @@ private static string GetJitLibraryName(string platformMoniker) } } + private static string GetCoreClrLibraryName(string platformMoniker) + { + switch (platformMoniker) + { + case "Windows": + return "coreclr.dll"; + case "Linux": + return "libcoreclr.so"; + case "OSX": + return "libcoreclr.dylib"; + default: + Console.Error.WriteLine("No platform mapping! (Platform moniker = {0})", platformMoniker); + return null; + } + } + private static string GetCrossgenExecutableName(string platformMoniker) { switch (platformMoniker) From b076273445611ba1f6e3209b145809e3df3a4313 Mon Sep 17 00:00:00 2001 From: Rattenkrieg Date: Sat, 31 Oct 2020 17:16:48 +0300 Subject: [PATCH 3/3] fix copypaste --- src/jit-diff/diff.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jit-diff/diff.cs b/src/jit-diff/diff.cs index 34131cdb..97a1334d 100644 --- a/src/jit-diff/diff.cs +++ b/src/jit-diff/diff.cs @@ -700,9 +700,9 @@ void RestoreLibs() { if (m_config.Verbose) { - Console.WriteLine($"Restoring existing {lib}: {backupLibPath} ==> {backupLibPath}"); + Console.WriteLine($"Restoring existing {lib}: {backupLibPath} ==> {existingLibPath}"); } - File.Copy(backupLibPath, backupLibPath, true); + File.Copy(backupLibPath, existingLibPath, true); } } }