ronantakizawa/codereview-bench huggingface dataset:
Repository: dotnet/runtime
File: eng/native/build-commons.sh (Shell)

Code before:
}

source "$__RepoRootDir/eng/common/native/init-os-and-arch.sh"

__TargetArch=$arch
__TargetOS=$os
__TargetRid=''

# Get the number of processors available to the scheduler
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
if [[ "$platform" == "freebsd" ]]; then
  __NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "netbsd" || "$platform" == "sunos" ]]; then
  __NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
elif [[ "$platform" == "darwin" ]]; then
  __NumProc="$(($(getconf _NPROCESSORS_ONLN)+1))"
elif command -v nproc > /dev/null 2>&1; then
  __NumProc="$(nproc)"
elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
  __NumProc="$(getconf _NPROCESSORS_ONLN)"
else
  __NumProc=1
fi

# Default to using Ninja on macOS for faster builds
if [[ "$os" == "osx" ]]; then
  __UseNinja=1
fi

while :; do
    if [[ "$#" -le 0 ]]; then
        break
    fi

    lowerI="$(echo "${1/--/-}" | tr "[:upper:]" "[:lower:]")"
    case "$lowerI" in
        -\?|-h|-help)
            usage
            exit 1
            ;;

        arm|-arm)
            __TargetArch=arm
            ;;

        armv6|-armv6)
            __TargetArch=armv6
            ;;

        arm64|-arm64)
            __TargetArch=arm64

Review comment (suggestion):
The unconditional assignment of __UseNinja on macOS will override any explicit initialization done by scripts that source this file. For example, src/coreclr/build-runtime.sh and src/tests/build.sh both set __UseNinja=0 before sourcing this file, but this assignment will override their setting on macOS.

The condition should check if __UseNinja is already set before applying the default. Consider using: if [[ "$os" == "osx" && -z ${__UseNinja+x} ]]; then
```suggestion
# Default to using Ninja on macOS for faster builds, unless already set by caller
if [[ "$os" == "osx" && -z ${__UseNinja+x} ]]; then
```

Code after:
}

source "$__RepoRootDir/eng/common/native/init-os-and-arch.sh"

__TargetArch=$arch
__TargetOS=$os
__TargetRid=''

# Get the number of processors available to the scheduler
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
if [[ "$platform" == "freebsd" ]]; then
  __NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "netbsd" || "$platform" == "sunos" ]]; then
  __NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
elif [[ "$platform" == "darwin" ]]; then
  __NumProc="$(($(getconf _NPROCESSORS_ONLN)+1))"
elif command -v nproc > /dev/null 2>&1; then
  __NumProc="$(nproc)"
elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
  __NumProc="$(getconf _NPROCESSORS_ONLN)"
else
  __NumProc=1
fi

# Default to using Ninja for faster builds
__UseNinja=1

while :; do
    if [[ "$#" -le 0 ]]; then
        break
    fi

    lowerI="$(echo "${1/--/-}" | tr "[:upper:]" "[:lower:]")"
    case "$lowerI" in
        -\?|-h|-help)
            usage
            exit 1
            ;;

        arm|-arm)
            __TargetArch=arm
            ;;

        armv6|-armv6)
            __TargetArch=armv6
            ;;

        arm64|-arm64)
            __TargetArch=arm64
            ;;
Repository: dotnet/runtime
File: eng/build.sh (Shell)

Code before:
}

showSubsetHelp()
{
  "$scriptroot/common/build.sh" "-restore" "-build" "/p:Subset=help" "/clp:nosummary" "/tl:false"
}

arguments=()
cmakeargs=''
extraargs=()
crossBuild=0
portableBuild=1
bootstrap=0
bootstrapConfig='Debug'

source $scriptroot/common/native/init-os-and-arch.sh

hostArch=$arch

# Default to using Ninja on macOS for faster builds (can be overridden with --ninja false)
if [[ "$os" == "osx" ]]; then
  useNinja=true
else
  useNinja=false
fi

# Check if an action is passed in
declare -a actions=("b" "build" "r" "restore" "rebuild" "testnobuild" "sign" "publish" "clean")
actInt=($(comm -12 <(printf '%s\n' "${actions[@]/#/-}" | sort) <(printf '%s\n' "${@/#--/-}" | sort)))
firstArgumentChecked=0

while [[ $# -gt 0 ]]; do
  opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"

  if [[ $firstArgumentChecked -eq 0 && $opt =~ ^[a-zA-Z.+]+$ ]]; then
    if [[ "$opt" == "help" ]]; then
      showSubsetHelp
      exit 0
    fi

    arguments+=("/p:Subset=$1")
    shift 1
    continue
  fi

  firstArgumentChecked=1

  case "$opt" in
     -help|-h|-\?|/?)
      usage
      exit 0

Review comment (suggestion):
Since we're here, do we want to change the default for Linux to match what the Mono subtree does? Mono uses Ninja if it's installed, otherwise falling back to Make.

Code after:
}

showSubsetHelp()
{
  "$scriptroot/common/build.sh" "-restore" "-build" "/p:Subset=help" "/clp:nosummary" "/tl:false"
}

arguments=()
cmakeargs=''
extraargs=()
crossBuild=0
portableBuild=1
bootstrap=0
bootstrapConfig='Debug'

source $scriptroot/common/native/init-os-and-arch.sh

hostArch=$arch

# Default to using Ninja for faster builds (can be overridden with --ninja false)
useNinja=true

# Check if an action is passed in
declare -a actions=("b" "build" "r" "restore" "rebuild" "testnobuild" "sign" "publish" "clean")
actInt=($(comm -12 <(printf '%s\n' "${actions[@]/#/-}" | sort) <(printf '%s\n' "${@/#--/-}" | sort)))
firstArgumentChecked=0

while [[ $# -gt 0 ]]; do
  opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"

  if [[ $firstArgumentChecked -eq 0 && $opt =~ ^[a-zA-Z.+]+$ ]]; then
    if [[ "$opt" == "help" ]]; then
      showSubsetHelp
      exit 0
    fi

    arguments+=("/p:Subset=$1")
    shift 1
    continue
  fi

  firstArgumentChecked=1

  case "$opt" in
     -help|-h|-\?|/?)
      usage
      exit 0
      ;;

     -subset|-s)
      if [ -z ${2+x} ]; then
Repository: dotnet/runtime
File: eng/build.sh (Shell)

Code before:
    initDistroRidGlobal "${targetOs}" "${targetArch}" "${passedRootfsDir}"
}

showSubsetHelp()
{
  "$scriptroot/common/build.sh" "-restore" "-build" "/p:Subset=help" "/clp:nosummary" "/tl:false"
}

arguments=()
cmakeargs=''
extraargs=()
crossBuild=0
portableBuild=1
bootstrap=0
bootstrapConfig='Debug'

source $scriptroot/common/native/init-os-and-arch.sh

hostArch=$arch

# Default to using Ninja if installed for faster builds (can be overridden with --ninja false)
if command -v ninja &> /dev/null; then
  useNinja=true
else
  useNinja=false
fi

# Check if an action is passed in
declare -a actions=("b" "build" "r" "restore" "rebuild" "testnobuild" "sign" "publish" "clean")
actInt=($(comm -12 <(printf '%s\n' "${actions[@]/#/-}" | sort) <(printf '%s\n' "${@/#--/-}" | sort)))
firstArgumentChecked=0

while [[ $# -gt 0 ]]; do
  opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"

  if [[ $firstArgumentChecked -eq 0 && $opt =~ ^[a-zA-Z.+]+$ ]]; then
    if [[ "$opt" == "help" ]]; then
      showSubsetHelp
      exit 0
    fi

    arguments+=("/p:Subset=$1")
    shift 1
    continue
  fi

  firstArgumentChecked=1

  case "$opt" in
     -help|-h|-\?|/?)
      usage

Review comment (suggestion):
This defaults to ninja on ALL platforms if ninja is installed, not just macOS as stated in the PR description. This is inconsistent with eng/native/build-commons.sh (lines 314-318) which only defaults to ninja on macOS.

Additionally, this only checks for 'ninja' but not 'ninja-build', while eng/native/build-commons.sh checks for both (line 45).

The code should be:

if [[ "$os" == "osx" ]] && { command -v ninja &> /dev/null || command -v ninja-build &> /dev/null; }; then
  useNinja=true
else
  useNinja=false
fi

This ensures ninja is only the default on macOS (matching PR intent and eng/native/build-commons.sh behavior) and works correctly on systems where ninja is installed as 'ninja-build'.

Code after:
    initDistroRidGlobal "${targetOs}" "${targetArch}" "${passedRootfsDir}"
}

showSubsetHelp()
{
  "$scriptroot/common/build.sh" "-restore" "-build" "/p:Subset=help" "/clp:nosummary" "/tl:false"
}

arguments=()
cmakeargs=''
extraargs=()
crossBuild=0
portableBuild=1
bootstrap=0
bootstrapConfig='Debug'

source $scriptroot/common/native/init-os-and-arch.sh

hostArch=$arch

# Default to using Ninja for faster builds (can be overridden with --ninja false)
useNinja=true

# Check if an action is passed in
declare -a actions=("b" "build" "r" "restore" "rebuild" "testnobuild" "sign" "publish" "clean")
actInt=($(comm -12 <(printf '%s\n' "${actions[@]/#/-}" | sort) <(printf '%s\n' "${@/#--/-}" | sort)))
firstArgumentChecked=0

while [[ $# -gt 0 ]]; do
  opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"

  if [[ $firstArgumentChecked -eq 0 && $opt =~ ^[a-zA-Z.+]+$ ]]; then
    if [[ "$opt" == "help" ]]; then
      showSubsetHelp
      exit 0
    fi

    arguments+=("/p:Subset=$1")
    shift 1
    continue
  fi

  firstArgumentChecked=1

  case "$opt" in
     -help|-h|-\?|/?)
      usage
      exit 0
      ;;

     -subset|-s)
Repository: dotnet/runtime
File: eng/native/build-commons.sh (Shell)

Code before:

source "$__RepoRootDir/eng/common/native/init-os-and-arch.sh"

__TargetArch=$arch
__TargetOS=$os
__TargetRid=''

# Get the number of processors available to the scheduler
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
if [[ "$platform" == "freebsd" ]]; then
  __NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "netbsd" || "$platform" == "sunos" ]]; then
  __NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
elif [[ "$platform" == "darwin" ]]; then
  __NumProc="$(($(getconf _NPROCESSORS_ONLN)+1))"
elif command -v nproc > /dev/null 2>&1; then
  __NumProc="$(nproc)"
elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
  __NumProc="$(getconf _NPROCESSORS_ONLN)"
else
  __NumProc=1
fi

# Default to using Ninja on macOS for faster builds
__UseNinja=0
if [[ "$os" == "osx" ]]; then
  __UseNinja=1
fi

while :; do
    if [[ "$#" -le 0 ]]; then
        break
    fi

    lowerI="$(echo "${1/--/-}" | tr "[:upper:]" "[:lower:]")"
    case "$lowerI" in
        -\?|-h|-help)
            usage
            exit 1
            ;;

        arm|-arm)
            __TargetArch=arm
            ;;

        armv6|-armv6)
            __TargetArch=armv6
            ;;

        arm64|-arm64)
            __TargetArch=arm64

Review comment (bug):
This sets __UseNinja=1 on macOS without checking if ninja is actually installed. This will cause build failures when check_prereqs() is called (line 44-46) on macOS systems without ninja. The code should check for ninja availability before defaulting to it:

__UseNinja=0
if [[ "$os" == "osx" ]] && { command -v ninja &> /dev/null || command -v ninja-build &> /dev/null; }; then
  __UseNinja=1
fi

This matches the check in check_prereqs() and prevents build failures.
```suggestion
if [[ "$os" == "osx" ]] && { command -v ninja &> /dev/null || command -v ninja-build &> /dev/null; }; then
```

Code after:

source "$__RepoRootDir/eng/common/native/init-os-and-arch.sh"

__TargetArch=$arch
__TargetOS=$os
__TargetRid=''

# Get the number of processors available to the scheduler
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
if [[ "$platform" == "freebsd" ]]; then
  __NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "netbsd" || "$platform" == "sunos" ]]; then
  __NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
elif [[ "$platform" == "darwin" ]]; then
  __NumProc="$(($(getconf _NPROCESSORS_ONLN)+1))"
elif command -v nproc > /dev/null 2>&1; then
  __NumProc="$(nproc)"
elif (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
  __NumProc="$(getconf _NPROCESSORS_ONLN)"
else
  __NumProc=1
fi

# Default to using Ninja for faster builds
__UseNinja=1

while :; do
    if [[ "$#" -le 0 ]]; then
        break
    fi

    lowerI="$(echo "${1/--/-}" | tr "[:upper:]" "[:lower:]")"
    case "$lowerI" in
        -\?|-h|-help)
            usage
            exit 1
            ;;

        arm|-arm)
            __TargetArch=arm
            ;;

        armv6|-armv6)
            __TargetArch=armv6
            ;;

        arm64|-arm64)
            __TargetArch=arm64
            ;;

        armel|-armel)
Repository: dotnet/runtime
File: eng/build.sh (Shell)

Code before:
     -keepnativesymbols)
      if [ -z ${2+x} ]; then
        echo "No value for keepNativeSymbols is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      passedKeepNativeSymbols="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
      if [ "$passedKeepNativeSymbols" = true ]; then
        arguments+=("/p:KeepNativeSymbols=true")
      fi
      shift 2
      ;;


      -ninja)
      if [ -z ${2+x} ]; then
        useNinja=true
        shift 1
      else
        ninja="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
        if [ "$ninja" = true ]; then
          useNinja=true
          shift 2
        elif [ "$ninja" = false ]; then
          useNinja=false
          shift 2
        else
          useNinja=true
          shift 1
        fi
      fi
      ;;

      -pgoinstrument)
      arguments+=("/p:PgoInstrument=true")
      shift 1
      ;;

      -use-bootstrap)
      arguments+=("/p:UseBootstrap=true")
      shift 1
      ;;

      -bootstrap)
      bootstrap=1
      shift 1
      ;;

      -fsanitize)
      if [ -z ${2+x} ]; then
        echo "No value for -fsanitize is supplied. See help (--help) for supported values." 1>&2
        exit 1

Review comment (suggestion):
These all should use `shift 2` as this whole block is `else` case of "no value supplied':
```sh
        ninja="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
        shift 2
        if [ "$ninja" = true ]; then
          arguments+=("/p:Ninja=true")
          useNinja=true
        elif [ "$ninja" = false ]; then
          arguments+=("/p:Ninja=false")
          useNinja=false
        else
          arguments+=("/p:Ninja=true")
          useNinja=true
        fi
```

Code after:
     -keepnativesymbols)
      if [ -z ${2+x} ]; then
        echo "No value for keepNativeSymbols is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      passedKeepNativeSymbols="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
      if [ "$passedKeepNativeSymbols" = true ]; then
        arguments+=("/p:KeepNativeSymbols=true")
      fi
      shift 2
      ;;


      -ninja)
      if [ -z ${2+x} ] || [[ "$2" == -* ]]; then
        useNinja=true
        shift 1
      else
        ninja="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
        shift 2
        if [ "$ninja" = false ]; then
          arguments+=("/p:Ninja=false")
          useNinja=false
        else
          useNinja=true
        fi
      fi
      ;;

      -pgoinstrument)
      arguments+=("/p:PgoInstrument=true")
      shift 1
      ;;

      -use-bootstrap)
      arguments+=("/p:UseBootstrap=true")
      shift 1
      ;;

      -bootstrap)
      bootstrap=1
      shift 1
      ;;

      -fsanitize)
      if [ -z ${2+x} ]; then
        echo "No value for -fsanitize is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      arguments+=("/p:EnableNativeSanitizers=$2")
      shift 2
Repository: dotnet/runtime
File: eng/build.sh (Shell)

Code before:
      if [ -z ${2+x} ]; then
        echo "No value for keepNativeSymbols is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      passedKeepNativeSymbols="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
      if [ "$passedKeepNativeSymbols" = true ]; then
        arguments+=("/p:KeepNativeSymbols=true")
      fi
      shift 2
      ;;


      -ninja)
      if [ -z ${2+x} ]; then
        useNinja=true
        shift 1
      else
        ninja="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
        shift 2
        if [ "$ninja" = true ]; then
          arguments+=("/p:Ninja=true")
          useNinja=true
        elif [ "$ninja" = false ]; then
          arguments+=("/p:Ninja=false")
          useNinja=false
        else
          arguments+=("/p:Ninja=true")
          useNinja=true
        fi
      fi
      ;;

      -pgoinstrument)
      arguments+=("/p:PgoInstrument=true")
      shift 1
      ;;

      -use-bootstrap)
      arguments+=("/p:UseBootstrap=true")
      shift 1
      ;;

      -bootstrap)
      bootstrap=1
      shift 1
      ;;

      -fsanitize)
      if [ -z ${2+x} ]; then
        echo "No value for -fsanitize is supplied. See help (--help) for supported values." 1>&2
        exit 1

Review comment (suggestion):
The `-ninja` argument parsing unconditionally treats `$2` as a value and `shift 2` before checking whether it’s actually a `true|false` value. If a user runs `./build.sh --ninja --subset ...` (or `--ninja -c Release`), this will consume the next option and break argument parsing. Update the logic to only consume `$2` when it’s a value (e.g., `true|false` or `--ninja=<value>`), and otherwise treat `--ninja` as a standalone flag and only `shift 1`.

Code after:
      if [ -z ${2+x} ]; then
        echo "No value for keepNativeSymbols is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      passedKeepNativeSymbols="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
      if [ "$passedKeepNativeSymbols" = true ]; then
        arguments+=("/p:KeepNativeSymbols=true")
      fi
      shift 2
      ;;


      -ninja)
      if [ -z ${2+x} ] || [[ "$2" == -* ]]; then
        useNinja=true
        shift 1
      else
        ninja="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
        shift 2
        if [ "$ninja" = false ]; then
          arguments+=("/p:Ninja=false")
          useNinja=false
        else
          useNinja=true
        fi
      fi
      ;;

      -pgoinstrument)
      arguments+=("/p:PgoInstrument=true")
      shift 1
      ;;

      -use-bootstrap)
      arguments+=("/p:UseBootstrap=true")
      shift 1
      ;;

      -bootstrap)
      bootstrap=1
      shift 1
      ;;

      -fsanitize)
      if [ -z ${2+x} ]; then
        echo "No value for -fsanitize is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      arguments+=("/p:EnableNativeSanitizers=$2")
      shift 2
      ;;
Repository: dotnet/runtime
File: eng/build.sh (Shell)

Code before:
        echo "No value for keepNativeSymbols is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      passedKeepNativeSymbols="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
      if [ "$passedKeepNativeSymbols" = true ]; then
        arguments+=("/p:KeepNativeSymbols=true")
      fi
      shift 2
      ;;


      -ninja)
      if [ -z ${2+x} ]; then
        useNinja=true
        shift 1
      else
        ninja="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
        shift 2
        if [ "$ninja" = true ]; then
          arguments+=("/p:Ninja=true")
          useNinja=true
        elif [ "$ninja" = false ]; then
          arguments+=("/p:Ninja=false")
          useNinja=false
        else
          arguments+=("/p:Ninja=true")
          useNinja=true
        fi
      fi
      ;;

      -pgoinstrument)
      arguments+=("/p:PgoInstrument=true")
      shift 1
      ;;

      -use-bootstrap)
      arguments+=("/p:UseBootstrap=true")
      shift 1
      ;;

      -bootstrap)
      bootstrap=1
      shift 1
      ;;

      -fsanitize)
      if [ -z ${2+x} ]; then
        echo "No value for -fsanitize is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi

Review comment (suggestion):
The `--ninja` option parsing now unconditionally `shift 2` whenever a second token exists, even if that token is another flag (e.g. `--ninja -c Release`). This will swallow the next option and change behavior compared to before. Only consume the next token when it is an explicit `true`/`false` value; otherwise treat `--ninja` as a valueless flag and only `shift 1`.

Code after:
        echo "No value for keepNativeSymbols is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      passedKeepNativeSymbols="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
      if [ "$passedKeepNativeSymbols" = true ]; then
        arguments+=("/p:KeepNativeSymbols=true")
      fi
      shift 2
      ;;


      -ninja)
      if [ -z ${2+x} ] || [[ "$2" == -* ]]; then
        useNinja=true
        shift 1
      else
        ninja="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
        shift 2
        if [ "$ninja" = false ]; then
          arguments+=("/p:Ninja=false")
          useNinja=false
        else
          useNinja=true
        fi
      fi
      ;;

      -pgoinstrument)
      arguments+=("/p:PgoInstrument=true")
      shift 1
      ;;

      -use-bootstrap)
      arguments+=("/p:UseBootstrap=true")
      shift 1
      ;;

      -bootstrap)
      bootstrap=1
      shift 1
      ;;

      -fsanitize)
      if [ -z ${2+x} ]; then
        echo "No value for -fsanitize is supplied. See help (--help) for supported values." 1>&2
        exit 1
      fi
      arguments+=("/p:EnableNativeSanitizers=$2")
      shift 2
      ;;
Repository: dotnet/runtime
File: src/coreclr/vm/perfmap.cpp (C++)

Code before:
    }
}

// Disable the map for the process - called from EEShutdownHelper.
void PerfMap::Disable()
{
    LIMITED_METHOD_CONTRACT;

    if (s_enabled)
    {
        CrstHolder ch(&(s_csPerfMap));

        s_enabled = false;
        if (s_Current != nullptr)
        {
            delete s_Current;
            s_Current = nullptr;
        }

        // PAL_PerfJitDump_Finish is lock protected and can safely be called multiple times
        PAL_PerfJitDump_Finish();
    }
}

// Signal that all dependencies (AppDomain, ExecutionManager) are ready.
// Called from EEStartup after ExecutionManager::Init.
void PerfMap::SignalSendExistingReady()
{
    LIMITED_METHOD_CONTRACT;

    s_sendExistingReady = true;
}

// Construct a new map for the process.
PerfMap::PerfMap()
{
    LIMITED_METHOD_CONTRACT;

    // Initialize with no failures.
    m_ErrorEncountered = false;
}

// Clean-up resources.
PerfMap::~PerfMap()
{
    LIMITED_METHOD_CONTRACT;

    fclose(m_fp);
    m_fp = nullptr;
}


Review comment (suggestion):
```suggestion
```
This comment is not useful and likely to become stale. It is very easy to find where this method is called from exactly at the moment.

Code after:
    }
}

// Disable the map for the process - called from EEShutdownHelper.
void PerfMap::Disable()
{
    LIMITED_METHOD_CONTRACT;

    if (s_enabled)
    {
        CrstHolder ch(&(s_csPerfMap));

        s_enabled = false;
        if (s_Current != nullptr)
        {
            delete s_Current;
            s_Current = nullptr;
        }

        // PAL_PerfJitDump_Finish is lock protected and can safely be called multiple times
        PAL_PerfJitDump_Finish();
    }
}

// Signal that all dependencies (AppDomain, ExecutionManager) are ready.
// This method must be called before any code is JITed or restored from R2R image.
void PerfMap::SignalDependenciesReady()
{
    LIMITED_METHOD_CONTRACT;

    s_dependenciesReady = true;
}

// Construct a new map for the process.
PerfMap::PerfMap()
{
    LIMITED_METHOD_CONTRACT;

    // Initialize with no failures.
    m_ErrorEncountered = false;
}

// Clean-up resources.
PerfMap::~PerfMap()
{
    LIMITED_METHOD_CONTRACT;

    fclose(m_fp);
    m_fp = nullptr;
}