1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-09 17:44:48 +09:00

Delete -fms-extensions from coreclr native build (#102834)

For stdcpp conformance, remove the remaining special extensions.
* clean up unnecessary __llvm  special handling.
* Add class, enum, struct prefixes to cases where the variable name is clashing with type name and it changes meaning  (-Werror=changes-meaning)
  * In some trivial cases, I just renamed the variables..
* On x86, replace `__asm {}` syntax with `__asm ("")`
* Two small illumos related build fixes under `src/native` which helped validating the rest of the changes on the platform.
This commit is contained in:
Adeel Mujahid 2024-06-15 07:59:19 +03:00 committed by GitHub
parent 80d0b887fc
commit 3099f31cc7
Signed by: github
GPG key ID: B5690EEEBB952194
59 changed files with 174 additions and 204 deletions

View file

@ -520,11 +520,6 @@ if (CLR_CMAKE_HOST_UNIX)
# Disable frame pointer optimizations so profilers can get better call stacks
add_compile_options(-fno-omit-frame-pointer)
# The -fms-extensions enable the stuff like __declspec(uuid()), etc.
add_compile_options(-fms-extensions)
#-fms-compatibility Enable full Microsoft Visual C++ compatibility
#-fms-extensions Accept some non-standard constructs supported by the Microsoft compiler
# Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
# using twos-complement representation (this is normally undefined according to the C++ spec).
add_compile_options(-fwrapv)

View file

@ -82,7 +82,7 @@ namespace
void PopulateBindRequest(/*inout*/ BinderTracing::AssemblyBindOperation::BindRequest &request)
{
AssemblySpec *spec = request.AssemblySpec;
AssemblySpec *spec = request.AssemblySpecPtr;
_ASSERTE(spec != nullptr);
if (spec->GetName() != nullptr)
@ -172,7 +172,7 @@ namespace BinderTracing
// ActivityTracker or EventSource may have triggered the system satellite load, or load of System.Private.CoreLib
// Don't track such bindings to avoid potential infinite recursion.
m_ignoreBind = t_AssemblyLoadStartInProgress && (m_bindRequest.AssemblySpec->IsCoreLib() || m_bindRequest.AssemblySpec->IsCoreLibSatellite());
m_ignoreBind = t_AssemblyLoadStartInProgress && (m_bindRequest.AssemblySpecPtr->IsCoreLib() || m_bindRequest.AssemblySpecPtr->IsCoreLibSatellite());
m_checkedIgnoreBind = true;
return m_ignoreBind;
}
@ -234,12 +234,12 @@ namespace BinderTracing
bool isLastAttempt = appAssembliesAttempt == nullptr;
TraceStage(Stage::FindInLoadContext,
isLastAttempt && FAILED(m_hr) && SUCCEEDED(inContextAttempt->HResult) ? m_hr : inContextAttempt->HResult,
inContextAttempt->Assembly,
inContextAttempt->AssemblyHolder,
mvidMismatch && isLastAttempt ? errorMsg.GetUnicode() : nullptr);
}
if (appAssembliesAttempt != nullptr)
TraceStage(Stage::ApplicationAssemblies, FAILED(m_hr) && SUCCEEDED(appAssembliesAttempt->HResult) ? m_hr : appAssembliesAttempt->HResult, appAssembliesAttempt->Assembly, mvidMismatch ? errorMsg.GetUnicode() : nullptr);
TraceStage(Stage::ApplicationAssemblies, FAILED(m_hr) && SUCCEEDED(appAssembliesAttempt->HResult) ? m_hr : appAssembliesAttempt->HResult, appAssembliesAttempt->AssemblyHolder, mvidMismatch ? errorMsg.GetUnicode() : nullptr);
}
void ResolutionAttemptedOperation::TraceStage(Stage stage, HRESULT hr, BINDER_SPACE::Assembly *resultAssembly, const WCHAR *customError)

View file

@ -34,7 +34,7 @@ namespace BinderTracing
struct BindRequest
{
AssemblySpec *AssemblySpec;
AssemblySpec *AssemblySpecPtr;
SString AssemblyName;
SString AssemblyPath;
SString RequestingAssembly;

View file

@ -39,14 +39,14 @@ namespace BINDER_SPACE
struct AttemptResult
{
HRESULT HResult;
ReleaseHolder<Assembly> Assembly;
ReleaseHolder<Assembly> AssemblyHolder;
bool Attempted = false;
void Set(const AttemptResult *result);
void Reset()
{
Assembly = nullptr;
AssemblyHolder = nullptr;
Attempted = false;
}
};

View file

@ -99,7 +99,7 @@ void BindResult::SetAttemptResult(HRESULT hr, Assembly *pAssembly, bool isInCont
pAssembly->AddRef();
BindResult::AttemptResult &result = isInContext ? m_inContextAttempt : m_applicationAssembliesAttempt;
result.Assembly = pAssembly;
result.AssemblyHolder = pAssembly;
result.HResult = hr;
result.Attempted = true;
}
@ -112,11 +112,11 @@ const BindResult::AttemptResult* BindResult::GetAttempt(bool foundInContext) con
void BindResult::AttemptResult::Set(const BindResult::AttemptResult *result)
{
BINDER_SPACE::Assembly *assembly = result->Assembly;
BINDER_SPACE::Assembly *assembly = result->AssemblyHolder;
if (assembly != nullptr)
assembly->AddRef();
Assembly = assembly;
AssemblyHolder = assembly;
HResult = result->HResult;
Attempted = result->Attempted;
}

View file

@ -93,7 +93,7 @@ DumpWriter::BuildSegmentLoadCommands()
for (const MemoryRegion& memoryRegion : m_crashInfo.MemoryRegions())
{
uint64_t size = memoryRegion.Size();
uint32_t prot = ConvertFlags(memoryRegion.Permissions());
int32_t prot = ConvertFlags(memoryRegion.Permissions());
segment_command_64 segment = {
LC_SEGMENT_64, // uint32_t cmd;
@ -240,8 +240,8 @@ DumpWriter::WriteSegments()
// Write the header
SpecialThreadInfoHeader header = {
{SPECIAL_THREADINFO_SIGNATURE},
m_crashInfo.Pid(),
m_crashInfo.Threads().size()
static_cast<uint32_t>(m_crashInfo.Pid()),
static_cast<uint32_t>(m_crashInfo.Threads().size())
};
if (!WriteData(&header, sizeof(header))) {
@ -252,7 +252,7 @@ DumpWriter::WriteSegments()
for (const ThreadInfo* thread : m_crashInfo.Threads())
{
SpecialThreadInfoEntry entry = {
thread->Tid(),
static_cast<uint32_t>(thread->Tid()),
thread->GetStackPointer()
};

View file

@ -7913,7 +7913,7 @@ void DacStackReferenceWalker::WalkStack()
// Setup GCCONTEXT structs for the stackwalk.
GCCONTEXT gcctx = {0};
DacScanContext dsc(this, &mList, mResolvePointers);
dsc.pEnumFunc = DacStackReferenceWalker::GCEnumCallback;
dsc.pEnumFunc = DacStackReferenceWalker::GCEnumCallbackFunc;
gcctx.f = DacStackReferenceWalker::GCReportCallback;
gcctx.sc = &dsc;
@ -7960,7 +7960,7 @@ CLRDATA_ADDRESS DacStackReferenceWalker::ReadPointer(TADDR addr)
}
void DacStackReferenceWalker::GCEnumCallback(LPVOID hCallback, OBJECTREF *pObject, uint32_t flags, DacSlotLocation loc)
void DacStackReferenceWalker::GCEnumCallbackFunc(LPVOID hCallback, OBJECTREF *pObject, uint32_t flags, DacSlotLocation loc)
{
GCCONTEXT *gcctx = (GCCONTEXT *)hCallback;
DacScanContext *dsc = (DacScanContext*)gcctx->sc;

View file

@ -2057,7 +2057,7 @@ public:
private:
static StackWalkAction Callback(CrawlFrame *pCF, VOID *pData);
static void GCEnumCallback(LPVOID hCallback, OBJECTREF *pObject, uint32_t flags, DacSlotLocation loc);
static void GCEnumCallbackFunc(LPVOID hCallback, OBJECTREF *pObject, uint32_t flags, DacSlotLocation loc);
static void GCReportCallback(PTR_PTR_Object ppObj, ScanContext *sc, uint32_t flags);
CLRDATA_ADDRESS ReadPointer(TADDR addr);

View file

@ -1503,7 +1503,11 @@ void CordbThread::Get32bitFPRegisters(CONTEXT * pContext)
for (i = 0; i <= floatStackTop; i++)
{
double td = 0.0;
#ifdef _MSC_VER
__asm fstp td // copy out the double
#else
__asm("fstpl %0" : "=m" (td));
#endif
m_floatValues[i] = td;
}

View file

@ -518,11 +518,19 @@ void FloatRegValueHome::SetEnregisteredValue(MemoryRange newValue,
while (i <= m_floatIndex)
{
#ifdef _MSC_VER
__asm fstp td
#else
__asm("fstpl %0" : "=m" (td));
#endif
popArea[i++] = td;
}
#ifdef _MSC_VER
__asm fld newVal; // push on the new value.
#else
__asm("fldl %0" : "=m" (newVal));
#endif
// Push any values that we popled off back onto the stack,
// _except_ the last one, which was the one we changed.
@ -531,7 +539,11 @@ void FloatRegValueHome::SetEnregisteredValue(MemoryRange newValue,
while (i > 0)
{
td = popArea[--i];
#ifdef _MSC_VER
__asm fld td
#else
__asm("fldl %0" : "=m" (td));
#endif
}
// Save out the modified float area.

View file

@ -13962,7 +13962,11 @@ void GenericHijackFuncHelper()
// must be naked.
//
#if defined(TARGET_X86)
#ifdef TARGET_WINDOWS
__declspec(naked)
#else
__attribute__((naked))
#endif
#endif // defined (_x86_)
void Debugger::GenericHijackFunc(void)
{

View file

@ -36,4 +36,3 @@
#include "frameinfo.h"
#include <corerror.h>
#include "../inc/common.h"

View file

@ -162,7 +162,6 @@ public: // !!! NOTE: Called from macros only!!!
#endif
};
//--------------------------------------------------------------------------------
// These CHECK macros are the correct way to propagate an assertion. These
// routines are designed for use inside "Check" routines. Such routines may
@ -535,11 +534,9 @@ CHECK CheckValue(TYPENAME &val)
#endif // _PREFAST_ || _PREFIX_
#define COMPILER_ASSUME(_condition) \
COMPILER_ASSUME_MSG(_condition, "")
//--------------------------------------------------------------------------------
// PREFIX_ASSUME_MSG and PREFAST_ASSUME_MSG are just another name
// for COMPILER_ASSUME_MSG
@ -576,18 +573,17 @@ CHECK CheckValue(TYPENAME &val)
#define UNREACHABLE() \
UNREACHABLE_MSG("")
#ifdef __llvm__
#define UNREACHABLE_RET() \
do { \
UNREACHABLE(); \
return 0; \
} while (0)
// LLVM complains if a function does not return what it says.
#define UNREACHABLE_RET() do { UNREACHABLE(); return 0; } while (0)
#define UNREACHABLE_MSG_RET(_message) UNREACHABLE_MSG(_message); return 0;
#else // __llvm__
#define UNREACHABLE_RET() UNREACHABLE()
#define UNREACHABLE_MSG_RET(_message) UNREACHABLE_MSG(_message)
#endif // __llvm__ else
#define UNREACHABLE_MSG_RET(_message) \
do { \
UNREACHABLE_MSG(_message); \
return 0; \
} while (0)
#ifdef _DEBUG_IMPL
@ -606,7 +602,6 @@ CHECK CheckValue(TYPENAME &val)
#endif
//--------------------------------------------------------------------------------
// STRESS_CHECK represents a check which is included in a free build
// @todo: behavior on trigger
@ -704,8 +699,6 @@ CHECK CheckValue(TYPENAME &val)
#endif
//--------------------------------------------------------------------------------
// Common base level checks
//--------------------------------------------------------------------------------

View file

@ -2120,10 +2120,10 @@ public:
}
private:
const regNumber intReg1;
const regNumber intReg2;
const regNumber addrReg;
emitter* const emitter;
const regNumber intReg1;
const regNumber intReg2;
const regNumber addrReg;
class emitter* const emitter;
};
class ProducingStream
@ -2213,11 +2213,11 @@ public:
}
private:
const regNumber intReg1;
const regNumber simdReg1;
const regNumber simdReg2;
const regNumber addrReg;
emitter* const emitter;
const regNumber intReg1;
const regNumber simdReg1;
const regNumber simdReg2;
const regNumber addrReg;
class emitter* const emitter;
};
class BlockUnrollHelper

View file

@ -4671,7 +4671,7 @@ struct NewCallArg
// The class handle if SignatureType == TYP_STRUCT.
CORINFO_CLASS_HANDLE SignatureClsHnd = NO_CLASS_HANDLE;
// The type of well known arg
WellKnownArg WellKnownArg = ::WellKnownArg::None;
enum class WellKnownArg WellKnownArg = ::WellKnownArg::None;
NewCallArg WellKnown(::WellKnownArg type) const
{

View file

@ -39,7 +39,7 @@ class LoopLocalOccurrences
struct Occurrence
{
BasicBlock* Block;
Statement* Statement;
struct Statement* Statement;
GenTreeLclVarCommon* Node;
Occurrence* Next;
};

View file

@ -24,7 +24,7 @@ public:
template <typename U>
struct rebind
{
typedef allocator<U> allocator;
typedef class allocator<U> allocator;
};
private:
@ -105,7 +105,7 @@ public:
template <typename U>
struct rebind
{
typedef allocator<U> allocator;
typedef class allocator<U> allocator;
};
private:

View file

@ -2115,7 +2115,7 @@ bool Compiler::fgExposeUnpropagatedLocals(bool propagatedAny, LocalEqualsLocalAd
struct Store
{
Statement* Statement;
struct Statement* Statement;
GenTreeLclVarCommon* Tree;
};

View file

@ -1216,8 +1216,8 @@ void NodeCounts::record(genTreeOps oper)
struct DumpOnShutdownEntry
{
const char* Name;
Dumpable* Dumpable;
const char* Name;
class Dumpable* Dumpable;
};
static DumpOnShutdownEntry s_dumpOnShutdown[16];

View file

@ -56,7 +56,7 @@ aot_ipc_get_process_id_disambiguation_key(
// since the start of the Unix epoch).
struct kinfo_proc info = {};
size_t size = sizeof (info);
int mib [4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_id };
int mib [4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)process_id };
const int result_sysctl = sysctl (mib, sizeof(mib)/sizeof(*mib), &info, &size, NULL, 0);
if (result_sysctl == 0) {

View file

@ -45,7 +45,15 @@ GPTR_IMPL(StressLog, g_pStressLog /*, &StressLog::theLog*/);
variable-speed CPUs (for power management), this is not accurate, but may
be good enough.
*/
inline __declspec(naked) uint64_t getTimeStamp() {
inline
#ifdef TARGET_WINDOWS
__declspec(naked)
#else
__attribute__((naked))
#endif
uint64_t getTimeStamp()
{
__asm {
RDTSC // read time stamp counter

View file

@ -30,14 +30,6 @@ typedef int errno_t;
// define the return value for success
#define SAFECRT_SUCCESS 0
#ifndef THROW_DECL
#if defined(_MSC_VER) || defined(__llvm__) || !defined(__cplusplus)
#define THROW_DECL
#else
#define THROW_DECL throw()
#endif // !_MSC_VER
#endif // !THROW_DECL
#ifdef __cplusplus
extern "C" {
#endif
@ -75,7 +67,7 @@ extern int _vsnprintf_s( char* string, size_t sizeInBytes, size_t count, const c
extern int sscanf_s( const char *string, const char *format, ... );
extern int swscanf_s( const WCHAR *string, const WCHAR *format, ... );
extern errno_t memcpy_s( void * dst, size_t sizeInBytes, const void * src, size_t count ) THROW_DECL;
extern errno_t memcpy_s( void * dst, size_t sizeInBytes, const void * src, size_t count );
extern errno_t memmove_s( void * dst, size_t sizeInBytes, const void * src, size_t count );
extern errno_t _wcslwr_s(char16_t *string, size_t sz);

View file

@ -49,6 +49,12 @@ Abstract:
#include <sys/types.h>
#include <unistd.h>
#include <wctype.h>
#if defined(__has_include)
#if __has_include(<alloca.h>)
#include <alloca.h>
#endif // __has_include(alloca.h)
#endif // defined(__has_include)
#ifdef __cplusplus
extern "C++"
@ -118,20 +124,6 @@ extern bool g_arm64_atomics_present;
#define LANG_ENGLISH 0x09
/******************* Compiler-specific glue *******************************/
#ifndef THROW_DECL
#if defined(_MSC_VER) || !defined(__cplusplus)
#define THROW_DECL
#else
#define THROW_DECL throw()
#endif // !_MSC_VER
#endif // !THROW_DECL
#ifdef __sun
#define MATH_THROW_DECL
#else
#define MATH_THROW_DECL THROW_DECL
#endif
#if defined(_MSC_VER)
#define DECLSPEC_ALIGN(x) __declspec(align(x))
#else
@ -167,19 +159,11 @@ extern bool g_arm64_atomics_present;
#ifndef NOOPT_ATTRIBUTE
#if defined(__llvm__)
#define NOOPT_ATTRIBUTE optnone
#elif defined(__GNUC__)
#else
#define NOOPT_ATTRIBUTE optimize("O0")
#endif
#endif
#ifndef NODEBUG_ATTRIBUTE
#if defined(__llvm__)
#define NODEBUG_ATTRIBUTE __nodebug__
#elif defined(__GNUC__)
#define NODEBUG_ATTRIBUTE __artificial__
#endif
#endif
#ifndef __has_cpp_attribute
#define __has_cpp_attribute(x) (0)
#endif
@ -3854,7 +3838,7 @@ PAL_GetCurrentThreadAffinitySet(SIZE_T size, UINT_PTR* data);
// errno_t is only defined when the Secure CRT Extensions library is available (which no standard library that we build with implements anyway)
typedef int errno_t;
PALIMPORT DLLEXPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t) THROW_DECL;
PALIMPORT DLLEXPORT errno_t __cdecl memcpy_s(void *, size_t, const void *, size_t);
PALIMPORT errno_t __cdecl memmove_s(void *, size_t, const void *, size_t);
PALIMPORT DLLEXPORT int __cdecl _wcsicmp(const WCHAR *, const WCHAR*);
PALIMPORT int __cdecl _wcsnicmp(const WCHAR *, const WCHAR *, size_t);
@ -3914,7 +3898,7 @@ inline WCHAR *PAL_wcsstr(WCHAR* S, const WCHAR* P)
}
#endif
#if !__has_builtin(_rotl)
#if !__has_builtin(_rotl) && !defined(_rotl)
/*++
Function:
_rotl
@ -3934,7 +3918,7 @@ unsigned int __cdecl _rotl(unsigned int value, int shift)
}
#endif // !__has_builtin(_rotl)
#if !__has_builtin(_rotr)
#if !__has_builtin(_rotr) && !defined(_rotr)
/*++
Function:

View file

@ -1097,29 +1097,6 @@ errno_t __cdecl _wcsnset_s(WCHAR *_Dst, size_t _SizeInWords, WCHAR _Value, size_
#endif
/* wcsnlen */
extern
size_t __cdecl wcsnlen(const WCHAR *inString, size_t inMaxSize);
#if _SAFECRT_USE_INLINES || _SAFECRT_IMPL
_SAFECRT__INLINE
size_t __cdecl wcsnlen(const WCHAR *inString, size_t inMaxSize)
{
size_t n;
/* Note that we do not check if s == nullptr, because we do not
* return errno_t...
*/
for (n = 0; n < inMaxSize && *inString; n++, inString++)
;
return n;
}
#endif
/* _wmakepath_s */
_SAFECRT__EXTERN_C
errno_t __cdecl _wmakepath_s(WCHAR *_Dst, size_t _SizeInWords, const WCHAR *_Drive, const WCHAR *_Dir, const WCHAR *_Filename, const WCHAR *_Ext);

View file

@ -60,17 +60,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define MACOS_ARM64_POINTER_AUTH_MASK 0x7fffffffffffull
#endif
// Sub-headers included from the libunwind.h contain an empty struct
// and clang issues a warning. Until the libunwind is fixed, disable
// the warning.
#ifdef __llvm__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wextern-c-compat"
#endif
#include <libunwind.h>
#ifdef __llvm__
#pragma clang diagnostic pop
#endif
SET_DEFAULT_DEBUG_CHANNEL(EXCEPT);

View file

@ -24,17 +24,7 @@ Abstract:
#include <dlfcn.h>
#define UNW_LOCAL_ONLY
// Sub-headers included from the libunwind.h contain an empty struct
// and clang issues a warning. Until the libunwind is fixed, disable
// the warning.
#ifdef __llvm__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wextern-c-compat"
#endif
#include <libunwind.h>
#ifdef __llvm__
#pragma clang diagnostic pop
#endif
#else // HOST_UNIX
#include <windows.h>

View file

@ -35,6 +35,7 @@ SET_DEFAULT_DEBUG_CHANNEL(FILE); // some headers have code with asserts, so do t
#include <sys/mount.h>
#include <errno.h>
#include <limits.h>
#include <fcntl.h>
using namespace CorUnix;

View file

@ -53,7 +53,7 @@ DLLEXPORT errno_t __cdecl memcpy_s(
size_t sizeInBytes,
const void * src,
size_t count
) THROW_DECL
)
{
if (count == 0)
{

View file

@ -1629,7 +1629,7 @@ GetProcessIdDisambiguationKey(DWORD processId, UINT64 *disambiguationKey)
// since the start of the Unix epoch).
struct kinfo_proc info = {};
size_t size = sizeof(info);
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, processId };
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)processId };
int ret = ::sysctl(mib, sizeof(mib)/sizeof(*mib), &info, &size, nullptr, 0);
if (ret == 0)

View file

@ -2,19 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
/*++
Module Name:
thread.cpp
Abstract:
Thread object and core APIs
--*/
#include "pal/dbgmsg.h"
@ -48,6 +40,7 @@ SET_DEFAULT_DEBUG_CHANNEL(THREAD); // some headers have code with asserts, so do
#define UNDEF_KERNEL
#endif
#include <sys/procfs.h>
#include <fcntl.h>
#ifdef UNDEF_KERNEL
#undef _KERNEL
#endif

View file

@ -103,7 +103,7 @@ void DumpPrimToConsoleBare(MethodContext* mc, CorInfoType prim, DWORDLONG classH
return;
default:
LogWarning("unknown type in PrimToString(0x%x)", prim);
__debugbreak();
DEBUG_BREAK;
return;
}
}

View file

@ -16,7 +16,7 @@ void MSC_ONLY(__declspec(noreturn)) ThrowSpmiException(DWORD exceptionCode, va_l
_vsnprintf_s(buffer, 8192, 8191, message, args);
if (BreakOnException())
__debugbreak();
DEBUG_BREAK;
ULONG_PTR exArgs[1];
exArgs[0] = (ULONG_PTR)buffer;
@ -42,7 +42,7 @@ void MSC_ONLY(__declspec(noreturn)) ThrowSpmiException(DWORD exceptionCode, cons
void MSC_ONLY(__declspec(noreturn)) ThrowRecordedException(DWORD innerExceptionCode)
{
if (BreakOnException())
__debugbreak();
DEBUG_BREAK;
ULONG_PTR args[1];
args[0] = (ULONG_PTR)innerExceptionCode;

View file

@ -59,7 +59,7 @@ public:
if (locked)
{
LogError("Added item that extended the buffer after it was locked by a call to GetBuffer()");
__debugbreak();
DEBUG_BREAK;
}
unsigned int newbuffsize = bufferLength + sizeof(unsigned int) + len;
@ -86,7 +86,7 @@ public:
if (locked)
{
LogError("Added item that extended the buffer after it was locked by a call to GetBuffer()");
__debugbreak();
DEBUG_BREAK;
}
unsigned int newbuffsize = bufferLength + sizeof(unsigned int) + len;
@ -380,7 +380,7 @@ public:
if (insert != (unsigned int)first)
{
LogDebug("index = %u f %u mid = %u l %u***************************", insert, first, mid, last);
__debugbreak();
DEBUG_BREAK;
}
if (numItems > 0)

View file

@ -171,7 +171,7 @@ void Logger::LogVprintf(
if (!s_initialized)
{
fprintf(stderr, "ERROR: [Logger::LogVprintf] Invoked the logging system before initializing it.\n");
__debugbreak();
DEBUG_BREAK;
}
// Early out if we're not logging at this level.

View file

@ -638,7 +638,7 @@ unsigned int toCorInfoSize(CorInfoType cit)
case CORINFO_TYPE_UNDEF:
case CORINFO_TYPE_VOID:
default:
__debugbreak();
DEBUG_BREAK;
return 0;
}
return -1;

View file

@ -14,7 +14,7 @@ SimpleTimer::SimpleTimer()
if (retVal == FALSE)
{
LogDebug("SimpleTimer::SimpleTimer unable to QPF. error was 0x%08x", ::GetLastError());
::__debugbreak();
DEBUG_BREAK;
}
}
@ -28,7 +28,7 @@ void SimpleTimer::Start()
if (retVal == FALSE)
{
LogDebug("SimpleTimer::Start unable to QPC. error was 0x%08x", ::GetLastError());
::__debugbreak();
DEBUG_BREAK;
}
}
@ -38,7 +38,7 @@ void SimpleTimer::Stop()
if (retVal == FALSE)
{
LogDebug("SimpleTimer::Stop unable to QPC. error was 0x%08x", ::GetLastError());
::__debugbreak();
DEBUG_BREAK;
}
}

View file

@ -38,9 +38,9 @@ void DebugBreakorAV(int val)
if (IsDebuggerPresent())
{
if (val == 0)
__debugbreak();
DEBUG_BREAK;
if (BreakOnDebugBreakorAV())
__debugbreak();
DEBUG_BREAK;
}
int exception_code = EXCEPTIONCODE_DebugBreakorAV + val;

View file

@ -9,6 +9,12 @@
// itself are probably inappropriate, because if you change them, the entire
// project will require a recompile. Generally just put SDK style stuff here...
#ifdef _MSC_VER
#define DEBUG_BREAK __debugbreak()
#else
#define DEBUG_BREAK DebugBreak()
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif // WIN32_LEAN_AND_MEAN
@ -110,13 +116,6 @@
#define DEFAULT_REAL_JIT_NAME_A MAKEDLLNAME_A("clrjit2")
#define DEFAULT_REAL_JIT_NAME_W MAKEDLLNAME_W("clrjit2")
#if !defined(_MSC_VER) && !defined(__llvm__)
static inline void __debugbreak()
{
DebugBreak();
}
#endif
using std::min;
using std::max;

View file

@ -22,7 +22,7 @@ void CycleTimer::Start()
if (retVal == FALSE)
{
LogError("CycleTimer::Start unable to QPC. error was 0x%08x", ::GetLastError());
::__debugbreak();
DEBUG_BREAK;
}
}
@ -33,7 +33,7 @@ void CycleTimer::Stop()
if (retVal == FALSE)
{
LogError("CycleTimer::Stop unable to QPC. error was 0x%08x", ::GetLastError());
::__debugbreak();
DEBUG_BREAK;
}
}

View file

@ -1129,7 +1129,7 @@ bool NearDiffer::compareVars(MethodContext* mc, CompileResult* cr1, CompileResul
if (ftn_1 != ftn_2)
{
// We would like to find out this situation
__debugbreak();
DEBUG_BREAK;
LogVerbose("compareVars found non-matching CORINFO_METHOD_HANDLE %p %p", ftn_1, ftn_2);
return false;
}

View file

@ -518,7 +518,7 @@ int __cdecl main(int argc, char* argv[])
{
if (o.indexCount == -1)
LogInfo("HINT: to repro add '-c %d' to cmdline", reader->GetMethodContextIndex());
__debugbreak();
DEBUG_BREAK;
}
}

View file

@ -12,6 +12,7 @@
#include "stdmacros.h"
#include "md5.h"
#include "contract.h"
#include <minipal/utils.h>
void MD5::Init(BOOL fConstructed)
{
@ -141,11 +142,12 @@ void MD5::GetHashValue(MD5HASHDATA* phash)
//
// but our compiler has an intrinsic!
#if (defined(HOST_X86) || defined(HOST_ARM) || !defined(__clang__)) && defined(TARGET_UNIX)
#define ROL(x, n) (((x) << (n)) | ((x) >> (32-(n))))
#define ROTATE_LEFT(x,n) (x) = ROL(x,n)
#if defined(TARGET_WINDOWS)
#define ROTATE_LEFT(x, n) (x) = _lrotl(x, n)
#elif __has_builtin(__builtin_rotateleft)
#define ROTATE_LEFT(x, n) ((x) = __builtin_rotateleft(x, n))
#else
#define ROTATE_LEFT(x,n) (x) = _lrotl(x,n)
#define ROTATE_LEFT(x, n) ((x) = ((x << (n)) | (x >> (sizeof(x) * 8 - (n)))))
#endif
////////////////////////////////////////////////////////////////

View file

@ -955,7 +955,13 @@ void MagicDeinit(void)
* Exactly the contents of RtlCaptureContext for Win7 - Win2K doesn't
* support this, so we need it for CoreCLR 4, if we require Win2K support
****************************************************************************/
extern "C" __declspec(naked) void __stdcall
extern "C"
#ifdef TARGET_WINDOWS
__declspec(naked)
#else
__attribute__((naked))
#endif
void __stdcall
ClrCaptureContext(_Out_ PCONTEXT ctx)
{
__asm {

View file

@ -22,4 +22,3 @@ using std::max;
#include "volatile.h"
#include "static_assert.h"

View file

@ -34,13 +34,27 @@ thread_local bool t_triedToCreateThreadStressLog;
variable-speed CPUs (for power management), this is not accurate, but may
be good enough.
*/
__forceinline __declspec(naked) uint64_t getTimeStamp() {
__forceinline
#ifdef HOST_WINDOWS
__declspec(naked)
#else
__attribute__((naked))
#endif
uint64_t getTimeStamp() {
STATIC_CONTRACT_LEAF;
__asm {
#ifdef HOST_WINDOWS
__asm {
RDTSC // read time stamp counter
ret
};
}
#else
__asm (
"rdtsc\n\t" // read time stamp counter
"ret\n\t"
);
#endif
}
#else // HOST_X86

View file

@ -24,7 +24,7 @@ public:
struct State
{
CorInfoCallConvExtension CallConvBase;
CallConvModifiers CallConvModifiers;
enum CallConvModifiers CallConvModifiers;
};
private:

View file

@ -6,13 +6,13 @@
struct CallsiteDetails
{
// The signature of the current call
MetaSig MetaSig;
class MetaSig MetaSig;
// The current call frame
FramedMethodFrame *Frame;
// The relevant method for the callsite
MethodDesc *MethodDesc;
class MethodDesc *MethodDesc;
// Is the callsite for a delegate
// Note the relevant method may _not_ be a delegate

View file

@ -201,15 +201,6 @@ Thread * const CURRENT_THREAD = NULL;
EXTERN_C AppDomain* STDCALL GetAppDomain();
#endif //!DACCESS_COMPILE
inline void RetailBreak()
{
#ifdef TARGET_X86
__asm int 3
#else
DebugBreak();
#endif
}
extern BOOL isMemoryReadable(const TADDR start, unsigned len);
#ifndef memcpyUnsafe_f

View file

@ -39,7 +39,7 @@ public:
struct ResolvedToken final
{
TypeHandle TypeHandle;
class TypeHandle TypeHandle;
SigPointer TypeSignature;
SigPointer MethodSignature;
MethodDesc* Method;

View file

@ -227,10 +227,14 @@ extern "C"
CallStackFrame* GetEbp()
{
CallStackFrame *frame=NULL;
#ifdef TARGET_WINDOWS
__asm
{
mov frame, ebp
}
#else
frame = (CallStackFrame*)__builtin_frame_address(0);
#endif
return frame;
}
}

View file

@ -1385,7 +1385,7 @@ struct SuspendableThreadStubArguments
{
void* Argument;
void (*ThreadStart)(void*);
Thread* Thread;
class Thread* Thread;
bool HasStarted;
CLREvent ThreadStartedEvent;
};

View file

@ -127,7 +127,7 @@ public:
lock->Release();
}
typedef Holder<GlobalAllocLock *, GlobalAllocLock::AcquireLock, GlobalAllocLock::ReleaseLock> Holder;
typedef class Holder<GlobalAllocLock *, GlobalAllocLock::AcquireLock, GlobalAllocLock::ReleaseLock> Holder;
};
typedef GlobalAllocLock::Holder GlobalAllocLockHolder;

View file

@ -3967,12 +3967,25 @@ static void FastCallFinalize(Object *obj, PCODE funcPtr, BOOL fCriticalCall)
#if defined(TARGET_X86)
#ifdef TARGET_WINDOWS
__asm
{
mov ecx, [obj]
call [funcPtr]
INDEBUG(nop) // Mark the fact that we can call managed code
}
#else
__asm
(
"mov %%ecx, %[obj]\n\t"
"call *%[funcPtr]\n\t"
INDEBUG("nop\n\t")
:
: [obj] "m" (obj), [funcPtr] "m" (funcPtr)
: "ecx"
);
#endif
#else // TARGET_X86

View file

@ -209,7 +209,7 @@ typedef DPTR(NDirectImportPrecode) PTR_NDirectImportPrecode;
struct FixupPrecodeData
{
PCODE Target;
MethodDesc *MethodDesc;
class MethodDesc *MethodDesc;
PCODE PrecodeFixupThunk;
};

View file

@ -12,14 +12,11 @@
//#error I am a part of util.hpp Please don't include me alone !
//#endif
#ifndef _H_SPINLOCK_
#define _H_SPINLOCK_
#include <stddef.h>
// #SwitchToThreadSpinning
//
// If you call __SwitchToThread in a loop waiting for a condition to be met,
@ -112,12 +109,12 @@ public:
return (BOOL)m_value;
}
typedef Holder<DangerousNonHostedSpinLock *, DangerousNonHostedSpinLock::AcquireLock, DangerousNonHostedSpinLock::ReleaseLock> Holder;
typedef ConditionalStateHolder<DangerousNonHostedSpinLock *, DangerousNonHostedSpinLock::TryAcquireLock, DangerousNonHostedSpinLock::ReleaseLock> TryHolder;
typedef Holder<DangerousNonHostedSpinLock *, DangerousNonHostedSpinLock::AcquireLock, DangerousNonHostedSpinLock::ReleaseLock> LockHolder;
typedef ConditionalStateHolder<DangerousNonHostedSpinLock *, DangerousNonHostedSpinLock::TryAcquireLock, DangerousNonHostedSpinLock::ReleaseLock> LockTryHolder;
};
typedef DangerousNonHostedSpinLock::Holder DangerousNonHostedSpinLockHolder;
typedef DangerousNonHostedSpinLock::TryHolder DangerousNonHostedSpinLockTryHolder;
typedef DangerousNonHostedSpinLock::LockHolder DangerousNonHostedSpinLockHolder;
typedef DangerousNonHostedSpinLock::LockTryHolder DangerousNonHostedSpinLockTryHolder;
class SpinLock;

View file

@ -81,7 +81,7 @@ struct TailCallInfo
TypeHandle RetTyHnd;
ArgBufferLayout ArgBufLayout;
bool HasGCDescriptor;
GCRefMapBuilder GCRefMapBuilder;
class GCRefMapBuilder GCRefMapBuilder;
TailCallInfo(
MethodDesc* pCallerMD, MethodDesc* pCalleeMD,

View file

@ -9,3 +9,4 @@ Revert https://github.com/libunwind/libunwind/pull/503 # issue: https://github.c
Apply https://github.com/libunwind/libunwind/pull/714
Revert https://github.com/libunwind/libunwind/commit/ec03043244082b8f552881ba9fb790aa49c85468 and follow up changes in the same file # issue: https://github.com/libunwind/libunwind/issues/715
Apply https://github.com/libunwind/libunwind/pull/734
Apply https://github.com/libunwind/libunwind/pull/758

View file

@ -63,7 +63,7 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
if (ei)
rc = elf_map_image (ei, mi.path);
else
rc = strlen(mi.path) >= pathlen ? -UNW_ENOMEM : UNW_ESUCCESS:;
rc = strlen(mi.path) >= pathlen ? -UNW_ENOMEM : UNW_ESUCCESS;
maps_close (&mi);
return rc;

View file

@ -2015,9 +2015,11 @@ static bool TryGetPlatformSocketOption(int32_t socketOptionLevel, int32_t socket
*optName = TCP_KEEPINTVL;
return true;
#ifdef TCP_FASTOPEN
case SocketOptionName_SO_TCP_FASTOPEN:
*optName = TCP_FASTOPEN;
return true;
#endif
default:
return false;