dotnet / dotnet/jitutils

jit-analyze issues on Unix

Open
#275 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
160
Forks
69
Avg merge
1h 56m
Merged PRs (30d)
1

Description

There seems to be few issues, which I think are worth the investigation for Unix.

Setup on macOS x64:

```sh
$ pushd runtime_base; ./build.sh -c Release; ./src/coreclr/build-test.sh -generatelayoutonly -release; popd
$ pushd runtime_pr; ./build.sh -c Release; ./src/coreclr/build-test.sh -generatelayoutonly -release; popd

$ mkdir /tmp/diffs

$ jitutils/bin/jit-diff diff \
--base runtime_base/artifacts/bin/coreclr/OSX.x64.Release \
--base_root runtime_base \
--core_root runtime_base/artifacts/tests/coreclr/OSX.x64.Release/Tests/Core_Root \
--output /tmp/diffs --pmi -f

...
Diffs (if any) can be viewed by comparing: /tmp/diffs/dasmset_1/base /tmp/diffs/dasmset_1/diff
...

$ jitutils/bin/jit-diff diff \
--diff runtime_pr/artifacts/bin/coreclr/OSX.x64.Release \
--diff_root runtime_pr \
--core_root runtime_pr/artifacts/tests/coreclr/OSX.x64.Release/Tests/Core_Root \
--output /tmp/diffs --pmi -f

...
Diffs (if any) can be viewed by comparing: /tmp/diffs/dasmset_2/base /tmp/diffs/dasmset_2/diff
...
```

1. allow symlinks.

```sh
$ ln -s /tmp/diffs/dasmset_2/diff/ /tmp/diffs/diff
$ ln -s /tmp/diffs/dasmset_1/base/ /tmp/diffs/base
$ jitutils/bin/jit-analyze --base /tmp/diffs/base --diff /tmp/diffs/diff
Couldn't parse --numstat output '1 1 /tmp/diffs/{diff => base}` : '/tmp/diffs/base' does not exist
```

looks like jit-analyze is strict about directory type and does not accept link-to-directory.

2. allow sub directories:

```sh
$ jitutils/bin/jit-analyze --base /tmp/diffs/dasmset_1/base --diff /tmp/diffs/dasmset_2/diff
```

currently it fails with these errors:

```sh
Couldn't parse --numstat output '1 1 /tmp/diffs/{dasmset_2/diff => dasmset_1/base}/CommandLine.dasm` : '/tmp/diffs/{dasmset_2/diff' does not exist
Couldn't parse --numstat output '1 1 /tmp/diffs/{dasmset_2/diff => dasmset_1/base}/Dia2Lib.dasm` : '/tmp/diffs/{dasmset_2/diff' does not exist
Couldn't parse --numstat output '1 1 /tmp/diffs/{dasmset_2/diff => dasmset_1/base}/ILCompiler.Reflection.ReadyToRun.dasm` : '/tmp/diffs/{dasmset_2/diff' does not exist
Couldn't parse --numstat output '1 1 /tmp/diffs/{dasmset_2/diff => dasmset_1/base}/Microsoft.CSharp.dasm` : '/tmp/diffs/{dasmset_2/diff' does not exist
Couldn't parse --numstat output '1 1 /tmp/diffs/{dasmset_2/diff => dasmset_1/base}/Microsoft.CodeAnalysis.CSharp.dasm` : '/tmp/diffs/{dasmset_2/diff' does not exist
Couldn't parse --numstat output '1 1 /tmp/diffs/{dasmset_2/diff => dasmset_1/base}/Microsoft.CodeAnalysis.VisualBasic.dasm` : '/tmp/diffs/{dasmset_2/diff' does not exist
...
```

from @AndyAyersMS:

> jit-analyze uses git diff under the covers and sometimes git diff decides there are renames and messes up our parsing.

3. crossgen2 does not produce executable on Unix:

and crossgen2.dll fails:

```sh
$ jitutils/bin/jit-diff diff --diff runtime_base/artifacts/bin/coreclr/OSX.x64.Release --diff_root runtime_base --core_root runtime_base/artifacts/tests/coreclr/OSX.x64.Release/Tests/Core_Root --output /tmp/diffs --crossgen runtime_base/artifacts/bin/coreclr/OSX.x64.Release/crossgen2/crossgen2.dll -f
Beginning Crossgen CodeSize Diffs for System.Private.CoreLib.dll, framework assemblies
- Finished 0/0 Base 0/265 Diff [0.1 sec]Unhandled exception. System.ComponentModel.Win32Exception (13): Permission denied
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Microsoft.DotNet.Cli.Utils.Command.Execute()
```

i think we can either produce crossgen2 executable on Unix in dotnet/runtime, or accept the base path of crossgen2, then invoke with `dotnet` as a process name.

_Originally posted by @am11 in https://github.com/dotnet/runtime/pull/39730_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.