repo_name
stringclasses 6
values | pr_number
int64 512
78.9k
| pr_title
stringlengths 3
144
| pr_description
stringlengths 0
30.3k
| author
stringlengths 2
21
| date_created
timestamp[ns, tz=UTC] | date_merged
timestamp[ns, tz=UTC] | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 17
30.4k
| filepath
stringlengths 9
210
| before_content
stringlengths 0
112M
| after_content
stringlengths 0
112M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/file_io/GetSystemTimeAsFileTime/test1/GetSystemTimeAsFileTime.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: GetSystemTimeAsFileTime.c
**
** Purpose: Tests the PAL implementation of GetSystemTimeAsFileTime
** Take two times, three seconds apart, and ensure that the time is
** increasing, and that it has increased at least 3 seconds.
**
**
**
**===================================================================*/
#include <palsuite.h>
PALTEST(file_io_GetSystemTimeAsFileTime_test1_paltest_getsystemtimeasfiletime_test1, "file_io/GetSystemTimeAsFileTime/test1/paltest_getsystemtimeasfiletime_test1")
{
FILETIME TheFirstTime, TheSecondTime;
ULONG64 FullFirstTime, FullSecondTime;
if (0 != PAL_Initialize(argc,argv))
{
return FAIL;
}
/* Get two times, 3 seconds apart */
GetSystemTimeAsFileTime( &TheFirstTime );
Sleep( 3000 );
GetSystemTimeAsFileTime( &TheSecondTime );
/* Convert them to ULONG64 to work with */
FullFirstTime = ((( (ULONG64)TheFirstTime.dwHighDateTime )<<32) |
( (ULONG64)TheFirstTime.dwLowDateTime ));
FullSecondTime = ((( (ULONG64)TheSecondTime.dwHighDateTime )<<32) |
( (ULONG64)TheSecondTime.dwLowDateTime ));
/* Test to ensure the second value is larger than the first */
if( FullSecondTime <= FullFirstTime )
{
Fail("ERROR: The system time didn't increase in the last "
"three seconds. The second time tested was less than "
"or equal to the first.");
}
/* Note: The 30000000 magic number is 3 seconds in hundreds of nano
seconds. This test checks to ensure at least 3 seconds passed
between the readings.
*/
if( ( (LONG64)( FullSecondTime - FullFirstTime ) - 30000000 ) < 0 )
{
ULONG64 TimeError;
/* Note: This test used to compare the difference between full times
in terms of hundreds of nanoseconds. But the x86 clock seems to be
precise only to the level of about 10000 nanoseconds, so we would
fail the comparison depending on when we took time slices.
To fix this, we just check that we're within a millisecond of
sleeping 3000 milliseconds. We're not currently ensuring that we
haven't slept much more than 3000 ms. We may want to do that.
*/
TimeError = 30000000 - ( FullSecondTime - FullFirstTime );
if ( TimeError > 10000)
{
Fail("ERROR: Two system times were tested, with a sleep of 3 "
"seconds between. The time passed should have been at least "
"3 seconds. But, it was less according to the function.");
}
}
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: GetSystemTimeAsFileTime.c
**
** Purpose: Tests the PAL implementation of GetSystemTimeAsFileTime
** Take two times, three seconds apart, and ensure that the time is
** increasing, and that it has increased at least 3 seconds.
**
**
**
**===================================================================*/
#include <palsuite.h>
PALTEST(file_io_GetSystemTimeAsFileTime_test1_paltest_getsystemtimeasfiletime_test1, "file_io/GetSystemTimeAsFileTime/test1/paltest_getsystemtimeasfiletime_test1")
{
FILETIME TheFirstTime, TheSecondTime;
ULONG64 FullFirstTime, FullSecondTime;
if (0 != PAL_Initialize(argc,argv))
{
return FAIL;
}
/* Get two times, 3 seconds apart */
GetSystemTimeAsFileTime( &TheFirstTime );
Sleep( 3000 );
GetSystemTimeAsFileTime( &TheSecondTime );
/* Convert them to ULONG64 to work with */
FullFirstTime = ((( (ULONG64)TheFirstTime.dwHighDateTime )<<32) |
( (ULONG64)TheFirstTime.dwLowDateTime ));
FullSecondTime = ((( (ULONG64)TheSecondTime.dwHighDateTime )<<32) |
( (ULONG64)TheSecondTime.dwLowDateTime ));
/* Test to ensure the second value is larger than the first */
if( FullSecondTime <= FullFirstTime )
{
Fail("ERROR: The system time didn't increase in the last "
"three seconds. The second time tested was less than "
"or equal to the first.");
}
/* Note: The 30000000 magic number is 3 seconds in hundreds of nano
seconds. This test checks to ensure at least 3 seconds passed
between the readings.
*/
if( ( (LONG64)( FullSecondTime - FullFirstTime ) - 30000000 ) < 0 )
{
ULONG64 TimeError;
/* Note: This test used to compare the difference between full times
in terms of hundreds of nanoseconds. But the x86 clock seems to be
precise only to the level of about 10000 nanoseconds, so we would
fail the comparison depending on when we took time slices.
To fix this, we just check that we're within a millisecond of
sleeping 3000 milliseconds. We're not currently ensuring that we
haven't slept much more than 3000 ms. We may want to do that.
*/
TimeError = 30000000 - ( FullSecondTime - FullFirstTime );
if ( TimeError > 10000)
{
Fail("ERROR: Two system times were tested, with a sleep of 3 "
"seconds between. The time passed should have been at least "
"3 seconds. But, it was less according to the function.");
}
}
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/exception_handling/pal_except/test2/test2.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: test2.c (exception_handling\pal_except\test2)
**
** Purpose: Test to make sure the PAL_EXCEPT block is executed
** after an exception occurs in the PAL_TRY block
** that contains another PAL_TRY-PAL_EXCEPT block
**
**
**===================================================================*/
#include <palsuite.h>
/* Execution flags */
BOOL bTry_pal_except_test2 = FALSE;
BOOL bExcept_pal_except_test2 = FALSE;
BOOL bTry_nested_pal_except_test2 = FALSE;
BOOL bExcept_nested_pal_except_test2 = FALSE;
PALTEST(exception_handling_pal_except_test2_paltest_pal_except_test2, "exception_handling/pal_except/test2/paltest_pal_except_test2")
{
if (0 != PAL_Initialize(argc, argv))
{
return FAIL;
}
PAL_TRY
{
int* p = 0x00000000; /* NULL pointer */
bTry_pal_except_test2 = TRUE; /* indicate we hit the PAL_TRY block */
/* Nested PAL_TRY */
PAL_TRY
{
bTry_nested_pal_except_test2 = TRUE;
*p = 13; /* causes an access violation exception */
Fail("ERROR: code was executed after the nested access violation.\n");
}
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
if (!bTry_pal_except_test2)
{
Fail("ERROR: Nested PAL_EXCEPT was hit without "
"nested PAL_TRY being hit.\n");
}
bExcept_nested_pal_except_test2 = TRUE;
}
PAL_ENDTRY;
*p = 13; /* causes an access violation exception */
Fail("ERROR: code was executed after the access violation.\n");
}
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
if (!bTry_pal_except_test2)
{
Fail("ERROR: PAL_EXCEPT was hit without PAL_TRY being hit.\n");
}
if (!bExcept_nested_pal_except_test2)
{
Fail("ERROR: PAL_EXCEPT was hit without "
"nested PAL_EXCEPT being hit.\n");
}
bExcept_pal_except_test2 = TRUE; /* indicate we hit the PAL_EXCEPT block */
}
PAL_ENDTRY;
if (!bTry_pal_except_test2)
{
Trace("ERROR: the code in the PAL_TRY block was not executed.\n");
}
if (!bExcept_pal_except_test2)
{
Trace("ERROR: the code in the PAL_EXCEPT block was not executed.\n");
}
if (!bTry_nested_pal_except_test2)
{
Trace("ERROR: the code in the "
"nested PAL_TRY block was not executed.\n");
}
if (!bExcept_nested_pal_except_test2)
{
Trace("ERROR: the code in the "
"nested PAL_EXCEPT block was not executed.\n");
}
/* did we hit all the code blocks? */
if(!bTry_pal_except_test2 || !bExcept_pal_except_test2 ||
!bTry_nested_pal_except_test2 || !bExcept_nested_pal_except_test2)
{
Fail("");
}
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: test2.c (exception_handling\pal_except\test2)
**
** Purpose: Test to make sure the PAL_EXCEPT block is executed
** after an exception occurs in the PAL_TRY block
** that contains another PAL_TRY-PAL_EXCEPT block
**
**
**===================================================================*/
#include <palsuite.h>
/* Execution flags */
BOOL bTry_pal_except_test2 = FALSE;
BOOL bExcept_pal_except_test2 = FALSE;
BOOL bTry_nested_pal_except_test2 = FALSE;
BOOL bExcept_nested_pal_except_test2 = FALSE;
PALTEST(exception_handling_pal_except_test2_paltest_pal_except_test2, "exception_handling/pal_except/test2/paltest_pal_except_test2")
{
if (0 != PAL_Initialize(argc, argv))
{
return FAIL;
}
PAL_TRY
{
int* p = 0x00000000; /* NULL pointer */
bTry_pal_except_test2 = TRUE; /* indicate we hit the PAL_TRY block */
/* Nested PAL_TRY */
PAL_TRY
{
bTry_nested_pal_except_test2 = TRUE;
*p = 13; /* causes an access violation exception */
Fail("ERROR: code was executed after the nested access violation.\n");
}
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
if (!bTry_pal_except_test2)
{
Fail("ERROR: Nested PAL_EXCEPT was hit without "
"nested PAL_TRY being hit.\n");
}
bExcept_nested_pal_except_test2 = TRUE;
}
PAL_ENDTRY;
*p = 13; /* causes an access violation exception */
Fail("ERROR: code was executed after the access violation.\n");
}
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
if (!bTry_pal_except_test2)
{
Fail("ERROR: PAL_EXCEPT was hit without PAL_TRY being hit.\n");
}
if (!bExcept_nested_pal_except_test2)
{
Fail("ERROR: PAL_EXCEPT was hit without "
"nested PAL_EXCEPT being hit.\n");
}
bExcept_pal_except_test2 = TRUE; /* indicate we hit the PAL_EXCEPT block */
}
PAL_ENDTRY;
if (!bTry_pal_except_test2)
{
Trace("ERROR: the code in the PAL_TRY block was not executed.\n");
}
if (!bExcept_pal_except_test2)
{
Trace("ERROR: the code in the PAL_EXCEPT block was not executed.\n");
}
if (!bTry_nested_pal_except_test2)
{
Trace("ERROR: the code in the "
"nested PAL_TRY block was not executed.\n");
}
if (!bExcept_nested_pal_except_test2)
{
Trace("ERROR: the code in the "
"nested PAL_EXCEPT block was not executed.\n");
}
/* did we hit all the code blocks? */
if(!bTry_pal_except_test2 || !bExcept_pal_except_test2 ||
!bTry_nested_pal_except_test2 || !bExcept_nested_pal_except_test2)
{
Fail("");
}
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/corehost/ijwhost/pedecoder.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include "pedecoder.h"
#include "corhdr.h"
bool PEDecoder::HasManagedEntryPoint() const
{
ULONG flags = GetCorHeader()->Flags;
return (!(flags & COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) &&
(!IsNilToken(GetCorHeader()->EntryPointToken)));
}
IMAGE_COR_VTABLEFIXUP *PEDecoder::GetVTableFixups(std::size_t *pCount) const
{
IMAGE_DATA_DIRECTORY *pDir = &GetCorHeader()->VTableFixups;
if (pCount != NULL)
*pCount = pDir->Size / sizeof(IMAGE_COR_VTABLEFIXUP);
return (IMAGE_COR_VTABLEFIXUP*)(GetDirectoryData(pDir));
}
bool PEDecoder::HasNativeEntryPoint() const
{
DWORD flags = GetCorHeader()->Flags;
return ((flags & COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) &&
(GetCorHeader()->EntryPointToken != 0));
}
void *PEDecoder::GetNativeEntryPoint() const
{
return ((void *) GetRvaData(GetCorHeader()->EntryPointToken));
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include "pedecoder.h"
#include "corhdr.h"
bool PEDecoder::HasManagedEntryPoint() const
{
ULONG flags = GetCorHeader()->Flags;
return (!(flags & COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) &&
(!IsNilToken(GetCorHeader()->EntryPointToken)));
}
IMAGE_COR_VTABLEFIXUP *PEDecoder::GetVTableFixups(std::size_t *pCount) const
{
IMAGE_DATA_DIRECTORY *pDir = &GetCorHeader()->VTableFixups;
if (pCount != NULL)
*pCount = pDir->Size / sizeof(IMAGE_COR_VTABLEFIXUP);
return (IMAGE_COR_VTABLEFIXUP*)(GetDirectoryData(pDir));
}
bool PEDecoder::HasNativeEntryPoint() const
{
DWORD flags = GetCorHeader()->Flags;
return ((flags & COMIMAGE_FLAGS_NATIVE_ENTRYPOINT) &&
(GetCorHeader()->EntryPointToken != 0));
}
void *PEDecoder::GetNativeEntryPoint() const
{
return ((void *) GetRvaData(GetCorHeader()->EntryPointToken));
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/threading/GetExitCodeProcess/test1/test1.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================================
**
** Source: test1.c
**
** Purpose: Test to ensure GetExitCodeProcess works properly.
**
** Dependencies: PAL_Initialize
** PAL_Terminate
** Fail
** ZeroMemory
** GetCurrentDirectoryW
** CreateProcessW
** WaitForSingleObject
** GetLastError
** strlen
** strncpy
**
**
**===========================================================================*/
#include <palsuite.h>
#include "myexitcode.h"
PALTEST(threading_GetExitCodeProcess_test1_paltest_getexitcodeprocess_test1, "threading/GetExitCodeProcess/test1/paltest_getexitcodeprocess_test1")
{
const char* rgchChildFile = "childprocess";
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD dwError;
DWORD dwExitCode;
DWORD dwFileLength;
DWORD dwDirLength;
DWORD dwSize;
char rgchDirName[_MAX_DIR];
char absPathBuf[_MAX_PATH];
char* rgchAbsPathName;
/* initialize the PAL */
if( PAL_Initialize(argc, argv) != 0 )
{
return( FAIL );
}
/* zero our process and startup info structures */
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof( si );
ZeroMemory( &pi, sizeof(pi) );
/* build the absolute path to the child process */
rgchAbsPathName = &absPathBuf[0];
dwFileLength = strlen( rgchChildFile );
dwDirLength = GetCurrentDirectory( _MAX_PATH, rgchDirName );
if( dwDirLength == 0 )
{
dwError = GetLastError();
Fail( "GetCurrentDirectory call failed with error code %d\n",
dwError );
}
dwSize = mkAbsoluteFilename( rgchDirName,
dwDirLength,
rgchChildFile,
dwFileLength,
rgchAbsPathName );
if( dwSize == 0 )
{
Fail( "Palsuite Code: mkAbsoluteFilename() call failed. Could ",
"not build absolute path name to file\n. Exiting.\n" );
}
LPWSTR rgchAbsPathNameW = convert(rgchAbsPathName);
/* launch the child process */
if( !CreateProcess( NULL, /* module name to execute */
rgchAbsPathNameW, /* command line */
NULL, /* process handle not */
/* inheritable */
NULL, /* thread handle not */
/* inheritable */
FALSE, /* handle inheritance */
CREATE_NEW_CONSOLE, /* dwCreationFlags */
NULL, /* use parent's environment */
NULL, /* use parent's starting */
/* directory */
&si, /* startup info struct */
&pi ) /* process info struct */
)
{
dwError = GetLastError();
free(rgchAbsPathNameW);
Fail( "CreateProcess call failed with error code %d\n",
dwError );
}
free(rgchAbsPathNameW);
/* wait for the child process to complete */
WaitForSingleObject ( pi.hProcess, INFINITE );
/* check the exit code from the process */
if( ! GetExitCodeProcess( pi.hProcess, &dwExitCode ) )
{
dwError = GetLastError();
CloseHandle ( pi.hProcess );
CloseHandle ( pi.hThread );
Fail( "GetExitCodeProcess call failed with error code %d\n",
dwError );
}
/* close process and thread handle */
CloseHandle ( pi.hProcess );
CloseHandle ( pi.hThread );
/* check for the expected exit code */
if( dwExitCode != TEST_EXIT_CODE )
{
Fail( "GetExitCodeProcess returned an incorrect exit code %d, "
"expected value is %d\n",
dwExitCode, TEST_EXIT_CODE );
}
/* terminate the PAL */
PAL_Terminate();
/* return success */
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================================
**
** Source: test1.c
**
** Purpose: Test to ensure GetExitCodeProcess works properly.
**
** Dependencies: PAL_Initialize
** PAL_Terminate
** Fail
** ZeroMemory
** GetCurrentDirectoryW
** CreateProcessW
** WaitForSingleObject
** GetLastError
** strlen
** strncpy
**
**
**===========================================================================*/
#include <palsuite.h>
#include "myexitcode.h"
PALTEST(threading_GetExitCodeProcess_test1_paltest_getexitcodeprocess_test1, "threading/GetExitCodeProcess/test1/paltest_getexitcodeprocess_test1")
{
const char* rgchChildFile = "childprocess";
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD dwError;
DWORD dwExitCode;
DWORD dwFileLength;
DWORD dwDirLength;
DWORD dwSize;
char rgchDirName[_MAX_DIR];
char absPathBuf[_MAX_PATH];
char* rgchAbsPathName;
/* initialize the PAL */
if( PAL_Initialize(argc, argv) != 0 )
{
return( FAIL );
}
/* zero our process and startup info structures */
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof( si );
ZeroMemory( &pi, sizeof(pi) );
/* build the absolute path to the child process */
rgchAbsPathName = &absPathBuf[0];
dwFileLength = strlen( rgchChildFile );
dwDirLength = GetCurrentDirectory( _MAX_PATH, rgchDirName );
if( dwDirLength == 0 )
{
dwError = GetLastError();
Fail( "GetCurrentDirectory call failed with error code %d\n",
dwError );
}
dwSize = mkAbsoluteFilename( rgchDirName,
dwDirLength,
rgchChildFile,
dwFileLength,
rgchAbsPathName );
if( dwSize == 0 )
{
Fail( "Palsuite Code: mkAbsoluteFilename() call failed. Could ",
"not build absolute path name to file\n. Exiting.\n" );
}
LPWSTR rgchAbsPathNameW = convert(rgchAbsPathName);
/* launch the child process */
if( !CreateProcess( NULL, /* module name to execute */
rgchAbsPathNameW, /* command line */
NULL, /* process handle not */
/* inheritable */
NULL, /* thread handle not */
/* inheritable */
FALSE, /* handle inheritance */
CREATE_NEW_CONSOLE, /* dwCreationFlags */
NULL, /* use parent's environment */
NULL, /* use parent's starting */
/* directory */
&si, /* startup info struct */
&pi ) /* process info struct */
)
{
dwError = GetLastError();
free(rgchAbsPathNameW);
Fail( "CreateProcess call failed with error code %d\n",
dwError );
}
free(rgchAbsPathNameW);
/* wait for the child process to complete */
WaitForSingleObject ( pi.hProcess, INFINITE );
/* check the exit code from the process */
if( ! GetExitCodeProcess( pi.hProcess, &dwExitCode ) )
{
dwError = GetLastError();
CloseHandle ( pi.hProcess );
CloseHandle ( pi.hThread );
Fail( "GetExitCodeProcess call failed with error code %d\n",
dwError );
}
/* close process and thread handle */
CloseHandle ( pi.hProcess );
CloseHandle ( pi.hThread );
/* check for the expected exit code */
if( dwExitCode != TEST_EXIT_CODE )
{
Fail( "GetExitCodeProcess returned an incorrect exit code %d, "
"expected value is %d\n",
dwExitCode, TEST_EXIT_CODE );
}
/* terminate the PAL */
PAL_Terminate();
/* return success */
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/vm/profilinghelper.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// ProfilingHelper.cpp
//
//
// Implementation of helper classes used for miscellaneous purposes within the profiling
// API
//
// ======================================================================================
//
// #LoadUnloadCallbackSynchronization
//
// There is synchronization around loading profilers, unloading profilers, and issuing
// callbacks to profilers, to ensure that we know when it's safe to detach profilers or
// to call into profilers. The synchronization scheme is intentionally lockless on the
// mainline path (issuing callbacks into the profiler), with heavy locking on the
// non-mainline path (loading / unloading profilers).
//
// PROTECTED DATA
//
// The synchronization protects the following data:
//
// * ProfilingAPIDetach::s_profilerDetachInfo
// * (volatile) g_profControlBlock.curProfStatus.m_profStatus
// * (volatile) g_profControlBlock.pProfInterface
// * latter implies the profiler DLL's load status is protected as well, as
// pProfInterface changes between non-NULL and NULL as a profiler DLL is
// loaded and unloaded, respectively.
//
// SYNCHRONIZATION COMPONENTS
//
// * Simple Crst: code:ProfilingAPIUtility::s_csStatus
// * Lockless, volatile per-thread counters: code:EvacuationCounterHolder
// * Profiler status transition invariants and CPU buffer flushing:
// code:CurrentProfilerStatus::Set
//
// WRITERS
//
// The above data is considered to be "written to" when a profiler is loaded or unloaded,
// or the status changes (see code:ProfilerStatus), or a request to detach the profiler
// is received (see code:ProfilingAPIDetach::RequestProfilerDetach), or the DetachThread
// consumes or modifies the contents of code:ProfilingAPIDetach::s_profilerDetachInfo.
// All these cases are serialized with each other by the simple Crst:
// code:ProfilingAPIUtility::s_csStatus
//
// READERS
//
// Readers are the mainline case and are lockless. A "reader" is anyone who wants to
// issue a profiler callback. Readers are scattered throughout the runtime, and have the
// following format:
// {
// BEGIN_PROFILER_CALLBACK(CORProfilerTrackAppDomainLoads());
// g_profControlBlock.pProfInterface->AppDomainCreationStarted(MyAppDomainID);
// END_PROFILER_CALLBACK();
// }
// The BEGIN / END macros do the following:
// * Evaluate the expression argument (e.g., CORProfilerTrackAppDomainLoads()). This is a
// "dirty read" as the profiler could be detached at any moment during or after that
// evaluation.
// * If true, push a code:EvacuationCounterHolder on the stack, which increments the
// per-thread evacuation counter (not interlocked).
// * Re-evaluate the expression argument. This time, it's a "clean read" (see below for
// why).
// * If still true, execute the statements inside the BEGIN/END block. Inside that block,
// the profiler is guaranteed to remain loaded, because the evacuation counter
// remains nonzero (again, see below).
// * Once the BEGIN/END block is exited, the evacuation counter is decremented, and the
// profiler is unpinned and allowed to detach.
//
// READER / WRITER COORDINATION
//
// The above ensures that a reader never touches g_profControlBlock.pProfInterface and
// all it embodies (including the profiler DLL code and callback implementations) unless
// the reader was able to increment its thread's evacuation counter AND re-verify that
// the profiler's status is still active (the status check is included in the macro's
// expression argument, such as CORProfilerTrackAppDomainLoads()).
//
// At the same time, a profiler DLL is never unloaded (nor
// g_profControlBlock.pProfInterface deleted and NULLed out) UNLESS the writer performs
// these actions:
// * (a) Set the profiler's status to a non-active state like kProfStatusDetaching or
// kProfStatusNone
// * (b) Call FlushProcessWriteBuffers()
// * (c) Grab thread store lock, iterate through all threads, and verify each per-thread
// evacuation counter is zero.
//
// The above steps are why it's considered a "clean read" if a reader first increments
// its evacuation counter and then checks the profiler status. Once the writer flushes
// the CPU buffers (b), the reader will see the updated status (from a) and know not to
// use g_profControlBlock.pProfInterface. And if the reader clean-reads the status before
// the buffers were flushed, then the reader will have incremented its evacuation counter
// first, which the writer will be sure to see in (c). For more details about how the
// evacuation counters work, see code:ProfilingAPIUtility::IsProfilerEvacuated.
//
#include "common.h"
#ifdef PROFILING_SUPPORTED
#include "eeprofinterfaces.h"
#include "eetoprofinterfaceimpl.h"
#include "eetoprofinterfaceimpl.inl"
#include "corprof.h"
#include "proftoeeinterfaceimpl.h"
#include "proftoeeinterfaceimpl.inl"
#include "profilinghelper.h"
#include "profilinghelper.inl"
#include "eemessagebox.h"
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
#include "profdetach.h"
#endif // FEATURE_PROFAPI_ATTACH_DETACH
#include "utilcode.h"
#ifndef TARGET_UNIX
#include "securitywrapper.h"
#endif // !TARGET_UNIX
// ----------------------------------------------------------------------------
// CurrentProfilerStatus methods
//---------------------------------------------------------------------------------------
//
// Updates the value indicating the profiler's current status
//
// Arguments:
// profStatus - New value (from enum ProfilerStatus) to set.
//
// Notes:
// Sets the status under a lock, and performs a debug-only check to verify that the
// status transition is a legal one. Also performs a FlushStoreBuffers() after
// changing the status when necessary.
//
void CurrentProfilerStatus::Set(ProfilerStatus newProfStatus)
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
_ASSERTE(ProfilingAPIUtility::GetStatusCrst() != NULL);
{
// Need to serialize attempts to transition the profiler status. For example, a
// profiler in one thread could request a detach, while the CLR in another
// thread is transitioning the profiler from kProfStatusInitializing* to
// kProfStatusActive
CRITSEC_Holder csh(ProfilingAPIUtility::GetStatusCrst());
// Based on what the old status is, verify the new status is a legal transition.
switch(m_profStatus)
{
default:
_ASSERTE(!"Unknown ProfilerStatus");
break;
case kProfStatusNone:
_ASSERTE((newProfStatus == kProfStatusPreInitialize) ||
(newProfStatus == kProfStatusInitializingForStartupLoad) ||
(newProfStatus == kProfStatusInitializingForAttachLoad));
break;
case kProfStatusDetaching:
_ASSERTE(newProfStatus == kProfStatusNone);
break;
case kProfStatusInitializingForStartupLoad:
case kProfStatusInitializingForAttachLoad:
_ASSERTE((newProfStatus == kProfStatusActive) ||
(newProfStatus == kProfStatusNone));
break;
case kProfStatusActive:
_ASSERTE((newProfStatus == kProfStatusNone) ||
(newProfStatus == kProfStatusDetaching));
break;
case kProfStatusPreInitialize:
_ASSERTE((newProfStatus == kProfStatusNone) ||
(newProfStatus == kProfStatusInitializingForStartupLoad) ||
(newProfStatus == kProfStatusInitializingForAttachLoad));
break;
}
m_profStatus = newProfStatus;
}
#if !defined(DACCESS_COMPILE)
if (((newProfStatus == kProfStatusNone) ||
(newProfStatus == kProfStatusDetaching) ||
(newProfStatus == kProfStatusActive)))
{
// Flush the store buffers on all CPUs, to ensure other threads see that
// g_profControlBlock.curProfStatus has changed. The important status changes to
// flush are:
// * to kProfStatusNone or kProfStatusDetaching so other threads know to stop
// making calls into the profiler
// * to kProfStatusActive, to ensure callbacks can be issued by the time an
// attaching profiler receives ProfilerAttachComplete(), so the profiler
// can safely perform catchup at that time (see
// code:#ProfCatchUpSynchronization).
//
::FlushProcessWriteBuffers();
}
#endif // !defined(DACCESS_COMPILE)
}
//---------------------------------------------------------------------------------------
// ProfilingAPIUtility members
// See code:#LoadUnloadCallbackSynchronization.
CRITSEC_COOKIE ProfilingAPIUtility::s_csStatus = NULL;
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::AppendSupplementaryInformation
//
// Description:
// Helper to the event logging functions to append the process ID and string
// resource ID to the end of the message.
//
// Arguments:
// * iStringResource - [in] String resource ID to append to message.
// * pString - [in/out] On input, the string to log so far. On output, the original
// string with the process ID info appended.
//
// static
void ProfilingAPIUtility::AppendSupplementaryInformation(int iStringResource, SString * pString)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
// This loads resource strings, which takes locks.
CAN_TAKE_LOCK;
}
CONTRACTL_END;
StackSString supplementaryInformation;
if (!supplementaryInformation.LoadResource(
CCompRC::Debugging,
IDS_PROF_SUPPLEMENTARY_INFO
))
{
// Resource not found; should never happen.
return;
}
pString->Append(W(" "));
pString->AppendPrintf(
supplementaryInformation,
GetCurrentProcessId(),
iStringResource);
}
//---------------------------------------------------------------------------------------
//
// Helper function to log publicly-viewable errors about profiler loading and
// initialization.
//
//
// Arguments:
// * iStringResourceID - resource ID of string containing message to log
// * wEventType - same constant used in win32 to specify the type of event:
// usually EVENTLOG_ERROR_TYPE, EVENTLOG_WARNING_TYPE, or
// EVENTLOG_INFORMATION_TYPE
// * insertionArgs - 0 or more values to be inserted into the string to be logged
// (>0 only if iStringResourceID contains format arguments (%)).
//
// static
void ProfilingAPIUtility::LogProfEventVA(
int iStringResourceID,
WORD wEventType,
va_list insertionArgs)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
// This loads resource strings, which takes locks.
CAN_TAKE_LOCK;
}
CONTRACTL_END;
StackSString messageFromResource;
StackSString messageToLog;
if (!messageFromResource.LoadResource(
CCompRC::Debugging,
iStringResourceID
))
{
// Resource not found; should never happen.
return;
}
messageToLog.VPrintf(messageFromResource, insertionArgs);
AppendSupplementaryInformation(iStringResourceID, &messageToLog);
// Write to ETW and EventPipe with the message
FireEtwProfilerMessage(GetClrInstanceId(), messageToLog.GetUnicode());
// Ouput debug strings for diagnostic messages.
WszOutputDebugString(messageToLog);
}
// See code:ProfilingAPIUtility.LogProfEventVA for description of arguments.
// static
void ProfilingAPIUtility::LogProfError(int iStringResourceID, ...)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
// This loads resource strings, which takes locks.
CAN_TAKE_LOCK;
}
CONTRACTL_END;
va_list insertionArgs;
va_start(insertionArgs, iStringResourceID);
LogProfEventVA(
iStringResourceID,
EVENTLOG_ERROR_TYPE,
insertionArgs);
va_end(insertionArgs);
}
// See code:ProfilingAPIUtility.LogProfEventVA for description of arguments.
// static
void ProfilingAPIUtility::LogProfInfo(int iStringResourceID, ...)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
// This loads resource strings, which takes locks.
CAN_TAKE_LOCK;
}
CONTRACTL_END;
va_list insertionArgs;
va_start(insertionArgs, iStringResourceID);
LogProfEventVA(
iStringResourceID,
EVENTLOG_INFORMATION_TYPE,
insertionArgs);
va_end(insertionArgs);
}
#ifdef PROF_TEST_ONLY_FORCE_ELT
// Special forward-declarations of the profiling API's slow-path enter/leave/tailcall
// hooks. These need to be forward-declared here so that they may be referenced in
// InitializeProfiling() below solely for the debug-only, test-only code to allow
// enter/leave/tailcall to be turned on at startup without a profiler. See
// code:ProfControlBlock#TestOnlyELT
EXTERN_C void STDMETHODCALLTYPE ProfileEnterNaked(UINT_PTR clientData);
EXTERN_C void STDMETHODCALLTYPE ProfileLeaveNaked(UINT_PTR clientData);
EXTERN_C void STDMETHODCALLTYPE ProfileTailcallNaked(UINT_PTR clientData);
#endif //PROF_TEST_ONLY_FORCE_ELT
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::InitializeProfiling
//
// This is the top-most level of profiling API initialization, and is called directly by
// EEStartupHelper() (in ceemain.cpp). This initializes internal structures relating to the
// Profiling API. This also orchestrates loading the profiler and initializing it (if
// its GUID is specified in the environment).
//
// Return Value:
// HRESULT indicating success or failure. This is generally very lenient about internal
// failures, as we don't want them to prevent the startup of the app:
// S_OK = Environment didn't request a profiler, or
// Environment did request a profiler, and it was loaded successfully
// S_FALSE = There was a problem loading the profiler, but that shouldn't prevent the app
// from starting up
// else (failure) = There was a serious problem that should be dealt with by the caller
//
// Notes:
// This function (or one of its callees) will log an error to the event log
// if there is a failure
//
// Assumptions:
// InitializeProfiling is called during startup, AFTER the host has initialized its
// settings and the config variables have been read, but BEFORE the finalizer thread
// has entered its first wait state. ASSERTs are placed in
// code:ProfilingAPIAttachDetach::Initialize (which is called by this function, and
// which depends on these assumptions) to verify.
// static
HRESULT ProfilingAPIUtility::InitializeProfiling()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_PREEMPTIVE;
}
CONTRACTL_END;
InitializeLogging();
// NULL out / initialize members of the global profapi structure
g_profControlBlock.Init();
AttemptLoadProfilerForStartup();
AttemptLoadDelayedStartupProfilers();
AttemptLoadProfilerList();
// For now, the return value from AttemptLoadProfilerForStartup is of no use to us.
// Any event has been logged already by AttemptLoadProfilerForStartup, and
// regardless of whether a profiler got loaded, we still need to continue.
#ifdef PROF_TEST_ONLY_FORCE_ELT
// Test-only, debug-only code to enable ELT on startup regardless of whether a
// startup profiler is loaded. See code:ProfControlBlock#TestOnlyELT.
DWORD dwEnableSlowELTHooks = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TestOnlyEnableSlowELTHooks);
if (dwEnableSlowELTHooks != 0)
{
(&g_profControlBlock)->fTestOnlyForceEnterLeave = TRUE;
SetJitHelperFunction(CORINFO_HELP_PROF_FCN_ENTER, (void *) ProfileEnterNaked);
SetJitHelperFunction(CORINFO_HELP_PROF_FCN_LEAVE, (void *) ProfileLeaveNaked);
SetJitHelperFunction(CORINFO_HELP_PROF_FCN_TAILCALL, (void *) ProfileTailcallNaked);
LOG((LF_CORPROF, LL_INFO10, "**PROF: Enabled test-only slow ELT hooks.\n"));
}
#endif //PROF_TEST_ONLY_FORCE_ELT
#ifdef PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED
// Test-only, debug-only code to enable ObjectAllocated callbacks on startup regardless of whether a
// startup profiler is loaded. See code:ProfControlBlock#TestOnlyObjectAllocated.
DWORD dwEnableObjectAllocated = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TestOnlyEnableObjectAllocatedHook);
if (dwEnableObjectAllocated != 0)
{
(&g_profControlBlock)->fTestOnlyForceObjectAllocated = TRUE;
LOG((LF_CORPROF, LL_INFO10, "**PROF: Enabled test-only object ObjectAllocated hooks.\n"));
}
#endif //PROF_TEST_ONLY_FORCE_ELT
#ifdef _DEBUG
// Test-only, debug-only code to allow attaching profilers to call ICorProfilerInfo inteface,
// which would otherwise be disallowed for attaching profilers
DWORD dwTestOnlyEnableICorProfilerInfo = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TestOnlyEnableICorProfilerInfo);
if (dwTestOnlyEnableICorProfilerInfo != 0)
{
(&g_profControlBlock)->fTestOnlyEnableICorProfilerInfo = TRUE;
}
#endif // _DEBUG
return S_OK;
}
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::ProfilerCLSIDFromString
//
// Description:
// Takes a string form of a CLSID (or progid, believe it or not), and returns the
// corresponding CLSID structure.
//
// Arguments:
// * wszClsid - [in / out] CLSID string to convert. This may also be a progid. This
// ensures our behavior is backward-compatible with previous CLR versions. I don't
// know why previous versions allowed the user to set a progid in the environment,
// but well whatever. On [out], this string is normalized in-place (e.g.,
// double-quotes around progid are removed).
// * pClsid - [out] CLSID structure corresponding to wszClsid
//
// Return Value:
// HRESULT indicating success or failure.
//
// Notes:
// * An event is logged if there is a failure.
//
// static
HRESULT ProfilingAPIUtility::ProfilerCLSIDFromString(
__inout_z LPWSTR wszClsid,
CLSID * pClsid)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_PREEMPTIVE;
}
CONTRACTL_END;
_ASSERTE(wszClsid != NULL);
_ASSERTE(pClsid != NULL);
HRESULT hr;
// Translate the string into a CLSID
if (*wszClsid == W('{'))
{
hr = IIDFromString(wszClsid, pClsid);
}
else
{
#ifndef TARGET_UNIX
WCHAR *szFrom, *szTo;
#ifdef _PREFAST_
#pragma warning(push)
#pragma warning(disable:26000) // "espX thinks there is an overflow here, but there isn't any"
#endif
for (szFrom=szTo=wszClsid; *szFrom; )
{
if (*szFrom == W('"'))
{
++szFrom;
continue;
}
*szTo++ = *szFrom++;
}
*szTo = 0;
hr = CLSIDFromProgID(wszClsid, pClsid);
#ifdef _PREFAST_
#pragma warning(pop)
#endif /*_PREFAST_*/
#else // !TARGET_UNIX
// ProgID not supported on TARGET_UNIX
hr = E_INVALIDARG;
#endif // !TARGET_UNIX
}
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_INFO10,
"**PROF: Invalid CLSID or ProgID (%S). hr=0x%x.\n",
wszClsid,
hr));
ProfilingAPIUtility::LogProfError(IDS_E_PROF_BAD_CLSID, wszClsid, hr);
return hr;
}
return S_OK;
}
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::AttemptLoadProfilerForStartup
//
// Description:
// Checks environment or registry to see if the app is configured to run with a
// profiler loaded on startup. If so, this calls LoadProfiler() to load it up.
//
// Arguments:
//
// Return Value:
// * S_OK: Startup-profiler has been loaded
// * S_FALSE: No profiler is configured for startup load
// * else, HRESULT indicating failure that occurred
//
// Assumptions:
// * This should be called on startup, after g_profControlBlock is initialized, but
// before any attach infrastructure is initialized. This ensures we don't receive
// an attach request while startup-loading a profiler.
//
// Notes:
// * This or its callees will ensure an event is logged on failure (though will be
// silent if no profiler is configured for startup load (which causes S_FALSE to
// be returned)
//
// static
HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_PREEMPTIVE;
}
CONTRACTL_END;
HRESULT hr;
// Find out if profiling is enabled
DWORD fProfEnabled = 0;
fProfEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_ENABLE_PROFILING);
NewArrayHolder<WCHAR> wszClsid(NULL);
NewArrayHolder<WCHAR> wszProfilerDLL(NULL);
CLSID *pClsid;
CLSID clsid;
if (fProfEnabled == 0)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling not enabled.\n"));
return S_FALSE;
}
LOG((LF_CORPROF, LL_INFO10, "**PROF: Initializing Profiling Services.\n"));
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER, &wszClsid));
#if defined(TARGET_ARM64)
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_ARM64, &wszProfilerDLL));
#elif defined(TARGET_ARM)
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_ARM32, &wszProfilerDLL));
#endif
if(wszProfilerDLL == NULL)
{
#ifdef TARGET_64BIT
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_64, &wszProfilerDLL));
#else
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_32, &wszProfilerDLL));
#endif
if(wszProfilerDLL == NULL)
{
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH, &wszProfilerDLL));
}
}
// If the environment variable doesn't exist, profiling is not enabled.
if (wszClsid == NULL)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling flag set, but required "
"environment variable does not exist.\n"));
LogProfError(IDS_E_PROF_NO_CLSID);
return S_FALSE;
}
if ((wszProfilerDLL != NULL) && (wcslen(wszProfilerDLL) >= MAX_LONGPATH))
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling flag set, but CORECLR_PROFILER_PATH was not set properly.\n"));
LogProfError(IDS_E_PROF_BAD_PATH);
return S_FALSE;
}
#ifdef TARGET_UNIX
// If the environment variable doesn't exist, profiling is not enabled.
if (wszProfilerDLL == NULL)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling flag set, but required "
"environment variable does not exist.\n"));
LogProfError(IDS_E_PROF_BAD_PATH);
return S_FALSE;
}
#endif // TARGET_UNIX
hr = ProfilingAPIUtility::ProfilerCLSIDFromString(wszClsid, &clsid);
if (FAILED(hr))
{
// ProfilerCLSIDFromString already logged an event if there was a failure
return hr;
}
pClsid = &clsid;
hr = LoadProfiler(
kStartupLoad,
pClsid,
wszClsid,
wszProfilerDLL,
NULL, // No client data for startup load
0); // No client data for startup load
if (FAILED(hr))
{
// A failure in either the CLR or the profiler prevented it from
// loading. Event has been logged. Propagate hr
return hr;
}
return S_OK;
}
//static
HRESULT ProfilingAPIUtility::AttemptLoadDelayedStartupProfilers()
{
if (g_profControlBlock.storedProfilers.IsEmpty())
{
return S_OK;
}
HRESULT storedHr = S_OK;
STOREDPROFILERLIST *profilers = &g_profControlBlock.storedProfilers;
for (StoredProfilerNode* item = profilers->GetHead(); item != NULL; item = STOREDPROFILERLIST::GetNext(item))
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiler loading from GUID/Path stored from the IPC channel."));
CLSID *pClsid = &(item->guid);
// Convert to string for logging
constexpr size_t guidStringSize = 39;
NewArrayHolder<WCHAR> wszClsid(new (nothrow) WCHAR[guidStringSize]);
// GUIDs should always be the same number of characters...
_ASSERTE(wszClsid != NULL);
if (wszClsid != NULL)
{
StringFromGUID2(*pClsid, wszClsid, guidStringSize);
}
HRESULT hr = LoadProfiler(
kStartupLoad,
pClsid,
wszClsid,
item->path.GetUnicode(),
NULL, // No client data for startup load
0); // No client data for startup load
if (FAILED(hr))
{
// LoadProfiler logs if there is an error
storedHr = hr;
}
}
return storedHr;
}
// static
HRESULT ProfilingAPIUtility::AttemptLoadProfilerList()
{
HRESULT hr = S_OK;
DWORD dwEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_ENABLE_NOTIFICATION_PROFILERS);
if (dwEnabled == 0)
{
// Profiler list explicitly disabled, bail
LogProfInfo(IDS_E_PROF_NOTIFICATION_DISABLED);
return S_OK;
}
NewArrayHolder<WCHAR> wszProfilerList(NULL);
#if defined(TARGET_ARM64)
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS_ARM64, &wszProfilerList);
#elif defined(TARGET_ARM)
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS_ARM32, &wszProfilerList);
#endif
if (wszProfilerList == NULL)
{
#ifdef TARGET_64BIT
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS_64, &wszProfilerList);
#else
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS_32, &wszProfilerList);
#endif
if (wszProfilerList == NULL)
{
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS, &wszProfilerList);
if (wszProfilerList == NULL)
{
// No profiler list specified, bail
return S_OK;
}
}
}
WCHAR *pOuter = NULL;
WCHAR *pInner = NULL;
WCHAR *currentSection = NULL;
WCHAR *currentPath = NULL;
WCHAR *currentGuid = NULL;
HRESULT storedHr = S_OK;
// Get each semicolon delimited config
currentSection = wcstok_s(wszProfilerList, W(";"), &pOuter);
while (currentSection != NULL)
{
// Parse this config "path={guid}"
currentPath = wcstok_s(currentSection, W("="), &pInner);
currentGuid = wcstok_s(NULL, W("="), &pInner);
CLSID clsid;
hr = ProfilingAPIUtility::ProfilerCLSIDFromString(currentGuid, &clsid);
if (FAILED(hr))
{
// ProfilerCLSIDFromString already logged an event if there was a failure
storedHr = hr;
goto NextSection;
}
hr = LoadProfiler(
kStartupLoad,
&clsid,
currentGuid,
currentPath,
NULL, // No client data for startup load
0); // No client data for startup load
if (FAILED(hr))
{
// LoadProfiler already logged if there was an error
storedHr = hr;
goto NextSection;
}
NextSection:
// Get next config
currentSection = wcstok_s(NULL, W(";"), &pOuter);
}
return storedHr;
}
//---------------------------------------------------------------------------------------
//
// Performs lazy initialization that need not occur on startup, but does need to occur
// before trying to load a profiler.
//
// Return Value:
// HRESULT indicating success or failure.
//
HRESULT ProfilingAPIUtility::PerformDeferredInit()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
CAN_TAKE_LOCK;
MODE_ANY;
}
CONTRACTL_END;
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
// Initialize internal resources for detaching
HRESULT hr = ProfilingAPIDetach::Initialize();
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_ERROR,
"**PROF: Unable to initialize resources for detaching. hr=0x%x.\n",
hr));
return hr;
}
#endif // FEATURE_PROFAPI_ATTACH_DETACH
if (s_csStatus == NULL)
{
s_csStatus = ClrCreateCriticalSection(
CrstProfilingAPIStatus,
(CrstFlags) (CRST_REENTRANCY | CRST_TAKEN_DURING_SHUTDOWN));
if (s_csStatus == NULL)
{
return E_OUTOFMEMORY;
}
}
return S_OK;
}
// static
HRESULT ProfilingAPIUtility::DoPreInitialization(
EEToProfInterfaceImpl *pEEProf,
const CLSID *pClsid,
LPCWSTR wszClsid,
LPCWSTR wszProfilerDLL,
LoadType loadType,
DWORD dwConcurrentGCWaitTimeoutInMs)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_ANY;
PRECONDITION(pEEProf != NULL);
PRECONDITION(pClsid != NULL);
PRECONDITION(wszClsid != NULL);
}
CONTRACTL_END;
_ASSERTE(s_csStatus != NULL);
ProfilerCompatibilityFlag profilerCompatibilityFlag = kDisableV2Profiler;
NewArrayHolder<WCHAR> wszProfilerCompatibilitySetting(NULL);
if (loadType == kStartupLoad)
{
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_ProfAPI_ProfilerCompatibilitySetting, &wszProfilerCompatibilitySetting);
if (wszProfilerCompatibilitySetting != NULL)
{
if (SString::_wcsicmp(wszProfilerCompatibilitySetting, W("EnableV2Profiler")) == 0)
{
profilerCompatibilityFlag = kEnableV2Profiler;
}
else if (SString::_wcsicmp(wszProfilerCompatibilitySetting, W("PreventLoad")) == 0)
{
profilerCompatibilityFlag = kPreventLoad;
}
}
if (profilerCompatibilityFlag == kPreventLoad)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: COMPlus_ProfAPI_ProfilerCompatibilitySetting is set to PreventLoad. "
"Profiler will not be loaded.\n"));
LogProfInfo(IDS_PROF_PROFILER_DISABLED,
CLRConfig::EXTERNAL_ProfAPI_ProfilerCompatibilitySetting.name,
wszProfilerCompatibilitySetting.GetValue(),
wszClsid);
return S_OK;
}
}
HRESULT hr = S_OK;
NewHolder<ProfToEEInterfaceImpl> pProfEE(new (nothrow) ProfToEEInterfaceImpl());
if (pProfEE == NULL)
{
LOG((LF_CORPROF, LL_ERROR, "**PROF: Unable to allocate ProfToEEInterfaceImpl.\n"));
LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, E_OUTOFMEMORY);
return E_OUTOFMEMORY;
}
// Initialize the interface
hr = pProfEE->Init();
if (FAILED(hr))
{
LOG((LF_CORPROF, LL_ERROR, "**PROF: ProfToEEInterface::Init failed.\n"));
LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, hr);
return hr;
}
// Provide the newly created and inited interface
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling code being provided with EE interface.\n"));
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
// We're about to load the profiler, so first make sure we successfully create the
// DetachThread and abort the load of the profiler if we can't. This ensures we don't
// load a profiler unless we're prepared to detach it later.
hr = ProfilingAPIDetach::CreateDetachThread();
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_ERROR,
"**PROF: Unable to create DetachThread. hr=0x%x.\n",
hr));
ProfilingAPIUtility::LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, hr);
return hr;
}
#endif // FEATURE_PROFAPI_ATTACH_DETACH
// Initialize internal state of our EEToProfInterfaceImpl. This also loads the
// profiler itself, but does not yet call its Initalize() callback
hr = pEEProf->Init(pProfEE, pClsid, wszClsid, wszProfilerDLL, (loadType == kAttachLoad), dwConcurrentGCWaitTimeoutInMs);
if (FAILED(hr))
{
LOG((LF_CORPROF, LL_ERROR, "**PROF: EEToProfInterfaceImpl::Init failed.\n"));
// EEToProfInterfaceImpl::Init logs an event log error on failure
return hr;
}
// EEToProfInterfaceImpl::Init takes over the ownership of pProfEE when Init succeeds, and
// EEToProfInterfaceImpl::~EEToProfInterfaceImpl is responsible for releasing the resource pointed
// by pProfEE. Calling SuppressRelease here is necessary to avoid double release that
// the resource pointed by pProfEE are released by both pProfEE and pEEProf's destructor.
pProfEE.SuppressRelease();
pProfEE = NULL;
if (loadType == kAttachLoad) // V4 profiler from attach
{
// Profiler must support ICorProfilerCallback3 to be attachable
if (!pEEProf->IsCallback3Supported())
{
LogProfError(IDS_E_PROF_NOT_ATTACHABLE, wszClsid);
return CORPROF_E_PROFILER_NOT_ATTACHABLE;
}
}
else if (!pEEProf->IsCallback3Supported()) // V2 profiler from startup
{
if (profilerCompatibilityFlag == kDisableV2Profiler)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: COMPlus_ProfAPI_ProfilerCompatibilitySetting is set to DisableV2Profiler (the default). "
"V2 profilers are not allowed, so that the configured V2 profiler is going to be unloaded.\n"));
LogProfInfo(IDS_PROF_V2PROFILER_DISABLED, wszClsid);
return S_OK;
}
_ASSERTE(profilerCompatibilityFlag == kEnableV2Profiler);
LOG((LF_CORPROF, LL_INFO10, "**PROF: COMPlus_ProfAPI_ProfilerCompatibilitySetting is set to EnableV2Profiler. "
"The configured V2 profiler is going to be initialized.\n"));
LogProfInfo(IDS_PROF_V2PROFILER_ENABLED,
CLRConfig::EXTERNAL_ProfAPI_ProfilerCompatibilitySetting.name,
wszProfilerCompatibilitySetting.GetValue(),
wszClsid);
}
return hr;
}
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::LoadProfiler
//
// Description:
// Outermost common code for loading the profiler DLL. Both startup and attach code
// paths use this.
//
// Arguments:
// * loadType - Startup load or attach load?
// * pClsid - Profiler's CLSID
// * wszClsid - Profiler's CLSID (or progid) in string form, for event log messages
// * wszProfilerDLL - Profiler's DLL path
// * pvClientData - For attach loads, this is the client data the trigger wants to
// pass to the profiler DLL
// * cbClientData - For attach loads, size of client data in bytes
// * dwConcurrentGCWaitTimeoutInMs - Time out for wait operation on concurrent GC. Attach scenario only
//
// Return Value:
// HRESULT indicating success or failure of the load
//
// Notes:
// * On failure, this function or a callee will have logged an event
//
// static
HRESULT ProfilingAPIUtility::LoadProfiler(
LoadType loadType,
const CLSID * pClsid,
LPCWSTR wszClsid,
LPCWSTR wszProfilerDLL,
LPVOID pvClientData,
UINT cbClientData,
DWORD dwConcurrentGCWaitTimeoutInMs)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_ANY;
}
CONTRACTL_END;
if (g_fEEShutDown)
{
return CORPROF_E_RUNTIME_UNINITIALIZED;
}
// Valid loadType?
_ASSERTE((loadType == kStartupLoad) || (loadType == kAttachLoad));
// If a nonzero client data size is reported, there'd better be client data!
_ASSERTE((cbClientData == 0) || (pvClientData != NULL));
// Client data is currently only specified on attach
_ASSERTE((pvClientData == NULL) || (loadType == kAttachLoad));
ProfilerInfo profilerInfo;
profilerInfo.Init();
profilerInfo.inUse = TRUE;
HRESULT hr = PerformDeferredInit();
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_ERROR,
"**PROF: ProfilingAPIUtility::PerformDeferredInit failed. hr=0x%x.\n",
hr));
LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, hr);
return hr;
}
{
// Usually we need to take the lock when modifying profiler status, but at this
// point no one else could have a pointer to this ProfilerInfo so we don't
// need to synchronize. Once we store it in g_profControlBlock we need to.
profilerInfo.curProfStatus.Set(kProfStatusPreInitialize);
}
NewHolder<EEToProfInterfaceImpl> pEEProf(new (nothrow) EEToProfInterfaceImpl());
if (pEEProf == NULL)
{
LOG((LF_CORPROF, LL_ERROR, "**PROF: Unable to allocate EEToProfInterfaceImpl.\n"));
LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, E_OUTOFMEMORY);
return E_OUTOFMEMORY;
}
// Create the ProfToEE interface to provide to the profiling services
hr = DoPreInitialization(pEEProf, pClsid, wszClsid, wszProfilerDLL, loadType, dwConcurrentGCWaitTimeoutInMs);
if (FAILED(hr))
{
return hr;
}
{
// Usually we need to take the lock when modifying profiler status, but at this
// point no one else could have a pointer to this ProfilerInfo so we don't
// need to synchronize. Once we store it in g_profControlBlock we need to.
// We've successfully allocated and initialized the callback wrapper object and the
// Info interface implementation objects. The profiler DLL is therefore also
// successfully loaded (but not yet Initialized). Transfer ownership of the
// callback wrapper object to globals (thus suppress a release when the local
// vars go out of scope).
//
// Setting this state now enables us to call into the profiler's Initialize()
// callback (which we do immediately below), and have it successfully call
// back into us via the Info interface (ProfToEEInterfaceImpl) to perform its
// initialization.
profilerInfo.pProfInterface = pEEProf.GetValue();
pEEProf.SuppressRelease();
pEEProf = NULL;
// Set global status to reflect the proper type of Init we're doing (attach vs
// startup)
profilerInfo.curProfStatus.Set(
(loadType == kStartupLoad) ?
kProfStatusInitializingForStartupLoad :
kProfStatusInitializingForAttachLoad);
}
ProfilerInfo *pProfilerInfo = NULL;
{
// Now we register the profiler, from this point on we need to worry about
// synchronization
CRITSEC_Holder csh(s_csStatus);
// Check if this profiler is notification only and load as appropriate
BOOL notificationOnly = FALSE;
{
HRESULT callHr = profilerInfo.pProfInterface->LoadAsNotificationOnly(¬ificationOnly);
if (FAILED(callHr))
{
notificationOnly = FALSE;
}
}
if (notificationOnly)
{
pProfilerInfo = g_profControlBlock.FindNextFreeProfilerInfoSlot();
if (pProfilerInfo == NULL)
{
LogProfError(IDS_E_PROF_NOTIFICATION_LIMIT_EXCEEDED);
return CORPROF_E_PROFILER_ALREADY_ACTIVE;
}
}
else
{
// "main" profiler, there can only be one
if (g_profControlBlock.mainProfilerInfo.curProfStatus.Get() != kProfStatusNone)
{
LogProfError(IDS_PROF_ALREADY_LOADED);
return CORPROF_E_PROFILER_ALREADY_ACTIVE;
}
// This profiler cannot be a notification only profiler
pProfilerInfo = &(g_profControlBlock.mainProfilerInfo);
}
pProfilerInfo->curProfStatus.Set(profilerInfo.curProfStatus.Get());
pProfilerInfo->pProfInterface = profilerInfo.pProfInterface;
pProfilerInfo->pProfInterface->SetProfilerInfo(pProfilerInfo);
pProfilerInfo->inUse = TRUE;
}
// Now that the profiler is officially loaded and in Init status, call into the
// profiler's appropriate Initialize() callback. Note that if the profiler fails this
// call, we should abort the rest of the profiler loading, and reset our state so we
// appear as if we never attempted to load the profiler.
if (loadType == kStartupLoad)
{
// This EvacuationCounterHolder is just to make asserts in EEToProfInterfaceImpl happy.
// Using it like this without the dirty read/evac counter increment/clean read pattern
// is not safe generally, but in this specific case we can skip all that since we haven't
// published it yet, so we are the only thread that can access it.
EvacuationCounterHolder holder(pProfilerInfo);
hr = pProfilerInfo->pProfInterface->Initialize();
}
else
{
// This EvacuationCounterHolder is just to make asserts in EEToProfInterfaceImpl happy.
// Using it like this without the dirty read/evac counter increment/clean read pattern
// is not safe generally, but in this specific case we can skip all that since we haven't
// published it yet, so we are the only thread that can access it.
EvacuationCounterHolder holder(pProfilerInfo);
_ASSERTE(loadType == kAttachLoad);
_ASSERTE(pProfilerInfo->pProfInterface->IsCallback3Supported());
hr = pProfilerInfo->pProfInterface->InitializeForAttach(pvClientData, cbClientData);
}
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_INFO10,
"**PROF: Profiler failed its Initialize callback. hr=0x%x.\n",
hr));
// If we timed out due to waiting on concurrent GC to finish, it is very likely this is
// the reason InitializeForAttach callback failed even though we cannot be sure and we cannot
// cannot assume hr is going to be CORPROF_E_TIMEOUT_WAITING_FOR_CONCURRENT_GC.
// The best we can do in this case is to report this failure anyway.
if (pProfilerInfo->pProfInterface->HasTimedOutWaitingForConcurrentGC())
{
ProfilingAPIUtility::LogProfError(IDS_E_PROF_TIMEOUT_WAITING_FOR_CONCURRENT_GC, dwConcurrentGCWaitTimeoutInMs, wszClsid);
}
// Check for known failure types, to customize the event we log
if ((loadType == kAttachLoad) &&
((hr == CORPROF_E_PROFILER_NOT_ATTACHABLE) || (hr == E_NOTIMPL)))
{
_ASSERTE(pProfilerInfo->pProfInterface->IsCallback3Supported());
// Profiler supports ICorProfilerCallback3, but explicitly doesn't support
// Attach loading. So log specialized event
LogProfError(IDS_E_PROF_NOT_ATTACHABLE, wszClsid);
// Normalize (CORPROF_E_PROFILER_NOT_ATTACHABLE || E_NOTIMPL) down to
// CORPROF_E_PROFILER_NOT_ATTACHABLE
hr = CORPROF_E_PROFILER_NOT_ATTACHABLE;
}
else if (hr == CORPROF_E_PROFILER_CANCEL_ACTIVATION)
{
// Profiler didn't encounter a bad error, but is voluntarily choosing not to
// profile this runtime. Profilers that need to set system environment
// variables to be able to profile services may use this HRESULT to avoid
// profiling all the other managed apps on the box.
LogProfInfo(IDS_PROF_CANCEL_ACTIVATION, wszClsid);
}
else
{
LogProfError(IDS_E_PROF_INIT_CALLBACK_FAILED, wszClsid, hr);
}
// Profiler failed; reset everything. This will automatically reset
// g_profControlBlock and will unload the profiler's DLL.
TerminateProfiling(pProfilerInfo);
return hr;
}
#ifdef FEATURE_MULTICOREJIT
// Disable multicore JIT when profiling is enabled
if (pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION))
{
MulticoreJitManager::DisableMulticoreJit();
}
#endif
// Indicate that profiling is properly initialized. On an attach-load, this will
// force a FlushStoreBuffers(), which is important for catch-up synchronization (see
// code:#ProfCatchUpSynchronization)
pProfilerInfo->curProfStatus.Set(kProfStatusActive);
LOG((
LF_CORPROF,
LL_INFO10,
"**PROF: Profiler successfully loaded and initialized.\n"));
LogProfInfo(IDS_PROF_LOAD_COMPLETE, wszClsid);
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiler created and enabled.\n"));
if (loadType == kStartupLoad)
{
// For startup profilers only: If the profiler is interested in tracking GC
// events, then we must disable concurrent GC since concurrent GC can allocate
// and kill objects without relocating and thus not doing a heap walk.
if (pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_GC))
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Turning off concurrent GC at startup.\n"));
// Previously we would use SetGCConcurrent(0) to indicate to the GC that it shouldn't even
// attempt to use concurrent GC. The standalone GC feature create a cycle during startup,
// where the profiler couldn't set startup flags for the GC. To overcome this, we call
// TempraryDisableConcurrentGC and never enable it again. This has a perf cost, since the
// GC will create concurrent GC data structures, but it is acceptable in the context of
// this kind of profiling.
GCHeapUtilities::GetGCHeap()->TemporaryDisableConcurrentGC();
LOG((LF_CORPROF, LL_INFO10, "**PROF: Concurrent GC has been turned off at startup.\n"));
}
}
if (loadType == kAttachLoad)
{
// #ProfCatchUpSynchronization
//
// Now that callbacks are enabled (and all threads are aware), tell an attaching
// profiler that it's safe to request catchup information.
//
// There's a race we're preventing that's worthwhile to spell out. An attaching
// profiler should be able to get a COMPLETE set of data through the use of
// callbacks unioned with the use of catch-up enumeration Info functions. To
// achieve this, we must ensure that there is no "hole"--any new data the
// profiler seeks must be available from a callback or a catch-up info function
// (or both, as dupes are ok). That means that:
//
// * callbacks must be enabled on other threads NO LATER THAN the profiler begins
// requesting catch-up information on this thread
// * Abbreviate: callbacks <= catch-up.
//
// Otherwise, if catch-up < callbacks, then it would be possible to have this:
//
// * catch-up < new data arrives < callbacks.
//
// In this nightmare scenario, the new data would not be accessible from the
// catch-up calls made by the profiler (cuz the profiler made the calls too
// early) or the callbacks made into the profiler (cuz the callbacks were enabled
// too late). That's a hole, and that's bad. So we ensure callbacks <= catch-up
// by the following order of operations:
//
// * This thread:
// * a: Set (volatile) currentProfStatus = kProfStatusActive (done above) and
// event mask bits (profiler did this in Initialize() callback above,
// when it called SetEventMask)
// * b: Flush CPU buffers (done automatically when we set status to
// kProfStatusActive)
// * c: CLR->Profiler call: ProfilerAttachComplete() (below). Inside this
// call:
// * Profiler->CLR calls: Catch-up Info functions
// * Other threads:
// * a: New data (thread, JIT info, etc.) is created
// * b: This new data is now available to a catch-up Info call
// * c: currentProfStatus & event mask bits are accurately visible to thread
// in determining whether to make a callback
// * d: Read currentProfStatus & event mask bits and make callback
// (CLR->Profiler) if necessary
//
// So as long as OtherThreads.c <= ThisThread.c we're ok. This means other
// threads must be able to get a clean read of the (volatile) currentProfStatus &
// event mask bits BEFORE this thread calls ProfilerAttachComplete(). Use of the
// "volatile" keyword ensures that compiler optimizations and (w/ VC2005+
// compilers) the CPU's instruction reordering optimizations at runtime are
// disabled enough such that they do not hinder the order above. Use of
// FlushStoreBuffers() ensures that multiple caches on multiple CPUs do not
// hinder the order above (by causing other threads to get stale reads of the
// volatiles).
//
// For more information about catch-up enumerations and exactly which entities,
// and which stage of loading, are permitted to appear in the enumerations, see
// code:ProfilerFunctionEnum::Init#ProfilerEnumGeneral
{
// This EvacuationCounterHolder is just to make asserts in EEToProfInterfaceImpl happy.
// Using it like this without the dirty read/evac counter increment/clean read pattern
// is not safe generally, but in this specific case we can skip all that since we haven't
// published it yet, so we are the only thread that can access it.
EvacuationCounterHolder holder(pProfilerInfo);
pProfilerInfo->pProfInterface->ProfilerAttachComplete();
}
}
return S_OK;
}
//---------------------------------------------------------------------------------------
//
// Performs the evacuation checks by grabbing the thread store lock, iterating through
// all EE Threads, and querying each one's evacuation counter. If they're all 0, the
// profiler is ready to be unloaded.
//
// Return Value:
// Nonzero iff the profiler is fully evacuated and ready to be unloaded.
//
// static
BOOL ProfilingAPIUtility::IsProfilerEvacuated(ProfilerInfo *pProfilerInfo)
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
_ASSERTE(pProfilerInfo->curProfStatus.Get() == kProfStatusDetaching);
// Note that threads are still in motion as we check its evacuation counter.
// This is ok, because we've already changed the profiler status to
// kProfStatusDetaching and flushed CPU buffers. So at this point the counter
// will typically only go down to 0 (and not increment anymore), with one
// small exception (below). So if we get a read of 0 below, the counter will
// typically stay there. Specifically:
// * Profiler is most likely not about to increment its evacuation counter
// from 0 to 1 because pThread sees that the status is
// kProfStatusDetaching.
// * Note that there is a small race where pThread might actually
// increment its evac counter from 0 to 1 (if it dirty-read the
// profiler status a tad too early), but that implies that when
// pThread rechecks the profiler status (clean read) then pThread
// will immediately decrement the evac counter back to 0 and avoid
// calling into the EEToProfInterfaceImpl pointer.
//
// (see
// code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization
// for details)Doing this under the thread store lock not only ensures we can
// iterate through the Thread objects safely, but also forces us to serialize with
// the GC. The latter is important, as server GC enters the profiler on non-EE
// Threads, and so no evacuation counters might be incremented during server GC even
// though control could be entering the profiler.
{
ThreadStoreLockHolder TSLockHolder;
Thread * pThread = ThreadStore::GetAllThreadList(
NULL, // cursor thread; always NULL to begin with
0, // mask to AND with Thread::m_State to filter returned threads
0); // bits to match the result of the above AND. (m_State & 0 == 0,
// so we won't filter out any threads)
// Note that, by not filtering out any of the threads, we're intentionally including
// stuff like TS_Dead or TS_Unstarted. But that keeps us on the safe
// side. If an EE Thread object exists, we want to check its counters to be
// absolutely certain it isn't executing in a profiler.
while (pThread != NULL)
{
// Note that pThread is still in motion as we check its evacuation counter.
// This is ok, because we've already changed the profiler status to
// kProfStatusDetaching and flushed CPU buffers. So at this point the counter
// will typically only go down to 0 (and not increment anymore), with one
// small exception (below). So if we get a read of 0 below, the counter will
// typically stay there. Specifically:
// * pThread is most likely not about to increment its evacuation counter
// from 0 to 1 because pThread sees that the status is
// kProfStatusDetaching.
// * Note that there is a small race where pThread might actually
// increment its evac counter from 0 to 1 (if it dirty-read the
// profiler status a tad too early), but that implies that when
// pThread rechecks the profiler status (clean read) then pThread
// will immediately decrement the evac counter back to 0 and avoid
// calling into the EEToProfInterfaceImpl pointer.
//
// (see
// code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization
// for details)
DWORD dwEvacCounter = pThread->GetProfilerEvacuationCounter(pProfilerInfo->slot);
if (dwEvacCounter != 0)
{
LOG((
LF_CORPROF,
LL_INFO100,
"**PROF: Profiler not yet evacuated because OS Thread ID 0x%x has evac counter of %d (decimal).\n",
pThread->GetOSThreadId(),
dwEvacCounter));
return FALSE;
}
pThread = ThreadStore::GetAllThreadList(pThread, 0, 0);
}
}
// FUTURE: When rejit feature crew complete, add code to verify all rejitted
// functions are fully reverted and off of all stacks. If this is very easy to
// verify (e.g., checking a single value), consider putting it above the loop
// above so we can early-out quicker if rejitted code is still around.
// We got this far without returning, so the profiler is fully evacuated
return TRUE;
}
//---------------------------------------------------------------------------------------
//
// This is the top-most level of profiling API teardown, and is called directly by
// EEShutDownHelper() (in ceemain.cpp). This cleans up internal structures relating to
// the Profiling API. If we're not in process teardown, then this also releases the
// profiler COM object and frees the profiler DLL
//
// static
void ProfilingAPIUtility::TerminateProfiling(ProfilerInfo *pProfilerInfo)
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
if (IsAtProcessExit())
{
// We're tearing down the process so don't bother trying to clean everything up.
// There's no reliable way to verify other threads won't be trying to re-enter
// the profiler anyway, so cleaning up here could cause AVs.
return;
}
_ASSERTE(s_csStatus != NULL);
{
// We're modifying status and possibly unloading the profiler DLL below, so
// serialize this code with any other loading / unloading / detaching code.
CRITSEC_Holder csh(s_csStatus);
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
if (pProfilerInfo->curProfStatus.Get() == kProfStatusDetaching && pProfilerInfo->pProfInterface.Load() != NULL)
{
// The profiler is still being referenced by
// ProfilingAPIDetach::s_profilerDetachInfo, so don't try to release and
// unload it. This can happen if Shutdown and Detach race, and Shutdown wins.
// For example, we could be called as part of Shutdown, but the profiler
// called RequestProfilerDetach near shutdown time as well (or even earlier
// but remains un-evacuated as shutdown begins). Whatever the cause, just
// don't unload the profiler here (as part of shutdown), and let the Detach
// Thread deal with it (if it gets the chance).
//
// Note: Since this check occurs inside s_csStatus, we don't have to worry
// that ProfilingAPIDetach::GetEEToProfPtr() will suddenly change during the
// code below.
//
// FUTURE: For reattach-with-neutered-profilers feature crew, change the
// above to scan through list of detaching profilers to make sure none of
// them give a GetEEToProfPtr() equal to g_profControlBlock.pProfInterface.
return;
}
#endif // FEATURE_PROFAPI_ATTACH_DETACH
if (pProfilerInfo->curProfStatus.Get() == kProfStatusActive)
{
pProfilerInfo->curProfStatus.Set(kProfStatusDetaching);
// Profiler was active when TerminateProfiling() was called, so we're unloading
// it due to shutdown. But other threads may still be trying to enter profiler
// callbacks (e.g., ClassUnloadStarted() can get called during shutdown). Now
// that the status has been changed to kProfStatusDetaching, no new threads will
// attempt to enter the profiler. But use the detach evacuation counters to see
// if other threads already began to enter the profiler.
if (!ProfilingAPIUtility::IsProfilerEvacuated(pProfilerInfo))
{
// Other threads might be entering the profiler, so just skip cleanup
return;
}
}
// If we have a profiler callback wrapper and / or info implementation
// active, then terminate them.
if (pProfilerInfo->pProfInterface.Load() != NULL)
{
// This destructor takes care of releasing the profiler's ICorProfilerCallback*
// interface, and unloading the DLL when we're not in process teardown.
delete pProfilerInfo->pProfInterface;
pProfilerInfo->pProfInterface.Store(NULL);
}
// NOTE: Intentionally not destroying / NULLing s_csStatus. If
// s_csStatus is already initialized, we can reuse it each time we do another
// attach / detach, so no need to destroy it.
// Attach/Load/Detach are all synchronized with the Status Crst, don't need to worry about races
// If we disabled concurrent GC and somehow failed later during the initialization
if (g_profControlBlock.fConcurrentGCDisabledForAttach.Load() && g_profControlBlock.IsMainProfiler(pProfilerInfo->pProfInterface))
{
g_profControlBlock.fConcurrentGCDisabledForAttach = FALSE;
// We know for sure GC has been fully initialized as we've turned off concurrent GC before
_ASSERTE(IsGarbageCollectorFullyInitialized());
GCHeapUtilities::GetGCHeap()->TemporaryEnableConcurrentGC();
}
// #ProfileResetSessionStatus Reset all the status variables that are for the current
// profiling attach session.
// When you are adding new status in g_profControlBlock, you need to think about whether
// your new status is per-session, or consistent across sessions
pProfilerInfo->ResetPerSessionStatus();
pProfilerInfo->curProfStatus.Set(kProfStatusNone);
g_profControlBlock.DeRegisterProfilerInfo(pProfilerInfo);
g_profControlBlock.UpdateGlobalEventMask();
}
}
#endif // PROFILING_SUPPORTED
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// ProfilingHelper.cpp
//
//
// Implementation of helper classes used for miscellaneous purposes within the profiling
// API
//
// ======================================================================================
//
// #LoadUnloadCallbackSynchronization
//
// There is synchronization around loading profilers, unloading profilers, and issuing
// callbacks to profilers, to ensure that we know when it's safe to detach profilers or
// to call into profilers. The synchronization scheme is intentionally lockless on the
// mainline path (issuing callbacks into the profiler), with heavy locking on the
// non-mainline path (loading / unloading profilers).
//
// PROTECTED DATA
//
// The synchronization protects the following data:
//
// * ProfilingAPIDetach::s_profilerDetachInfo
// * (volatile) g_profControlBlock.curProfStatus.m_profStatus
// * (volatile) g_profControlBlock.pProfInterface
// * latter implies the profiler DLL's load status is protected as well, as
// pProfInterface changes between non-NULL and NULL as a profiler DLL is
// loaded and unloaded, respectively.
//
// SYNCHRONIZATION COMPONENTS
//
// * Simple Crst: code:ProfilingAPIUtility::s_csStatus
// * Lockless, volatile per-thread counters: code:EvacuationCounterHolder
// * Profiler status transition invariants and CPU buffer flushing:
// code:CurrentProfilerStatus::Set
//
// WRITERS
//
// The above data is considered to be "written to" when a profiler is loaded or unloaded,
// or the status changes (see code:ProfilerStatus), or a request to detach the profiler
// is received (see code:ProfilingAPIDetach::RequestProfilerDetach), or the DetachThread
// consumes or modifies the contents of code:ProfilingAPIDetach::s_profilerDetachInfo.
// All these cases are serialized with each other by the simple Crst:
// code:ProfilingAPIUtility::s_csStatus
//
// READERS
//
// Readers are the mainline case and are lockless. A "reader" is anyone who wants to
// issue a profiler callback. Readers are scattered throughout the runtime, and have the
// following format:
// {
// BEGIN_PROFILER_CALLBACK(CORProfilerTrackAppDomainLoads());
// g_profControlBlock.pProfInterface->AppDomainCreationStarted(MyAppDomainID);
// END_PROFILER_CALLBACK();
// }
// The BEGIN / END macros do the following:
// * Evaluate the expression argument (e.g., CORProfilerTrackAppDomainLoads()). This is a
// "dirty read" as the profiler could be detached at any moment during or after that
// evaluation.
// * If true, push a code:EvacuationCounterHolder on the stack, which increments the
// per-thread evacuation counter (not interlocked).
// * Re-evaluate the expression argument. This time, it's a "clean read" (see below for
// why).
// * If still true, execute the statements inside the BEGIN/END block. Inside that block,
// the profiler is guaranteed to remain loaded, because the evacuation counter
// remains nonzero (again, see below).
// * Once the BEGIN/END block is exited, the evacuation counter is decremented, and the
// profiler is unpinned and allowed to detach.
//
// READER / WRITER COORDINATION
//
// The above ensures that a reader never touches g_profControlBlock.pProfInterface and
// all it embodies (including the profiler DLL code and callback implementations) unless
// the reader was able to increment its thread's evacuation counter AND re-verify that
// the profiler's status is still active (the status check is included in the macro's
// expression argument, such as CORProfilerTrackAppDomainLoads()).
//
// At the same time, a profiler DLL is never unloaded (nor
// g_profControlBlock.pProfInterface deleted and NULLed out) UNLESS the writer performs
// these actions:
// * (a) Set the profiler's status to a non-active state like kProfStatusDetaching or
// kProfStatusNone
// * (b) Call FlushProcessWriteBuffers()
// * (c) Grab thread store lock, iterate through all threads, and verify each per-thread
// evacuation counter is zero.
//
// The above steps are why it's considered a "clean read" if a reader first increments
// its evacuation counter and then checks the profiler status. Once the writer flushes
// the CPU buffers (b), the reader will see the updated status (from a) and know not to
// use g_profControlBlock.pProfInterface. And if the reader clean-reads the status before
// the buffers were flushed, then the reader will have incremented its evacuation counter
// first, which the writer will be sure to see in (c). For more details about how the
// evacuation counters work, see code:ProfilingAPIUtility::IsProfilerEvacuated.
//
#include "common.h"
#ifdef PROFILING_SUPPORTED
#include "eeprofinterfaces.h"
#include "eetoprofinterfaceimpl.h"
#include "eetoprofinterfaceimpl.inl"
#include "corprof.h"
#include "proftoeeinterfaceimpl.h"
#include "proftoeeinterfaceimpl.inl"
#include "profilinghelper.h"
#include "profilinghelper.inl"
#include "eemessagebox.h"
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
#include "profdetach.h"
#endif // FEATURE_PROFAPI_ATTACH_DETACH
#include "utilcode.h"
#ifndef TARGET_UNIX
#include "securitywrapper.h"
#endif // !TARGET_UNIX
// ----------------------------------------------------------------------------
// CurrentProfilerStatus methods
//---------------------------------------------------------------------------------------
//
// Updates the value indicating the profiler's current status
//
// Arguments:
// profStatus - New value (from enum ProfilerStatus) to set.
//
// Notes:
// Sets the status under a lock, and performs a debug-only check to verify that the
// status transition is a legal one. Also performs a FlushStoreBuffers() after
// changing the status when necessary.
//
void CurrentProfilerStatus::Set(ProfilerStatus newProfStatus)
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
_ASSERTE(ProfilingAPIUtility::GetStatusCrst() != NULL);
{
// Need to serialize attempts to transition the profiler status. For example, a
// profiler in one thread could request a detach, while the CLR in another
// thread is transitioning the profiler from kProfStatusInitializing* to
// kProfStatusActive
CRITSEC_Holder csh(ProfilingAPIUtility::GetStatusCrst());
// Based on what the old status is, verify the new status is a legal transition.
switch(m_profStatus)
{
default:
_ASSERTE(!"Unknown ProfilerStatus");
break;
case kProfStatusNone:
_ASSERTE((newProfStatus == kProfStatusPreInitialize) ||
(newProfStatus == kProfStatusInitializingForStartupLoad) ||
(newProfStatus == kProfStatusInitializingForAttachLoad));
break;
case kProfStatusDetaching:
_ASSERTE(newProfStatus == kProfStatusNone);
break;
case kProfStatusInitializingForStartupLoad:
case kProfStatusInitializingForAttachLoad:
_ASSERTE((newProfStatus == kProfStatusActive) ||
(newProfStatus == kProfStatusNone));
break;
case kProfStatusActive:
_ASSERTE((newProfStatus == kProfStatusNone) ||
(newProfStatus == kProfStatusDetaching));
break;
case kProfStatusPreInitialize:
_ASSERTE((newProfStatus == kProfStatusNone) ||
(newProfStatus == kProfStatusInitializingForStartupLoad) ||
(newProfStatus == kProfStatusInitializingForAttachLoad));
break;
}
m_profStatus = newProfStatus;
}
#if !defined(DACCESS_COMPILE)
if (((newProfStatus == kProfStatusNone) ||
(newProfStatus == kProfStatusDetaching) ||
(newProfStatus == kProfStatusActive)))
{
// Flush the store buffers on all CPUs, to ensure other threads see that
// g_profControlBlock.curProfStatus has changed. The important status changes to
// flush are:
// * to kProfStatusNone or kProfStatusDetaching so other threads know to stop
// making calls into the profiler
// * to kProfStatusActive, to ensure callbacks can be issued by the time an
// attaching profiler receives ProfilerAttachComplete(), so the profiler
// can safely perform catchup at that time (see
// code:#ProfCatchUpSynchronization).
//
::FlushProcessWriteBuffers();
}
#endif // !defined(DACCESS_COMPILE)
}
//---------------------------------------------------------------------------------------
// ProfilingAPIUtility members
// See code:#LoadUnloadCallbackSynchronization.
CRITSEC_COOKIE ProfilingAPIUtility::s_csStatus = NULL;
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::AppendSupplementaryInformation
//
// Description:
// Helper to the event logging functions to append the process ID and string
// resource ID to the end of the message.
//
// Arguments:
// * iStringResource - [in] String resource ID to append to message.
// * pString - [in/out] On input, the string to log so far. On output, the original
// string with the process ID info appended.
//
// static
void ProfilingAPIUtility::AppendSupplementaryInformation(int iStringResource, SString * pString)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
// This loads resource strings, which takes locks.
CAN_TAKE_LOCK;
}
CONTRACTL_END;
StackSString supplementaryInformation;
if (!supplementaryInformation.LoadResource(
CCompRC::Debugging,
IDS_PROF_SUPPLEMENTARY_INFO
))
{
// Resource not found; should never happen.
return;
}
pString->Append(W(" "));
pString->AppendPrintf(
supplementaryInformation,
GetCurrentProcessId(),
iStringResource);
}
//---------------------------------------------------------------------------------------
//
// Helper function to log publicly-viewable errors about profiler loading and
// initialization.
//
//
// Arguments:
// * iStringResourceID - resource ID of string containing message to log
// * wEventType - same constant used in win32 to specify the type of event:
// usually EVENTLOG_ERROR_TYPE, EVENTLOG_WARNING_TYPE, or
// EVENTLOG_INFORMATION_TYPE
// * insertionArgs - 0 or more values to be inserted into the string to be logged
// (>0 only if iStringResourceID contains format arguments (%)).
//
// static
void ProfilingAPIUtility::LogProfEventVA(
int iStringResourceID,
WORD wEventType,
va_list insertionArgs)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
// This loads resource strings, which takes locks.
CAN_TAKE_LOCK;
}
CONTRACTL_END;
StackSString messageFromResource;
StackSString messageToLog;
if (!messageFromResource.LoadResource(
CCompRC::Debugging,
iStringResourceID
))
{
// Resource not found; should never happen.
return;
}
messageToLog.VPrintf(messageFromResource, insertionArgs);
AppendSupplementaryInformation(iStringResourceID, &messageToLog);
// Write to ETW and EventPipe with the message
FireEtwProfilerMessage(GetClrInstanceId(), messageToLog.GetUnicode());
// Ouput debug strings for diagnostic messages.
WszOutputDebugString(messageToLog);
}
// See code:ProfilingAPIUtility.LogProfEventVA for description of arguments.
// static
void ProfilingAPIUtility::LogProfError(int iStringResourceID, ...)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
// This loads resource strings, which takes locks.
CAN_TAKE_LOCK;
}
CONTRACTL_END;
va_list insertionArgs;
va_start(insertionArgs, iStringResourceID);
LogProfEventVA(
iStringResourceID,
EVENTLOG_ERROR_TYPE,
insertionArgs);
va_end(insertionArgs);
}
// See code:ProfilingAPIUtility.LogProfEventVA for description of arguments.
// static
void ProfilingAPIUtility::LogProfInfo(int iStringResourceID, ...)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
// This loads resource strings, which takes locks.
CAN_TAKE_LOCK;
}
CONTRACTL_END;
va_list insertionArgs;
va_start(insertionArgs, iStringResourceID);
LogProfEventVA(
iStringResourceID,
EVENTLOG_INFORMATION_TYPE,
insertionArgs);
va_end(insertionArgs);
}
#ifdef PROF_TEST_ONLY_FORCE_ELT
// Special forward-declarations of the profiling API's slow-path enter/leave/tailcall
// hooks. These need to be forward-declared here so that they may be referenced in
// InitializeProfiling() below solely for the debug-only, test-only code to allow
// enter/leave/tailcall to be turned on at startup without a profiler. See
// code:ProfControlBlock#TestOnlyELT
EXTERN_C void STDMETHODCALLTYPE ProfileEnterNaked(UINT_PTR clientData);
EXTERN_C void STDMETHODCALLTYPE ProfileLeaveNaked(UINT_PTR clientData);
EXTERN_C void STDMETHODCALLTYPE ProfileTailcallNaked(UINT_PTR clientData);
#endif //PROF_TEST_ONLY_FORCE_ELT
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::InitializeProfiling
//
// This is the top-most level of profiling API initialization, and is called directly by
// EEStartupHelper() (in ceemain.cpp). This initializes internal structures relating to the
// Profiling API. This also orchestrates loading the profiler and initializing it (if
// its GUID is specified in the environment).
//
// Return Value:
// HRESULT indicating success or failure. This is generally very lenient about internal
// failures, as we don't want them to prevent the startup of the app:
// S_OK = Environment didn't request a profiler, or
// Environment did request a profiler, and it was loaded successfully
// S_FALSE = There was a problem loading the profiler, but that shouldn't prevent the app
// from starting up
// else (failure) = There was a serious problem that should be dealt with by the caller
//
// Notes:
// This function (or one of its callees) will log an error to the event log
// if there is a failure
//
// Assumptions:
// InitializeProfiling is called during startup, AFTER the host has initialized its
// settings and the config variables have been read, but BEFORE the finalizer thread
// has entered its first wait state. ASSERTs are placed in
// code:ProfilingAPIAttachDetach::Initialize (which is called by this function, and
// which depends on these assumptions) to verify.
// static
HRESULT ProfilingAPIUtility::InitializeProfiling()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_PREEMPTIVE;
}
CONTRACTL_END;
InitializeLogging();
// NULL out / initialize members of the global profapi structure
g_profControlBlock.Init();
AttemptLoadProfilerForStartup();
AttemptLoadDelayedStartupProfilers();
AttemptLoadProfilerList();
// For now, the return value from AttemptLoadProfilerForStartup is of no use to us.
// Any event has been logged already by AttemptLoadProfilerForStartup, and
// regardless of whether a profiler got loaded, we still need to continue.
#ifdef PROF_TEST_ONLY_FORCE_ELT
// Test-only, debug-only code to enable ELT on startup regardless of whether a
// startup profiler is loaded. See code:ProfControlBlock#TestOnlyELT.
DWORD dwEnableSlowELTHooks = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TestOnlyEnableSlowELTHooks);
if (dwEnableSlowELTHooks != 0)
{
(&g_profControlBlock)->fTestOnlyForceEnterLeave = TRUE;
SetJitHelperFunction(CORINFO_HELP_PROF_FCN_ENTER, (void *) ProfileEnterNaked);
SetJitHelperFunction(CORINFO_HELP_PROF_FCN_LEAVE, (void *) ProfileLeaveNaked);
SetJitHelperFunction(CORINFO_HELP_PROF_FCN_TAILCALL, (void *) ProfileTailcallNaked);
LOG((LF_CORPROF, LL_INFO10, "**PROF: Enabled test-only slow ELT hooks.\n"));
}
#endif //PROF_TEST_ONLY_FORCE_ELT
#ifdef PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED
// Test-only, debug-only code to enable ObjectAllocated callbacks on startup regardless of whether a
// startup profiler is loaded. See code:ProfControlBlock#TestOnlyObjectAllocated.
DWORD dwEnableObjectAllocated = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TestOnlyEnableObjectAllocatedHook);
if (dwEnableObjectAllocated != 0)
{
(&g_profControlBlock)->fTestOnlyForceObjectAllocated = TRUE;
LOG((LF_CORPROF, LL_INFO10, "**PROF: Enabled test-only object ObjectAllocated hooks.\n"));
}
#endif //PROF_TEST_ONLY_FORCE_ELT
#ifdef _DEBUG
// Test-only, debug-only code to allow attaching profilers to call ICorProfilerInfo inteface,
// which would otherwise be disallowed for attaching profilers
DWORD dwTestOnlyEnableICorProfilerInfo = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_TestOnlyEnableICorProfilerInfo);
if (dwTestOnlyEnableICorProfilerInfo != 0)
{
(&g_profControlBlock)->fTestOnlyEnableICorProfilerInfo = TRUE;
}
#endif // _DEBUG
return S_OK;
}
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::ProfilerCLSIDFromString
//
// Description:
// Takes a string form of a CLSID (or progid, believe it or not), and returns the
// corresponding CLSID structure.
//
// Arguments:
// * wszClsid - [in / out] CLSID string to convert. This may also be a progid. This
// ensures our behavior is backward-compatible with previous CLR versions. I don't
// know why previous versions allowed the user to set a progid in the environment,
// but well whatever. On [out], this string is normalized in-place (e.g.,
// double-quotes around progid are removed).
// * pClsid - [out] CLSID structure corresponding to wszClsid
//
// Return Value:
// HRESULT indicating success or failure.
//
// Notes:
// * An event is logged if there is a failure.
//
// static
HRESULT ProfilingAPIUtility::ProfilerCLSIDFromString(
__inout_z LPWSTR wszClsid,
CLSID * pClsid)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_PREEMPTIVE;
}
CONTRACTL_END;
_ASSERTE(wszClsid != NULL);
_ASSERTE(pClsid != NULL);
HRESULT hr;
// Translate the string into a CLSID
if (*wszClsid == W('{'))
{
hr = IIDFromString(wszClsid, pClsid);
}
else
{
#ifndef TARGET_UNIX
WCHAR *szFrom, *szTo;
#ifdef _PREFAST_
#pragma warning(push)
#pragma warning(disable:26000) // "espX thinks there is an overflow here, but there isn't any"
#endif
for (szFrom=szTo=wszClsid; *szFrom; )
{
if (*szFrom == W('"'))
{
++szFrom;
continue;
}
*szTo++ = *szFrom++;
}
*szTo = 0;
hr = CLSIDFromProgID(wszClsid, pClsid);
#ifdef _PREFAST_
#pragma warning(pop)
#endif /*_PREFAST_*/
#else // !TARGET_UNIX
// ProgID not supported on TARGET_UNIX
hr = E_INVALIDARG;
#endif // !TARGET_UNIX
}
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_INFO10,
"**PROF: Invalid CLSID or ProgID (%S). hr=0x%x.\n",
wszClsid,
hr));
ProfilingAPIUtility::LogProfError(IDS_E_PROF_BAD_CLSID, wszClsid, hr);
return hr;
}
return S_OK;
}
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::AttemptLoadProfilerForStartup
//
// Description:
// Checks environment or registry to see if the app is configured to run with a
// profiler loaded on startup. If so, this calls LoadProfiler() to load it up.
//
// Arguments:
//
// Return Value:
// * S_OK: Startup-profiler has been loaded
// * S_FALSE: No profiler is configured for startup load
// * else, HRESULT indicating failure that occurred
//
// Assumptions:
// * This should be called on startup, after g_profControlBlock is initialized, but
// before any attach infrastructure is initialized. This ensures we don't receive
// an attach request while startup-loading a profiler.
//
// Notes:
// * This or its callees will ensure an event is logged on failure (though will be
// silent if no profiler is configured for startup load (which causes S_FALSE to
// be returned)
//
// static
HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_PREEMPTIVE;
}
CONTRACTL_END;
HRESULT hr;
// Find out if profiling is enabled
DWORD fProfEnabled = 0;
fProfEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_ENABLE_PROFILING);
NewArrayHolder<WCHAR> wszClsid(NULL);
NewArrayHolder<WCHAR> wszProfilerDLL(NULL);
CLSID *pClsid;
CLSID clsid;
if (fProfEnabled == 0)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling not enabled.\n"));
return S_FALSE;
}
LOG((LF_CORPROF, LL_INFO10, "**PROF: Initializing Profiling Services.\n"));
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER, &wszClsid));
#if defined(TARGET_ARM64)
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_ARM64, &wszProfilerDLL));
#elif defined(TARGET_ARM)
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_ARM32, &wszProfilerDLL));
#endif
if(wszProfilerDLL == NULL)
{
#ifdef TARGET_64BIT
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_64, &wszProfilerDLL));
#else
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_32, &wszProfilerDLL));
#endif
if(wszProfilerDLL == NULL)
{
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH, &wszProfilerDLL));
}
}
// If the environment variable doesn't exist, profiling is not enabled.
if (wszClsid == NULL)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling flag set, but required "
"environment variable does not exist.\n"));
LogProfError(IDS_E_PROF_NO_CLSID);
return S_FALSE;
}
if ((wszProfilerDLL != NULL) && (wcslen(wszProfilerDLL) >= MAX_LONGPATH))
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling flag set, but CORECLR_PROFILER_PATH was not set properly.\n"));
LogProfError(IDS_E_PROF_BAD_PATH);
return S_FALSE;
}
#ifdef TARGET_UNIX
// If the environment variable doesn't exist, profiling is not enabled.
if (wszProfilerDLL == NULL)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling flag set, but required "
"environment variable does not exist.\n"));
LogProfError(IDS_E_PROF_BAD_PATH);
return S_FALSE;
}
#endif // TARGET_UNIX
hr = ProfilingAPIUtility::ProfilerCLSIDFromString(wszClsid, &clsid);
if (FAILED(hr))
{
// ProfilerCLSIDFromString already logged an event if there was a failure
return hr;
}
pClsid = &clsid;
hr = LoadProfiler(
kStartupLoad,
pClsid,
wszClsid,
wszProfilerDLL,
NULL, // No client data for startup load
0); // No client data for startup load
if (FAILED(hr))
{
// A failure in either the CLR or the profiler prevented it from
// loading. Event has been logged. Propagate hr
return hr;
}
return S_OK;
}
//static
HRESULT ProfilingAPIUtility::AttemptLoadDelayedStartupProfilers()
{
if (g_profControlBlock.storedProfilers.IsEmpty())
{
return S_OK;
}
HRESULT storedHr = S_OK;
STOREDPROFILERLIST *profilers = &g_profControlBlock.storedProfilers;
for (StoredProfilerNode* item = profilers->GetHead(); item != NULL; item = STOREDPROFILERLIST::GetNext(item))
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiler loading from GUID/Path stored from the IPC channel."));
CLSID *pClsid = &(item->guid);
// Convert to string for logging
constexpr size_t guidStringSize = 39;
NewArrayHolder<WCHAR> wszClsid(new (nothrow) WCHAR[guidStringSize]);
// GUIDs should always be the same number of characters...
_ASSERTE(wszClsid != NULL);
if (wszClsid != NULL)
{
StringFromGUID2(*pClsid, wszClsid, guidStringSize);
}
HRESULT hr = LoadProfiler(
kStartupLoad,
pClsid,
wszClsid,
item->path.GetUnicode(),
NULL, // No client data for startup load
0); // No client data for startup load
if (FAILED(hr))
{
// LoadProfiler logs if there is an error
storedHr = hr;
}
}
return storedHr;
}
// static
HRESULT ProfilingAPIUtility::AttemptLoadProfilerList()
{
HRESULT hr = S_OK;
DWORD dwEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_ENABLE_NOTIFICATION_PROFILERS);
if (dwEnabled == 0)
{
// Profiler list explicitly disabled, bail
LogProfInfo(IDS_E_PROF_NOTIFICATION_DISABLED);
return S_OK;
}
NewArrayHolder<WCHAR> wszProfilerList(NULL);
#if defined(TARGET_ARM64)
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS_ARM64, &wszProfilerList);
#elif defined(TARGET_ARM)
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS_ARM32, &wszProfilerList);
#endif
if (wszProfilerList == NULL)
{
#ifdef TARGET_64BIT
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS_64, &wszProfilerList);
#else
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS_32, &wszProfilerList);
#endif
if (wszProfilerList == NULL)
{
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_NOTIFICATION_PROFILERS, &wszProfilerList);
if (wszProfilerList == NULL)
{
// No profiler list specified, bail
return S_OK;
}
}
}
WCHAR *pOuter = NULL;
WCHAR *pInner = NULL;
WCHAR *currentSection = NULL;
WCHAR *currentPath = NULL;
WCHAR *currentGuid = NULL;
HRESULT storedHr = S_OK;
// Get each semicolon delimited config
currentSection = wcstok_s(wszProfilerList, W(";"), &pOuter);
while (currentSection != NULL)
{
// Parse this config "path={guid}"
currentPath = wcstok_s(currentSection, W("="), &pInner);
currentGuid = wcstok_s(NULL, W("="), &pInner);
CLSID clsid;
hr = ProfilingAPIUtility::ProfilerCLSIDFromString(currentGuid, &clsid);
if (FAILED(hr))
{
// ProfilerCLSIDFromString already logged an event if there was a failure
storedHr = hr;
goto NextSection;
}
hr = LoadProfiler(
kStartupLoad,
&clsid,
currentGuid,
currentPath,
NULL, // No client data for startup load
0); // No client data for startup load
if (FAILED(hr))
{
// LoadProfiler already logged if there was an error
storedHr = hr;
goto NextSection;
}
NextSection:
// Get next config
currentSection = wcstok_s(NULL, W(";"), &pOuter);
}
return storedHr;
}
//---------------------------------------------------------------------------------------
//
// Performs lazy initialization that need not occur on startup, but does need to occur
// before trying to load a profiler.
//
// Return Value:
// HRESULT indicating success or failure.
//
HRESULT ProfilingAPIUtility::PerformDeferredInit()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
CAN_TAKE_LOCK;
MODE_ANY;
}
CONTRACTL_END;
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
// Initialize internal resources for detaching
HRESULT hr = ProfilingAPIDetach::Initialize();
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_ERROR,
"**PROF: Unable to initialize resources for detaching. hr=0x%x.\n",
hr));
return hr;
}
#endif // FEATURE_PROFAPI_ATTACH_DETACH
if (s_csStatus == NULL)
{
s_csStatus = ClrCreateCriticalSection(
CrstProfilingAPIStatus,
(CrstFlags) (CRST_REENTRANCY | CRST_TAKEN_DURING_SHUTDOWN));
if (s_csStatus == NULL)
{
return E_OUTOFMEMORY;
}
}
return S_OK;
}
// static
HRESULT ProfilingAPIUtility::DoPreInitialization(
EEToProfInterfaceImpl *pEEProf,
const CLSID *pClsid,
LPCWSTR wszClsid,
LPCWSTR wszProfilerDLL,
LoadType loadType,
DWORD dwConcurrentGCWaitTimeoutInMs)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_ANY;
PRECONDITION(pEEProf != NULL);
PRECONDITION(pClsid != NULL);
PRECONDITION(wszClsid != NULL);
}
CONTRACTL_END;
_ASSERTE(s_csStatus != NULL);
ProfilerCompatibilityFlag profilerCompatibilityFlag = kDisableV2Profiler;
NewArrayHolder<WCHAR> wszProfilerCompatibilitySetting(NULL);
if (loadType == kStartupLoad)
{
CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_ProfAPI_ProfilerCompatibilitySetting, &wszProfilerCompatibilitySetting);
if (wszProfilerCompatibilitySetting != NULL)
{
if (SString::_wcsicmp(wszProfilerCompatibilitySetting, W("EnableV2Profiler")) == 0)
{
profilerCompatibilityFlag = kEnableV2Profiler;
}
else if (SString::_wcsicmp(wszProfilerCompatibilitySetting, W("PreventLoad")) == 0)
{
profilerCompatibilityFlag = kPreventLoad;
}
}
if (profilerCompatibilityFlag == kPreventLoad)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: COMPlus_ProfAPI_ProfilerCompatibilitySetting is set to PreventLoad. "
"Profiler will not be loaded.\n"));
LogProfInfo(IDS_PROF_PROFILER_DISABLED,
CLRConfig::EXTERNAL_ProfAPI_ProfilerCompatibilitySetting.name,
wszProfilerCompatibilitySetting.GetValue(),
wszClsid);
return S_OK;
}
}
HRESULT hr = S_OK;
NewHolder<ProfToEEInterfaceImpl> pProfEE(new (nothrow) ProfToEEInterfaceImpl());
if (pProfEE == NULL)
{
LOG((LF_CORPROF, LL_ERROR, "**PROF: Unable to allocate ProfToEEInterfaceImpl.\n"));
LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, E_OUTOFMEMORY);
return E_OUTOFMEMORY;
}
// Initialize the interface
hr = pProfEE->Init();
if (FAILED(hr))
{
LOG((LF_CORPROF, LL_ERROR, "**PROF: ProfToEEInterface::Init failed.\n"));
LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, hr);
return hr;
}
// Provide the newly created and inited interface
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiling code being provided with EE interface.\n"));
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
// We're about to load the profiler, so first make sure we successfully create the
// DetachThread and abort the load of the profiler if we can't. This ensures we don't
// load a profiler unless we're prepared to detach it later.
hr = ProfilingAPIDetach::CreateDetachThread();
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_ERROR,
"**PROF: Unable to create DetachThread. hr=0x%x.\n",
hr));
ProfilingAPIUtility::LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, hr);
return hr;
}
#endif // FEATURE_PROFAPI_ATTACH_DETACH
// Initialize internal state of our EEToProfInterfaceImpl. This also loads the
// profiler itself, but does not yet call its Initalize() callback
hr = pEEProf->Init(pProfEE, pClsid, wszClsid, wszProfilerDLL, (loadType == kAttachLoad), dwConcurrentGCWaitTimeoutInMs);
if (FAILED(hr))
{
LOG((LF_CORPROF, LL_ERROR, "**PROF: EEToProfInterfaceImpl::Init failed.\n"));
// EEToProfInterfaceImpl::Init logs an event log error on failure
return hr;
}
// EEToProfInterfaceImpl::Init takes over the ownership of pProfEE when Init succeeds, and
// EEToProfInterfaceImpl::~EEToProfInterfaceImpl is responsible for releasing the resource pointed
// by pProfEE. Calling SuppressRelease here is necessary to avoid double release that
// the resource pointed by pProfEE are released by both pProfEE and pEEProf's destructor.
pProfEE.SuppressRelease();
pProfEE = NULL;
if (loadType == kAttachLoad) // V4 profiler from attach
{
// Profiler must support ICorProfilerCallback3 to be attachable
if (!pEEProf->IsCallback3Supported())
{
LogProfError(IDS_E_PROF_NOT_ATTACHABLE, wszClsid);
return CORPROF_E_PROFILER_NOT_ATTACHABLE;
}
}
else if (!pEEProf->IsCallback3Supported()) // V2 profiler from startup
{
if (profilerCompatibilityFlag == kDisableV2Profiler)
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: COMPlus_ProfAPI_ProfilerCompatibilitySetting is set to DisableV2Profiler (the default). "
"V2 profilers are not allowed, so that the configured V2 profiler is going to be unloaded.\n"));
LogProfInfo(IDS_PROF_V2PROFILER_DISABLED, wszClsid);
return S_OK;
}
_ASSERTE(profilerCompatibilityFlag == kEnableV2Profiler);
LOG((LF_CORPROF, LL_INFO10, "**PROF: COMPlus_ProfAPI_ProfilerCompatibilitySetting is set to EnableV2Profiler. "
"The configured V2 profiler is going to be initialized.\n"));
LogProfInfo(IDS_PROF_V2PROFILER_ENABLED,
CLRConfig::EXTERNAL_ProfAPI_ProfilerCompatibilitySetting.name,
wszProfilerCompatibilitySetting.GetValue(),
wszClsid);
}
return hr;
}
// ----------------------------------------------------------------------------
// ProfilingAPIUtility::LoadProfiler
//
// Description:
// Outermost common code for loading the profiler DLL. Both startup and attach code
// paths use this.
//
// Arguments:
// * loadType - Startup load or attach load?
// * pClsid - Profiler's CLSID
// * wszClsid - Profiler's CLSID (or progid) in string form, for event log messages
// * wszProfilerDLL - Profiler's DLL path
// * pvClientData - For attach loads, this is the client data the trigger wants to
// pass to the profiler DLL
// * cbClientData - For attach loads, size of client data in bytes
// * dwConcurrentGCWaitTimeoutInMs - Time out for wait operation on concurrent GC. Attach scenario only
//
// Return Value:
// HRESULT indicating success or failure of the load
//
// Notes:
// * On failure, this function or a callee will have logged an event
//
// static
HRESULT ProfilingAPIUtility::LoadProfiler(
LoadType loadType,
const CLSID * pClsid,
LPCWSTR wszClsid,
LPCWSTR wszProfilerDLL,
LPVOID pvClientData,
UINT cbClientData,
DWORD dwConcurrentGCWaitTimeoutInMs)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
// This causes events to be logged, which loads resource strings,
// which takes locks.
CAN_TAKE_LOCK;
MODE_ANY;
}
CONTRACTL_END;
if (g_fEEShutDown)
{
return CORPROF_E_RUNTIME_UNINITIALIZED;
}
// Valid loadType?
_ASSERTE((loadType == kStartupLoad) || (loadType == kAttachLoad));
// If a nonzero client data size is reported, there'd better be client data!
_ASSERTE((cbClientData == 0) || (pvClientData != NULL));
// Client data is currently only specified on attach
_ASSERTE((pvClientData == NULL) || (loadType == kAttachLoad));
ProfilerInfo profilerInfo;
profilerInfo.Init();
profilerInfo.inUse = TRUE;
HRESULT hr = PerformDeferredInit();
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_ERROR,
"**PROF: ProfilingAPIUtility::PerformDeferredInit failed. hr=0x%x.\n",
hr));
LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, hr);
return hr;
}
{
// Usually we need to take the lock when modifying profiler status, but at this
// point no one else could have a pointer to this ProfilerInfo so we don't
// need to synchronize. Once we store it in g_profControlBlock we need to.
profilerInfo.curProfStatus.Set(kProfStatusPreInitialize);
}
NewHolder<EEToProfInterfaceImpl> pEEProf(new (nothrow) EEToProfInterfaceImpl());
if (pEEProf == NULL)
{
LOG((LF_CORPROF, LL_ERROR, "**PROF: Unable to allocate EEToProfInterfaceImpl.\n"));
LogProfError(IDS_E_PROF_INTERNAL_INIT, wszClsid, E_OUTOFMEMORY);
return E_OUTOFMEMORY;
}
// Create the ProfToEE interface to provide to the profiling services
hr = DoPreInitialization(pEEProf, pClsid, wszClsid, wszProfilerDLL, loadType, dwConcurrentGCWaitTimeoutInMs);
if (FAILED(hr))
{
return hr;
}
{
// Usually we need to take the lock when modifying profiler status, but at this
// point no one else could have a pointer to this ProfilerInfo so we don't
// need to synchronize. Once we store it in g_profControlBlock we need to.
// We've successfully allocated and initialized the callback wrapper object and the
// Info interface implementation objects. The profiler DLL is therefore also
// successfully loaded (but not yet Initialized). Transfer ownership of the
// callback wrapper object to globals (thus suppress a release when the local
// vars go out of scope).
//
// Setting this state now enables us to call into the profiler's Initialize()
// callback (which we do immediately below), and have it successfully call
// back into us via the Info interface (ProfToEEInterfaceImpl) to perform its
// initialization.
profilerInfo.pProfInterface = pEEProf.GetValue();
pEEProf.SuppressRelease();
pEEProf = NULL;
// Set global status to reflect the proper type of Init we're doing (attach vs
// startup)
profilerInfo.curProfStatus.Set(
(loadType == kStartupLoad) ?
kProfStatusInitializingForStartupLoad :
kProfStatusInitializingForAttachLoad);
}
ProfilerInfo *pProfilerInfo = NULL;
{
// Now we register the profiler, from this point on we need to worry about
// synchronization
CRITSEC_Holder csh(s_csStatus);
// Check if this profiler is notification only and load as appropriate
BOOL notificationOnly = FALSE;
{
HRESULT callHr = profilerInfo.pProfInterface->LoadAsNotificationOnly(¬ificationOnly);
if (FAILED(callHr))
{
notificationOnly = FALSE;
}
}
if (notificationOnly)
{
pProfilerInfo = g_profControlBlock.FindNextFreeProfilerInfoSlot();
if (pProfilerInfo == NULL)
{
LogProfError(IDS_E_PROF_NOTIFICATION_LIMIT_EXCEEDED);
return CORPROF_E_PROFILER_ALREADY_ACTIVE;
}
}
else
{
// "main" profiler, there can only be one
if (g_profControlBlock.mainProfilerInfo.curProfStatus.Get() != kProfStatusNone)
{
LogProfError(IDS_PROF_ALREADY_LOADED);
return CORPROF_E_PROFILER_ALREADY_ACTIVE;
}
// This profiler cannot be a notification only profiler
pProfilerInfo = &(g_profControlBlock.mainProfilerInfo);
}
pProfilerInfo->curProfStatus.Set(profilerInfo.curProfStatus.Get());
pProfilerInfo->pProfInterface = profilerInfo.pProfInterface;
pProfilerInfo->pProfInterface->SetProfilerInfo(pProfilerInfo);
pProfilerInfo->inUse = TRUE;
}
// Now that the profiler is officially loaded and in Init status, call into the
// profiler's appropriate Initialize() callback. Note that if the profiler fails this
// call, we should abort the rest of the profiler loading, and reset our state so we
// appear as if we never attempted to load the profiler.
if (loadType == kStartupLoad)
{
// This EvacuationCounterHolder is just to make asserts in EEToProfInterfaceImpl happy.
// Using it like this without the dirty read/evac counter increment/clean read pattern
// is not safe generally, but in this specific case we can skip all that since we haven't
// published it yet, so we are the only thread that can access it.
EvacuationCounterHolder holder(pProfilerInfo);
hr = pProfilerInfo->pProfInterface->Initialize();
}
else
{
// This EvacuationCounterHolder is just to make asserts in EEToProfInterfaceImpl happy.
// Using it like this without the dirty read/evac counter increment/clean read pattern
// is not safe generally, but in this specific case we can skip all that since we haven't
// published it yet, so we are the only thread that can access it.
EvacuationCounterHolder holder(pProfilerInfo);
_ASSERTE(loadType == kAttachLoad);
_ASSERTE(pProfilerInfo->pProfInterface->IsCallback3Supported());
hr = pProfilerInfo->pProfInterface->InitializeForAttach(pvClientData, cbClientData);
}
if (FAILED(hr))
{
LOG((
LF_CORPROF,
LL_INFO10,
"**PROF: Profiler failed its Initialize callback. hr=0x%x.\n",
hr));
// If we timed out due to waiting on concurrent GC to finish, it is very likely this is
// the reason InitializeForAttach callback failed even though we cannot be sure and we cannot
// cannot assume hr is going to be CORPROF_E_TIMEOUT_WAITING_FOR_CONCURRENT_GC.
// The best we can do in this case is to report this failure anyway.
if (pProfilerInfo->pProfInterface->HasTimedOutWaitingForConcurrentGC())
{
ProfilingAPIUtility::LogProfError(IDS_E_PROF_TIMEOUT_WAITING_FOR_CONCURRENT_GC, dwConcurrentGCWaitTimeoutInMs, wszClsid);
}
// Check for known failure types, to customize the event we log
if ((loadType == kAttachLoad) &&
((hr == CORPROF_E_PROFILER_NOT_ATTACHABLE) || (hr == E_NOTIMPL)))
{
_ASSERTE(pProfilerInfo->pProfInterface->IsCallback3Supported());
// Profiler supports ICorProfilerCallback3, but explicitly doesn't support
// Attach loading. So log specialized event
LogProfError(IDS_E_PROF_NOT_ATTACHABLE, wszClsid);
// Normalize (CORPROF_E_PROFILER_NOT_ATTACHABLE || E_NOTIMPL) down to
// CORPROF_E_PROFILER_NOT_ATTACHABLE
hr = CORPROF_E_PROFILER_NOT_ATTACHABLE;
}
else if (hr == CORPROF_E_PROFILER_CANCEL_ACTIVATION)
{
// Profiler didn't encounter a bad error, but is voluntarily choosing not to
// profile this runtime. Profilers that need to set system environment
// variables to be able to profile services may use this HRESULT to avoid
// profiling all the other managed apps on the box.
LogProfInfo(IDS_PROF_CANCEL_ACTIVATION, wszClsid);
}
else
{
LogProfError(IDS_E_PROF_INIT_CALLBACK_FAILED, wszClsid, hr);
}
// Profiler failed; reset everything. This will automatically reset
// g_profControlBlock and will unload the profiler's DLL.
TerminateProfiling(pProfilerInfo);
return hr;
}
#ifdef FEATURE_MULTICOREJIT
// Disable multicore JIT when profiling is enabled
if (pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_JIT_COMPILATION))
{
MulticoreJitManager::DisableMulticoreJit();
}
#endif
// Indicate that profiling is properly initialized. On an attach-load, this will
// force a FlushStoreBuffers(), which is important for catch-up synchronization (see
// code:#ProfCatchUpSynchronization)
pProfilerInfo->curProfStatus.Set(kProfStatusActive);
LOG((
LF_CORPROF,
LL_INFO10,
"**PROF: Profiler successfully loaded and initialized.\n"));
LogProfInfo(IDS_PROF_LOAD_COMPLETE, wszClsid);
LOG((LF_CORPROF, LL_INFO10, "**PROF: Profiler created and enabled.\n"));
if (loadType == kStartupLoad)
{
// For startup profilers only: If the profiler is interested in tracking GC
// events, then we must disable concurrent GC since concurrent GC can allocate
// and kill objects without relocating and thus not doing a heap walk.
if (pProfilerInfo->eventMask.IsEventMaskSet(COR_PRF_MONITOR_GC))
{
LOG((LF_CORPROF, LL_INFO10, "**PROF: Turning off concurrent GC at startup.\n"));
// Previously we would use SetGCConcurrent(0) to indicate to the GC that it shouldn't even
// attempt to use concurrent GC. The standalone GC feature create a cycle during startup,
// where the profiler couldn't set startup flags for the GC. To overcome this, we call
// TempraryDisableConcurrentGC and never enable it again. This has a perf cost, since the
// GC will create concurrent GC data structures, but it is acceptable in the context of
// this kind of profiling.
GCHeapUtilities::GetGCHeap()->TemporaryDisableConcurrentGC();
LOG((LF_CORPROF, LL_INFO10, "**PROF: Concurrent GC has been turned off at startup.\n"));
}
}
if (loadType == kAttachLoad)
{
// #ProfCatchUpSynchronization
//
// Now that callbacks are enabled (and all threads are aware), tell an attaching
// profiler that it's safe to request catchup information.
//
// There's a race we're preventing that's worthwhile to spell out. An attaching
// profiler should be able to get a COMPLETE set of data through the use of
// callbacks unioned with the use of catch-up enumeration Info functions. To
// achieve this, we must ensure that there is no "hole"--any new data the
// profiler seeks must be available from a callback or a catch-up info function
// (or both, as dupes are ok). That means that:
//
// * callbacks must be enabled on other threads NO LATER THAN the profiler begins
// requesting catch-up information on this thread
// * Abbreviate: callbacks <= catch-up.
//
// Otherwise, if catch-up < callbacks, then it would be possible to have this:
//
// * catch-up < new data arrives < callbacks.
//
// In this nightmare scenario, the new data would not be accessible from the
// catch-up calls made by the profiler (cuz the profiler made the calls too
// early) or the callbacks made into the profiler (cuz the callbacks were enabled
// too late). That's a hole, and that's bad. So we ensure callbacks <= catch-up
// by the following order of operations:
//
// * This thread:
// * a: Set (volatile) currentProfStatus = kProfStatusActive (done above) and
// event mask bits (profiler did this in Initialize() callback above,
// when it called SetEventMask)
// * b: Flush CPU buffers (done automatically when we set status to
// kProfStatusActive)
// * c: CLR->Profiler call: ProfilerAttachComplete() (below). Inside this
// call:
// * Profiler->CLR calls: Catch-up Info functions
// * Other threads:
// * a: New data (thread, JIT info, etc.) is created
// * b: This new data is now available to a catch-up Info call
// * c: currentProfStatus & event mask bits are accurately visible to thread
// in determining whether to make a callback
// * d: Read currentProfStatus & event mask bits and make callback
// (CLR->Profiler) if necessary
//
// So as long as OtherThreads.c <= ThisThread.c we're ok. This means other
// threads must be able to get a clean read of the (volatile) currentProfStatus &
// event mask bits BEFORE this thread calls ProfilerAttachComplete(). Use of the
// "volatile" keyword ensures that compiler optimizations and (w/ VC2005+
// compilers) the CPU's instruction reordering optimizations at runtime are
// disabled enough such that they do not hinder the order above. Use of
// FlushStoreBuffers() ensures that multiple caches on multiple CPUs do not
// hinder the order above (by causing other threads to get stale reads of the
// volatiles).
//
// For more information about catch-up enumerations and exactly which entities,
// and which stage of loading, are permitted to appear in the enumerations, see
// code:ProfilerFunctionEnum::Init#ProfilerEnumGeneral
{
// This EvacuationCounterHolder is just to make asserts in EEToProfInterfaceImpl happy.
// Using it like this without the dirty read/evac counter increment/clean read pattern
// is not safe generally, but in this specific case we can skip all that since we haven't
// published it yet, so we are the only thread that can access it.
EvacuationCounterHolder holder(pProfilerInfo);
pProfilerInfo->pProfInterface->ProfilerAttachComplete();
}
}
return S_OK;
}
//---------------------------------------------------------------------------------------
//
// Performs the evacuation checks by grabbing the thread store lock, iterating through
// all EE Threads, and querying each one's evacuation counter. If they're all 0, the
// profiler is ready to be unloaded.
//
// Return Value:
// Nonzero iff the profiler is fully evacuated and ready to be unloaded.
//
// static
BOOL ProfilingAPIUtility::IsProfilerEvacuated(ProfilerInfo *pProfilerInfo)
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
_ASSERTE(pProfilerInfo->curProfStatus.Get() == kProfStatusDetaching);
// Note that threads are still in motion as we check its evacuation counter.
// This is ok, because we've already changed the profiler status to
// kProfStatusDetaching and flushed CPU buffers. So at this point the counter
// will typically only go down to 0 (and not increment anymore), with one
// small exception (below). So if we get a read of 0 below, the counter will
// typically stay there. Specifically:
// * Profiler is most likely not about to increment its evacuation counter
// from 0 to 1 because pThread sees that the status is
// kProfStatusDetaching.
// * Note that there is a small race where pThread might actually
// increment its evac counter from 0 to 1 (if it dirty-read the
// profiler status a tad too early), but that implies that when
// pThread rechecks the profiler status (clean read) then pThread
// will immediately decrement the evac counter back to 0 and avoid
// calling into the EEToProfInterfaceImpl pointer.
//
// (see
// code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization
// for details)Doing this under the thread store lock not only ensures we can
// iterate through the Thread objects safely, but also forces us to serialize with
// the GC. The latter is important, as server GC enters the profiler on non-EE
// Threads, and so no evacuation counters might be incremented during server GC even
// though control could be entering the profiler.
{
ThreadStoreLockHolder TSLockHolder;
Thread * pThread = ThreadStore::GetAllThreadList(
NULL, // cursor thread; always NULL to begin with
0, // mask to AND with Thread::m_State to filter returned threads
0); // bits to match the result of the above AND. (m_State & 0 == 0,
// so we won't filter out any threads)
// Note that, by not filtering out any of the threads, we're intentionally including
// stuff like TS_Dead or TS_Unstarted. But that keeps us on the safe
// side. If an EE Thread object exists, we want to check its counters to be
// absolutely certain it isn't executing in a profiler.
while (pThread != NULL)
{
// Note that pThread is still in motion as we check its evacuation counter.
// This is ok, because we've already changed the profiler status to
// kProfStatusDetaching and flushed CPU buffers. So at this point the counter
// will typically only go down to 0 (and not increment anymore), with one
// small exception (below). So if we get a read of 0 below, the counter will
// typically stay there. Specifically:
// * pThread is most likely not about to increment its evacuation counter
// from 0 to 1 because pThread sees that the status is
// kProfStatusDetaching.
// * Note that there is a small race where pThread might actually
// increment its evac counter from 0 to 1 (if it dirty-read the
// profiler status a tad too early), but that implies that when
// pThread rechecks the profiler status (clean read) then pThread
// will immediately decrement the evac counter back to 0 and avoid
// calling into the EEToProfInterfaceImpl pointer.
//
// (see
// code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization
// for details)
DWORD dwEvacCounter = pThread->GetProfilerEvacuationCounter(pProfilerInfo->slot);
if (dwEvacCounter != 0)
{
LOG((
LF_CORPROF,
LL_INFO100,
"**PROF: Profiler not yet evacuated because OS Thread ID 0x%x has evac counter of %d (decimal).\n",
pThread->GetOSThreadId(),
dwEvacCounter));
return FALSE;
}
pThread = ThreadStore::GetAllThreadList(pThread, 0, 0);
}
}
// FUTURE: When rejit feature crew complete, add code to verify all rejitted
// functions are fully reverted and off of all stacks. If this is very easy to
// verify (e.g., checking a single value), consider putting it above the loop
// above so we can early-out quicker if rejitted code is still around.
// We got this far without returning, so the profiler is fully evacuated
return TRUE;
}
//---------------------------------------------------------------------------------------
//
// This is the top-most level of profiling API teardown, and is called directly by
// EEShutDownHelper() (in ceemain.cpp). This cleans up internal structures relating to
// the Profiling API. If we're not in process teardown, then this also releases the
// profiler COM object and frees the profiler DLL
//
// static
void ProfilingAPIUtility::TerminateProfiling(ProfilerInfo *pProfilerInfo)
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
if (IsAtProcessExit())
{
// We're tearing down the process so don't bother trying to clean everything up.
// There's no reliable way to verify other threads won't be trying to re-enter
// the profiler anyway, so cleaning up here could cause AVs.
return;
}
_ASSERTE(s_csStatus != NULL);
{
// We're modifying status and possibly unloading the profiler DLL below, so
// serialize this code with any other loading / unloading / detaching code.
CRITSEC_Holder csh(s_csStatus);
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
if (pProfilerInfo->curProfStatus.Get() == kProfStatusDetaching && pProfilerInfo->pProfInterface.Load() != NULL)
{
// The profiler is still being referenced by
// ProfilingAPIDetach::s_profilerDetachInfo, so don't try to release and
// unload it. This can happen if Shutdown and Detach race, and Shutdown wins.
// For example, we could be called as part of Shutdown, but the profiler
// called RequestProfilerDetach near shutdown time as well (or even earlier
// but remains un-evacuated as shutdown begins). Whatever the cause, just
// don't unload the profiler here (as part of shutdown), and let the Detach
// Thread deal with it (if it gets the chance).
//
// Note: Since this check occurs inside s_csStatus, we don't have to worry
// that ProfilingAPIDetach::GetEEToProfPtr() will suddenly change during the
// code below.
//
// FUTURE: For reattach-with-neutered-profilers feature crew, change the
// above to scan through list of detaching profilers to make sure none of
// them give a GetEEToProfPtr() equal to g_profControlBlock.pProfInterface.
return;
}
#endif // FEATURE_PROFAPI_ATTACH_DETACH
if (pProfilerInfo->curProfStatus.Get() == kProfStatusActive)
{
pProfilerInfo->curProfStatus.Set(kProfStatusDetaching);
// Profiler was active when TerminateProfiling() was called, so we're unloading
// it due to shutdown. But other threads may still be trying to enter profiler
// callbacks (e.g., ClassUnloadStarted() can get called during shutdown). Now
// that the status has been changed to kProfStatusDetaching, no new threads will
// attempt to enter the profiler. But use the detach evacuation counters to see
// if other threads already began to enter the profiler.
if (!ProfilingAPIUtility::IsProfilerEvacuated(pProfilerInfo))
{
// Other threads might be entering the profiler, so just skip cleanup
return;
}
}
// If we have a profiler callback wrapper and / or info implementation
// active, then terminate them.
if (pProfilerInfo->pProfInterface.Load() != NULL)
{
// This destructor takes care of releasing the profiler's ICorProfilerCallback*
// interface, and unloading the DLL when we're not in process teardown.
delete pProfilerInfo->pProfInterface;
pProfilerInfo->pProfInterface.Store(NULL);
}
// NOTE: Intentionally not destroying / NULLing s_csStatus. If
// s_csStatus is already initialized, we can reuse it each time we do another
// attach / detach, so no need to destroy it.
// Attach/Load/Detach are all synchronized with the Status Crst, don't need to worry about races
// If we disabled concurrent GC and somehow failed later during the initialization
if (g_profControlBlock.fConcurrentGCDisabledForAttach.Load() && g_profControlBlock.IsMainProfiler(pProfilerInfo->pProfInterface))
{
g_profControlBlock.fConcurrentGCDisabledForAttach = FALSE;
// We know for sure GC has been fully initialized as we've turned off concurrent GC before
_ASSERTE(IsGarbageCollectorFullyInitialized());
GCHeapUtilities::GetGCHeap()->TemporaryEnableConcurrentGC();
}
// #ProfileResetSessionStatus Reset all the status variables that are for the current
// profiling attach session.
// When you are adding new status in g_profControlBlock, you need to think about whether
// your new status is per-session, or consistent across sessions
pProfilerInfo->ResetPerSessionStatus();
pProfilerInfo->curProfStatus.Set(kProfStatusNone);
g_profControlBlock.DeRegisterProfilerInfo(pProfilerInfo);
g_profControlBlock.UpdateGlobalEventMask();
}
}
#endif // PROFILING_SUPPORTED
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/vm/syncblk.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// SYNCBLK.CPP
//
//
// Definition of a SyncBlock and the SyncBlockCache which manages it
//
#include "common.h"
#include "vars.hpp"
#include "util.hpp"
#include "class.h"
#include "object.h"
#include "threads.h"
#include "excep.h"
#include "threads.h"
#include "syncblk.h"
#include "interoputil.h"
#include "encee.h"
#include "eventtrace.h"
#include "dllimportcallback.h"
#include "comcallablewrapper.h"
#include "eeconfig.h"
#include "corhost.h"
#include "comdelegate.h"
#include "finalizerthread.h"
#ifdef FEATURE_COMINTEROP
#include "runtimecallablewrapper.h"
#endif // FEATURE_COMINTEROP
// Allocate 4K worth. Typically enough
#define MAXSYNCBLOCK (0x1000-sizeof(void*))/sizeof(SyncBlock)
#define SYNC_TABLE_INITIAL_SIZE 250
//#define DUMP_SB
class SyncBlockArray
{
public:
SyncBlockArray *m_Next;
BYTE m_Blocks[MAXSYNCBLOCK * sizeof (SyncBlock)];
};
// For in-place constructor
BYTE g_SyncBlockCacheInstance[sizeof(SyncBlockCache)];
SPTR_IMPL (SyncBlockCache, SyncBlockCache, s_pSyncBlockCache);
#ifndef DACCESS_COMPILE
#ifndef TARGET_UNIX
// static
SLIST_HEADER InteropSyncBlockInfo::s_InteropInfoStandbyList;
#endif // !TARGET_UNIX
InteropSyncBlockInfo::~InteropSyncBlockInfo()
{
CONTRACTL
{
NOTHROW;
DESTRUCTOR_CHECK;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
FreeUMEntryThunk();
}
#ifndef TARGET_UNIX
// Deletes all items in code:s_InteropInfoStandbyList.
void InteropSyncBlockInfo::FlushStandbyList()
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
PSLIST_ENTRY pEntry = InterlockedFlushSList(&InteropSyncBlockInfo::s_InteropInfoStandbyList);
while (pEntry)
{
PSLIST_ENTRY pNextEntry = pEntry->Next;
// make sure to use the global delete since the destructor has already run
::delete (void *)pEntry;
pEntry = pNextEntry;
}
}
#endif // !TARGET_UNIX
void InteropSyncBlockInfo::FreeUMEntryThunk()
{
CONTRACTL
{
NOTHROW;
DESTRUCTOR_CHECK;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END
if (!g_fEEShutDown)
{
void *pUMEntryThunk = GetUMEntryThunk();
if (pUMEntryThunk != NULL)
{
COMDelegate::RemoveEntryFromFPtrHash((UPTR)pUMEntryThunk);
UMEntryThunk::FreeUMEntryThunk((UMEntryThunk *)pUMEntryThunk);
}
}
m_pUMEntryThunk = NULL;
}
#ifdef FEATURE_COMINTEROP
// Returns either NULL or an RCW on which AcquireLock has been called.
RCW* InteropSyncBlockInfo::GetRCWAndIncrementUseCount()
{
LIMITED_METHOD_CONTRACT;
DWORD dwSwitchCount = 0;
while (true)
{
RCW *pRCW = VolatileLoad(&m_pRCW);
if ((size_t)pRCW <= 0x1)
{
// the RCW never existed or has been released
return NULL;
}
if (((size_t)pRCW & 0x1) == 0x0)
{
// it looks like we have a chance, try to acquire the lock
RCW *pLockedRCW = (RCW *)((size_t)pRCW | 0x1);
if (InterlockedCompareExchangeT(&m_pRCW, pLockedRCW, pRCW) == pRCW)
{
// we have the lock on the m_pRCW field, now we can safely "use" the RCW
pRCW->IncrementUseCount();
// release the m_pRCW lock
VolatileStore(&m_pRCW, pRCW);
// and return the RCW
return pRCW;
}
}
// somebody else holds the lock, retry
__SwitchToThread(0, ++dwSwitchCount);
}
}
// Sets the m_pRCW field in a thread-safe manner, pRCW can be NULL.
void InteropSyncBlockInfo::SetRawRCW(RCW* pRCW)
{
LIMITED_METHOD_CONTRACT;
if (pRCW != NULL)
{
// we never set two different RCWs on a single object
_ASSERTE(m_pRCW == NULL);
m_pRCW = pRCW;
}
else
{
DWORD dwSwitchCount = 0;
while (true)
{
RCW *pOldRCW = VolatileLoad(&m_pRCW);
if ((size_t)pOldRCW <= 0x1)
{
// the RCW never existed or has been released
VolatileStore(&m_pRCW, (RCW *)0x1);
return;
}
if (((size_t)pOldRCW & 0x1) == 0x0)
{
// it looks like we have a chance, set the RCW to 0x1
if (InterlockedCompareExchangeT(&m_pRCW, (RCW *)0x1, pOldRCW) == pOldRCW)
{
// we made it
return;
}
}
// somebody else holds the lock, retry
__SwitchToThread(0, ++dwSwitchCount);
}
}
}
#endif // FEATURE_COMINTEROP
#endif // !DACCESS_COMPILE
PTR_SyncTableEntry SyncTableEntry::GetSyncTableEntry()
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
return (PTR_SyncTableEntry)g_pSyncTable;
}
#ifndef DACCESS_COMPILE
SyncTableEntry*& SyncTableEntry::GetSyncTableEntryByRef()
{
LIMITED_METHOD_CONTRACT;
return g_pSyncTable;
}
/* static */
SyncBlockCache*& SyncBlockCache::GetSyncBlockCache()
{
LIMITED_METHOD_CONTRACT;
return s_pSyncBlockCache;
}
//----------------------------------------------------------------------------
//
// ThreadQueue Implementation
//
//----------------------------------------------------------------------------
#endif //!DACCESS_COMPILE
// Given a link in the chain, get the Thread that it represents
/* static */
inline PTR_WaitEventLink ThreadQueue::WaitEventLinkForLink(PTR_SLink pLink)
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
return (PTR_WaitEventLink) (((PTR_BYTE) pLink) - offsetof(WaitEventLink, m_LinkSB));
}
#ifndef DACCESS_COMPILE
// Unlink the head of the Q. We are always in the SyncBlock's critical
// section.
/* static */
inline WaitEventLink *ThreadQueue::DequeueThread(SyncBlock *psb)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
// Be careful, the debugger inspects the queue from out of process and just looks at the memory...
// it must be valid even if the lock is held. Be careful if you change the way the queue is updated.
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
WaitEventLink *ret = NULL;
SLink *pLink = psb->m_Link.m_pNext;
if (pLink)
{
psb->m_Link.m_pNext = pLink->m_pNext;
#ifdef _DEBUG
pLink->m_pNext = (SLink *)POISONC;
#endif
ret = WaitEventLinkForLink(pLink);
_ASSERTE(ret->m_WaitSB == psb);
}
return ret;
}
// Enqueue is the slow one. We have to find the end of the Q since we don't
// want to burn storage for this in the SyncBlock.
/* static */
inline void ThreadQueue::EnqueueThread(WaitEventLink *pWaitEventLink, SyncBlock *psb)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
_ASSERTE (pWaitEventLink->m_LinkSB.m_pNext == NULL);
// Be careful, the debugger inspects the queue from out of process and just looks at the memory...
// it must be valid even if the lock is held. Be careful if you change the way the queue is updated.
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
SLink *pPrior = &psb->m_Link;
while (pPrior->m_pNext)
{
// We shouldn't already be in the waiting list!
_ASSERTE(pPrior->m_pNext != &pWaitEventLink->m_LinkSB);
pPrior = pPrior->m_pNext;
}
pPrior->m_pNext = &pWaitEventLink->m_LinkSB;
}
// Wade through the SyncBlock's list of waiting threads and remove the
// specified thread.
/* static */
BOOL ThreadQueue::RemoveThread (Thread *pThread, SyncBlock *psb)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
BOOL res = FALSE;
// Be careful, the debugger inspects the queue from out of process and just looks at the memory...
// it must be valid even if the lock is held. Be careful if you change the way the queue is updated.
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
SLink *pPrior = &psb->m_Link;
SLink *pLink;
WaitEventLink *pWaitEventLink;
while ((pLink = pPrior->m_pNext) != NULL)
{
pWaitEventLink = WaitEventLinkForLink(pLink);
if (pWaitEventLink->m_Thread == pThread)
{
pPrior->m_pNext = pLink->m_pNext;
#ifdef _DEBUG
pLink->m_pNext = (SLink *)POISONC;
#endif
_ASSERTE(pWaitEventLink->m_WaitSB == psb);
res = TRUE;
break;
}
pPrior = pLink;
}
return res;
}
#endif //!DACCESS_COMPILE
#ifdef DACCESS_COMPILE
// Enumerates the threads in the queue from front to back by calling
// pCallbackFunction on each one
/* static */
void ThreadQueue::EnumerateThreads(SyncBlock *psb, FP_TQ_THREAD_ENUMERATION_CALLBACK pCallbackFunction, void* pUserData)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
SUPPORTS_DAC;
PTR_SLink pLink = psb->m_Link.m_pNext;
PTR_WaitEventLink pWaitEventLink;
while (pLink != NULL)
{
pWaitEventLink = WaitEventLinkForLink(pLink);
pCallbackFunction(pWaitEventLink->m_Thread, pUserData);
pLink = pLink->m_pNext;
}
}
#endif //DACCESS_COMPILE
#ifndef DACCESS_COMPILE
// ***************************************************************************
//
// Ephemeral Bitmap Helper
//
// ***************************************************************************
#define card_size 32
#define card_word_width 32
size_t CardIndex (size_t card)
{
LIMITED_METHOD_CONTRACT;
return card_size * card;
}
size_t CardOf (size_t idx)
{
LIMITED_METHOD_CONTRACT;
return idx / card_size;
}
size_t CardWord (size_t card)
{
LIMITED_METHOD_CONTRACT;
return card / card_word_width;
}
inline
unsigned CardBit (size_t card)
{
LIMITED_METHOD_CONTRACT;
return (unsigned)(card % card_word_width);
}
inline
void SyncBlockCache::SetCard (size_t card)
{
WRAPPER_NO_CONTRACT;
m_EphemeralBitmap [CardWord (card)] =
(m_EphemeralBitmap [CardWord (card)] | (1 << CardBit (card)));
}
inline
void SyncBlockCache::ClearCard (size_t card)
{
WRAPPER_NO_CONTRACT;
m_EphemeralBitmap [CardWord (card)] =
(m_EphemeralBitmap [CardWord (card)] & ~(1 << CardBit (card)));
}
inline
BOOL SyncBlockCache::CardSetP (size_t card)
{
WRAPPER_NO_CONTRACT;
return ( m_EphemeralBitmap [ CardWord (card) ] & (1 << CardBit (card)));
}
inline
void SyncBlockCache::CardTableSetBit (size_t idx)
{
WRAPPER_NO_CONTRACT;
SetCard (CardOf (idx));
}
size_t BitMapSize (size_t cacheSize)
{
LIMITED_METHOD_CONTRACT;
return (cacheSize + card_size * card_word_width - 1)/ (card_size * card_word_width);
}
// ***************************************************************************
//
// SyncBlockCache class implementation
//
// ***************************************************************************
SyncBlockCache::SyncBlockCache()
: m_pCleanupBlockList(NULL),
m_FreeBlockList(NULL),
// NOTE: CRST_UNSAFE_ANYMODE prevents a GC mode switch when entering this crst.
// If you remove this flag, we will switch to preemptive mode when entering
// g_criticalSection, which means all functions that enter it will become
// GC_TRIGGERS. (This includes all uses of LockHolder around SyncBlockCache::GetSyncBlockCache().
// So be sure to update the contracts if you remove this flag.
m_CacheLock(CrstSyncBlockCache, (CrstFlags) (CRST_UNSAFE_ANYMODE | CRST_DEBUGGER_THREAD)),
m_FreeCount(0),
m_ActiveCount(0),
m_SyncBlocks(0),
m_FreeSyncBlock(0),
m_FreeSyncTableIndex(1),
m_FreeSyncTableList(0),
m_SyncTableSize(SYNC_TABLE_INITIAL_SIZE),
m_OldSyncTables(0),
m_bSyncBlockCleanupInProgress(FALSE),
m_EphemeralBitmap(0)
{
CONTRACTL
{
CONSTRUCTOR_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END;
}
// This method is NO longer called.
SyncBlockCache::~SyncBlockCache()
{
CONTRACTL
{
DESTRUCTOR_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// Clear the list the fast way.
m_FreeBlockList = NULL;
//<TODO>@todo we can clear this fast too I guess</TODO>
m_pCleanupBlockList = NULL;
// destruct all arrays
while (m_SyncBlocks)
{
SyncBlockArray *next = m_SyncBlocks->m_Next;
delete m_SyncBlocks;
m_SyncBlocks = next;
}
// Also, now is a good time to clean up all the old tables which we discarded
// when we overflowed them.
SyncTableEntry* arr;
while ((arr = m_OldSyncTables) != 0)
{
m_OldSyncTables = (SyncTableEntry*)arr[0].m_Object.Load();
delete arr;
}
}
// When the GC determines that an object is dead the low bit of the
// m_Object field of SyncTableEntry is set, however it is not
// cleaned up because we cant do the COM interop cleanup at GC time.
// It is put on a cleanup list and at a later time (typically during
// finalization, this list is cleaned up.
//
void SyncBlockCache::CleanupSyncBlocks()
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_MODE_COOPERATIVE;
_ASSERTE(GetThread() == FinalizerThread::GetFinalizerThread());
// Set the flag indicating sync block cleanup is in progress.
// IMPORTANT: This must be set before the sync block cleanup bit is reset on the thread.
m_bSyncBlockCleanupInProgress = TRUE;
struct Param
{
SyncBlockCache *pThis;
SyncBlock* psb;
#ifdef FEATURE_COMINTEROP
RCW* pRCW;
#endif
} param;
param.pThis = this;
param.psb = NULL;
#ifdef FEATURE_COMINTEROP
param.pRCW = NULL;
#endif
EE_TRY_FOR_FINALLY(Param *, pParam, ¶m)
{
// reset the flag
FinalizerThread::GetFinalizerThread()->ResetSyncBlockCleanup();
// walk the cleanup list and cleanup 'em up
while ((pParam->psb = pParam->pThis->GetNextCleanupSyncBlock()) != NULL)
{
#ifdef FEATURE_COMINTEROP
InteropSyncBlockInfo* pInteropInfo = pParam->psb->GetInteropInfoNoCreate();
if (pInteropInfo)
{
pParam->pRCW = pInteropInfo->GetRawRCW();
if (pParam->pRCW)
{
// We should have initialized the cleanup list with the
// first RCW cache we created
_ASSERTE(g_pRCWCleanupList != NULL);
g_pRCWCleanupList->AddWrapper(pParam->pRCW);
pParam->pRCW = NULL;
pInteropInfo->SetRawRCW(NULL);
}
}
#endif // FEATURE_COMINTEROP
// Delete the sync block.
pParam->pThis->DeleteSyncBlock(pParam->psb);
pParam->psb = NULL;
// pulse GC mode to allow GC to perform its work
if (FinalizerThread::GetFinalizerThread()->CatchAtSafePointOpportunistic())
{
FinalizerThread::GetFinalizerThread()->PulseGCMode();
}
}
#ifdef FEATURE_COMINTEROP
// Now clean up the rcw's sorted by context
if (g_pRCWCleanupList != NULL)
g_pRCWCleanupList->CleanupAllWrappers();
#endif // FEATURE_COMINTEROP
}
EE_FINALLY
{
// We are finished cleaning up the sync blocks.
m_bSyncBlockCleanupInProgress = FALSE;
#ifdef FEATURE_COMINTEROP
if (param.pRCW)
param.pRCW->Cleanup();
#endif
if (param.psb)
DeleteSyncBlock(param.psb);
} EE_END_FINALLY;
}
// create the sync block cache
/* static */
void SyncBlockCache::Attach()
{
LIMITED_METHOD_CONTRACT;
}
// create the sync block cache
/* static */
void SyncBlockCache::Start()
{
CONTRACTL
{
THROWS;
GC_NOTRIGGER;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
DWORD* bm = new DWORD [BitMapSize(SYNC_TABLE_INITIAL_SIZE+1)];
memset (bm, 0, BitMapSize (SYNC_TABLE_INITIAL_SIZE+1)*sizeof(DWORD));
SyncTableEntry::GetSyncTableEntryByRef() = new SyncTableEntry[SYNC_TABLE_INITIAL_SIZE+1];
#ifdef _DEBUG
for (int i=0; i<SYNC_TABLE_INITIAL_SIZE+1; i++) {
SyncTableEntry::GetSyncTableEntry()[i].m_SyncBlock = NULL;
}
#endif
SyncTableEntry::GetSyncTableEntry()[0].m_SyncBlock = 0;
SyncBlockCache::GetSyncBlockCache() = new (&g_SyncBlockCacheInstance) SyncBlockCache;
SyncBlockCache::GetSyncBlockCache()->m_EphemeralBitmap = bm;
#ifndef TARGET_UNIX
InitializeSListHead(&InteropSyncBlockInfo::s_InteropInfoStandbyList);
#endif // !TARGET_UNIX
}
// destroy the sync block cache
/* static */
void SyncBlockCache::Stop()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// cache must be destroyed first, since it can traverse the table to find all the
// sync blocks which are live and thus must have their critical sections destroyed.
if (SyncBlockCache::GetSyncBlockCache())
{
delete SyncBlockCache::GetSyncBlockCache();
SyncBlockCache::GetSyncBlockCache() = 0;
}
if (SyncTableEntry::GetSyncTableEntry())
{
delete SyncTableEntry::GetSyncTableEntry();
SyncTableEntry::GetSyncTableEntryByRef() = 0;
}
}
void SyncBlockCache::InsertCleanupSyncBlock(SyncBlock* psb)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// free up the threads that are waiting before we use the link
// for other purposes
if (psb->m_Link.m_pNext != NULL)
{
while (ThreadQueue::DequeueThread(psb) != NULL)
continue;
}
#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS)
if (psb->m_pInteropInfo)
{
// called during GC
// so do only minorcleanup
MinorCleanupSyncBlockComData(psb->m_pInteropInfo);
}
#endif // FEATURE_COMINTEROP || FEATURE_COMWRAPPERS
// This method will be called only by the GC thread
//<TODO>@todo add an assert for the above statement</TODO>
// we don't need to lock here
//EnterCacheLock();
psb->m_Link.m_pNext = m_pCleanupBlockList;
m_pCleanupBlockList = &psb->m_Link;
// we don't need a lock here
//LeaveCacheLock();
}
SyncBlock* SyncBlockCache::GetNextCleanupSyncBlock()
{
LIMITED_METHOD_CONTRACT;
// we don't need a lock here,
// as this is called only on the finalizer thread currently
SyncBlock *psb = NULL;
if (m_pCleanupBlockList)
{
// get the actual sync block pointer
psb = (SyncBlock *) (((BYTE *) m_pCleanupBlockList) - offsetof(SyncBlock, m_Link));
m_pCleanupBlockList = m_pCleanupBlockList->m_pNext;
}
return psb;
}
// returns and removes the next free syncblock from the list
// the cache lock must be entered to call this
SyncBlock *SyncBlockCache::GetNextFreeSyncBlock()
{
CONTRACTL
{
INJECT_FAULT(COMPlusThrowOM());
THROWS;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
#ifdef _DEBUG // Instrumentation for OOM fault injection testing
delete new char;
#endif
SyncBlock *psb;
SLink *plst = m_FreeBlockList;
m_ActiveCount++;
if (plst)
{
m_FreeBlockList = m_FreeBlockList->m_pNext;
// shouldn't be 0
m_FreeCount--;
// get the actual sync block pointer
psb = (SyncBlock *) (((BYTE *) plst) - offsetof(SyncBlock, m_Link));
return psb;
}
else
{
if ((m_SyncBlocks == NULL) || (m_FreeSyncBlock >= MAXSYNCBLOCK))
{
#ifdef DUMP_SB
// LogSpewAlways("Allocating new syncblock array\n");
// DumpSyncBlockCache();
#endif
SyncBlockArray* newsyncblocks = new(SyncBlockArray);
if (!newsyncblocks)
COMPlusThrowOM ();
newsyncblocks->m_Next = m_SyncBlocks;
m_SyncBlocks = newsyncblocks;
m_FreeSyncBlock = 0;
}
return &(((SyncBlock*)m_SyncBlocks->m_Blocks)[m_FreeSyncBlock++]);
}
}
void SyncBlockCache::Grow()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_COOPERATIVE;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
STRESS_LOG0(LF_SYNC, LL_INFO10000, "SyncBlockCache::NewSyncBlockSlot growing SyncBlockCache \n");
NewArrayHolder<SyncTableEntry> newSyncTable (NULL);
NewArrayHolder<DWORD> newBitMap (NULL);
DWORD * oldBitMap;
// Compute the size of the new synctable. Normally, we double it - unless
// doing so would create slots with indices too high to fit within the
// mask. If so, we create a synctable up to the mask limit. If we're
// already at the mask limit, then caller is out of luck.
DWORD newSyncTableSize;
if (m_SyncTableSize <= (MASK_SYNCBLOCKINDEX >> 1))
{
newSyncTableSize = m_SyncTableSize * 2;
}
else
{
newSyncTableSize = MASK_SYNCBLOCKINDEX;
}
if (!(newSyncTableSize > m_SyncTableSize)) // Make sure we actually found room to grow!
{
EX_THROW(EEMessageException, (kOutOfMemoryException, IDS_EE_OUT_OF_SYNCBLOCKS));
}
newSyncTable = new SyncTableEntry[newSyncTableSize];
newBitMap = new DWORD[BitMapSize (newSyncTableSize)];
{
//! From here on, we assume that we will succeed and start doing global side-effects.
//! Any operation that could fail must occur before this point.
CANNOTTHROWCOMPLUSEXCEPTION();
FAULT_FORBID();
newSyncTable.SuppressRelease();
newBitMap.SuppressRelease();
// We chain old table because we can't delete
// them before all the threads are stoppped
// (next GC)
SyncTableEntry::GetSyncTableEntry() [0].m_Object = (Object *)m_OldSyncTables;
m_OldSyncTables = SyncTableEntry::GetSyncTableEntry();
memset (newSyncTable, 0, newSyncTableSize*sizeof (SyncTableEntry));
memset (newBitMap, 0, BitMapSize (newSyncTableSize)*sizeof (DWORD));
CopyMemory (newSyncTable, SyncTableEntry::GetSyncTableEntry(),
m_SyncTableSize*sizeof (SyncTableEntry));
CopyMemory (newBitMap, m_EphemeralBitmap,
BitMapSize (m_SyncTableSize)*sizeof (DWORD));
oldBitMap = m_EphemeralBitmap;
m_EphemeralBitmap = newBitMap;
delete[] oldBitMap;
_ASSERTE((m_SyncTableSize & MASK_SYNCBLOCKINDEX) == m_SyncTableSize);
// note: we do not care if another thread does not see the new size
// however we really do not want it to see the new size without seeing the new array
//@TODO do we still leak here if two threads come here at the same time ?
FastInterlockExchangePointer(&SyncTableEntry::GetSyncTableEntryByRef(), newSyncTable.GetValue());
m_FreeSyncTableIndex++;
m_SyncTableSize = newSyncTableSize;
#ifdef _DEBUG
static int dumpSBOnResize = -1;
if (dumpSBOnResize == -1)
dumpSBOnResize = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SBDumpOnResize);
if (dumpSBOnResize)
{
LogSpewAlways("SyncBlockCache resized\n");
DumpSyncBlockCache();
}
#endif
}
}
DWORD SyncBlockCache::NewSyncBlockSlot(Object *obj)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_COOPERATIVE;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
_ASSERTE(m_CacheLock.OwnedByCurrentThread()); // GetSyncBlock takes the lock, make sure no one else does.
DWORD indexNewEntry;
if (m_FreeSyncTableList)
{
indexNewEntry = (DWORD)(m_FreeSyncTableList >> 1);
_ASSERTE ((size_t)SyncTableEntry::GetSyncTableEntry()[indexNewEntry].m_Object.Load() & 1);
m_FreeSyncTableList = (size_t)SyncTableEntry::GetSyncTableEntry()[indexNewEntry].m_Object.Load() & ~1;
}
else if ((indexNewEntry = (DWORD)(m_FreeSyncTableIndex)) >= m_SyncTableSize)
{
// This is kept out of line to keep stuff like the C++ EH prolog (needed for holders) off
// of the common path.
Grow();
}
else
{
#ifdef _DEBUG
static int dumpSBOnNewIndex = -1;
if (dumpSBOnNewIndex == -1)
dumpSBOnNewIndex = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SBDumpOnNewIndex);
if (dumpSBOnNewIndex)
{
LogSpewAlways("SyncBlockCache index incremented\n");
DumpSyncBlockCache();
}
#endif
m_FreeSyncTableIndex ++;
}
CardTableSetBit (indexNewEntry);
// In debug builds the m_SyncBlock at indexNewEntry should already be null, since we should
// start out with a null table and always null it out on delete.
_ASSERTE(SyncTableEntry::GetSyncTableEntry() [indexNewEntry].m_SyncBlock == NULL);
SyncTableEntry::GetSyncTableEntry() [indexNewEntry].m_SyncBlock = NULL;
SyncTableEntry::GetSyncTableEntry() [indexNewEntry].m_Object = obj;
_ASSERTE(indexNewEntry != 0);
return indexNewEntry;
}
// free a used sync block, only called from CleanupSyncBlocks.
void SyncBlockCache::DeleteSyncBlock(SyncBlock *psb)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END;
// clean up comdata
if (psb->m_pInteropInfo)
{
#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS)
CleanupSyncBlockComData(psb->m_pInteropInfo);
#endif // FEATURE_COMINTEROP || FEATURE_COMWRAPPERS
#ifndef TARGET_UNIX
if (g_fEEShutDown)
{
delete psb->m_pInteropInfo;
}
else
{
psb->m_pInteropInfo->~InteropSyncBlockInfo();
InterlockedPushEntrySList(&InteropSyncBlockInfo::s_InteropInfoStandbyList, (PSLIST_ENTRY)psb->m_pInteropInfo);
}
#else // !TARGET_UNIX
delete psb->m_pInteropInfo;
#endif // !TARGET_UNIX
}
#ifdef EnC_SUPPORTED
// clean up EnC info
if (psb->m_pEnCInfo)
psb->m_pEnCInfo->Cleanup();
#endif // EnC_SUPPORTED
// Destruct the SyncBlock, but don't reclaim its memory. (Overridden
// operator delete).
delete psb;
//synchronizer with the consumers,
// <TODO>@todo we don't really need a lock here, we can come up
// with some simple algo to avoid taking a lock </TODO>
{
SyncBlockCache::LockHolder lh(this);
DeleteSyncBlockMemory(psb);
}
}
// returns the sync block memory to the free pool but does not destruct sync block (must own cache lock already)
void SyncBlockCache::DeleteSyncBlockMemory(SyncBlock *psb)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
FORBID_FAULT;
}
CONTRACTL_END
m_ActiveCount--;
m_FreeCount++;
psb->m_Link.m_pNext = m_FreeBlockList;
m_FreeBlockList = &psb->m_Link;
}
// free a used sync block
void SyncBlockCache::GCDeleteSyncBlock(SyncBlock *psb)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// Destruct the SyncBlock, but don't reclaim its memory. (Overridden
// operator delete).
delete psb;
m_ActiveCount--;
m_FreeCount++;
psb->m_Link.m_pNext = m_FreeBlockList;
m_FreeBlockList = &psb->m_Link;
}
void SyncBlockCache::GCWeakPtrScan(HANDLESCANPROC scanProc, uintptr_t lp1, uintptr_t lp2)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// First delete the obsolete arrays since we have exclusive access
BOOL fSetSyncBlockCleanup = FALSE;
SyncTableEntry* arr;
while ((arr = m_OldSyncTables) != NULL)
{
m_OldSyncTables = (SyncTableEntry*)arr[0].m_Object.Load();
delete[] arr;
}
#ifdef DUMP_SB
LogSpewAlways("GCWeakPtrScan starting\n");
#endif
#ifdef VERIFY_HEAP
if (g_pConfig->GetHeapVerifyLevel()& EEConfig::HEAPVERIFY_SYNCBLK)
STRESS_LOG0 (LF_GC | LF_SYNC, LL_INFO100, "GCWeakPtrScan starting\n");
#endif
if (GCHeapUtilities::GetGCHeap()->GetCondemnedGeneration() < GCHeapUtilities::GetGCHeap()->GetMaxGeneration())
{
#ifdef VERIFY_HEAP
//for VSW 294550: we saw stale obeject reference in SyncBlkCache, so we want to make sure the card
//table logic above works correctly so that every ephemeral entry is promoted.
//For verification, we make a copy of the sync table in relocation phase and promote it use the
//slow approach and compare the result with the original one
DWORD freeSyncTalbeIndexCopy = m_FreeSyncTableIndex;
SyncTableEntry * syncTableShadow = NULL;
if ((g_pConfig->GetHeapVerifyLevel()& EEConfig::HEAPVERIFY_SYNCBLK) && !((ScanContext*)lp1)->promotion)
{
syncTableShadow = new(nothrow) SyncTableEntry [m_FreeSyncTableIndex];
if (syncTableShadow)
{
memcpy (syncTableShadow, SyncTableEntry::GetSyncTableEntry(), m_FreeSyncTableIndex * sizeof (SyncTableEntry));
}
}
#endif //VERIFY_HEAP
//scan the bitmap
size_t dw = 0;
while (1)
{
while (dw < BitMapSize (m_SyncTableSize) && (m_EphemeralBitmap[dw]==0))
{
dw++;
}
if (dw < BitMapSize (m_SyncTableSize))
{
//found one
for (int i = 0; i < card_word_width; i++)
{
size_t card = i+dw*card_word_width;
if (CardSetP (card))
{
BOOL clear_card = TRUE;
for (int idx = 0; idx < card_size; idx++)
{
size_t nb = CardIndex (card) + idx;
if (( nb < m_FreeSyncTableIndex) && (nb > 0))
{
Object* o = SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
if (o && !((size_t)o & 1))
{
if (GCHeapUtilities::GetGCHeap()->IsEphemeral (o))
{
clear_card = FALSE;
GCWeakPtrScanElement ((int)nb, scanProc,
lp1, lp2, fSetSyncBlockCleanup);
}
}
}
}
if (clear_card)
ClearCard (card);
}
}
dw++;
}
else
break;
}
#ifdef VERIFY_HEAP
//for VSW 294550: we saw stale obeject reference in SyncBlkCache, so we want to make sure the card
//table logic above works correctly so that every ephemeral entry is promoted. To verify, we make a
//copy of the sync table and promote it use the slow approach and compare the result with the real one
if (g_pConfig->GetHeapVerifyLevel()& EEConfig::HEAPVERIFY_SYNCBLK)
{
if (syncTableShadow)
{
for (DWORD nb = 1; nb < m_FreeSyncTableIndex; nb++)
{
Object **keyv = (Object **) &syncTableShadow[nb].m_Object;
if (((size_t) *keyv & 1) == 0)
{
(*scanProc) (keyv, NULL, lp1, lp2);
SyncBlock *pSB = syncTableShadow[nb].m_SyncBlock;
if (*keyv != 0 && (!pSB || !pSB->IsIDisposable()))
{
if (syncTableShadow[nb].m_Object != SyncTableEntry::GetSyncTableEntry()[nb].m_Object)
DebugBreak ();
}
}
}
delete []syncTableShadow;
syncTableShadow = NULL;
}
if (freeSyncTalbeIndexCopy != m_FreeSyncTableIndex)
DebugBreak ();
}
#endif //VERIFY_HEAP
}
else
{
for (DWORD nb = 1; nb < m_FreeSyncTableIndex; nb++)
{
GCWeakPtrScanElement (nb, scanProc, lp1, lp2, fSetSyncBlockCleanup);
}
}
if (fSetSyncBlockCleanup)
{
// mark the finalizer thread saying requires cleanup
FinalizerThread::GetFinalizerThread()->SetSyncBlockCleanup();
FinalizerThread::EnableFinalization();
}
#if defined(VERIFY_HEAP)
if (g_pConfig->GetHeapVerifyLevel() & EEConfig::HEAPVERIFY_GC)
{
if (((ScanContext*)lp1)->promotion)
{
for (int nb = 1; nb < (int)m_FreeSyncTableIndex; nb++)
{
Object* o = SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
if (o && ((size_t)o & 1) == 0)
{
o->Validate();
}
}
}
}
#endif // VERIFY_HEAP
}
/* Scan the weak pointers in the SyncBlockEntry and report them to the GC. If the
reference is dead, then return TRUE */
BOOL SyncBlockCache::GCWeakPtrScanElement (int nb, HANDLESCANPROC scanProc, LPARAM lp1, LPARAM lp2,
BOOL& cleanup)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
Object **keyv = (Object **) &SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
#ifdef DUMP_SB
struct Param
{
Object **keyv;
char *name;
} param;
param.keyv = keyv;
PAL_TRY(Param *, pParam, ¶m) {
if (! *pParam->keyv)
pParam->name = "null";
else if ((size_t) *pParam->keyv & 1)
pParam->name = "free";
else {
pParam->name = (*pParam->keyv)->GetClass()->GetDebugClassName();
if (strlen(pParam->name) == 0)
pParam->name = "<INVALID>";
}
} PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
param.name = "<INVALID>";
}
PAL_ENDTRY
LogSpewAlways("[%4.4d]: %8.8x, %s\n", nb, *keyv, param.name);
#endif
if (((size_t) *keyv & 1) == 0)
{
#ifdef VERIFY_HEAP
if (g_pConfig->GetHeapVerifyLevel () & EEConfig::HEAPVERIFY_SYNCBLK)
{
STRESS_LOG3 (LF_GC | LF_SYNC, LL_INFO100000, "scanning syncblk[%d, %p, %p]\n", nb, (size_t)SyncTableEntry::GetSyncTableEntry()[nb].m_SyncBlock, (size_t)*keyv);
}
#endif
(*scanProc) (keyv, NULL, lp1, lp2);
SyncBlock *pSB = SyncTableEntry::GetSyncTableEntry()[nb].m_SyncBlock;
if ((*keyv == 0 ) || (pSB && pSB->IsIDisposable()))
{
#ifdef VERIFY_HEAP
if (g_pConfig->GetHeapVerifyLevel () & EEConfig::HEAPVERIFY_SYNCBLK)
{
STRESS_LOG3 (LF_GC | LF_SYNC, LL_INFO100000, "freeing syncblk[%d, %p, %p]\n", nb, (size_t)pSB, (size_t)*keyv);
}
#endif
if (*keyv)
{
_ASSERTE (pSB);
GCDeleteSyncBlock(pSB);
//clean the object syncblock header
((Object*)(*keyv))->GetHeader()->GCResetIndex();
}
else if (pSB)
{
cleanup = TRUE;
// insert block into cleanup list
InsertCleanupSyncBlock (SyncTableEntry::GetSyncTableEntry()[nb].m_SyncBlock);
#ifdef DUMP_SB
LogSpewAlways(" Cleaning up block at %4.4d\n", nb);
#endif
}
// delete the entry
#ifdef DUMP_SB
LogSpewAlways(" Deleting block at %4.4d\n", nb);
#endif
SyncTableEntry::GetSyncTableEntry()[nb].m_Object = (Object *)(m_FreeSyncTableList | 1);
m_FreeSyncTableList = nb << 1;
SyncTableEntry::GetSyncTableEntry()[nb].m_SyncBlock = NULL;
return TRUE;
}
else
{
#ifdef DUMP_SB
LogSpewAlways(" Keeping block at %4.4d with oref %8.8x\n", nb, *keyv);
#endif
}
}
return FALSE;
}
void SyncBlockCache::GCDone(BOOL demoting, int max_gen)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
if (demoting &&
(GCHeapUtilities::GetGCHeap()->GetCondemnedGeneration() ==
GCHeapUtilities::GetGCHeap()->GetMaxGeneration()))
{
//scan the bitmap
size_t dw = 0;
while (1)
{
while (dw < BitMapSize (m_SyncTableSize) &&
(m_EphemeralBitmap[dw]==(DWORD)~0))
{
dw++;
}
if (dw < BitMapSize (m_SyncTableSize))
{
//found one
for (int i = 0; i < card_word_width; i++)
{
size_t card = i+dw*card_word_width;
if (!CardSetP (card))
{
for (int idx = 0; idx < card_size; idx++)
{
size_t nb = CardIndex (card) + idx;
if (( nb < m_FreeSyncTableIndex) && (nb > 0))
{
Object* o = SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
if (o && !((size_t)o & 1))
{
if (GCHeapUtilities::GetGCHeap()->WhichGeneration (o) < (unsigned int)max_gen)
{
SetCard (card);
break;
}
}
}
}
}
}
dw++;
}
else
break;
}
}
}
#if defined (VERIFY_HEAP)
#ifndef _DEBUG
#ifdef _ASSERTE
#undef _ASSERTE
#endif
#define _ASSERTE(c) if (!(c)) DebugBreak()
#endif
void SyncBlockCache::VerifySyncTableEntry()
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
for (DWORD nb = 1; nb < m_FreeSyncTableIndex; nb++)
{
Object* o = SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
// if the slot was just allocated, the object may still be null
if (o && (((size_t)o & 1) == 0))
{
//there is no need to verify next object's header because this is called
//from verify_heap, which will verify every object anyway
o->Validate(TRUE, FALSE);
//
// This loop is just a heuristic to try to catch errors, but it is not 100%.
// To prevent false positives, we weaken our assert below to exclude the case
// where the index is still NULL, but we've reached the end of our loop.
//
static const DWORD max_iterations = 100;
DWORD loop = 0;
for (; loop < max_iterations; loop++)
{
// The syncblock index may be updating by another thread.
if (o->GetHeader()->GetHeaderSyncBlockIndex() != 0)
{
break;
}
__SwitchToThread(0, CALLER_LIMITS_SPINNING);
}
DWORD idx = o->GetHeader()->GetHeaderSyncBlockIndex();
_ASSERTE(idx == nb || ((0 == idx) && (loop == max_iterations)));
_ASSERTE(!GCHeapUtilities::GetGCHeap()->IsEphemeral(o) || CardSetP(CardOf(nb)));
}
}
}
#ifndef _DEBUG
#undef _ASSERTE
#define _ASSERTE(expr) ((void)0)
#endif // _DEBUG
#endif // VERIFY_HEAP
#ifdef _DEBUG
void DumpSyncBlockCache()
{
STATIC_CONTRACT_NOTHROW;
SyncBlockCache *pCache = SyncBlockCache::GetSyncBlockCache();
LogSpewAlways("Dumping SyncBlockCache size %d\n", pCache->m_FreeSyncTableIndex);
static int dumpSBStyle = -1;
if (dumpSBStyle == -1)
dumpSBStyle = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SBDumpStyle);
if (dumpSBStyle == 0)
return;
BOOL isString = FALSE;
DWORD objectCount = 0;
DWORD slotCount = 0;
for (DWORD nb = 1; nb < pCache->m_FreeSyncTableIndex; nb++)
{
isString = FALSE;
char buffer[1024], buffer2[1024];
LPCUTF8 descrip = "null";
SyncTableEntry *pEntry = &SyncTableEntry::GetSyncTableEntry()[nb];
Object *oref = (Object *) pEntry->m_Object;
if (((size_t) oref & 1) != 0)
{
descrip = "free";
oref = 0;
}
else
{
++slotCount;
if (oref)
{
++objectCount;
struct Param
{
LPCUTF8 descrip;
Object *oref;
char *buffer2;
UINT cch2;
BOOL isString;
} param;
param.descrip = descrip;
param.oref = oref;
param.buffer2 = buffer2;
param.cch2 = ARRAY_SIZE(buffer2);
param.isString = isString;
PAL_TRY(Param *, pParam, ¶m)
{
pParam->descrip = pParam->oref->GetMethodTable()->GetDebugClassName();
if (strlen(pParam->descrip) == 0)
pParam->descrip = "<INVALID>";
else if (pParam->oref->GetMethodTable() == g_pStringClass)
{
sprintf_s(pParam->buffer2, pParam->cch2, "%s (%S)", pParam->descrip, ObjectToSTRINGREF((StringObject*)pParam->oref)->GetBuffer());
pParam->descrip = pParam->buffer2;
pParam->isString = TRUE;
}
}
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
param.descrip = "<INVALID>";
}
PAL_ENDTRY
descrip = param.descrip;
isString = param.isString;
}
sprintf_s(buffer, ARRAY_SIZE(buffer), "%s", descrip);
descrip = buffer;
}
if (dumpSBStyle < 2)
LogSpewAlways("[%4.4d]: %8.8x %s\n", nb, oref, descrip);
else if (dumpSBStyle == 2 && ! isString)
LogSpewAlways("[%4.4d]: %s\n", nb, descrip);
}
LogSpewAlways("Done dumping SyncBlockCache used slots: %d, objects: %d\n", slotCount, objectCount);
}
#endif
// ***************************************************************************
//
// ObjHeader class implementation
//
// ***************************************************************************
#if defined(ENABLE_CONTRACTS_IMPL)
// The LOCK_TAKEN/RELEASED macros need a "pointer" to the lock object to do
// comparisons between takes & releases (and to provide debugging info to the
// developer). Ask the syncblock for its lock contract pointer, if the
// syncblock exists. Otherwise, use the MethodTable* from the Object. That's not great,
// as it's not unique, so we might miss unbalanced lock takes/releases from
// different objects of the same type. However, our hands are tied, and we can't
// do much better.
void * ObjHeader::GetPtrForLockContract()
{
if (GetHeaderSyncBlockIndex() == 0)
{
return (void *) GetBaseObject()->GetMethodTable();
}
return PassiveGetSyncBlock()->GetPtrForLockContract();
}
#endif // defined(ENABLE_CONTRACTS_IMPL)
// this enters the monitor of an object
void ObjHeader::EnterObjMonitor()
{
WRAPPER_NO_CONTRACT;
GetSyncBlock()->EnterMonitor();
}
// Non-blocking version of above
BOOL ObjHeader::TryEnterObjMonitor(INT32 timeOut)
{
WRAPPER_NO_CONTRACT;
return GetSyncBlock()->TryEnterMonitor(timeOut);
}
AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelperSpin(Thread* pCurThread)
{
CONTRACTL{
NOTHROW;
GC_NOTRIGGER;
MODE_COOPERATIVE;
} CONTRACTL_END;
// Note: EnterObjMonitorHelper must be called before this function (see below)
if (g_SystemInfo.dwNumberOfProcessors == 1)
{
return AwareLock::EnterHelperResult_Contention;
}
YieldProcessorNormalizationInfo normalizationInfo;
const DWORD spinCount = g_SpinConstants.dwMonitorSpinCount;
for (DWORD spinIteration = 0; spinIteration < spinCount; ++spinIteration)
{
AwareLock::SpinWait(normalizationInfo, spinIteration);
LONG oldValue = m_SyncBlockValue.LoadWithoutBarrier();
// Since spinning has begun, chances are good that the monitor has already switched to AwareLock mode, so check for that
// case first
if (oldValue & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX)
{
// If we have a hash code already, we need to create a sync block
if (oldValue & BIT_SBLK_IS_HASHCODE)
{
return AwareLock::EnterHelperResult_UseSlowPath;
}
SyncBlock *syncBlock = g_pSyncTable[oldValue & MASK_SYNCBLOCKINDEX].m_SyncBlock;
_ASSERTE(syncBlock != NULL);
AwareLock *awareLock = &syncBlock->m_Monitor;
AwareLock::EnterHelperResult result = awareLock->TryEnterBeforeSpinLoopHelper(pCurThread);
if (result != AwareLock::EnterHelperResult_Contention)
{
return result;
}
++spinIteration;
if (spinIteration < spinCount)
{
while (true)
{
AwareLock::SpinWait(normalizationInfo, spinIteration);
++spinIteration;
if (spinIteration >= spinCount)
{
// The last lock attempt for this spin will be done after the loop
break;
}
result = awareLock->TryEnterInsideSpinLoopHelper(pCurThread);
if (result == AwareLock::EnterHelperResult_Entered)
{
return AwareLock::EnterHelperResult_Entered;
}
if (result == AwareLock::EnterHelperResult_UseSlowPath)
{
break;
}
}
}
if (awareLock->TryEnterAfterSpinLoopHelper(pCurThread))
{
return AwareLock::EnterHelperResult_Entered;
}
break;
}
DWORD tid = pCurThread->GetThreadId();
if ((oldValue & (BIT_SBLK_SPIN_LOCK +
SBLK_MASK_LOCK_THREADID +
SBLK_MASK_LOCK_RECLEVEL)) == 0)
{
if (tid > SBLK_MASK_LOCK_THREADID)
{
return AwareLock::EnterHelperResult_UseSlowPath;
}
LONG newValue = oldValue | tid;
if (InterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue)
{
return AwareLock::EnterHelperResult_Entered;
}
continue;
}
// EnterObjMonitorHelper handles the thin lock recursion case. If it's not that case, it won't become that case. If
// EnterObjMonitorHelper failed to increment the recursion level, it will go down the slow path and won't come here. So,
// no need to check the recursion case here.
_ASSERTE(
// The header is transitioning - treat this as if the lock was taken
oldValue & BIT_SBLK_SPIN_LOCK ||
// Here we know we have the "thin lock" layout, but the lock is not free.
// It can't be the recursion case though, because the call to EnterObjMonitorHelper prior to this would have taken
// the slow path in the recursive case.
tid != (DWORD)(oldValue & SBLK_MASK_LOCK_THREADID));
}
return AwareLock::EnterHelperResult_Contention;
}
BOOL ObjHeader::LeaveObjMonitor()
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_COOPERATIVE;
}
CONTRACTL_END;
//this function switch to preemp mode so we need to protect the object in some path
OBJECTREF thisObj = ObjectToOBJECTREF (GetBaseObject ());
DWORD dwSwitchCount = 0;
for (;;)
{
AwareLock::LeaveHelperAction action = thisObj->GetHeader()->LeaveObjMonitorHelper(GetThread());
switch(action)
{
case AwareLock::LeaveHelperAction_None:
// We are done
return TRUE;
case AwareLock::LeaveHelperAction_Signal:
{
// Signal the event
SyncBlock *psb = thisObj->GetHeader ()->PassiveGetSyncBlock();
if (psb != NULL)
psb->QuickGetMonitor()->Signal();
}
return TRUE;
case AwareLock::LeaveHelperAction_Yield:
YieldProcessorNormalized();
continue;
case AwareLock::LeaveHelperAction_Contention:
// Some thread is updating the syncblock value.
{
//protect the object before switching mode
GCPROTECT_BEGIN (thisObj);
GCX_PREEMP();
__SwitchToThread(0, ++dwSwitchCount);
GCPROTECT_END ();
}
continue;
default:
// Must be an error otherwise - ignore it
_ASSERTE(action == AwareLock::LeaveHelperAction_Error);
return FALSE;
}
}
}
// The only difference between LeaveObjMonitor and LeaveObjMonitorAtException is switch
// to preemptive mode around __SwitchToThread
BOOL ObjHeader::LeaveObjMonitorAtException()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_COOPERATIVE;
}
CONTRACTL_END;
DWORD dwSwitchCount = 0;
for (;;)
{
AwareLock::LeaveHelperAction action = LeaveObjMonitorHelper(GetThread());
switch(action)
{
case AwareLock::LeaveHelperAction_None:
// We are done
return TRUE;
case AwareLock::LeaveHelperAction_Signal:
{
// Signal the event
SyncBlock *psb = PassiveGetSyncBlock();
if (psb != NULL)
psb->QuickGetMonitor()->Signal();
}
return TRUE;
case AwareLock::LeaveHelperAction_Yield:
YieldProcessorNormalized();
continue;
case AwareLock::LeaveHelperAction_Contention:
// Some thread is updating the syncblock value.
//
// We never toggle GC mode while holding the spinlock (BeginNoTriggerGC/EndNoTriggerGC
// in EnterSpinLock/ReleaseSpinLock ensures it). Thus we do not need to switch to preemptive
// while waiting on the spinlock.
//
{
__SwitchToThread(0, ++dwSwitchCount);
}
continue;
default:
// Must be an error otherwise - ignore it
_ASSERTE(action == AwareLock::LeaveHelperAction_Error);
return FALSE;
}
}
}
#endif //!DACCESS_COMPILE
// Returns TRUE if the lock is owned and FALSE otherwise
// threadId is set to the ID (Thread::GetThreadId()) of the thread which owns the lock
// acquisitionCount is set to the number of times the lock needs to be released before
// it is unowned
BOOL ObjHeader::GetThreadOwningMonitorLock(DWORD *pThreadId, DWORD *pAcquisitionCount)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
#ifndef DACCESS_COMPILE
if (!IsGCSpecialThread ()) {MODE_COOPERATIVE;} else {MODE_ANY;}
#endif
}
CONTRACTL_END;
SUPPORTS_DAC;
DWORD bits = GetBits();
if (bits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX)
{
if (bits & BIT_SBLK_IS_HASHCODE)
{
//
// This thread does not own the lock.
//
*pThreadId = 0;
*pAcquisitionCount = 0;
return FALSE;
}
else
{
//
// We have a syncblk
//
DWORD index = bits & MASK_SYNCBLOCKINDEX;
SyncBlock* psb = g_pSyncTable[(int)index].m_SyncBlock;
_ASSERTE(psb->GetMonitor() != NULL);
Thread* pThread = psb->GetMonitor()->GetHoldingThread();
if(pThread == NULL)
{
*pThreadId = 0;
*pAcquisitionCount = 0;
return FALSE;
}
else
{
*pThreadId = pThread->GetThreadId();
*pAcquisitionCount = psb->GetMonitor()->GetRecursionLevel();
return TRUE;
}
}
}
else
{
//
// We have a thinlock
//
DWORD lockThreadId, recursionLevel;
lockThreadId = bits & SBLK_MASK_LOCK_THREADID;
recursionLevel = (bits & SBLK_MASK_LOCK_RECLEVEL) >> SBLK_RECLEVEL_SHIFT;
//if thread ID is 0, recursionLevel got to be zero
//but thread ID doesn't have to be valid because the lock could be orphanend
_ASSERTE (lockThreadId != 0 || recursionLevel == 0 );
*pThreadId = lockThreadId;
if(lockThreadId != 0)
{
// in the header, the recursionLevel of 0 means the lock is owned once
// (this differs from m_Recursion in the AwareLock)
*pAcquisitionCount = recursionLevel + 1;
return TRUE;
}
else
{
*pAcquisitionCount = 0;
return FALSE;
}
}
}
#ifndef DACCESS_COMPILE
#ifdef MP_LOCKS
DEBUG_NOINLINE void ObjHeader::EnterSpinLock()
{
// NOTE: This function cannot have a dynamic contract. If it does, the contract's
// destructor will reset the CLR debug state to what it was before entering the
// function, which will undo the BeginNoTriggerGC() call below.
SCAN_SCOPE_BEGIN;
STATIC_CONTRACT_GC_NOTRIGGER;
#ifdef _DEBUG
int i = 0;
#endif
DWORD dwSwitchCount = 0;
while (TRUE)
{
#ifdef _DEBUG
#ifdef HOST_64BIT
// Give 64bit more time because there isn't a remoting fast path now, and we've hit this assert
// needlessly in CLRSTRESS.
if (i++ > 30000)
#else
if (i++ > 10000)
#endif // HOST_64BIT
_ASSERTE(!"ObjHeader::EnterLock timed out");
#endif
// get the value so that it doesn't get changed under us.
LONG curValue = m_SyncBlockValue.LoadWithoutBarrier();
// check if lock taken
if (! (curValue & BIT_SBLK_SPIN_LOCK))
{
// try to take the lock
LONG newValue = curValue | BIT_SBLK_SPIN_LOCK;
LONG result = FastInterlockCompareExchange((LONG*)&m_SyncBlockValue, newValue, curValue);
if (result == curValue)
break;
}
if (g_SystemInfo.dwNumberOfProcessors > 1)
{
for (int spinCount = 0; spinCount < BIT_SBLK_SPIN_COUNT; spinCount++)
{
if (! (m_SyncBlockValue & BIT_SBLK_SPIN_LOCK))
break;
YieldProcessorNormalized(); // indicate to the processor that we are spinning
}
if (m_SyncBlockValue & BIT_SBLK_SPIN_LOCK)
__SwitchToThread(0, ++dwSwitchCount);
}
else
__SwitchToThread(0, ++dwSwitchCount);
}
INCONTRACT(Thread* pThread = GetThreadNULLOk());
INCONTRACT(if (pThread != NULL) pThread->BeginNoTriggerGC(__FILE__, __LINE__));
}
#else
DEBUG_NOINLINE void ObjHeader::EnterSpinLock()
{
SCAN_SCOPE_BEGIN;
STATIC_CONTRACT_GC_NOTRIGGER;
#ifdef _DEBUG
int i = 0;
#endif
DWORD dwSwitchCount = 0;
while (TRUE)
{
#ifdef _DEBUG
if (i++ > 10000)
_ASSERTE(!"ObjHeader::EnterLock timed out");
#endif
// get the value so that it doesn't get changed under us.
LONG curValue = m_SyncBlockValue.LoadWithoutBarrier();
// check if lock taken
if (! (curValue & BIT_SBLK_SPIN_LOCK))
{
// try to take the lock
LONG newValue = curValue | BIT_SBLK_SPIN_LOCK;
LONG result = FastInterlockCompareExchange((LONG*)&m_SyncBlockValue, newValue, curValue);
if (result == curValue)
break;
}
__SwitchToThread(0, ++dwSwitchCount);
}
INCONTRACT(Thread* pThread = GetThreadNULLOk());
INCONTRACT(if (pThread != NULL) pThread->BeginNoTriggerGC(__FILE__, __LINE__));
}
#endif //MP_LOCKS
DEBUG_NOINLINE void ObjHeader::ReleaseSpinLock()
{
SCAN_SCOPE_END;
LIMITED_METHOD_CONTRACT;
INCONTRACT(Thread* pThread = GetThreadNULLOk());
INCONTRACT(if (pThread != NULL) pThread->EndNoTriggerGC());
FastInterlockAnd(&m_SyncBlockValue, ~BIT_SBLK_SPIN_LOCK);
}
#endif //!DACCESS_COMPILE
#ifndef DACCESS_COMPILE
DWORD ObjHeader::GetSyncBlockIndex()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
DWORD indx;
if ((indx = GetHeaderSyncBlockIndex()) == 0)
{
BOOL fMustCreateSyncBlock = FALSE;
{
//Need to get it from the cache
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
//Try one more time
if (GetHeaderSyncBlockIndex() == 0)
{
ENTER_SPIN_LOCK(this);
// Now the header will be stable - check whether hashcode, appdomain index or lock information is stored in it.
DWORD bits = GetBits();
if (((bits & (BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | BIT_SBLK_IS_HASHCODE)) == (BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | BIT_SBLK_IS_HASHCODE)) ||
((bits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX) == 0))
{
// Need a sync block to store this info
fMustCreateSyncBlock = TRUE;
}
else
{
SetIndex(BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | SyncBlockCache::GetSyncBlockCache()->NewSyncBlockSlot(GetBaseObject()));
}
LEAVE_SPIN_LOCK(this);
}
// SyncBlockCache::LockHolder goes out of scope here
}
if (fMustCreateSyncBlock)
GetSyncBlock();
if ((indx = GetHeaderSyncBlockIndex()) == 0)
COMPlusThrowOM();
}
return indx;
}
#if defined (VERIFY_HEAP)
BOOL ObjHeader::Validate (BOOL bVerifySyncBlkIndex)
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_MODE_COOPERATIVE;
DWORD bits = GetBits ();
Object * obj = GetBaseObject ();
BOOL bVerifyMore = g_pConfig->GetHeapVerifyLevel() & EEConfig::HEAPVERIFY_SYNCBLK;
//the highest 2 bits have reloaded meaning
// BIT_UNUSED 0x80000000
// BIT_SBLK_FINALIZER_RUN 0x40000000
if (bits & BIT_SBLK_FINALIZER_RUN)
{
ASSERT_AND_CHECK (obj->GetGCSafeMethodTable ()->HasFinalizer ());
}
//BIT_SBLK_GC_RESERVE (0x20000000) is only set during GC. But for frozen object, we don't clean the bit
if (bits & BIT_SBLK_GC_RESERVE)
{
if (!GCHeapUtilities::IsGCInProgress () && !GCHeapUtilities::GetGCHeap()->IsConcurrentGCInProgress ())
{
#ifdef FEATURE_BASICFREEZE
ASSERT_AND_CHECK (GCHeapUtilities::GetGCHeap()->IsInFrozenSegment(obj));
#else //FEATURE_BASICFREEZE
_ASSERTE(!"Reserve bit not cleared");
return FALSE;
#endif //FEATURE_BASICFREEZE
}
}
//Don't know how to verify BIT_SBLK_SPIN_LOCK (0x10000000)
//BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX (0x08000000)
if (bits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX)
{
//if BIT_SBLK_IS_HASHCODE (0x04000000) is not set,
//rest of the DWORD is SyncBlk Index
if (!(bits & BIT_SBLK_IS_HASHCODE))
{
if (bVerifySyncBlkIndex && GCHeapUtilities::GetGCHeap()->RuntimeStructuresValid ())
{
DWORD sbIndex = bits & MASK_SYNCBLOCKINDEX;
ASSERT_AND_CHECK(SyncTableEntry::GetSyncTableEntry()[sbIndex].m_Object == obj);
}
}
else
{
// rest of the DWORD is a hash code and we don't have much to validate it
}
}
else
{
//if BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX is clear, rest of DWORD is thin lock thread ID,
//thin lock recursion level and appdomain index
DWORD lockThreadId = bits & SBLK_MASK_LOCK_THREADID;
DWORD recursionLevel = (bits & SBLK_MASK_LOCK_RECLEVEL) >> SBLK_RECLEVEL_SHIFT;
//if thread ID is 0, recursionLeve got to be zero
//but thread ID doesn't have to be valid because the lock could be orphanend
ASSERT_AND_CHECK (lockThreadId != 0 || recursionLevel == 0 );
}
return TRUE;
}
#endif //VERIFY_HEAP
// This holder takes care of the SyncBlock memory cleanup if an OOM occurs inside a call to NewSyncBlockSlot.
//
// Warning: Assumes you already own the cache lock.
// Assumes nothing allocated inside the SyncBlock (only releases the memory, does not destruct.)
//
// This holder really just meets GetSyncBlock()'s special needs. It's not a general purpose holder.
// Do not inline this call. (fyuan)
// SyncBlockMemoryHolder is normally a check for empty pointer and return. Inlining VoidDeleteSyncBlockMemory adds expensive exception handling.
void VoidDeleteSyncBlockMemory(SyncBlock* psb)
{
LIMITED_METHOD_CONTRACT;
SyncBlockCache::GetSyncBlockCache()->DeleteSyncBlockMemory(psb);
}
typedef Wrapper<SyncBlock*, DoNothing<SyncBlock*>, VoidDeleteSyncBlockMemory, NULL> SyncBlockMemoryHolder;
// get the sync block for an existing object
SyncBlock *ObjHeader::GetSyncBlock()
{
CONTRACT(SyncBlock *)
{
INSTANCE_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
POSTCONDITION(CheckPointer(RETVAL));
}
CONTRACT_END;
PTR_SyncBlock syncBlock = GetBaseObject()->PassiveGetSyncBlock();
DWORD indx = 0;
BOOL indexHeld = FALSE;
if (syncBlock)
{
#ifdef _DEBUG
// Has our backpointer been correctly updated through every GC?
PTR_SyncTableEntry pEntries(SyncTableEntry::GetSyncTableEntry());
_ASSERTE(pEntries[GetHeaderSyncBlockIndex()].m_Object == GetBaseObject());
#endif // _DEBUG
RETURN syncBlock;
}
//Need to get it from the cache
{
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
//Try one more time
syncBlock = GetBaseObject()->PassiveGetSyncBlock();
if (syncBlock)
RETURN syncBlock;
SyncBlockMemoryHolder syncBlockMemoryHolder(SyncBlockCache::GetSyncBlockCache()->GetNextFreeSyncBlock());
syncBlock = syncBlockMemoryHolder;
if ((indx = GetHeaderSyncBlockIndex()) == 0)
{
indx = SyncBlockCache::GetSyncBlockCache()->NewSyncBlockSlot(GetBaseObject());
}
else
{
//We already have an index, we need to hold the syncblock
indexHeld = TRUE;
}
{
//! NewSyncBlockSlot has side-effects that we don't have backout for - thus, that must be the last
//! failable operation called.
CANNOTTHROWCOMPLUSEXCEPTION();
FAULT_FORBID();
syncBlockMemoryHolder.SuppressRelease();
new (syncBlock) SyncBlock(indx);
{
// after this point, nobody can update the index in the header
ENTER_SPIN_LOCK(this);
{
// If the thin lock in the header is in use, transfer the information to the syncblock
DWORD bits = GetBits();
if ((bits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX) == 0)
{
DWORD lockThreadId = bits & SBLK_MASK_LOCK_THREADID;
DWORD recursionLevel = (bits & SBLK_MASK_LOCK_RECLEVEL) >> SBLK_RECLEVEL_SHIFT;
if (lockThreadId != 0 || recursionLevel != 0)
{
// recursionLevel can't be non-zero if thread id is 0
_ASSERTE(lockThreadId != 0);
Thread *pThread = g_pThinLockThreadIdDispenser->IdToThreadWithValidation(lockThreadId);
if (pThread == NULL)
{
// The lock is orphaned.
pThread = (Thread*) -1;
}
syncBlock->InitState(recursionLevel + 1, pThread);
}
}
else if ((bits & BIT_SBLK_IS_HASHCODE) != 0)
{
DWORD hashCode = bits & MASK_HASHCODE;
syncBlock->SetHashCode(hashCode);
}
}
SyncTableEntry::GetSyncTableEntry() [indx].m_SyncBlock = syncBlock;
// in order to avoid a race where some thread tries to get the AD index and we've already zapped it,
// make sure the syncblock etc is all setup with the AD index prior to replacing the index
// in the header
if (GetHeaderSyncBlockIndex() == 0)
{
// We have transferred the AppDomain into the syncblock above.
SetIndex(BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | indx);
}
//If we had already an index, hold the syncblock
//for the lifetime of the object.
if (indexHeld)
syncBlock->SetPrecious();
LEAVE_SPIN_LOCK(this);
}
// SyncBlockCache::LockHolder goes out of scope here
}
}
RETURN syncBlock;
}
BOOL ObjHeader::Wait(INT32 timeOut)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
// The following code may cause GC, so we must fetch the sync block from
// the object now in case it moves.
SyncBlock *pSB = GetBaseObject()->GetSyncBlock();
// GetSyncBlock throws on failure
_ASSERTE(pSB != NULL);
// make sure we own the crst
if (!pSB->DoesCurrentThreadOwnMonitor())
COMPlusThrow(kSynchronizationLockException);
return pSB->Wait(timeOut);
}
void ObjHeader::Pulse()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
// The following code may cause GC, so we must fetch the sync block from
// the object now in case it moves.
SyncBlock *pSB = GetBaseObject()->GetSyncBlock();
// GetSyncBlock throws on failure
_ASSERTE(pSB != NULL);
// make sure we own the crst
if (!pSB->DoesCurrentThreadOwnMonitor())
COMPlusThrow(kSynchronizationLockException);
pSB->Pulse();
}
void ObjHeader::PulseAll()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
// The following code may cause GC, so we must fetch the sync block from
// the object now in case it moves.
SyncBlock *pSB = GetBaseObject()->GetSyncBlock();
// GetSyncBlock throws on failure
_ASSERTE(pSB != NULL);
// make sure we own the crst
if (!pSB->DoesCurrentThreadOwnMonitor())
COMPlusThrow(kSynchronizationLockException);
pSB->PulseAll();
}
// ***************************************************************************
//
// AwareLock class implementation (GC-aware locking)
//
// ***************************************************************************
void AwareLock::AllocLockSemEvent()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
// Before we switch from cooperative, ensure that this syncblock won't disappear
// under us. For something as expensive as an event, do it permanently rather
// than transiently.
SetPrecious();
GCX_PREEMP();
// No need to take a lock - CLREvent::CreateMonitorEvent is thread safe
m_SemEvent.CreateMonitorEvent((SIZE_T)this);
}
void AwareLock::Enter()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
Thread *pCurThread = GetThread();
LockState state = m_lockState.VolatileLoadWithoutBarrier();
if (!state.IsLocked() || m_HoldingThread != pCurThread)
{
if (m_lockState.InterlockedTryLock_Or_RegisterWaiter(this, state))
{
// We get here if we successfully acquired the mutex.
m_HoldingThread = pCurThread;
m_Recursion = 1;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP
? (int)pFrame->GetReturnAddress()
: -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
return;
}
// Lock was not acquired and the waiter was registered
// Didn't manage to get the mutex, must wait.
// The precondition for EnterEpilog is that the count of waiters be bumped
// to account for this thread, which was done above.
EnterEpilog(pCurThread);
return;
}
// Got the mutex via recursive locking on the same thread.
_ASSERTE(m_Recursion >= 1);
m_Recursion++;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP ? (int)pFrame->GetReturnAddress() : -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
}
BOOL AwareLock::TryEnter(INT32 timeOut)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
if (timeOut == 0) {MODE_ANY;} else {MODE_COOPERATIVE;}
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
Thread *pCurThread = GetThread();
if (pCurThread->IsAbortRequested())
{
pCurThread->HandleThreadAbort();
}
LockState state = m_lockState.VolatileLoadWithoutBarrier();
if (!state.IsLocked() || m_HoldingThread != pCurThread)
{
if (timeOut == 0
? m_lockState.InterlockedTryLock(state)
: m_lockState.InterlockedTryLock_Or_RegisterWaiter(this, state))
{
// We get here if we successfully acquired the mutex.
m_HoldingThread = pCurThread;
m_Recursion = 1;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP ? (int)pFrame->GetReturnAddress() : -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
return true;
}
// Lock was not acquired and the waiter was registered if the timeout is nonzero
// Didn't manage to get the mutex, return failure if no timeout, else wait
// for at most timeout milliseconds for the mutex.
if (timeOut == 0)
{
return false;
}
// The precondition for EnterEpilog is that the count of waiters be bumped
// to account for this thread, which was done above
return EnterEpilog(pCurThread, timeOut);
}
// Got the mutex via recursive locking on the same thread.
_ASSERTE(m_Recursion >= 1);
m_Recursion++;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP ? (int)pFrame->GetReturnAddress() : -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
return true;
}
BOOL AwareLock::EnterEpilog(Thread* pCurThread, INT32 timeOut)
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_MODE_COOPERATIVE;
STATIC_CONTRACT_GC_TRIGGERS;
// While we are in this frame the thread is considered blocked on the
// critical section of the monitor lock according to the debugger
DebugBlockingItem blockingMonitorInfo;
blockingMonitorInfo.dwTimeout = timeOut;
blockingMonitorInfo.pMonitor = this;
blockingMonitorInfo.pAppDomain = SystemDomain::GetCurrentDomain();
blockingMonitorInfo.type = DebugBlock_MonitorCriticalSection;
DebugBlockingItemHolder holder(pCurThread, &blockingMonitorInfo);
// We need a separate helper because it uses SEH and the holder has a
// destructor
return EnterEpilogHelper(pCurThread, timeOut);
}
#ifdef _DEBUG
#define _LOGCONTENTION
#endif // _DEBUG
#ifdef _LOGCONTENTION
inline void LogContention()
{
WRAPPER_NO_CONTRACT;
#ifdef LOGGING
if (LoggingOn(LF_SYNC, LL_INFO100))
{
LogSpewAlways("Contention: Stack Trace Begin\n");
void LogStackTrace();
LogStackTrace();
LogSpewAlways("Contention: Stack Trace End\n");
}
#endif
}
#else
#define LogContention()
#endif
double ComputeElapsedTimeInNanosecond(LARGE_INTEGER startTicks, LARGE_INTEGER endTicks)
{
static LARGE_INTEGER freq;
if (freq.QuadPart == 0)
QueryPerformanceFrequency(&freq);
const double NsPerSecond = 1000 * 1000 * 1000;
LONGLONG elapsedTicks = endTicks.QuadPart - startTicks.QuadPart;
return (elapsedTicks * NsPerSecond) / freq.QuadPart;
}
BOOL AwareLock::EnterEpilogHelper(Thread* pCurThread, INT32 timeOut)
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_MODE_COOPERATIVE;
STATIC_CONTRACT_GC_TRIGGERS;
// IMPORTANT!!!
// The caller has already registered a waiter. This function needs to unregister the waiter on all paths (exception paths
// included). On runtimes where thread-abort is supported, a thread-abort also needs to unregister the waiter. There may be
// a possibility for preemptive GC toggles below to handle a thread-abort, that should be taken into consideration when
// porting this code back to .NET Framework.
// Require all callers to be in cooperative mode. If they have switched to preemptive
// mode temporarily before calling here, then they are responsible for protecting
// the object associated with this lock.
_ASSERTE(pCurThread->PreemptiveGCDisabled());
BOOLEAN IsContentionKeywordEnabled = ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context, TRACE_LEVEL_INFORMATION, CLR_CONTENTION_KEYWORD);
LARGE_INTEGER startTicks = { {0} };
if (IsContentionKeywordEnabled)
{
QueryPerformanceCounter(&startTicks);
// Fire a contention start event for a managed contention
FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId());
}
LogContention();
Thread::IncrementMonitorLockContentionCount(pCurThread);
OBJECTREF obj = GetOwningObject();
// We cannot allow the AwareLock to be cleaned up underneath us by the GC.
IncrementTransientPrecious();
DWORD ret;
GCPROTECT_BEGIN(obj);
{
if (!m_SemEvent.IsMonitorEventAllocated())
{
AllocLockSemEvent();
}
_ASSERTE(m_SemEvent.IsMonitorEventAllocated());
pCurThread->EnablePreemptiveGC();
for (;;)
{
// Measure the time we wait so that, in the case where we wake up
// and fail to acquire the mutex, we can adjust remaining timeout
// accordingly.
ULONGLONG start = CLRGetTickCount64();
// It is likely the case that An APC threw an exception, for instance Thread.Interrupt(). The wait subsystem
// guarantees that if a signal to the event being waited upon is observed by the woken thread, that thread's
// wait will return WAIT_OBJECT_0. So in any race between m_SemEvent being signaled and the wait throwing an
// exception, a thread that is woken by an exception would not observe the signal, and the signal would wake
// another thread as necessary.
// We must decrement the waiter count in the case an exception happened. This holder takes care of that
class UnregisterWaiterHolder
{
LockState* m_pLockState;
public:
UnregisterWaiterHolder(LockState* pLockState) : m_pLockState(pLockState)
{
}
~UnregisterWaiterHolder()
{
if (m_pLockState != NULL)
{
m_pLockState->InterlockedUnregisterWaiter();
}
}
void SuppressRelease()
{
m_pLockState = NULL;
}
} unregisterWaiterHolder(&m_lockState);
ret = m_SemEvent.Wait(timeOut, TRUE);
_ASSERTE((ret == WAIT_OBJECT_0) || (ret == WAIT_TIMEOUT));
if (ret != WAIT_OBJECT_0)
{
// We timed out
// (the holder unregisters the waiter here)
break;
}
unregisterWaiterHolder.SuppressRelease();
// Spin a bit while trying to acquire the lock. This has a few benefits:
// - Spinning helps to reduce waiter starvation. Since other non-waiter threads can take the lock while there are
// waiters (see LockState::InterlockedTryLock()), once a waiter wakes it will be able to better compete
// with other spinners for the lock.
// - If there is another thread that is repeatedly acquiring and releasing the lock, spinning before waiting again
// helps to prevent a waiter from repeatedly context-switching in and out
// - Further in the same situation above, waking up and waiting shortly thereafter deprioritizes this waiter because
// events release waiters in FIFO order. Spinning a bit helps a waiter to retain its priority at least for one
// spin duration before it gets deprioritized behind all other waiters.
if (g_SystemInfo.dwNumberOfProcessors > 1)
{
bool acquiredLock = false;
YieldProcessorNormalizationInfo normalizationInfo;
const DWORD spinCount = g_SpinConstants.dwMonitorSpinCount;
for (DWORD spinIteration = 0; spinIteration < spinCount; ++spinIteration)
{
if (m_lockState.InterlockedTry_LockAndUnregisterWaiterAndObserveWakeSignal(this))
{
acquiredLock = true;
break;
}
SpinWait(normalizationInfo, spinIteration);
}
if (acquiredLock)
{
break;
}
}
if (m_lockState.InterlockedObserveWakeSignal_Try_LockAndUnregisterWaiter(this))
{
break;
}
// When calculating duration we consider a couple of special cases.
// If the end tick is the same as the start tick we make the
// duration a millisecond, to ensure we make forward progress if
// there's a lot of contention on the mutex. Secondly, we have to
// cope with the case where the tick counter wrapped while we where
// waiting (we can cope with at most one wrap, so don't expect three
// month timeouts to be very accurate). Luckily for us, the latter
// case is taken care of by 32-bit modulo arithmetic automatically.
if (timeOut != (INT32)INFINITE)
{
ULONGLONG end = CLRGetTickCount64();
ULONGLONG duration;
if (end == start)
{
duration = 1;
}
else
{
duration = end - start;
}
duration = min(duration, (DWORD)timeOut);
timeOut -= (INT32)duration;
}
}
pCurThread->DisablePreemptiveGC();
}
GCPROTECT_END();
DecrementTransientPrecious();
if (IsContentionKeywordEnabled)
{
LARGE_INTEGER endTicks;
QueryPerformanceCounter(&endTicks);
double elapsedTimeInNanosecond = ComputeElapsedTimeInNanosecond(startTicks, endTicks);
// Fire a contention end event for a managed contention
FireEtwContentionStop_V1(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId(), elapsedTimeInNanosecond);
}
if (ret == WAIT_TIMEOUT)
{
return false;
}
m_HoldingThread = pCurThread;
m_Recursion = 1;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP ? (int)pFrame->GetReturnAddress() : -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
return true;
}
BOOL AwareLock::Leave()
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
Thread* pThread = GetThread();
AwareLock::LeaveHelperAction action = LeaveHelper(pThread);
switch(action)
{
case AwareLock::LeaveHelperAction_None:
// We are done
return TRUE;
case AwareLock::LeaveHelperAction_Signal:
// Signal the event
Signal();
return TRUE;
default:
// Must be an error otherwise
_ASSERTE(action == AwareLock::LeaveHelperAction_Error);
return FALSE;
}
}
LONG AwareLock::LeaveCompletely()
{
WRAPPER_NO_CONTRACT;
LONG count = 0;
while (Leave()) {
count++;
}
_ASSERTE(count > 0); // otherwise we were never in the lock
return count;
}
BOOL AwareLock::OwnedByCurrentThread()
{
WRAPPER_NO_CONTRACT;
return (GetThread() == m_HoldingThread);
}
// ***************************************************************************
//
// SyncBlock class implementation
//
// ***************************************************************************
// We maintain two queues for SyncBlock::Wait.
// 1. Inside SyncBlock we queue all threads that are waiting on the SyncBlock.
// When we pulse, we pick the thread from this queue using FIFO.
// 2. We queue all SyncBlocks that a thread is waiting for in Thread::m_WaitEventLink.
// When we pulse a thread, we find the event from this queue to set, and we also
// or in a 1 bit in the syncblock value saved in the queue, so that we can return
// immediately from SyncBlock::Wait if the syncblock has been pulsed.
BOOL SyncBlock::Wait(INT32 timeOut)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END;
Thread *pCurThread = GetThread();
BOOL isTimedOut = FALSE;
BOOL isEnqueued = FALSE;
WaitEventLink waitEventLink;
WaitEventLink *pWaitEventLink;
// As soon as we flip the switch, we are in a race with the GC, which could clean
// up the SyncBlock underneath us -- unless we report the object.
_ASSERTE(pCurThread->PreemptiveGCDisabled());
// Does this thread already wait for this SyncBlock?
WaitEventLink *walk = pCurThread->WaitEventLinkForSyncBlock(this);
if (walk->m_Next) {
if (walk->m_Next->m_WaitSB == this) {
// Wait on the same lock again.
walk->m_Next->m_RefCount ++;
pWaitEventLink = walk->m_Next;
}
else if ((SyncBlock*)(((DWORD_PTR)walk->m_Next->m_WaitSB) & ~1)== this) {
// This thread has been pulsed. No need to wait.
return TRUE;
}
}
else {
// First time this thread is going to wait for this SyncBlock.
CLREvent* hEvent;
if (pCurThread->m_WaitEventLink.m_Next == NULL) {
hEvent = &(pCurThread->m_EventWait);
}
else {
hEvent = GetEventFromEventStore();
}
waitEventLink.m_WaitSB = this;
waitEventLink.m_EventWait = hEvent;
waitEventLink.m_Thread = pCurThread;
waitEventLink.m_Next = NULL;
waitEventLink.m_LinkSB.m_pNext = NULL;
waitEventLink.m_RefCount = 1;
pWaitEventLink = &waitEventLink;
walk->m_Next = pWaitEventLink;
// Before we enqueue it (and, thus, before it can be dequeued), reset the event
// that will awaken us.
hEvent->Reset();
// This thread is now waiting on this sync block
ThreadQueue::EnqueueThread(pWaitEventLink, this);
isEnqueued = TRUE;
}
_ASSERTE ((SyncBlock*)((DWORD_PTR)walk->m_Next->m_WaitSB & ~1)== this);
PendingSync syncState(walk);
OBJECTREF obj = m_Monitor.GetOwningObject();
m_Monitor.IncrementTransientPrecious();
// While we are in this frame the thread is considered blocked on the
// event of the monitor lock according to the debugger
DebugBlockingItem blockingMonitorInfo;
blockingMonitorInfo.dwTimeout = timeOut;
blockingMonitorInfo.pMonitor = &m_Monitor;
blockingMonitorInfo.pAppDomain = SystemDomain::GetCurrentDomain();
blockingMonitorInfo.type = DebugBlock_MonitorEvent;
DebugBlockingItemHolder holder(pCurThread, &blockingMonitorInfo);
GCPROTECT_BEGIN(obj);
{
GCX_PREEMP();
// remember how many times we synchronized
syncState.m_EnterCount = LeaveMonitorCompletely();
_ASSERTE(syncState.m_EnterCount > 0);
isTimedOut = pCurThread->Block(timeOut, &syncState);
}
GCPROTECT_END();
m_Monitor.DecrementTransientPrecious();
return !isTimedOut;
}
void SyncBlock::Pulse()
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
WaitEventLink *pWaitEventLink;
if ((pWaitEventLink = ThreadQueue::DequeueThread(this)) != NULL)
pWaitEventLink->m_EventWait->Set();
}
void SyncBlock::PulseAll()
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
WaitEventLink *pWaitEventLink;
while ((pWaitEventLink = ThreadQueue::DequeueThread(this)) != NULL)
pWaitEventLink->m_EventWait->Set();
}
bool SyncBlock::SetInteropInfo(InteropSyncBlockInfo* pInteropInfo)
{
WRAPPER_NO_CONTRACT;
SetPrecious();
// We could be agile, but not have noticed yet. We can't assert here
// that we live in any given domain, nor is this an appropriate place
// to re-parent the syncblock.
/* _ASSERTE (m_dwAppDomainIndex.m_dwIndex == 0 ||
m_dwAppDomainIndex == SystemDomain::System()->DefaultDomain()->GetIndex() ||
m_dwAppDomainIndex == GetAppDomain()->GetIndex());
m_dwAppDomainIndex = GetAppDomain()->GetIndex();
*/
return (FastInterlockCompareExchangePointer(&m_pInteropInfo,
pInteropInfo,
NULL) == NULL);
}
#ifdef EnC_SUPPORTED
// Store information about fields added to this object by EnC
// This must be called from a thread in the AppDomain of this object instance
void SyncBlock::SetEnCInfo(EnCSyncBlockInfo *pEnCInfo)
{
WRAPPER_NO_CONTRACT;
// We can't recreate the field contents, so this SyncBlock can never go away
SetPrecious();
// Store the field info (should only ever happen once)
_ASSERTE( m_pEnCInfo == NULL );
m_pEnCInfo = pEnCInfo;
}
#endif // EnC_SUPPORTED
#endif // !DACCESS_COMPILE
#if defined(HOST_64BIT) && defined(_DEBUG)
void ObjHeader::IllegalAlignPad()
{
WRAPPER_NO_CONTRACT;
#ifdef LOGGING
void** object = ((void**) this) + 1;
LogSpewAlways("\n\n******** Illegal ObjHeader m_alignpad not 0, object" FMT_ADDR "\n\n",
DBG_ADDR(object));
#endif
_ASSERTE(m_alignpad == 0);
}
#endif // HOST_64BIT && _DEBUG
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// SYNCBLK.CPP
//
//
// Definition of a SyncBlock and the SyncBlockCache which manages it
//
#include "common.h"
#include "vars.hpp"
#include "util.hpp"
#include "class.h"
#include "object.h"
#include "threads.h"
#include "excep.h"
#include "threads.h"
#include "syncblk.h"
#include "interoputil.h"
#include "encee.h"
#include "eventtrace.h"
#include "dllimportcallback.h"
#include "comcallablewrapper.h"
#include "eeconfig.h"
#include "corhost.h"
#include "comdelegate.h"
#include "finalizerthread.h"
#ifdef FEATURE_COMINTEROP
#include "runtimecallablewrapper.h"
#endif // FEATURE_COMINTEROP
// Allocate 4K worth. Typically enough
#define MAXSYNCBLOCK (0x1000-sizeof(void*))/sizeof(SyncBlock)
#define SYNC_TABLE_INITIAL_SIZE 250
//#define DUMP_SB
class SyncBlockArray
{
public:
SyncBlockArray *m_Next;
BYTE m_Blocks[MAXSYNCBLOCK * sizeof (SyncBlock)];
};
// For in-place constructor
BYTE g_SyncBlockCacheInstance[sizeof(SyncBlockCache)];
SPTR_IMPL (SyncBlockCache, SyncBlockCache, s_pSyncBlockCache);
#ifndef DACCESS_COMPILE
#ifndef TARGET_UNIX
// static
SLIST_HEADER InteropSyncBlockInfo::s_InteropInfoStandbyList;
#endif // !TARGET_UNIX
InteropSyncBlockInfo::~InteropSyncBlockInfo()
{
CONTRACTL
{
NOTHROW;
DESTRUCTOR_CHECK;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
FreeUMEntryThunk();
}
#ifndef TARGET_UNIX
// Deletes all items in code:s_InteropInfoStandbyList.
void InteropSyncBlockInfo::FlushStandbyList()
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;
PSLIST_ENTRY pEntry = InterlockedFlushSList(&InteropSyncBlockInfo::s_InteropInfoStandbyList);
while (pEntry)
{
PSLIST_ENTRY pNextEntry = pEntry->Next;
// make sure to use the global delete since the destructor has already run
::delete (void *)pEntry;
pEntry = pNextEntry;
}
}
#endif // !TARGET_UNIX
void InteropSyncBlockInfo::FreeUMEntryThunk()
{
CONTRACTL
{
NOTHROW;
DESTRUCTOR_CHECK;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END
if (!g_fEEShutDown)
{
void *pUMEntryThunk = GetUMEntryThunk();
if (pUMEntryThunk != NULL)
{
COMDelegate::RemoveEntryFromFPtrHash((UPTR)pUMEntryThunk);
UMEntryThunk::FreeUMEntryThunk((UMEntryThunk *)pUMEntryThunk);
}
}
m_pUMEntryThunk = NULL;
}
#ifdef FEATURE_COMINTEROP
// Returns either NULL or an RCW on which AcquireLock has been called.
RCW* InteropSyncBlockInfo::GetRCWAndIncrementUseCount()
{
LIMITED_METHOD_CONTRACT;
DWORD dwSwitchCount = 0;
while (true)
{
RCW *pRCW = VolatileLoad(&m_pRCW);
if ((size_t)pRCW <= 0x1)
{
// the RCW never existed or has been released
return NULL;
}
if (((size_t)pRCW & 0x1) == 0x0)
{
// it looks like we have a chance, try to acquire the lock
RCW *pLockedRCW = (RCW *)((size_t)pRCW | 0x1);
if (InterlockedCompareExchangeT(&m_pRCW, pLockedRCW, pRCW) == pRCW)
{
// we have the lock on the m_pRCW field, now we can safely "use" the RCW
pRCW->IncrementUseCount();
// release the m_pRCW lock
VolatileStore(&m_pRCW, pRCW);
// and return the RCW
return pRCW;
}
}
// somebody else holds the lock, retry
__SwitchToThread(0, ++dwSwitchCount);
}
}
// Sets the m_pRCW field in a thread-safe manner, pRCW can be NULL.
void InteropSyncBlockInfo::SetRawRCW(RCW* pRCW)
{
LIMITED_METHOD_CONTRACT;
if (pRCW != NULL)
{
// we never set two different RCWs on a single object
_ASSERTE(m_pRCW == NULL);
m_pRCW = pRCW;
}
else
{
DWORD dwSwitchCount = 0;
while (true)
{
RCW *pOldRCW = VolatileLoad(&m_pRCW);
if ((size_t)pOldRCW <= 0x1)
{
// the RCW never existed or has been released
VolatileStore(&m_pRCW, (RCW *)0x1);
return;
}
if (((size_t)pOldRCW & 0x1) == 0x0)
{
// it looks like we have a chance, set the RCW to 0x1
if (InterlockedCompareExchangeT(&m_pRCW, (RCW *)0x1, pOldRCW) == pOldRCW)
{
// we made it
return;
}
}
// somebody else holds the lock, retry
__SwitchToThread(0, ++dwSwitchCount);
}
}
}
#endif // FEATURE_COMINTEROP
#endif // !DACCESS_COMPILE
PTR_SyncTableEntry SyncTableEntry::GetSyncTableEntry()
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
return (PTR_SyncTableEntry)g_pSyncTable;
}
#ifndef DACCESS_COMPILE
SyncTableEntry*& SyncTableEntry::GetSyncTableEntryByRef()
{
LIMITED_METHOD_CONTRACT;
return g_pSyncTable;
}
/* static */
SyncBlockCache*& SyncBlockCache::GetSyncBlockCache()
{
LIMITED_METHOD_CONTRACT;
return s_pSyncBlockCache;
}
//----------------------------------------------------------------------------
//
// ThreadQueue Implementation
//
//----------------------------------------------------------------------------
#endif //!DACCESS_COMPILE
// Given a link in the chain, get the Thread that it represents
/* static */
inline PTR_WaitEventLink ThreadQueue::WaitEventLinkForLink(PTR_SLink pLink)
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
return (PTR_WaitEventLink) (((PTR_BYTE) pLink) - offsetof(WaitEventLink, m_LinkSB));
}
#ifndef DACCESS_COMPILE
// Unlink the head of the Q. We are always in the SyncBlock's critical
// section.
/* static */
inline WaitEventLink *ThreadQueue::DequeueThread(SyncBlock *psb)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
// Be careful, the debugger inspects the queue from out of process and just looks at the memory...
// it must be valid even if the lock is held. Be careful if you change the way the queue is updated.
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
WaitEventLink *ret = NULL;
SLink *pLink = psb->m_Link.m_pNext;
if (pLink)
{
psb->m_Link.m_pNext = pLink->m_pNext;
#ifdef _DEBUG
pLink->m_pNext = (SLink *)POISONC;
#endif
ret = WaitEventLinkForLink(pLink);
_ASSERTE(ret->m_WaitSB == psb);
}
return ret;
}
// Enqueue is the slow one. We have to find the end of the Q since we don't
// want to burn storage for this in the SyncBlock.
/* static */
inline void ThreadQueue::EnqueueThread(WaitEventLink *pWaitEventLink, SyncBlock *psb)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
CAN_TAKE_LOCK;
}
CONTRACTL_END;
_ASSERTE (pWaitEventLink->m_LinkSB.m_pNext == NULL);
// Be careful, the debugger inspects the queue from out of process and just looks at the memory...
// it must be valid even if the lock is held. Be careful if you change the way the queue is updated.
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
SLink *pPrior = &psb->m_Link;
while (pPrior->m_pNext)
{
// We shouldn't already be in the waiting list!
_ASSERTE(pPrior->m_pNext != &pWaitEventLink->m_LinkSB);
pPrior = pPrior->m_pNext;
}
pPrior->m_pNext = &pWaitEventLink->m_LinkSB;
}
// Wade through the SyncBlock's list of waiting threads and remove the
// specified thread.
/* static */
BOOL ThreadQueue::RemoveThread (Thread *pThread, SyncBlock *psb)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
BOOL res = FALSE;
// Be careful, the debugger inspects the queue from out of process and just looks at the memory...
// it must be valid even if the lock is held. Be careful if you change the way the queue is updated.
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
SLink *pPrior = &psb->m_Link;
SLink *pLink;
WaitEventLink *pWaitEventLink;
while ((pLink = pPrior->m_pNext) != NULL)
{
pWaitEventLink = WaitEventLinkForLink(pLink);
if (pWaitEventLink->m_Thread == pThread)
{
pPrior->m_pNext = pLink->m_pNext;
#ifdef _DEBUG
pLink->m_pNext = (SLink *)POISONC;
#endif
_ASSERTE(pWaitEventLink->m_WaitSB == psb);
res = TRUE;
break;
}
pPrior = pLink;
}
return res;
}
#endif //!DACCESS_COMPILE
#ifdef DACCESS_COMPILE
// Enumerates the threads in the queue from front to back by calling
// pCallbackFunction on each one
/* static */
void ThreadQueue::EnumerateThreads(SyncBlock *psb, FP_TQ_THREAD_ENUMERATION_CALLBACK pCallbackFunction, void* pUserData)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
SUPPORTS_DAC;
PTR_SLink pLink = psb->m_Link.m_pNext;
PTR_WaitEventLink pWaitEventLink;
while (pLink != NULL)
{
pWaitEventLink = WaitEventLinkForLink(pLink);
pCallbackFunction(pWaitEventLink->m_Thread, pUserData);
pLink = pLink->m_pNext;
}
}
#endif //DACCESS_COMPILE
#ifndef DACCESS_COMPILE
// ***************************************************************************
//
// Ephemeral Bitmap Helper
//
// ***************************************************************************
#define card_size 32
#define card_word_width 32
size_t CardIndex (size_t card)
{
LIMITED_METHOD_CONTRACT;
return card_size * card;
}
size_t CardOf (size_t idx)
{
LIMITED_METHOD_CONTRACT;
return idx / card_size;
}
size_t CardWord (size_t card)
{
LIMITED_METHOD_CONTRACT;
return card / card_word_width;
}
inline
unsigned CardBit (size_t card)
{
LIMITED_METHOD_CONTRACT;
return (unsigned)(card % card_word_width);
}
inline
void SyncBlockCache::SetCard (size_t card)
{
WRAPPER_NO_CONTRACT;
m_EphemeralBitmap [CardWord (card)] =
(m_EphemeralBitmap [CardWord (card)] | (1 << CardBit (card)));
}
inline
void SyncBlockCache::ClearCard (size_t card)
{
WRAPPER_NO_CONTRACT;
m_EphemeralBitmap [CardWord (card)] =
(m_EphemeralBitmap [CardWord (card)] & ~(1 << CardBit (card)));
}
inline
BOOL SyncBlockCache::CardSetP (size_t card)
{
WRAPPER_NO_CONTRACT;
return ( m_EphemeralBitmap [ CardWord (card) ] & (1 << CardBit (card)));
}
inline
void SyncBlockCache::CardTableSetBit (size_t idx)
{
WRAPPER_NO_CONTRACT;
SetCard (CardOf (idx));
}
size_t BitMapSize (size_t cacheSize)
{
LIMITED_METHOD_CONTRACT;
return (cacheSize + card_size * card_word_width - 1)/ (card_size * card_word_width);
}
// ***************************************************************************
//
// SyncBlockCache class implementation
//
// ***************************************************************************
SyncBlockCache::SyncBlockCache()
: m_pCleanupBlockList(NULL),
m_FreeBlockList(NULL),
// NOTE: CRST_UNSAFE_ANYMODE prevents a GC mode switch when entering this crst.
// If you remove this flag, we will switch to preemptive mode when entering
// g_criticalSection, which means all functions that enter it will become
// GC_TRIGGERS. (This includes all uses of LockHolder around SyncBlockCache::GetSyncBlockCache().
// So be sure to update the contracts if you remove this flag.
m_CacheLock(CrstSyncBlockCache, (CrstFlags) (CRST_UNSAFE_ANYMODE | CRST_DEBUGGER_THREAD)),
m_FreeCount(0),
m_ActiveCount(0),
m_SyncBlocks(0),
m_FreeSyncBlock(0),
m_FreeSyncTableIndex(1),
m_FreeSyncTableList(0),
m_SyncTableSize(SYNC_TABLE_INITIAL_SIZE),
m_OldSyncTables(0),
m_bSyncBlockCleanupInProgress(FALSE),
m_EphemeralBitmap(0)
{
CONTRACTL
{
CONSTRUCTOR_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END;
}
// This method is NO longer called.
SyncBlockCache::~SyncBlockCache()
{
CONTRACTL
{
DESTRUCTOR_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// Clear the list the fast way.
m_FreeBlockList = NULL;
//<TODO>@todo we can clear this fast too I guess</TODO>
m_pCleanupBlockList = NULL;
// destruct all arrays
while (m_SyncBlocks)
{
SyncBlockArray *next = m_SyncBlocks->m_Next;
delete m_SyncBlocks;
m_SyncBlocks = next;
}
// Also, now is a good time to clean up all the old tables which we discarded
// when we overflowed them.
SyncTableEntry* arr;
while ((arr = m_OldSyncTables) != 0)
{
m_OldSyncTables = (SyncTableEntry*)arr[0].m_Object.Load();
delete arr;
}
}
// When the GC determines that an object is dead the low bit of the
// m_Object field of SyncTableEntry is set, however it is not
// cleaned up because we cant do the COM interop cleanup at GC time.
// It is put on a cleanup list and at a later time (typically during
// finalization, this list is cleaned up.
//
void SyncBlockCache::CleanupSyncBlocks()
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_MODE_COOPERATIVE;
_ASSERTE(GetThread() == FinalizerThread::GetFinalizerThread());
// Set the flag indicating sync block cleanup is in progress.
// IMPORTANT: This must be set before the sync block cleanup bit is reset on the thread.
m_bSyncBlockCleanupInProgress = TRUE;
struct Param
{
SyncBlockCache *pThis;
SyncBlock* psb;
#ifdef FEATURE_COMINTEROP
RCW* pRCW;
#endif
} param;
param.pThis = this;
param.psb = NULL;
#ifdef FEATURE_COMINTEROP
param.pRCW = NULL;
#endif
EE_TRY_FOR_FINALLY(Param *, pParam, ¶m)
{
// reset the flag
FinalizerThread::GetFinalizerThread()->ResetSyncBlockCleanup();
// walk the cleanup list and cleanup 'em up
while ((pParam->psb = pParam->pThis->GetNextCleanupSyncBlock()) != NULL)
{
#ifdef FEATURE_COMINTEROP
InteropSyncBlockInfo* pInteropInfo = pParam->psb->GetInteropInfoNoCreate();
if (pInteropInfo)
{
pParam->pRCW = pInteropInfo->GetRawRCW();
if (pParam->pRCW)
{
// We should have initialized the cleanup list with the
// first RCW cache we created
_ASSERTE(g_pRCWCleanupList != NULL);
g_pRCWCleanupList->AddWrapper(pParam->pRCW);
pParam->pRCW = NULL;
pInteropInfo->SetRawRCW(NULL);
}
}
#endif // FEATURE_COMINTEROP
// Delete the sync block.
pParam->pThis->DeleteSyncBlock(pParam->psb);
pParam->psb = NULL;
// pulse GC mode to allow GC to perform its work
if (FinalizerThread::GetFinalizerThread()->CatchAtSafePointOpportunistic())
{
FinalizerThread::GetFinalizerThread()->PulseGCMode();
}
}
#ifdef FEATURE_COMINTEROP
// Now clean up the rcw's sorted by context
if (g_pRCWCleanupList != NULL)
g_pRCWCleanupList->CleanupAllWrappers();
#endif // FEATURE_COMINTEROP
}
EE_FINALLY
{
// We are finished cleaning up the sync blocks.
m_bSyncBlockCleanupInProgress = FALSE;
#ifdef FEATURE_COMINTEROP
if (param.pRCW)
param.pRCW->Cleanup();
#endif
if (param.psb)
DeleteSyncBlock(param.psb);
} EE_END_FINALLY;
}
// create the sync block cache
/* static */
void SyncBlockCache::Attach()
{
LIMITED_METHOD_CONTRACT;
}
// create the sync block cache
/* static */
void SyncBlockCache::Start()
{
CONTRACTL
{
THROWS;
GC_NOTRIGGER;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
DWORD* bm = new DWORD [BitMapSize(SYNC_TABLE_INITIAL_SIZE+1)];
memset (bm, 0, BitMapSize (SYNC_TABLE_INITIAL_SIZE+1)*sizeof(DWORD));
SyncTableEntry::GetSyncTableEntryByRef() = new SyncTableEntry[SYNC_TABLE_INITIAL_SIZE+1];
#ifdef _DEBUG
for (int i=0; i<SYNC_TABLE_INITIAL_SIZE+1; i++) {
SyncTableEntry::GetSyncTableEntry()[i].m_SyncBlock = NULL;
}
#endif
SyncTableEntry::GetSyncTableEntry()[0].m_SyncBlock = 0;
SyncBlockCache::GetSyncBlockCache() = new (&g_SyncBlockCacheInstance) SyncBlockCache;
SyncBlockCache::GetSyncBlockCache()->m_EphemeralBitmap = bm;
#ifndef TARGET_UNIX
InitializeSListHead(&InteropSyncBlockInfo::s_InteropInfoStandbyList);
#endif // !TARGET_UNIX
}
// destroy the sync block cache
/* static */
void SyncBlockCache::Stop()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// cache must be destroyed first, since it can traverse the table to find all the
// sync blocks which are live and thus must have their critical sections destroyed.
if (SyncBlockCache::GetSyncBlockCache())
{
delete SyncBlockCache::GetSyncBlockCache();
SyncBlockCache::GetSyncBlockCache() = 0;
}
if (SyncTableEntry::GetSyncTableEntry())
{
delete SyncTableEntry::GetSyncTableEntry();
SyncTableEntry::GetSyncTableEntryByRef() = 0;
}
}
void SyncBlockCache::InsertCleanupSyncBlock(SyncBlock* psb)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// free up the threads that are waiting before we use the link
// for other purposes
if (psb->m_Link.m_pNext != NULL)
{
while (ThreadQueue::DequeueThread(psb) != NULL)
continue;
}
#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS)
if (psb->m_pInteropInfo)
{
// called during GC
// so do only minorcleanup
MinorCleanupSyncBlockComData(psb->m_pInteropInfo);
}
#endif // FEATURE_COMINTEROP || FEATURE_COMWRAPPERS
// This method will be called only by the GC thread
//<TODO>@todo add an assert for the above statement</TODO>
// we don't need to lock here
//EnterCacheLock();
psb->m_Link.m_pNext = m_pCleanupBlockList;
m_pCleanupBlockList = &psb->m_Link;
// we don't need a lock here
//LeaveCacheLock();
}
SyncBlock* SyncBlockCache::GetNextCleanupSyncBlock()
{
LIMITED_METHOD_CONTRACT;
// we don't need a lock here,
// as this is called only on the finalizer thread currently
SyncBlock *psb = NULL;
if (m_pCleanupBlockList)
{
// get the actual sync block pointer
psb = (SyncBlock *) (((BYTE *) m_pCleanupBlockList) - offsetof(SyncBlock, m_Link));
m_pCleanupBlockList = m_pCleanupBlockList->m_pNext;
}
return psb;
}
// returns and removes the next free syncblock from the list
// the cache lock must be entered to call this
SyncBlock *SyncBlockCache::GetNextFreeSyncBlock()
{
CONTRACTL
{
INJECT_FAULT(COMPlusThrowOM());
THROWS;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
#ifdef _DEBUG // Instrumentation for OOM fault injection testing
delete new char;
#endif
SyncBlock *psb;
SLink *plst = m_FreeBlockList;
m_ActiveCount++;
if (plst)
{
m_FreeBlockList = m_FreeBlockList->m_pNext;
// shouldn't be 0
m_FreeCount--;
// get the actual sync block pointer
psb = (SyncBlock *) (((BYTE *) plst) - offsetof(SyncBlock, m_Link));
return psb;
}
else
{
if ((m_SyncBlocks == NULL) || (m_FreeSyncBlock >= MAXSYNCBLOCK))
{
#ifdef DUMP_SB
// LogSpewAlways("Allocating new syncblock array\n");
// DumpSyncBlockCache();
#endif
SyncBlockArray* newsyncblocks = new(SyncBlockArray);
if (!newsyncblocks)
COMPlusThrowOM ();
newsyncblocks->m_Next = m_SyncBlocks;
m_SyncBlocks = newsyncblocks;
m_FreeSyncBlock = 0;
}
return &(((SyncBlock*)m_SyncBlocks->m_Blocks)[m_FreeSyncBlock++]);
}
}
void SyncBlockCache::Grow()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_COOPERATIVE;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
STRESS_LOG0(LF_SYNC, LL_INFO10000, "SyncBlockCache::NewSyncBlockSlot growing SyncBlockCache \n");
NewArrayHolder<SyncTableEntry> newSyncTable (NULL);
NewArrayHolder<DWORD> newBitMap (NULL);
DWORD * oldBitMap;
// Compute the size of the new synctable. Normally, we double it - unless
// doing so would create slots with indices too high to fit within the
// mask. If so, we create a synctable up to the mask limit. If we're
// already at the mask limit, then caller is out of luck.
DWORD newSyncTableSize;
if (m_SyncTableSize <= (MASK_SYNCBLOCKINDEX >> 1))
{
newSyncTableSize = m_SyncTableSize * 2;
}
else
{
newSyncTableSize = MASK_SYNCBLOCKINDEX;
}
if (!(newSyncTableSize > m_SyncTableSize)) // Make sure we actually found room to grow!
{
EX_THROW(EEMessageException, (kOutOfMemoryException, IDS_EE_OUT_OF_SYNCBLOCKS));
}
newSyncTable = new SyncTableEntry[newSyncTableSize];
newBitMap = new DWORD[BitMapSize (newSyncTableSize)];
{
//! From here on, we assume that we will succeed and start doing global side-effects.
//! Any operation that could fail must occur before this point.
CANNOTTHROWCOMPLUSEXCEPTION();
FAULT_FORBID();
newSyncTable.SuppressRelease();
newBitMap.SuppressRelease();
// We chain old table because we can't delete
// them before all the threads are stoppped
// (next GC)
SyncTableEntry::GetSyncTableEntry() [0].m_Object = (Object *)m_OldSyncTables;
m_OldSyncTables = SyncTableEntry::GetSyncTableEntry();
memset (newSyncTable, 0, newSyncTableSize*sizeof (SyncTableEntry));
memset (newBitMap, 0, BitMapSize (newSyncTableSize)*sizeof (DWORD));
CopyMemory (newSyncTable, SyncTableEntry::GetSyncTableEntry(),
m_SyncTableSize*sizeof (SyncTableEntry));
CopyMemory (newBitMap, m_EphemeralBitmap,
BitMapSize (m_SyncTableSize)*sizeof (DWORD));
oldBitMap = m_EphemeralBitmap;
m_EphemeralBitmap = newBitMap;
delete[] oldBitMap;
_ASSERTE((m_SyncTableSize & MASK_SYNCBLOCKINDEX) == m_SyncTableSize);
// note: we do not care if another thread does not see the new size
// however we really do not want it to see the new size without seeing the new array
//@TODO do we still leak here if two threads come here at the same time ?
FastInterlockExchangePointer(&SyncTableEntry::GetSyncTableEntryByRef(), newSyncTable.GetValue());
m_FreeSyncTableIndex++;
m_SyncTableSize = newSyncTableSize;
#ifdef _DEBUG
static int dumpSBOnResize = -1;
if (dumpSBOnResize == -1)
dumpSBOnResize = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SBDumpOnResize);
if (dumpSBOnResize)
{
LogSpewAlways("SyncBlockCache resized\n");
DumpSyncBlockCache();
}
#endif
}
}
DWORD SyncBlockCache::NewSyncBlockSlot(Object *obj)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_COOPERATIVE;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
_ASSERTE(m_CacheLock.OwnedByCurrentThread()); // GetSyncBlock takes the lock, make sure no one else does.
DWORD indexNewEntry;
if (m_FreeSyncTableList)
{
indexNewEntry = (DWORD)(m_FreeSyncTableList >> 1);
_ASSERTE ((size_t)SyncTableEntry::GetSyncTableEntry()[indexNewEntry].m_Object.Load() & 1);
m_FreeSyncTableList = (size_t)SyncTableEntry::GetSyncTableEntry()[indexNewEntry].m_Object.Load() & ~1;
}
else if ((indexNewEntry = (DWORD)(m_FreeSyncTableIndex)) >= m_SyncTableSize)
{
// This is kept out of line to keep stuff like the C++ EH prolog (needed for holders) off
// of the common path.
Grow();
}
else
{
#ifdef _DEBUG
static int dumpSBOnNewIndex = -1;
if (dumpSBOnNewIndex == -1)
dumpSBOnNewIndex = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SBDumpOnNewIndex);
if (dumpSBOnNewIndex)
{
LogSpewAlways("SyncBlockCache index incremented\n");
DumpSyncBlockCache();
}
#endif
m_FreeSyncTableIndex ++;
}
CardTableSetBit (indexNewEntry);
// In debug builds the m_SyncBlock at indexNewEntry should already be null, since we should
// start out with a null table and always null it out on delete.
_ASSERTE(SyncTableEntry::GetSyncTableEntry() [indexNewEntry].m_SyncBlock == NULL);
SyncTableEntry::GetSyncTableEntry() [indexNewEntry].m_SyncBlock = NULL;
SyncTableEntry::GetSyncTableEntry() [indexNewEntry].m_Object = obj;
_ASSERTE(indexNewEntry != 0);
return indexNewEntry;
}
// free a used sync block, only called from CleanupSyncBlocks.
void SyncBlockCache::DeleteSyncBlock(SyncBlock *psb)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END;
// clean up comdata
if (psb->m_pInteropInfo)
{
#if defined(FEATURE_COMINTEROP) || defined(FEATURE_COMWRAPPERS)
CleanupSyncBlockComData(psb->m_pInteropInfo);
#endif // FEATURE_COMINTEROP || FEATURE_COMWRAPPERS
#ifndef TARGET_UNIX
if (g_fEEShutDown)
{
delete psb->m_pInteropInfo;
}
else
{
psb->m_pInteropInfo->~InteropSyncBlockInfo();
InterlockedPushEntrySList(&InteropSyncBlockInfo::s_InteropInfoStandbyList, (PSLIST_ENTRY)psb->m_pInteropInfo);
}
#else // !TARGET_UNIX
delete psb->m_pInteropInfo;
#endif // !TARGET_UNIX
}
#ifdef EnC_SUPPORTED
// clean up EnC info
if (psb->m_pEnCInfo)
psb->m_pEnCInfo->Cleanup();
#endif // EnC_SUPPORTED
// Destruct the SyncBlock, but don't reclaim its memory. (Overridden
// operator delete).
delete psb;
//synchronizer with the consumers,
// <TODO>@todo we don't really need a lock here, we can come up
// with some simple algo to avoid taking a lock </TODO>
{
SyncBlockCache::LockHolder lh(this);
DeleteSyncBlockMemory(psb);
}
}
// returns the sync block memory to the free pool but does not destruct sync block (must own cache lock already)
void SyncBlockCache::DeleteSyncBlockMemory(SyncBlock *psb)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
FORBID_FAULT;
}
CONTRACTL_END
m_ActiveCount--;
m_FreeCount++;
psb->m_Link.m_pNext = m_FreeBlockList;
m_FreeBlockList = &psb->m_Link;
}
// free a used sync block
void SyncBlockCache::GCDeleteSyncBlock(SyncBlock *psb)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// Destruct the SyncBlock, but don't reclaim its memory. (Overridden
// operator delete).
delete psb;
m_ActiveCount--;
m_FreeCount++;
psb->m_Link.m_pNext = m_FreeBlockList;
m_FreeBlockList = &psb->m_Link;
}
void SyncBlockCache::GCWeakPtrScan(HANDLESCANPROC scanProc, uintptr_t lp1, uintptr_t lp2)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
// First delete the obsolete arrays since we have exclusive access
BOOL fSetSyncBlockCleanup = FALSE;
SyncTableEntry* arr;
while ((arr = m_OldSyncTables) != NULL)
{
m_OldSyncTables = (SyncTableEntry*)arr[0].m_Object.Load();
delete[] arr;
}
#ifdef DUMP_SB
LogSpewAlways("GCWeakPtrScan starting\n");
#endif
#ifdef VERIFY_HEAP
if (g_pConfig->GetHeapVerifyLevel()& EEConfig::HEAPVERIFY_SYNCBLK)
STRESS_LOG0 (LF_GC | LF_SYNC, LL_INFO100, "GCWeakPtrScan starting\n");
#endif
if (GCHeapUtilities::GetGCHeap()->GetCondemnedGeneration() < GCHeapUtilities::GetGCHeap()->GetMaxGeneration())
{
#ifdef VERIFY_HEAP
//for VSW 294550: we saw stale obeject reference in SyncBlkCache, so we want to make sure the card
//table logic above works correctly so that every ephemeral entry is promoted.
//For verification, we make a copy of the sync table in relocation phase and promote it use the
//slow approach and compare the result with the original one
DWORD freeSyncTalbeIndexCopy = m_FreeSyncTableIndex;
SyncTableEntry * syncTableShadow = NULL;
if ((g_pConfig->GetHeapVerifyLevel()& EEConfig::HEAPVERIFY_SYNCBLK) && !((ScanContext*)lp1)->promotion)
{
syncTableShadow = new(nothrow) SyncTableEntry [m_FreeSyncTableIndex];
if (syncTableShadow)
{
memcpy (syncTableShadow, SyncTableEntry::GetSyncTableEntry(), m_FreeSyncTableIndex * sizeof (SyncTableEntry));
}
}
#endif //VERIFY_HEAP
//scan the bitmap
size_t dw = 0;
while (1)
{
while (dw < BitMapSize (m_SyncTableSize) && (m_EphemeralBitmap[dw]==0))
{
dw++;
}
if (dw < BitMapSize (m_SyncTableSize))
{
//found one
for (int i = 0; i < card_word_width; i++)
{
size_t card = i+dw*card_word_width;
if (CardSetP (card))
{
BOOL clear_card = TRUE;
for (int idx = 0; idx < card_size; idx++)
{
size_t nb = CardIndex (card) + idx;
if (( nb < m_FreeSyncTableIndex) && (nb > 0))
{
Object* o = SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
if (o && !((size_t)o & 1))
{
if (GCHeapUtilities::GetGCHeap()->IsEphemeral (o))
{
clear_card = FALSE;
GCWeakPtrScanElement ((int)nb, scanProc,
lp1, lp2, fSetSyncBlockCleanup);
}
}
}
}
if (clear_card)
ClearCard (card);
}
}
dw++;
}
else
break;
}
#ifdef VERIFY_HEAP
//for VSW 294550: we saw stale obeject reference in SyncBlkCache, so we want to make sure the card
//table logic above works correctly so that every ephemeral entry is promoted. To verify, we make a
//copy of the sync table and promote it use the slow approach and compare the result with the real one
if (g_pConfig->GetHeapVerifyLevel()& EEConfig::HEAPVERIFY_SYNCBLK)
{
if (syncTableShadow)
{
for (DWORD nb = 1; nb < m_FreeSyncTableIndex; nb++)
{
Object **keyv = (Object **) &syncTableShadow[nb].m_Object;
if (((size_t) *keyv & 1) == 0)
{
(*scanProc) (keyv, NULL, lp1, lp2);
SyncBlock *pSB = syncTableShadow[nb].m_SyncBlock;
if (*keyv != 0 && (!pSB || !pSB->IsIDisposable()))
{
if (syncTableShadow[nb].m_Object != SyncTableEntry::GetSyncTableEntry()[nb].m_Object)
DebugBreak ();
}
}
}
delete []syncTableShadow;
syncTableShadow = NULL;
}
if (freeSyncTalbeIndexCopy != m_FreeSyncTableIndex)
DebugBreak ();
}
#endif //VERIFY_HEAP
}
else
{
for (DWORD nb = 1; nb < m_FreeSyncTableIndex; nb++)
{
GCWeakPtrScanElement (nb, scanProc, lp1, lp2, fSetSyncBlockCleanup);
}
}
if (fSetSyncBlockCleanup)
{
// mark the finalizer thread saying requires cleanup
FinalizerThread::GetFinalizerThread()->SetSyncBlockCleanup();
FinalizerThread::EnableFinalization();
}
#if defined(VERIFY_HEAP)
if (g_pConfig->GetHeapVerifyLevel() & EEConfig::HEAPVERIFY_GC)
{
if (((ScanContext*)lp1)->promotion)
{
for (int nb = 1; nb < (int)m_FreeSyncTableIndex; nb++)
{
Object* o = SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
if (o && ((size_t)o & 1) == 0)
{
o->Validate();
}
}
}
}
#endif // VERIFY_HEAP
}
/* Scan the weak pointers in the SyncBlockEntry and report them to the GC. If the
reference is dead, then return TRUE */
BOOL SyncBlockCache::GCWeakPtrScanElement (int nb, HANDLESCANPROC scanProc, LPARAM lp1, LPARAM lp2,
BOOL& cleanup)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
Object **keyv = (Object **) &SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
#ifdef DUMP_SB
struct Param
{
Object **keyv;
char *name;
} param;
param.keyv = keyv;
PAL_TRY(Param *, pParam, ¶m) {
if (! *pParam->keyv)
pParam->name = "null";
else if ((size_t) *pParam->keyv & 1)
pParam->name = "free";
else {
pParam->name = (*pParam->keyv)->GetClass()->GetDebugClassName();
if (strlen(pParam->name) == 0)
pParam->name = "<INVALID>";
}
} PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
param.name = "<INVALID>";
}
PAL_ENDTRY
LogSpewAlways("[%4.4d]: %8.8x, %s\n", nb, *keyv, param.name);
#endif
if (((size_t) *keyv & 1) == 0)
{
#ifdef VERIFY_HEAP
if (g_pConfig->GetHeapVerifyLevel () & EEConfig::HEAPVERIFY_SYNCBLK)
{
STRESS_LOG3 (LF_GC | LF_SYNC, LL_INFO100000, "scanning syncblk[%d, %p, %p]\n", nb, (size_t)SyncTableEntry::GetSyncTableEntry()[nb].m_SyncBlock, (size_t)*keyv);
}
#endif
(*scanProc) (keyv, NULL, lp1, lp2);
SyncBlock *pSB = SyncTableEntry::GetSyncTableEntry()[nb].m_SyncBlock;
if ((*keyv == 0 ) || (pSB && pSB->IsIDisposable()))
{
#ifdef VERIFY_HEAP
if (g_pConfig->GetHeapVerifyLevel () & EEConfig::HEAPVERIFY_SYNCBLK)
{
STRESS_LOG3 (LF_GC | LF_SYNC, LL_INFO100000, "freeing syncblk[%d, %p, %p]\n", nb, (size_t)pSB, (size_t)*keyv);
}
#endif
if (*keyv)
{
_ASSERTE (pSB);
GCDeleteSyncBlock(pSB);
//clean the object syncblock header
((Object*)(*keyv))->GetHeader()->GCResetIndex();
}
else if (pSB)
{
cleanup = TRUE;
// insert block into cleanup list
InsertCleanupSyncBlock (SyncTableEntry::GetSyncTableEntry()[nb].m_SyncBlock);
#ifdef DUMP_SB
LogSpewAlways(" Cleaning up block at %4.4d\n", nb);
#endif
}
// delete the entry
#ifdef DUMP_SB
LogSpewAlways(" Deleting block at %4.4d\n", nb);
#endif
SyncTableEntry::GetSyncTableEntry()[nb].m_Object = (Object *)(m_FreeSyncTableList | 1);
m_FreeSyncTableList = nb << 1;
SyncTableEntry::GetSyncTableEntry()[nb].m_SyncBlock = NULL;
return TRUE;
}
else
{
#ifdef DUMP_SB
LogSpewAlways(" Keeping block at %4.4d with oref %8.8x\n", nb, *keyv);
#endif
}
}
return FALSE;
}
void SyncBlockCache::GCDone(BOOL demoting, int max_gen)
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
if (demoting &&
(GCHeapUtilities::GetGCHeap()->GetCondemnedGeneration() ==
GCHeapUtilities::GetGCHeap()->GetMaxGeneration()))
{
//scan the bitmap
size_t dw = 0;
while (1)
{
while (dw < BitMapSize (m_SyncTableSize) &&
(m_EphemeralBitmap[dw]==(DWORD)~0))
{
dw++;
}
if (dw < BitMapSize (m_SyncTableSize))
{
//found one
for (int i = 0; i < card_word_width; i++)
{
size_t card = i+dw*card_word_width;
if (!CardSetP (card))
{
for (int idx = 0; idx < card_size; idx++)
{
size_t nb = CardIndex (card) + idx;
if (( nb < m_FreeSyncTableIndex) && (nb > 0))
{
Object* o = SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
if (o && !((size_t)o & 1))
{
if (GCHeapUtilities::GetGCHeap()->WhichGeneration (o) < (unsigned int)max_gen)
{
SetCard (card);
break;
}
}
}
}
}
}
dw++;
}
else
break;
}
}
}
#if defined (VERIFY_HEAP)
#ifndef _DEBUG
#ifdef _ASSERTE
#undef _ASSERTE
#endif
#define _ASSERTE(c) if (!(c)) DebugBreak()
#endif
void SyncBlockCache::VerifySyncTableEntry()
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
for (DWORD nb = 1; nb < m_FreeSyncTableIndex; nb++)
{
Object* o = SyncTableEntry::GetSyncTableEntry()[nb].m_Object;
// if the slot was just allocated, the object may still be null
if (o && (((size_t)o & 1) == 0))
{
//there is no need to verify next object's header because this is called
//from verify_heap, which will verify every object anyway
o->Validate(TRUE, FALSE);
//
// This loop is just a heuristic to try to catch errors, but it is not 100%.
// To prevent false positives, we weaken our assert below to exclude the case
// where the index is still NULL, but we've reached the end of our loop.
//
static const DWORD max_iterations = 100;
DWORD loop = 0;
for (; loop < max_iterations; loop++)
{
// The syncblock index may be updating by another thread.
if (o->GetHeader()->GetHeaderSyncBlockIndex() != 0)
{
break;
}
__SwitchToThread(0, CALLER_LIMITS_SPINNING);
}
DWORD idx = o->GetHeader()->GetHeaderSyncBlockIndex();
_ASSERTE(idx == nb || ((0 == idx) && (loop == max_iterations)));
_ASSERTE(!GCHeapUtilities::GetGCHeap()->IsEphemeral(o) || CardSetP(CardOf(nb)));
}
}
}
#ifndef _DEBUG
#undef _ASSERTE
#define _ASSERTE(expr) ((void)0)
#endif // _DEBUG
#endif // VERIFY_HEAP
#ifdef _DEBUG
void DumpSyncBlockCache()
{
STATIC_CONTRACT_NOTHROW;
SyncBlockCache *pCache = SyncBlockCache::GetSyncBlockCache();
LogSpewAlways("Dumping SyncBlockCache size %d\n", pCache->m_FreeSyncTableIndex);
static int dumpSBStyle = -1;
if (dumpSBStyle == -1)
dumpSBStyle = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_SBDumpStyle);
if (dumpSBStyle == 0)
return;
BOOL isString = FALSE;
DWORD objectCount = 0;
DWORD slotCount = 0;
for (DWORD nb = 1; nb < pCache->m_FreeSyncTableIndex; nb++)
{
isString = FALSE;
char buffer[1024], buffer2[1024];
LPCUTF8 descrip = "null";
SyncTableEntry *pEntry = &SyncTableEntry::GetSyncTableEntry()[nb];
Object *oref = (Object *) pEntry->m_Object;
if (((size_t) oref & 1) != 0)
{
descrip = "free";
oref = 0;
}
else
{
++slotCount;
if (oref)
{
++objectCount;
struct Param
{
LPCUTF8 descrip;
Object *oref;
char *buffer2;
UINT cch2;
BOOL isString;
} param;
param.descrip = descrip;
param.oref = oref;
param.buffer2 = buffer2;
param.cch2 = ARRAY_SIZE(buffer2);
param.isString = isString;
PAL_TRY(Param *, pParam, ¶m)
{
pParam->descrip = pParam->oref->GetMethodTable()->GetDebugClassName();
if (strlen(pParam->descrip) == 0)
pParam->descrip = "<INVALID>";
else if (pParam->oref->GetMethodTable() == g_pStringClass)
{
sprintf_s(pParam->buffer2, pParam->cch2, "%s (%S)", pParam->descrip, ObjectToSTRINGREF((StringObject*)pParam->oref)->GetBuffer());
pParam->descrip = pParam->buffer2;
pParam->isString = TRUE;
}
}
PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
param.descrip = "<INVALID>";
}
PAL_ENDTRY
descrip = param.descrip;
isString = param.isString;
}
sprintf_s(buffer, ARRAY_SIZE(buffer), "%s", descrip);
descrip = buffer;
}
if (dumpSBStyle < 2)
LogSpewAlways("[%4.4d]: %8.8x %s\n", nb, oref, descrip);
else if (dumpSBStyle == 2 && ! isString)
LogSpewAlways("[%4.4d]: %s\n", nb, descrip);
}
LogSpewAlways("Done dumping SyncBlockCache used slots: %d, objects: %d\n", slotCount, objectCount);
}
#endif
// ***************************************************************************
//
// ObjHeader class implementation
//
// ***************************************************************************
#if defined(ENABLE_CONTRACTS_IMPL)
// The LOCK_TAKEN/RELEASED macros need a "pointer" to the lock object to do
// comparisons between takes & releases (and to provide debugging info to the
// developer). Ask the syncblock for its lock contract pointer, if the
// syncblock exists. Otherwise, use the MethodTable* from the Object. That's not great,
// as it's not unique, so we might miss unbalanced lock takes/releases from
// different objects of the same type. However, our hands are tied, and we can't
// do much better.
void * ObjHeader::GetPtrForLockContract()
{
if (GetHeaderSyncBlockIndex() == 0)
{
return (void *) GetBaseObject()->GetMethodTable();
}
return PassiveGetSyncBlock()->GetPtrForLockContract();
}
#endif // defined(ENABLE_CONTRACTS_IMPL)
// this enters the monitor of an object
void ObjHeader::EnterObjMonitor()
{
WRAPPER_NO_CONTRACT;
GetSyncBlock()->EnterMonitor();
}
// Non-blocking version of above
BOOL ObjHeader::TryEnterObjMonitor(INT32 timeOut)
{
WRAPPER_NO_CONTRACT;
return GetSyncBlock()->TryEnterMonitor(timeOut);
}
AwareLock::EnterHelperResult ObjHeader::EnterObjMonitorHelperSpin(Thread* pCurThread)
{
CONTRACTL{
NOTHROW;
GC_NOTRIGGER;
MODE_COOPERATIVE;
} CONTRACTL_END;
// Note: EnterObjMonitorHelper must be called before this function (see below)
if (g_SystemInfo.dwNumberOfProcessors == 1)
{
return AwareLock::EnterHelperResult_Contention;
}
YieldProcessorNormalizationInfo normalizationInfo;
const DWORD spinCount = g_SpinConstants.dwMonitorSpinCount;
for (DWORD spinIteration = 0; spinIteration < spinCount; ++spinIteration)
{
AwareLock::SpinWait(normalizationInfo, spinIteration);
LONG oldValue = m_SyncBlockValue.LoadWithoutBarrier();
// Since spinning has begun, chances are good that the monitor has already switched to AwareLock mode, so check for that
// case first
if (oldValue & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX)
{
// If we have a hash code already, we need to create a sync block
if (oldValue & BIT_SBLK_IS_HASHCODE)
{
return AwareLock::EnterHelperResult_UseSlowPath;
}
SyncBlock *syncBlock = g_pSyncTable[oldValue & MASK_SYNCBLOCKINDEX].m_SyncBlock;
_ASSERTE(syncBlock != NULL);
AwareLock *awareLock = &syncBlock->m_Monitor;
AwareLock::EnterHelperResult result = awareLock->TryEnterBeforeSpinLoopHelper(pCurThread);
if (result != AwareLock::EnterHelperResult_Contention)
{
return result;
}
++spinIteration;
if (spinIteration < spinCount)
{
while (true)
{
AwareLock::SpinWait(normalizationInfo, spinIteration);
++spinIteration;
if (spinIteration >= spinCount)
{
// The last lock attempt for this spin will be done after the loop
break;
}
result = awareLock->TryEnterInsideSpinLoopHelper(pCurThread);
if (result == AwareLock::EnterHelperResult_Entered)
{
return AwareLock::EnterHelperResult_Entered;
}
if (result == AwareLock::EnterHelperResult_UseSlowPath)
{
break;
}
}
}
if (awareLock->TryEnterAfterSpinLoopHelper(pCurThread))
{
return AwareLock::EnterHelperResult_Entered;
}
break;
}
DWORD tid = pCurThread->GetThreadId();
if ((oldValue & (BIT_SBLK_SPIN_LOCK +
SBLK_MASK_LOCK_THREADID +
SBLK_MASK_LOCK_RECLEVEL)) == 0)
{
if (tid > SBLK_MASK_LOCK_THREADID)
{
return AwareLock::EnterHelperResult_UseSlowPath;
}
LONG newValue = oldValue | tid;
if (InterlockedCompareExchangeAcquire((LONG*)&m_SyncBlockValue, newValue, oldValue) == oldValue)
{
return AwareLock::EnterHelperResult_Entered;
}
continue;
}
// EnterObjMonitorHelper handles the thin lock recursion case. If it's not that case, it won't become that case. If
// EnterObjMonitorHelper failed to increment the recursion level, it will go down the slow path and won't come here. So,
// no need to check the recursion case here.
_ASSERTE(
// The header is transitioning - treat this as if the lock was taken
oldValue & BIT_SBLK_SPIN_LOCK ||
// Here we know we have the "thin lock" layout, but the lock is not free.
// It can't be the recursion case though, because the call to EnterObjMonitorHelper prior to this would have taken
// the slow path in the recursive case.
tid != (DWORD)(oldValue & SBLK_MASK_LOCK_THREADID));
}
return AwareLock::EnterHelperResult_Contention;
}
BOOL ObjHeader::LeaveObjMonitor()
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
MODE_COOPERATIVE;
}
CONTRACTL_END;
//this function switch to preemp mode so we need to protect the object in some path
OBJECTREF thisObj = ObjectToOBJECTREF (GetBaseObject ());
DWORD dwSwitchCount = 0;
for (;;)
{
AwareLock::LeaveHelperAction action = thisObj->GetHeader()->LeaveObjMonitorHelper(GetThread());
switch(action)
{
case AwareLock::LeaveHelperAction_None:
// We are done
return TRUE;
case AwareLock::LeaveHelperAction_Signal:
{
// Signal the event
SyncBlock *psb = thisObj->GetHeader ()->PassiveGetSyncBlock();
if (psb != NULL)
psb->QuickGetMonitor()->Signal();
}
return TRUE;
case AwareLock::LeaveHelperAction_Yield:
YieldProcessorNormalized();
continue;
case AwareLock::LeaveHelperAction_Contention:
// Some thread is updating the syncblock value.
{
//protect the object before switching mode
GCPROTECT_BEGIN (thisObj);
GCX_PREEMP();
__SwitchToThread(0, ++dwSwitchCount);
GCPROTECT_END ();
}
continue;
default:
// Must be an error otherwise - ignore it
_ASSERTE(action == AwareLock::LeaveHelperAction_Error);
return FALSE;
}
}
}
// The only difference between LeaveObjMonitor and LeaveObjMonitorAtException is switch
// to preemptive mode around __SwitchToThread
BOOL ObjHeader::LeaveObjMonitorAtException()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_COOPERATIVE;
}
CONTRACTL_END;
DWORD dwSwitchCount = 0;
for (;;)
{
AwareLock::LeaveHelperAction action = LeaveObjMonitorHelper(GetThread());
switch(action)
{
case AwareLock::LeaveHelperAction_None:
// We are done
return TRUE;
case AwareLock::LeaveHelperAction_Signal:
{
// Signal the event
SyncBlock *psb = PassiveGetSyncBlock();
if (psb != NULL)
psb->QuickGetMonitor()->Signal();
}
return TRUE;
case AwareLock::LeaveHelperAction_Yield:
YieldProcessorNormalized();
continue;
case AwareLock::LeaveHelperAction_Contention:
// Some thread is updating the syncblock value.
//
// We never toggle GC mode while holding the spinlock (BeginNoTriggerGC/EndNoTriggerGC
// in EnterSpinLock/ReleaseSpinLock ensures it). Thus we do not need to switch to preemptive
// while waiting on the spinlock.
//
{
__SwitchToThread(0, ++dwSwitchCount);
}
continue;
default:
// Must be an error otherwise - ignore it
_ASSERTE(action == AwareLock::LeaveHelperAction_Error);
return FALSE;
}
}
}
#endif //!DACCESS_COMPILE
// Returns TRUE if the lock is owned and FALSE otherwise
// threadId is set to the ID (Thread::GetThreadId()) of the thread which owns the lock
// acquisitionCount is set to the number of times the lock needs to be released before
// it is unowned
BOOL ObjHeader::GetThreadOwningMonitorLock(DWORD *pThreadId, DWORD *pAcquisitionCount)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
#ifndef DACCESS_COMPILE
if (!IsGCSpecialThread ()) {MODE_COOPERATIVE;} else {MODE_ANY;}
#endif
}
CONTRACTL_END;
SUPPORTS_DAC;
DWORD bits = GetBits();
if (bits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX)
{
if (bits & BIT_SBLK_IS_HASHCODE)
{
//
// This thread does not own the lock.
//
*pThreadId = 0;
*pAcquisitionCount = 0;
return FALSE;
}
else
{
//
// We have a syncblk
//
DWORD index = bits & MASK_SYNCBLOCKINDEX;
SyncBlock* psb = g_pSyncTable[(int)index].m_SyncBlock;
_ASSERTE(psb->GetMonitor() != NULL);
Thread* pThread = psb->GetMonitor()->GetHoldingThread();
if(pThread == NULL)
{
*pThreadId = 0;
*pAcquisitionCount = 0;
return FALSE;
}
else
{
*pThreadId = pThread->GetThreadId();
*pAcquisitionCount = psb->GetMonitor()->GetRecursionLevel();
return TRUE;
}
}
}
else
{
//
// We have a thinlock
//
DWORD lockThreadId, recursionLevel;
lockThreadId = bits & SBLK_MASK_LOCK_THREADID;
recursionLevel = (bits & SBLK_MASK_LOCK_RECLEVEL) >> SBLK_RECLEVEL_SHIFT;
//if thread ID is 0, recursionLevel got to be zero
//but thread ID doesn't have to be valid because the lock could be orphanend
_ASSERTE (lockThreadId != 0 || recursionLevel == 0 );
*pThreadId = lockThreadId;
if(lockThreadId != 0)
{
// in the header, the recursionLevel of 0 means the lock is owned once
// (this differs from m_Recursion in the AwareLock)
*pAcquisitionCount = recursionLevel + 1;
return TRUE;
}
else
{
*pAcquisitionCount = 0;
return FALSE;
}
}
}
#ifndef DACCESS_COMPILE
#ifdef MP_LOCKS
DEBUG_NOINLINE void ObjHeader::EnterSpinLock()
{
// NOTE: This function cannot have a dynamic contract. If it does, the contract's
// destructor will reset the CLR debug state to what it was before entering the
// function, which will undo the BeginNoTriggerGC() call below.
SCAN_SCOPE_BEGIN;
STATIC_CONTRACT_GC_NOTRIGGER;
#ifdef _DEBUG
int i = 0;
#endif
DWORD dwSwitchCount = 0;
while (TRUE)
{
#ifdef _DEBUG
#ifdef HOST_64BIT
// Give 64bit more time because there isn't a remoting fast path now, and we've hit this assert
// needlessly in CLRSTRESS.
if (i++ > 30000)
#else
if (i++ > 10000)
#endif // HOST_64BIT
_ASSERTE(!"ObjHeader::EnterLock timed out");
#endif
// get the value so that it doesn't get changed under us.
LONG curValue = m_SyncBlockValue.LoadWithoutBarrier();
// check if lock taken
if (! (curValue & BIT_SBLK_SPIN_LOCK))
{
// try to take the lock
LONG newValue = curValue | BIT_SBLK_SPIN_LOCK;
LONG result = FastInterlockCompareExchange((LONG*)&m_SyncBlockValue, newValue, curValue);
if (result == curValue)
break;
}
if (g_SystemInfo.dwNumberOfProcessors > 1)
{
for (int spinCount = 0; spinCount < BIT_SBLK_SPIN_COUNT; spinCount++)
{
if (! (m_SyncBlockValue & BIT_SBLK_SPIN_LOCK))
break;
YieldProcessorNormalized(); // indicate to the processor that we are spinning
}
if (m_SyncBlockValue & BIT_SBLK_SPIN_LOCK)
__SwitchToThread(0, ++dwSwitchCount);
}
else
__SwitchToThread(0, ++dwSwitchCount);
}
INCONTRACT(Thread* pThread = GetThreadNULLOk());
INCONTRACT(if (pThread != NULL) pThread->BeginNoTriggerGC(__FILE__, __LINE__));
}
#else
DEBUG_NOINLINE void ObjHeader::EnterSpinLock()
{
SCAN_SCOPE_BEGIN;
STATIC_CONTRACT_GC_NOTRIGGER;
#ifdef _DEBUG
int i = 0;
#endif
DWORD dwSwitchCount = 0;
while (TRUE)
{
#ifdef _DEBUG
if (i++ > 10000)
_ASSERTE(!"ObjHeader::EnterLock timed out");
#endif
// get the value so that it doesn't get changed under us.
LONG curValue = m_SyncBlockValue.LoadWithoutBarrier();
// check if lock taken
if (! (curValue & BIT_SBLK_SPIN_LOCK))
{
// try to take the lock
LONG newValue = curValue | BIT_SBLK_SPIN_LOCK;
LONG result = FastInterlockCompareExchange((LONG*)&m_SyncBlockValue, newValue, curValue);
if (result == curValue)
break;
}
__SwitchToThread(0, ++dwSwitchCount);
}
INCONTRACT(Thread* pThread = GetThreadNULLOk());
INCONTRACT(if (pThread != NULL) pThread->BeginNoTriggerGC(__FILE__, __LINE__));
}
#endif //MP_LOCKS
DEBUG_NOINLINE void ObjHeader::ReleaseSpinLock()
{
SCAN_SCOPE_END;
LIMITED_METHOD_CONTRACT;
INCONTRACT(Thread* pThread = GetThreadNULLOk());
INCONTRACT(if (pThread != NULL) pThread->EndNoTriggerGC());
FastInterlockAnd(&m_SyncBlockValue, ~BIT_SBLK_SPIN_LOCK);
}
#endif //!DACCESS_COMPILE
#ifndef DACCESS_COMPILE
DWORD ObjHeader::GetSyncBlockIndex()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
DWORD indx;
if ((indx = GetHeaderSyncBlockIndex()) == 0)
{
BOOL fMustCreateSyncBlock = FALSE;
{
//Need to get it from the cache
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
//Try one more time
if (GetHeaderSyncBlockIndex() == 0)
{
ENTER_SPIN_LOCK(this);
// Now the header will be stable - check whether hashcode, appdomain index or lock information is stored in it.
DWORD bits = GetBits();
if (((bits & (BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | BIT_SBLK_IS_HASHCODE)) == (BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | BIT_SBLK_IS_HASHCODE)) ||
((bits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX) == 0))
{
// Need a sync block to store this info
fMustCreateSyncBlock = TRUE;
}
else
{
SetIndex(BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | SyncBlockCache::GetSyncBlockCache()->NewSyncBlockSlot(GetBaseObject()));
}
LEAVE_SPIN_LOCK(this);
}
// SyncBlockCache::LockHolder goes out of scope here
}
if (fMustCreateSyncBlock)
GetSyncBlock();
if ((indx = GetHeaderSyncBlockIndex()) == 0)
COMPlusThrowOM();
}
return indx;
}
#if defined (VERIFY_HEAP)
BOOL ObjHeader::Validate (BOOL bVerifySyncBlkIndex)
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_MODE_COOPERATIVE;
DWORD bits = GetBits ();
Object * obj = GetBaseObject ();
BOOL bVerifyMore = g_pConfig->GetHeapVerifyLevel() & EEConfig::HEAPVERIFY_SYNCBLK;
//the highest 2 bits have reloaded meaning
// BIT_UNUSED 0x80000000
// BIT_SBLK_FINALIZER_RUN 0x40000000
if (bits & BIT_SBLK_FINALIZER_RUN)
{
ASSERT_AND_CHECK (obj->GetGCSafeMethodTable ()->HasFinalizer ());
}
//BIT_SBLK_GC_RESERVE (0x20000000) is only set during GC. But for frozen object, we don't clean the bit
if (bits & BIT_SBLK_GC_RESERVE)
{
if (!GCHeapUtilities::IsGCInProgress () && !GCHeapUtilities::GetGCHeap()->IsConcurrentGCInProgress ())
{
#ifdef FEATURE_BASICFREEZE
ASSERT_AND_CHECK (GCHeapUtilities::GetGCHeap()->IsInFrozenSegment(obj));
#else //FEATURE_BASICFREEZE
_ASSERTE(!"Reserve bit not cleared");
return FALSE;
#endif //FEATURE_BASICFREEZE
}
}
//Don't know how to verify BIT_SBLK_SPIN_LOCK (0x10000000)
//BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX (0x08000000)
if (bits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX)
{
//if BIT_SBLK_IS_HASHCODE (0x04000000) is not set,
//rest of the DWORD is SyncBlk Index
if (!(bits & BIT_SBLK_IS_HASHCODE))
{
if (bVerifySyncBlkIndex && GCHeapUtilities::GetGCHeap()->RuntimeStructuresValid ())
{
DWORD sbIndex = bits & MASK_SYNCBLOCKINDEX;
ASSERT_AND_CHECK(SyncTableEntry::GetSyncTableEntry()[sbIndex].m_Object == obj);
}
}
else
{
// rest of the DWORD is a hash code and we don't have much to validate it
}
}
else
{
//if BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX is clear, rest of DWORD is thin lock thread ID,
//thin lock recursion level and appdomain index
DWORD lockThreadId = bits & SBLK_MASK_LOCK_THREADID;
DWORD recursionLevel = (bits & SBLK_MASK_LOCK_RECLEVEL) >> SBLK_RECLEVEL_SHIFT;
//if thread ID is 0, recursionLeve got to be zero
//but thread ID doesn't have to be valid because the lock could be orphanend
ASSERT_AND_CHECK (lockThreadId != 0 || recursionLevel == 0 );
}
return TRUE;
}
#endif //VERIFY_HEAP
// This holder takes care of the SyncBlock memory cleanup if an OOM occurs inside a call to NewSyncBlockSlot.
//
// Warning: Assumes you already own the cache lock.
// Assumes nothing allocated inside the SyncBlock (only releases the memory, does not destruct.)
//
// This holder really just meets GetSyncBlock()'s special needs. It's not a general purpose holder.
// Do not inline this call. (fyuan)
// SyncBlockMemoryHolder is normally a check for empty pointer and return. Inlining VoidDeleteSyncBlockMemory adds expensive exception handling.
void VoidDeleteSyncBlockMemory(SyncBlock* psb)
{
LIMITED_METHOD_CONTRACT;
SyncBlockCache::GetSyncBlockCache()->DeleteSyncBlockMemory(psb);
}
typedef Wrapper<SyncBlock*, DoNothing<SyncBlock*>, VoidDeleteSyncBlockMemory, NULL> SyncBlockMemoryHolder;
// get the sync block for an existing object
SyncBlock *ObjHeader::GetSyncBlock()
{
CONTRACT(SyncBlock *)
{
INSTANCE_CHECK;
THROWS;
GC_NOTRIGGER;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
POSTCONDITION(CheckPointer(RETVAL));
}
CONTRACT_END;
PTR_SyncBlock syncBlock = GetBaseObject()->PassiveGetSyncBlock();
DWORD indx = 0;
BOOL indexHeld = FALSE;
if (syncBlock)
{
#ifdef _DEBUG
// Has our backpointer been correctly updated through every GC?
PTR_SyncTableEntry pEntries(SyncTableEntry::GetSyncTableEntry());
_ASSERTE(pEntries[GetHeaderSyncBlockIndex()].m_Object == GetBaseObject());
#endif // _DEBUG
RETURN syncBlock;
}
//Need to get it from the cache
{
SyncBlockCache::LockHolder lh(SyncBlockCache::GetSyncBlockCache());
//Try one more time
syncBlock = GetBaseObject()->PassiveGetSyncBlock();
if (syncBlock)
RETURN syncBlock;
SyncBlockMemoryHolder syncBlockMemoryHolder(SyncBlockCache::GetSyncBlockCache()->GetNextFreeSyncBlock());
syncBlock = syncBlockMemoryHolder;
if ((indx = GetHeaderSyncBlockIndex()) == 0)
{
indx = SyncBlockCache::GetSyncBlockCache()->NewSyncBlockSlot(GetBaseObject());
}
else
{
//We already have an index, we need to hold the syncblock
indexHeld = TRUE;
}
{
//! NewSyncBlockSlot has side-effects that we don't have backout for - thus, that must be the last
//! failable operation called.
CANNOTTHROWCOMPLUSEXCEPTION();
FAULT_FORBID();
syncBlockMemoryHolder.SuppressRelease();
new (syncBlock) SyncBlock(indx);
{
// after this point, nobody can update the index in the header
ENTER_SPIN_LOCK(this);
{
// If the thin lock in the header is in use, transfer the information to the syncblock
DWORD bits = GetBits();
if ((bits & BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX) == 0)
{
DWORD lockThreadId = bits & SBLK_MASK_LOCK_THREADID;
DWORD recursionLevel = (bits & SBLK_MASK_LOCK_RECLEVEL) >> SBLK_RECLEVEL_SHIFT;
if (lockThreadId != 0 || recursionLevel != 0)
{
// recursionLevel can't be non-zero if thread id is 0
_ASSERTE(lockThreadId != 0);
Thread *pThread = g_pThinLockThreadIdDispenser->IdToThreadWithValidation(lockThreadId);
if (pThread == NULL)
{
// The lock is orphaned.
pThread = (Thread*) -1;
}
syncBlock->InitState(recursionLevel + 1, pThread);
}
}
else if ((bits & BIT_SBLK_IS_HASHCODE) != 0)
{
DWORD hashCode = bits & MASK_HASHCODE;
syncBlock->SetHashCode(hashCode);
}
}
SyncTableEntry::GetSyncTableEntry() [indx].m_SyncBlock = syncBlock;
// in order to avoid a race where some thread tries to get the AD index and we've already zapped it,
// make sure the syncblock etc is all setup with the AD index prior to replacing the index
// in the header
if (GetHeaderSyncBlockIndex() == 0)
{
// We have transferred the AppDomain into the syncblock above.
SetIndex(BIT_SBLK_IS_HASH_OR_SYNCBLKINDEX | indx);
}
//If we had already an index, hold the syncblock
//for the lifetime of the object.
if (indexHeld)
syncBlock->SetPrecious();
LEAVE_SPIN_LOCK(this);
}
// SyncBlockCache::LockHolder goes out of scope here
}
}
RETURN syncBlock;
}
BOOL ObjHeader::Wait(INT32 timeOut)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
// The following code may cause GC, so we must fetch the sync block from
// the object now in case it moves.
SyncBlock *pSB = GetBaseObject()->GetSyncBlock();
// GetSyncBlock throws on failure
_ASSERTE(pSB != NULL);
// make sure we own the crst
if (!pSB->DoesCurrentThreadOwnMonitor())
COMPlusThrow(kSynchronizationLockException);
return pSB->Wait(timeOut);
}
void ObjHeader::Pulse()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
// The following code may cause GC, so we must fetch the sync block from
// the object now in case it moves.
SyncBlock *pSB = GetBaseObject()->GetSyncBlock();
// GetSyncBlock throws on failure
_ASSERTE(pSB != NULL);
// make sure we own the crst
if (!pSB->DoesCurrentThreadOwnMonitor())
COMPlusThrow(kSynchronizationLockException);
pSB->Pulse();
}
void ObjHeader::PulseAll()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
// The following code may cause GC, so we must fetch the sync block from
// the object now in case it moves.
SyncBlock *pSB = GetBaseObject()->GetSyncBlock();
// GetSyncBlock throws on failure
_ASSERTE(pSB != NULL);
// make sure we own the crst
if (!pSB->DoesCurrentThreadOwnMonitor())
COMPlusThrow(kSynchronizationLockException);
pSB->PulseAll();
}
// ***************************************************************************
//
// AwareLock class implementation (GC-aware locking)
//
// ***************************************************************************
void AwareLock::AllocLockSemEvent()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
// Before we switch from cooperative, ensure that this syncblock won't disappear
// under us. For something as expensive as an event, do it permanently rather
// than transiently.
SetPrecious();
GCX_PREEMP();
// No need to take a lock - CLREvent::CreateMonitorEvent is thread safe
m_SemEvent.CreateMonitorEvent((SIZE_T)this);
}
void AwareLock::Enter()
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
Thread *pCurThread = GetThread();
LockState state = m_lockState.VolatileLoadWithoutBarrier();
if (!state.IsLocked() || m_HoldingThread != pCurThread)
{
if (m_lockState.InterlockedTryLock_Or_RegisterWaiter(this, state))
{
// We get here if we successfully acquired the mutex.
m_HoldingThread = pCurThread;
m_Recursion = 1;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP
? (int)pFrame->GetReturnAddress()
: -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
return;
}
// Lock was not acquired and the waiter was registered
// Didn't manage to get the mutex, must wait.
// The precondition for EnterEpilog is that the count of waiters be bumped
// to account for this thread, which was done above.
EnterEpilog(pCurThread);
return;
}
// Got the mutex via recursive locking on the same thread.
_ASSERTE(m_Recursion >= 1);
m_Recursion++;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP ? (int)pFrame->GetReturnAddress() : -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
}
BOOL AwareLock::TryEnter(INT32 timeOut)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
if (timeOut == 0) {MODE_ANY;} else {MODE_COOPERATIVE;}
INJECT_FAULT(COMPlusThrowOM(););
}
CONTRACTL_END;
Thread *pCurThread = GetThread();
if (pCurThread->IsAbortRequested())
{
pCurThread->HandleThreadAbort();
}
LockState state = m_lockState.VolatileLoadWithoutBarrier();
if (!state.IsLocked() || m_HoldingThread != pCurThread)
{
if (timeOut == 0
? m_lockState.InterlockedTryLock(state)
: m_lockState.InterlockedTryLock_Or_RegisterWaiter(this, state))
{
// We get here if we successfully acquired the mutex.
m_HoldingThread = pCurThread;
m_Recursion = 1;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP ? (int)pFrame->GetReturnAddress() : -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
return true;
}
// Lock was not acquired and the waiter was registered if the timeout is nonzero
// Didn't manage to get the mutex, return failure if no timeout, else wait
// for at most timeout milliseconds for the mutex.
if (timeOut == 0)
{
return false;
}
// The precondition for EnterEpilog is that the count of waiters be bumped
// to account for this thread, which was done above
return EnterEpilog(pCurThread, timeOut);
}
// Got the mutex via recursive locking on the same thread.
_ASSERTE(m_Recursion >= 1);
m_Recursion++;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP ? (int)pFrame->GetReturnAddress() : -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
return true;
}
BOOL AwareLock::EnterEpilog(Thread* pCurThread, INT32 timeOut)
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_MODE_COOPERATIVE;
STATIC_CONTRACT_GC_TRIGGERS;
// While we are in this frame the thread is considered blocked on the
// critical section of the monitor lock according to the debugger
DebugBlockingItem blockingMonitorInfo;
blockingMonitorInfo.dwTimeout = timeOut;
blockingMonitorInfo.pMonitor = this;
blockingMonitorInfo.pAppDomain = SystemDomain::GetCurrentDomain();
blockingMonitorInfo.type = DebugBlock_MonitorCriticalSection;
DebugBlockingItemHolder holder(pCurThread, &blockingMonitorInfo);
// We need a separate helper because it uses SEH and the holder has a
// destructor
return EnterEpilogHelper(pCurThread, timeOut);
}
#ifdef _DEBUG
#define _LOGCONTENTION
#endif // _DEBUG
#ifdef _LOGCONTENTION
inline void LogContention()
{
WRAPPER_NO_CONTRACT;
#ifdef LOGGING
if (LoggingOn(LF_SYNC, LL_INFO100))
{
LogSpewAlways("Contention: Stack Trace Begin\n");
void LogStackTrace();
LogStackTrace();
LogSpewAlways("Contention: Stack Trace End\n");
}
#endif
}
#else
#define LogContention()
#endif
double ComputeElapsedTimeInNanosecond(LARGE_INTEGER startTicks, LARGE_INTEGER endTicks)
{
static LARGE_INTEGER freq;
if (freq.QuadPart == 0)
QueryPerformanceFrequency(&freq);
const double NsPerSecond = 1000 * 1000 * 1000;
LONGLONG elapsedTicks = endTicks.QuadPart - startTicks.QuadPart;
return (elapsedTicks * NsPerSecond) / freq.QuadPart;
}
BOOL AwareLock::EnterEpilogHelper(Thread* pCurThread, INT32 timeOut)
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_MODE_COOPERATIVE;
STATIC_CONTRACT_GC_TRIGGERS;
// IMPORTANT!!!
// The caller has already registered a waiter. This function needs to unregister the waiter on all paths (exception paths
// included). On runtimes where thread-abort is supported, a thread-abort also needs to unregister the waiter. There may be
// a possibility for preemptive GC toggles below to handle a thread-abort, that should be taken into consideration when
// porting this code back to .NET Framework.
// Require all callers to be in cooperative mode. If they have switched to preemptive
// mode temporarily before calling here, then they are responsible for protecting
// the object associated with this lock.
_ASSERTE(pCurThread->PreemptiveGCDisabled());
BOOLEAN IsContentionKeywordEnabled = ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context, TRACE_LEVEL_INFORMATION, CLR_CONTENTION_KEYWORD);
LARGE_INTEGER startTicks = { {0} };
if (IsContentionKeywordEnabled)
{
QueryPerformanceCounter(&startTicks);
// Fire a contention start event for a managed contention
FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId());
}
LogContention();
Thread::IncrementMonitorLockContentionCount(pCurThread);
OBJECTREF obj = GetOwningObject();
// We cannot allow the AwareLock to be cleaned up underneath us by the GC.
IncrementTransientPrecious();
DWORD ret;
GCPROTECT_BEGIN(obj);
{
if (!m_SemEvent.IsMonitorEventAllocated())
{
AllocLockSemEvent();
}
_ASSERTE(m_SemEvent.IsMonitorEventAllocated());
pCurThread->EnablePreemptiveGC();
for (;;)
{
// Measure the time we wait so that, in the case where we wake up
// and fail to acquire the mutex, we can adjust remaining timeout
// accordingly.
ULONGLONG start = CLRGetTickCount64();
// It is likely the case that An APC threw an exception, for instance Thread.Interrupt(). The wait subsystem
// guarantees that if a signal to the event being waited upon is observed by the woken thread, that thread's
// wait will return WAIT_OBJECT_0. So in any race between m_SemEvent being signaled and the wait throwing an
// exception, a thread that is woken by an exception would not observe the signal, and the signal would wake
// another thread as necessary.
// We must decrement the waiter count in the case an exception happened. This holder takes care of that
class UnregisterWaiterHolder
{
LockState* m_pLockState;
public:
UnregisterWaiterHolder(LockState* pLockState) : m_pLockState(pLockState)
{
}
~UnregisterWaiterHolder()
{
if (m_pLockState != NULL)
{
m_pLockState->InterlockedUnregisterWaiter();
}
}
void SuppressRelease()
{
m_pLockState = NULL;
}
} unregisterWaiterHolder(&m_lockState);
ret = m_SemEvent.Wait(timeOut, TRUE);
_ASSERTE((ret == WAIT_OBJECT_0) || (ret == WAIT_TIMEOUT));
if (ret != WAIT_OBJECT_0)
{
// We timed out
// (the holder unregisters the waiter here)
break;
}
unregisterWaiterHolder.SuppressRelease();
// Spin a bit while trying to acquire the lock. This has a few benefits:
// - Spinning helps to reduce waiter starvation. Since other non-waiter threads can take the lock while there are
// waiters (see LockState::InterlockedTryLock()), once a waiter wakes it will be able to better compete
// with other spinners for the lock.
// - If there is another thread that is repeatedly acquiring and releasing the lock, spinning before waiting again
// helps to prevent a waiter from repeatedly context-switching in and out
// - Further in the same situation above, waking up and waiting shortly thereafter deprioritizes this waiter because
// events release waiters in FIFO order. Spinning a bit helps a waiter to retain its priority at least for one
// spin duration before it gets deprioritized behind all other waiters.
if (g_SystemInfo.dwNumberOfProcessors > 1)
{
bool acquiredLock = false;
YieldProcessorNormalizationInfo normalizationInfo;
const DWORD spinCount = g_SpinConstants.dwMonitorSpinCount;
for (DWORD spinIteration = 0; spinIteration < spinCount; ++spinIteration)
{
if (m_lockState.InterlockedTry_LockAndUnregisterWaiterAndObserveWakeSignal(this))
{
acquiredLock = true;
break;
}
SpinWait(normalizationInfo, spinIteration);
}
if (acquiredLock)
{
break;
}
}
if (m_lockState.InterlockedObserveWakeSignal_Try_LockAndUnregisterWaiter(this))
{
break;
}
// When calculating duration we consider a couple of special cases.
// If the end tick is the same as the start tick we make the
// duration a millisecond, to ensure we make forward progress if
// there's a lot of contention on the mutex. Secondly, we have to
// cope with the case where the tick counter wrapped while we where
// waiting (we can cope with at most one wrap, so don't expect three
// month timeouts to be very accurate). Luckily for us, the latter
// case is taken care of by 32-bit modulo arithmetic automatically.
if (timeOut != (INT32)INFINITE)
{
ULONGLONG end = CLRGetTickCount64();
ULONGLONG duration;
if (end == start)
{
duration = 1;
}
else
{
duration = end - start;
}
duration = min(duration, (DWORD)timeOut);
timeOut -= (INT32)duration;
}
}
pCurThread->DisablePreemptiveGC();
}
GCPROTECT_END();
DecrementTransientPrecious();
if (IsContentionKeywordEnabled)
{
LARGE_INTEGER endTicks;
QueryPerformanceCounter(&endTicks);
double elapsedTimeInNanosecond = ComputeElapsedTimeInNanosecond(startTicks, endTicks);
// Fire a contention end event for a managed contention
FireEtwContentionStop_V1(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId(), elapsedTimeInNanosecond);
}
if (ret == WAIT_TIMEOUT)
{
return false;
}
m_HoldingThread = pCurThread;
m_Recursion = 1;
#if defined(_DEBUG) && defined(TRACK_SYNC)
// The best place to grab this is from the ECall frame
Frame *pFrame = pCurThread->GetFrame();
int caller = (pFrame && pFrame != FRAME_TOP ? (int)pFrame->GetReturnAddress() : -1);
pCurThread->m_pTrackSync->EnterSync(caller, this);
#endif
return true;
}
BOOL AwareLock::Leave()
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
Thread* pThread = GetThread();
AwareLock::LeaveHelperAction action = LeaveHelper(pThread);
switch(action)
{
case AwareLock::LeaveHelperAction_None:
// We are done
return TRUE;
case AwareLock::LeaveHelperAction_Signal:
// Signal the event
Signal();
return TRUE;
default:
// Must be an error otherwise
_ASSERTE(action == AwareLock::LeaveHelperAction_Error);
return FALSE;
}
}
LONG AwareLock::LeaveCompletely()
{
WRAPPER_NO_CONTRACT;
LONG count = 0;
while (Leave()) {
count++;
}
_ASSERTE(count > 0); // otherwise we were never in the lock
return count;
}
BOOL AwareLock::OwnedByCurrentThread()
{
WRAPPER_NO_CONTRACT;
return (GetThread() == m_HoldingThread);
}
// ***************************************************************************
//
// SyncBlock class implementation
//
// ***************************************************************************
// We maintain two queues for SyncBlock::Wait.
// 1. Inside SyncBlock we queue all threads that are waiting on the SyncBlock.
// When we pulse, we pick the thread from this queue using FIFO.
// 2. We queue all SyncBlocks that a thread is waiting for in Thread::m_WaitEventLink.
// When we pulse a thread, we find the event from this queue to set, and we also
// or in a 1 bit in the syncblock value saved in the queue, so that we can return
// immediately from SyncBlock::Wait if the syncblock has been pulsed.
BOOL SyncBlock::Wait(INT32 timeOut)
{
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END;
Thread *pCurThread = GetThread();
BOOL isTimedOut = FALSE;
BOOL isEnqueued = FALSE;
WaitEventLink waitEventLink;
WaitEventLink *pWaitEventLink;
// As soon as we flip the switch, we are in a race with the GC, which could clean
// up the SyncBlock underneath us -- unless we report the object.
_ASSERTE(pCurThread->PreemptiveGCDisabled());
// Does this thread already wait for this SyncBlock?
WaitEventLink *walk = pCurThread->WaitEventLinkForSyncBlock(this);
if (walk->m_Next) {
if (walk->m_Next->m_WaitSB == this) {
// Wait on the same lock again.
walk->m_Next->m_RefCount ++;
pWaitEventLink = walk->m_Next;
}
else if ((SyncBlock*)(((DWORD_PTR)walk->m_Next->m_WaitSB) & ~1)== this) {
// This thread has been pulsed. No need to wait.
return TRUE;
}
}
else {
// First time this thread is going to wait for this SyncBlock.
CLREvent* hEvent;
if (pCurThread->m_WaitEventLink.m_Next == NULL) {
hEvent = &(pCurThread->m_EventWait);
}
else {
hEvent = GetEventFromEventStore();
}
waitEventLink.m_WaitSB = this;
waitEventLink.m_EventWait = hEvent;
waitEventLink.m_Thread = pCurThread;
waitEventLink.m_Next = NULL;
waitEventLink.m_LinkSB.m_pNext = NULL;
waitEventLink.m_RefCount = 1;
pWaitEventLink = &waitEventLink;
walk->m_Next = pWaitEventLink;
// Before we enqueue it (and, thus, before it can be dequeued), reset the event
// that will awaken us.
hEvent->Reset();
// This thread is now waiting on this sync block
ThreadQueue::EnqueueThread(pWaitEventLink, this);
isEnqueued = TRUE;
}
_ASSERTE ((SyncBlock*)((DWORD_PTR)walk->m_Next->m_WaitSB & ~1)== this);
PendingSync syncState(walk);
OBJECTREF obj = m_Monitor.GetOwningObject();
m_Monitor.IncrementTransientPrecious();
// While we are in this frame the thread is considered blocked on the
// event of the monitor lock according to the debugger
DebugBlockingItem blockingMonitorInfo;
blockingMonitorInfo.dwTimeout = timeOut;
blockingMonitorInfo.pMonitor = &m_Monitor;
blockingMonitorInfo.pAppDomain = SystemDomain::GetCurrentDomain();
blockingMonitorInfo.type = DebugBlock_MonitorEvent;
DebugBlockingItemHolder holder(pCurThread, &blockingMonitorInfo);
GCPROTECT_BEGIN(obj);
{
GCX_PREEMP();
// remember how many times we synchronized
syncState.m_EnterCount = LeaveMonitorCompletely();
_ASSERTE(syncState.m_EnterCount > 0);
isTimedOut = pCurThread->Block(timeOut, &syncState);
}
GCPROTECT_END();
m_Monitor.DecrementTransientPrecious();
return !isTimedOut;
}
void SyncBlock::Pulse()
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
WaitEventLink *pWaitEventLink;
if ((pWaitEventLink = ThreadQueue::DequeueThread(this)) != NULL)
pWaitEventLink->m_EventWait->Set();
}
void SyncBlock::PulseAll()
{
CONTRACTL
{
INSTANCE_CHECK;
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
}
CONTRACTL_END;
WaitEventLink *pWaitEventLink;
while ((pWaitEventLink = ThreadQueue::DequeueThread(this)) != NULL)
pWaitEventLink->m_EventWait->Set();
}
bool SyncBlock::SetInteropInfo(InteropSyncBlockInfo* pInteropInfo)
{
WRAPPER_NO_CONTRACT;
SetPrecious();
// We could be agile, but not have noticed yet. We can't assert here
// that we live in any given domain, nor is this an appropriate place
// to re-parent the syncblock.
/* _ASSERTE (m_dwAppDomainIndex.m_dwIndex == 0 ||
m_dwAppDomainIndex == SystemDomain::System()->DefaultDomain()->GetIndex() ||
m_dwAppDomainIndex == GetAppDomain()->GetIndex());
m_dwAppDomainIndex = GetAppDomain()->GetIndex();
*/
return (FastInterlockCompareExchangePointer(&m_pInteropInfo,
pInteropInfo,
NULL) == NULL);
}
#ifdef EnC_SUPPORTED
// Store information about fields added to this object by EnC
// This must be called from a thread in the AppDomain of this object instance
void SyncBlock::SetEnCInfo(EnCSyncBlockInfo *pEnCInfo)
{
WRAPPER_NO_CONTRACT;
// We can't recreate the field contents, so this SyncBlock can never go away
SetPrecious();
// Store the field info (should only ever happen once)
_ASSERTE( m_pEnCInfo == NULL );
m_pEnCInfo = pEnCInfo;
}
#endif // EnC_SUPPORTED
#endif // !DACCESS_COMPILE
#if defined(HOST_64BIT) && defined(_DEBUG)
void ObjHeader::IllegalAlignPad()
{
WRAPPER_NO_CONTRACT;
#ifdef LOGGING
void** object = ((void**) this) + 1;
LogSpewAlways("\n\n******** Illegal ObjHeader m_alignpad not 0, object" FMT_ADDR "\n\n",
DBG_ADDR(object));
#endif
_ASSERTE(m_alignpad == 0);
}
#endif // HOST_64BIT && _DEBUG
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/debug_api/WriteProcessMemory/test4/helper.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================
**
** Source: helper.c
**
** Purpose: This helper process sets up a block of memory, then
** raises an exception to pass that memory location back to the
** parent process. When the parent process is done calling WriteProcessMemory
** we check here that it was written properly.
**
**
**============================================================*/
#include <palsuite.h>
const int MY_EXCEPTION=999;
PALTEST(debug_api_WriteProcessMemory_test4_paltest_writeprocessmemory_test4_helper, "debug_api/WriteProcessMemory/test4/paltest_writeprocessmemory_test4_helper")
{
char* Memory;
char* TheArray[1];
int i;
if(0 != (PAL_Initialize(argc, argv)))
{
return FAIL;
}
Memory = (char*)VirtualAlloc(NULL, 4096, MEM_COMMIT, PAGE_READONLY);
if(Memory == NULL)
{
Fail("ERROR: Attempted to allocate two pages, but the VirtualAlloc "
"call failed. GetLastError() returned %d.\n",GetLastError());
}
TheArray[0] = Memory;
/* Need to sleep for a couple seconds. Otherwise this process
won't be being debugged when the first exception is raised.
*/
Sleep(4000);
RaiseException(MY_EXCEPTION, 0, 1, (ULONG_PTR*)TheArray);
for(i=0; i<4096; ++i)
{
if(Memory[i] != '\0')
{
Fail("ERROR: The memory should be unchanged after the "
"invalid call to WriteProcessMemory, but the char "
"at index %d has changed.\n",i);
}
}
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================
**
** Source: helper.c
**
** Purpose: This helper process sets up a block of memory, then
** raises an exception to pass that memory location back to the
** parent process. When the parent process is done calling WriteProcessMemory
** we check here that it was written properly.
**
**
**============================================================*/
#include <palsuite.h>
const int MY_EXCEPTION=999;
PALTEST(debug_api_WriteProcessMemory_test4_paltest_writeprocessmemory_test4_helper, "debug_api/WriteProcessMemory/test4/paltest_writeprocessmemory_test4_helper")
{
char* Memory;
char* TheArray[1];
int i;
if(0 != (PAL_Initialize(argc, argv)))
{
return FAIL;
}
Memory = (char*)VirtualAlloc(NULL, 4096, MEM_COMMIT, PAGE_READONLY);
if(Memory == NULL)
{
Fail("ERROR: Attempted to allocate two pages, but the VirtualAlloc "
"call failed. GetLastError() returned %d.\n",GetLastError());
}
TheArray[0] = Memory;
/* Need to sleep for a couple seconds. Otherwise this process
won't be being debugged when the first exception is raised.
*/
Sleep(4000);
RaiseException(MY_EXCEPTION, 0, 1, (ULONG_PTR*)TheArray);
for(i=0; i<4096; ++i)
{
if(Memory[i] != '\0')
{
Fail("ERROR: The memory should be unchanged after the "
"invalid call to WriteProcessMemory, but the char "
"at index %d has changed.\n",i);
}
}
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/vm/amd64/excepcpu.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
//
// EXCEPCPU.H -
//
// This header file is included from Excep.h if the target platform is AMD64
//
#ifndef __excepamd64_h__
#define __excepamd64_h__
#include "corerror.h" // HResults for the COM+ Runtime
#include "../dlls/mscorrc/resource.h"
class FaultingExceptionFrame;
#define THROW_CONTROL_FOR_THREAD_FUNCTION RedirectForThrowControl
EXTERN_C void RedirectForThrowControl();
#define STATUS_CLR_GCCOVER_CODE STATUS_PRIVILEGED_INSTRUCTION
//
// No FS:0, nothing to do.
//
#define INSTALL_EXCEPTION_HANDLING_RECORD(record)
#define UNINSTALL_EXCEPTION_HANDLING_RECORD(record)
//
// On Win64, the COMPlusFrameHandler's work is done by our personality routine.
//
#define DECLARE_CPFH_EH_RECORD(pCurThread)
//
// Retrieves the redirected CONTEXT* from the stack frame of one of the
// RedirectedHandledJITCaseForXXX_Stub's.
//
PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(DISPATCHER_CONTEXT * pDispatcherContext);
PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(CONTEXT * pContext);
//
// Retrieves the FaultingExceptionFrame* from the stack frame of
// RedirectForThrowControl or NakedThrowHelper.
//
FaultingExceptionFrame *GetFrameFromRedirectedStubStackFrame (DISPATCHER_CONTEXT *pDispatcherContext);
//
// Functions that wrap RtlVirtualUnwind to make sure that in the AMD64 case all the
// breakpoints have been removed from the Epilogue if RtlVirtualUnwind is going to
// try and disassemble it.
//
#if !defined(DACCESS_COMPILE)
UCHAR GetOpcodeFromManagedBPForAddress(ULONG64 Address, BOOL* HasManagedBreakpoint, BOOL* HasUnmanagedBreakpoint);
#define RtlVirtualUnwind RtlVirtualUnwind_Wrapper
PEXCEPTION_ROUTINE
RtlVirtualUnwind (
IN ULONG HandlerType,
IN ULONG64 ImageBase,
IN ULONG64 ControlPc,
IN PT_RUNTIME_FUNCTION FunctionEntry,
IN OUT PCONTEXT ContextRecord,
OUT PVOID *HandlerData,
OUT PULONG64 EstablisherFrame,
IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
);
PEXCEPTION_ROUTINE
RtlVirtualUnwind_Worker (
IN ULONG HandlerType,
IN ULONG64 ImageBase,
IN ULONG64 ControlPc,
IN PT_RUNTIME_FUNCTION FunctionEntry,
IN OUT PCONTEXT ContextRecord,
OUT PVOID *HandlerData,
OUT PULONG64 EstablisherFrame,
IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
);
#endif // !DACCESS_COMPILE
BOOL AdjustContextForVirtualStub(EXCEPTION_RECORD *pExceptionRecord, CONTEXT *pContext);
#endif // __excepamd64_h__
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
//
// EXCEPCPU.H -
//
// This header file is included from Excep.h if the target platform is AMD64
//
#ifndef __excepamd64_h__
#define __excepamd64_h__
#include "corerror.h" // HResults for the COM+ Runtime
#include "../dlls/mscorrc/resource.h"
class FaultingExceptionFrame;
#define THROW_CONTROL_FOR_THREAD_FUNCTION RedirectForThrowControl
EXTERN_C void RedirectForThrowControl();
#define STATUS_CLR_GCCOVER_CODE STATUS_PRIVILEGED_INSTRUCTION
//
// No FS:0, nothing to do.
//
#define INSTALL_EXCEPTION_HANDLING_RECORD(record)
#define UNINSTALL_EXCEPTION_HANDLING_RECORD(record)
//
// On Win64, the COMPlusFrameHandler's work is done by our personality routine.
//
#define DECLARE_CPFH_EH_RECORD(pCurThread)
//
// Retrieves the redirected CONTEXT* from the stack frame of one of the
// RedirectedHandledJITCaseForXXX_Stub's.
//
PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(DISPATCHER_CONTEXT * pDispatcherContext);
PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(CONTEXT * pContext);
//
// Retrieves the FaultingExceptionFrame* from the stack frame of
// RedirectForThrowControl or NakedThrowHelper.
//
FaultingExceptionFrame *GetFrameFromRedirectedStubStackFrame (DISPATCHER_CONTEXT *pDispatcherContext);
//
// Functions that wrap RtlVirtualUnwind to make sure that in the AMD64 case all the
// breakpoints have been removed from the Epilogue if RtlVirtualUnwind is going to
// try and disassemble it.
//
#if !defined(DACCESS_COMPILE)
UCHAR GetOpcodeFromManagedBPForAddress(ULONG64 Address, BOOL* HasManagedBreakpoint, BOOL* HasUnmanagedBreakpoint);
#define RtlVirtualUnwind RtlVirtualUnwind_Wrapper
PEXCEPTION_ROUTINE
RtlVirtualUnwind (
IN ULONG HandlerType,
IN ULONG64 ImageBase,
IN ULONG64 ControlPc,
IN PT_RUNTIME_FUNCTION FunctionEntry,
IN OUT PCONTEXT ContextRecord,
OUT PVOID *HandlerData,
OUT PULONG64 EstablisherFrame,
IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
);
PEXCEPTION_ROUTINE
RtlVirtualUnwind_Worker (
IN ULONG HandlerType,
IN ULONG64 ImageBase,
IN ULONG64 ControlPc,
IN PT_RUNTIME_FUNCTION FunctionEntry,
IN OUT PCONTEXT ContextRecord,
OUT PVOID *HandlerData,
OUT PULONG64 EstablisherFrame,
IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
);
#endif // !DACCESS_COMPILE
BOOL AdjustContextForVirtualStub(EXCEPTION_RECORD *pExceptionRecord, CONTEXT *pContext);
#endif // __excepamd64_h__
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/classlibnative/bcltype/arraynative.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// File: ArrayNative.h
//
//
// ArrayNative
// This file defines the native methods for the Array
//
#ifndef _ARRAYNATIVE_H_
#define _ARRAYNATIVE_H_
#include "fcall.h"
#include "runtimehandles.h"
struct FCALLRuntimeFieldHandle
{
ReflectFieldObject *pFieldDONOTUSEDIRECTLY;
};
#define FCALL_RFH_TO_REFLECTFIELD(x) (x).pFieldDONOTUSEDIRECTLY
class ArrayNative
{
public:
static FCDECL1(INT32, GetCorElementTypeOfElementType, ArrayBase* arrayUNSAFE);
static FCDECL1(void, Initialize, ArrayBase* pArray);
static FCDECL2(FC_BOOL_RET, IsSimpleCopy, ArrayBase* pSrc, ArrayBase* pDst);
static FCDECL5(void, CopySlow, ArrayBase* pSrc, INT32 iSrcIndex, ArrayBase* pDst, INT32 iDstIndex, INT32 iLength);
static FCDECL4(Object*, CreateInstance, ReflectClassBaseObject* pElementTypeUNSAFE, INT32 rank, INT32* pLengths, INT32* pBounds);
// This method will return a TypedReference to the array element
static FCDECL2(Object*, GetValue, ArrayBase* refThisUNSAFE, INT_PTR flattenedIndex);
// This set of methods will set a value in an array
static FCDECL3(void, SetValue, ArrayBase* refThisUNSAFE, Object* objUNSAFE, INT_PTR flattenedIndex);
// This method will initialize an array from a TypeHandle
// to a field.
static FCDECL2_IV(void, InitializeArray, ArrayBase* vArrayRef, FCALLRuntimeFieldHandle structField);
// This method will acquire data to create a span from a TypeHandle
// to a field.
static FCDECL3_VVI(void*, GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetTypeUnsafe, INT32* count);
private:
// Helper for CreateInstance
static void CheckElementType(TypeHandle elementType);
// Return values for CanAssignArrayType
enum AssignArrayEnum
{
AssignWrongType,
AssignMustCast,
AssignBoxValueClassOrPrimitive,
AssignUnboxValueClass,
AssignPrimitiveWiden,
};
// The following functions are all helpers for ArrayCopy
static AssignArrayEnum CanAssignArrayType(const BASEARRAYREF pSrc, const BASEARRAYREF pDest);
static void CastCheckEachElement(BASEARRAYREF pSrc, unsigned int srcIndex, BASEARRAYREF pDest, unsigned int destIndex, unsigned int length);
static void BoxEachElement(BASEARRAYREF pSrc, unsigned int srcIndex, BASEARRAYREF pDest, unsigned int destIndex, unsigned int length);
static void UnBoxEachElement(BASEARRAYREF pSrc, unsigned int srcIndex, BASEARRAYREF pDest, unsigned int destIndex, unsigned int length);
static void PrimitiveWiden(BASEARRAYREF pSrc, unsigned int srcIndex, BASEARRAYREF pDest, unsigned int destIndex, unsigned int length);
};
#endif // _ARRAYNATIVE_H_
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// File: ArrayNative.h
//
//
// ArrayNative
// This file defines the native methods for the Array
//
#ifndef _ARRAYNATIVE_H_
#define _ARRAYNATIVE_H_
#include "fcall.h"
#include "runtimehandles.h"
struct FCALLRuntimeFieldHandle
{
ReflectFieldObject *pFieldDONOTUSEDIRECTLY;
};
#define FCALL_RFH_TO_REFLECTFIELD(x) (x).pFieldDONOTUSEDIRECTLY
class ArrayNative
{
public:
static FCDECL1(INT32, GetCorElementTypeOfElementType, ArrayBase* arrayUNSAFE);
static FCDECL1(void, Initialize, ArrayBase* pArray);
static FCDECL2(FC_BOOL_RET, IsSimpleCopy, ArrayBase* pSrc, ArrayBase* pDst);
static FCDECL5(void, CopySlow, ArrayBase* pSrc, INT32 iSrcIndex, ArrayBase* pDst, INT32 iDstIndex, INT32 iLength);
static FCDECL4(Object*, CreateInstance, ReflectClassBaseObject* pElementTypeUNSAFE, INT32 rank, INT32* pLengths, INT32* pBounds);
// This method will return a TypedReference to the array element
static FCDECL2(Object*, GetValue, ArrayBase* refThisUNSAFE, INT_PTR flattenedIndex);
// This set of methods will set a value in an array
static FCDECL3(void, SetValue, ArrayBase* refThisUNSAFE, Object* objUNSAFE, INT_PTR flattenedIndex);
// This method will initialize an array from a TypeHandle
// to a field.
static FCDECL2_IV(void, InitializeArray, ArrayBase* vArrayRef, FCALLRuntimeFieldHandle structField);
// This method will acquire data to create a span from a TypeHandle
// to a field.
static FCDECL3_VVI(void*, GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetTypeUnsafe, INT32* count);
private:
// Helper for CreateInstance
static void CheckElementType(TypeHandle elementType);
// Return values for CanAssignArrayType
enum AssignArrayEnum
{
AssignWrongType,
AssignMustCast,
AssignBoxValueClassOrPrimitive,
AssignUnboxValueClass,
AssignPrimitiveWiden,
};
// The following functions are all helpers for ArrayCopy
static AssignArrayEnum CanAssignArrayType(const BASEARRAYREF pSrc, const BASEARRAYREF pDest);
static void CastCheckEachElement(BASEARRAYREF pSrc, unsigned int srcIndex, BASEARRAYREF pDest, unsigned int destIndex, unsigned int length);
static void BoxEachElement(BASEARRAYREF pSrc, unsigned int srcIndex, BASEARRAYREF pDest, unsigned int destIndex, unsigned int length);
static void UnBoxEachElement(BASEARRAYREF pSrc, unsigned int srcIndex, BASEARRAYREF pDest, unsigned int destIndex, unsigned int length);
static void PrimitiveWiden(BASEARRAYREF pSrc, unsigned int srcIndex, BASEARRAYREF pDest, unsigned int destIndex, unsigned int length);
};
#endif // _ARRAYNATIVE_H_
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/mono/mono/metadata/class-private-definition.h
|
/**
* \file Definitions of struct _MonoClass members
*
* NOTE: This file should NOT be included directly.
*/
#if defined(MONO_CLASS_DEF_PRIVATE) && !defined(REALLY_INCLUDE_CLASS_DEF)
#error struct _MonoClass definition should not be accessed directly
#endif
#ifndef __MONO_METADATA_CLASS_PRIVATE_DEFINITION_H__
#define __MONO_METADATA_CLASS_PRIVATE_DEFINITION_H__
struct _MonoClass {
/* element class for arrays and enum basetype for enums */
MonoClass *element_class;
/* used for subtype checks */
MonoClass *cast_class;
/* for fast subtype checks */
MonoClass **supertypes;
guint16 idepth;
/* array dimension */
guint8 rank;
/* One of the values from MonoTypeKind */
guint8 class_kind;
int instance_size; /* object instance size */
guint inited : 1;
/* A class contains static and non static data. Static data can be
* of the same type as the class itselfs, but it does not influence
* the instance size of the class. To avoid cyclic calls to
* mono_class_init_internal (from mono_class_instance_size ()) we first
* initialise all non static fields. After that we set size_inited
* to 1, because we know the instance size now. After that we
* initialise all static fields.
*/
/* ALL BITFIELDS SHOULD BE WRITTEN WHILE HOLDING THE LOADER LOCK */
guint size_inited : 1;
guint valuetype : 1; /* derives from System.ValueType */
guint enumtype : 1; /* derives from System.Enum */
guint blittable : 1; /* class is blittable */
guint unicode : 1; /* class uses unicode char when marshalled */
guint wastypebuilder : 1; /* class was created at runtime from a TypeBuilder */
guint is_array_special_interface : 1; /* gtd or ginst of once of the magic interfaces that arrays implement */
guint is_byreflike : 1; /* class is a valuetype and has System.Runtime.CompilerServices.IsByRefLikeAttribute */
/* next byte */
guint8 min_align;
/* next byte */
guint packing_size : 4;
guint ghcimpl : 1; /* class has its own GetHashCode impl */
guint has_finalize : 1; /* class has its own Finalize impl */
guint delegate : 1; /* class is a Delegate */
/* next byte */
guint gc_descr_inited : 1; /* gc_descr is initialized */
guint has_cctor : 1; /* class has a cctor */
guint has_references : 1; /* it has GC-tracked references in the instance */
guint has_ref_fields : 1; /* it has byref fields */
guint has_static_refs : 1; /* it has static fields that are GC-tracked */
guint no_special_static_fields : 1; /* has no thread/context static fields */
/* directly or indirectly derives from ComImport attributed class.
* this means we need to create a proxy for instances of this class
* for COM Interop. set this flag on loading so all we need is a quick check
* during object creation rather than having to traverse supertypes
*/
guint is_com_object : 1;
guint nested_classes_inited : 1; /* Whenever nested_class is initialized */
/* next byte*/
guint interfaces_inited : 1; /* interfaces is initialized */
guint simd_type : 1; /* class is a simd intrinsic type */
guint has_finalize_inited : 1; /* has_finalize is initialized */
guint fields_inited : 1; /* setup_fields () has finished */
guint has_failure : 1; /* See mono_class_get_exception_data () for a MonoErrorBoxed with the details */
guint has_weak_fields : 1; /* class has weak reference fields */
guint has_dim_conflicts : 1; /* Class has conflicting default interface methods */
guint any_field_has_auto_layout : 1; /* a field in this type's layout uses auto-layout */
MonoClass *parent;
MonoClass *nested_in;
MonoImage *image;
const char *name;
const char *name_space;
guint32 type_token;
int vtable_size; /* number of slots */
guint16 interface_count;
guint32 interface_id; /* unique inderface id (for interfaces) */
guint32 max_interface_id;
guint16 interface_offsets_count;
MonoClass **interfaces_packed;
guint16 *interface_offsets_packed;
guint8 *interface_bitmap;
MonoClass **interfaces;
union _MonoClassSizes sizes;
/*
* Field information: Type and location from object base
*/
MonoClassField *fields;
MonoMethod **methods;
/* used as the type of the this argument and when passing the arg by value */
MonoType this_arg;
MonoType _byval_arg;
MonoGCDescriptor gc_descr;
MonoVTable *runtime_vtable;
/* Generic vtable. Initialized by a call to mono_class_setup_vtable () */
MonoMethod **vtable;
/* Infrequently used items. See class-accessors.c: InfrequentDataKind for what goes into here. */
MonoPropertyBag infrequent_data;
};
struct _MonoClassDef {
MonoClass klass;
guint32 flags;
/*
* From the TypeDef table
*/
guint32 first_method_idx;
guint32 first_field_idx;
guint32 method_count, field_count;
/* next element in the class_cache hash list (in MonoImage) */
MonoClass *next_class_cache;
};
struct _MonoClassGtd {
MonoClassDef klass;
MonoGenericContainer *generic_container;
/* The canonical GENERICINST where we instantiate a generic type definition with its own generic parameters.*/
/* Suppose we have class T`2<A,B> {...}. canonical_inst is the GTD T`2 applied to A and B. */
MonoType canonical_inst;
};
struct _MonoClassGenericInst {
MonoClass klass;
MonoGenericClass *generic_class;
};
struct _MonoClassGenericParam {
MonoClass klass;
};
struct _MonoClassArray {
MonoClass klass;
guint32 method_count;
};
struct _MonoClassPointer {
MonoClass klass;
};
#endif
|
/**
* \file Definitions of struct _MonoClass members
*
* NOTE: This file should NOT be included directly.
*/
#if defined(MONO_CLASS_DEF_PRIVATE) && !defined(REALLY_INCLUDE_CLASS_DEF)
#error struct _MonoClass definition should not be accessed directly
#endif
#ifndef __MONO_METADATA_CLASS_PRIVATE_DEFINITION_H__
#define __MONO_METADATA_CLASS_PRIVATE_DEFINITION_H__
struct _MonoClass {
/* element class for arrays and enum basetype for enums */
MonoClass *element_class;
/* used for subtype checks */
MonoClass *cast_class;
/* for fast subtype checks */
MonoClass **supertypes;
guint16 idepth;
/* array dimension */
guint8 rank;
/* One of the values from MonoTypeKind */
guint8 class_kind;
int instance_size; /* object instance size */
guint inited : 1;
/* A class contains static and non static data. Static data can be
* of the same type as the class itselfs, but it does not influence
* the instance size of the class. To avoid cyclic calls to
* mono_class_init_internal (from mono_class_instance_size ()) we first
* initialise all non static fields. After that we set size_inited
* to 1, because we know the instance size now. After that we
* initialise all static fields.
*/
/* ALL BITFIELDS SHOULD BE WRITTEN WHILE HOLDING THE LOADER LOCK */
guint size_inited : 1;
guint valuetype : 1; /* derives from System.ValueType */
guint enumtype : 1; /* derives from System.Enum */
guint blittable : 1; /* class is blittable */
guint unicode : 1; /* class uses unicode char when marshalled */
guint wastypebuilder : 1; /* class was created at runtime from a TypeBuilder */
guint is_array_special_interface : 1; /* gtd or ginst of once of the magic interfaces that arrays implement */
guint is_byreflike : 1; /* class is a valuetype and has System.Runtime.CompilerServices.IsByRefLikeAttribute */
/* next byte */
guint8 min_align;
/* next byte */
guint packing_size : 4;
guint ghcimpl : 1; /* class has its own GetHashCode impl */
guint has_finalize : 1; /* class has its own Finalize impl */
guint delegate : 1; /* class is a Delegate */
/* next byte */
guint gc_descr_inited : 1; /* gc_descr is initialized */
guint has_cctor : 1; /* class has a cctor */
guint has_references : 1; /* it has GC-tracked references in the instance */
guint has_ref_fields : 1; /* it has byref fields */
guint has_static_refs : 1; /* it has static fields that are GC-tracked */
guint no_special_static_fields : 1; /* has no thread/context static fields */
/* directly or indirectly derives from ComImport attributed class.
* this means we need to create a proxy for instances of this class
* for COM Interop. set this flag on loading so all we need is a quick check
* during object creation rather than having to traverse supertypes
*/
guint is_com_object : 1;
guint nested_classes_inited : 1; /* Whenever nested_class is initialized */
/* next byte*/
guint interfaces_inited : 1; /* interfaces is initialized */
guint simd_type : 1; /* class is a simd intrinsic type */
guint has_finalize_inited : 1; /* has_finalize is initialized */
guint fields_inited : 1; /* setup_fields () has finished */
guint has_failure : 1; /* See mono_class_get_exception_data () for a MonoErrorBoxed with the details */
guint has_weak_fields : 1; /* class has weak reference fields */
guint has_dim_conflicts : 1; /* Class has conflicting default interface methods */
guint any_field_has_auto_layout : 1; /* a field in this type's layout uses auto-layout */
MonoClass *parent;
MonoClass *nested_in;
MonoImage *image;
const char *name;
const char *name_space;
guint32 type_token;
int vtable_size; /* number of slots */
guint16 interface_count;
guint32 interface_id; /* unique inderface id (for interfaces) */
guint32 max_interface_id;
guint16 interface_offsets_count;
MonoClass **interfaces_packed;
guint16 *interface_offsets_packed;
guint8 *interface_bitmap;
MonoClass **interfaces;
union _MonoClassSizes sizes;
/*
* Field information: Type and location from object base
*/
MonoClassField *fields;
MonoMethod **methods;
/* used as the type of the this argument and when passing the arg by value */
MonoType this_arg;
MonoType _byval_arg;
MonoGCDescriptor gc_descr;
MonoVTable *runtime_vtable;
/* Generic vtable. Initialized by a call to mono_class_setup_vtable () */
MonoMethod **vtable;
/* Infrequently used items. See class-accessors.c: InfrequentDataKind for what goes into here. */
MonoPropertyBag infrequent_data;
};
struct _MonoClassDef {
MonoClass klass;
guint32 flags;
/*
* From the TypeDef table
*/
guint32 first_method_idx;
guint32 first_field_idx;
guint32 method_count, field_count;
/* next element in the class_cache hash list (in MonoImage) */
MonoClass *next_class_cache;
};
struct _MonoClassGtd {
MonoClassDef klass;
MonoGenericContainer *generic_container;
/* The canonical GENERICINST where we instantiate a generic type definition with its own generic parameters.*/
/* Suppose we have class T`2<A,B> {...}. canonical_inst is the GTD T`2 applied to A and B. */
MonoType canonical_inst;
};
struct _MonoClassGenericInst {
MonoClass klass;
MonoGenericClass *generic_class;
};
struct _MonoClassGenericParam {
MonoClass klass;
};
struct _MonoClassArray {
MonoClass klass;
guint32 method_count;
};
struct _MonoClassPointer {
MonoClass klass;
};
#endif
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/c_runtime/_vsnwprintf_s/test15/test15.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: test15.c
**
** Purpose: Test #15 for the _vsnwprintf_s function.
**
**
**===================================================================*/
#include <palsuite.h>
#include "../_vsnwprintf_s.h"
/* memcmp is used to verify the results, so this test is dependent on it. */
/* ditto with wcslen */
PALTEST(c_runtime__vsnwprintf_s_test15_paltest_vsnwprintf_test15, "c_runtime/_vsnwprintf_s/test15/paltest_vsnwprintf_test15")
{
double val = 256.0;
double neg = -256.0;
if (PAL_Initialize(argc, argv) != 0)
{
return(FAIL);
}
DoDoubleTest(convert("foo %E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %lE"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %hE"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %LE"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %I64E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %14E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %-14E"), val, convert("foo 2.560000E+002 "),
convert("foo 2.560000E+02 "));
DoDoubleTest(convert("foo %.1E"), val, convert("foo 2.6E+002"),
convert("foo 2.6E+02"));
DoDoubleTest(convert("foo %.8E"), val, convert("foo 2.56000000E+002"),
convert("foo 2.56000000E+02"));
DoDoubleTest(convert("foo %014E"), val, convert("foo 02.560000E+002"),
convert("foo 002.560000E+02"));
DoDoubleTest(convert("foo %#E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %+E"), val, convert("foo +2.560000E+002"),
convert("foo +2.560000E+02"));
DoDoubleTest(convert("foo % E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %+E"), neg, convert("foo -2.560000E+002"),
convert("foo -2.560000E+02"));
DoDoubleTest(convert("foo % E"), neg, convert("foo -2.560000E+002"),
convert("foo -2.560000E+002"));
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: test15.c
**
** Purpose: Test #15 for the _vsnwprintf_s function.
**
**
**===================================================================*/
#include <palsuite.h>
#include "../_vsnwprintf_s.h"
/* memcmp is used to verify the results, so this test is dependent on it. */
/* ditto with wcslen */
PALTEST(c_runtime__vsnwprintf_s_test15_paltest_vsnwprintf_test15, "c_runtime/_vsnwprintf_s/test15/paltest_vsnwprintf_test15")
{
double val = 256.0;
double neg = -256.0;
if (PAL_Initialize(argc, argv) != 0)
{
return(FAIL);
}
DoDoubleTest(convert("foo %E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %lE"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %hE"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %LE"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %I64E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %14E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %-14E"), val, convert("foo 2.560000E+002 "),
convert("foo 2.560000E+02 "));
DoDoubleTest(convert("foo %.1E"), val, convert("foo 2.6E+002"),
convert("foo 2.6E+02"));
DoDoubleTest(convert("foo %.8E"), val, convert("foo 2.56000000E+002"),
convert("foo 2.56000000E+02"));
DoDoubleTest(convert("foo %014E"), val, convert("foo 02.560000E+002"),
convert("foo 002.560000E+02"));
DoDoubleTest(convert("foo %#E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %+E"), val, convert("foo +2.560000E+002"),
convert("foo +2.560000E+02"));
DoDoubleTest(convert("foo % E"), val, convert("foo 2.560000E+002"),
convert("foo 2.560000E+02"));
DoDoubleTest(convert("foo %+E"), neg, convert("foo -2.560000E+002"),
convert("foo -2.560000E+02"));
DoDoubleTest(convert("foo % E"), neg, convert("foo -2.560000E+002"),
convert("foo -2.560000E+002"));
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/mono/mono/utils/options.h
|
/**
* \file Runtime options
*
* Copyright 2020 Microsoft
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#ifndef __MONO_UTILS_FLAGS_H__
#define __MONO_UTILS_FLAGS_H__
#include <config.h>
#include <glib.h>
#include "mono/utils/mono-error.h"
/* Declare list of options */
/* Each option will declare an exported C variable named mono_opt_... */
MONO_BEGIN_DECLS
#define DEFINE_OPTION_FULL(flag_type, ctype, c_name, cmd_name, def_value, comment) \
MONO_API_DATA ctype mono_opt_##c_name;
#define DEFINE_OPTION_READONLY(flag_type, ctype, c_name, cmd_name, def_value, comment) \
static const ctype mono_opt_##c_name = def_value;
#include "options-def.h"
MONO_END_DECLS
void mono_options_print_usage (void);
void mono_options_parse_options (const char **args, int argc, int *out_argc, MonoError *error);
#endif
|
/**
* \file Runtime options
*
* Copyright 2020 Microsoft
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#ifndef __MONO_UTILS_FLAGS_H__
#define __MONO_UTILS_FLAGS_H__
#include <config.h>
#include <glib.h>
#include "mono/utils/mono-error.h"
/* Declare list of options */
/* Each option will declare an exported C variable named mono_opt_... */
MONO_BEGIN_DECLS
#define DEFINE_OPTION_FULL(flag_type, ctype, c_name, cmd_name, def_value, comment) \
MONO_API_DATA ctype mono_opt_##c_name;
#define DEFINE_OPTION_READONLY(flag_type, ctype, c_name, cmd_name, def_value, comment) \
static const ctype mono_opt_##c_name = def_value;
#include "options-def.h"
MONO_END_DECLS
void mono_options_print_usage (void);
void mono_options_parse_options (const char **args, int argc, int *out_argc, MonoError *error);
#endif
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/mono/mono/sgen/sgen-array-list.h
|
/**
* \file
* A pointer array that doesn't use reallocs.
*
* Copyright (C) 2016 Xamarin Inc
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#ifndef __MONO_SGEN_ARRAY_LIST_H__
#define __MONO_SGEN_ARRAY_LIST_H__
#include <glib.h>
#define SGEN_ARRAY_LIST_BUCKETS (32)
#define SGEN_ARRAY_LIST_MIN_BUCKET_BITS (5)
#define SGEN_ARRAY_LIST_MIN_BUCKET_SIZE (1 << SGEN_ARRAY_LIST_MIN_BUCKET_BITS)
typedef void (*SgenArrayListBucketAllocCallback) (gpointer *bucket, guint32 new_bucket_size, gboolean alloc);
typedef gboolean (*SgenArrayListIsSlotSetFunc) (volatile gpointer *slot);
typedef gboolean (*SgenArrayListSetSlotFunc) (volatile gpointer *slot, gpointer ptr, int data);
/*
* 'entries' is an array of pointers to buckets of increasing size. The first
* bucket has size 'MIN_BUCKET_SIZE', and each bucket is twice the size of the
* previous, i.e.:
*
* |-------|-- MIN_BUCKET_SIZE
* [0] -> xxxxxxxx
* [1] -> xxxxxxxxxxxxxxxx
* [2] -> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* ...
*
* 'slot_hint' denotes the position of the last allocation, so that the
* whole array needn't be searched on every allocation.
*
* The size of the spine, 'SGEN_ARRAY_LIST_BUCKETS', is chosen so
* that the maximum number of entries is no less than G_MAXUINT32.
*/
typedef struct {
volatile gpointer *volatile entries [SGEN_ARRAY_LIST_BUCKETS];
volatile guint32 capacity;
volatile guint32 slot_hint;
volatile guint32 next_slot;
SgenArrayListBucketAllocCallback bucket_alloc_callback;
SgenArrayListIsSlotSetFunc is_slot_set_func;
SgenArrayListSetSlotFunc set_slot_func;
int mem_type; /* sgen internal mem type or -1 for malloc allocation */
} SgenArrayList;
#if defined(__GNUC__)
static inline guint32
sgen_clz (guint32 x)
{
return __builtin_clz (x);
}
#elif !defined(ENABLE_MSVC_LZCNT) && defined(_MSC_VER)
static inline guint32
sgen_clz (guint32 x)
{
gulong leading_zero_bits;
return _BitScanReverse (&leading_zero_bits, (gulong)x) ? 31 - leading_zero_bits : 32;
}
#elif defined(ENABLE_MSVC_LZCNT) && defined(_MSC_VER)
static inline guint32
sgen_clz (guint32 x)
{
return __lzcnt (x);
}
#else
static inline guint32
sgen_clz (guint32 x)
{
guint count = 0;
while (x) {
++count;
x >>= 1;
}
return 32 - count;
}
#endif
/*
* Computes floor(log2(index + MIN_BUCKET_SIZE)) - 1, giving the index
* of the bucket containing a slot.
*/
static inline guint32
sgen_array_list_index_bucket (guint32 index)
{
return CHAR_BIT * sizeof (index) - sgen_clz (index + SGEN_ARRAY_LIST_MIN_BUCKET_SIZE) - 1 - SGEN_ARRAY_LIST_MIN_BUCKET_BITS;
}
static inline guint32
sgen_array_list_bucket_size (guint32 index)
{
return 1 << (index + SGEN_ARRAY_LIST_MIN_BUCKET_BITS);
}
static inline void
sgen_array_list_bucketize (guint32 index, guint32 *bucket, guint32 *offset)
{
*bucket = sgen_array_list_index_bucket (index);
*offset = index - sgen_array_list_bucket_size (*bucket) + SGEN_ARRAY_LIST_MIN_BUCKET_SIZE;
}
static inline volatile gpointer *
sgen_array_list_get_slot (SgenArrayList *array, guint32 index)
{
guint32 bucket, offset;
SGEN_ASSERT (0, index < array->capacity, "Why are we accessing an entry that is not allocated");
sgen_array_list_bucketize (index, &bucket, &offset);
return &(array->entries [bucket] [offset]);
}
#define SGEN_ARRAY_LIST_INIT(bucket_alloc_callback, is_slot_set_func, set_slot_func, mem_type) { { NULL }, 0, 0, 0, (bucket_alloc_callback), (is_slot_set_func), (set_slot_func), (mem_type) }
#define SGEN_ARRAY_LIST_FOREACH_SLOT(array, slot) { \
guint32 __bucket, __offset; \
const guint32 __max_bucket = sgen_array_list_index_bucket ((array)->capacity); \
guint32 __index = 0; \
const guint32 __next_slot = (array)->next_slot; \
for (__bucket = 0; __bucket < __max_bucket; ++__bucket) { \
volatile gpointer *__entries = (array)->entries [__bucket]; \
for (__offset = 0; __offset < sgen_array_list_bucket_size (__bucket); ++__offset, ++__index) { \
if (__index >= __next_slot) \
break; \
slot = &__entries [__offset];
#define SGEN_ARRAY_LIST_END_FOREACH_SLOT } } }
#define SGEN_ARRAY_LIST_FOREACH_SLOT_RANGE(array, begin, end, slot, index) { \
for (index = (begin); index < (end); index++) { \
guint32 __bucket, __offset; \
volatile gpointer *__entries; \
sgen_array_list_bucketize (index, &__bucket, &__offset); \
__entries = (array)->entries [__bucket]; \
slot = &__entries [__offset];
#define SGEN_ARRAY_LIST_END_FOREACH_SLOT_RANGE } }
guint32 sgen_array_list_alloc_block (SgenArrayList *array, guint32 slots_to_add);
guint32 sgen_array_list_add (SgenArrayList *array, gpointer ptr, int data, gboolean increase_size_before_set);
guint32 sgen_array_list_find (SgenArrayList *array, gpointer ptr);
gboolean sgen_array_list_default_cas_setter (volatile gpointer *slot, gpointer ptr, int data);
gboolean sgen_array_list_default_is_slot_set (volatile gpointer *slot);
void sgen_array_list_remove_nulls (SgenArrayList *array);
#endif
|
/**
* \file
* A pointer array that doesn't use reallocs.
*
* Copyright (C) 2016 Xamarin Inc
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#ifndef __MONO_SGEN_ARRAY_LIST_H__
#define __MONO_SGEN_ARRAY_LIST_H__
#include <glib.h>
#define SGEN_ARRAY_LIST_BUCKETS (32)
#define SGEN_ARRAY_LIST_MIN_BUCKET_BITS (5)
#define SGEN_ARRAY_LIST_MIN_BUCKET_SIZE (1 << SGEN_ARRAY_LIST_MIN_BUCKET_BITS)
typedef void (*SgenArrayListBucketAllocCallback) (gpointer *bucket, guint32 new_bucket_size, gboolean alloc);
typedef gboolean (*SgenArrayListIsSlotSetFunc) (volatile gpointer *slot);
typedef gboolean (*SgenArrayListSetSlotFunc) (volatile gpointer *slot, gpointer ptr, int data);
/*
* 'entries' is an array of pointers to buckets of increasing size. The first
* bucket has size 'MIN_BUCKET_SIZE', and each bucket is twice the size of the
* previous, i.e.:
*
* |-------|-- MIN_BUCKET_SIZE
* [0] -> xxxxxxxx
* [1] -> xxxxxxxxxxxxxxxx
* [2] -> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* ...
*
* 'slot_hint' denotes the position of the last allocation, so that the
* whole array needn't be searched on every allocation.
*
* The size of the spine, 'SGEN_ARRAY_LIST_BUCKETS', is chosen so
* that the maximum number of entries is no less than G_MAXUINT32.
*/
typedef struct {
volatile gpointer *volatile entries [SGEN_ARRAY_LIST_BUCKETS];
volatile guint32 capacity;
volatile guint32 slot_hint;
volatile guint32 next_slot;
SgenArrayListBucketAllocCallback bucket_alloc_callback;
SgenArrayListIsSlotSetFunc is_slot_set_func;
SgenArrayListSetSlotFunc set_slot_func;
int mem_type; /* sgen internal mem type or -1 for malloc allocation */
} SgenArrayList;
#if defined(__GNUC__)
static inline guint32
sgen_clz (guint32 x)
{
return __builtin_clz (x);
}
#elif !defined(ENABLE_MSVC_LZCNT) && defined(_MSC_VER)
static inline guint32
sgen_clz (guint32 x)
{
gulong leading_zero_bits;
return _BitScanReverse (&leading_zero_bits, (gulong)x) ? 31 - leading_zero_bits : 32;
}
#elif defined(ENABLE_MSVC_LZCNT) && defined(_MSC_VER)
static inline guint32
sgen_clz (guint32 x)
{
return __lzcnt (x);
}
#else
static inline guint32
sgen_clz (guint32 x)
{
guint count = 0;
while (x) {
++count;
x >>= 1;
}
return 32 - count;
}
#endif
/*
* Computes floor(log2(index + MIN_BUCKET_SIZE)) - 1, giving the index
* of the bucket containing a slot.
*/
static inline guint32
sgen_array_list_index_bucket (guint32 index)
{
return CHAR_BIT * sizeof (index) - sgen_clz (index + SGEN_ARRAY_LIST_MIN_BUCKET_SIZE) - 1 - SGEN_ARRAY_LIST_MIN_BUCKET_BITS;
}
static inline guint32
sgen_array_list_bucket_size (guint32 index)
{
return 1 << (index + SGEN_ARRAY_LIST_MIN_BUCKET_BITS);
}
static inline void
sgen_array_list_bucketize (guint32 index, guint32 *bucket, guint32 *offset)
{
*bucket = sgen_array_list_index_bucket (index);
*offset = index - sgen_array_list_bucket_size (*bucket) + SGEN_ARRAY_LIST_MIN_BUCKET_SIZE;
}
static inline volatile gpointer *
sgen_array_list_get_slot (SgenArrayList *array, guint32 index)
{
guint32 bucket, offset;
SGEN_ASSERT (0, index < array->capacity, "Why are we accessing an entry that is not allocated");
sgen_array_list_bucketize (index, &bucket, &offset);
return &(array->entries [bucket] [offset]);
}
#define SGEN_ARRAY_LIST_INIT(bucket_alloc_callback, is_slot_set_func, set_slot_func, mem_type) { { NULL }, 0, 0, 0, (bucket_alloc_callback), (is_slot_set_func), (set_slot_func), (mem_type) }
#define SGEN_ARRAY_LIST_FOREACH_SLOT(array, slot) { \
guint32 __bucket, __offset; \
const guint32 __max_bucket = sgen_array_list_index_bucket ((array)->capacity); \
guint32 __index = 0; \
const guint32 __next_slot = (array)->next_slot; \
for (__bucket = 0; __bucket < __max_bucket; ++__bucket) { \
volatile gpointer *__entries = (array)->entries [__bucket]; \
for (__offset = 0; __offset < sgen_array_list_bucket_size (__bucket); ++__offset, ++__index) { \
if (__index >= __next_slot) \
break; \
slot = &__entries [__offset];
#define SGEN_ARRAY_LIST_END_FOREACH_SLOT } } }
#define SGEN_ARRAY_LIST_FOREACH_SLOT_RANGE(array, begin, end, slot, index) { \
for (index = (begin); index < (end); index++) { \
guint32 __bucket, __offset; \
volatile gpointer *__entries; \
sgen_array_list_bucketize (index, &__bucket, &__offset); \
__entries = (array)->entries [__bucket]; \
slot = &__entries [__offset];
#define SGEN_ARRAY_LIST_END_FOREACH_SLOT_RANGE } }
guint32 sgen_array_list_alloc_block (SgenArrayList *array, guint32 slots_to_add);
guint32 sgen_array_list_add (SgenArrayList *array, gpointer ptr, int data, gboolean increase_size_before_set);
guint32 sgen_array_list_find (SgenArrayList *array, gpointer ptr);
gboolean sgen_array_list_default_cas_setter (volatile gpointer *slot, gpointer ptr, int data);
gboolean sgen_array_list_default_is_slot_set (volatile gpointer *slot);
void sgen_array_list_remove_nulls (SgenArrayList *array);
#endif
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/threading/CriticalSectionFunctions/test6/test6.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: CriticalSectionFunctions/test6/test6.c
**
** Purpose: Attempt to leave a critical section which is owned by
** another thread.
**
**
**===================================================================*/
#include <palsuite.h>
DWORD PALAPI Thread_CriticalSectionFunctions_test6(LPVOID lpParam)
{
DWORD dwTRet;
EnterCriticalSection(&CriticalSection);
/* signal thread 0 */
if (0 == SetEvent(hToken[0]))
{
Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) during "
"clean up.\nGetLastError returned '%u'.\n", hToken[0],
GetLastError());
LeaveCriticalSection(&CriticalSection);
Cleanup (&hToken[0], NUM_TOKENS);
DeleteCriticalSection(&CriticalSection);
Fail("");
}
/* wait to be signaled */
dwTRet = WaitForSingleObject(hToken[1], 10000);
if (WAIT_OBJECT_0 != dwTRet)
{
Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have "
"returned\nWAIT_OBJECT_0 ('%d'), instead it returned "
"('%d').\nGetLastError returned '%u'.\n",
hToken[1], 10000, WAIT_OBJECT_0, dwTRet, GetLastError());
LeaveCriticalSection(&CriticalSection);
Cleanup (&hToken[0], NUM_TOKENS);
DeleteCriticalSection(&CriticalSection);
Fail("");
}
LeaveCriticalSection(&CriticalSection);
return 0;
}
PALTEST(threading_CriticalSectionFunctions_test6_paltest_criticalsectionfunctions_test6, "threading/CriticalSectionFunctions/test6/paltest_criticalsectionfunctions_test6")
{
DWORD dwThreadId;
DWORD dwMRet;
if ((PAL_Initialize(argc,argv)) != 0)
{
return(FAIL);
}
/* thread 0 event */
hToken[0] = CreateEvent(NULL, TRUE, FALSE, NULL);
if (hToken[0] == NULL)
{
Fail("PALSUITE ERROR: CreateEvent call #0 failed. GetLastError "
"returned %u.\n", GetLastError());
}
/* thread 1 event */
hToken[1] = CreateEvent(NULL, TRUE, FALSE, NULL);
if (hToken[1] == NULL)
{
Trace("PALSUITE ERROR: CreateEvent call #1 failed. GetLastError "
"returned %u.\n", GetLastError());
Cleanup(&hToken[0], (NUM_TOKENS - 2));
Fail("");
}
InitializeCriticalSection(&CriticalSection);
hToken[2] = CreateThread(NULL,
0,
&Thread_CriticalSectionFunctions_test6,
(LPVOID) NULL,
0,
&dwThreadId);
if (hToken[2] == NULL)
{
Trace("PALSUITE ERROR: CreateThread call #0 failed. GetLastError "
"returned %u.\n", GetLastError());
Cleanup(&hToken[0], (NUM_TOKENS - 1));
DeleteCriticalSection(&CriticalSection);
Fail("");
}
/* wait for thread 0 to be signaled */
dwMRet = WaitForSingleObject(hToken[0], 10000);
if (WAIT_OBJECT_0 != dwMRet)
{
Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have "
"returned\nWAIT_OBJECT_0 ('%d'), instead it returned "
"('%d').\nGetLastError returned '%u'.\n", hToken[0], 10000,
WAIT_OBJECT_0, dwMRet, GetLastError());
Cleanup(&hToken[0], NUM_TOKENS);
Fail("");
}
/*
* Attempt to leave critical section which is owned by the other thread.
*/
LeaveCriticalSection(&CriticalSection);
/* signal thread 1 */
if (0 == SetEvent(hToken[1]))
{
Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) call.\n"
"GetLastError returned '%u'.\n", hToken[1],
GetLastError());
Cleanup(&hToken[0], NUM_TOKENS);
Fail("");
}
dwMRet = WaitForSingleObject(hToken[2], 10000);
if (WAIT_OBJECT_0 != dwMRet)
{
Trace("PALSUITE ERROR: WaitForSingleObject(%p, %d) call "
"returned an unexpected value '%d'.\nGetLastError returned "
"%u.\n", hToken[2], 10000, dwMRet, GetLastError());
Cleanup(&hToken[0], NUM_TOKENS);
Fail("");
}
if (!Cleanup(&hToken[0], NUM_TOKENS))
{
Fail("");
}
PAL_Terminate();
return(PASS);
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: CriticalSectionFunctions/test6/test6.c
**
** Purpose: Attempt to leave a critical section which is owned by
** another thread.
**
**
**===================================================================*/
#include <palsuite.h>
DWORD PALAPI Thread_CriticalSectionFunctions_test6(LPVOID lpParam)
{
DWORD dwTRet;
EnterCriticalSection(&CriticalSection);
/* signal thread 0 */
if (0 == SetEvent(hToken[0]))
{
Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) during "
"clean up.\nGetLastError returned '%u'.\n", hToken[0],
GetLastError());
LeaveCriticalSection(&CriticalSection);
Cleanup (&hToken[0], NUM_TOKENS);
DeleteCriticalSection(&CriticalSection);
Fail("");
}
/* wait to be signaled */
dwTRet = WaitForSingleObject(hToken[1], 10000);
if (WAIT_OBJECT_0 != dwTRet)
{
Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have "
"returned\nWAIT_OBJECT_0 ('%d'), instead it returned "
"('%d').\nGetLastError returned '%u'.\n",
hToken[1], 10000, WAIT_OBJECT_0, dwTRet, GetLastError());
LeaveCriticalSection(&CriticalSection);
Cleanup (&hToken[0], NUM_TOKENS);
DeleteCriticalSection(&CriticalSection);
Fail("");
}
LeaveCriticalSection(&CriticalSection);
return 0;
}
PALTEST(threading_CriticalSectionFunctions_test6_paltest_criticalsectionfunctions_test6, "threading/CriticalSectionFunctions/test6/paltest_criticalsectionfunctions_test6")
{
DWORD dwThreadId;
DWORD dwMRet;
if ((PAL_Initialize(argc,argv)) != 0)
{
return(FAIL);
}
/* thread 0 event */
hToken[0] = CreateEvent(NULL, TRUE, FALSE, NULL);
if (hToken[0] == NULL)
{
Fail("PALSUITE ERROR: CreateEvent call #0 failed. GetLastError "
"returned %u.\n", GetLastError());
}
/* thread 1 event */
hToken[1] = CreateEvent(NULL, TRUE, FALSE, NULL);
if (hToken[1] == NULL)
{
Trace("PALSUITE ERROR: CreateEvent call #1 failed. GetLastError "
"returned %u.\n", GetLastError());
Cleanup(&hToken[0], (NUM_TOKENS - 2));
Fail("");
}
InitializeCriticalSection(&CriticalSection);
hToken[2] = CreateThread(NULL,
0,
&Thread_CriticalSectionFunctions_test6,
(LPVOID) NULL,
0,
&dwThreadId);
if (hToken[2] == NULL)
{
Trace("PALSUITE ERROR: CreateThread call #0 failed. GetLastError "
"returned %u.\n", GetLastError());
Cleanup(&hToken[0], (NUM_TOKENS - 1));
DeleteCriticalSection(&CriticalSection);
Fail("");
}
/* wait for thread 0 to be signaled */
dwMRet = WaitForSingleObject(hToken[0], 10000);
if (WAIT_OBJECT_0 != dwMRet)
{
Trace("PALSUITE ERROR: WaitForSingleObject(%p,%d) should have "
"returned\nWAIT_OBJECT_0 ('%d'), instead it returned "
"('%d').\nGetLastError returned '%u'.\n", hToken[0], 10000,
WAIT_OBJECT_0, dwMRet, GetLastError());
Cleanup(&hToken[0], NUM_TOKENS);
Fail("");
}
/*
* Attempt to leave critical section which is owned by the other thread.
*/
LeaveCriticalSection(&CriticalSection);
/* signal thread 1 */
if (0 == SetEvent(hToken[1]))
{
Trace("PALSUITE ERROR: Unable to execute SetEvent(%p) call.\n"
"GetLastError returned '%u'.\n", hToken[1],
GetLastError());
Cleanup(&hToken[0], NUM_TOKENS);
Fail("");
}
dwMRet = WaitForSingleObject(hToken[2], 10000);
if (WAIT_OBJECT_0 != dwMRet)
{
Trace("PALSUITE ERROR: WaitForSingleObject(%p, %d) call "
"returned an unexpected value '%d'.\nGetLastError returned "
"%u.\n", hToken[2], 10000, dwMRet, GetLastError());
Cleanup(&hToken[0], NUM_TOKENS);
Fail("");
}
if (!Cleanup(&hToken[0], NUM_TOKENS))
{
Fail("");
}
PAL_Terminate();
return(PASS);
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/c_runtime/atanf/test1/test1.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================================
**
** Source: test1.c
**
** Purpose: Test to ensure that atanf return the correct values
**
** Dependencies: PAL_Initialize
** PAL_Terminate
** Fail
** fabs
**
**===========================================================================*/
#include <palsuite.h>
// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this
// is slightly too accurate when writing tests meant to run against libm implementations
// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get.
//
// The tests themselves will take PAL_EPSILON and adjust it according to the expected result
// so that the delta used for comparison will compare the most significant digits and ignore
// any digits that are outside the double precision range (6-9 digits).
// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON
// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use
// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10.
#define PAL_EPSILON 4.76837158e-07
#define PAL_NAN sqrtf(-1.0f)
#define PAL_POSINF -logf(0.0f)
#define PAL_NEGINF logf(0.0f)
/**
* Helper test structure
*/
struct test
{
float value; /* value to test the function with */
float expected; /* expected result */
float variance; /* maximum delta between the expected and actual result */
};
/**
* atanf_test1_validate
*
* test validation function
*/
void __cdecl atanf_test1_validate(float value, float expected, float variance)
{
float result = atanf(value);
/*
* The test is valid when the difference between result
* and expected is less than or equal to variance
*/
float delta = fabsf(result - expected);
if (delta > variance)
{
Fail("atanf(%g) returned %10.9g when it should have returned %10.9g",
value, result, expected);
}
}
/**
* atanf_test1_validate
*
* test validation function for values returning NaN
*/
void __cdecl atanf_test1_validate_isnan(float value)
{
float result = atanf(value);
if (!_isnanf(result))
{
Fail("atanf(%g) returned %10.9g when it should have returned %10.9g",
value, result, PAL_NAN);
}
}
/**
* main
*
* executable entry point
*/
PALTEST(c_runtime_atanf_test1_paltest_atanf_test1, "c_runtime/atanf/test1/paltest_atanf_test1")
{
struct test tests[] =
{
/* value expected variance */
{ 0, 0, PAL_EPSILON },
{ 0.329514733f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi
{ 0.450549534f, 0.423310825f, PAL_EPSILON }, // expected: pi - e
{ 0.463829067f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e)
{ 0.739302950f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi
{ 0.830640878f, 0.693147181f, PAL_EPSILON }, // expected: ln(2)
{ 0.854510432f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2)
{ 1, 0.785398163f, PAL_EPSILON }, // expected: pi / 4
{ 1.11340715f, 0.839007561f, PAL_EPSILON }, // expected: pi - ln(10)
{ 1.55740772f, 1, PAL_EPSILON * 10 },
{ 2.11087684f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi)
{ 6.33411917f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2)
{ 7.76357567f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e)
{ PAL_POSINF, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2
};
/* PAL initialization */
if (PAL_Initialize(argc, argv) != 0)
{
return FAIL;
}
for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++)
{
atanf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance);
atanf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance);
}
atanf_test1_validate_isnan(PAL_NAN);
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================================
**
** Source: test1.c
**
** Purpose: Test to ensure that atanf return the correct values
**
** Dependencies: PAL_Initialize
** PAL_Terminate
** Fail
** fabs
**
**===========================================================================*/
#include <palsuite.h>
// binary32 (float) has a machine epsilon of 2^-23 (approx. 1.19e-07). However, this
// is slightly too accurate when writing tests meant to run against libm implementations
// for various platforms. 2^-21 (approx. 4.76e-07) seems to be as accurate as we can get.
//
// The tests themselves will take PAL_EPSILON and adjust it according to the expected result
// so that the delta used for comparison will compare the most significant digits and ignore
// any digits that are outside the double precision range (6-9 digits).
// For example, a test with an expect result in the format of 0.xxxxxxxxx will use PAL_EPSILON
// for the variance, while an expected result in the format of 0.0xxxxxxxxx will use
// PAL_EPSILON / 10 and and expected result in the format of x.xxxxxx will use PAL_EPSILON * 10.
#define PAL_EPSILON 4.76837158e-07
#define PAL_NAN sqrtf(-1.0f)
#define PAL_POSINF -logf(0.0f)
#define PAL_NEGINF logf(0.0f)
/**
* Helper test structure
*/
struct test
{
float value; /* value to test the function with */
float expected; /* expected result */
float variance; /* maximum delta between the expected and actual result */
};
/**
* atanf_test1_validate
*
* test validation function
*/
void __cdecl atanf_test1_validate(float value, float expected, float variance)
{
float result = atanf(value);
/*
* The test is valid when the difference between result
* and expected is less than or equal to variance
*/
float delta = fabsf(result - expected);
if (delta > variance)
{
Fail("atanf(%g) returned %10.9g when it should have returned %10.9g",
value, result, expected);
}
}
/**
* atanf_test1_validate
*
* test validation function for values returning NaN
*/
void __cdecl atanf_test1_validate_isnan(float value)
{
float result = atanf(value);
if (!_isnanf(result))
{
Fail("atanf(%g) returned %10.9g when it should have returned %10.9g",
value, result, PAL_NAN);
}
}
/**
* main
*
* executable entry point
*/
PALTEST(c_runtime_atanf_test1_paltest_atanf_test1, "c_runtime/atanf/test1/paltest_atanf_test1")
{
struct test tests[] =
{
/* value expected variance */
{ 0, 0, PAL_EPSILON },
{ 0.329514733f, 0.318309886f, PAL_EPSILON }, // expected: 1 / pi
{ 0.450549534f, 0.423310825f, PAL_EPSILON }, // expected: pi - e
{ 0.463829067f, 0.434294482f, PAL_EPSILON }, // expected: logf10f(e)
{ 0.739302950f, 0.636619772f, PAL_EPSILON }, // expected: 2 / pi
{ 0.830640878f, 0.693147181f, PAL_EPSILON }, // expected: ln(2)
{ 0.854510432f, 0.707106781f, PAL_EPSILON }, // expected: 1 / sqrtf(2)
{ 1, 0.785398163f, PAL_EPSILON }, // expected: pi / 4
{ 1.11340715f, 0.839007561f, PAL_EPSILON }, // expected: pi - ln(10)
{ 1.55740772f, 1, PAL_EPSILON * 10 },
{ 2.11087684f, 1.12837917f, PAL_EPSILON * 10 }, // expected: 2 / sqrtf(pi)
{ 6.33411917f, 1.41421356f, PAL_EPSILON * 10 }, // expected: sqrtf(2)
{ 7.76357567f, 1.44269504f, PAL_EPSILON * 10 }, // expected: logf2(e)
{ PAL_POSINF, 1.57079633f, PAL_EPSILON * 10 }, // expected: pi / 2
};
/* PAL initialization */
if (PAL_Initialize(argc, argv) != 0)
{
return FAIL;
}
for (int i = 0; i < (sizeof(tests) / sizeof(struct test)); i++)
{
atanf_test1_validate( tests[i].value, tests[i].expected, tests[i].variance);
atanf_test1_validate(-tests[i].value, -tests[i].expected, tests[i].variance);
}
atanf_test1_validate_isnan(PAL_NAN);
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/src/safecrt/memmove_s.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/***
*memmove_s.c - contains memmove_s routine
*
*
*Purpose:
* memmove_s() copies a source memory buffer to a destination buffer.
* Overlapping buffers are treated specially, to avoid propagation.
*
*Revision History:
* 10-07-03 AC Module created.
* 03-10-04 AC Return ERANGE when buffer is too small
*
*******************************************************************************/
#include <string.h>
#include <errno.h>
#include "internal_securecrt.h"
#include "mbusafecrt_internal.h"
/***
*memmove - Copy source buffer to destination buffer
*
*Purpose:
* memmove() copies a source memory buffer to a destination memory buffer.
* This routine recognize overlapping buffers to avoid propagation.
*
* For cases where propagation is not a problem, memcpy_s() can be used.
*
*Entry:
* void *dst = pointer to destination buffer
* size_t sizeInBytes = size in bytes of the destination buffer
* const void *src = pointer to source buffer
* size_t count = number of bytes to copy
*
*Exit:
* Returns 0 if everything is ok, else return the error code.
*
*Exceptions:
* Input parameters are validated. Refer to the validation section of the function.
* On error, the error code is returned. Nothing is written to the destination buffer.
*
*******************************************************************************/
errno_t __cdecl memmove_s(
void * dst,
size_t sizeInBytes,
const void * src,
size_t count
)
{
if (count == 0)
{
/* nothing to do */
return 0;
}
/* validation section */
_VALIDATE_RETURN_ERRCODE(dst != NULL, EINVAL);
_VALIDATE_RETURN_ERRCODE(src != NULL, EINVAL);
_VALIDATE_RETURN_ERRCODE(sizeInBytes >= count, ERANGE);
memmove(dst, src, count);
return 0;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/***
*memmove_s.c - contains memmove_s routine
*
*
*Purpose:
* memmove_s() copies a source memory buffer to a destination buffer.
* Overlapping buffers are treated specially, to avoid propagation.
*
*Revision History:
* 10-07-03 AC Module created.
* 03-10-04 AC Return ERANGE when buffer is too small
*
*******************************************************************************/
#include <string.h>
#include <errno.h>
#include "internal_securecrt.h"
#include "mbusafecrt_internal.h"
/***
*memmove - Copy source buffer to destination buffer
*
*Purpose:
* memmove() copies a source memory buffer to a destination memory buffer.
* This routine recognize overlapping buffers to avoid propagation.
*
* For cases where propagation is not a problem, memcpy_s() can be used.
*
*Entry:
* void *dst = pointer to destination buffer
* size_t sizeInBytes = size in bytes of the destination buffer
* const void *src = pointer to source buffer
* size_t count = number of bytes to copy
*
*Exit:
* Returns 0 if everything is ok, else return the error code.
*
*Exceptions:
* Input parameters are validated. Refer to the validation section of the function.
* On error, the error code is returned. Nothing is written to the destination buffer.
*
*******************************************************************************/
errno_t __cdecl memmove_s(
void * dst,
size_t sizeInBytes,
const void * src,
size_t count
)
{
if (count == 0)
{
/* nothing to do */
return 0;
}
/* validation section */
_VALIDATE_RETURN_ERRCODE(dst != NULL, EINVAL);
_VALIDATE_RETURN_ERRCODE(src != NULL, EINVAL);
_VALIDATE_RETURN_ERRCODE(sizeInBytes >= count, ERANGE);
memmove(dst, src, count);
return 0;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/eventpipe/ep-json-file.h
|
#ifndef __EVENTPIPE_JSON_FILE_H__
#define __EVENTPIPE_JSON_FILE_H__
#include "ep-rt-config.h"
#ifdef ENABLE_PERFTRACING
#include "ep-types.h"
#include "ep-rt.h"
#undef EP_IMPL_GETTER_SETTER
#ifdef EP_IMPL_JSON_FILE_GETTER_SETTER
#define EP_IMPL_GETTER_SETTER
#endif
#include "ep-getter-setter.h"
#ifdef EP_CHECKED_BUILD
/*
* EventPipeJsonFile.
*/
#if defined(EP_INLINE_GETTER_SETTER) || defined(EP_IMPL_JSON_FILE_GETTER_SETTER)
struct _EventPipeJsonFile {
#else
struct _EventPipeJsonFile_Internal {
#endif
ep_rt_file_handle_t file_stream;
ep_timestamp_t file_open_timestamp;
bool write_error_encountered;
};
#if !defined(EP_INLINE_GETTER_SETTER) && !defined(EP_IMPL_JSON_FILE_GETTER_SETTER)
struct _EventPipeJsonFile {
uint8_t _internal [sizeof (struct _EventPipeJsonFile_Internal)];
};
#endif
EventPipeJsonFile *
ep_json_file_alloc (const ep_char8_t *out_file_path);
void
ep_json_file_free (EventPipeJsonFile *json_file);
void
ep_json_file_write_event (
EventPipeJsonFile *json_file,
EventPipeEventInstance *instance);
void
ep_json_file_write_event_data (
EventPipeJsonFile *json_file,
ep_timestamp_t timestamp,
ep_rt_thread_id_t thread_id,
const ep_char8_t *message,
EventPipeStackContents *stack_contents);
#endif /* EP_CHECKED_BUILD */
#endif /* ENABLE_PERFTRACING */
#endif /* __EVENTPIPE_JSON_FILE_H__ */
|
#ifndef __EVENTPIPE_JSON_FILE_H__
#define __EVENTPIPE_JSON_FILE_H__
#include "ep-rt-config.h"
#ifdef ENABLE_PERFTRACING
#include "ep-types.h"
#include "ep-rt.h"
#undef EP_IMPL_GETTER_SETTER
#ifdef EP_IMPL_JSON_FILE_GETTER_SETTER
#define EP_IMPL_GETTER_SETTER
#endif
#include "ep-getter-setter.h"
#ifdef EP_CHECKED_BUILD
/*
* EventPipeJsonFile.
*/
#if defined(EP_INLINE_GETTER_SETTER) || defined(EP_IMPL_JSON_FILE_GETTER_SETTER)
struct _EventPipeJsonFile {
#else
struct _EventPipeJsonFile_Internal {
#endif
ep_rt_file_handle_t file_stream;
ep_timestamp_t file_open_timestamp;
bool write_error_encountered;
};
#if !defined(EP_INLINE_GETTER_SETTER) && !defined(EP_IMPL_JSON_FILE_GETTER_SETTER)
struct _EventPipeJsonFile {
uint8_t _internal [sizeof (struct _EventPipeJsonFile_Internal)];
};
#endif
EventPipeJsonFile *
ep_json_file_alloc (const ep_char8_t *out_file_path);
void
ep_json_file_free (EventPipeJsonFile *json_file);
void
ep_json_file_write_event (
EventPipeJsonFile *json_file,
EventPipeEventInstance *instance);
void
ep_json_file_write_event_data (
EventPipeJsonFile *json_file,
ep_timestamp_t timestamp,
ep_rt_thread_id_t thread_id,
const ep_char8_t *message,
EventPipeStackContents *stack_contents);
#endif /* EP_CHECKED_BUILD */
#endif /* ENABLE_PERFTRACING */
#endif /* __EVENTPIPE_JSON_FILE_H__ */
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/mono/mono/eventpipe/test/ep-tests-debug.h
|
#ifndef __EVENTPIPE_TESTS_DEBUG_H__
#define __EVENTPIPE_TESTS_DEBUG_H__
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#endif /* __EVENTPIPE_TESTS_DEBUG_H__ */
|
#ifndef __EVENTPIPE_TESTS_DEBUG_H__
#define __EVENTPIPE_TESTS_DEBUG_H__
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#endif /* __EVENTPIPE_TESTS_DEBUG_H__ */
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/c_runtime/swscanf/test12/test12.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================================
**
** Source: test12.c
**
** Purpose: Tests swscanf with wide strings
**
**
**==========================================================================*/
#include <palsuite.h>
#include "../swscanf.h"
PALTEST(c_runtime_swscanf_test12_paltest_swscanf_test12, "c_runtime/swscanf/test12/paltest_swscanf_test12")
{
if (PAL_Initialize(argc, argv))
{
return FAIL;
}
DoStrTest(convert("foo bar"), convert("foo %S"), "bar");
DoStrTest(convert("foo bar"), convert("foo %2S"), "ba");
DoStrTest(convert("foo bar"), convert("foo %hS"), "bar");
DoWStrTest(convert("foo bar"), convert("foo %lS"), convert("bar"));
DoStrTest(convert("foo bar"), convert("foo %LS"), "bar");
DoStrTest(convert("foo bar"), convert("foo %I64S"), "bar");
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================================
**
** Source: test12.c
**
** Purpose: Tests swscanf with wide strings
**
**
**==========================================================================*/
#include <palsuite.h>
#include "../swscanf.h"
PALTEST(c_runtime_swscanf_test12_paltest_swscanf_test12, "c_runtime/swscanf/test12/paltest_swscanf_test12")
{
if (PAL_Initialize(argc, argv))
{
return FAIL;
}
DoStrTest(convert("foo bar"), convert("foo %S"), "bar");
DoStrTest(convert("foo bar"), convert("foo %2S"), "ba");
DoStrTest(convert("foo bar"), convert("foo %hS"), "bar");
DoWStrTest(convert("foo bar"), convert("foo %lS"), convert("bar"));
DoStrTest(convert("foo bar"), convert("foo %LS"), "bar");
DoStrTest(convert("foo bar"), convert("foo %I64S"), "bar");
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/Methodical/gc_poll/GCPollNative.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include <cstdio>
#include <cstdint>
#include <atomic>
#if defined(_MSC_VER)
#define STDMETHODCALLTYPE __stdcall
#define EXPORT(type) extern "C" type __declspec(dllexport)
#else // !defined(_MSC_VER)
#ifdef __i386__
#define STDMETHODCALLTYPE __attribute__((stdcall))
#else
#define STDMETHODCALLTYPE
#endif
#define EXPORT(type) extern "C" __attribute__((visibility("default"))) type
#endif // defined(_MSC_VER)
namespace
{
std::atomic<uint64_t> _n{ 0 };
template<typename T>
T NextUInt(T t)
{
return (T)((++_n) + t);
}
}
EXPORT(uint32_t) STDMETHODCALLTYPE NextUInt32(uint32_t t)
{
return NextUInt(t);
}
EXPORT(uint64_t) STDMETHODCALLTYPE NextUInt64(uint64_t t)
{
return NextUInt(t);
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include <cstdio>
#include <cstdint>
#include <atomic>
#if defined(_MSC_VER)
#define STDMETHODCALLTYPE __stdcall
#define EXPORT(type) extern "C" type __declspec(dllexport)
#else // !defined(_MSC_VER)
#ifdef __i386__
#define STDMETHODCALLTYPE __attribute__((stdcall))
#else
#define STDMETHODCALLTYPE
#endif
#define EXPORT(type) extern "C" __attribute__((visibility("default"))) type
#endif // defined(_MSC_VER)
namespace
{
std::atomic<uint64_t> _n{ 0 };
template<typename T>
T NextUInt(T t)
{
return (T)((++_n) + t);
}
}
EXPORT(uint32_t) STDMETHODCALLTYPE NextUInt32(uint32_t t)
{
return NextUInt(t);
}
EXPORT(uint64_t) STDMETHODCALLTYPE NextUInt64(uint64_t t)
{
return NextUInt(t);
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/miscellaneous/SetEnvironmentVariableA/test4/test4.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================
** Source : test4.c
**
** Purpose: Test for SetEnvironmentVariableA() function
** Create environment variables that differ only
** in case and verify that they return the appropriate
** value in the WIN32 Environment
**
**
===========================================================*/
#include <palsuite.h>
PALTEST(miscellaneous_SetEnvironmentVariableA_test4_paltest_setenvironmentvariablea_test4, "miscellaneous/SetEnvironmentVariableA/test4/paltest_setenvironmentvariablea_test4")
{
#if WIN32
/* Define some buffers needed for the function */
char * pResultBuffer = NULL;
char FirstEnvironmentVariable[] = {"PALTEST"};
char FirstEnvironmentValue[] = {"FIRST"};
char ModifiedEnvVar[] = {"paltest"};
DWORD size = 0;
BOOL bRc = TRUE;
/*
* Initialize the PAL and return FAILURE if this fails
*/
if(0 != (PAL_Initialize(argc, argv)))
{
return FAIL;
}
/* Set the first environment variable */
bRc = SetEnvironmentVariableA(FirstEnvironmentVariable,
FirstEnvironmentValue);
if(!bRc)
{
Fail("ERROR: SetEnvironmentVariable failed to set a "
"proper environment variable with error %u.\n",
GetLastError());
}
/* Normal case, PATH should fit into this buffer */
size = GetEnvironmentVariableA(ModifiedEnvVar,
pResultBuffer,
0);
/* To account for the null character at the end of the string */
size = size + 1;
pResultBuffer = (char*)malloc(sizeof(char)*size);
if ( pResultBuffer == NULL )
{
Fail("ERROR: Failed to allocate memory for pResultBuffer pointer.\n");
}
/* Try to retrieve the value of the first environment variable */
GetEnvironmentVariableA(ModifiedEnvVar,
pResultBuffer,
size);
if ( pResultBuffer == NULL )
{
free(pResultBuffer);
Fail("ERROR: GetEnvironmentVariable failed to return a value "
"from a proper environment variable with error %u.\n",
GetLastError());
}
/* Compare the strings to see that the correct variable was returned */
if(strcmp(pResultBuffer,FirstEnvironmentValue) != 0)
{
Trace("ERROR: The value in the buffer should have been '%s' but "
"was really '%s'.\n",FirstEnvironmentValue, pResultBuffer);
free(pResultBuffer);
Fail("");
}
free(pResultBuffer);
PAL_Terminate();
return PASS;
#else
return PASS;
#endif
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================
** Source : test4.c
**
** Purpose: Test for SetEnvironmentVariableA() function
** Create environment variables that differ only
** in case and verify that they return the appropriate
** value in the WIN32 Environment
**
**
===========================================================*/
#include <palsuite.h>
PALTEST(miscellaneous_SetEnvironmentVariableA_test4_paltest_setenvironmentvariablea_test4, "miscellaneous/SetEnvironmentVariableA/test4/paltest_setenvironmentvariablea_test4")
{
#if WIN32
/* Define some buffers needed for the function */
char * pResultBuffer = NULL;
char FirstEnvironmentVariable[] = {"PALTEST"};
char FirstEnvironmentValue[] = {"FIRST"};
char ModifiedEnvVar[] = {"paltest"};
DWORD size = 0;
BOOL bRc = TRUE;
/*
* Initialize the PAL and return FAILURE if this fails
*/
if(0 != (PAL_Initialize(argc, argv)))
{
return FAIL;
}
/* Set the first environment variable */
bRc = SetEnvironmentVariableA(FirstEnvironmentVariable,
FirstEnvironmentValue);
if(!bRc)
{
Fail("ERROR: SetEnvironmentVariable failed to set a "
"proper environment variable with error %u.\n",
GetLastError());
}
/* Normal case, PATH should fit into this buffer */
size = GetEnvironmentVariableA(ModifiedEnvVar,
pResultBuffer,
0);
/* To account for the null character at the end of the string */
size = size + 1;
pResultBuffer = (char*)malloc(sizeof(char)*size);
if ( pResultBuffer == NULL )
{
Fail("ERROR: Failed to allocate memory for pResultBuffer pointer.\n");
}
/* Try to retrieve the value of the first environment variable */
GetEnvironmentVariableA(ModifiedEnvVar,
pResultBuffer,
size);
if ( pResultBuffer == NULL )
{
free(pResultBuffer);
Fail("ERROR: GetEnvironmentVariable failed to return a value "
"from a proper environment variable with error %u.\n",
GetLastError());
}
/* Compare the strings to see that the correct variable was returned */
if(strcmp(pResultBuffer,FirstEnvironmentValue) != 0)
{
Trace("ERROR: The value in the buffer should have been '%s' but "
"was really '%s'.\n",FirstEnvironmentValue, pResultBuffer);
free(pResultBuffer);
Fail("");
}
free(pResultBuffer);
PAL_Terminate();
return PASS;
#else
return PASS;
#endif
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/libs/System.Security.Cryptography.Native.Apple/pal_keyagree.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "pal_seckey.h"
#include "pal_compiler.h"
#include <Security/Security.h>
/*
Perform the EC Diffie-Hellman key agreement between the provided keys.
Follows pal_seckey return conventions.
*/
PALEXPORT int32_t
AppleCryptoNative_EcdhKeyAgree(SecKeyRef privateKey, SecKeyRef publicKey, CFDataRef* pAgreeOut, CFErrorRef* pErrorOut);
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "pal_seckey.h"
#include "pal_compiler.h"
#include <Security/Security.h>
/*
Perform the EC Diffie-Hellman key agreement between the provided keys.
Follows pal_seckey return conventions.
*/
PALEXPORT int32_t
AppleCryptoNative_EcdhKeyAgree(SecKeyRef privateKey, SecKeyRef publicKey, CFDataRef* pAgreeOut, CFErrorRef* pErrorOut);
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/debug/createdump/datatarget.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
class CrashInfo;
class DumpDataTarget : public ICLRDataTarget
{
private:
LONG m_ref; // reference count
CrashInfo& m_crashInfo;
// no public copy constructor
DumpDataTarget(const DumpDataTarget&) = delete;
void operator=(const DumpDataTarget&) = delete;
public:
DumpDataTarget(CrashInfo& crashInfo);
virtual ~DumpDataTarget();
//
// IUnknown
//
STDMETHOD(QueryInterface)(___in REFIID InterfaceId, ___out PVOID* Interface);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
//
// ICLRDataTarget
//
virtual HRESULT STDMETHODCALLTYPE GetMachineType(
/* [out] */ ULONG32 *machine);
virtual HRESULT STDMETHODCALLTYPE GetPointerSize(
/* [out] */ ULONG32 *size);
virtual HRESULT STDMETHODCALLTYPE GetImageBase(
/* [string][in] */ LPCWSTR moduleName,
/* [out] */ CLRDATA_ADDRESS *baseAddress);
virtual HRESULT STDMETHODCALLTYPE ReadVirtual(
/* [in] */ CLRDATA_ADDRESS address,
/* [length_is][size_is][out] */ PBYTE buffer,
/* [in] */ ULONG32 size,
/* [optional][out] */ ULONG32 *done);
virtual HRESULT STDMETHODCALLTYPE WriteVirtual(
/* [in] */ CLRDATA_ADDRESS address,
/* [size_is][in] */ PBYTE buffer,
/* [in] */ ULONG32 size,
/* [optional][out] */ ULONG32 *done);
virtual HRESULT STDMETHODCALLTYPE GetTLSValue(
/* [in] */ ULONG32 threadID,
/* [in] */ ULONG32 index,
/* [out] */ CLRDATA_ADDRESS* value);
virtual HRESULT STDMETHODCALLTYPE SetTLSValue(
/* [in] */ ULONG32 threadID,
/* [in] */ ULONG32 index,
/* [in] */ CLRDATA_ADDRESS value);
virtual HRESULT STDMETHODCALLTYPE GetCurrentThreadID(
/* [out] */ ULONG32* threadID);
virtual HRESULT STDMETHODCALLTYPE GetThreadContext(
/* [in] */ ULONG32 threadID,
/* [in] */ ULONG32 contextFlags,
/* [in] */ ULONG32 contextSize,
/* [out, size_is(contextSize)] */ PBYTE context);
virtual HRESULT STDMETHODCALLTYPE SetThreadContext(
/* [in] */ ULONG32 threadID,
/* [in] */ ULONG32 contextSize,
/* [in, size_is(contextSize)] */ PBYTE context);
virtual HRESULT STDMETHODCALLTYPE Request(
/* [in] */ ULONG32 reqCode,
/* [in] */ ULONG32 inBufferSize,
/* [size_is][in] */ BYTE *inBuffer,
/* [in] */ ULONG32 outBufferSize,
/* [size_is][out] */ BYTE *outBuffer);
};
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
class CrashInfo;
class DumpDataTarget : public ICLRDataTarget
{
private:
LONG m_ref; // reference count
CrashInfo& m_crashInfo;
// no public copy constructor
DumpDataTarget(const DumpDataTarget&) = delete;
void operator=(const DumpDataTarget&) = delete;
public:
DumpDataTarget(CrashInfo& crashInfo);
virtual ~DumpDataTarget();
//
// IUnknown
//
STDMETHOD(QueryInterface)(___in REFIID InterfaceId, ___out PVOID* Interface);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
//
// ICLRDataTarget
//
virtual HRESULT STDMETHODCALLTYPE GetMachineType(
/* [out] */ ULONG32 *machine);
virtual HRESULT STDMETHODCALLTYPE GetPointerSize(
/* [out] */ ULONG32 *size);
virtual HRESULT STDMETHODCALLTYPE GetImageBase(
/* [string][in] */ LPCWSTR moduleName,
/* [out] */ CLRDATA_ADDRESS *baseAddress);
virtual HRESULT STDMETHODCALLTYPE ReadVirtual(
/* [in] */ CLRDATA_ADDRESS address,
/* [length_is][size_is][out] */ PBYTE buffer,
/* [in] */ ULONG32 size,
/* [optional][out] */ ULONG32 *done);
virtual HRESULT STDMETHODCALLTYPE WriteVirtual(
/* [in] */ CLRDATA_ADDRESS address,
/* [size_is][in] */ PBYTE buffer,
/* [in] */ ULONG32 size,
/* [optional][out] */ ULONG32 *done);
virtual HRESULT STDMETHODCALLTYPE GetTLSValue(
/* [in] */ ULONG32 threadID,
/* [in] */ ULONG32 index,
/* [out] */ CLRDATA_ADDRESS* value);
virtual HRESULT STDMETHODCALLTYPE SetTLSValue(
/* [in] */ ULONG32 threadID,
/* [in] */ ULONG32 index,
/* [in] */ CLRDATA_ADDRESS value);
virtual HRESULT STDMETHODCALLTYPE GetCurrentThreadID(
/* [out] */ ULONG32* threadID);
virtual HRESULT STDMETHODCALLTYPE GetThreadContext(
/* [in] */ ULONG32 threadID,
/* [in] */ ULONG32 contextFlags,
/* [in] */ ULONG32 contextSize,
/* [out, size_is(contextSize)] */ PBYTE context);
virtual HRESULT STDMETHODCALLTYPE SetThreadContext(
/* [in] */ ULONG32 threadID,
/* [in] */ ULONG32 contextSize,
/* [in, size_is(contextSize)] */ PBYTE context);
virtual HRESULT STDMETHODCALLTYPE Request(
/* [in] */ ULONG32 reqCode,
/* [in] */ ULONG32 inBufferSize,
/* [size_is][in] */ BYTE *inBuffer,
/* [in] */ ULONG32 outBufferSize,
/* [size_is][out] */ BYTE *outBuffer);
};
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/debug/ee/debuggermodule.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//*****************************************************************************
// File: DebuggerModule.cpp
//
//
// Stuff for tracking DebuggerModules.
//
//*****************************************************************************
#include "stdafx.h"
#include "../inc/common.h"
#include "eeconfig.h" // This is here even for retail & free builds...
#include "vars.hpp"
#include <limits.h>
#include "ilformatter.h"
#include "debuginfostore.h"
/* ------------------------------------------------------------------------ *
* Debugger Module routines
* ------------------------------------------------------------------------ */
// <TODO> (8/12/2002)
// We need to stop lying to the debugger about not sharing Modules.
// Primary Modules allow a transition to that. Once we stop lying,
// then all modules will be their own Primary.
// </TODO>
// Select the primary module.
// Primary Modules are selected DebuggerModules that map 1:1 w/ Module*.
// If the runtime module is not shared, then we're our own Primary Module.
// If the Runtime module is shared, the primary module is some specific instance.
// Note that a domain-neutral module can be loaded into multiple domains without
// being loaded into the default domain, and so there is no "primary module" as far
// as the CLR is concerned - we just pick any one and call it primary.
void DebuggerModule::PickPrimaryModule()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
Debugger::DebuggerDataLockHolder ch(g_pDebugger);
LOG((LF_CORDB, LL_INFO100000, "DM::PickPrimaryModule, this=0x%p\n", this));
// We're our own primary module, unless something else proves otherwise.
// Note that we should be able to skip all of this if this module is not domain neutral
m_pPrimaryModule = this;
// This should be thread safe because our creation for the DebuggerModules
// are serialized.
// Lookup our Runtime Module. If it's already in there,
// then
DebuggerModuleTable * pTable = g_pDebugger->GetModuleTable();
// If the table doesn't exist yet, then we must be a primary module.
if (pTable == NULL)
{
LOG((LF_CORDB, LL_INFO100000, "DM::PickPrimaryModule, this=0x%p, table not created yet\n", this));
return;
}
// Look through existing module list to find a common primary DebuggerModule
// for the given EE Module. We don't know what order we'll traverse in.
HASHFIND f;
for (DebuggerModule * m = pTable->GetFirstModule(&f);
m != NULL;
m = pTable->GetNextModule(&f))
{
if (m->GetRuntimeModule() == this->GetRuntimeModule())
{
// Make sure we're picking another primary module.
_ASSERTE(m->GetPrimaryModule() != m);
}
} // end for
// If we got here, then this instance is a Primary Module.
LOG((LF_CORDB, LL_INFO100000, "DM::PickPrimaryModule, this=%p is first, primary.\n", this));
}
void DebuggerModule::SetCanChangeJitFlags(bool fCanChangeJitFlags)
{
m_fCanChangeJitFlags = fCanChangeJitFlags;
}
#ifndef DACCESS_COMPILE
DebuggerModuleTable::DebuggerModuleTable() : CHashTableAndData<CNewZeroData>(101)
{
WRAPPER_NO_CONTRACT;
SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE;
NewInit(101, sizeof(DebuggerModuleEntry), 101);
}
DebuggerModuleTable::~DebuggerModuleTable()
{
WRAPPER_NO_CONTRACT;
_ASSERTE(ThreadHoldsLock());
Clear();
}
#ifdef _DEBUG
bool DebuggerModuleTable::ThreadHoldsLock()
{
// In shutdown (g_fProcessDetach), the shutdown thread implicitly holds all locks.
return g_fProcessDetach || g_pDebugger->HasDebuggerDataLock();
}
#endif
//
// RemoveModules removes any module loaded into the given appdomain from the hash. This is used when we send an
// ExitAppdomain event to ensure that there are no leftover modules in the hash. This can happen when we have shared
// modules that aren't properly accounted for in the CLR. We miss sending UnloadModule events for those modules, so
// we clean them up with this method.
//
void DebuggerModuleTable::RemoveModules(AppDomain *pAppDomain)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
LOG((LF_CORDB, LL_INFO1000, "DMT::RM removing all modules from AD 0x%08x\n", pAppDomain));
_ASSERTE(ThreadHoldsLock());
HASHFIND hf;
DebuggerModuleEntry *pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
while (pDME != NULL)
{
DebuggerModule *pDM = pDME->module;
if (pDM->GetAppDomain() == pAppDomain)
{
LOG((LF_CORDB, LL_INFO1000, "DMT::RM removing DebuggerModule 0x%08x\n", pDM));
// Defer to the normal logic in RemoveModule for the actual removal. This accurately simulates what
// happens when we process an UnloadModule event.
RemoveModule(pDM->GetRuntimeModule(), pAppDomain);
// Start back at the first entry since we just modified the hash.
pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
}
else
{
pDME = (DebuggerModuleEntry *) FindNextEntry(&hf);
}
}
LOG((LF_CORDB, LL_INFO1000, "DMT::RM done removing all modules from AD 0x%08x\n", pAppDomain));
}
void DebuggerModuleTable::Clear()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(ThreadHoldsLock());
HASHFIND hf;
DebuggerModuleEntry *pDME;
pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
while (pDME)
{
DebuggerModule *pDM = pDME->module;
Module *pEEM = pDM->GetRuntimeModule();
TRACE_FREE(pDME->module);
DeleteInteropSafe(pDM);
Delete(HASH(pEEM), (HASHENTRY *) pDME);
pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
}
CHashTableAndData<CNewZeroData>::Clear();
}
void DebuggerModuleTable::AddModule(DebuggerModule *pModule)
{
CONTRACTL
{
THROWS;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(ThreadHoldsLock());
_ASSERTE(pModule != NULL);
LOG((LF_CORDB, LL_EVERYTHING, "DMT::AM: DebuggerMod:0x%x Module:0x%x AD:0x%x\n",
pModule, pModule->GetRuntimeModule(), pModule->GetAppDomain()));
DebuggerModuleEntry * pEntry = (DebuggerModuleEntry *) Add(HASH(pModule->GetRuntimeModule()));
if (pEntry == NULL)
{
ThrowOutOfMemory();
}
pEntry->module = pModule;
// Don't need to update the primary module since it was set when we created the module.
_ASSERTE(pModule->GetPrimaryModule() != NULL);
}
//-----------------------------------------------------------------------------
// Remove a DebuggerModule from the module table when it gets notified.
// This occurs in response to the finalization of an unloaded AssemblyLoadContext.
//-----------------------------------------------------------------------------
void DebuggerModuleTable::RemoveModule(Module* pModule, AppDomain *pAppDomain)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
LOG((LF_CORDB, LL_INFO1000, "DMT::RM Attempting to remove Module:0x%x AD:0x%x\n", pModule, pAppDomain));
_ASSERTE(ThreadHoldsLock());
_ASSERTE(pModule != NULL);
HASHFIND hf;
for (DebuggerModuleEntry *pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
pDME != NULL;
pDME = (DebuggerModuleEntry*) FindNextEntry(&hf))
{
DebuggerModule *pDM = pDME->module;
Module* pRuntimeModule = pDM->GetRuntimeModule();
if ((pRuntimeModule == pModule) && (pDM->GetAppDomain() == pAppDomain))
{
LOG((LF_CORDB, LL_INFO1000, "DMT::RM Removing DebuggerMod:0x%x - Module:0x%x DF:0x%x AD:0x%x\n",
pDM, pModule, pDM->GetDomainAssembly(), pAppDomain));
TRACE_FREE(pDM);
DeleteInteropSafe(pDM);
Delete(HASH(pRuntimeModule), (HASHENTRY *) pDME);
_ASSERTE(GetModule(pModule, pAppDomain) == NULL);
return;
}
}
LOG((LF_CORDB, LL_INFO1000, "DMT::RM No debugger module found for Module:0x%x AD:0x%x\n", pModule, pAppDomain));
}
#endif // DACCESS_COMPILE
DebuggerModule *DebuggerModuleTable::GetModule(Module* module)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(module != NULL);
_ASSERTE(ThreadHoldsLock());
DebuggerModuleEntry *entry
= (DebuggerModuleEntry *) Find(HASH(module), KEY(module));
if (entry == NULL)
return NULL;
else
return entry->module;
}
// We should never look for a NULL Module *
DebuggerModule *DebuggerModuleTable::GetModule(Module* module, AppDomain* pAppDomain)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(module != NULL);
_ASSERTE(ThreadHoldsLock());
HASHFIND findmodule;
DebuggerModuleEntry *moduleentry;
for (moduleentry = (DebuggerModuleEntry*) FindFirstEntry(&findmodule);
moduleentry != NULL;
moduleentry = (DebuggerModuleEntry*) FindNextEntry(&findmodule))
{
DebuggerModule *pModule = moduleentry->module;
if ((pModule->GetRuntimeModule() == module) &&
(pModule->GetAppDomain() == pAppDomain))
return pModule;
}
// didn't find any match! So return a matching module for any app domain
return NULL;
}
DebuggerModule *DebuggerModuleTable::GetFirstModule(HASHFIND *info)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(ThreadHoldsLock());
DebuggerModuleEntry *entry = (DebuggerModuleEntry *) FindFirstEntry(info);
if (entry == NULL)
return NULL;
else
return entry->module;
}
DebuggerModule *DebuggerModuleTable::GetNextModule(HASHFIND *info)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(ThreadHoldsLock());
DebuggerModuleEntry *entry = (DebuggerModuleEntry *) FindNextEntry(info);
if (entry == NULL)
return NULL;
else
return entry->module;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//*****************************************************************************
// File: DebuggerModule.cpp
//
//
// Stuff for tracking DebuggerModules.
//
//*****************************************************************************
#include "stdafx.h"
#include "../inc/common.h"
#include "eeconfig.h" // This is here even for retail & free builds...
#include "vars.hpp"
#include <limits.h>
#include "ilformatter.h"
#include "debuginfostore.h"
/* ------------------------------------------------------------------------ *
* Debugger Module routines
* ------------------------------------------------------------------------ */
// <TODO> (8/12/2002)
// We need to stop lying to the debugger about not sharing Modules.
// Primary Modules allow a transition to that. Once we stop lying,
// then all modules will be their own Primary.
// </TODO>
// Select the primary module.
// Primary Modules are selected DebuggerModules that map 1:1 w/ Module*.
// If the runtime module is not shared, then we're our own Primary Module.
// If the Runtime module is shared, the primary module is some specific instance.
// Note that a domain-neutral module can be loaded into multiple domains without
// being loaded into the default domain, and so there is no "primary module" as far
// as the CLR is concerned - we just pick any one and call it primary.
void DebuggerModule::PickPrimaryModule()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
Debugger::DebuggerDataLockHolder ch(g_pDebugger);
LOG((LF_CORDB, LL_INFO100000, "DM::PickPrimaryModule, this=0x%p\n", this));
// We're our own primary module, unless something else proves otherwise.
// Note that we should be able to skip all of this if this module is not domain neutral
m_pPrimaryModule = this;
// This should be thread safe because our creation for the DebuggerModules
// are serialized.
// Lookup our Runtime Module. If it's already in there,
// then
DebuggerModuleTable * pTable = g_pDebugger->GetModuleTable();
// If the table doesn't exist yet, then we must be a primary module.
if (pTable == NULL)
{
LOG((LF_CORDB, LL_INFO100000, "DM::PickPrimaryModule, this=0x%p, table not created yet\n", this));
return;
}
// Look through existing module list to find a common primary DebuggerModule
// for the given EE Module. We don't know what order we'll traverse in.
HASHFIND f;
for (DebuggerModule * m = pTable->GetFirstModule(&f);
m != NULL;
m = pTable->GetNextModule(&f))
{
if (m->GetRuntimeModule() == this->GetRuntimeModule())
{
// Make sure we're picking another primary module.
_ASSERTE(m->GetPrimaryModule() != m);
}
} // end for
// If we got here, then this instance is a Primary Module.
LOG((LF_CORDB, LL_INFO100000, "DM::PickPrimaryModule, this=%p is first, primary.\n", this));
}
void DebuggerModule::SetCanChangeJitFlags(bool fCanChangeJitFlags)
{
m_fCanChangeJitFlags = fCanChangeJitFlags;
}
#ifndef DACCESS_COMPILE
DebuggerModuleTable::DebuggerModuleTable() : CHashTableAndData<CNewZeroData>(101)
{
WRAPPER_NO_CONTRACT;
SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE;
NewInit(101, sizeof(DebuggerModuleEntry), 101);
}
DebuggerModuleTable::~DebuggerModuleTable()
{
WRAPPER_NO_CONTRACT;
_ASSERTE(ThreadHoldsLock());
Clear();
}
#ifdef _DEBUG
bool DebuggerModuleTable::ThreadHoldsLock()
{
// In shutdown (g_fProcessDetach), the shutdown thread implicitly holds all locks.
return g_fProcessDetach || g_pDebugger->HasDebuggerDataLock();
}
#endif
//
// RemoveModules removes any module loaded into the given appdomain from the hash. This is used when we send an
// ExitAppdomain event to ensure that there are no leftover modules in the hash. This can happen when we have shared
// modules that aren't properly accounted for in the CLR. We miss sending UnloadModule events for those modules, so
// we clean them up with this method.
//
void DebuggerModuleTable::RemoveModules(AppDomain *pAppDomain)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
LOG((LF_CORDB, LL_INFO1000, "DMT::RM removing all modules from AD 0x%08x\n", pAppDomain));
_ASSERTE(ThreadHoldsLock());
HASHFIND hf;
DebuggerModuleEntry *pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
while (pDME != NULL)
{
DebuggerModule *pDM = pDME->module;
if (pDM->GetAppDomain() == pAppDomain)
{
LOG((LF_CORDB, LL_INFO1000, "DMT::RM removing DebuggerModule 0x%08x\n", pDM));
// Defer to the normal logic in RemoveModule for the actual removal. This accurately simulates what
// happens when we process an UnloadModule event.
RemoveModule(pDM->GetRuntimeModule(), pAppDomain);
// Start back at the first entry since we just modified the hash.
pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
}
else
{
pDME = (DebuggerModuleEntry *) FindNextEntry(&hf);
}
}
LOG((LF_CORDB, LL_INFO1000, "DMT::RM done removing all modules from AD 0x%08x\n", pAppDomain));
}
void DebuggerModuleTable::Clear()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(ThreadHoldsLock());
HASHFIND hf;
DebuggerModuleEntry *pDME;
pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
while (pDME)
{
DebuggerModule *pDM = pDME->module;
Module *pEEM = pDM->GetRuntimeModule();
TRACE_FREE(pDME->module);
DeleteInteropSafe(pDM);
Delete(HASH(pEEM), (HASHENTRY *) pDME);
pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
}
CHashTableAndData<CNewZeroData>::Clear();
}
void DebuggerModuleTable::AddModule(DebuggerModule *pModule)
{
CONTRACTL
{
THROWS;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(ThreadHoldsLock());
_ASSERTE(pModule != NULL);
LOG((LF_CORDB, LL_EVERYTHING, "DMT::AM: DebuggerMod:0x%x Module:0x%x AD:0x%x\n",
pModule, pModule->GetRuntimeModule(), pModule->GetAppDomain()));
DebuggerModuleEntry * pEntry = (DebuggerModuleEntry *) Add(HASH(pModule->GetRuntimeModule()));
if (pEntry == NULL)
{
ThrowOutOfMemory();
}
pEntry->module = pModule;
// Don't need to update the primary module since it was set when we created the module.
_ASSERTE(pModule->GetPrimaryModule() != NULL);
}
//-----------------------------------------------------------------------------
// Remove a DebuggerModule from the module table when it gets notified.
// This occurs in response to the finalization of an unloaded AssemblyLoadContext.
//-----------------------------------------------------------------------------
void DebuggerModuleTable::RemoveModule(Module* pModule, AppDomain *pAppDomain)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
LOG((LF_CORDB, LL_INFO1000, "DMT::RM Attempting to remove Module:0x%x AD:0x%x\n", pModule, pAppDomain));
_ASSERTE(ThreadHoldsLock());
_ASSERTE(pModule != NULL);
HASHFIND hf;
for (DebuggerModuleEntry *pDME = (DebuggerModuleEntry *) FindFirstEntry(&hf);
pDME != NULL;
pDME = (DebuggerModuleEntry*) FindNextEntry(&hf))
{
DebuggerModule *pDM = pDME->module;
Module* pRuntimeModule = pDM->GetRuntimeModule();
if ((pRuntimeModule == pModule) && (pDM->GetAppDomain() == pAppDomain))
{
LOG((LF_CORDB, LL_INFO1000, "DMT::RM Removing DebuggerMod:0x%x - Module:0x%x DF:0x%x AD:0x%x\n",
pDM, pModule, pDM->GetDomainAssembly(), pAppDomain));
TRACE_FREE(pDM);
DeleteInteropSafe(pDM);
Delete(HASH(pRuntimeModule), (HASHENTRY *) pDME);
_ASSERTE(GetModule(pModule, pAppDomain) == NULL);
return;
}
}
LOG((LF_CORDB, LL_INFO1000, "DMT::RM No debugger module found for Module:0x%x AD:0x%x\n", pModule, pAppDomain));
}
#endif // DACCESS_COMPILE
DebuggerModule *DebuggerModuleTable::GetModule(Module* module)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(module != NULL);
_ASSERTE(ThreadHoldsLock());
DebuggerModuleEntry *entry
= (DebuggerModuleEntry *) Find(HASH(module), KEY(module));
if (entry == NULL)
return NULL;
else
return entry->module;
}
// We should never look for a NULL Module *
DebuggerModule *DebuggerModuleTable::GetModule(Module* module, AppDomain* pAppDomain)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(module != NULL);
_ASSERTE(ThreadHoldsLock());
HASHFIND findmodule;
DebuggerModuleEntry *moduleentry;
for (moduleentry = (DebuggerModuleEntry*) FindFirstEntry(&findmodule);
moduleentry != NULL;
moduleentry = (DebuggerModuleEntry*) FindNextEntry(&findmodule))
{
DebuggerModule *pModule = moduleentry->module;
if ((pModule->GetRuntimeModule() == module) &&
(pModule->GetAppDomain() == pAppDomain))
return pModule;
}
// didn't find any match! So return a matching module for any app domain
return NULL;
}
DebuggerModule *DebuggerModuleTable::GetFirstModule(HASHFIND *info)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(ThreadHoldsLock());
DebuggerModuleEntry *entry = (DebuggerModuleEntry *) FindFirstEntry(info);
if (entry == NULL)
return NULL;
else
return entry->module;
}
DebuggerModule *DebuggerModuleTable::GetNextModule(HASHFIND *info)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
_ASSERTE(ThreadHoldsLock());
DebuggerModuleEntry *entry = (DebuggerModuleEntry *) FindNextEntry(info);
if (entry == NULL)
return NULL;
else
return entry->module;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/file_io/SetFilePointer/test7/SetFilePointer.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: SetFilePointer.c (test 7)
**
** Purpose: Tests the PAL implementation of the SetFilePointer function.
** Test the FILE_END option with high order support
**
** Assumes Successful:
** CreateFile
** ReadFile
** WriteFile
** strlen
** CloseHandle
** strcmp
** GetFileSize
**
**
**===================================================================*/
#include <palsuite.h>
PALTEST(file_io_SetFilePointer_test7_paltest_setfilepointer_test7, "file_io/SetFilePointer/test7/paltest_setfilepointer_test7")
{
HANDLE hFile = NULL;
DWORD dwOffset = 0;
LONG dwHighOrder = 0;
DWORD dwReturnedOffset = 0;
LONG dwReturnedHighOrder = 0;
DWORD dwRc = 0;
if (0 != PAL_Initialize(argc,argv))
{
return FAIL;
}
/* create a test file */
hFile = CreateFile(szTextFile,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
Fail("SetFilePointer: ERROR -> Unable to create file \"%s\".\n",
szTextFile);
}
/* move -1 from beginning which should fail */
dwHighOrder = -1;
dwOffset = 0;
dwRc = SetFilePointer(hFile, dwOffset, &dwHighOrder, FILE_END);
if (dwRc != INVALID_SET_FILE_POINTER)
{
Trace("SetFilePointer: ERROR -> Succeeded to move the pointer "
"before the beginning of the file.\n");
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
/* move the pointer ahead in the file and verify */
dwHighOrder = 1;
dwOffset = 10;
dwRc = SetFilePointer(hFile, dwOffset, &dwHighOrder, FILE_END);
if ((dwRc != 10) || (dwHighOrder != 1))
{
Trace("SetFilePointer: ERROR -> Asked to move 4GB plus 10 bytes from "
"the beginning of the file but didn't.\n");
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
else
{
/* verify results */
if (SetEndOfFile(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Call to SetEndOfFile failed with "
"error code: %d\n",
GetLastError());
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
dwReturnedOffset = GetFileSize(hFile, (DWORD*)&dwReturnedHighOrder);
if ((dwReturnedOffset != dwOffset) || (dwReturnedHighOrder != dwHighOrder))
{
Trace("SetFilePointer: ERROR -> Asked to move far past the "
"end of the file. low order sent: %ld low order returned: %ld "
"high order sent: %ld high order returned: %ld",
dwOffset, dwReturnedOffset,
dwHighOrder, dwReturnedHighOrder);
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
}
/*
* move the pointer backwards in the file and verify
*/
dwOffset = 0;
dwHighOrder = -1;
dwRc = SetFilePointer(hFile, dwOffset, &dwHighOrder, FILE_END);
if (dwRc != 10)
{
Trace("SetFilePointer: ERROR -> Asked to move back to 10 bytes from the"
"beginning of the file but moved it to position %ld.\n", dwRc);
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
else
{
/* verify results */
dwReturnedHighOrder = 0;
dwRc = SetFilePointer(hFile, 0, &dwReturnedHighOrder, FILE_CURRENT);
if (dwRc != 10)
{
Trace("SetFilePointer: ERROR -> Asked for current position. "
"Should be 10 but was %ld.\n", dwRc);
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file"
" \"%s\".\n", szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file"
" \"%s\".\n", szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
}
/* clean up, clean up, everybody do their share... */
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
if (!DeleteFileA(szTextFile))
{
Fail("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: SetFilePointer.c (test 7)
**
** Purpose: Tests the PAL implementation of the SetFilePointer function.
** Test the FILE_END option with high order support
**
** Assumes Successful:
** CreateFile
** ReadFile
** WriteFile
** strlen
** CloseHandle
** strcmp
** GetFileSize
**
**
**===================================================================*/
#include <palsuite.h>
PALTEST(file_io_SetFilePointer_test7_paltest_setfilepointer_test7, "file_io/SetFilePointer/test7/paltest_setfilepointer_test7")
{
HANDLE hFile = NULL;
DWORD dwOffset = 0;
LONG dwHighOrder = 0;
DWORD dwReturnedOffset = 0;
LONG dwReturnedHighOrder = 0;
DWORD dwRc = 0;
if (0 != PAL_Initialize(argc,argv))
{
return FAIL;
}
/* create a test file */
hFile = CreateFile(szTextFile,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
Fail("SetFilePointer: ERROR -> Unable to create file \"%s\".\n",
szTextFile);
}
/* move -1 from beginning which should fail */
dwHighOrder = -1;
dwOffset = 0;
dwRc = SetFilePointer(hFile, dwOffset, &dwHighOrder, FILE_END);
if (dwRc != INVALID_SET_FILE_POINTER)
{
Trace("SetFilePointer: ERROR -> Succeeded to move the pointer "
"before the beginning of the file.\n");
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
/* move the pointer ahead in the file and verify */
dwHighOrder = 1;
dwOffset = 10;
dwRc = SetFilePointer(hFile, dwOffset, &dwHighOrder, FILE_END);
if ((dwRc != 10) || (dwHighOrder != 1))
{
Trace("SetFilePointer: ERROR -> Asked to move 4GB plus 10 bytes from "
"the beginning of the file but didn't.\n");
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
else
{
/* verify results */
if (SetEndOfFile(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Call to SetEndOfFile failed with "
"error code: %d\n",
GetLastError());
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
dwReturnedOffset = GetFileSize(hFile, (DWORD*)&dwReturnedHighOrder);
if ((dwReturnedOffset != dwOffset) || (dwReturnedHighOrder != dwHighOrder))
{
Trace("SetFilePointer: ERROR -> Asked to move far past the "
"end of the file. low order sent: %ld low order returned: %ld "
"high order sent: %ld high order returned: %ld",
dwOffset, dwReturnedOffset,
dwHighOrder, dwReturnedHighOrder);
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
}
/*
* move the pointer backwards in the file and verify
*/
dwOffset = 0;
dwHighOrder = -1;
dwRc = SetFilePointer(hFile, dwOffset, &dwHighOrder, FILE_END);
if (dwRc != 10)
{
Trace("SetFilePointer: ERROR -> Asked to move back to 10 bytes from the"
"beginning of the file but moved it to position %ld.\n", dwRc);
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
else
{
/* verify results */
dwReturnedHighOrder = 0;
dwRc = SetFilePointer(hFile, 0, &dwReturnedHighOrder, FILE_CURRENT);
if (dwRc != 10)
{
Trace("SetFilePointer: ERROR -> Asked for current position. "
"Should be 10 but was %ld.\n", dwRc);
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file"
" \"%s\".\n", szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file"
" \"%s\".\n", szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
}
/* clean up, clean up, everybody do their share... */
if (CloseHandle(hFile) != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
if (!DeleteFileA(szTextFile))
{
Fail("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/Interop/COM/NativeServer/EventTesting.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "Servers.h"
class EventTesting :
public UnknownImpl,
public IEventTesting,
public IConnectionPointContainer,
public IConnectionPoint
{
private: // static
static const WCHAR * const Names[];
static const int NamesCount;
private:
IDispatch *_eventConnections[32];
public:
EventTesting()
{
// Ensure connections array is null
::memset(_eventConnections, 0, sizeof(_eventConnections));
}
public: // IDispatch
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(
/* [out] */ __RPC__out UINT *pctinfo)
{
*pctinfo = 0;
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(
/* [in] */ __RPC__in REFIID,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId)
{
bool containsUnknown = false;
DISPID *curr = rgDispId;
for (UINT i = 0; i < cNames; ++i)
{
*curr = DISPID_UNKNOWN;
LPOLESTR name = rgszNames[i];
for (int j = 1; j < NamesCount; ++j)
{
const WCHAR *nameMaybe = Names[j];
if (::TP_wcmp_s(name, nameMaybe) == 0)
{
*curr = DISPID{ j };
break;
}
}
containsUnknown &= (*curr == DISPID_UNKNOWN);
curr++;
}
return (containsUnknown) ? DISP_E_UNKNOWNNAME : S_OK;
}
virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(
/* [annotation][in] */ _In_ DISPID dispIdMember,
/* [annotation][in] */ _In_ REFIID riid,
/* [annotation][in] */ _In_ LCID lcid,
/* [annotation][in] */ _In_ WORD wFlags,
/* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams,
/* [annotation][out] */ _Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */ _Out_opt_ UINT *puArgErr)
{
//
// Note that arguments are received in reverse order for IDispatch::Invoke()
//
switch (dispIdMember)
{
case 1:
{
return FireEvent();
}
}
return E_NOTIMPL;
}
public: // IEventTesting
virtual HRESULT STDMETHODCALLTYPE FireEvent()
{
return FireEvent_Impl(1 /* DISPID for the FireEvent function */);
}
public: // IConnectionPointContainer
virtual HRESULT STDMETHODCALLTYPE EnumConnectionPoints(
/* [out] */ __RPC__deref_out_opt IEnumConnectionPoints **ppEnum)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE FindConnectionPoint(
/* [in] */ __RPC__in REFIID riid,
/* [out] */ __RPC__deref_out_opt IConnectionPoint **ppCP)
{
if (riid != IID_TestingEvents)
return CONNECT_E_NOCONNECTION;
return QueryInterface(__uuidof(*ppCP), (void**)ppCP);
}
public: // IConnectionPoint
virtual HRESULT STDMETHODCALLTYPE GetConnectionInterface(
/* [out] */ __RPC__out IID *pIID)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE GetConnectionPointContainer(
/* [out] */ __RPC__deref_out_opt IConnectionPointContainer **ppCPC)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE Advise(
/* [in] */ __RPC__in_opt IUnknown *pUnkSink,
/* [out] */ __RPC__out DWORD *pdwCookie)
{
if (pUnkSink == nullptr || pdwCookie == nullptr)
return E_POINTER;
for (DWORD i = 0; i < ARRAY_SIZE(_eventConnections); ++i)
{
if (_eventConnections[i] == nullptr)
{
IDispatch *handler;
HRESULT hr = pUnkSink->QueryInterface(IID_IDispatch, (void**)&handler);
if (hr != S_OK)
return CONNECT_E_CANNOTCONNECT;
_eventConnections[i] = handler;
*pdwCookie = i;
return S_OK;
}
}
return CONNECT_E_ADVISELIMIT;
}
virtual HRESULT STDMETHODCALLTYPE Unadvise(
/* [in] */ DWORD dwCookie)
{
if (0 <= dwCookie && dwCookie < ARRAY_SIZE(_eventConnections))
{
IDispatch *handler = _eventConnections[dwCookie];
if (handler != nullptr)
{
_eventConnections[dwCookie] = nullptr;
handler->Release();
return S_OK;
}
}
return E_POINTER;
}
virtual HRESULT STDMETHODCALLTYPE EnumConnections(
/* [out] */ __RPC__deref_out_opt IEnumConnections **ppEnum)
{
return E_NOTIMPL;
}
private:
HRESULT FireEvent_Impl(_In_ int dispId)
{
HRESULT hr = S_OK;
VARIANTARG arg;
::VariantInit(&arg);
arg.vt = VT_BSTR;
arg.bstrVal = TP_SysAllocString(Names[dispId]);
for (DWORD i = 0; i < ARRAY_SIZE(_eventConnections); ++i)
{
IDispatch *handler = _eventConnections[i];
if (handler != nullptr)
{
DISPPARAMS params{};
params.rgvarg = &arg;
params.cArgs = 1;
hr = handler->Invoke(
DISPATCHTESTINGEVENTS_DISPID_ONEVENT,
IID_NULL,
0,
DISPATCH_METHOD,
¶ms,
nullptr,
nullptr,
nullptr);
if (FAILED(hr))
break;
}
}
return ::VariantClear(&arg);
}
public: // IUnknown
STDMETHOD(QueryInterface)(
/* [in] */ REFIID riid,
/* [iid_is][out] */ _COM_Outptr_ void __RPC_FAR *__RPC_FAR *ppvObject)
{
return DoQueryInterface(riid, ppvObject,
static_cast<IDispatch *>(this),
static_cast<IEventTesting *>(this),
static_cast<IConnectionPointContainer *>(this),
static_cast<IConnectionPoint *>(this));
}
DEFINE_REF_COUNTING();
};
const WCHAR * const EventTesting::Names[] =
{
W("__RESERVED__"),
W("FireEvent"),
};
const int EventTesting::NamesCount = ARRAY_SIZE(EventTesting::Names);
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "Servers.h"
class EventTesting :
public UnknownImpl,
public IEventTesting,
public IConnectionPointContainer,
public IConnectionPoint
{
private: // static
static const WCHAR * const Names[];
static const int NamesCount;
private:
IDispatch *_eventConnections[32];
public:
EventTesting()
{
// Ensure connections array is null
::memset(_eventConnections, 0, sizeof(_eventConnections));
}
public: // IDispatch
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(
/* [out] */ __RPC__out UINT *pctinfo)
{
*pctinfo = 0;
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(
/* [in] */ __RPC__in REFIID,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId)
{
bool containsUnknown = false;
DISPID *curr = rgDispId;
for (UINT i = 0; i < cNames; ++i)
{
*curr = DISPID_UNKNOWN;
LPOLESTR name = rgszNames[i];
for (int j = 1; j < NamesCount; ++j)
{
const WCHAR *nameMaybe = Names[j];
if (::TP_wcmp_s(name, nameMaybe) == 0)
{
*curr = DISPID{ j };
break;
}
}
containsUnknown &= (*curr == DISPID_UNKNOWN);
curr++;
}
return (containsUnknown) ? DISP_E_UNKNOWNNAME : S_OK;
}
virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(
/* [annotation][in] */ _In_ DISPID dispIdMember,
/* [annotation][in] */ _In_ REFIID riid,
/* [annotation][in] */ _In_ LCID lcid,
/* [annotation][in] */ _In_ WORD wFlags,
/* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams,
/* [annotation][out] */ _Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */ _Out_opt_ UINT *puArgErr)
{
//
// Note that arguments are received in reverse order for IDispatch::Invoke()
//
switch (dispIdMember)
{
case 1:
{
return FireEvent();
}
}
return E_NOTIMPL;
}
public: // IEventTesting
virtual HRESULT STDMETHODCALLTYPE FireEvent()
{
return FireEvent_Impl(1 /* DISPID for the FireEvent function */);
}
public: // IConnectionPointContainer
virtual HRESULT STDMETHODCALLTYPE EnumConnectionPoints(
/* [out] */ __RPC__deref_out_opt IEnumConnectionPoints **ppEnum)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE FindConnectionPoint(
/* [in] */ __RPC__in REFIID riid,
/* [out] */ __RPC__deref_out_opt IConnectionPoint **ppCP)
{
if (riid != IID_TestingEvents)
return CONNECT_E_NOCONNECTION;
return QueryInterface(__uuidof(*ppCP), (void**)ppCP);
}
public: // IConnectionPoint
virtual HRESULT STDMETHODCALLTYPE GetConnectionInterface(
/* [out] */ __RPC__out IID *pIID)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE GetConnectionPointContainer(
/* [out] */ __RPC__deref_out_opt IConnectionPointContainer **ppCPC)
{
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE Advise(
/* [in] */ __RPC__in_opt IUnknown *pUnkSink,
/* [out] */ __RPC__out DWORD *pdwCookie)
{
if (pUnkSink == nullptr || pdwCookie == nullptr)
return E_POINTER;
for (DWORD i = 0; i < ARRAY_SIZE(_eventConnections); ++i)
{
if (_eventConnections[i] == nullptr)
{
IDispatch *handler;
HRESULT hr = pUnkSink->QueryInterface(IID_IDispatch, (void**)&handler);
if (hr != S_OK)
return CONNECT_E_CANNOTCONNECT;
_eventConnections[i] = handler;
*pdwCookie = i;
return S_OK;
}
}
return CONNECT_E_ADVISELIMIT;
}
virtual HRESULT STDMETHODCALLTYPE Unadvise(
/* [in] */ DWORD dwCookie)
{
if (0 <= dwCookie && dwCookie < ARRAY_SIZE(_eventConnections))
{
IDispatch *handler = _eventConnections[dwCookie];
if (handler != nullptr)
{
_eventConnections[dwCookie] = nullptr;
handler->Release();
return S_OK;
}
}
return E_POINTER;
}
virtual HRESULT STDMETHODCALLTYPE EnumConnections(
/* [out] */ __RPC__deref_out_opt IEnumConnections **ppEnum)
{
return E_NOTIMPL;
}
private:
HRESULT FireEvent_Impl(_In_ int dispId)
{
HRESULT hr = S_OK;
VARIANTARG arg;
::VariantInit(&arg);
arg.vt = VT_BSTR;
arg.bstrVal = TP_SysAllocString(Names[dispId]);
for (DWORD i = 0; i < ARRAY_SIZE(_eventConnections); ++i)
{
IDispatch *handler = _eventConnections[i];
if (handler != nullptr)
{
DISPPARAMS params{};
params.rgvarg = &arg;
params.cArgs = 1;
hr = handler->Invoke(
DISPATCHTESTINGEVENTS_DISPID_ONEVENT,
IID_NULL,
0,
DISPATCH_METHOD,
¶ms,
nullptr,
nullptr,
nullptr);
if (FAILED(hr))
break;
}
}
return ::VariantClear(&arg);
}
public: // IUnknown
STDMETHOD(QueryInterface)(
/* [in] */ REFIID riid,
/* [iid_is][out] */ _COM_Outptr_ void __RPC_FAR *__RPC_FAR *ppvObject)
{
return DoQueryInterface(riid, ppvObject,
static_cast<IDispatch *>(this),
static_cast<IEventTesting *>(this),
static_cast<IConnectionPointContainer *>(this),
static_cast<IConnectionPoint *>(this));
}
DEFINE_REF_COUNTING();
};
const WCHAR * const EventTesting::Names[] =
{
W("__RESERVED__"),
W("FireEvent"),
};
const int EventTesting::NamesCount = ARRAY_SIZE(EventTesting::Names);
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/debug/di/shimremotedatatarget.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//*****************************************************************************
//
// File: ShimRemoteDataTarget.cpp
//
//*****************************************************************************
#include "stdafx.h"
#include "safewrap.h"
#include "check.h"
#include <limits.h>
#include "shimpriv.h"
#include "shimdatatarget.h"
#include "dbgtransportsession.h"
#include "dbgtransportmanager.h"
class ShimRemoteDataTarget : public ShimDataTarget
{
public:
ShimRemoteDataTarget(DWORD processId, DbgTransportTarget * pProxy, DbgTransportSession * pTransport);
virtual ~ShimRemoteDataTarget();
virtual void Dispose();
//
// ICorDebugMutableDataTarget.
//
virtual HRESULT STDMETHODCALLTYPE GetPlatform(
CorDebugPlatform *pPlatform);
virtual HRESULT STDMETHODCALLTYPE ReadVirtual(
CORDB_ADDRESS address,
BYTE * pBuffer,
ULONG32 request,
ULONG32 *pcbRead);
virtual HRESULT STDMETHODCALLTYPE WriteVirtual(
CORDB_ADDRESS address,
const BYTE * pBuffer,
ULONG32 request);
virtual HRESULT STDMETHODCALLTYPE GetThreadContext(
DWORD dwThreadID,
ULONG32 contextFlags,
ULONG32 contextSize,
BYTE * context);
virtual HRESULT STDMETHODCALLTYPE SetThreadContext(
DWORD dwThreadID,
ULONG32 contextSize,
const BYTE * context);
virtual HRESULT STDMETHODCALLTYPE ContinueStatusChanged(
DWORD dwThreadId,
CORDB_CONTINUE_STATUS dwContinueStatus);
virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(
DWORD threadId, ULONG32 contextSize, PBYTE context);
private:
DbgTransportTarget * m_pProxy;
DbgTransportSession * m_pTransport;
#ifdef FEATURE_REMOTE_PROC_MEM
DWORD m_memoryHandle; // PAL_ReadProcessMemory handle or UINT32_MAX if fallback
#endif
};
// Helper macro to check for failure conditions at the start of data-target methods.
#define ReturnFailureIfStateNotOk() \
if (m_hr != S_OK) \
{ \
return m_hr; \
}
//---------------------------------------------------------------------------------------
//
// This is the ctor for ShimRemoteDataTarget.
//
// Arguments:
// processId - pid of live process on the remote machine
// pProxy - connection to the debugger proxy
// pTransport - connection to the debuggee process
//
ShimRemoteDataTarget::ShimRemoteDataTarget(DWORD processId,
DbgTransportTarget * pProxy,
DbgTransportSession * pTransport)
{
m_ref = 0;
m_processId = processId;
m_pProxy = pProxy;
m_pTransport = pTransport;
m_hr = S_OK;
m_fpContinueStatusChanged = NULL;
m_pContinueStatusChangedUserData = NULL;
#ifdef FEATURE_REMOTE_PROC_MEM
PAL_OpenProcessMemory(m_processId, &m_memoryHandle);
#endif
}
//---------------------------------------------------------------------------------------
//
// dtor for ShimRemoteDataTarget
//
ShimRemoteDataTarget::~ShimRemoteDataTarget()
{
Dispose();
}
//---------------------------------------------------------------------------------------
//
// Dispose all resources and neuter the object.
//
// Notes:
// Release all resources (such as the connections to the debugger proxy and the debuggee process).
// May be called multiple times.
// All other non-trivial APIs (eg, not IUnknown) will fail after this.
//
void ShimRemoteDataTarget::Dispose()
{
#ifdef FEATURE_REMOTE_PROC_MEM
PAL_CloseProcessMemory(m_memoryHandle);
m_memoryHandle = UINT32_MAX;
#endif
if (m_pTransport != NULL)
{
m_pProxy->ReleaseTransport(m_pTransport);
}
m_pTransport = NULL;
m_hr = CORDBG_E_OBJECT_NEUTERED;
}
//---------------------------------------------------------------------------------------
//
// Construction method for data-target
//
// Arguments:
// machineInfo - (input) the IP address of the remote machine and the port number of the debugger proxy
// processId - (input) live OS process ID to build a data-target for.
// ppDataTarget - (output) new data-target instance. This gets addreffed.
//
// Return Value:
// S_OK on success.
//
// Assumptions:
// pid is for a process on the remote machine specified by the IP address in machineInfo
// Caller must release *ppDataTarget.
//
HRESULT BuildPlatformSpecificDataTarget(MachineInfo machineInfo,
const ProcessDescriptor * pProcessDescriptor,
ShimDataTarget ** ppDataTarget)
{
HandleHolder hDummy;
HRESULT hr = E_FAIL;
ShimRemoteDataTarget * pRemoteDataTarget = NULL;
DbgTransportTarget * pProxy = g_pDbgTransportTarget;
DbgTransportSession * pTransport = NULL;
hr = pProxy->GetTransportForProcess(pProcessDescriptor, &pTransport, &hDummy);
if (FAILED(hr))
{
goto Label_Exit;
}
if (!pTransport->WaitForSessionToOpen(10000))
{
hr = CORDBG_E_TIMEOUT;
goto Label_Exit;
}
pRemoteDataTarget = new (nothrow) ShimRemoteDataTarget(pProcessDescriptor->m_Pid, pProxy, pTransport);
if (pRemoteDataTarget == NULL)
{
hr = E_OUTOFMEMORY;
goto Label_Exit;
}
_ASSERTE(SUCCEEDED(hr));
*ppDataTarget = pRemoteDataTarget;
pRemoteDataTarget->AddRef(); // must addref out-parameters
Label_Exit:
if (FAILED(hr))
{
if (pRemoteDataTarget != NULL)
{
// The ShimRemoteDataTarget has ownership of the proxy and the transport,
// so we don't need to clean them up here.
delete pRemoteDataTarget;
}
else
{
if (pTransport != NULL)
{
pProxy->ReleaseTransport(pTransport);
}
}
}
return hr;
}
// impl of interface method ICorDebugDataTarget::GetPlatform
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::GetPlatform(
CorDebugPlatform *pPlatform)
{
#ifdef TARGET_UNIX
#if defined(TARGET_X86)
*pPlatform = CORDB_PLATFORM_POSIX_X86;
#elif defined(TARGET_AMD64)
*pPlatform = CORDB_PLATFORM_POSIX_AMD64;
#elif defined(TARGET_ARM)
*pPlatform = CORDB_PLATFORM_POSIX_ARM;
#elif defined(TARGET_ARM64)
*pPlatform = CORDB_PLATFORM_POSIX_ARM64;
#else
#error Unknown Processor.
#endif
#else
#if defined(TARGET_X86)
*pPlatform = CORDB_PLATFORM_WINDOWS_X86;
#elif defined(TARGET_AMD64)
*pPlatform = CORDB_PLATFORM_WINDOWS_AMD64;
#elif defined(TARGET_ARM)
*pPlatform = CORDB_PLATFORM_WINDOWS_ARM;
#elif defined(TARGET_ARM64)
*pPlatform = CORDB_PLATFORM_WINDOWS_ARM64;
#else
#error Unknown Processor.
#endif
#endif
return S_OK;
}
// impl of interface method ICorDebugDataTarget::ReadVirtual
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::ReadVirtual(
CORDB_ADDRESS address,
PBYTE pBuffer,
ULONG32 cbRequestSize,
ULONG32 *pcbRead)
{
ReturnFailureIfStateNotOk();
size_t read = cbRequestSize;
HRESULT hr = S_OK;
#ifdef FEATURE_REMOTE_PROC_MEM
if (m_memoryHandle != UINT32_MAX)
{
if (!PAL_ReadProcessMemory(m_memoryHandle, (ULONG64)address, pBuffer, cbRequestSize, &read))
{
hr = E_FAIL;
}
}
else
#endif
{
hr = m_pTransport->ReadMemory(reinterpret_cast<BYTE *>(CORDB_ADDRESS_TO_PTR(address)), pBuffer, cbRequestSize);
}
if (pcbRead != NULL)
{
*pcbRead = ULONG32(SUCCEEDED(hr) ? read : 0);
}
return hr;
}
// impl of interface method ICorDebugMutableDataTarget::WriteVirtual
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::WriteVirtual(
CORDB_ADDRESS pAddress,
const BYTE * pBuffer,
ULONG32 cbRequestSize)
{
ReturnFailureIfStateNotOk();
HRESULT hr = E_FAIL;
hr = m_pTransport->WriteMemory(reinterpret_cast<BYTE *>(CORDB_ADDRESS_TO_PTR(pAddress)),
const_cast<BYTE *>(pBuffer),
cbRequestSize);
return hr;
}
// impl of interface method ICorDebugMutableDataTarget::GetThreadContext
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::GetThreadContext(
DWORD dwThreadID,
ULONG32 contextFlags,
ULONG32 contextSize,
BYTE * pContext)
{
ReturnFailureIfStateNotOk();
// GetThreadContext() is currently not implemented in ShimRemoteDataTarget, which is used with our pipe transport
// (FEATURE_DBGIPC_TRANSPORT_DI). Pipe transport is used on POSIX system, but occasionally we can turn it on for Windows for testing,
// and then we'd like to have same behavior as on POSIX system (zero context).
//
// We don't have a good way to implement GetThreadContext() in ShimRemoteDataTarget yet, because we have no way to convert a thread ID to a
// thread handle. The function to do the conversion is OpenThread(), which is not implemented in PAL. Even if we had a handle, PAL implementation
// of GetThreadContext() is very limited and doesn't work when we're not attached with ptrace.
// Instead, we just zero out the seed CONTEXT for the stackwalk. This tells the stackwalker to
// start the stackwalk with the first explicit frame. This won't work when we do native debugging,
// but that won't happen on the POSIX systems since they don't support native debugging.
ZeroMemory(pContext, contextSize);
return E_NOTIMPL;
}
// impl of interface method ICorDebugMutableDataTarget::SetThreadContext
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::SetThreadContext(
DWORD dwThreadID,
ULONG32 contextSize,
const BYTE * pContext)
{
ReturnFailureIfStateNotOk();
// ICorDebugDataTarget::GetThreadContext() and ICorDebugDataTarget::SetThreadContext() are currently only
// required for interop-debugging and inspection of floating point registers, both of which are not
// implemented on Mac.
_ASSERTE(!"The remote data target doesn't know how to set a thread's CONTEXT.");
return E_NOTIMPL;
}
// Public implementation of ICorDebugMutableDataTarget::ContinueStatusChanged
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::ContinueStatusChanged(
DWORD dwThreadId,
CORDB_CONTINUE_STATUS dwContinueStatus)
{
ReturnFailureIfStateNotOk();
_ASSERTE(!"ShimRemoteDataTarget::ContinueStatusChanged() is called unexpectedly");
if (m_fpContinueStatusChanged != NULL)
{
return m_fpContinueStatusChanged(m_pContinueStatusChangedUserData, dwThreadId, dwContinueStatus);
}
return E_NOTIMPL;
}
//---------------------------------------------------------------------------------------
//
// Unwind the stack to the next frame.
//
// Return Value:
// context filled in with the next frame
//
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context)
{
return m_pTransport->VirtualUnwind(threadId, contextSize, context);
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//*****************************************************************************
//
// File: ShimRemoteDataTarget.cpp
//
//*****************************************************************************
#include "stdafx.h"
#include "safewrap.h"
#include "check.h"
#include <limits.h>
#include "shimpriv.h"
#include "shimdatatarget.h"
#include "dbgtransportsession.h"
#include "dbgtransportmanager.h"
class ShimRemoteDataTarget : public ShimDataTarget
{
public:
ShimRemoteDataTarget(DWORD processId, DbgTransportTarget * pProxy, DbgTransportSession * pTransport);
virtual ~ShimRemoteDataTarget();
virtual void Dispose();
//
// ICorDebugMutableDataTarget.
//
virtual HRESULT STDMETHODCALLTYPE GetPlatform(
CorDebugPlatform *pPlatform);
virtual HRESULT STDMETHODCALLTYPE ReadVirtual(
CORDB_ADDRESS address,
BYTE * pBuffer,
ULONG32 request,
ULONG32 *pcbRead);
virtual HRESULT STDMETHODCALLTYPE WriteVirtual(
CORDB_ADDRESS address,
const BYTE * pBuffer,
ULONG32 request);
virtual HRESULT STDMETHODCALLTYPE GetThreadContext(
DWORD dwThreadID,
ULONG32 contextFlags,
ULONG32 contextSize,
BYTE * context);
virtual HRESULT STDMETHODCALLTYPE SetThreadContext(
DWORD dwThreadID,
ULONG32 contextSize,
const BYTE * context);
virtual HRESULT STDMETHODCALLTYPE ContinueStatusChanged(
DWORD dwThreadId,
CORDB_CONTINUE_STATUS dwContinueStatus);
virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(
DWORD threadId, ULONG32 contextSize, PBYTE context);
private:
DbgTransportTarget * m_pProxy;
DbgTransportSession * m_pTransport;
#ifdef FEATURE_REMOTE_PROC_MEM
DWORD m_memoryHandle; // PAL_ReadProcessMemory handle or UINT32_MAX if fallback
#endif
};
// Helper macro to check for failure conditions at the start of data-target methods.
#define ReturnFailureIfStateNotOk() \
if (m_hr != S_OK) \
{ \
return m_hr; \
}
//---------------------------------------------------------------------------------------
//
// This is the ctor for ShimRemoteDataTarget.
//
// Arguments:
// processId - pid of live process on the remote machine
// pProxy - connection to the debugger proxy
// pTransport - connection to the debuggee process
//
ShimRemoteDataTarget::ShimRemoteDataTarget(DWORD processId,
DbgTransportTarget * pProxy,
DbgTransportSession * pTransport)
{
m_ref = 0;
m_processId = processId;
m_pProxy = pProxy;
m_pTransport = pTransport;
m_hr = S_OK;
m_fpContinueStatusChanged = NULL;
m_pContinueStatusChangedUserData = NULL;
#ifdef FEATURE_REMOTE_PROC_MEM
PAL_OpenProcessMemory(m_processId, &m_memoryHandle);
#endif
}
//---------------------------------------------------------------------------------------
//
// dtor for ShimRemoteDataTarget
//
ShimRemoteDataTarget::~ShimRemoteDataTarget()
{
Dispose();
}
//---------------------------------------------------------------------------------------
//
// Dispose all resources and neuter the object.
//
// Notes:
// Release all resources (such as the connections to the debugger proxy and the debuggee process).
// May be called multiple times.
// All other non-trivial APIs (eg, not IUnknown) will fail after this.
//
void ShimRemoteDataTarget::Dispose()
{
#ifdef FEATURE_REMOTE_PROC_MEM
PAL_CloseProcessMemory(m_memoryHandle);
m_memoryHandle = UINT32_MAX;
#endif
if (m_pTransport != NULL)
{
m_pProxy->ReleaseTransport(m_pTransport);
}
m_pTransport = NULL;
m_hr = CORDBG_E_OBJECT_NEUTERED;
}
//---------------------------------------------------------------------------------------
//
// Construction method for data-target
//
// Arguments:
// machineInfo - (input) the IP address of the remote machine and the port number of the debugger proxy
// processId - (input) live OS process ID to build a data-target for.
// ppDataTarget - (output) new data-target instance. This gets addreffed.
//
// Return Value:
// S_OK on success.
//
// Assumptions:
// pid is for a process on the remote machine specified by the IP address in machineInfo
// Caller must release *ppDataTarget.
//
HRESULT BuildPlatformSpecificDataTarget(MachineInfo machineInfo,
const ProcessDescriptor * pProcessDescriptor,
ShimDataTarget ** ppDataTarget)
{
HandleHolder hDummy;
HRESULT hr = E_FAIL;
ShimRemoteDataTarget * pRemoteDataTarget = NULL;
DbgTransportTarget * pProxy = g_pDbgTransportTarget;
DbgTransportSession * pTransport = NULL;
hr = pProxy->GetTransportForProcess(pProcessDescriptor, &pTransport, &hDummy);
if (FAILED(hr))
{
goto Label_Exit;
}
if (!pTransport->WaitForSessionToOpen(10000))
{
hr = CORDBG_E_TIMEOUT;
goto Label_Exit;
}
pRemoteDataTarget = new (nothrow) ShimRemoteDataTarget(pProcessDescriptor->m_Pid, pProxy, pTransport);
if (pRemoteDataTarget == NULL)
{
hr = E_OUTOFMEMORY;
goto Label_Exit;
}
_ASSERTE(SUCCEEDED(hr));
*ppDataTarget = pRemoteDataTarget;
pRemoteDataTarget->AddRef(); // must addref out-parameters
Label_Exit:
if (FAILED(hr))
{
if (pRemoteDataTarget != NULL)
{
// The ShimRemoteDataTarget has ownership of the proxy and the transport,
// so we don't need to clean them up here.
delete pRemoteDataTarget;
}
else
{
if (pTransport != NULL)
{
pProxy->ReleaseTransport(pTransport);
}
}
}
return hr;
}
// impl of interface method ICorDebugDataTarget::GetPlatform
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::GetPlatform(
CorDebugPlatform *pPlatform)
{
#ifdef TARGET_UNIX
#if defined(TARGET_X86)
*pPlatform = CORDB_PLATFORM_POSIX_X86;
#elif defined(TARGET_AMD64)
*pPlatform = CORDB_PLATFORM_POSIX_AMD64;
#elif defined(TARGET_ARM)
*pPlatform = CORDB_PLATFORM_POSIX_ARM;
#elif defined(TARGET_ARM64)
*pPlatform = CORDB_PLATFORM_POSIX_ARM64;
#else
#error Unknown Processor.
#endif
#else
#if defined(TARGET_X86)
*pPlatform = CORDB_PLATFORM_WINDOWS_X86;
#elif defined(TARGET_AMD64)
*pPlatform = CORDB_PLATFORM_WINDOWS_AMD64;
#elif defined(TARGET_ARM)
*pPlatform = CORDB_PLATFORM_WINDOWS_ARM;
#elif defined(TARGET_ARM64)
*pPlatform = CORDB_PLATFORM_WINDOWS_ARM64;
#else
#error Unknown Processor.
#endif
#endif
return S_OK;
}
// impl of interface method ICorDebugDataTarget::ReadVirtual
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::ReadVirtual(
CORDB_ADDRESS address,
PBYTE pBuffer,
ULONG32 cbRequestSize,
ULONG32 *pcbRead)
{
ReturnFailureIfStateNotOk();
size_t read = cbRequestSize;
HRESULT hr = S_OK;
#ifdef FEATURE_REMOTE_PROC_MEM
if (m_memoryHandle != UINT32_MAX)
{
if (!PAL_ReadProcessMemory(m_memoryHandle, (ULONG64)address, pBuffer, cbRequestSize, &read))
{
hr = E_FAIL;
}
}
else
#endif
{
hr = m_pTransport->ReadMemory(reinterpret_cast<BYTE *>(CORDB_ADDRESS_TO_PTR(address)), pBuffer, cbRequestSize);
}
if (pcbRead != NULL)
{
*pcbRead = ULONG32(SUCCEEDED(hr) ? read : 0);
}
return hr;
}
// impl of interface method ICorDebugMutableDataTarget::WriteVirtual
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::WriteVirtual(
CORDB_ADDRESS pAddress,
const BYTE * pBuffer,
ULONG32 cbRequestSize)
{
ReturnFailureIfStateNotOk();
HRESULT hr = E_FAIL;
hr = m_pTransport->WriteMemory(reinterpret_cast<BYTE *>(CORDB_ADDRESS_TO_PTR(pAddress)),
const_cast<BYTE *>(pBuffer),
cbRequestSize);
return hr;
}
// impl of interface method ICorDebugMutableDataTarget::GetThreadContext
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::GetThreadContext(
DWORD dwThreadID,
ULONG32 contextFlags,
ULONG32 contextSize,
BYTE * pContext)
{
ReturnFailureIfStateNotOk();
// GetThreadContext() is currently not implemented in ShimRemoteDataTarget, which is used with our pipe transport
// (FEATURE_DBGIPC_TRANSPORT_DI). Pipe transport is used on POSIX system, but occasionally we can turn it on for Windows for testing,
// and then we'd like to have same behavior as on POSIX system (zero context).
//
// We don't have a good way to implement GetThreadContext() in ShimRemoteDataTarget yet, because we have no way to convert a thread ID to a
// thread handle. The function to do the conversion is OpenThread(), which is not implemented in PAL. Even if we had a handle, PAL implementation
// of GetThreadContext() is very limited and doesn't work when we're not attached with ptrace.
// Instead, we just zero out the seed CONTEXT for the stackwalk. This tells the stackwalker to
// start the stackwalk with the first explicit frame. This won't work when we do native debugging,
// but that won't happen on the POSIX systems since they don't support native debugging.
ZeroMemory(pContext, contextSize);
return E_NOTIMPL;
}
// impl of interface method ICorDebugMutableDataTarget::SetThreadContext
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::SetThreadContext(
DWORD dwThreadID,
ULONG32 contextSize,
const BYTE * pContext)
{
ReturnFailureIfStateNotOk();
// ICorDebugDataTarget::GetThreadContext() and ICorDebugDataTarget::SetThreadContext() are currently only
// required for interop-debugging and inspection of floating point registers, both of which are not
// implemented on Mac.
_ASSERTE(!"The remote data target doesn't know how to set a thread's CONTEXT.");
return E_NOTIMPL;
}
// Public implementation of ICorDebugMutableDataTarget::ContinueStatusChanged
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::ContinueStatusChanged(
DWORD dwThreadId,
CORDB_CONTINUE_STATUS dwContinueStatus)
{
ReturnFailureIfStateNotOk();
_ASSERTE(!"ShimRemoteDataTarget::ContinueStatusChanged() is called unexpectedly");
if (m_fpContinueStatusChanged != NULL)
{
return m_fpContinueStatusChanged(m_pContinueStatusChangedUserData, dwThreadId, dwContinueStatus);
}
return E_NOTIMPL;
}
//---------------------------------------------------------------------------------------
//
// Unwind the stack to the next frame.
//
// Return Value:
// context filled in with the next frame
//
HRESULT STDMETHODCALLTYPE
ShimRemoteDataTarget::VirtualUnwind(DWORD threadId, ULONG32 contextSize, PBYTE context)
{
return m_pTransport->VirtualUnwind(threadId, contextSize, context);
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/vm/arm/asmconstants.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// asmconstants.h -
//
// This header defines field offsets and constants used by assembly code
// Be sure to rebuild clr/src/vm/ceemain.cpp after changing this file, to
// ensure that the constants match the expected C/C++ values
// #ifndef HOST_ARM
// #error this file should only be used on an ARM platform
// #endif // HOST_ARM
#include "../../inc/switches.h"
//-----------------------------------------------------------------------------
#ifndef ASMCONSTANTS_C_ASSERT
#define ASMCONSTANTS_C_ASSERT(cond)
#endif
#ifndef ASMCONSTANTS_RUNTIME_ASSERT
#define ASMCONSTANTS_RUNTIME_ASSERT(cond)
#endif
// Some contants are different in _DEBUG builds. This macro factors out ifdefs from below.
#ifdef _DEBUG
#define DBG_FRE(dbg,fre) dbg
#else
#define DBG_FRE(dbg,fre) fre
#endif
#define DynamicHelperFrameFlags_Default 0
#define DynamicHelperFrameFlags_ObjectArg 1
#define DynamicHelperFrameFlags_ObjectArg2 2
#define REDIRECTSTUB_SP_OFFSET_CONTEXT 0
#define CORINFO_NullReferenceException_ASM 0
ASMCONSTANTS_C_ASSERT( CORINFO_NullReferenceException_ASM
== CORINFO_NullReferenceException);
#define CORINFO_IndexOutOfRangeException_ASM 3
ASMCONSTANTS_C_ASSERT( CORINFO_IndexOutOfRangeException_ASM
== CORINFO_IndexOutOfRangeException);
// Offset of the array containing the address of captured registers in MachState
#define MachState__captureR4_R11 0x0
ASMCONSTANTS_C_ASSERT(MachState__captureR4_R11 == offsetof(MachState, captureR4_R11))
// Offset of the array containing the address of preserved registers in MachState
#define MachState___R4_R11 0x20
ASMCONSTANTS_C_ASSERT(MachState___R4_R11 == offsetof(MachState, _R4_R11))
#define MachState__isValid 0x48
ASMCONSTANTS_C_ASSERT(MachState__isValid == offsetof(MachState, _isValid))
#define LazyMachState_captureR4_R11 MachState__captureR4_R11
ASMCONSTANTS_C_ASSERT(LazyMachState_captureR4_R11 == offsetof(LazyMachState, captureR4_R11))
#define LazyMachState_captureSp (MachState__isValid+4)
ASMCONSTANTS_C_ASSERT(LazyMachState_captureSp == offsetof(LazyMachState, captureSp))
#define LazyMachState_captureIp (LazyMachState_captureSp+4)
ASMCONSTANTS_C_ASSERT(LazyMachState_captureIp == offsetof(LazyMachState, captureIp))
#define DelegateObject___methodPtr 0x0c
ASMCONSTANTS_C_ASSERT(DelegateObject___methodPtr == offsetof(DelegateObject, _methodPtr));
#define DelegateObject___target 0x04
ASMCONSTANTS_C_ASSERT(DelegateObject___target == offsetof(DelegateObject, _target));
#define MethodTable__m_BaseSize 0x04
ASMCONSTANTS_C_ASSERT(MethodTable__m_BaseSize == offsetof(MethodTable, m_BaseSize));
#define MethodTable__m_dwFlags 0x0
ASMCONSTANTS_C_ASSERT(MethodTable__m_dwFlags == offsetof(MethodTable, m_dwFlags));
#define MethodTable__m_pWriteableData DBG_FRE(0x1c, 0x18)
ASMCONSTANTS_C_ASSERT(MethodTable__m_pWriteableData == offsetof(MethodTable, m_pWriteableData));
#define MethodTable__enum_flag_ContainsPointers 0x01000000
ASMCONSTANTS_C_ASSERT(MethodTable__enum_flag_ContainsPointers == MethodTable::enum_flag_ContainsPointers);
#define MethodTable__m_ElementType DBG_FRE(0x24, 0x20)
ASMCONSTANTS_C_ASSERT(MethodTable__m_ElementType == offsetof(MethodTable, m_pMultipurposeSlot1));
#define SIZEOF__MethodTable DBG_FRE(0x2c, 0x28)
ASMCONSTANTS_C_ASSERT(SIZEOF__MethodTable == sizeof(MethodTable));
#define MethodTableWriteableData__m_dwFlags 0x00
ASMCONSTANTS_C_ASSERT(MethodTableWriteableData__m_dwFlags == offsetof(MethodTableWriteableData, m_dwFlags));
#define MethodTableWriteableData__enum_flag_Unrestored 0x04
ASMCONSTANTS_C_ASSERT(MethodTableWriteableData__enum_flag_Unrestored == MethodTableWriteableData::enum_flag_Unrestored);
#define ArrayBase__m_NumComponents 0x4
ASMCONSTANTS_C_ASSERT(ArrayBase__m_NumComponents == offsetof(ArrayBase, m_NumComponents));
#define PtrArray__m_Array 0x8
ASMCONSTANTS_C_ASSERT(PtrArray__m_Array == offsetof(PtrArray, m_Array));
#define TypeHandle_CanCast 0x1 // TypeHandle::CanCast
#define SIZEOF__GSCookie 0x4
ASMCONSTANTS_C_ASSERT(SIZEOF__GSCookie == sizeof(GSCookie));
#define SIZEOF__Frame 0x8
ASMCONSTANTS_C_ASSERT(SIZEOF__Frame == sizeof(Frame));
#define SIZEOF__CONTEXT 0x1a0
ASMCONSTANTS_C_ASSERT(SIZEOF__CONTEXT == sizeof(T_CONTEXT));
#define SIZEOF__CalleeSavedRegisters 0x24
ASMCONSTANTS_C_ASSERT(SIZEOF__CalleeSavedRegisters == sizeof(CalleeSavedRegisters))
#define SIZEOF__ArgumentRegisters 0x10
ASMCONSTANTS_C_ASSERT(SIZEOF__ArgumentRegisters == sizeof(ArgumentRegisters))
#define SIZEOF__FloatArgumentRegisters 0x40
ASMCONSTANTS_C_ASSERT(SIZEOF__FloatArgumentRegisters == sizeof(FloatArgumentRegisters))
#define ASM_ENREGISTERED_RETURNTYPE_MAXSIZE 0x20
ASMCONSTANTS_C_ASSERT(ASM_ENREGISTERED_RETURNTYPE_MAXSIZE == ENREGISTERED_RETURNTYPE_MAXSIZE)
#define MethodDesc__m_wFlags DBG_FRE(0x1A, 0x06)
ASMCONSTANTS_C_ASSERT(MethodDesc__m_wFlags == offsetof(MethodDesc, m_wFlags))
#define MethodDesc__mdcClassification 0x7
ASMCONSTANTS_C_ASSERT(MethodDesc__mdcClassification == mdcClassification)
#ifdef FEATURE_COMINTEROP
#define MethodDesc__mcComInterop 0x6
ASMCONSTANTS_C_ASSERT(MethodDesc__mcComInterop == mcComInterop)
#define Stub__m_pCode DBG_FRE(0x10, 0x0c)
ASMCONSTANTS_C_ASSERT(Stub__m_pCode == sizeof(Stub))
#define SIZEOF__ComMethodFrame 0x24
ASMCONSTANTS_C_ASSERT(SIZEOF__ComMethodFrame == sizeof(ComMethodFrame))
#define UnmanagedToManagedFrame__m_pvDatum 0x08
ASMCONSTANTS_C_ASSERT(UnmanagedToManagedFrame__m_pvDatum == offsetof(UnmanagedToManagedFrame, m_pvDatum))
// In ComCallPreStub and GenericComPlusCallStub, we setup R12 to contain address of ComCallMethodDesc after doing the following:
//
// mov r12, pc
//
// This constant defines where ComCallMethodDesc is post execution of the above instruction.
#define ComCallMethodDesc_Offset_FromR12 0x8
#endif // FEATURE_COMINTEROP
#define Thread__m_fPreemptiveGCDisabled 0x08
ASMCONSTANTS_C_ASSERT(Thread__m_fPreemptiveGCDisabled == offsetof(Thread, m_fPreemptiveGCDisabled));
#define Thread_m_fPreemptiveGCDisabled Thread__m_fPreemptiveGCDisabled
#define Thread__m_pFrame 0x0C
ASMCONSTANTS_C_ASSERT(Thread__m_pFrame == offsetof(Thread, m_pFrame));
#define Thread_m_pFrame Thread__m_pFrame
#define DomainLocalModule__m_pDataBlob 0x18
ASMCONSTANTS_C_ASSERT(DomainLocalModule__m_pDataBlob == offsetof(DomainLocalModule, m_pDataBlob));
#define DomainLocalModule__m_pGCStatics 0x10
ASMCONSTANTS_C_ASSERT(DomainLocalModule__m_pGCStatics == offsetof(DomainLocalModule, m_pGCStatics));
#define ASM__VTABLE_SLOTS_PER_CHUNK 8
ASMCONSTANTS_C_ASSERT(ASM__VTABLE_SLOTS_PER_CHUNK == VTABLE_SLOTS_PER_CHUNK)
#define ASM__VTABLE_SLOTS_PER_CHUNK_LOG2 3
ASMCONSTANTS_C_ASSERT(ASM__VTABLE_SLOTS_PER_CHUNK_LOG2 == VTABLE_SLOTS_PER_CHUNK_LOG2)
#define VASigCookie__pNDirectILStub 0x4
ASMCONSTANTS_C_ASSERT(VASigCookie__pNDirectILStub == offsetof(VASigCookie, pNDirectILStub))
#define CONTEXT_Pc 0x040
ASMCONSTANTS_C_ASSERT(CONTEXT_Pc == offsetof(T_CONTEXT,Pc))
#define CallDescrData__pSrc 0x00
#define CallDescrData__numStackSlots 0x04
#define CallDescrData__pArgumentRegisters 0x08
#define CallDescrData__pFloatArgumentRegisters 0x0C
#define CallDescrData__fpReturnSize 0x10
#define CallDescrData__pTarget 0x14
#define CallDescrData__returnValue 0x18
ASMCONSTANTS_C_ASSERT(CallDescrData__pSrc == offsetof(CallDescrData, pSrc))
ASMCONSTANTS_C_ASSERT(CallDescrData__numStackSlots == offsetof(CallDescrData, numStackSlots))
ASMCONSTANTS_C_ASSERT(CallDescrData__pArgumentRegisters == offsetof(CallDescrData, pArgumentRegisters))
ASMCONSTANTS_C_ASSERT(CallDescrData__pFloatArgumentRegisters == offsetof(CallDescrData, pFloatArgumentRegisters))
ASMCONSTANTS_C_ASSERT(CallDescrData__fpReturnSize == offsetof(CallDescrData, fpReturnSize))
ASMCONSTANTS_C_ASSERT(CallDescrData__pTarget == offsetof(CallDescrData, pTarget))
ASMCONSTANTS_C_ASSERT(CallDescrData__returnValue == offsetof(CallDescrData, returnValue))
#define SIZEOF__FaultingExceptionFrame (SIZEOF__Frame + 0x8 + SIZEOF__CONTEXT)
#define FaultingExceptionFrame__m_fFilterExecuted SIZEOF__Frame
ASMCONSTANTS_C_ASSERT(SIZEOF__FaultingExceptionFrame == sizeof(FaultingExceptionFrame))
ASMCONSTANTS_C_ASSERT(FaultingExceptionFrame__m_fFilterExecuted == offsetof(FaultingExceptionFrame, m_fFilterExecuted))
// For JIT_PInvokeBegin and JIT_PInvokeEnd helpers
#define Frame__m_Next 0x04
ASMCONSTANTS_C_ASSERT(Frame__m_Next == offsetof(Frame, m_Next))
#define InlinedCallFrame__m_Datum 0x08
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_Datum == offsetof(InlinedCallFrame, m_Datum))
#define InlinedCallFrame__m_pCallSiteSP 0x0C
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pCallSiteSP == offsetof(InlinedCallFrame, m_pCallSiteSP))
#define InlinedCallFrame__m_pCallerReturnAddress 0x10
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pCallerReturnAddress == offsetof(InlinedCallFrame, m_pCallerReturnAddress))
#define InlinedCallFrame__m_pCalleeSavedFP 0x14
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pCalleeSavedFP == offsetof(InlinedCallFrame, m_pCalleeSavedFP))
#define InlinedCallFrame__m_pThread 0x18
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pThread == offsetof(InlinedCallFrame, m_pThread))
#define InlinedCallFrame__m_pSPAfterProlog 0x1C
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pSPAfterProlog == offsetof(InlinedCallFrame, m_pSPAfterProlog))
#define FixupPrecodeData__Target 0x00
ASMCONSTANTS_C_ASSERT(FixupPrecodeData__Target == offsetof(FixupPrecodeData, Target))
#define FixupPrecodeData__MethodDesc 0x04
ASMCONSTANTS_C_ASSERT(FixupPrecodeData__MethodDesc == offsetof(FixupPrecodeData, MethodDesc))
#define FixupPrecodeData__PrecodeFixupThunk 0x08
ASMCONSTANTS_C_ASSERT(FixupPrecodeData__PrecodeFixupThunk == offsetof(FixupPrecodeData, PrecodeFixupThunk))
#define StubPrecodeData__MethodDesc 0x00
ASMCONSTANTS_C_ASSERT(StubPrecodeData__MethodDesc == offsetof(StubPrecodeData, MethodDesc))
#define StubPrecodeData__Target 0x04
ASMCONSTANTS_C_ASSERT(StubPrecodeData__Target == offsetof(StubPrecodeData, Target))
#define CallCountingStubData__RemainingCallCountCell 0x00
ASMCONSTANTS_C_ASSERT(CallCountingStubData__RemainingCallCountCell == offsetof(CallCountingStubData, RemainingCallCountCell))
#define CallCountingStubData__TargetForMethod 0x04
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForMethod == offsetof(CallCountingStubData, TargetForMethod))
#define CallCountingStubData__TargetForThresholdReached 0x08
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForThresholdReached == offsetof(CallCountingStubData, TargetForThresholdReached))
#undef ASMCONSTANTS_RUNTIME_ASSERT
#undef ASMCONSTANTS_C_ASSERT
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// asmconstants.h -
//
// This header defines field offsets and constants used by assembly code
// Be sure to rebuild clr/src/vm/ceemain.cpp after changing this file, to
// ensure that the constants match the expected C/C++ values
// #ifndef HOST_ARM
// #error this file should only be used on an ARM platform
// #endif // HOST_ARM
#include "../../inc/switches.h"
//-----------------------------------------------------------------------------
#ifndef ASMCONSTANTS_C_ASSERT
#define ASMCONSTANTS_C_ASSERT(cond)
#endif
#ifndef ASMCONSTANTS_RUNTIME_ASSERT
#define ASMCONSTANTS_RUNTIME_ASSERT(cond)
#endif
// Some contants are different in _DEBUG builds. This macro factors out ifdefs from below.
#ifdef _DEBUG
#define DBG_FRE(dbg,fre) dbg
#else
#define DBG_FRE(dbg,fre) fre
#endif
#define DynamicHelperFrameFlags_Default 0
#define DynamicHelperFrameFlags_ObjectArg 1
#define DynamicHelperFrameFlags_ObjectArg2 2
#define REDIRECTSTUB_SP_OFFSET_CONTEXT 0
#define CORINFO_NullReferenceException_ASM 0
ASMCONSTANTS_C_ASSERT( CORINFO_NullReferenceException_ASM
== CORINFO_NullReferenceException);
#define CORINFO_IndexOutOfRangeException_ASM 3
ASMCONSTANTS_C_ASSERT( CORINFO_IndexOutOfRangeException_ASM
== CORINFO_IndexOutOfRangeException);
// Offset of the array containing the address of captured registers in MachState
#define MachState__captureR4_R11 0x0
ASMCONSTANTS_C_ASSERT(MachState__captureR4_R11 == offsetof(MachState, captureR4_R11))
// Offset of the array containing the address of preserved registers in MachState
#define MachState___R4_R11 0x20
ASMCONSTANTS_C_ASSERT(MachState___R4_R11 == offsetof(MachState, _R4_R11))
#define MachState__isValid 0x48
ASMCONSTANTS_C_ASSERT(MachState__isValid == offsetof(MachState, _isValid))
#define LazyMachState_captureR4_R11 MachState__captureR4_R11
ASMCONSTANTS_C_ASSERT(LazyMachState_captureR4_R11 == offsetof(LazyMachState, captureR4_R11))
#define LazyMachState_captureSp (MachState__isValid+4)
ASMCONSTANTS_C_ASSERT(LazyMachState_captureSp == offsetof(LazyMachState, captureSp))
#define LazyMachState_captureIp (LazyMachState_captureSp+4)
ASMCONSTANTS_C_ASSERT(LazyMachState_captureIp == offsetof(LazyMachState, captureIp))
#define DelegateObject___methodPtr 0x0c
ASMCONSTANTS_C_ASSERT(DelegateObject___methodPtr == offsetof(DelegateObject, _methodPtr));
#define DelegateObject___target 0x04
ASMCONSTANTS_C_ASSERT(DelegateObject___target == offsetof(DelegateObject, _target));
#define MethodTable__m_BaseSize 0x04
ASMCONSTANTS_C_ASSERT(MethodTable__m_BaseSize == offsetof(MethodTable, m_BaseSize));
#define MethodTable__m_dwFlags 0x0
ASMCONSTANTS_C_ASSERT(MethodTable__m_dwFlags == offsetof(MethodTable, m_dwFlags));
#define MethodTable__m_pWriteableData DBG_FRE(0x1c, 0x18)
ASMCONSTANTS_C_ASSERT(MethodTable__m_pWriteableData == offsetof(MethodTable, m_pWriteableData));
#define MethodTable__enum_flag_ContainsPointers 0x01000000
ASMCONSTANTS_C_ASSERT(MethodTable__enum_flag_ContainsPointers == MethodTable::enum_flag_ContainsPointers);
#define MethodTable__m_ElementType DBG_FRE(0x24, 0x20)
ASMCONSTANTS_C_ASSERT(MethodTable__m_ElementType == offsetof(MethodTable, m_pMultipurposeSlot1));
#define SIZEOF__MethodTable DBG_FRE(0x2c, 0x28)
ASMCONSTANTS_C_ASSERT(SIZEOF__MethodTable == sizeof(MethodTable));
#define MethodTableWriteableData__m_dwFlags 0x00
ASMCONSTANTS_C_ASSERT(MethodTableWriteableData__m_dwFlags == offsetof(MethodTableWriteableData, m_dwFlags));
#define MethodTableWriteableData__enum_flag_Unrestored 0x04
ASMCONSTANTS_C_ASSERT(MethodTableWriteableData__enum_flag_Unrestored == MethodTableWriteableData::enum_flag_Unrestored);
#define ArrayBase__m_NumComponents 0x4
ASMCONSTANTS_C_ASSERT(ArrayBase__m_NumComponents == offsetof(ArrayBase, m_NumComponents));
#define PtrArray__m_Array 0x8
ASMCONSTANTS_C_ASSERT(PtrArray__m_Array == offsetof(PtrArray, m_Array));
#define TypeHandle_CanCast 0x1 // TypeHandle::CanCast
#define SIZEOF__GSCookie 0x4
ASMCONSTANTS_C_ASSERT(SIZEOF__GSCookie == sizeof(GSCookie));
#define SIZEOF__Frame 0x8
ASMCONSTANTS_C_ASSERT(SIZEOF__Frame == sizeof(Frame));
#define SIZEOF__CONTEXT 0x1a0
ASMCONSTANTS_C_ASSERT(SIZEOF__CONTEXT == sizeof(T_CONTEXT));
#define SIZEOF__CalleeSavedRegisters 0x24
ASMCONSTANTS_C_ASSERT(SIZEOF__CalleeSavedRegisters == sizeof(CalleeSavedRegisters))
#define SIZEOF__ArgumentRegisters 0x10
ASMCONSTANTS_C_ASSERT(SIZEOF__ArgumentRegisters == sizeof(ArgumentRegisters))
#define SIZEOF__FloatArgumentRegisters 0x40
ASMCONSTANTS_C_ASSERT(SIZEOF__FloatArgumentRegisters == sizeof(FloatArgumentRegisters))
#define ASM_ENREGISTERED_RETURNTYPE_MAXSIZE 0x20
ASMCONSTANTS_C_ASSERT(ASM_ENREGISTERED_RETURNTYPE_MAXSIZE == ENREGISTERED_RETURNTYPE_MAXSIZE)
#define MethodDesc__m_wFlags DBG_FRE(0x1A, 0x06)
ASMCONSTANTS_C_ASSERT(MethodDesc__m_wFlags == offsetof(MethodDesc, m_wFlags))
#define MethodDesc__mdcClassification 0x7
ASMCONSTANTS_C_ASSERT(MethodDesc__mdcClassification == mdcClassification)
#ifdef FEATURE_COMINTEROP
#define MethodDesc__mcComInterop 0x6
ASMCONSTANTS_C_ASSERT(MethodDesc__mcComInterop == mcComInterop)
#define Stub__m_pCode DBG_FRE(0x10, 0x0c)
ASMCONSTANTS_C_ASSERT(Stub__m_pCode == sizeof(Stub))
#define SIZEOF__ComMethodFrame 0x24
ASMCONSTANTS_C_ASSERT(SIZEOF__ComMethodFrame == sizeof(ComMethodFrame))
#define UnmanagedToManagedFrame__m_pvDatum 0x08
ASMCONSTANTS_C_ASSERT(UnmanagedToManagedFrame__m_pvDatum == offsetof(UnmanagedToManagedFrame, m_pvDatum))
// In ComCallPreStub and GenericComPlusCallStub, we setup R12 to contain address of ComCallMethodDesc after doing the following:
//
// mov r12, pc
//
// This constant defines where ComCallMethodDesc is post execution of the above instruction.
#define ComCallMethodDesc_Offset_FromR12 0x8
#endif // FEATURE_COMINTEROP
#define Thread__m_fPreemptiveGCDisabled 0x08
ASMCONSTANTS_C_ASSERT(Thread__m_fPreemptiveGCDisabled == offsetof(Thread, m_fPreemptiveGCDisabled));
#define Thread_m_fPreemptiveGCDisabled Thread__m_fPreemptiveGCDisabled
#define Thread__m_pFrame 0x0C
ASMCONSTANTS_C_ASSERT(Thread__m_pFrame == offsetof(Thread, m_pFrame));
#define Thread_m_pFrame Thread__m_pFrame
#define DomainLocalModule__m_pDataBlob 0x18
ASMCONSTANTS_C_ASSERT(DomainLocalModule__m_pDataBlob == offsetof(DomainLocalModule, m_pDataBlob));
#define DomainLocalModule__m_pGCStatics 0x10
ASMCONSTANTS_C_ASSERT(DomainLocalModule__m_pGCStatics == offsetof(DomainLocalModule, m_pGCStatics));
#define ASM__VTABLE_SLOTS_PER_CHUNK 8
ASMCONSTANTS_C_ASSERT(ASM__VTABLE_SLOTS_PER_CHUNK == VTABLE_SLOTS_PER_CHUNK)
#define ASM__VTABLE_SLOTS_PER_CHUNK_LOG2 3
ASMCONSTANTS_C_ASSERT(ASM__VTABLE_SLOTS_PER_CHUNK_LOG2 == VTABLE_SLOTS_PER_CHUNK_LOG2)
#define VASigCookie__pNDirectILStub 0x4
ASMCONSTANTS_C_ASSERT(VASigCookie__pNDirectILStub == offsetof(VASigCookie, pNDirectILStub))
#define CONTEXT_Pc 0x040
ASMCONSTANTS_C_ASSERT(CONTEXT_Pc == offsetof(T_CONTEXT,Pc))
#define CallDescrData__pSrc 0x00
#define CallDescrData__numStackSlots 0x04
#define CallDescrData__pArgumentRegisters 0x08
#define CallDescrData__pFloatArgumentRegisters 0x0C
#define CallDescrData__fpReturnSize 0x10
#define CallDescrData__pTarget 0x14
#define CallDescrData__returnValue 0x18
ASMCONSTANTS_C_ASSERT(CallDescrData__pSrc == offsetof(CallDescrData, pSrc))
ASMCONSTANTS_C_ASSERT(CallDescrData__numStackSlots == offsetof(CallDescrData, numStackSlots))
ASMCONSTANTS_C_ASSERT(CallDescrData__pArgumentRegisters == offsetof(CallDescrData, pArgumentRegisters))
ASMCONSTANTS_C_ASSERT(CallDescrData__pFloatArgumentRegisters == offsetof(CallDescrData, pFloatArgumentRegisters))
ASMCONSTANTS_C_ASSERT(CallDescrData__fpReturnSize == offsetof(CallDescrData, fpReturnSize))
ASMCONSTANTS_C_ASSERT(CallDescrData__pTarget == offsetof(CallDescrData, pTarget))
ASMCONSTANTS_C_ASSERT(CallDescrData__returnValue == offsetof(CallDescrData, returnValue))
#define SIZEOF__FaultingExceptionFrame (SIZEOF__Frame + 0x8 + SIZEOF__CONTEXT)
#define FaultingExceptionFrame__m_fFilterExecuted SIZEOF__Frame
ASMCONSTANTS_C_ASSERT(SIZEOF__FaultingExceptionFrame == sizeof(FaultingExceptionFrame))
ASMCONSTANTS_C_ASSERT(FaultingExceptionFrame__m_fFilterExecuted == offsetof(FaultingExceptionFrame, m_fFilterExecuted))
// For JIT_PInvokeBegin and JIT_PInvokeEnd helpers
#define Frame__m_Next 0x04
ASMCONSTANTS_C_ASSERT(Frame__m_Next == offsetof(Frame, m_Next))
#define InlinedCallFrame__m_Datum 0x08
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_Datum == offsetof(InlinedCallFrame, m_Datum))
#define InlinedCallFrame__m_pCallSiteSP 0x0C
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pCallSiteSP == offsetof(InlinedCallFrame, m_pCallSiteSP))
#define InlinedCallFrame__m_pCallerReturnAddress 0x10
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pCallerReturnAddress == offsetof(InlinedCallFrame, m_pCallerReturnAddress))
#define InlinedCallFrame__m_pCalleeSavedFP 0x14
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pCalleeSavedFP == offsetof(InlinedCallFrame, m_pCalleeSavedFP))
#define InlinedCallFrame__m_pThread 0x18
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pThread == offsetof(InlinedCallFrame, m_pThread))
#define InlinedCallFrame__m_pSPAfterProlog 0x1C
ASMCONSTANTS_C_ASSERT(InlinedCallFrame__m_pSPAfterProlog == offsetof(InlinedCallFrame, m_pSPAfterProlog))
#define FixupPrecodeData__Target 0x00
ASMCONSTANTS_C_ASSERT(FixupPrecodeData__Target == offsetof(FixupPrecodeData, Target))
#define FixupPrecodeData__MethodDesc 0x04
ASMCONSTANTS_C_ASSERT(FixupPrecodeData__MethodDesc == offsetof(FixupPrecodeData, MethodDesc))
#define FixupPrecodeData__PrecodeFixupThunk 0x08
ASMCONSTANTS_C_ASSERT(FixupPrecodeData__PrecodeFixupThunk == offsetof(FixupPrecodeData, PrecodeFixupThunk))
#define StubPrecodeData__MethodDesc 0x00
ASMCONSTANTS_C_ASSERT(StubPrecodeData__MethodDesc == offsetof(StubPrecodeData, MethodDesc))
#define StubPrecodeData__Target 0x04
ASMCONSTANTS_C_ASSERT(StubPrecodeData__Target == offsetof(StubPrecodeData, Target))
#define CallCountingStubData__RemainingCallCountCell 0x00
ASMCONSTANTS_C_ASSERT(CallCountingStubData__RemainingCallCountCell == offsetof(CallCountingStubData, RemainingCallCountCell))
#define CallCountingStubData__TargetForMethod 0x04
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForMethod == offsetof(CallCountingStubData, TargetForMethod))
#define CallCountingStubData__TargetForThresholdReached 0x08
ASMCONSTANTS_C_ASSERT(CallCountingStubData__TargetForThresholdReached == offsetof(CallCountingStubData, TargetForThresholdReached))
#undef ASMCONSTANTS_RUNTIME_ASSERT
#undef ASMCONSTANTS_C_ASSERT
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================================
**
** Source: test7.c
**
** Purpose: Tests the wide char specifier (%C).
** This test is modeled after the sprintf series.
**
**
**==========================================================================*/
#include <palsuite.h>
#include "../fwprintf.h"
/*
* Depends on memcmp, strlen, fopen, fseek and fgets.
*/
PALTEST(c_runtime_fwprintf_test7_paltest_fwprintf_test7, "c_runtime/fwprintf/test7/paltest_fwprintf_test7")
{
WCHAR wb = (WCHAR) 'b';
if (PAL_Initialize(argc, argv))
{
return FAIL;
}
DoCharTest(convert("foo %C"), 'c', "foo c");
DoWCharTest(convert("foo %hc"), wb, "foo b");
DoCharTest(convert("foo %lC"), 'c', "foo c");
DoCharTest(convert("foo %LC"), 'c', "foo c");
DoCharTest(convert("foo %I64C"), 'c', "foo c");
DoCharTest(convert("foo %5C"), 'c', "foo c");
DoCharTest(convert("foo %.0C"), 'c', "foo c");
DoCharTest(convert("foo %-5C"), 'c', "foo c ");
DoCharTest(convert("foo %05C"), 'c', "foo 0000c");
DoCharTest(convert("foo % C"), 'c', "foo c");
DoCharTest(convert("foo %#C"), 'c', "foo c");
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================================
**
** Source: test7.c
**
** Purpose: Tests the wide char specifier (%C).
** This test is modeled after the sprintf series.
**
**
**==========================================================================*/
#include <palsuite.h>
#include "../fwprintf.h"
/*
* Depends on memcmp, strlen, fopen, fseek and fgets.
*/
PALTEST(c_runtime_fwprintf_test7_paltest_fwprintf_test7, "c_runtime/fwprintf/test7/paltest_fwprintf_test7")
{
WCHAR wb = (WCHAR) 'b';
if (PAL_Initialize(argc, argv))
{
return FAIL;
}
DoCharTest(convert("foo %C"), 'c', "foo c");
DoWCharTest(convert("foo %hc"), wb, "foo b");
DoCharTest(convert("foo %lC"), 'c', "foo c");
DoCharTest(convert("foo %LC"), 'c', "foo c");
DoCharTest(convert("foo %I64C"), 'c', "foo c");
DoCharTest(convert("foo %5C"), 'c', "foo c");
DoCharTest(convert("foo %.0C"), 'c', "foo c");
DoCharTest(convert("foo %-5C"), 'c', "foo c ");
DoCharTest(convert("foo %05C"), 'c', "foo 0000c");
DoCharTest(convert("foo % C"), 'c', "foo c");
DoCharTest(convert("foo %#C"), 'c', "foo c");
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test5/loadlibrarya.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================
**
** Source: loadlibrarya.c
**
** Purpose: Negative test the LoadLibraryA API.
** Call LoadLibraryA by passing a module name
** without extension but with a trailing dot.
**
**
**============================================================*/
#include <palsuite.h>
PALTEST(loader_LoadLibraryA_test5_paltest_loadlibrarya_test5, "loader/LoadLibraryA/test5/paltest_loadlibrarya_test5")
{
HMODULE ModuleHandle;
char ModuleName[_MAX_FNAME];
int err;
/* Initialize the PAL environment */
err = PAL_Initialize(argc, argv);
if(0 != err)
{
return FAIL;
}
memset(ModuleName, 0, _MAX_FNAME);
/*Module name without extension but with a trailing dot*/
#if WIN32
sprintf_s(ModuleName, ARRAY_SIZE(ModuleName), "%s", "rotor_pal.");
#else
/* Under FreeBSD */
sprintf_s(ModuleName, ARRAY_SIZE(ModuleName), "%s", "librotor_pal.");
#endif
/* load a module which does not have the file extension,
* but has a trailing dot
*/
ModuleHandle = LoadLibraryA(ModuleName);
if(NULL != ModuleHandle)
{
Trace("Failed to call LoadLibraryA API for a negative test "
"call LoadLibraryA with module name which does not have "
"extension except a trailing dot, a NULL module handle is"
"expected, but no NULL module handle is returned, "
"error code = %u\n", GetLastError());
/* decrement the reference count of the loaded dll */
err = FreeLibrary(ModuleHandle);
if(0 == err)
{
Trace("\nFailed to call FreeLibrary API, "
"error code = %u\n", GetLastError());
}
Fail("");
}
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================
**
** Source: loadlibrarya.c
**
** Purpose: Negative test the LoadLibraryA API.
** Call LoadLibraryA by passing a module name
** without extension but with a trailing dot.
**
**
**============================================================*/
#include <palsuite.h>
PALTEST(loader_LoadLibraryA_test5_paltest_loadlibrarya_test5, "loader/LoadLibraryA/test5/paltest_loadlibrarya_test5")
{
HMODULE ModuleHandle;
char ModuleName[_MAX_FNAME];
int err;
/* Initialize the PAL environment */
err = PAL_Initialize(argc, argv);
if(0 != err)
{
return FAIL;
}
memset(ModuleName, 0, _MAX_FNAME);
/*Module name without extension but with a trailing dot*/
#if WIN32
sprintf_s(ModuleName, ARRAY_SIZE(ModuleName), "%s", "rotor_pal.");
#else
/* Under FreeBSD */
sprintf_s(ModuleName, ARRAY_SIZE(ModuleName), "%s", "librotor_pal.");
#endif
/* load a module which does not have the file extension,
* but has a trailing dot
*/
ModuleHandle = LoadLibraryA(ModuleName);
if(NULL != ModuleHandle)
{
Trace("Failed to call LoadLibraryA API for a negative test "
"call LoadLibraryA with module name which does not have "
"extension except a trailing dot, a NULL module handle is"
"expected, but no NULL module handle is returned, "
"error code = %u\n", GetLastError());
/* decrement the reference count of the loaded dll */
err = FreeLibrary(ModuleHandle);
if(0 == err)
{
Trace("\nFailed to call FreeLibrary API, "
"error code = %u\n", GetLastError());
}
Fail("");
}
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: test8.c
**
** Purpose: Test #8 for the vswprintf function.
**
**
**===================================================================*/
#include <palsuite.h>
#include "../vswprintf.h"
/* memcmp is used to verify the results, so this test is dependent on it. */
/* ditto with wcslen */
PALTEST(c_runtime_vswprintf_test8_paltest_vswprintf_test8, "c_runtime/vswprintf/test8/paltest_vswprintf_test8")
{
int neg = -42;
int pos = 42;
INT64 l = 42;
if (PAL_Initialize(argc, argv) != 0)
return(FAIL);
DoNumTest(convert("foo %d"), pos, convert("foo 42"));
DoNumTest(convert("foo %ld"), 0xFFFF, convert("foo 65535"));
DoNumTest(convert("foo %hd"), 0xFFFF, convert("foo -1"));
DoNumTest(convert("foo %Ld"), pos, convert("foo 42"));
DoI64NumTest(convert("foo %I64d"), l, "42", convert("foo 42"));
DoNumTest(convert("foo %3d"), pos, convert("foo 42"));
DoNumTest(convert("foo %-3d"), pos, convert("foo 42 "));
DoNumTest(convert("foo %.1d"), pos, convert("foo 42"));
DoNumTest(convert("foo %.3d"), pos, convert("foo 042"));
DoNumTest(convert("foo %03d"), pos, convert("foo 042"));
DoNumTest(convert("foo %#d"), pos, convert("foo 42"));
DoNumTest(convert("foo %+d"), pos, convert("foo +42"));
DoNumTest(convert("foo % d"), pos, convert("foo 42"));
DoNumTest(convert("foo %+d"), neg, convert("foo -42"));
DoNumTest(convert("foo % d"), neg, convert("foo -42"));
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=====================================================================
**
** Source: test8.c
**
** Purpose: Test #8 for the vswprintf function.
**
**
**===================================================================*/
#include <palsuite.h>
#include "../vswprintf.h"
/* memcmp is used to verify the results, so this test is dependent on it. */
/* ditto with wcslen */
PALTEST(c_runtime_vswprintf_test8_paltest_vswprintf_test8, "c_runtime/vswprintf/test8/paltest_vswprintf_test8")
{
int neg = -42;
int pos = 42;
INT64 l = 42;
if (PAL_Initialize(argc, argv) != 0)
return(FAIL);
DoNumTest(convert("foo %d"), pos, convert("foo 42"));
DoNumTest(convert("foo %ld"), 0xFFFF, convert("foo 65535"));
DoNumTest(convert("foo %hd"), 0xFFFF, convert("foo -1"));
DoNumTest(convert("foo %Ld"), pos, convert("foo 42"));
DoI64NumTest(convert("foo %I64d"), l, "42", convert("foo 42"));
DoNumTest(convert("foo %3d"), pos, convert("foo 42"));
DoNumTest(convert("foo %-3d"), pos, convert("foo 42 "));
DoNumTest(convert("foo %.1d"), pos, convert("foo 42"));
DoNumTest(convert("foo %.3d"), pos, convert("foo 042"));
DoNumTest(convert("foo %03d"), pos, convert("foo 042"));
DoNumTest(convert("foo %#d"), pos, convert("foo 42"));
DoNumTest(convert("foo %+d"), pos, convert("foo +42"));
DoNumTest(convert("foo % d"), pos, convert("foo 42"));
DoNumTest(convert("foo %+d"), neg, convert("foo -42"));
DoNumTest(convert("foo % d"), neg, convert("foo -42"));
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/classlibnative/bcltype/oavariant.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// File: OAVariant.h
//
//
// Purpose: Wrapper for Ole Automation compatable math ops.
// Calls through to OleAut.dll
//
//
#ifndef _OAVARIANT_H_
#define _OAVARIANT_H_
#ifndef FEATURE_COMINTEROP
#error FEATURE_COMINTEROP is required for this file
#endif // FEATURE_COMINTEROP
#include "variant.h"
class COMOAVariant
{
public:
// Utility Functions
// Conversion between COM+ variant type field & OleAut Variant enumeration
// WinCE doesn't support Variants entirely.
static VARENUM CVtoVT(const CVTypes cv);
static CVTypes VTtoCV(const VARENUM vt);
// Conversion between COM+ Variant & OleAut Variant. ToOAVariant
// returns true if the conversion process allocated an object (like a BSTR).
static bool ToOAVariant(const VariantData * const var, VARIANT * oa);
static void FromOAVariant(const VARIANT * const oa, VariantData * const& var);
// Throw a specific exception for a failure, specified by a given HRESULT.
static void OAFailed(const HRESULT hr);
static FCDECL6(void, ChangeTypeEx, VariantData *result, VariantData *op, LCID lcid, void *targetType, int cvType, INT16 flags);
};
#endif // _OAVARIANT_H_
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// File: OAVariant.h
//
//
// Purpose: Wrapper for Ole Automation compatable math ops.
// Calls through to OleAut.dll
//
//
#ifndef _OAVARIANT_H_
#define _OAVARIANT_H_
#ifndef FEATURE_COMINTEROP
#error FEATURE_COMINTEROP is required for this file
#endif // FEATURE_COMINTEROP
#include "variant.h"
class COMOAVariant
{
public:
// Utility Functions
// Conversion between COM+ variant type field & OleAut Variant enumeration
// WinCE doesn't support Variants entirely.
static VARENUM CVtoVT(const CVTypes cv);
static CVTypes VTtoCV(const VARENUM vt);
// Conversion between COM+ Variant & OleAut Variant. ToOAVariant
// returns true if the conversion process allocated an object (like a BSTR).
static bool ToOAVariant(const VariantData * const var, VARIANT * oa);
static void FromOAVariant(const VARIANT * const oa, VariantData * const& var);
// Throw a specific exception for a failure, specified by a given HRESULT.
static void OAFailed(const HRESULT hr);
static FCDECL6(void, ChangeTypeEx, VariantData *result, VariantData *op, LCID lcid, void *targetType, int cvType, INT16 flags);
};
#endif // _OAVARIANT_H_
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/mono/mono/eglib/eglib-remap.h
|
#undef g_malloc
#undef g_realloc
#undef g_malloc0
#undef g_calloc
#undef g_try_malloc
#undef g_try_realloc
#undef g_memdup
#define g_array_append monoeg_g_array_append
#define g_array_append_vals monoeg_g_array_append_vals
#define g_array_free monoeg_g_array_free
#define g_array_insert_vals monoeg_g_array_insert_vals
#define g_array_new monoeg_g_array_new
#define g_array_remove_index monoeg_g_array_remove_index
#define g_array_remove_index_fast monoeg_g_array_remove_index_fast
#define g_array_set_size monoeg_g_array_set_size
#define g_array_sized_new monoeg_g_array_sized_new
#define g_ascii_strdown monoeg_g_ascii_strdown
#define g_ascii_strdown_no_alloc monoeg_g_ascii_strdown_no_alloc
#define g_ascii_strncasecmp monoeg_g_ascii_strncasecmp
#define g_ascii_tolower monoeg_g_ascii_tolower
#define g_ascii_xdigit_value monoeg_g_ascii_xdigit_value
#define g_build_path monoeg_g_build_path
#define g_byte_array_append monoeg_g_byte_array_append
#define g_byte_array_free monoeg_g_byte_array_free
#define g_byte_array_new monoeg_g_byte_array_new
#define g_byte_array_set_size monoeg_g_byte_array_set_size
#define g_calloc monoeg_g_calloc
#define g_clear_error monoeg_g_clear_error
#define g_convert_error_quark monoeg_g_convert_error_quark
#define g_fixed_buffer_custom_allocator monoeg_g_fixed_buffer_custom_allocator
#define g_dir_close monoeg_g_dir_close
#define g_dir_open monoeg_g_dir_open
#define g_dir_read_name monoeg_g_dir_read_name
#define g_dir_rewind monoeg_g_dir_rewind
#define g_mkdir_with_parents monoeg_g_mkdir_with_parents
#define g_direct_equal monoeg_g_direct_equal
#define g_direct_hash monoeg_g_direct_hash
#define g_ensure_directory_exists monoeg_g_ensure_directory_exists
#define g_error_free monoeg_g_error_free
#define g_error_new monoeg_g_error_new
#define g_error_vnew monoeg_g_error_vnew
#define g_file_error_quark monoeg_g_file_error_quark
#define g_file_error_from_errno monoeg_g_file_error_from_errno
#define g_file_get_contents monoeg_g_file_get_contents
#define g_file_set_contents monoeg_g_file_set_contents
#define g_file_open_tmp monoeg_g_file_open_tmp
#define g_file_test monoeg_g_file_test
#define g_find_program_in_path monoeg_g_find_program_in_path
#define g_fprintf monoeg_g_fprintf
#define g_free monoeg_g_free
#define g_get_current_dir monoeg_g_get_current_dir
#define g_get_current_time monoeg_g_get_current_time
#define g_get_home_dir monoeg_g_get_home_dir
#define g_get_prgname monoeg_g_get_prgname
#define g_get_tmp_dir monoeg_g_get_tmp_dir
#define g_get_user_name monoeg_g_get_user_name
#define g_getenv monoeg_g_getenv
#define g_hasenv monoeg_g_hasenv
#define g_hash_table_destroy monoeg_g_hash_table_destroy
#define g_hash_table_find monoeg_g_hash_table_find
#define g_hash_table_foreach monoeg_g_hash_table_foreach
#define g_hash_table_foreach_remove monoeg_g_hash_table_foreach_remove
#define g_hash_table_foreach_steal monoeg_g_hash_table_foreach_steal
#define g_hash_table_get_keys monoeg_g_hash_table_get_keys
#define g_hash_table_get_values monoeg_g_hash_table_get_values
#define g_hash_table_contains monoeg_g_hash_table_contains
#define g_hash_table_insert_replace monoeg_g_hash_table_insert_replace
#define g_hash_table_lookup monoeg_g_hash_table_lookup
#define g_hash_table_lookup_extended monoeg_g_hash_table_lookup_extended
#define g_hash_table_new monoeg_g_hash_table_new
#define g_hash_table_new_full monoeg_g_hash_table_new_full
#define g_hash_table_remove monoeg_g_hash_table_remove
#define g_hash_table_steal monoeg_g_hash_table_steal
#define g_hash_table_size monoeg_g_hash_table_size
#define g_hash_table_print_stats monoeg_g_hash_table_print_stats
#define g_hash_table_remove_all monoeg_g_hash_table_remove_all
#define g_hash_table_iter_init monoeg_g_hash_table_iter_init
#define g_hash_table_iter_next monoeg_g_hash_table_iter_next
#define g_int_equal monoeg_g_int_equal
#define g_int_hash monoeg_g_int_hash
#define g_list_alloc monoeg_g_list_alloc
#define g_list_append monoeg_g_list_append
#define g_list_concat monoeg_g_list_concat
#define g_list_copy monoeg_g_list_copy
#define g_list_delete_link monoeg_g_list_delete_link
#define g_list_find monoeg_g_list_find
#define g_list_find_custom monoeg_g_list_find_custom
#define g_list_first monoeg_g_list_first
#define g_list_foreach monoeg_g_list_foreach
#define g_list_free monoeg_g_list_free
#define g_list_free_1 monoeg_g_list_free_1
#define g_list_index monoeg_g_list_index
#define g_list_insert_before monoeg_g_list_insert_before
#define g_list_insert_sorted monoeg_g_list_insert_sorted
#define g_list_last monoeg_g_list_last
#define g_list_length monoeg_g_list_length
#define g_list_nth monoeg_g_list_nth
#define g_list_nth_data monoeg_g_list_nth_data
#define g_list_prepend monoeg_g_list_prepend
#define g_list_remove monoeg_g_list_remove
#define g_list_remove_all monoeg_g_list_remove_all
#define g_list_remove_link monoeg_g_list_remove_link
#define g_list_reverse monoeg_g_list_reverse
#define g_list_sort monoeg_g_list_sort
#define g_log monoeg_g_log
#define g_log_set_always_fatal monoeg_g_log_set_always_fatal
#define g_log_set_fatal_mask monoeg_g_log_set_fatal_mask
#define g_logv monoeg_g_logv
#define g_memdup monoeg_g_memdup
#define g_mem_set_vtable monoeg_g_mem_set_vtable
#define g_mem_get_vtable monoeg_g_mem_get_vtable
#define g_mkdtemp monoeg_g_mkdtemp
#define g_module_address monoeg_g_module_address
#define g_module_build_path monoeg_g_module_build_path
#define g_module_close monoeg_g_module_close
#define g_module_error monoeg_g_module_error
#define g_module_open monoeg_g_module_open
#define g_module_symbol monoeg_g_module_symbol
#define g_path_get_basename monoeg_g_path_get_basename
#define g_path_get_dirname monoeg_g_path_get_dirname
#define g_path_is_absolute monoeg_g_path_is_absolute
#define g_async_safe_fgets monoeg_g_async_safe_fgets
#define g_async_safe_fprintf monoeg_g_async_safe_fprintf
#define g_async_safe_vfprintf monoeg_g_async_safe_vfprintf
#define g_async_safe_printf monoeg_g_async_safe_printf
#define g_async_safe_vprintf monoeg_g_async_safe_vprintf
#define g_print monoeg_g_print
#define g_printf monoeg_g_printf
#define g_printv monoeg_g_printv
#define g_printerr monoeg_g_printerr
#define g_propagate_error monoeg_g_propagate_error
#define g_ptr_array_add monoeg_g_ptr_array_add
#define g_ptr_array_capacity monoeg_g_ptr_array_capacity
#define g_ptr_array_foreach monoeg_g_ptr_array_foreach
#define g_ptr_array_free monoeg_g_ptr_array_free
#define g_ptr_array_new monoeg_g_ptr_array_new
#define g_ptr_array_remove monoeg_g_ptr_array_remove
#define g_ptr_array_remove_fast monoeg_g_ptr_array_remove_fast
#define g_ptr_array_remove_index monoeg_g_ptr_array_remove_index
#define g_ptr_array_remove_index_fast monoeg_g_ptr_array_remove_index_fast
#define g_ptr_array_set_size monoeg_g_ptr_array_set_size
#define g_ptr_array_sized_new monoeg_g_ptr_array_sized_new
#define g_ptr_array_sort monoeg_g_ptr_array_sort
#define g_ptr_array_find monoeg_g_ptr_array_find
#define g_queue_free monoeg_g_queue_free
#define g_queue_is_empty monoeg_g_queue_is_empty
#define g_queue_foreach monoeg_g_queue_foreach
#define g_queue_new monoeg_g_queue_new
#define g_queue_pop_head monoeg_g_queue_pop_head
#define g_queue_push_head monoeg_g_queue_push_head
#define g_queue_push_tail monoeg_g_queue_push_tail
#define g_set_error monoeg_g_set_error
#define g_set_prgname monoeg_g_set_prgname
#define g_setenv monoeg_g_setenv
#define g_slist_alloc monoeg_g_slist_alloc
#define g_slist_append monoeg_g_slist_append
#define g_slist_concat monoeg_g_slist_concat
#define g_slist_copy monoeg_g_slist_copy
#define g_slist_delete_link monoeg_g_slist_delete_link
#define g_slist_find monoeg_g_slist_find
#define g_slist_find_custom monoeg_g_slist_find_custom
#define g_slist_foreach monoeg_g_slist_foreach
#define g_slist_free monoeg_g_slist_free
#define g_slist_free_1 monoeg_g_slist_free_1
#define g_slist_index monoeg_g_slist_index
#define g_slist_insert_before monoeg_g_slist_insert_before
#define g_slist_insert_sorted monoeg_g_slist_insert_sorted
#define g_slist_last monoeg_g_slist_last
#define g_slist_length monoeg_g_slist_length
#define g_slist_nth monoeg_g_slist_nth
#define g_slist_nth_data monoeg_g_slist_nth_data
#define g_slist_prepend monoeg_g_slist_prepend
#define g_slist_remove monoeg_g_slist_remove
#define g_slist_remove_all monoeg_g_slist_remove_all
#define g_slist_remove_link monoeg_g_slist_remove_link
#define g_slist_reverse monoeg_g_slist_reverse
#define g_slist_sort monoeg_g_slist_sort
#define g_snprintf monoeg_g_snprintf
#define g_spaced_primes_closest monoeg_g_spaced_primes_closest
#define g_spawn_async_with_pipes monoeg_g_spawn_async_with_pipes
#define g_sprintf monoeg_g_sprintf
#define g_stpcpy monoeg_g_stpcpy
#define g_str_equal monoeg_g_str_equal
#define g_str_has_prefix monoeg_g_str_has_prefix
#define g_str_has_suffix monoeg_g_str_has_suffix
#define g_str_hash monoeg_g_str_hash
#define g_strchomp monoeg_g_strchomp
#define g_strchug monoeg_g_strchug
#define g_strconcat monoeg_g_strconcat
#define g_strdelimit monoeg_g_strdelimit
#define g_strdup_printf monoeg_g_strdup_printf
#define g_strdup_vprintf monoeg_g_strdup_vprintf
#define g_strerror monoeg_g_strerror
#define g_strfreev monoeg_g_strfreev
#define g_strdupv monoeg_g_strdupv
#define g_string_append monoeg_g_string_append
#define g_string_append_c monoeg_g_string_append_c
#define g_string_append_len monoeg_g_string_append_len
#define g_string_append_unichar monoeg_g_string_append_unichar
#define g_string_append_printf monoeg_g_string_append_printf
#define g_string_append_vprintf monoeg_g_string_append_vprintf
#define g_string_free monoeg_g_string_free
#define g_string_new monoeg_g_string_new
#define g_string_new_len monoeg_g_string_new_len
#define g_string_printf monoeg_g_string_printf
#define g_string_set_size monoeg_g_string_set_size
#define g_string_sized_new monoeg_g_string_sized_new
#define g_string_truncate monoeg_g_string_truncate
#define g_strjoin monoeg_g_strjoin
#define g_strjoinv monoeg_g_strjoinv
#define g_strlcpy monoeg_g_strlcpy
#define g_strndup monoeg_g_strndup
#define g_strnfill monoeg_g_strnfill
#define g_strnlen monoeg_g_strnlen
#define g_str_from_file_region monoeg_g_str_from_file_region
#define g_strreverse monoeg_g_strreverse
#define g_strsplit monoeg_g_strsplit
#define g_strsplit_set monoeg_g_strsplit_set
#define g_strv_length monoeg_g_strv_length
#define g_timer_destroy monoeg_g_timer_destroy
#define g_timer_elapsed monoeg_g_timer_elapsed
#define g_timer_new monoeg_g_timer_new
#define g_timer_start monoeg_g_timer_start
#define g_timer_stop monoeg_g_timer_stop
#define g_trailingBytesForUTF8 monoeg_g_trailingBytesForUTF8
#define g_ucs4_to_utf8 monoeg_g_ucs4_to_utf8
#define g_ucs4_to_utf16 monoeg_g_ucs4_to_utf16
#define g_usleep monoeg_g_usleep
#define g_utf16_to_ucs4 monoeg_g_utf16_to_ucs4
#define g_utf16_to_utf8 monoeg_g_utf16_to_utf8
#define g_utf16_to_utf8_custom_alloc monoeg_g_utf16_to_utf8_custom_alloc
#define g_utf16_ascii_equal monoeg_g_utf16_ascii_equal
#define g_utf16_asciiz_equal monoeg_g_utf16_asciiz_equal
#define g_utf8_jump_table monoeg_g_utf8_jump_table
#define g_utf8_get_char monoeg_g_utf8_get_char
#define g_utf8_strlen monoeg_g_utf8_strlen
#define g_utf8_to_utf16 monoeg_g_utf8_to_utf16
#define g_utf8_to_utf16_custom_alloc monoeg_g_utf8_to_utf16_custom_alloc
#define g_utf8_validate monoeg_g_utf8_validate
#define g_unichar_to_utf8 monoeg_g_unichar_to_utf8
#define g_utf8_offset_to_pointer monoeg_g_utf8_offset_to_pointer
#define g_utf8_pointer_to_offset monoeg_g_utf8_pointer_to_offset
#define g_utf8_to_ucs4_fast monoeg_g_utf8_to_ucs4_fast
#define g_vasprintf monoeg_g_vasprintf
#define g_win32_getlocale monoeg_g_win32_getlocale
#define g_assertion_disable_global monoeg_assertion_disable_global
#define g_assert_abort monoeg_assert_abort
#define g_assertion_message monoeg_assertion_message
#define g_get_assertion_message monoeg_get_assertion_message
#define g_malloc monoeg_malloc
#define g_malloc0 monoeg_malloc0
#define g_ptr_array_grow monoeg_ptr_array_grow
#define g_realloc monoeg_realloc
#define g_try_malloc monoeg_try_malloc
#define g_try_realloc monoeg_try_realloc
#define g_strdup monoeg_strdup
#define g_ucs4_to_utf16_len monoeg_ucs4_to_utf16_len
#define g_utf16_to_ucs4_len monoeg_utf16_to_ucs4_len
#define g_utf16_len monoeg_utf16_len
#define g_ascii_strcasecmp monoeg_ascii_strcasecmp
#define g_ascii_strup monoeg_ascii_strup
#define g_ascii_toupper monoeg_ascii_toupper
#define g_unichar_to_utf16 monoeg_unichar_to_utf16
#define g_utf8_get_char_validated monoeg_utf8_get_char_validated
#define g_utf8_to_ucs4 monoeg_utf8_to_ucs4
#define g_log_default_handler monoeg_log_default_handler
#define g_log_set_default_handler monoeg_log_set_default_handler
#define g_set_print_handler monoeg_set_print_handler
#define g_set_printerr_handler monoeg_set_printerr_handler
#define g_size_to_int monoeg_size_to_int
#define g_ascii_charcmp monoeg_ascii_charcmp
#define g_ascii_charcasecmp monoeg_ascii_charcasecmp
#define g_warning_d monoeg_warning_d
#ifdef HAVE_CLOCK_NANOSLEEP
#define g_clock_nanosleep monoeg_clock_nanosleep
#endif
|
#undef g_malloc
#undef g_realloc
#undef g_malloc0
#undef g_calloc
#undef g_try_malloc
#undef g_try_realloc
#undef g_memdup
#define g_array_append monoeg_g_array_append
#define g_array_append_vals monoeg_g_array_append_vals
#define g_array_free monoeg_g_array_free
#define g_array_insert_vals monoeg_g_array_insert_vals
#define g_array_new monoeg_g_array_new
#define g_array_remove_index monoeg_g_array_remove_index
#define g_array_remove_index_fast monoeg_g_array_remove_index_fast
#define g_array_set_size monoeg_g_array_set_size
#define g_array_sized_new monoeg_g_array_sized_new
#define g_ascii_strdown monoeg_g_ascii_strdown
#define g_ascii_strdown_no_alloc monoeg_g_ascii_strdown_no_alloc
#define g_ascii_strncasecmp monoeg_g_ascii_strncasecmp
#define g_ascii_tolower monoeg_g_ascii_tolower
#define g_ascii_xdigit_value monoeg_g_ascii_xdigit_value
#define g_build_path monoeg_g_build_path
#define g_byte_array_append monoeg_g_byte_array_append
#define g_byte_array_free monoeg_g_byte_array_free
#define g_byte_array_new monoeg_g_byte_array_new
#define g_byte_array_set_size monoeg_g_byte_array_set_size
#define g_calloc monoeg_g_calloc
#define g_clear_error monoeg_g_clear_error
#define g_convert_error_quark monoeg_g_convert_error_quark
#define g_fixed_buffer_custom_allocator monoeg_g_fixed_buffer_custom_allocator
#define g_dir_close monoeg_g_dir_close
#define g_dir_open monoeg_g_dir_open
#define g_dir_read_name monoeg_g_dir_read_name
#define g_dir_rewind monoeg_g_dir_rewind
#define g_mkdir_with_parents monoeg_g_mkdir_with_parents
#define g_direct_equal monoeg_g_direct_equal
#define g_direct_hash monoeg_g_direct_hash
#define g_ensure_directory_exists monoeg_g_ensure_directory_exists
#define g_error_free monoeg_g_error_free
#define g_error_new monoeg_g_error_new
#define g_error_vnew monoeg_g_error_vnew
#define g_file_error_quark monoeg_g_file_error_quark
#define g_file_error_from_errno monoeg_g_file_error_from_errno
#define g_file_get_contents monoeg_g_file_get_contents
#define g_file_set_contents monoeg_g_file_set_contents
#define g_file_open_tmp monoeg_g_file_open_tmp
#define g_file_test monoeg_g_file_test
#define g_find_program_in_path monoeg_g_find_program_in_path
#define g_fprintf monoeg_g_fprintf
#define g_free monoeg_g_free
#define g_get_current_dir monoeg_g_get_current_dir
#define g_get_current_time monoeg_g_get_current_time
#define g_get_home_dir monoeg_g_get_home_dir
#define g_get_prgname monoeg_g_get_prgname
#define g_get_tmp_dir monoeg_g_get_tmp_dir
#define g_get_user_name monoeg_g_get_user_name
#define g_getenv monoeg_g_getenv
#define g_hasenv monoeg_g_hasenv
#define g_hash_table_destroy monoeg_g_hash_table_destroy
#define g_hash_table_find monoeg_g_hash_table_find
#define g_hash_table_foreach monoeg_g_hash_table_foreach
#define g_hash_table_foreach_remove monoeg_g_hash_table_foreach_remove
#define g_hash_table_foreach_steal monoeg_g_hash_table_foreach_steal
#define g_hash_table_get_keys monoeg_g_hash_table_get_keys
#define g_hash_table_get_values monoeg_g_hash_table_get_values
#define g_hash_table_contains monoeg_g_hash_table_contains
#define g_hash_table_insert_replace monoeg_g_hash_table_insert_replace
#define g_hash_table_lookup monoeg_g_hash_table_lookup
#define g_hash_table_lookup_extended monoeg_g_hash_table_lookup_extended
#define g_hash_table_new monoeg_g_hash_table_new
#define g_hash_table_new_full monoeg_g_hash_table_new_full
#define g_hash_table_remove monoeg_g_hash_table_remove
#define g_hash_table_steal monoeg_g_hash_table_steal
#define g_hash_table_size monoeg_g_hash_table_size
#define g_hash_table_print_stats monoeg_g_hash_table_print_stats
#define g_hash_table_remove_all monoeg_g_hash_table_remove_all
#define g_hash_table_iter_init monoeg_g_hash_table_iter_init
#define g_hash_table_iter_next monoeg_g_hash_table_iter_next
#define g_int_equal monoeg_g_int_equal
#define g_int_hash monoeg_g_int_hash
#define g_list_alloc monoeg_g_list_alloc
#define g_list_append monoeg_g_list_append
#define g_list_concat monoeg_g_list_concat
#define g_list_copy monoeg_g_list_copy
#define g_list_delete_link monoeg_g_list_delete_link
#define g_list_find monoeg_g_list_find
#define g_list_find_custom monoeg_g_list_find_custom
#define g_list_first monoeg_g_list_first
#define g_list_foreach monoeg_g_list_foreach
#define g_list_free monoeg_g_list_free
#define g_list_free_1 monoeg_g_list_free_1
#define g_list_index monoeg_g_list_index
#define g_list_insert_before monoeg_g_list_insert_before
#define g_list_insert_sorted monoeg_g_list_insert_sorted
#define g_list_last monoeg_g_list_last
#define g_list_length monoeg_g_list_length
#define g_list_nth monoeg_g_list_nth
#define g_list_nth_data monoeg_g_list_nth_data
#define g_list_prepend monoeg_g_list_prepend
#define g_list_remove monoeg_g_list_remove
#define g_list_remove_all monoeg_g_list_remove_all
#define g_list_remove_link monoeg_g_list_remove_link
#define g_list_reverse monoeg_g_list_reverse
#define g_list_sort monoeg_g_list_sort
#define g_log monoeg_g_log
#define g_log_set_always_fatal monoeg_g_log_set_always_fatal
#define g_log_set_fatal_mask monoeg_g_log_set_fatal_mask
#define g_logv monoeg_g_logv
#define g_memdup monoeg_g_memdup
#define g_mem_set_vtable monoeg_g_mem_set_vtable
#define g_mem_get_vtable monoeg_g_mem_get_vtable
#define g_mkdtemp monoeg_g_mkdtemp
#define g_module_address monoeg_g_module_address
#define g_module_build_path monoeg_g_module_build_path
#define g_module_close monoeg_g_module_close
#define g_module_error monoeg_g_module_error
#define g_module_open monoeg_g_module_open
#define g_module_symbol monoeg_g_module_symbol
#define g_path_get_basename monoeg_g_path_get_basename
#define g_path_get_dirname monoeg_g_path_get_dirname
#define g_path_is_absolute monoeg_g_path_is_absolute
#define g_async_safe_fgets monoeg_g_async_safe_fgets
#define g_async_safe_fprintf monoeg_g_async_safe_fprintf
#define g_async_safe_vfprintf monoeg_g_async_safe_vfprintf
#define g_async_safe_printf monoeg_g_async_safe_printf
#define g_async_safe_vprintf monoeg_g_async_safe_vprintf
#define g_print monoeg_g_print
#define g_printf monoeg_g_printf
#define g_printv monoeg_g_printv
#define g_printerr monoeg_g_printerr
#define g_propagate_error monoeg_g_propagate_error
#define g_ptr_array_add monoeg_g_ptr_array_add
#define g_ptr_array_capacity monoeg_g_ptr_array_capacity
#define g_ptr_array_foreach monoeg_g_ptr_array_foreach
#define g_ptr_array_free monoeg_g_ptr_array_free
#define g_ptr_array_new monoeg_g_ptr_array_new
#define g_ptr_array_remove monoeg_g_ptr_array_remove
#define g_ptr_array_remove_fast monoeg_g_ptr_array_remove_fast
#define g_ptr_array_remove_index monoeg_g_ptr_array_remove_index
#define g_ptr_array_remove_index_fast monoeg_g_ptr_array_remove_index_fast
#define g_ptr_array_set_size monoeg_g_ptr_array_set_size
#define g_ptr_array_sized_new monoeg_g_ptr_array_sized_new
#define g_ptr_array_sort monoeg_g_ptr_array_sort
#define g_ptr_array_find monoeg_g_ptr_array_find
#define g_queue_free monoeg_g_queue_free
#define g_queue_is_empty monoeg_g_queue_is_empty
#define g_queue_foreach monoeg_g_queue_foreach
#define g_queue_new monoeg_g_queue_new
#define g_queue_pop_head monoeg_g_queue_pop_head
#define g_queue_push_head monoeg_g_queue_push_head
#define g_queue_push_tail monoeg_g_queue_push_tail
#define g_set_error monoeg_g_set_error
#define g_set_prgname monoeg_g_set_prgname
#define g_setenv monoeg_g_setenv
#define g_slist_alloc monoeg_g_slist_alloc
#define g_slist_append monoeg_g_slist_append
#define g_slist_concat monoeg_g_slist_concat
#define g_slist_copy monoeg_g_slist_copy
#define g_slist_delete_link monoeg_g_slist_delete_link
#define g_slist_find monoeg_g_slist_find
#define g_slist_find_custom monoeg_g_slist_find_custom
#define g_slist_foreach monoeg_g_slist_foreach
#define g_slist_free monoeg_g_slist_free
#define g_slist_free_1 monoeg_g_slist_free_1
#define g_slist_index monoeg_g_slist_index
#define g_slist_insert_before monoeg_g_slist_insert_before
#define g_slist_insert_sorted monoeg_g_slist_insert_sorted
#define g_slist_last monoeg_g_slist_last
#define g_slist_length monoeg_g_slist_length
#define g_slist_nth monoeg_g_slist_nth
#define g_slist_nth_data monoeg_g_slist_nth_data
#define g_slist_prepend monoeg_g_slist_prepend
#define g_slist_remove monoeg_g_slist_remove
#define g_slist_remove_all monoeg_g_slist_remove_all
#define g_slist_remove_link monoeg_g_slist_remove_link
#define g_slist_reverse monoeg_g_slist_reverse
#define g_slist_sort monoeg_g_slist_sort
#define g_snprintf monoeg_g_snprintf
#define g_spaced_primes_closest monoeg_g_spaced_primes_closest
#define g_spawn_async_with_pipes monoeg_g_spawn_async_with_pipes
#define g_sprintf monoeg_g_sprintf
#define g_stpcpy monoeg_g_stpcpy
#define g_str_equal monoeg_g_str_equal
#define g_str_has_prefix monoeg_g_str_has_prefix
#define g_str_has_suffix monoeg_g_str_has_suffix
#define g_str_hash monoeg_g_str_hash
#define g_strchomp monoeg_g_strchomp
#define g_strchug monoeg_g_strchug
#define g_strconcat monoeg_g_strconcat
#define g_strdelimit monoeg_g_strdelimit
#define g_strdup_printf monoeg_g_strdup_printf
#define g_strdup_vprintf monoeg_g_strdup_vprintf
#define g_strerror monoeg_g_strerror
#define g_strfreev monoeg_g_strfreev
#define g_strdupv monoeg_g_strdupv
#define g_string_append monoeg_g_string_append
#define g_string_append_c monoeg_g_string_append_c
#define g_string_append_len monoeg_g_string_append_len
#define g_string_append_unichar monoeg_g_string_append_unichar
#define g_string_append_printf monoeg_g_string_append_printf
#define g_string_append_vprintf monoeg_g_string_append_vprintf
#define g_string_free monoeg_g_string_free
#define g_string_new monoeg_g_string_new
#define g_string_new_len monoeg_g_string_new_len
#define g_string_printf monoeg_g_string_printf
#define g_string_set_size monoeg_g_string_set_size
#define g_string_sized_new monoeg_g_string_sized_new
#define g_string_truncate monoeg_g_string_truncate
#define g_strjoin monoeg_g_strjoin
#define g_strjoinv monoeg_g_strjoinv
#define g_strlcpy monoeg_g_strlcpy
#define g_strndup monoeg_g_strndup
#define g_strnfill monoeg_g_strnfill
#define g_strnlen monoeg_g_strnlen
#define g_str_from_file_region monoeg_g_str_from_file_region
#define g_strreverse monoeg_g_strreverse
#define g_strsplit monoeg_g_strsplit
#define g_strsplit_set monoeg_g_strsplit_set
#define g_strv_length monoeg_g_strv_length
#define g_timer_destroy monoeg_g_timer_destroy
#define g_timer_elapsed monoeg_g_timer_elapsed
#define g_timer_new monoeg_g_timer_new
#define g_timer_start monoeg_g_timer_start
#define g_timer_stop monoeg_g_timer_stop
#define g_trailingBytesForUTF8 monoeg_g_trailingBytesForUTF8
#define g_ucs4_to_utf8 monoeg_g_ucs4_to_utf8
#define g_ucs4_to_utf16 monoeg_g_ucs4_to_utf16
#define g_usleep monoeg_g_usleep
#define g_utf16_to_ucs4 monoeg_g_utf16_to_ucs4
#define g_utf16_to_utf8 monoeg_g_utf16_to_utf8
#define g_utf16_to_utf8_custom_alloc monoeg_g_utf16_to_utf8_custom_alloc
#define g_utf16_ascii_equal monoeg_g_utf16_ascii_equal
#define g_utf16_asciiz_equal monoeg_g_utf16_asciiz_equal
#define g_utf8_jump_table monoeg_g_utf8_jump_table
#define g_utf8_get_char monoeg_g_utf8_get_char
#define g_utf8_strlen monoeg_g_utf8_strlen
#define g_utf8_to_utf16 monoeg_g_utf8_to_utf16
#define g_utf8_to_utf16_custom_alloc monoeg_g_utf8_to_utf16_custom_alloc
#define g_utf8_validate monoeg_g_utf8_validate
#define g_unichar_to_utf8 monoeg_g_unichar_to_utf8
#define g_utf8_offset_to_pointer monoeg_g_utf8_offset_to_pointer
#define g_utf8_pointer_to_offset monoeg_g_utf8_pointer_to_offset
#define g_utf8_to_ucs4_fast monoeg_g_utf8_to_ucs4_fast
#define g_vasprintf monoeg_g_vasprintf
#define g_win32_getlocale monoeg_g_win32_getlocale
#define g_assertion_disable_global monoeg_assertion_disable_global
#define g_assert_abort monoeg_assert_abort
#define g_assertion_message monoeg_assertion_message
#define g_get_assertion_message monoeg_get_assertion_message
#define g_malloc monoeg_malloc
#define g_malloc0 monoeg_malloc0
#define g_ptr_array_grow monoeg_ptr_array_grow
#define g_realloc monoeg_realloc
#define g_try_malloc monoeg_try_malloc
#define g_try_realloc monoeg_try_realloc
#define g_strdup monoeg_strdup
#define g_ucs4_to_utf16_len monoeg_ucs4_to_utf16_len
#define g_utf16_to_ucs4_len monoeg_utf16_to_ucs4_len
#define g_utf16_len monoeg_utf16_len
#define g_ascii_strcasecmp monoeg_ascii_strcasecmp
#define g_ascii_strup monoeg_ascii_strup
#define g_ascii_toupper monoeg_ascii_toupper
#define g_unichar_to_utf16 monoeg_unichar_to_utf16
#define g_utf8_get_char_validated monoeg_utf8_get_char_validated
#define g_utf8_to_ucs4 monoeg_utf8_to_ucs4
#define g_log_default_handler monoeg_log_default_handler
#define g_log_set_default_handler monoeg_log_set_default_handler
#define g_set_print_handler monoeg_set_print_handler
#define g_set_printerr_handler monoeg_set_printerr_handler
#define g_size_to_int monoeg_size_to_int
#define g_ascii_charcmp monoeg_ascii_charcmp
#define g_ascii_charcasecmp monoeg_ascii_charcasecmp
#define g_warning_d monoeg_warning_d
#ifdef HAVE_CLOCK_NANOSLEEP
#define g_clock_nanosleep monoeg_clock_nanosleep
#endif
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/Interop/LayoutClass/LayoutClassNative.cpp
|
#include "platformdefines.h"
#include <stdio.h>
#include <stdlib.h>
#include <xplatform.h>
typedef void *voidPtr;
struct EmptyBase
{
};
struct DerivedSeqClass : public EmptyBase
{
int a;
};
struct SeqClass
{
int a;
bool b;
char* str;
};
struct ExpClass
{
int a;
int padding; //padding needs to be added here as we have added 8 byte offset.
union
{
int i;
BOOL b;
double d;
} udata;
};
struct BlittableClass
{
int a;
};
struct NestedLayoutClass
{
SeqClass str;
};
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleSeqLayoutClassByRef(SeqClass* p)
{
if((p->a != 0) || (p->b) || strcmp(p->str, "before") != 0)
{
printf("FAIL: p->a=%d, p->b=%s, p->str=%s\n", p->a, p->b ? "true" : "false", p->str);
return FALSE;
}
return TRUE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleSeqLayoutClassByRefNull(SeqClass* p)
{
return p == NULL ? TRUE : FALSE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE DerivedSeqLayoutClassByRef(EmptyBase* p, int expected)
{
if(((DerivedSeqClass*)p)->a != expected)
{
printf("FAIL: p->a=%d, expected %d\n", ((DerivedSeqClass*)p)->a, expected);
return FALSE;
}
return TRUE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleExpLayoutClassByRef(ExpClass* p)
{
if((p->a != 0) || (p->udata.i != 10))
{
printf("FAIL: p->a=%d, p->udata.i=%d\n",p->a,p->udata.i);
return FALSE;
}
return TRUE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleBlittableSeqLayoutClass_UpdateField(BlittableClass* p)
{
if(p->a != 10)
{
printf("FAIL: p->a=%d\n", p->a);
return FALSE;
}
p->a++;
return TRUE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleBlittableSeqLayoutClass_Null(BlittableClass* p)
{
return p == NULL ? TRUE : FALSE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleNestedLayoutClassByValue(NestedLayoutClass v)
{
return SimpleSeqLayoutClassByRef(&v.str);
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE PointersEqual(void* ptr, void* ptr2)
{
return ptr == ptr2 ? TRUE : FALSE;
}
extern "C"
DLL_EXPORT void __cdecl Invalid(...)
{
}
|
#include "platformdefines.h"
#include <stdio.h>
#include <stdlib.h>
#include <xplatform.h>
typedef void *voidPtr;
struct EmptyBase
{
};
struct DerivedSeqClass : public EmptyBase
{
int a;
};
struct SeqClass
{
int a;
bool b;
char* str;
};
struct ExpClass
{
int a;
int padding; //padding needs to be added here as we have added 8 byte offset.
union
{
int i;
BOOL b;
double d;
} udata;
};
struct BlittableClass
{
int a;
};
struct NestedLayoutClass
{
SeqClass str;
};
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleSeqLayoutClassByRef(SeqClass* p)
{
if((p->a != 0) || (p->b) || strcmp(p->str, "before") != 0)
{
printf("FAIL: p->a=%d, p->b=%s, p->str=%s\n", p->a, p->b ? "true" : "false", p->str);
return FALSE;
}
return TRUE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleSeqLayoutClassByRefNull(SeqClass* p)
{
return p == NULL ? TRUE : FALSE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE DerivedSeqLayoutClassByRef(EmptyBase* p, int expected)
{
if(((DerivedSeqClass*)p)->a != expected)
{
printf("FAIL: p->a=%d, expected %d\n", ((DerivedSeqClass*)p)->a, expected);
return FALSE;
}
return TRUE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleExpLayoutClassByRef(ExpClass* p)
{
if((p->a != 0) || (p->udata.i != 10))
{
printf("FAIL: p->a=%d, p->udata.i=%d\n",p->a,p->udata.i);
return FALSE;
}
return TRUE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleBlittableSeqLayoutClass_UpdateField(BlittableClass* p)
{
if(p->a != 10)
{
printf("FAIL: p->a=%d\n", p->a);
return FALSE;
}
p->a++;
return TRUE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleBlittableSeqLayoutClass_Null(BlittableClass* p)
{
return p == NULL ? TRUE : FALSE;
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE SimpleNestedLayoutClassByValue(NestedLayoutClass v)
{
return SimpleSeqLayoutClassByRef(&v.str);
}
extern "C"
DLL_EXPORT BOOL STDMETHODCALLTYPE PointersEqual(void* ptr, void* ptr2)
{
return ptr == ptr2 ? TRUE : FALSE;
}
extern "C"
DLL_EXPORT void __cdecl Invalid(...)
{
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/binder/assembly.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ============================================================
//
// Assembly.cpp
//
//
// Implements the Assembly class
//
// ============================================================
#include "common.h"
#include "assembly.hpp"
#include "utils.hpp"
#include "assemblybindercommon.hpp"
namespace BINDER_SPACE
{
Assembly::Assembly()
{
m_cRef = 1;
m_pPEImage = NULL;
m_pAssemblyName = NULL;
m_isInTPA = false;
m_pBinder = NULL;
m_domainAssembly = NULL;
}
Assembly::~Assembly()
{
SAFE_RELEASE(m_pPEImage);
SAFE_RELEASE(m_pAssemblyName);
}
HRESULT Assembly::Init(PEImage *pPEImage, BOOL fIsInTPA)
{
HRESULT hr = S_OK;
ReleaseHolder<AssemblyName> pAssemblyName;
SAFE_NEW(pAssemblyName, AssemblyName);
// Get assembly name def from meta data import and store it for later refs access
IF_FAIL_GO(pAssemblyName->Init(pPEImage));
pAssemblyName->SetIsDefinition(TRUE);
// validate architecture
if (!AssemblyBinderCommon::IsValidArchitecture(pAssemblyName->GetArchitecture()))
{
// Assembly image can't be executed on this platform
IF_FAIL_GO(HRESULT_FROM_WIN32(ERROR_BAD_FORMAT));
}
m_isInTPA = fIsInTPA;
pPEImage->AddRef();
m_pPEImage = pPEImage;
// Now take ownership of assembly name
m_pAssemblyName = pAssemblyName.Extract();
Exit:
return hr;
}
PEImage* Assembly::GetPEImage()
{
return m_pPEImage;
}
LPCWSTR Assembly::GetSimpleName()
{
AssemblyName *pAsmName = GetAssemblyName();
return (pAsmName == nullptr ? nullptr : (LPCWSTR)pAsmName->GetSimpleName());
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ============================================================
//
// Assembly.cpp
//
//
// Implements the Assembly class
//
// ============================================================
#include "common.h"
#include "assembly.hpp"
#include "utils.hpp"
#include "assemblybindercommon.hpp"
namespace BINDER_SPACE
{
Assembly::Assembly()
{
m_cRef = 1;
m_pPEImage = NULL;
m_pAssemblyName = NULL;
m_isInTPA = false;
m_pBinder = NULL;
m_domainAssembly = NULL;
}
Assembly::~Assembly()
{
SAFE_RELEASE(m_pPEImage);
SAFE_RELEASE(m_pAssemblyName);
}
HRESULT Assembly::Init(PEImage *pPEImage, BOOL fIsInTPA)
{
HRESULT hr = S_OK;
ReleaseHolder<AssemblyName> pAssemblyName;
SAFE_NEW(pAssemblyName, AssemblyName);
// Get assembly name def from meta data import and store it for later refs access
IF_FAIL_GO(pAssemblyName->Init(pPEImage));
pAssemblyName->SetIsDefinition(TRUE);
// validate architecture
if (!AssemblyBinderCommon::IsValidArchitecture(pAssemblyName->GetArchitecture()))
{
// Assembly image can't be executed on this platform
IF_FAIL_GO(HRESULT_FROM_WIN32(ERROR_BAD_FORMAT));
}
m_isInTPA = fIsInTPA;
pPEImage->AddRef();
m_pPEImage = pPEImage;
// Now take ownership of assembly name
m_pAssemblyName = pAssemblyName.Extract();
Exit:
return hr;
}
PEImage* Assembly::GetPEImage()
{
return m_pPEImage;
}
LPCWSTR Assembly::GetSimpleName()
{
AssemblyName *pAsmName = GetAssemblyName();
return (pAsmName == nullptr ? nullptr : (LPCWSTR)pAsmName->GetSimpleName());
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ReferenceSource/CallingConvention.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
//
// Provides an abstraction over platform specific calling conventions (specifically, the calling convention
// utilized by the JIT on that platform). The caller enumerates each argument of a signature in turn, and is
// provided with information mapping that argument into registers and/or stack locations.
//
#ifndef __CALLING_CONVENTION_INCLUDED
#define __CALLING_CONVENTION_INCLUDED
BOOL IsRetBuffPassedAsFirstArg();
// Describes how a single argument is laid out in registers and/or stack locations when given as an input to a
// managed method as part of a larger signature.
//
// Locations are split into floating point registers, general registers and stack offsets. Registers are
// obviously architecture dependent but are represented as a zero-based index into the usual sequence in which
// such registers are allocated for input on the platform in question. For instance:
// X86: 0 == ecx, 1 == edx
// ARM: 0 == r0, 1 == r1, 2 == r2 etc.
//
// Stack locations are represented as offsets from the stack pointer (at the point of the call). The offset is
// given as an index of a pointer sized slot. Similarly the size of data on the stack is given in slot-sized
// units. For instance, given an index of 2 and a size of 3:
// X86: argument starts at [ESP + 8] and is 12 bytes long
// AMD64: argument starts at [RSP + 16] and is 24 bytes long
//
// The structure is flexible enough to describe an argument that is split over several (consecutive) registers
// and possibly on to the stack as well.
struct ArgLocDesc
{
int m_idxFloatReg; // First floating point register used (or -1)
int m_cFloatReg; // Count of floating point registers used (or 0)
int m_idxGenReg; // First general register used (or -1)
int m_cGenReg; // Count of general registers used (or 0)
int m_idxStack; // First stack slot used (or -1)
int m_cStack; // Count of stack slots used (or 0)
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
EEClass* m_eeClass; // For structs passed in register, it points to the EEClass of the struct
#endif // UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
#if defined(_TARGET_ARM64_)
bool m_isSinglePrecision; // For determining if HFA is single or double
// precision
#endif // defined(_TARGET_ARM64_)
#if defined(_TARGET_ARM_)
BOOL m_fRequires64BitAlignment; // True if the argument should always be aligned (in registers or on the stack
#endif
ArgLocDesc()
{
Init();
}
// Initialize to represent a non-placed argument (no register or stack slots referenced).
void Init()
{
m_idxFloatReg = -1;
m_cFloatReg = 0;
m_idxGenReg = -1;
m_cGenReg = 0;
m_idxStack = -1;
m_cStack = 0;
#if defined(_TARGET_ARM_)
m_fRequires64BitAlignment = FALSE;
#endif
#if defined(_TARGET_ARM64_)
m_isSinglePrecision = FALSE;
#endif // defined(_TARGET_ARM64_)
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
m_eeClass = NULL;
#endif
}
};
//
// TransitionBlock is layout of stack frame of method call, saved argument registers and saved callee saved registers. Even though not
// all fields are used all the time, we use uniform form for simplicity.
//
struct TransitionBlock
{
#if defined(_TARGET_X86_)
ArgumentRegisters m_argumentRegisters;
CalleeSavedRegisters m_calleeSavedRegisters;
TADDR m_ReturnAddress;
#elif defined(_TARGET_AMD64_)
#ifdef UNIX_AMD64_ABI
ArgumentRegisters m_argumentRegisters;
#endif
CalleeSavedRegisters m_calleeSavedRegisters;
TADDR m_ReturnAddress;
#elif defined(_TARGET_ARM_)
union {
CalleeSavedRegisters m_calleeSavedRegisters;
// alias saved link register as m_ReturnAddress
struct {
INT32 r4, r5, r6, r7, r8, r9, r10;
INT32 r11;
TADDR m_ReturnAddress;
};
};
ArgumentRegisters m_argumentRegisters;
#elif defined(_TARGET_ARM64_)
union {
CalleeSavedRegisters m_calleeSavedRegisters;
struct {
INT64 x29; // frame pointer
TADDR m_ReturnAddress;
INT64 x19, x20, x21, x22, x23, x24, x25, x26, x27, x28;
};
};
ArgumentRegisters m_argumentRegisters;
TADDR padding; // Keep size of TransitionBlock as multiple of 16-byte. Simplifies code in PROLOG_WITH_TRANSITION_BLOCK
#else
PORTABILITY_ASSERT("TransitionBlock");
#endif
// The transition block should define everything pushed by callee. The code assumes in number of places that
// end of the transition block is caller's stack pointer.
static int GetOffsetOfReturnAddress()
{
LIMITED_METHOD_CONTRACT;
return offsetof(TransitionBlock, m_ReturnAddress);
}
static BYTE GetOffsetOfArgs()
{
LIMITED_METHOD_CONTRACT;
return sizeof(TransitionBlock);
}
static int GetOffsetOfArgumentRegisters()
{
LIMITED_METHOD_CONTRACT;
int offs;
#if defined(_TARGET_AMD64_) && !defined(UNIX_AMD64_ABI)
offs = sizeof(TransitionBlock);
#else
offs = offsetof(TransitionBlock, m_argumentRegisters);
#endif
return offs;
}
static BOOL IsStackArgumentOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
return offset >= sizeof(TransitionBlock);
#else
int ofsArgRegs = GetOffsetOfArgumentRegisters();
return offset >= (int) (ofsArgRegs + ARGUMENTREGISTERS_SIZE);
#endif
}
static BOOL IsArgumentRegisterOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
int ofsArgRegs = GetOffsetOfArgumentRegisters();
return offset >= ofsArgRegs && offset < (int) (ofsArgRegs + ARGUMENTREGISTERS_SIZE);
}
#ifndef _TARGET_X86_
static UINT GetArgumentIndexFromOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
_ASSERTE(offset != TransitionBlock::StructInRegsOffset);
#endif
return (offset - GetOffsetOfArgumentRegisters()) / sizeof(TADDR);
}
static UINT GetStackArgumentIndexFromOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
return (offset - TransitionBlock::GetOffsetOfArgs()) / STACK_ELEM_SIZE;
}
#endif
#ifdef CALLDESCR_FPARGREGS
static BOOL IsFloatArgumentRegisterOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
return (offset != TransitionBlock::StructInRegsOffset) && (offset < 0);
#else
return offset < 0;
#endif
}
// Check if an argument has floating point register, that means that it is
// either a floating point argument or a struct passed in registers that
// has a floating point member.
static BOOL HasFloatRegister(int offset, ArgLocDesc* argLocDescForStructInRegs)
{
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
if (offset == TransitionBlock::StructInRegsOffset)
{
return argLocDescForStructInRegs->m_cFloatReg > 0;
}
#endif
return offset < 0;
}
static int GetOffsetOfFloatArgumentRegisters()
{
LIMITED_METHOD_CONTRACT;
return -GetNegSpaceSize();
}
#endif // CALLDESCR_FPARGREGS
static int GetOffsetOfCalleeSavedRegisters()
{
LIMITED_METHOD_CONTRACT;
return offsetof(TransitionBlock, m_calleeSavedRegisters);
}
static int GetNegSpaceSize()
{
LIMITED_METHOD_CONTRACT;
int negSpaceSize = 0;
#ifdef CALLDESCR_FPARGREGS
negSpaceSize += sizeof(FloatArgumentRegisters);
#endif
#ifdef _TARGET_ARM_
negSpaceSize += sizeof(TADDR); // padding to make FloatArgumentRegisters address 8-byte aligned
#endif
return negSpaceSize;
}
static const int InvalidOffset = -1;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
// Special offset value to represent struct passed in registers. Such a struct can span both
// general purpose and floating point registers, so it can have two different offsets.
static const int StructInRegsOffset = -2;
#endif
};
//-----------------------------------------------------------------------
// ArgIterator is helper for dealing with calling conventions.
// It is tightly coupled with TransitionBlock. It uses offsets into
// TransitionBlock to represent argument locations for efficiency
// reasons. Alternatively, it can also return ArgLocDesc for less
// performance critical code.
//
// The ARGITERATOR_BASE argument of the template is provider of the parsed
// method signature. Typically, the arg iterator works on top of MetaSig.
// Reflection invoke uses alternative implementation to save signature parsing
// time because of it has the parsed signature available.
//-----------------------------------------------------------------------
template<class ARGITERATOR_BASE>
class ArgIteratorTemplate : public ARGITERATOR_BASE
{
public:
//------------------------------------------------------------
// Constructor
//------------------------------------------------------------
ArgIteratorTemplate()
{
WRAPPER_NO_CONTRACT;
m_dwFlags = 0;
}
UINT SizeOfArgStack()
{
WRAPPER_NO_CONTRACT;
if (!(m_dwFlags & SIZE_OF_ARG_STACK_COMPUTED))
ForceSigWalk();
_ASSERTE((m_dwFlags & SIZE_OF_ARG_STACK_COMPUTED) != 0);
return m_nSizeOfArgStack;
}
// For use with ArgIterator. This function computes the amount of additional
// memory required above the TransitionBlock. The parameter offsets
// returned by ArgIteratorTemplate::GetNextOffset are relative to a
// FramedMethodFrame, and may be in either of these regions.
UINT SizeOfFrameArgumentArray()
{
WRAPPER_NO_CONTRACT;
UINT size = SizeOfArgStack();
#if defined(_TARGET_AMD64_) && !defined(UNIX_AMD64_ABI)
// The argument registers are not included in the stack size on AMD64
size += ARGUMENTREGISTERS_SIZE;
#endif
return size;
}
//------------------------------------------------------------------------
#ifdef _TARGET_X86_
UINT CbStackPop()
{
WRAPPER_NO_CONTRACT;
if (this->IsVarArg())
return 0;
else
return SizeOfArgStack();
}
#endif
// Is there a hidden parameter for the return parameter?
//
BOOL HasRetBuffArg()
{
WRAPPER_NO_CONTRACT;
if (!(m_dwFlags & RETURN_FLAGS_COMPUTED))
ComputeReturnFlags();
return (m_dwFlags & RETURN_HAS_RET_BUFFER);
}
UINT GetFPReturnSize()
{
WRAPPER_NO_CONTRACT;
if (!(m_dwFlags & RETURN_FLAGS_COMPUTED))
ComputeReturnFlags();
return m_dwFlags >> RETURN_FP_SIZE_SHIFT;
}
#ifdef _TARGET_X86_
//=========================================================================
// Indicates whether an argument is to be put in a register using the
// default IL calling convention. This should be called on each parameter
// in the order it appears in the call signature. For a non-static method,
// this function should also be called once for the "this" argument, prior
// to calling it for the "real" arguments. Pass in a typ of ELEMENT_TYPE_CLASS.
//
// *pNumRegistersUsed: [in,out]: keeps track of the number of argument
// registers assigned previously. The caller should
// initialize this variable to 0 - then each call
// will update it.
//
// typ: the signature type
//=========================================================================
static BOOL IsArgumentInRegister(int * pNumRegistersUsed, CorElementType typ)
{
LIMITED_METHOD_CONTRACT;
if ( (*pNumRegistersUsed) < NUM_ARGUMENT_REGISTERS) {
if (gElementTypeInfo[typ].m_enregister) {
(*pNumRegistersUsed)++;
return(TRUE);
}
}
return(FALSE);
}
#endif // _TARGET_X86_
#if defined(ENREGISTERED_PARAMTYPE_MAXSIZE)
// Note that this overload does not handle varargs
static BOOL IsArgPassedByRef(TypeHandle th)
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(!th.IsNull());
// This method only works for valuetypes. It includes true value types,
// primitives, enums and TypedReference.
_ASSERTE(th.IsValueType());
size_t size = th.GetSize();
#ifdef _TARGET_AMD64_
return IsArgPassedByRef(size);
#elif defined(_TARGET_ARM64_)
// Composites greater than 16 bytes are passed by reference
return ((size > ENREGISTERED_PARAMTYPE_MAXSIZE) && !th.IsHFA());
#else
PORTABILITY_ASSERT("ArgIteratorTemplate::IsArgPassedByRef");
return FALSE;
#endif
}
#ifdef _TARGET_AMD64_
// This overload should only be used in AMD64-specific code only.
static BOOL IsArgPassedByRef(size_t size)
{
LIMITED_METHOD_CONTRACT;
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
// No arguments are passed by reference on AMD64 on Unix
return FALSE;
#else
// If the size is bigger than ENREGISTERED_PARAM_TYPE_MAXSIZE, or if the size is NOT a power of 2, then
// the argument is passed by reference.
return (size > ENREGISTERED_PARAMTYPE_MAXSIZE) || ((size & (size-1)) != 0);
#endif
}
#endif // _TARGET_AMD64_
// This overload should be used for varargs only.
static BOOL IsVarArgPassedByRef(size_t size)
{
LIMITED_METHOD_CONTRACT;
#ifdef _TARGET_AMD64_
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
PORTABILITY_ASSERT("ArgIteratorTemplate::IsVarArgPassedByRef");
return FALSE;
#else // FEATURE_UNIX_AMD64_STRUCT_PASSING
return IsArgPassedByRef(size);
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
#else
return (size > ENREGISTERED_PARAMTYPE_MAXSIZE);
#endif
}
BOOL IsArgPassedByRef()
{
LIMITED_METHOD_CONTRACT;
#ifdef _TARGET_AMD64_
return IsArgPassedByRef(m_argSize);
#elif defined(_TARGET_ARM64_)
if (m_argType == ELEMENT_TYPE_VALUETYPE)
{
_ASSERTE(!m_argTypeHandle.IsNull());
return ((m_argSize > ENREGISTERED_PARAMTYPE_MAXSIZE) && (!m_argTypeHandle.IsHFA() || this->IsVarArg()));
}
return FALSE;
#else
PORTABILITY_ASSERT("ArgIteratorTemplate::IsArgPassedByRef");
return FALSE;
#endif
}
#endif // ENREGISTERED_PARAMTYPE_MAXSIZE
//------------------------------------------------------------
// Return the offsets of the special arguments
//------------------------------------------------------------
static int GetThisOffset();
int GetRetBuffArgOffset();
int GetVASigCookieOffset();
int GetParamTypeArgOffset();
//------------------------------------------------------------
// Each time this is called, this returns a byte offset of the next
// argument from the TransitionBlock* pointer.
//
// Returns TransitionBlock::InvalidOffset once you've hit the end
// of the list.
//------------------------------------------------------------
int GetNextOffset();
CorElementType GetArgType(TypeHandle *pTypeHandle = NULL)
{
LIMITED_METHOD_CONTRACT;
if (pTypeHandle != NULL)
{
*pTypeHandle = m_argTypeHandle;
}
return m_argType;
}
int GetArgSize()
{
LIMITED_METHOD_CONTRACT;
return m_argSize;
}
void ForceSigWalk();
#ifndef _TARGET_X86_
// Accessors for built in argument descriptions of the special implicit parameters not mentioned directly
// in signatures (this pointer and the like). Whether or not these can be used successfully before all the
// explicit arguments have been scanned is platform dependent.
void GetThisLoc(ArgLocDesc * pLoc) { WRAPPER_NO_CONTRACT; GetSimpleLoc(GetThisOffset(), pLoc); }
void GetRetBuffArgLoc(ArgLocDesc * pLoc) { WRAPPER_NO_CONTRACT; GetSimpleLoc(GetRetBuffArgOffset(), pLoc); }
void GetParamTypeLoc(ArgLocDesc * pLoc) { WRAPPER_NO_CONTRACT; GetSimpleLoc(GetParamTypeArgOffset(), pLoc); }
void GetVASigCookieLoc(ArgLocDesc * pLoc) { WRAPPER_NO_CONTRACT; GetSimpleLoc(GetVASigCookieOffset(), pLoc); }
#endif // !_TARGET_X86_
ArgLocDesc* GetArgLocDescForStructInRegs()
{
#if (defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)) || defined (_TARGET_ARM64_)
return m_hasArgLocDescForStructInRegs ? &m_argLocDescForStructInRegs : NULL;
#else
return NULL;
#endif
}
#ifdef _TARGET_ARM_
// Get layout information for the argument that the ArgIterator is currently visiting.
void GetArgLoc(int argOffset, ArgLocDesc *pLoc)
{
LIMITED_METHOD_CONTRACT;
pLoc->Init();
pLoc->m_fRequires64BitAlignment = m_fRequires64BitAlignment;
int cSlots = (GetArgSize() + 3) / 4;
if (TransitionBlock::IsFloatArgumentRegisterOffset(argOffset))
{
pLoc->m_idxFloatReg = (argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters()) / 4;
pLoc->m_cFloatReg = cSlots;
return;
}
if (!TransitionBlock::IsStackArgumentOffset(argOffset))
{
pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
if (cSlots <= (4 - pLoc->m_idxGenReg))
{
pLoc->m_cGenReg = cSlots;
}
else
{
pLoc->m_cGenReg = 4 - pLoc->m_idxGenReg;
pLoc->m_idxStack = 0;
pLoc->m_cStack = cSlots - pLoc->m_cGenReg;
}
}
else
{
pLoc->m_idxStack = TransitionBlock::GetStackArgumentIndexFromOffset(argOffset);
pLoc->m_cStack = cSlots;
}
}
#endif // _TARGET_ARM_
#ifdef _TARGET_ARM64_
// Get layout information for the argument that the ArgIterator is currently visiting.
void GetArgLoc(int argOffset, ArgLocDesc *pLoc)
{
LIMITED_METHOD_CONTRACT;
pLoc->Init();
if (TransitionBlock::IsFloatArgumentRegisterOffset(argOffset))
{
// Dividing by 8 as size of each register in FloatArgumentRegisters is 8 bytes.
pLoc->m_idxFloatReg = (argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters()) / 8;
if (!m_argTypeHandle.IsNull() && m_argTypeHandle.IsHFA())
{
CorElementType type = m_argTypeHandle.GetHFAType();
bool isFloatType = (type == ELEMENT_TYPE_R4);
pLoc->m_cFloatReg = isFloatType ? GetArgSize()/sizeof(float): GetArgSize()/sizeof(double);
pLoc->m_isSinglePrecision = isFloatType;
}
else
{
pLoc->m_cFloatReg = 1;
}
return;
}
int cSlots = (GetArgSize() + 7)/ 8;
// Composites greater than 16bytes are passed by reference
if (GetArgType() == ELEMENT_TYPE_VALUETYPE && GetArgSize() > ENREGISTERED_PARAMTYPE_MAXSIZE)
{
cSlots = 1;
}
if (!TransitionBlock::IsStackArgumentOffset(argOffset))
{
pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
pLoc->m_cGenReg = cSlots;
}
else
{
pLoc->m_idxStack = TransitionBlock::GetStackArgumentIndexFromOffset(argOffset);
pLoc->m_cStack = cSlots;
}
}
#endif // _TARGET_ARM64_
#if defined(_TARGET_AMD64_) && defined(UNIX_AMD64_ABI)
// Get layout information for the argument that the ArgIterator is currently visiting.
void GetArgLoc(int argOffset, ArgLocDesc* pLoc)
{
LIMITED_METHOD_CONTRACT;
#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
if (m_hasArgLocDescForStructInRegs)
{
*pLoc = m_argLocDescForStructInRegs;
return;
}
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
if (argOffset == TransitionBlock::StructInRegsOffset)
{
// We always already have argLocDesc for structs passed in registers, we
// compute it in the GetNextOffset for those since it is always needed.
_ASSERTE(false);
return;
}
pLoc->Init();
if (TransitionBlock::IsFloatArgumentRegisterOffset(argOffset))
{
// Dividing by 16 as size of each register in FloatArgumentRegisters is 16 bytes.
pLoc->m_idxFloatReg = (argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters()) / 16;
pLoc->m_cFloatReg = 1;
}
else if (!TransitionBlock::IsStackArgumentOffset(argOffset))
{
pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
pLoc->m_cGenReg = 1;
}
else
{
pLoc->m_idxStack = TransitionBlock::GetStackArgumentIndexFromOffset(argOffset);
pLoc->m_cStack = (GetArgSize() + STACK_ELEM_SIZE - 1) / STACK_ELEM_SIZE;
}
}
#endif // _TARGET_AMD64_ && UNIX_AMD64_ABI
protected:
DWORD m_dwFlags; // Cached flags
int m_nSizeOfArgStack; // Cached value of SizeOfArgStack
DWORD m_argNum;
// Cached information about last argument
CorElementType m_argType;
int m_argSize;
TypeHandle m_argTypeHandle;
#if (defined(_TARGET_AMD64_) && defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)) || defined(_TARGET_ARM64_)
ArgLocDesc m_argLocDescForStructInRegs;
bool m_hasArgLocDescForStructInRegs;
#endif // _TARGET_AMD64_ && UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
#ifdef _TARGET_X86_
int m_curOfs; // Current position of the stack iterator
int m_numRegistersUsed;
#endif
#ifdef _TARGET_AMD64_
#ifdef UNIX_AMD64_ABI
int m_idxGenReg; // Next general register to be assigned a value
int m_idxStack; // Next stack slot to be assigned a value
int m_idxFPReg; // Next floating point register to be assigned a value
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
bool m_fArgInRegisters; // Indicates that the current argument is stored in registers
#endif
#else
int m_curOfs; // Current position of the stack iterator
#endif
#endif
#ifdef _TARGET_ARM_
int m_idxGenReg; // Next general register to be assigned a value
int m_idxStack; // Next stack slot to be assigned a value
WORD m_wFPRegs; // Bitmask of available floating point argument registers (s0-s15/d0-d7)
bool m_fRequires64BitAlignment; // Cached info about the current arg
#endif
#ifdef _TARGET_ARM64_
int m_idxGenReg; // Next general register to be assigned a value
int m_idxStack; // Next stack slot to be assigned a value
int m_idxFPReg; // Next FP register to be assigned a value
#endif
enum {
ITERATION_STARTED = 0x0001, // Started iterating over arguments
SIZE_OF_ARG_STACK_COMPUTED = 0x0002,
RETURN_FLAGS_COMPUTED = 0x0004,
RETURN_HAS_RET_BUFFER = 0x0008, // Cached value of HasRetBuffArg
#ifdef _TARGET_X86_
PARAM_TYPE_REGISTER_MASK = 0x0030,
PARAM_TYPE_REGISTER_STACK = 0x0010,
PARAM_TYPE_REGISTER_ECX = 0x0020,
PARAM_TYPE_REGISTER_EDX = 0x0030,
#endif
METHOD_INVOKE_NEEDS_ACTIVATION = 0x0040, // Flag used by ArgIteratorForMethodInvoke
RETURN_FP_SIZE_SHIFT = 8, // The rest of the flags is cached value of GetFPReturnSize
};
void ComputeReturnFlags();
#ifndef _TARGET_X86_
void GetSimpleLoc(int offset, ArgLocDesc * pLoc)
{
WRAPPER_NO_CONTRACT;
pLoc->Init();
pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(offset);
pLoc->m_cGenReg = 1;
}
#endif
};
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetThisOffset()
{
WRAPPER_NO_CONTRACT;
// This pointer is in the first argument register by default
int ret = TransitionBlock::GetOffsetOfArgumentRegisters();
#ifdef _TARGET_X86_
// x86 is special as always
ret += offsetof(ArgumentRegisters, ECX);
#endif
return ret;
}
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetRetBuffArgOffset()
{
WRAPPER_NO_CONTRACT;
_ASSERTE(this->HasRetBuffArg());
// RetBuf arg is in the second argument register by default
int ret = TransitionBlock::GetOffsetOfArgumentRegisters();
#if _TARGET_X86_
// x86 is special as always
ret += this->HasThis() ? offsetof(ArgumentRegisters, EDX) : offsetof(ArgumentRegisters, ECX);
#elif _TARGET_ARM64_
ret += (int) offsetof(ArgumentRegisters, x[8]);
#else
if (this->HasThis())
ret += sizeof(void *);
#endif
return ret;
}
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetVASigCookieOffset()
{
WRAPPER_NO_CONTRACT;
_ASSERTE(this->IsVarArg());
#if defined(_TARGET_X86_)
// x86 is special as always
return sizeof(TransitionBlock);
#else
// VaSig cookie is after this and retbuf arguments by default.
int ret = TransitionBlock::GetOffsetOfArgumentRegisters();
if (this->HasThis())
{
ret += sizeof(void*);
}
if (this->HasRetBuffArg() && IsRetBuffPassedAsFirstArg())
{
ret += sizeof(void*);
}
return ret;
#endif
}
//-----------------------------------------------------------
// Get the extra param offset for shared generic code
//-----------------------------------------------------------
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetParamTypeArgOffset()
{
CONTRACTL
{
INSTANCE_CHECK;
if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS;
if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS;
if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); }
MODE_ANY;
}
CONTRACTL_END
_ASSERTE(this->HasParamType());
#ifdef _TARGET_X86_
// x86 is special as always
if (!(m_dwFlags & SIZE_OF_ARG_STACK_COMPUTED))
ForceSigWalk();
switch (m_dwFlags & PARAM_TYPE_REGISTER_MASK)
{
case PARAM_TYPE_REGISTER_ECX:
return TransitionBlock::GetOffsetOfArgumentRegisters() + offsetof(ArgumentRegisters, ECX);
case PARAM_TYPE_REGISTER_EDX:
return TransitionBlock::GetOffsetOfArgumentRegisters() + offsetof(ArgumentRegisters, EDX);
default:
break;
}
// The param type arg is last stack argument otherwise
return sizeof(TransitionBlock);
#else
// The hidden arg is after this and retbuf arguments by default.
int ret = TransitionBlock::GetOffsetOfArgumentRegisters();
if (this->HasThis())
{
ret += sizeof(void*);
}
if (this->HasRetBuffArg() && IsRetBuffPassedAsFirstArg())
{
ret += sizeof(void*);
}
return ret;
#endif
}
// To avoid corner case bugs, limit maximum size of the arguments with sufficient margin
#define MAX_ARG_SIZE 0xFFFFFF
//------------------------------------------------------------
// Each time this is called, this returns a byte offset of the next
// argument from the Frame* pointer. This offset can be positive *or* negative.
//
// Returns TransitionBlock::InvalidOffset once you've hit the end of the list.
//------------------------------------------------------------
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
if (!(m_dwFlags & ITERATION_STARTED))
{
int numRegistersUsed = 0;
if (this->HasThis())
numRegistersUsed++;
if (this->HasRetBuffArg() && IsRetBuffPassedAsFirstArg())
numRegistersUsed++;
_ASSERTE(!this->IsVarArg() || !this->HasParamType());
#ifndef _TARGET_X86_
if (this->IsVarArg() || this->HasParamType())
{
numRegistersUsed++;
}
#endif
#ifdef _TARGET_X86_
if (this->IsVarArg())
{
numRegistersUsed = NUM_ARGUMENT_REGISTERS; // Nothing else gets passed in registers for varargs
}
#ifdef FEATURE_INTERPRETER
BYTE callconv = CallConv();
switch (callconv)
{
case IMAGE_CEE_CS_CALLCONV_C:
case IMAGE_CEE_CS_CALLCONV_STDCALL:
m_numRegistersUsed = NUM_ARGUMENT_REGISTERS;
m_curOfs = TransitionBlock::GetOffsetOfArgs() + numRegistersUsed * sizeof(void *);
m_fUnmanagedCallConv = true;
break;
case IMAGE_CEE_CS_CALLCONV_THISCALL:
case IMAGE_CEE_CS_CALLCONV_FASTCALL:
_ASSERTE_MSG(false, "Unsupported calling convention.");
default:
m_fUnmanagedCallConv = false;
m_numRegistersUsed = numRegistersUsed;
m_curOfs = TransitionBlock::GetOffsetOfArgs() + SizeOfArgStack();
}
#else
m_numRegistersUsed = numRegistersUsed;
m_curOfs = TransitionBlock::GetOffsetOfArgs() + SizeOfArgStack();
#endif
#elif defined(_TARGET_AMD64_)
#ifdef UNIX_AMD64_ABI
m_idxGenReg = numRegistersUsed;
m_idxStack = 0;
m_idxFPReg = 0;
#else
m_curOfs = TransitionBlock::GetOffsetOfArgs() + numRegistersUsed * sizeof(void *);
#endif
#elif defined(_TARGET_ARM_)
m_idxGenReg = numRegistersUsed;
m_idxStack = 0;
m_wFPRegs = 0;
#elif defined(_TARGET_ARM64_)
m_idxGenReg = numRegistersUsed;
m_idxStack = 0;
m_idxFPReg = 0;
#else
PORTABILITY_ASSERT("ArgIteratorTemplate::GetNextOffset");
#endif
m_argNum = 0;
m_dwFlags |= ITERATION_STARTED;
}
if (m_argNum == this->NumFixedArgs())
return TransitionBlock::InvalidOffset;
TypeHandle thValueType;
CorElementType argType = this->GetNextArgumentType(m_argNum++, &thValueType);
int argSize = MetaSig::GetElemSize(argType, thValueType);
m_argType = argType;
m_argSize = argSize;
m_argTypeHandle = thValueType;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
m_hasArgLocDescForStructInRegs = false;
#endif
#ifdef _TARGET_X86_
#ifdef FEATURE_INTERPRETER
if (m_fUnmanagedCallConv)
{
int argOfs = m_curOfs;
m_curOfs += StackElemSize(argSize);
return argOfs;
}
#endif
if (IsArgumentInRegister(&m_numRegistersUsed, argType))
{
return TransitionBlock::GetOffsetOfArgumentRegisters() + (NUM_ARGUMENT_REGISTERS - m_numRegistersUsed) * sizeof(void *);
}
m_curOfs -= StackElemSize(argSize);
_ASSERTE(m_curOfs >= TransitionBlock::GetOffsetOfArgs());
return m_curOfs;
#elif defined(_TARGET_AMD64_)
#ifdef UNIX_AMD64_ABI
m_fArgInRegisters = true;
int cFPRegs = 0;
int cGenRegs = 0;
int cbArg = StackElemSize(argSize);
switch (argType)
{
case ELEMENT_TYPE_R4:
// 32-bit floating point argument.
cFPRegs = 1;
break;
case ELEMENT_TYPE_R8:
// 64-bit floating point argument.
cFPRegs = 1;
break;
case ELEMENT_TYPE_VALUETYPE:
{
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
MethodTable *pMT = m_argTypeHandle.AsMethodTable();
if (pMT->IsRegPassedStruct())
{
EEClass* eeClass = pMT->GetClass();
cGenRegs = 0;
for (int i = 0; i < eeClass->GetNumberEightBytes(); i++)
{
switch (eeClass->GetEightByteClassification(i))
{
case SystemVClassificationTypeInteger:
case SystemVClassificationTypeIntegerReference:
case SystemVClassificationTypeIntegerByRef:
cGenRegs++;
break;
case SystemVClassificationTypeSSE:
cFPRegs++;
break;
default:
_ASSERTE(false);
break;
}
}
// Check if we have enough registers available for the struct passing
if ((cFPRegs + m_idxFPReg <= NUM_FLOAT_ARGUMENT_REGISTERS) && (cGenRegs + m_idxGenReg) <= NUM_ARGUMENT_REGISTERS)
{
m_argLocDescForStructInRegs.Init();
m_argLocDescForStructInRegs.m_cGenReg = cGenRegs;
m_argLocDescForStructInRegs.m_cFloatReg = cFPRegs;
m_argLocDescForStructInRegs.m_idxGenReg = m_idxGenReg;
m_argLocDescForStructInRegs.m_idxFloatReg = m_idxFPReg;
m_argLocDescForStructInRegs.m_eeClass = eeClass;
m_hasArgLocDescForStructInRegs = true;
m_idxGenReg += cGenRegs;
m_idxFPReg += cFPRegs;
return TransitionBlock::StructInRegsOffset;
}
}
// Set the register counts to indicate that this argument will not be passed in registers
cFPRegs = 0;
cGenRegs = 0;
#else // FEATURE_UNIX_AMD64_STRUCT_PASSING
argSize = sizeof(TADDR);
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
break;
}
default:
cGenRegs = cbArg / 8; // GP reg size
break;
}
if ((cFPRegs > 0) && (cFPRegs + m_idxFPReg <= NUM_FLOAT_ARGUMENT_REGISTERS))
{
int argOfs = TransitionBlock::GetOffsetOfFloatArgumentRegisters() + m_idxFPReg * 16;
m_idxFPReg += cFPRegs;
return argOfs;
}
else if ((cGenRegs > 0) && (m_idxGenReg + cGenRegs <= NUM_ARGUMENT_REGISTERS))
{
int argOfs = TransitionBlock::GetOffsetOfArgumentRegisters() + m_idxGenReg * 8;
m_idxGenReg += cGenRegs;
return argOfs;
}
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
m_fArgInRegisters = false;
#endif
int argOfs = TransitionBlock::GetOffsetOfArgs() + m_idxStack * STACK_ELEM_SIZE;
int cArgSlots = cbArg / STACK_ELEM_SIZE;
m_idxStack += cArgSlots;
return argOfs;
#else
// Each argument takes exactly one slot on AMD64 on Windows
int argOfs = m_curOfs;
m_curOfs += sizeof(void *);
return argOfs;
#endif
#elif defined(_TARGET_ARM_)
// First look at the underlying type of the argument to determine some basic properties:
// 1) The size of the argument in bytes (rounded up to the stack slot size of 4 if necessary).
// 2) Whether the argument represents a floating point primitive (ELEMENT_TYPE_R4 or ELEMENT_TYPE_R8).
// 3) Whether the argument requires 64-bit alignment (anything that contains a Int64/UInt64).
bool fFloatingPoint = false;
bool fRequiresAlign64Bit = false;
switch (argType)
{
case ELEMENT_TYPE_I8:
case ELEMENT_TYPE_U8:
// 64-bit integers require 64-bit alignment on ARM.
fRequiresAlign64Bit = true;
break;
case ELEMENT_TYPE_R4:
// 32-bit floating point argument.
fFloatingPoint = true;
break;
case ELEMENT_TYPE_R8:
// 64-bit floating point argument.
fFloatingPoint = true;
fRequiresAlign64Bit = true;
break;
case ELEMENT_TYPE_VALUETYPE:
{
// Value type case: extract the alignment requirement, note that this has to handle
// the interop "native value types".
fRequiresAlign64Bit = thValueType.RequiresAlign8();
#ifdef FEATURE_HFA
// Handle HFAs: packed structures of 1-4 floats or doubles that are passed in FP argument
// registers if possible.
if (thValueType.IsHFA())
{
fFloatingPoint = true;
}
#endif
break;
}
default:
// The default is are 4-byte arguments (or promoted to 4 bytes), non-FP and don't require any
// 64-bit alignment.
break;
}
// Now attempt to place the argument into some combination of floating point or general registers and
// the stack.
// Save the alignment requirement
m_fRequires64BitAlignment = fRequiresAlign64Bit;
int cbArg = StackElemSize(argSize);
int cArgSlots = cbArg / 4;
// Ignore floating point argument placement in registers if we're dealing with a vararg function (the ABI
// specifies this so that vararg processing on the callee side is simplified).
#ifndef ARM_SOFTFP
if (fFloatingPoint && !this->IsVarArg())
{
// Handle floating point (primitive) arguments.
// First determine whether we can place the argument in VFP registers. There are 16 32-bit
// and 8 64-bit argument registers that share the same register space (e.g. D0 overlaps S0 and
// S1). The ABI specifies that VFP values will be passed in the lowest sequence of registers that
// haven't been used yet and have the required alignment. So the sequence (float, double, float)
// would be mapped to (S0, D1, S1) or (S0, S2/S3, S1).
//
// We use a 16-bit bitmap to record which registers have been used so far.
//
// So we can use the same basic loop for each argument type (float, double or HFA struct) we set up
// the following input parameters based on the size and alignment requirements of the arguments:
// wAllocMask : bitmask of the number of 32-bit registers we need (1 for 1, 3 for 2, 7 for 3 etc.)
// cSteps : number of loop iterations it'll take to search the 16 registers
// cShift : how many bits to shift the allocation mask on each attempt
WORD wAllocMask = (1 << (cbArg / 4)) - 1;
WORD cSteps = (WORD)(fRequiresAlign64Bit ? 9 - (cbArg / 8) : 17 - (cbArg / 4));
WORD cShift = fRequiresAlign64Bit ? 2 : 1;
// Look through the availability bitmask for a free register or register pair.
for (WORD i = 0; i < cSteps; i++)
{
if ((m_wFPRegs & wAllocMask) == 0)
{
// We found one, mark the register or registers as used.
m_wFPRegs |= wAllocMask;
// Indicate the registers used to the caller and return.
return TransitionBlock::GetOffsetOfFloatArgumentRegisters() + (i * cShift * 4);
}
wAllocMask <<= cShift;
}
// The FP argument is going to live on the stack. Once this happens the ABI demands we mark all FP
// registers as unavailable.
m_wFPRegs = 0xffff;
// Doubles or HFAs containing doubles need the stack aligned appropriately.
if (fRequiresAlign64Bit)
m_idxStack = ALIGN_UP(m_idxStack, 2);
// Indicate the stack location of the argument to the caller.
int argOfs = TransitionBlock::GetOffsetOfArgs() + m_idxStack * 4;
// Record the stack usage.
m_idxStack += cArgSlots;
return argOfs;
}
#endif // ARM_SOFTFP
//
// Handle the non-floating point case.
//
if (m_idxGenReg < 4)
{
if (fRequiresAlign64Bit)
{
// The argument requires 64-bit alignment. Align either the next general argument register if
// we have any left. See step C.3 in the algorithm in the ABI spec.
m_idxGenReg = ALIGN_UP(m_idxGenReg, 2);
}
int argOfs = TransitionBlock::GetOffsetOfArgumentRegisters() + m_idxGenReg * 4;
int cRemainingRegs = 4 - m_idxGenReg;
if (cArgSlots <= cRemainingRegs)
{
// Mark the registers just allocated as used.
m_idxGenReg += cArgSlots;
return argOfs;
}
// The ABI supports splitting a non-FP argument across registers and the stack. But this is
// disabled if the FP arguments already overflowed onto the stack (i.e. the stack index is not
// zero). The following code marks the general argument registers as exhausted if this condition
// holds. See steps C.5 in the algorithm in the ABI spec.
m_idxGenReg = 4;
if (m_idxStack == 0)
{
m_idxStack += cArgSlots - cRemainingRegs;
return argOfs;
}
}
if (fRequiresAlign64Bit)
{
// The argument requires 64-bit alignment. If it is going to be passed on the stack, align
// the next stack slot. See step C.6 in the algorithm in the ABI spec.
m_idxStack = ALIGN_UP(m_idxStack, 2);
}
int argOfs = TransitionBlock::GetOffsetOfArgs() + m_idxStack * 4;
// Advance the stack pointer over the argument just placed.
m_idxStack += cArgSlots;
return argOfs;
#elif defined(_TARGET_ARM64_)
int cFPRegs = 0;
switch (argType)
{
case ELEMENT_TYPE_R4:
// 32-bit floating point argument.
cFPRegs = 1;
break;
case ELEMENT_TYPE_R8:
// 64-bit floating point argument.
cFPRegs = 1;
break;
case ELEMENT_TYPE_VALUETYPE:
{
// Handle HFAs: packed structures of 2-4 floats or doubles that are passed in FP argument
// registers if possible.
if (thValueType.IsHFA())
{
CorElementType type = thValueType.GetHFAType();
bool isFloatType = (type == ELEMENT_TYPE_R4);
cFPRegs = (type == ELEMENT_TYPE_R4)? (argSize/sizeof(float)): (argSize/sizeof(double));
m_argLocDescForStructInRegs.Init();
m_argLocDescForStructInRegs.m_cFloatReg = cFPRegs;
m_argLocDescForStructInRegs.m_idxFloatReg = m_idxFPReg;
m_argLocDescForStructInRegs.m_isSinglePrecision = isFloatType;
m_hasArgLocDescForStructInRegs = true;
}
else
{
// Composite greater than 16bytes should be passed by reference
if (argSize > ENREGISTERED_PARAMTYPE_MAXSIZE)
{
argSize = sizeof(TADDR);
}
}
break;
}
default:
break;
}
int cbArg = StackElemSize(argSize);
int cArgSlots = cbArg / STACK_ELEM_SIZE;
if (cFPRegs>0 && !this->IsVarArg())
{
if (cFPRegs + m_idxFPReg <= 8)
{
int argOfs = TransitionBlock::GetOffsetOfFloatArgumentRegisters() + m_idxFPReg * 8;
m_idxFPReg += cFPRegs;
return argOfs;
}
else
{
m_idxFPReg = 8;
}
}
else
{
if (m_idxGenReg + cArgSlots <= 8)
{
int argOfs = TransitionBlock::GetOffsetOfArgumentRegisters() + m_idxGenReg * 8;
m_idxGenReg += cArgSlots;
return argOfs;
}
else
{
m_idxGenReg = 8;
}
}
int argOfs = TransitionBlock::GetOffsetOfArgs() + m_idxStack * 8;
m_idxStack += cArgSlots;
return argOfs;
#else
PORTABILITY_ASSERT("ArgIteratorTemplate::GetNextOffset");
return TransitionBlock::InvalidOffset;
#endif
}
template<class ARGITERATOR_BASE>
void ArgIteratorTemplate<ARGITERATOR_BASE>::ComputeReturnFlags()
{
CONTRACTL
{
INSTANCE_CHECK;
if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS;
if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS;
if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); }
MODE_ANY;
}
CONTRACTL_END
TypeHandle thValueType;
CorElementType type = this->GetReturnType(&thValueType);
DWORD flags = RETURN_FLAGS_COMPUTED;
switch (type)
{
case ELEMENT_TYPE_TYPEDBYREF:
#ifdef ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE
if (sizeof(TypedByRef) > ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE)
flags |= RETURN_HAS_RET_BUFFER;
#else
flags |= RETURN_HAS_RET_BUFFER;
#endif
break;
case ELEMENT_TYPE_R4:
#ifndef ARM_SOFTFP
flags |= sizeof(float) << RETURN_FP_SIZE_SHIFT;
#endif
break;
case ELEMENT_TYPE_R8:
#ifndef ARM_SOFTFP
flags |= sizeof(double) << RETURN_FP_SIZE_SHIFT;
#endif
break;
case ELEMENT_TYPE_VALUETYPE:
#ifdef ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE
{
_ASSERTE(!thValueType.IsNull());
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
MethodTable *pMT = thValueType.AsMethodTable();
if (pMT->IsRegPassedStruct())
{
EEClass* eeClass = pMT->GetClass();
if (eeClass->GetNumberEightBytes() == 1)
{
// Structs occupying just one eightbyte are treated as int / double
if (eeClass->GetEightByteClassification(0) == SystemVClassificationTypeSSE)
{
flags |= sizeof(double) << RETURN_FP_SIZE_SHIFT;
}
}
else
{
// Size of the struct is 16 bytes
flags |= (16 << RETURN_FP_SIZE_SHIFT);
// The lowest two bits of the size encode the order of the int and SSE fields
if (eeClass->GetEightByteClassification(0) == SystemVClassificationTypeSSE)
{
flags |= (1 << RETURN_FP_SIZE_SHIFT);
}
if (eeClass->GetEightByteClassification(1) == SystemVClassificationTypeSSE)
{
flags |= (2 << RETURN_FP_SIZE_SHIFT);
}
}
break;
}
#else // UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
#ifdef FEATURE_HFA
if (thValueType.IsHFA() && !this->IsVarArg())
{
CorElementType hfaType = thValueType.GetHFAType();
flags |= (hfaType == ELEMENT_TYPE_R4) ?
((4 * sizeof(float)) << RETURN_FP_SIZE_SHIFT) :
((4 * sizeof(double)) << RETURN_FP_SIZE_SHIFT);
break;
}
#endif
size_t size = thValueType.GetSize();
#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_)
// Return value types of size which are not powers of 2 using a RetBuffArg
if ((size & (size-1)) != 0)
{
flags |= RETURN_HAS_RET_BUFFER;
break;
}
#endif
if (size <= ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE)
break;
#endif // UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
}
#endif // ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE
// Value types are returned using return buffer by default
flags |= RETURN_HAS_RET_BUFFER;
break;
default:
break;
}
m_dwFlags |= flags;
}
template<class ARGITERATOR_BASE>
void ArgIteratorTemplate<ARGITERATOR_BASE>::ForceSigWalk()
{
CONTRACTL
{
INSTANCE_CHECK;
if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS;
if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS;
if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); }
MODE_ANY;
}
CONTRACTL_END
// This can be only used before the actual argument iteration started
_ASSERTE((m_dwFlags & ITERATION_STARTED) == 0);
#ifdef _TARGET_X86_
//
// x86 is special as always
//
int numRegistersUsed = 0;
int nSizeOfArgStack = 0;
if (this->HasThis())
numRegistersUsed++;
if (this->HasRetBuffArg() && IsRetBuffPassedAsFirstArg())
numRegistersUsed++;
if (this->IsVarArg())
{
nSizeOfArgStack += sizeof(void *);
numRegistersUsed = NUM_ARGUMENT_REGISTERS; // Nothing else gets passed in registers for varargs
}
#ifdef FEATURE_INTERPRETER
BYTE callconv = CallConv();
switch (callconv)
{
case IMAGE_CEE_CS_CALLCONV_C:
case IMAGE_CEE_CS_CALLCONV_STDCALL:
numRegistersUsed = NUM_ARGUMENT_REGISTERS;
nSizeOfArgStack = TransitionBlock::GetOffsetOfArgs() + numRegistersUsed * sizeof(void *);
break;
case IMAGE_CEE_CS_CALLCONV_THISCALL:
case IMAGE_CEE_CS_CALLCONV_FASTCALL:
_ASSERTE_MSG(false, "Unsupported calling convention.");
default:
}
#endif // FEATURE_INTERPRETER
DWORD nArgs = this->NumFixedArgs();
for (DWORD i = 0; i < nArgs; i++)
{
TypeHandle thValueType;
CorElementType type = this->GetNextArgumentType(i, &thValueType);
if (!IsArgumentInRegister(&numRegistersUsed, type))
{
int structSize = MetaSig::GetElemSize(type, thValueType);
nSizeOfArgStack += StackElemSize(structSize);
#ifndef DACCESS_COMPILE
if (nSizeOfArgStack > MAX_ARG_SIZE)
{
#ifdef _DEBUG
// We should not ever throw exception in the "FORBIDGC_LOADER_USE_ENABLED" mode.
// The contract violation is required to workaround bug in the static contract analyzer.
_ASSERTE(!FORBIDGC_LOADER_USE_ENABLED());
CONTRACT_VIOLATION(ThrowsViolation);
#endif
COMPlusThrow(kNotSupportedException);
}
#endif
}
}
if (this->HasParamType())
{
DWORD paramTypeFlags = 0;
if (numRegistersUsed < NUM_ARGUMENT_REGISTERS)
{
numRegistersUsed++;
paramTypeFlags = (numRegistersUsed == 1) ?
PARAM_TYPE_REGISTER_ECX : PARAM_TYPE_REGISTER_EDX;
}
else
{
nSizeOfArgStack += sizeof(void *);
paramTypeFlags = PARAM_TYPE_REGISTER_STACK;
}
m_dwFlags |= paramTypeFlags;
}
#else // _TARGET_X86_
int maxOffset = TransitionBlock::GetOffsetOfArgs();
int ofs;
while (TransitionBlock::InvalidOffset != (ofs = GetNextOffset()))
{
int stackElemSize;
#ifdef _TARGET_AMD64_
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
if (m_fArgInRegisters)
{
// Arguments passed in registers don't consume any stack
continue;
}
stackElemSize = StackElemSize(GetArgSize());
#else // FEATURE_UNIX_AMD64_STRUCT_PASSING
// All stack arguments take just one stack slot on AMD64 because of arguments bigger
// than a stack slot are passed by reference.
stackElemSize = STACK_ELEM_SIZE;
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
#else // _TARGET_AMD64_
stackElemSize = StackElemSize(GetArgSize());
#if defined(ENREGISTERED_PARAMTYPE_MAXSIZE)
if (IsArgPassedByRef())
stackElemSize = STACK_ELEM_SIZE;
#endif
#endif // _TARGET_AMD64_
int endOfs = ofs + stackElemSize;
if (endOfs > maxOffset)
{
#if !defined(DACCESS_COMPILE)
if (endOfs > MAX_ARG_SIZE)
{
#ifdef _DEBUG
// We should not ever throw exception in the "FORBIDGC_LOADER_USE_ENABLED" mode.
// The contract violation is required to workaround bug in the static contract analyzer.
_ASSERTE(!FORBIDGC_LOADER_USE_ENABLED());
CONTRACT_VIOLATION(ThrowsViolation);
#endif
COMPlusThrow(kNotSupportedException);
}
#endif
maxOffset = endOfs;
}
}
// Clear the iterator started flag
m_dwFlags &= ~ITERATION_STARTED;
int nSizeOfArgStack = maxOffset - TransitionBlock::GetOffsetOfArgs();
#if defined(_TARGET_AMD64_) && !defined(UNIX_AMD64_ABI)
nSizeOfArgStack = (nSizeOfArgStack > (int)sizeof(ArgumentRegisters)) ?
(nSizeOfArgStack - sizeof(ArgumentRegisters)) : 0;
#endif
#endif // _TARGET_X86_
// Cache the result
m_nSizeOfArgStack = nSizeOfArgStack;
m_dwFlags |= SIZE_OF_ARG_STACK_COMPUTED;
this->Reset();
}
class ArgIteratorBase
{
protected:
MetaSig * m_pSig;
FORCEINLINE CorElementType GetReturnType(TypeHandle * pthValueType)
{
WRAPPER_NO_CONTRACT;
#ifdef ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE
return m_pSig->GetReturnTypeNormalized(pthValueType);
#else
return m_pSig->GetReturnTypeNormalized();
#endif
}
FORCEINLINE CorElementType GetNextArgumentType(DWORD iArg, TypeHandle * pthValueType)
{
WRAPPER_NO_CONTRACT;
_ASSERTE(iArg == m_pSig->GetArgNum());
CorElementType et = m_pSig->PeekArgNormalized(pthValueType);
m_pSig->SkipArg();
return et;
}
FORCEINLINE void Reset()
{
WRAPPER_NO_CONTRACT;
m_pSig->Reset();
}
public:
BOOL HasThis()
{
LIMITED_METHOD_CONTRACT;
return m_pSig->HasThis();
}
BOOL HasParamType()
{
LIMITED_METHOD_CONTRACT;
return m_pSig->GetCallingConventionInfo() & CORINFO_CALLCONV_PARAMTYPE;
}
BOOL IsVarArg()
{
LIMITED_METHOD_CONTRACT;
return m_pSig->IsVarArg() || m_pSig->IsTreatAsVarArg();
}
DWORD NumFixedArgs()
{
LIMITED_METHOD_CONTRACT;
return m_pSig->NumFixedArgs();
}
#ifdef FEATURE_INTERPRETER
BYTE CallConv()
{
return m_pSig->GetCallingConvention();
}
#endif // FEATURE_INTERPRETER
//
// The following is used by the profiler to dig into the iterator for
// discovering if the method has a This pointer or a return buffer.
// Do not use this to re-initialize the signature, use the exposed Init()
// method in this class.
//
MetaSig *GetSig(void)
{
return m_pSig;
}
};
class ArgIterator : public ArgIteratorTemplate<ArgIteratorBase>
{
public:
ArgIterator(MetaSig * pSig)
{
m_pSig = pSig;
}
// This API returns true if we are returning a structure in registers instead of using a byref return buffer
BOOL HasNonStandardByvalReturn()
{
WRAPPER_NO_CONTRACT;
#ifdef ENREGISTERED_RETURNTYPE_MAXSIZE
CorElementType type = m_pSig->GetReturnTypeNormalized();
return (type == ELEMENT_TYPE_VALUETYPE || type == ELEMENT_TYPE_TYPEDBYREF) && !HasRetBuffArg();
#else
return FALSE;
#endif
}
};
// Conventience helper
inline BOOL HasRetBuffArg(MetaSig * pSig)
{
WRAPPER_NO_CONTRACT;
ArgIterator argit(pSig);
return argit.HasRetBuffArg();
}
#ifdef UNIX_X86_ABI
// For UNIX_X86_ABI and unmanaged function, we always need RetBuf if the return type is VALUETYPE
inline BOOL HasRetBuffArgUnmanagedFixup(MetaSig * pSig)
{
WRAPPER_NO_CONTRACT;
// We cannot just pSig->GetReturnType() here since it will return ELEMENT_TYPE_VALUETYPE for enums
CorElementType type = pSig->GetRetTypeHandleThrowing().GetVerifierCorElementType();
return type == ELEMENT_TYPE_VALUETYPE;
}
#endif
inline BOOL IsRetBuffPassedAsFirstArg()
{
WRAPPER_NO_CONTRACT;
#ifndef _TARGET_ARM64_
return TRUE;
#else
return FALSE;
#endif
}
#endif // __CALLING_CONVENTION_INCLUDED
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
//
// Provides an abstraction over platform specific calling conventions (specifically, the calling convention
// utilized by the JIT on that platform). The caller enumerates each argument of a signature in turn, and is
// provided with information mapping that argument into registers and/or stack locations.
//
#ifndef __CALLING_CONVENTION_INCLUDED
#define __CALLING_CONVENTION_INCLUDED
BOOL IsRetBuffPassedAsFirstArg();
// Describes how a single argument is laid out in registers and/or stack locations when given as an input to a
// managed method as part of a larger signature.
//
// Locations are split into floating point registers, general registers and stack offsets. Registers are
// obviously architecture dependent but are represented as a zero-based index into the usual sequence in which
// such registers are allocated for input on the platform in question. For instance:
// X86: 0 == ecx, 1 == edx
// ARM: 0 == r0, 1 == r1, 2 == r2 etc.
//
// Stack locations are represented as offsets from the stack pointer (at the point of the call). The offset is
// given as an index of a pointer sized slot. Similarly the size of data on the stack is given in slot-sized
// units. For instance, given an index of 2 and a size of 3:
// X86: argument starts at [ESP + 8] and is 12 bytes long
// AMD64: argument starts at [RSP + 16] and is 24 bytes long
//
// The structure is flexible enough to describe an argument that is split over several (consecutive) registers
// and possibly on to the stack as well.
struct ArgLocDesc
{
int m_idxFloatReg; // First floating point register used (or -1)
int m_cFloatReg; // Count of floating point registers used (or 0)
int m_idxGenReg; // First general register used (or -1)
int m_cGenReg; // Count of general registers used (or 0)
int m_idxStack; // First stack slot used (or -1)
int m_cStack; // Count of stack slots used (or 0)
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
EEClass* m_eeClass; // For structs passed in register, it points to the EEClass of the struct
#endif // UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
#if defined(_TARGET_ARM64_)
bool m_isSinglePrecision; // For determining if HFA is single or double
// precision
#endif // defined(_TARGET_ARM64_)
#if defined(_TARGET_ARM_)
BOOL m_fRequires64BitAlignment; // True if the argument should always be aligned (in registers or on the stack
#endif
ArgLocDesc()
{
Init();
}
// Initialize to represent a non-placed argument (no register or stack slots referenced).
void Init()
{
m_idxFloatReg = -1;
m_cFloatReg = 0;
m_idxGenReg = -1;
m_cGenReg = 0;
m_idxStack = -1;
m_cStack = 0;
#if defined(_TARGET_ARM_)
m_fRequires64BitAlignment = FALSE;
#endif
#if defined(_TARGET_ARM64_)
m_isSinglePrecision = FALSE;
#endif // defined(_TARGET_ARM64_)
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
m_eeClass = NULL;
#endif
}
};
//
// TransitionBlock is layout of stack frame of method call, saved argument registers and saved callee saved registers. Even though not
// all fields are used all the time, we use uniform form for simplicity.
//
struct TransitionBlock
{
#if defined(_TARGET_X86_)
ArgumentRegisters m_argumentRegisters;
CalleeSavedRegisters m_calleeSavedRegisters;
TADDR m_ReturnAddress;
#elif defined(_TARGET_AMD64_)
#ifdef UNIX_AMD64_ABI
ArgumentRegisters m_argumentRegisters;
#endif
CalleeSavedRegisters m_calleeSavedRegisters;
TADDR m_ReturnAddress;
#elif defined(_TARGET_ARM_)
union {
CalleeSavedRegisters m_calleeSavedRegisters;
// alias saved link register as m_ReturnAddress
struct {
INT32 r4, r5, r6, r7, r8, r9, r10;
INT32 r11;
TADDR m_ReturnAddress;
};
};
ArgumentRegisters m_argumentRegisters;
#elif defined(_TARGET_ARM64_)
union {
CalleeSavedRegisters m_calleeSavedRegisters;
struct {
INT64 x29; // frame pointer
TADDR m_ReturnAddress;
INT64 x19, x20, x21, x22, x23, x24, x25, x26, x27, x28;
};
};
ArgumentRegisters m_argumentRegisters;
TADDR padding; // Keep size of TransitionBlock as multiple of 16-byte. Simplifies code in PROLOG_WITH_TRANSITION_BLOCK
#else
PORTABILITY_ASSERT("TransitionBlock");
#endif
// The transition block should define everything pushed by callee. The code assumes in number of places that
// end of the transition block is caller's stack pointer.
static int GetOffsetOfReturnAddress()
{
LIMITED_METHOD_CONTRACT;
return offsetof(TransitionBlock, m_ReturnAddress);
}
static BYTE GetOffsetOfArgs()
{
LIMITED_METHOD_CONTRACT;
return sizeof(TransitionBlock);
}
static int GetOffsetOfArgumentRegisters()
{
LIMITED_METHOD_CONTRACT;
int offs;
#if defined(_TARGET_AMD64_) && !defined(UNIX_AMD64_ABI)
offs = sizeof(TransitionBlock);
#else
offs = offsetof(TransitionBlock, m_argumentRegisters);
#endif
return offs;
}
static BOOL IsStackArgumentOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
return offset >= sizeof(TransitionBlock);
#else
int ofsArgRegs = GetOffsetOfArgumentRegisters();
return offset >= (int) (ofsArgRegs + ARGUMENTREGISTERS_SIZE);
#endif
}
static BOOL IsArgumentRegisterOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
int ofsArgRegs = GetOffsetOfArgumentRegisters();
return offset >= ofsArgRegs && offset < (int) (ofsArgRegs + ARGUMENTREGISTERS_SIZE);
}
#ifndef _TARGET_X86_
static UINT GetArgumentIndexFromOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
_ASSERTE(offset != TransitionBlock::StructInRegsOffset);
#endif
return (offset - GetOffsetOfArgumentRegisters()) / sizeof(TADDR);
}
static UINT GetStackArgumentIndexFromOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
return (offset - TransitionBlock::GetOffsetOfArgs()) / STACK_ELEM_SIZE;
}
#endif
#ifdef CALLDESCR_FPARGREGS
static BOOL IsFloatArgumentRegisterOffset(int offset)
{
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
return (offset != TransitionBlock::StructInRegsOffset) && (offset < 0);
#else
return offset < 0;
#endif
}
// Check if an argument has floating point register, that means that it is
// either a floating point argument or a struct passed in registers that
// has a floating point member.
static BOOL HasFloatRegister(int offset, ArgLocDesc* argLocDescForStructInRegs)
{
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
if (offset == TransitionBlock::StructInRegsOffset)
{
return argLocDescForStructInRegs->m_cFloatReg > 0;
}
#endif
return offset < 0;
}
static int GetOffsetOfFloatArgumentRegisters()
{
LIMITED_METHOD_CONTRACT;
return -GetNegSpaceSize();
}
#endif // CALLDESCR_FPARGREGS
static int GetOffsetOfCalleeSavedRegisters()
{
LIMITED_METHOD_CONTRACT;
return offsetof(TransitionBlock, m_calleeSavedRegisters);
}
static int GetNegSpaceSize()
{
LIMITED_METHOD_CONTRACT;
int negSpaceSize = 0;
#ifdef CALLDESCR_FPARGREGS
negSpaceSize += sizeof(FloatArgumentRegisters);
#endif
#ifdef _TARGET_ARM_
negSpaceSize += sizeof(TADDR); // padding to make FloatArgumentRegisters address 8-byte aligned
#endif
return negSpaceSize;
}
static const int InvalidOffset = -1;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
// Special offset value to represent struct passed in registers. Such a struct can span both
// general purpose and floating point registers, so it can have two different offsets.
static const int StructInRegsOffset = -2;
#endif
};
//-----------------------------------------------------------------------
// ArgIterator is helper for dealing with calling conventions.
// It is tightly coupled with TransitionBlock. It uses offsets into
// TransitionBlock to represent argument locations for efficiency
// reasons. Alternatively, it can also return ArgLocDesc for less
// performance critical code.
//
// The ARGITERATOR_BASE argument of the template is provider of the parsed
// method signature. Typically, the arg iterator works on top of MetaSig.
// Reflection invoke uses alternative implementation to save signature parsing
// time because of it has the parsed signature available.
//-----------------------------------------------------------------------
template<class ARGITERATOR_BASE>
class ArgIteratorTemplate : public ARGITERATOR_BASE
{
public:
//------------------------------------------------------------
// Constructor
//------------------------------------------------------------
ArgIteratorTemplate()
{
WRAPPER_NO_CONTRACT;
m_dwFlags = 0;
}
UINT SizeOfArgStack()
{
WRAPPER_NO_CONTRACT;
if (!(m_dwFlags & SIZE_OF_ARG_STACK_COMPUTED))
ForceSigWalk();
_ASSERTE((m_dwFlags & SIZE_OF_ARG_STACK_COMPUTED) != 0);
return m_nSizeOfArgStack;
}
// For use with ArgIterator. This function computes the amount of additional
// memory required above the TransitionBlock. The parameter offsets
// returned by ArgIteratorTemplate::GetNextOffset are relative to a
// FramedMethodFrame, and may be in either of these regions.
UINT SizeOfFrameArgumentArray()
{
WRAPPER_NO_CONTRACT;
UINT size = SizeOfArgStack();
#if defined(_TARGET_AMD64_) && !defined(UNIX_AMD64_ABI)
// The argument registers are not included in the stack size on AMD64
size += ARGUMENTREGISTERS_SIZE;
#endif
return size;
}
//------------------------------------------------------------------------
#ifdef _TARGET_X86_
UINT CbStackPop()
{
WRAPPER_NO_CONTRACT;
if (this->IsVarArg())
return 0;
else
return SizeOfArgStack();
}
#endif
// Is there a hidden parameter for the return parameter?
//
BOOL HasRetBuffArg()
{
WRAPPER_NO_CONTRACT;
if (!(m_dwFlags & RETURN_FLAGS_COMPUTED))
ComputeReturnFlags();
return (m_dwFlags & RETURN_HAS_RET_BUFFER);
}
UINT GetFPReturnSize()
{
WRAPPER_NO_CONTRACT;
if (!(m_dwFlags & RETURN_FLAGS_COMPUTED))
ComputeReturnFlags();
return m_dwFlags >> RETURN_FP_SIZE_SHIFT;
}
#ifdef _TARGET_X86_
//=========================================================================
// Indicates whether an argument is to be put in a register using the
// default IL calling convention. This should be called on each parameter
// in the order it appears in the call signature. For a non-static method,
// this function should also be called once for the "this" argument, prior
// to calling it for the "real" arguments. Pass in a typ of ELEMENT_TYPE_CLASS.
//
// *pNumRegistersUsed: [in,out]: keeps track of the number of argument
// registers assigned previously. The caller should
// initialize this variable to 0 - then each call
// will update it.
//
// typ: the signature type
//=========================================================================
static BOOL IsArgumentInRegister(int * pNumRegistersUsed, CorElementType typ)
{
LIMITED_METHOD_CONTRACT;
if ( (*pNumRegistersUsed) < NUM_ARGUMENT_REGISTERS) {
if (gElementTypeInfo[typ].m_enregister) {
(*pNumRegistersUsed)++;
return(TRUE);
}
}
return(FALSE);
}
#endif // _TARGET_X86_
#if defined(ENREGISTERED_PARAMTYPE_MAXSIZE)
// Note that this overload does not handle varargs
static BOOL IsArgPassedByRef(TypeHandle th)
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(!th.IsNull());
// This method only works for valuetypes. It includes true value types,
// primitives, enums and TypedReference.
_ASSERTE(th.IsValueType());
size_t size = th.GetSize();
#ifdef _TARGET_AMD64_
return IsArgPassedByRef(size);
#elif defined(_TARGET_ARM64_)
// Composites greater than 16 bytes are passed by reference
return ((size > ENREGISTERED_PARAMTYPE_MAXSIZE) && !th.IsHFA());
#else
PORTABILITY_ASSERT("ArgIteratorTemplate::IsArgPassedByRef");
return FALSE;
#endif
}
#ifdef _TARGET_AMD64_
// This overload should only be used in AMD64-specific code only.
static BOOL IsArgPassedByRef(size_t size)
{
LIMITED_METHOD_CONTRACT;
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
// No arguments are passed by reference on AMD64 on Unix
return FALSE;
#else
// If the size is bigger than ENREGISTERED_PARAM_TYPE_MAXSIZE, or if the size is NOT a power of 2, then
// the argument is passed by reference.
return (size > ENREGISTERED_PARAMTYPE_MAXSIZE) || ((size & (size-1)) != 0);
#endif
}
#endif // _TARGET_AMD64_
// This overload should be used for varargs only.
static BOOL IsVarArgPassedByRef(size_t size)
{
LIMITED_METHOD_CONTRACT;
#ifdef _TARGET_AMD64_
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
PORTABILITY_ASSERT("ArgIteratorTemplate::IsVarArgPassedByRef");
return FALSE;
#else // FEATURE_UNIX_AMD64_STRUCT_PASSING
return IsArgPassedByRef(size);
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
#else
return (size > ENREGISTERED_PARAMTYPE_MAXSIZE);
#endif
}
BOOL IsArgPassedByRef()
{
LIMITED_METHOD_CONTRACT;
#ifdef _TARGET_AMD64_
return IsArgPassedByRef(m_argSize);
#elif defined(_TARGET_ARM64_)
if (m_argType == ELEMENT_TYPE_VALUETYPE)
{
_ASSERTE(!m_argTypeHandle.IsNull());
return ((m_argSize > ENREGISTERED_PARAMTYPE_MAXSIZE) && (!m_argTypeHandle.IsHFA() || this->IsVarArg()));
}
return FALSE;
#else
PORTABILITY_ASSERT("ArgIteratorTemplate::IsArgPassedByRef");
return FALSE;
#endif
}
#endif // ENREGISTERED_PARAMTYPE_MAXSIZE
//------------------------------------------------------------
// Return the offsets of the special arguments
//------------------------------------------------------------
static int GetThisOffset();
int GetRetBuffArgOffset();
int GetVASigCookieOffset();
int GetParamTypeArgOffset();
//------------------------------------------------------------
// Each time this is called, this returns a byte offset of the next
// argument from the TransitionBlock* pointer.
//
// Returns TransitionBlock::InvalidOffset once you've hit the end
// of the list.
//------------------------------------------------------------
int GetNextOffset();
CorElementType GetArgType(TypeHandle *pTypeHandle = NULL)
{
LIMITED_METHOD_CONTRACT;
if (pTypeHandle != NULL)
{
*pTypeHandle = m_argTypeHandle;
}
return m_argType;
}
int GetArgSize()
{
LIMITED_METHOD_CONTRACT;
return m_argSize;
}
void ForceSigWalk();
#ifndef _TARGET_X86_
// Accessors for built in argument descriptions of the special implicit parameters not mentioned directly
// in signatures (this pointer and the like). Whether or not these can be used successfully before all the
// explicit arguments have been scanned is platform dependent.
void GetThisLoc(ArgLocDesc * pLoc) { WRAPPER_NO_CONTRACT; GetSimpleLoc(GetThisOffset(), pLoc); }
void GetRetBuffArgLoc(ArgLocDesc * pLoc) { WRAPPER_NO_CONTRACT; GetSimpleLoc(GetRetBuffArgOffset(), pLoc); }
void GetParamTypeLoc(ArgLocDesc * pLoc) { WRAPPER_NO_CONTRACT; GetSimpleLoc(GetParamTypeArgOffset(), pLoc); }
void GetVASigCookieLoc(ArgLocDesc * pLoc) { WRAPPER_NO_CONTRACT; GetSimpleLoc(GetVASigCookieOffset(), pLoc); }
#endif // !_TARGET_X86_
ArgLocDesc* GetArgLocDescForStructInRegs()
{
#if (defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)) || defined (_TARGET_ARM64_)
return m_hasArgLocDescForStructInRegs ? &m_argLocDescForStructInRegs : NULL;
#else
return NULL;
#endif
}
#ifdef _TARGET_ARM_
// Get layout information for the argument that the ArgIterator is currently visiting.
void GetArgLoc(int argOffset, ArgLocDesc *pLoc)
{
LIMITED_METHOD_CONTRACT;
pLoc->Init();
pLoc->m_fRequires64BitAlignment = m_fRequires64BitAlignment;
int cSlots = (GetArgSize() + 3) / 4;
if (TransitionBlock::IsFloatArgumentRegisterOffset(argOffset))
{
pLoc->m_idxFloatReg = (argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters()) / 4;
pLoc->m_cFloatReg = cSlots;
return;
}
if (!TransitionBlock::IsStackArgumentOffset(argOffset))
{
pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
if (cSlots <= (4 - pLoc->m_idxGenReg))
{
pLoc->m_cGenReg = cSlots;
}
else
{
pLoc->m_cGenReg = 4 - pLoc->m_idxGenReg;
pLoc->m_idxStack = 0;
pLoc->m_cStack = cSlots - pLoc->m_cGenReg;
}
}
else
{
pLoc->m_idxStack = TransitionBlock::GetStackArgumentIndexFromOffset(argOffset);
pLoc->m_cStack = cSlots;
}
}
#endif // _TARGET_ARM_
#ifdef _TARGET_ARM64_
// Get layout information for the argument that the ArgIterator is currently visiting.
void GetArgLoc(int argOffset, ArgLocDesc *pLoc)
{
LIMITED_METHOD_CONTRACT;
pLoc->Init();
if (TransitionBlock::IsFloatArgumentRegisterOffset(argOffset))
{
// Dividing by 8 as size of each register in FloatArgumentRegisters is 8 bytes.
pLoc->m_idxFloatReg = (argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters()) / 8;
if (!m_argTypeHandle.IsNull() && m_argTypeHandle.IsHFA())
{
CorElementType type = m_argTypeHandle.GetHFAType();
bool isFloatType = (type == ELEMENT_TYPE_R4);
pLoc->m_cFloatReg = isFloatType ? GetArgSize()/sizeof(float): GetArgSize()/sizeof(double);
pLoc->m_isSinglePrecision = isFloatType;
}
else
{
pLoc->m_cFloatReg = 1;
}
return;
}
int cSlots = (GetArgSize() + 7)/ 8;
// Composites greater than 16bytes are passed by reference
if (GetArgType() == ELEMENT_TYPE_VALUETYPE && GetArgSize() > ENREGISTERED_PARAMTYPE_MAXSIZE)
{
cSlots = 1;
}
if (!TransitionBlock::IsStackArgumentOffset(argOffset))
{
pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
pLoc->m_cGenReg = cSlots;
}
else
{
pLoc->m_idxStack = TransitionBlock::GetStackArgumentIndexFromOffset(argOffset);
pLoc->m_cStack = cSlots;
}
}
#endif // _TARGET_ARM64_
#if defined(_TARGET_AMD64_) && defined(UNIX_AMD64_ABI)
// Get layout information for the argument that the ArgIterator is currently visiting.
void GetArgLoc(int argOffset, ArgLocDesc* pLoc)
{
LIMITED_METHOD_CONTRACT;
#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
if (m_hasArgLocDescForStructInRegs)
{
*pLoc = m_argLocDescForStructInRegs;
return;
}
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
if (argOffset == TransitionBlock::StructInRegsOffset)
{
// We always already have argLocDesc for structs passed in registers, we
// compute it in the GetNextOffset for those since it is always needed.
_ASSERTE(false);
return;
}
pLoc->Init();
if (TransitionBlock::IsFloatArgumentRegisterOffset(argOffset))
{
// Dividing by 16 as size of each register in FloatArgumentRegisters is 16 bytes.
pLoc->m_idxFloatReg = (argOffset - TransitionBlock::GetOffsetOfFloatArgumentRegisters()) / 16;
pLoc->m_cFloatReg = 1;
}
else if (!TransitionBlock::IsStackArgumentOffset(argOffset))
{
pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(argOffset);
pLoc->m_cGenReg = 1;
}
else
{
pLoc->m_idxStack = TransitionBlock::GetStackArgumentIndexFromOffset(argOffset);
pLoc->m_cStack = (GetArgSize() + STACK_ELEM_SIZE - 1) / STACK_ELEM_SIZE;
}
}
#endif // _TARGET_AMD64_ && UNIX_AMD64_ABI
protected:
DWORD m_dwFlags; // Cached flags
int m_nSizeOfArgStack; // Cached value of SizeOfArgStack
DWORD m_argNum;
// Cached information about last argument
CorElementType m_argType;
int m_argSize;
TypeHandle m_argTypeHandle;
#if (defined(_TARGET_AMD64_) && defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)) || defined(_TARGET_ARM64_)
ArgLocDesc m_argLocDescForStructInRegs;
bool m_hasArgLocDescForStructInRegs;
#endif // _TARGET_AMD64_ && UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
#ifdef _TARGET_X86_
int m_curOfs; // Current position of the stack iterator
int m_numRegistersUsed;
#endif
#ifdef _TARGET_AMD64_
#ifdef UNIX_AMD64_ABI
int m_idxGenReg; // Next general register to be assigned a value
int m_idxStack; // Next stack slot to be assigned a value
int m_idxFPReg; // Next floating point register to be assigned a value
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
bool m_fArgInRegisters; // Indicates that the current argument is stored in registers
#endif
#else
int m_curOfs; // Current position of the stack iterator
#endif
#endif
#ifdef _TARGET_ARM_
int m_idxGenReg; // Next general register to be assigned a value
int m_idxStack; // Next stack slot to be assigned a value
WORD m_wFPRegs; // Bitmask of available floating point argument registers (s0-s15/d0-d7)
bool m_fRequires64BitAlignment; // Cached info about the current arg
#endif
#ifdef _TARGET_ARM64_
int m_idxGenReg; // Next general register to be assigned a value
int m_idxStack; // Next stack slot to be assigned a value
int m_idxFPReg; // Next FP register to be assigned a value
#endif
enum {
ITERATION_STARTED = 0x0001, // Started iterating over arguments
SIZE_OF_ARG_STACK_COMPUTED = 0x0002,
RETURN_FLAGS_COMPUTED = 0x0004,
RETURN_HAS_RET_BUFFER = 0x0008, // Cached value of HasRetBuffArg
#ifdef _TARGET_X86_
PARAM_TYPE_REGISTER_MASK = 0x0030,
PARAM_TYPE_REGISTER_STACK = 0x0010,
PARAM_TYPE_REGISTER_ECX = 0x0020,
PARAM_TYPE_REGISTER_EDX = 0x0030,
#endif
METHOD_INVOKE_NEEDS_ACTIVATION = 0x0040, // Flag used by ArgIteratorForMethodInvoke
RETURN_FP_SIZE_SHIFT = 8, // The rest of the flags is cached value of GetFPReturnSize
};
void ComputeReturnFlags();
#ifndef _TARGET_X86_
void GetSimpleLoc(int offset, ArgLocDesc * pLoc)
{
WRAPPER_NO_CONTRACT;
pLoc->Init();
pLoc->m_idxGenReg = TransitionBlock::GetArgumentIndexFromOffset(offset);
pLoc->m_cGenReg = 1;
}
#endif
};
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetThisOffset()
{
WRAPPER_NO_CONTRACT;
// This pointer is in the first argument register by default
int ret = TransitionBlock::GetOffsetOfArgumentRegisters();
#ifdef _TARGET_X86_
// x86 is special as always
ret += offsetof(ArgumentRegisters, ECX);
#endif
return ret;
}
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetRetBuffArgOffset()
{
WRAPPER_NO_CONTRACT;
_ASSERTE(this->HasRetBuffArg());
// RetBuf arg is in the second argument register by default
int ret = TransitionBlock::GetOffsetOfArgumentRegisters();
#if _TARGET_X86_
// x86 is special as always
ret += this->HasThis() ? offsetof(ArgumentRegisters, EDX) : offsetof(ArgumentRegisters, ECX);
#elif _TARGET_ARM64_
ret += (int) offsetof(ArgumentRegisters, x[8]);
#else
if (this->HasThis())
ret += sizeof(void *);
#endif
return ret;
}
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetVASigCookieOffset()
{
WRAPPER_NO_CONTRACT;
_ASSERTE(this->IsVarArg());
#if defined(_TARGET_X86_)
// x86 is special as always
return sizeof(TransitionBlock);
#else
// VaSig cookie is after this and retbuf arguments by default.
int ret = TransitionBlock::GetOffsetOfArgumentRegisters();
if (this->HasThis())
{
ret += sizeof(void*);
}
if (this->HasRetBuffArg() && IsRetBuffPassedAsFirstArg())
{
ret += sizeof(void*);
}
return ret;
#endif
}
//-----------------------------------------------------------
// Get the extra param offset for shared generic code
//-----------------------------------------------------------
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetParamTypeArgOffset()
{
CONTRACTL
{
INSTANCE_CHECK;
if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS;
if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS;
if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); }
MODE_ANY;
}
CONTRACTL_END
_ASSERTE(this->HasParamType());
#ifdef _TARGET_X86_
// x86 is special as always
if (!(m_dwFlags & SIZE_OF_ARG_STACK_COMPUTED))
ForceSigWalk();
switch (m_dwFlags & PARAM_TYPE_REGISTER_MASK)
{
case PARAM_TYPE_REGISTER_ECX:
return TransitionBlock::GetOffsetOfArgumentRegisters() + offsetof(ArgumentRegisters, ECX);
case PARAM_TYPE_REGISTER_EDX:
return TransitionBlock::GetOffsetOfArgumentRegisters() + offsetof(ArgumentRegisters, EDX);
default:
break;
}
// The param type arg is last stack argument otherwise
return sizeof(TransitionBlock);
#else
// The hidden arg is after this and retbuf arguments by default.
int ret = TransitionBlock::GetOffsetOfArgumentRegisters();
if (this->HasThis())
{
ret += sizeof(void*);
}
if (this->HasRetBuffArg() && IsRetBuffPassedAsFirstArg())
{
ret += sizeof(void*);
}
return ret;
#endif
}
// To avoid corner case bugs, limit maximum size of the arguments with sufficient margin
#define MAX_ARG_SIZE 0xFFFFFF
//------------------------------------------------------------
// Each time this is called, this returns a byte offset of the next
// argument from the Frame* pointer. This offset can be positive *or* negative.
//
// Returns TransitionBlock::InvalidOffset once you've hit the end of the list.
//------------------------------------------------------------
template<class ARGITERATOR_BASE>
int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
if (!(m_dwFlags & ITERATION_STARTED))
{
int numRegistersUsed = 0;
if (this->HasThis())
numRegistersUsed++;
if (this->HasRetBuffArg() && IsRetBuffPassedAsFirstArg())
numRegistersUsed++;
_ASSERTE(!this->IsVarArg() || !this->HasParamType());
#ifndef _TARGET_X86_
if (this->IsVarArg() || this->HasParamType())
{
numRegistersUsed++;
}
#endif
#ifdef _TARGET_X86_
if (this->IsVarArg())
{
numRegistersUsed = NUM_ARGUMENT_REGISTERS; // Nothing else gets passed in registers for varargs
}
#ifdef FEATURE_INTERPRETER
BYTE callconv = CallConv();
switch (callconv)
{
case IMAGE_CEE_CS_CALLCONV_C:
case IMAGE_CEE_CS_CALLCONV_STDCALL:
m_numRegistersUsed = NUM_ARGUMENT_REGISTERS;
m_curOfs = TransitionBlock::GetOffsetOfArgs() + numRegistersUsed * sizeof(void *);
m_fUnmanagedCallConv = true;
break;
case IMAGE_CEE_CS_CALLCONV_THISCALL:
case IMAGE_CEE_CS_CALLCONV_FASTCALL:
_ASSERTE_MSG(false, "Unsupported calling convention.");
default:
m_fUnmanagedCallConv = false;
m_numRegistersUsed = numRegistersUsed;
m_curOfs = TransitionBlock::GetOffsetOfArgs() + SizeOfArgStack();
}
#else
m_numRegistersUsed = numRegistersUsed;
m_curOfs = TransitionBlock::GetOffsetOfArgs() + SizeOfArgStack();
#endif
#elif defined(_TARGET_AMD64_)
#ifdef UNIX_AMD64_ABI
m_idxGenReg = numRegistersUsed;
m_idxStack = 0;
m_idxFPReg = 0;
#else
m_curOfs = TransitionBlock::GetOffsetOfArgs() + numRegistersUsed * sizeof(void *);
#endif
#elif defined(_TARGET_ARM_)
m_idxGenReg = numRegistersUsed;
m_idxStack = 0;
m_wFPRegs = 0;
#elif defined(_TARGET_ARM64_)
m_idxGenReg = numRegistersUsed;
m_idxStack = 0;
m_idxFPReg = 0;
#else
PORTABILITY_ASSERT("ArgIteratorTemplate::GetNextOffset");
#endif
m_argNum = 0;
m_dwFlags |= ITERATION_STARTED;
}
if (m_argNum == this->NumFixedArgs())
return TransitionBlock::InvalidOffset;
TypeHandle thValueType;
CorElementType argType = this->GetNextArgumentType(m_argNum++, &thValueType);
int argSize = MetaSig::GetElemSize(argType, thValueType);
m_argType = argType;
m_argSize = argSize;
m_argTypeHandle = thValueType;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
m_hasArgLocDescForStructInRegs = false;
#endif
#ifdef _TARGET_X86_
#ifdef FEATURE_INTERPRETER
if (m_fUnmanagedCallConv)
{
int argOfs = m_curOfs;
m_curOfs += StackElemSize(argSize);
return argOfs;
}
#endif
if (IsArgumentInRegister(&m_numRegistersUsed, argType))
{
return TransitionBlock::GetOffsetOfArgumentRegisters() + (NUM_ARGUMENT_REGISTERS - m_numRegistersUsed) * sizeof(void *);
}
m_curOfs -= StackElemSize(argSize);
_ASSERTE(m_curOfs >= TransitionBlock::GetOffsetOfArgs());
return m_curOfs;
#elif defined(_TARGET_AMD64_)
#ifdef UNIX_AMD64_ABI
m_fArgInRegisters = true;
int cFPRegs = 0;
int cGenRegs = 0;
int cbArg = StackElemSize(argSize);
switch (argType)
{
case ELEMENT_TYPE_R4:
// 32-bit floating point argument.
cFPRegs = 1;
break;
case ELEMENT_TYPE_R8:
// 64-bit floating point argument.
cFPRegs = 1;
break;
case ELEMENT_TYPE_VALUETYPE:
{
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
MethodTable *pMT = m_argTypeHandle.AsMethodTable();
if (pMT->IsRegPassedStruct())
{
EEClass* eeClass = pMT->GetClass();
cGenRegs = 0;
for (int i = 0; i < eeClass->GetNumberEightBytes(); i++)
{
switch (eeClass->GetEightByteClassification(i))
{
case SystemVClassificationTypeInteger:
case SystemVClassificationTypeIntegerReference:
case SystemVClassificationTypeIntegerByRef:
cGenRegs++;
break;
case SystemVClassificationTypeSSE:
cFPRegs++;
break;
default:
_ASSERTE(false);
break;
}
}
// Check if we have enough registers available for the struct passing
if ((cFPRegs + m_idxFPReg <= NUM_FLOAT_ARGUMENT_REGISTERS) && (cGenRegs + m_idxGenReg) <= NUM_ARGUMENT_REGISTERS)
{
m_argLocDescForStructInRegs.Init();
m_argLocDescForStructInRegs.m_cGenReg = cGenRegs;
m_argLocDescForStructInRegs.m_cFloatReg = cFPRegs;
m_argLocDescForStructInRegs.m_idxGenReg = m_idxGenReg;
m_argLocDescForStructInRegs.m_idxFloatReg = m_idxFPReg;
m_argLocDescForStructInRegs.m_eeClass = eeClass;
m_hasArgLocDescForStructInRegs = true;
m_idxGenReg += cGenRegs;
m_idxFPReg += cFPRegs;
return TransitionBlock::StructInRegsOffset;
}
}
// Set the register counts to indicate that this argument will not be passed in registers
cFPRegs = 0;
cGenRegs = 0;
#else // FEATURE_UNIX_AMD64_STRUCT_PASSING
argSize = sizeof(TADDR);
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
break;
}
default:
cGenRegs = cbArg / 8; // GP reg size
break;
}
if ((cFPRegs > 0) && (cFPRegs + m_idxFPReg <= NUM_FLOAT_ARGUMENT_REGISTERS))
{
int argOfs = TransitionBlock::GetOffsetOfFloatArgumentRegisters() + m_idxFPReg * 16;
m_idxFPReg += cFPRegs;
return argOfs;
}
else if ((cGenRegs > 0) && (m_idxGenReg + cGenRegs <= NUM_ARGUMENT_REGISTERS))
{
int argOfs = TransitionBlock::GetOffsetOfArgumentRegisters() + m_idxGenReg * 8;
m_idxGenReg += cGenRegs;
return argOfs;
}
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
m_fArgInRegisters = false;
#endif
int argOfs = TransitionBlock::GetOffsetOfArgs() + m_idxStack * STACK_ELEM_SIZE;
int cArgSlots = cbArg / STACK_ELEM_SIZE;
m_idxStack += cArgSlots;
return argOfs;
#else
// Each argument takes exactly one slot on AMD64 on Windows
int argOfs = m_curOfs;
m_curOfs += sizeof(void *);
return argOfs;
#endif
#elif defined(_TARGET_ARM_)
// First look at the underlying type of the argument to determine some basic properties:
// 1) The size of the argument in bytes (rounded up to the stack slot size of 4 if necessary).
// 2) Whether the argument represents a floating point primitive (ELEMENT_TYPE_R4 or ELEMENT_TYPE_R8).
// 3) Whether the argument requires 64-bit alignment (anything that contains a Int64/UInt64).
bool fFloatingPoint = false;
bool fRequiresAlign64Bit = false;
switch (argType)
{
case ELEMENT_TYPE_I8:
case ELEMENT_TYPE_U8:
// 64-bit integers require 64-bit alignment on ARM.
fRequiresAlign64Bit = true;
break;
case ELEMENT_TYPE_R4:
// 32-bit floating point argument.
fFloatingPoint = true;
break;
case ELEMENT_TYPE_R8:
// 64-bit floating point argument.
fFloatingPoint = true;
fRequiresAlign64Bit = true;
break;
case ELEMENT_TYPE_VALUETYPE:
{
// Value type case: extract the alignment requirement, note that this has to handle
// the interop "native value types".
fRequiresAlign64Bit = thValueType.RequiresAlign8();
#ifdef FEATURE_HFA
// Handle HFAs: packed structures of 1-4 floats or doubles that are passed in FP argument
// registers if possible.
if (thValueType.IsHFA())
{
fFloatingPoint = true;
}
#endif
break;
}
default:
// The default is are 4-byte arguments (or promoted to 4 bytes), non-FP and don't require any
// 64-bit alignment.
break;
}
// Now attempt to place the argument into some combination of floating point or general registers and
// the stack.
// Save the alignment requirement
m_fRequires64BitAlignment = fRequiresAlign64Bit;
int cbArg = StackElemSize(argSize);
int cArgSlots = cbArg / 4;
// Ignore floating point argument placement in registers if we're dealing with a vararg function (the ABI
// specifies this so that vararg processing on the callee side is simplified).
#ifndef ARM_SOFTFP
if (fFloatingPoint && !this->IsVarArg())
{
// Handle floating point (primitive) arguments.
// First determine whether we can place the argument in VFP registers. There are 16 32-bit
// and 8 64-bit argument registers that share the same register space (e.g. D0 overlaps S0 and
// S1). The ABI specifies that VFP values will be passed in the lowest sequence of registers that
// haven't been used yet and have the required alignment. So the sequence (float, double, float)
// would be mapped to (S0, D1, S1) or (S0, S2/S3, S1).
//
// We use a 16-bit bitmap to record which registers have been used so far.
//
// So we can use the same basic loop for each argument type (float, double or HFA struct) we set up
// the following input parameters based on the size and alignment requirements of the arguments:
// wAllocMask : bitmask of the number of 32-bit registers we need (1 for 1, 3 for 2, 7 for 3 etc.)
// cSteps : number of loop iterations it'll take to search the 16 registers
// cShift : how many bits to shift the allocation mask on each attempt
WORD wAllocMask = (1 << (cbArg / 4)) - 1;
WORD cSteps = (WORD)(fRequiresAlign64Bit ? 9 - (cbArg / 8) : 17 - (cbArg / 4));
WORD cShift = fRequiresAlign64Bit ? 2 : 1;
// Look through the availability bitmask for a free register or register pair.
for (WORD i = 0; i < cSteps; i++)
{
if ((m_wFPRegs & wAllocMask) == 0)
{
// We found one, mark the register or registers as used.
m_wFPRegs |= wAllocMask;
// Indicate the registers used to the caller and return.
return TransitionBlock::GetOffsetOfFloatArgumentRegisters() + (i * cShift * 4);
}
wAllocMask <<= cShift;
}
// The FP argument is going to live on the stack. Once this happens the ABI demands we mark all FP
// registers as unavailable.
m_wFPRegs = 0xffff;
// Doubles or HFAs containing doubles need the stack aligned appropriately.
if (fRequiresAlign64Bit)
m_idxStack = ALIGN_UP(m_idxStack, 2);
// Indicate the stack location of the argument to the caller.
int argOfs = TransitionBlock::GetOffsetOfArgs() + m_idxStack * 4;
// Record the stack usage.
m_idxStack += cArgSlots;
return argOfs;
}
#endif // ARM_SOFTFP
//
// Handle the non-floating point case.
//
if (m_idxGenReg < 4)
{
if (fRequiresAlign64Bit)
{
// The argument requires 64-bit alignment. Align either the next general argument register if
// we have any left. See step C.3 in the algorithm in the ABI spec.
m_idxGenReg = ALIGN_UP(m_idxGenReg, 2);
}
int argOfs = TransitionBlock::GetOffsetOfArgumentRegisters() + m_idxGenReg * 4;
int cRemainingRegs = 4 - m_idxGenReg;
if (cArgSlots <= cRemainingRegs)
{
// Mark the registers just allocated as used.
m_idxGenReg += cArgSlots;
return argOfs;
}
// The ABI supports splitting a non-FP argument across registers and the stack. But this is
// disabled if the FP arguments already overflowed onto the stack (i.e. the stack index is not
// zero). The following code marks the general argument registers as exhausted if this condition
// holds. See steps C.5 in the algorithm in the ABI spec.
m_idxGenReg = 4;
if (m_idxStack == 0)
{
m_idxStack += cArgSlots - cRemainingRegs;
return argOfs;
}
}
if (fRequiresAlign64Bit)
{
// The argument requires 64-bit alignment. If it is going to be passed on the stack, align
// the next stack slot. See step C.6 in the algorithm in the ABI spec.
m_idxStack = ALIGN_UP(m_idxStack, 2);
}
int argOfs = TransitionBlock::GetOffsetOfArgs() + m_idxStack * 4;
// Advance the stack pointer over the argument just placed.
m_idxStack += cArgSlots;
return argOfs;
#elif defined(_TARGET_ARM64_)
int cFPRegs = 0;
switch (argType)
{
case ELEMENT_TYPE_R4:
// 32-bit floating point argument.
cFPRegs = 1;
break;
case ELEMENT_TYPE_R8:
// 64-bit floating point argument.
cFPRegs = 1;
break;
case ELEMENT_TYPE_VALUETYPE:
{
// Handle HFAs: packed structures of 2-4 floats or doubles that are passed in FP argument
// registers if possible.
if (thValueType.IsHFA())
{
CorElementType type = thValueType.GetHFAType();
bool isFloatType = (type == ELEMENT_TYPE_R4);
cFPRegs = (type == ELEMENT_TYPE_R4)? (argSize/sizeof(float)): (argSize/sizeof(double));
m_argLocDescForStructInRegs.Init();
m_argLocDescForStructInRegs.m_cFloatReg = cFPRegs;
m_argLocDescForStructInRegs.m_idxFloatReg = m_idxFPReg;
m_argLocDescForStructInRegs.m_isSinglePrecision = isFloatType;
m_hasArgLocDescForStructInRegs = true;
}
else
{
// Composite greater than 16bytes should be passed by reference
if (argSize > ENREGISTERED_PARAMTYPE_MAXSIZE)
{
argSize = sizeof(TADDR);
}
}
break;
}
default:
break;
}
int cbArg = StackElemSize(argSize);
int cArgSlots = cbArg / STACK_ELEM_SIZE;
if (cFPRegs>0 && !this->IsVarArg())
{
if (cFPRegs + m_idxFPReg <= 8)
{
int argOfs = TransitionBlock::GetOffsetOfFloatArgumentRegisters() + m_idxFPReg * 8;
m_idxFPReg += cFPRegs;
return argOfs;
}
else
{
m_idxFPReg = 8;
}
}
else
{
if (m_idxGenReg + cArgSlots <= 8)
{
int argOfs = TransitionBlock::GetOffsetOfArgumentRegisters() + m_idxGenReg * 8;
m_idxGenReg += cArgSlots;
return argOfs;
}
else
{
m_idxGenReg = 8;
}
}
int argOfs = TransitionBlock::GetOffsetOfArgs() + m_idxStack * 8;
m_idxStack += cArgSlots;
return argOfs;
#else
PORTABILITY_ASSERT("ArgIteratorTemplate::GetNextOffset");
return TransitionBlock::InvalidOffset;
#endif
}
template<class ARGITERATOR_BASE>
void ArgIteratorTemplate<ARGITERATOR_BASE>::ComputeReturnFlags()
{
CONTRACTL
{
INSTANCE_CHECK;
if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS;
if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS;
if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); }
MODE_ANY;
}
CONTRACTL_END
TypeHandle thValueType;
CorElementType type = this->GetReturnType(&thValueType);
DWORD flags = RETURN_FLAGS_COMPUTED;
switch (type)
{
case ELEMENT_TYPE_TYPEDBYREF:
#ifdef ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE
if (sizeof(TypedByRef) > ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE)
flags |= RETURN_HAS_RET_BUFFER;
#else
flags |= RETURN_HAS_RET_BUFFER;
#endif
break;
case ELEMENT_TYPE_R4:
#ifndef ARM_SOFTFP
flags |= sizeof(float) << RETURN_FP_SIZE_SHIFT;
#endif
break;
case ELEMENT_TYPE_R8:
#ifndef ARM_SOFTFP
flags |= sizeof(double) << RETURN_FP_SIZE_SHIFT;
#endif
break;
case ELEMENT_TYPE_VALUETYPE:
#ifdef ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE
{
_ASSERTE(!thValueType.IsNull());
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
MethodTable *pMT = thValueType.AsMethodTable();
if (pMT->IsRegPassedStruct())
{
EEClass* eeClass = pMT->GetClass();
if (eeClass->GetNumberEightBytes() == 1)
{
// Structs occupying just one eightbyte are treated as int / double
if (eeClass->GetEightByteClassification(0) == SystemVClassificationTypeSSE)
{
flags |= sizeof(double) << RETURN_FP_SIZE_SHIFT;
}
}
else
{
// Size of the struct is 16 bytes
flags |= (16 << RETURN_FP_SIZE_SHIFT);
// The lowest two bits of the size encode the order of the int and SSE fields
if (eeClass->GetEightByteClassification(0) == SystemVClassificationTypeSSE)
{
flags |= (1 << RETURN_FP_SIZE_SHIFT);
}
if (eeClass->GetEightByteClassification(1) == SystemVClassificationTypeSSE)
{
flags |= (2 << RETURN_FP_SIZE_SHIFT);
}
}
break;
}
#else // UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
#ifdef FEATURE_HFA
if (thValueType.IsHFA() && !this->IsVarArg())
{
CorElementType hfaType = thValueType.GetHFAType();
flags |= (hfaType == ELEMENT_TYPE_R4) ?
((4 * sizeof(float)) << RETURN_FP_SIZE_SHIFT) :
((4 * sizeof(double)) << RETURN_FP_SIZE_SHIFT);
break;
}
#endif
size_t size = thValueType.GetSize();
#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_)
// Return value types of size which are not powers of 2 using a RetBuffArg
if ((size & (size-1)) != 0)
{
flags |= RETURN_HAS_RET_BUFFER;
break;
}
#endif
if (size <= ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE)
break;
#endif // UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
}
#endif // ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE
// Value types are returned using return buffer by default
flags |= RETURN_HAS_RET_BUFFER;
break;
default:
break;
}
m_dwFlags |= flags;
}
template<class ARGITERATOR_BASE>
void ArgIteratorTemplate<ARGITERATOR_BASE>::ForceSigWalk()
{
CONTRACTL
{
INSTANCE_CHECK;
if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS;
if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS;
if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); }
MODE_ANY;
}
CONTRACTL_END
// This can be only used before the actual argument iteration started
_ASSERTE((m_dwFlags & ITERATION_STARTED) == 0);
#ifdef _TARGET_X86_
//
// x86 is special as always
//
int numRegistersUsed = 0;
int nSizeOfArgStack = 0;
if (this->HasThis())
numRegistersUsed++;
if (this->HasRetBuffArg() && IsRetBuffPassedAsFirstArg())
numRegistersUsed++;
if (this->IsVarArg())
{
nSizeOfArgStack += sizeof(void *);
numRegistersUsed = NUM_ARGUMENT_REGISTERS; // Nothing else gets passed in registers for varargs
}
#ifdef FEATURE_INTERPRETER
BYTE callconv = CallConv();
switch (callconv)
{
case IMAGE_CEE_CS_CALLCONV_C:
case IMAGE_CEE_CS_CALLCONV_STDCALL:
numRegistersUsed = NUM_ARGUMENT_REGISTERS;
nSizeOfArgStack = TransitionBlock::GetOffsetOfArgs() + numRegistersUsed * sizeof(void *);
break;
case IMAGE_CEE_CS_CALLCONV_THISCALL:
case IMAGE_CEE_CS_CALLCONV_FASTCALL:
_ASSERTE_MSG(false, "Unsupported calling convention.");
default:
}
#endif // FEATURE_INTERPRETER
DWORD nArgs = this->NumFixedArgs();
for (DWORD i = 0; i < nArgs; i++)
{
TypeHandle thValueType;
CorElementType type = this->GetNextArgumentType(i, &thValueType);
if (!IsArgumentInRegister(&numRegistersUsed, type))
{
int structSize = MetaSig::GetElemSize(type, thValueType);
nSizeOfArgStack += StackElemSize(structSize);
#ifndef DACCESS_COMPILE
if (nSizeOfArgStack > MAX_ARG_SIZE)
{
#ifdef _DEBUG
// We should not ever throw exception in the "FORBIDGC_LOADER_USE_ENABLED" mode.
// The contract violation is required to workaround bug in the static contract analyzer.
_ASSERTE(!FORBIDGC_LOADER_USE_ENABLED());
CONTRACT_VIOLATION(ThrowsViolation);
#endif
COMPlusThrow(kNotSupportedException);
}
#endif
}
}
if (this->HasParamType())
{
DWORD paramTypeFlags = 0;
if (numRegistersUsed < NUM_ARGUMENT_REGISTERS)
{
numRegistersUsed++;
paramTypeFlags = (numRegistersUsed == 1) ?
PARAM_TYPE_REGISTER_ECX : PARAM_TYPE_REGISTER_EDX;
}
else
{
nSizeOfArgStack += sizeof(void *);
paramTypeFlags = PARAM_TYPE_REGISTER_STACK;
}
m_dwFlags |= paramTypeFlags;
}
#else // _TARGET_X86_
int maxOffset = TransitionBlock::GetOffsetOfArgs();
int ofs;
while (TransitionBlock::InvalidOffset != (ofs = GetNextOffset()))
{
int stackElemSize;
#ifdef _TARGET_AMD64_
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
if (m_fArgInRegisters)
{
// Arguments passed in registers don't consume any stack
continue;
}
stackElemSize = StackElemSize(GetArgSize());
#else // FEATURE_UNIX_AMD64_STRUCT_PASSING
// All stack arguments take just one stack slot on AMD64 because of arguments bigger
// than a stack slot are passed by reference.
stackElemSize = STACK_ELEM_SIZE;
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
#else // _TARGET_AMD64_
stackElemSize = StackElemSize(GetArgSize());
#if defined(ENREGISTERED_PARAMTYPE_MAXSIZE)
if (IsArgPassedByRef())
stackElemSize = STACK_ELEM_SIZE;
#endif
#endif // _TARGET_AMD64_
int endOfs = ofs + stackElemSize;
if (endOfs > maxOffset)
{
#if !defined(DACCESS_COMPILE)
if (endOfs > MAX_ARG_SIZE)
{
#ifdef _DEBUG
// We should not ever throw exception in the "FORBIDGC_LOADER_USE_ENABLED" mode.
// The contract violation is required to workaround bug in the static contract analyzer.
_ASSERTE(!FORBIDGC_LOADER_USE_ENABLED());
CONTRACT_VIOLATION(ThrowsViolation);
#endif
COMPlusThrow(kNotSupportedException);
}
#endif
maxOffset = endOfs;
}
}
// Clear the iterator started flag
m_dwFlags &= ~ITERATION_STARTED;
int nSizeOfArgStack = maxOffset - TransitionBlock::GetOffsetOfArgs();
#if defined(_TARGET_AMD64_) && !defined(UNIX_AMD64_ABI)
nSizeOfArgStack = (nSizeOfArgStack > (int)sizeof(ArgumentRegisters)) ?
(nSizeOfArgStack - sizeof(ArgumentRegisters)) : 0;
#endif
#endif // _TARGET_X86_
// Cache the result
m_nSizeOfArgStack = nSizeOfArgStack;
m_dwFlags |= SIZE_OF_ARG_STACK_COMPUTED;
this->Reset();
}
class ArgIteratorBase
{
protected:
MetaSig * m_pSig;
FORCEINLINE CorElementType GetReturnType(TypeHandle * pthValueType)
{
WRAPPER_NO_CONTRACT;
#ifdef ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE
return m_pSig->GetReturnTypeNormalized(pthValueType);
#else
return m_pSig->GetReturnTypeNormalized();
#endif
}
FORCEINLINE CorElementType GetNextArgumentType(DWORD iArg, TypeHandle * pthValueType)
{
WRAPPER_NO_CONTRACT;
_ASSERTE(iArg == m_pSig->GetArgNum());
CorElementType et = m_pSig->PeekArgNormalized(pthValueType);
m_pSig->SkipArg();
return et;
}
FORCEINLINE void Reset()
{
WRAPPER_NO_CONTRACT;
m_pSig->Reset();
}
public:
BOOL HasThis()
{
LIMITED_METHOD_CONTRACT;
return m_pSig->HasThis();
}
BOOL HasParamType()
{
LIMITED_METHOD_CONTRACT;
return m_pSig->GetCallingConventionInfo() & CORINFO_CALLCONV_PARAMTYPE;
}
BOOL IsVarArg()
{
LIMITED_METHOD_CONTRACT;
return m_pSig->IsVarArg() || m_pSig->IsTreatAsVarArg();
}
DWORD NumFixedArgs()
{
LIMITED_METHOD_CONTRACT;
return m_pSig->NumFixedArgs();
}
#ifdef FEATURE_INTERPRETER
BYTE CallConv()
{
return m_pSig->GetCallingConvention();
}
#endif // FEATURE_INTERPRETER
//
// The following is used by the profiler to dig into the iterator for
// discovering if the method has a This pointer or a return buffer.
// Do not use this to re-initialize the signature, use the exposed Init()
// method in this class.
//
MetaSig *GetSig(void)
{
return m_pSig;
}
};
class ArgIterator : public ArgIteratorTemplate<ArgIteratorBase>
{
public:
ArgIterator(MetaSig * pSig)
{
m_pSig = pSig;
}
// This API returns true if we are returning a structure in registers instead of using a byref return buffer
BOOL HasNonStandardByvalReturn()
{
WRAPPER_NO_CONTRACT;
#ifdef ENREGISTERED_RETURNTYPE_MAXSIZE
CorElementType type = m_pSig->GetReturnTypeNormalized();
return (type == ELEMENT_TYPE_VALUETYPE || type == ELEMENT_TYPE_TYPEDBYREF) && !HasRetBuffArg();
#else
return FALSE;
#endif
}
};
// Conventience helper
inline BOOL HasRetBuffArg(MetaSig * pSig)
{
WRAPPER_NO_CONTRACT;
ArgIterator argit(pSig);
return argit.HasRetBuffArg();
}
#ifdef UNIX_X86_ABI
// For UNIX_X86_ABI and unmanaged function, we always need RetBuf if the return type is VALUETYPE
inline BOOL HasRetBuffArgUnmanagedFixup(MetaSig * pSig)
{
WRAPPER_NO_CONTRACT;
// We cannot just pSig->GetReturnType() here since it will return ELEMENT_TYPE_VALUETYPE for enums
CorElementType type = pSig->GetRetTypeHandleThrowing().GetVerifierCorElementType();
return type == ELEMENT_TYPE_VALUETYPE;
}
#endif
inline BOOL IsRetBuffPassedAsFirstArg()
{
WRAPPER_NO_CONTRACT;
#ifndef _TARGET_ARM64_
return TRUE;
#else
return FALSE;
#endif
}
#endif // __CALLING_CONVENTION_INCLUDED
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/src/file/filetime.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*++
Module Name:
filetime.cpp
Abstract:
Implementation of the file WIN API related to file time.
Notes:
One very important thing to note is that on BSD systems, the stat structure
stores nanoseconds for the time-related fields. This is implemented by
replacing the time_t fields st_atime, st_mtime, and st_ctime by timespec
structures, instead named st_atimespec, st_mtimespec, and st_ctimespec.
However, if _POSIX_SOURCE is defined, the fields are time_t values and use
their POSIX names. For compatibility purposes, when _POSIX_SOURCE is NOT
defined, the time-related fields are defined in sys/stat.h as:
#ifndef _POSIX_SOURCE
#define st_atime st_atimespec.tv_sec
#define st_mtime st_mtimespec.tv_sec
#define st_ctime st_ctimespec.tv_sec
#endif
Furthermore, if _POSIX_SOURCE is defined, the structure still has
additional fields for nanoseconds, named st_atimensec, st_mtimensec, and
st_ctimensec.
In the PAL, there is a configure check to see if the system supports
nanoseconds for the time-related fields. This source file also sets macros
so that STAT_ATIME_NSEC etc. will always refer to the appropriate field
if it exists, and are defined as 0 otherwise.
--
Also note that there is no analog to "creation time" on Linux systems.
Instead, we use the inode change time, which is set to the current time
whenever mtime changes or when chmod, chown, etc. syscalls modify the
file status; or mtime if older. Ideally we would use birthtime when
available.
--*/
#include "pal/corunix.hpp"
#include "pal/dbgmsg.h"
#include "pal/filetime.h"
#include "pal/thread.hpp"
#include "pal/file.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <utime.h>
#include <time.h>
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif // HAVE_SYS_TIME_H
using namespace CorUnix;
SET_DEFAULT_DEBUG_CHANNEL(FILE);
// In safemath.h, Template SafeInt uses macro _ASSERTE, which need to use variable
// defdbgchan defined by SET_DEFAULT_DEBUG_CHANNEL. Therefore, the include statement
// should be placed after the SET_DEFAULT_DEBUG_CHANNEL(FILE)
#include <safemath.h>
/* Magic number explanation:
To 1970:
Both epochs are Gregorian. 1970 - 1601 = 369. Assuming a leap
year every four years, 369 / 4 = 92. However, 1700, 1800, and 1900
were NOT leap years, so 89 leap years, 280 non-leap years.
89 * 366 + 280 * 365 = 134774 days between epochs. Of course
60 * 60 * 24 = 86400 seconds per day, so 134774 * 86400 =
11644473600 = SECS_BETWEEN_1601_AND_1970_EPOCHS.
To 2001:
Again, both epochs are Gregorian. 2001 - 1601 = 400. Assuming a leap
year every four years, 400 / 4 = 100. However, 1700, 1800, and 1900
were NOT leap years (2000 was because it was divisible by 400), so
97 leap years, 303 non-leap years.
97 * 366 + 303 * 365 = 146097 days between epochs. 146097 * 86400 =
12622780800 = SECS_BETWEEN_1601_AND_2001_EPOCHS.
This result is also confirmed in the MSDN documentation on how
to convert a time_t value to a win32 FILETIME.
*/
static const __int64 SECS_BETWEEN_1601_AND_1970_EPOCHS = 11644473600LL;
static const __int64 SECS_TO_100NS = 10000000; /* 10^7 */
#ifdef __APPLE__
static const __int64 SECS_BETWEEN_1601_AND_2001_EPOCHS = 12622780800LL;
#endif // __APPLE__
/*++
Function:
CompareFileTime
See MSDN doc.
--*/
LONG
PALAPI
CompareFileTime(
IN CONST FILETIME *lpFileTime1,
IN CONST FILETIME *lpFileTime2)
{
__int64 First;
__int64 Second;
long Ret;
PERF_ENTRY(CompareFileTime);
ENTRY("CompareFileTime(lpFileTime1=%p lpFileTime2=%p)\n",
lpFileTime1, lpFileTime2);
First = ((__int64)lpFileTime1->dwHighDateTime << 32) +
lpFileTime1->dwLowDateTime;
Second = ((__int64)lpFileTime2->dwHighDateTime << 32) +
lpFileTime2->dwLowDateTime;
if ( First < Second )
{
Ret = -1;
}
else if ( First > Second )
{
Ret = 1;
}
else
{
Ret = 0;
}
LOGEXIT("CompareFileTime returns LONG %ld\n", Ret);
PERF_EXIT(CompareFileTime);
return Ret;
}
/*++
Function:
GetSystemTimeAsFileTime
See MSDN doc.
--*/
VOID
PALAPI
GetSystemTimeAsFileTime(
OUT LPFILETIME lpSystemTimeAsFileTime)
{
PERF_ENTRY(GetSystemTimeAsFileTime);
ENTRY("GetSystemTimeAsFileTime(lpSystemTimeAsFileTime=%p)\n",
lpSystemTimeAsFileTime);
#if HAVE_WORKING_CLOCK_GETTIME
struct timespec Time;
if (clock_gettime(CLOCK_REALTIME, &Time) == 0)
{
*lpSystemTimeAsFileTime = FILEUnixTimeToFileTime( Time.tv_sec, Time.tv_nsec );
}
#else
struct timeval Time;
if (gettimeofday(&Time, NULL) == 0)
{
/* use (tv_usec * 1000) because 2nd arg is in nanoseconds */
*lpSystemTimeAsFileTime = FILEUnixTimeToFileTime( Time.tv_sec, Time.tv_usec * 1000);
}
#endif
else
{
/* no way to indicate failure, so set time to zero */
ASSERT("clock_gettime or gettimeofday failed");
*lpSystemTimeAsFileTime = FILEUnixTimeToFileTime( 0, 0 );
}
LOGEXIT("GetSystemTimeAsFileTime returns.\n");
PERF_EXIT(GetSystemTimeAsFileTime);
}
#ifdef __APPLE__
/*++
Function:
FILECFAbsoluteTimeToFileTime
Convert a CFAbsoluteTime value to a win32 FILETIME structure, as described
in MSDN documentation. CFAbsoluteTime is the number of seconds elapsed since
00:00 01 January 2001 UTC (Mac OS X epoch), while FILETIME represents a
64-bit number of 100-nanosecond intervals that have passed since 00:00
01 January 1601 UTC (win32 epoch).
--*/
FILETIME FILECFAbsoluteTimeToFileTime( CFAbsoluteTime sec )
{
__int64 Result;
FILETIME Ret;
Result = ((__int64)sec + SECS_BETWEEN_1601_AND_2001_EPOCHS) * SECS_TO_100NS;
Ret.dwLowDateTime = (DWORD)Result;
Ret.dwHighDateTime = (DWORD)(Result >> 32);
TRACE("CFAbsoluteTime = [%9f] converts to Win32 FILETIME = [%#x:%#x]\n",
sec, Ret.dwHighDateTime, Ret.dwLowDateTime);
return Ret;
}
#endif // __APPLE__
/*++
Function:
FILEUnixTimeToFileTime
Convert a time_t value to a win32 FILETIME structure, as described in
MSDN documentation. time_t is the number of seconds elapsed since
00:00 01 January 1970 UTC (Unix epoch), while FILETIME represents a
64-bit number of 100-nanosecond intervals that have passed since 00:00
01 January 1601 UTC (win32 epoch).
--*/
FILETIME FILEUnixTimeToFileTime( time_t sec, long nsec )
{
__int64 Result;
FILETIME Ret;
Result = ((__int64)sec + SECS_BETWEEN_1601_AND_1970_EPOCHS) * SECS_TO_100NS +
(nsec / 100);
Ret.dwLowDateTime = (DWORD)Result;
Ret.dwHighDateTime = (DWORD)(Result >> 32);
TRACE("Unix time = [%ld.%09ld] converts to Win32 FILETIME = [%#x:%#x]\n",
sec, nsec, Ret.dwHighDateTime, Ret.dwLowDateTime);
return Ret;
}
/**
Function
FileTimeToSystemTime()
Helper function for FileTimeToDosTime.
Converts the necessary file time attributes to system time, for
easier manipulation in FileTimeToDosTime.
--*/
BOOL PALAPI FileTimeToSystemTime( CONST FILETIME * lpFileTime,
LPSYSTEMTIME lpSystemTime )
{
UINT64 FileTime = 0;
time_t UnixFileTime = 0;
struct tm * UnixSystemTime = 0;
/* Combine the file time. */
FileTime = lpFileTime->dwHighDateTime;
FileTime <<= 32;
FileTime |= (UINT)lpFileTime->dwLowDateTime;
bool isSafe = ClrSafeInt<UINT64>::subtraction(
FileTime,
SECS_BETWEEN_1601_AND_1970_EPOCHS * SECS_TO_100NS,
FileTime);
if (isSafe == true)
{
#if HAVE_GMTIME_R
struct tm timeBuf;
#endif /* HAVE_GMTIME_R */
/* Convert file time to unix time. */
if (((INT64)FileTime) < 0)
{
UnixFileTime = -1 - ( ( -FileTime - 1 ) / 10000000 );
}
else
{
UnixFileTime = FileTime / 10000000;
}
/* Convert unix file time to Unix System time. */
#if HAVE_GMTIME_R
UnixSystemTime = gmtime_r( &UnixFileTime, &timeBuf );
#else /* HAVE_GMTIME_R */
UnixSystemTime = gmtime( &UnixFileTime );
#endif /* HAVE_GMTIME_R */
/* Convert unix system time to Windows system time. */
lpSystemTime->wDay = UnixSystemTime->tm_mday;
/* Unix time counts January as a 0, under Windows it is 1*/
lpSystemTime->wMonth = UnixSystemTime->tm_mon + 1;
/* Unix time returns the year - 1900, Windows returns the current year*/
lpSystemTime->wYear = UnixSystemTime->tm_year + 1900;
lpSystemTime->wSecond = UnixSystemTime->tm_sec;
lpSystemTime->wMinute = UnixSystemTime->tm_min;
lpSystemTime->wHour = UnixSystemTime->tm_hour;
return TRUE;
}
else
{
ERROR( "The file time is to large.\n" );
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*++
Module Name:
filetime.cpp
Abstract:
Implementation of the file WIN API related to file time.
Notes:
One very important thing to note is that on BSD systems, the stat structure
stores nanoseconds for the time-related fields. This is implemented by
replacing the time_t fields st_atime, st_mtime, and st_ctime by timespec
structures, instead named st_atimespec, st_mtimespec, and st_ctimespec.
However, if _POSIX_SOURCE is defined, the fields are time_t values and use
their POSIX names. For compatibility purposes, when _POSIX_SOURCE is NOT
defined, the time-related fields are defined in sys/stat.h as:
#ifndef _POSIX_SOURCE
#define st_atime st_atimespec.tv_sec
#define st_mtime st_mtimespec.tv_sec
#define st_ctime st_ctimespec.tv_sec
#endif
Furthermore, if _POSIX_SOURCE is defined, the structure still has
additional fields for nanoseconds, named st_atimensec, st_mtimensec, and
st_ctimensec.
In the PAL, there is a configure check to see if the system supports
nanoseconds for the time-related fields. This source file also sets macros
so that STAT_ATIME_NSEC etc. will always refer to the appropriate field
if it exists, and are defined as 0 otherwise.
--
Also note that there is no analog to "creation time" on Linux systems.
Instead, we use the inode change time, which is set to the current time
whenever mtime changes or when chmod, chown, etc. syscalls modify the
file status; or mtime if older. Ideally we would use birthtime when
available.
--*/
#include "pal/corunix.hpp"
#include "pal/dbgmsg.h"
#include "pal/filetime.h"
#include "pal/thread.hpp"
#include "pal/file.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <utime.h>
#include <time.h>
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif // HAVE_SYS_TIME_H
using namespace CorUnix;
SET_DEFAULT_DEBUG_CHANNEL(FILE);
// In safemath.h, Template SafeInt uses macro _ASSERTE, which need to use variable
// defdbgchan defined by SET_DEFAULT_DEBUG_CHANNEL. Therefore, the include statement
// should be placed after the SET_DEFAULT_DEBUG_CHANNEL(FILE)
#include <safemath.h>
/* Magic number explanation:
To 1970:
Both epochs are Gregorian. 1970 - 1601 = 369. Assuming a leap
year every four years, 369 / 4 = 92. However, 1700, 1800, and 1900
were NOT leap years, so 89 leap years, 280 non-leap years.
89 * 366 + 280 * 365 = 134774 days between epochs. Of course
60 * 60 * 24 = 86400 seconds per day, so 134774 * 86400 =
11644473600 = SECS_BETWEEN_1601_AND_1970_EPOCHS.
To 2001:
Again, both epochs are Gregorian. 2001 - 1601 = 400. Assuming a leap
year every four years, 400 / 4 = 100. However, 1700, 1800, and 1900
were NOT leap years (2000 was because it was divisible by 400), so
97 leap years, 303 non-leap years.
97 * 366 + 303 * 365 = 146097 days between epochs. 146097 * 86400 =
12622780800 = SECS_BETWEEN_1601_AND_2001_EPOCHS.
This result is also confirmed in the MSDN documentation on how
to convert a time_t value to a win32 FILETIME.
*/
static const __int64 SECS_BETWEEN_1601_AND_1970_EPOCHS = 11644473600LL;
static const __int64 SECS_TO_100NS = 10000000; /* 10^7 */
#ifdef __APPLE__
static const __int64 SECS_BETWEEN_1601_AND_2001_EPOCHS = 12622780800LL;
#endif // __APPLE__
/*++
Function:
CompareFileTime
See MSDN doc.
--*/
LONG
PALAPI
CompareFileTime(
IN CONST FILETIME *lpFileTime1,
IN CONST FILETIME *lpFileTime2)
{
__int64 First;
__int64 Second;
long Ret;
PERF_ENTRY(CompareFileTime);
ENTRY("CompareFileTime(lpFileTime1=%p lpFileTime2=%p)\n",
lpFileTime1, lpFileTime2);
First = ((__int64)lpFileTime1->dwHighDateTime << 32) +
lpFileTime1->dwLowDateTime;
Second = ((__int64)lpFileTime2->dwHighDateTime << 32) +
lpFileTime2->dwLowDateTime;
if ( First < Second )
{
Ret = -1;
}
else if ( First > Second )
{
Ret = 1;
}
else
{
Ret = 0;
}
LOGEXIT("CompareFileTime returns LONG %ld\n", Ret);
PERF_EXIT(CompareFileTime);
return Ret;
}
/*++
Function:
GetSystemTimeAsFileTime
See MSDN doc.
--*/
VOID
PALAPI
GetSystemTimeAsFileTime(
OUT LPFILETIME lpSystemTimeAsFileTime)
{
PERF_ENTRY(GetSystemTimeAsFileTime);
ENTRY("GetSystemTimeAsFileTime(lpSystemTimeAsFileTime=%p)\n",
lpSystemTimeAsFileTime);
#if HAVE_WORKING_CLOCK_GETTIME
struct timespec Time;
if (clock_gettime(CLOCK_REALTIME, &Time) == 0)
{
*lpSystemTimeAsFileTime = FILEUnixTimeToFileTime( Time.tv_sec, Time.tv_nsec );
}
#else
struct timeval Time;
if (gettimeofday(&Time, NULL) == 0)
{
/* use (tv_usec * 1000) because 2nd arg is in nanoseconds */
*lpSystemTimeAsFileTime = FILEUnixTimeToFileTime( Time.tv_sec, Time.tv_usec * 1000);
}
#endif
else
{
/* no way to indicate failure, so set time to zero */
ASSERT("clock_gettime or gettimeofday failed");
*lpSystemTimeAsFileTime = FILEUnixTimeToFileTime( 0, 0 );
}
LOGEXIT("GetSystemTimeAsFileTime returns.\n");
PERF_EXIT(GetSystemTimeAsFileTime);
}
#ifdef __APPLE__
/*++
Function:
FILECFAbsoluteTimeToFileTime
Convert a CFAbsoluteTime value to a win32 FILETIME structure, as described
in MSDN documentation. CFAbsoluteTime is the number of seconds elapsed since
00:00 01 January 2001 UTC (Mac OS X epoch), while FILETIME represents a
64-bit number of 100-nanosecond intervals that have passed since 00:00
01 January 1601 UTC (win32 epoch).
--*/
FILETIME FILECFAbsoluteTimeToFileTime( CFAbsoluteTime sec )
{
__int64 Result;
FILETIME Ret;
Result = ((__int64)sec + SECS_BETWEEN_1601_AND_2001_EPOCHS) * SECS_TO_100NS;
Ret.dwLowDateTime = (DWORD)Result;
Ret.dwHighDateTime = (DWORD)(Result >> 32);
TRACE("CFAbsoluteTime = [%9f] converts to Win32 FILETIME = [%#x:%#x]\n",
sec, Ret.dwHighDateTime, Ret.dwLowDateTime);
return Ret;
}
#endif // __APPLE__
/*++
Function:
FILEUnixTimeToFileTime
Convert a time_t value to a win32 FILETIME structure, as described in
MSDN documentation. time_t is the number of seconds elapsed since
00:00 01 January 1970 UTC (Unix epoch), while FILETIME represents a
64-bit number of 100-nanosecond intervals that have passed since 00:00
01 January 1601 UTC (win32 epoch).
--*/
FILETIME FILEUnixTimeToFileTime( time_t sec, long nsec )
{
__int64 Result;
FILETIME Ret;
Result = ((__int64)sec + SECS_BETWEEN_1601_AND_1970_EPOCHS) * SECS_TO_100NS +
(nsec / 100);
Ret.dwLowDateTime = (DWORD)Result;
Ret.dwHighDateTime = (DWORD)(Result >> 32);
TRACE("Unix time = [%ld.%09ld] converts to Win32 FILETIME = [%#x:%#x]\n",
sec, nsec, Ret.dwHighDateTime, Ret.dwLowDateTime);
return Ret;
}
/**
Function
FileTimeToSystemTime()
Helper function for FileTimeToDosTime.
Converts the necessary file time attributes to system time, for
easier manipulation in FileTimeToDosTime.
--*/
BOOL PALAPI FileTimeToSystemTime( CONST FILETIME * lpFileTime,
LPSYSTEMTIME lpSystemTime )
{
UINT64 FileTime = 0;
time_t UnixFileTime = 0;
struct tm * UnixSystemTime = 0;
/* Combine the file time. */
FileTime = lpFileTime->dwHighDateTime;
FileTime <<= 32;
FileTime |= (UINT)lpFileTime->dwLowDateTime;
bool isSafe = ClrSafeInt<UINT64>::subtraction(
FileTime,
SECS_BETWEEN_1601_AND_1970_EPOCHS * SECS_TO_100NS,
FileTime);
if (isSafe == true)
{
#if HAVE_GMTIME_R
struct tm timeBuf;
#endif /* HAVE_GMTIME_R */
/* Convert file time to unix time. */
if (((INT64)FileTime) < 0)
{
UnixFileTime = -1 - ( ( -FileTime - 1 ) / 10000000 );
}
else
{
UnixFileTime = FileTime / 10000000;
}
/* Convert unix file time to Unix System time. */
#if HAVE_GMTIME_R
UnixSystemTime = gmtime_r( &UnixFileTime, &timeBuf );
#else /* HAVE_GMTIME_R */
UnixSystemTime = gmtime( &UnixFileTime );
#endif /* HAVE_GMTIME_R */
/* Convert unix system time to Windows system time. */
lpSystemTime->wDay = UnixSystemTime->tm_mday;
/* Unix time counts January as a 0, under Windows it is 1*/
lpSystemTime->wMonth = UnixSystemTime->tm_mon + 1;
/* Unix time returns the year - 1900, Windows returns the current year*/
lpSystemTime->wYear = UnixSystemTime->tm_year + 1900;
lpSystemTime->wSecond = UnixSystemTime->tm_sec;
lpSystemTime->wMinute = UnixSystemTime->tm_min;
lpSystemTime->wHour = UnixSystemTime->tm_hour;
return TRUE;
}
else
{
ERROR( "The file time is to large.\n" );
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/external/rapidjson/document.h
|
// Tencent is pleased to support the open source community by making RapidJSON available.
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#ifndef RAPIDJSON_DOCUMENT_H_
#define RAPIDJSON_DOCUMENT_H_
/*! \file document.h */
#include "reader.h"
#include "internal/meta.h"
#include "internal/strfunc.h"
#include "memorystream.h"
#include "encodedstream.h"
#include <new> // placement new
#include <limits>
RAPIDJSON_DIAG_PUSH
#ifdef __clang__
RAPIDJSON_DIAG_OFF(padded)
RAPIDJSON_DIAG_OFF(switch-enum)
RAPIDJSON_DIAG_OFF(c++98-compat)
#elif defined(_MSC_VER)
RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible loss of data
#endif
#ifdef __GNUC__
RAPIDJSON_DIAG_OFF(effc++)
#endif // __GNUC__
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
#include <iterator> // std::random_access_iterator_tag
#endif
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
#include <utility> // std::move
#endif
RAPIDJSON_NAMESPACE_BEGIN
// Forward declaration.
template <typename Encoding, typename Allocator>
class GenericValue;
template <typename Encoding, typename Allocator, typename StackAllocator>
class GenericDocument;
//! Name-value pair in a JSON object value.
/*!
This class was internal to GenericValue. It used to be a inner struct.
But a compiler (IBM XL C/C++ for AIX) have reported to have problem with that so it moved as a namespace scope struct.
https://code.google.com/p/rapidjson/issues/detail?id=64
*/
template <typename Encoding, typename Allocator>
struct GenericMember {
GenericValue<Encoding, Allocator> name; //!< name of member (must be a string)
GenericValue<Encoding, Allocator> value; //!< value of member.
// swap() for std::sort() and other potential use in STL.
friend inline void swap(GenericMember& a, GenericMember& b) RAPIDJSON_NOEXCEPT {
a.name.Swap(b.name);
a.value.Swap(b.value);
}
};
///////////////////////////////////////////////////////////////////////////////
// GenericMemberIterator
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
//! (Constant) member iterator for a JSON object value
/*!
\tparam Const Is this a constant iterator?
\tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document)
\tparam Allocator Allocator type for allocating memory of object, array and string.
This class implements a Random Access Iterator for GenericMember elements
of a GenericValue, see ISO/IEC 14882:2003(E) C++ standard, 24.1 [lib.iterator.requirements].
\note This iterator implementation is mainly intended to avoid implicit
conversions from iterator values to \c NULL,
e.g. from GenericValue::FindMember.
\note Define \c RAPIDJSON_NOMEMBERITERATORCLASS to fall back to a
pointer-based implementation, if your platform doesn't provide
the C++ <iterator> header.
\see GenericMember, GenericValue::MemberIterator, GenericValue::ConstMemberIterator
*/
template <bool Const, typename Encoding, typename Allocator>
class GenericMemberIterator {
friend class GenericValue<Encoding,Allocator>;
template <bool, typename, typename> friend class GenericMemberIterator;
typedef GenericMember<Encoding,Allocator> PlainType;
typedef typename internal::MaybeAddConst<Const,PlainType>::Type ValueType;
public:
//! Iterator type itself
typedef GenericMemberIterator Iterator;
//! Constant iterator type
typedef GenericMemberIterator<true,Encoding,Allocator> ConstIterator;
//! Non-constant iterator type
typedef GenericMemberIterator<false,Encoding,Allocator> NonConstIterator;
/** \name std::iterator_traits support */
//@{
typedef ValueType value_type;
typedef ValueType * pointer;
typedef ValueType & reference;
typedef std::ptrdiff_t difference_type;
typedef std::random_access_iterator_tag iterator_category;
//@}
//! Pointer to (const) GenericMember
typedef pointer Pointer;
//! Reference to (const) GenericMember
typedef reference Reference;
//! Signed integer type (e.g. \c ptrdiff_t)
typedef difference_type DifferenceType;
//! Default constructor (singular value)
/*! Creates an iterator pointing to no element.
\note All operations, except for comparisons, are undefined on such values.
*/
GenericMemberIterator() : ptr_() {}
//! Iterator conversions to more const
/*!
\param it (Non-const) iterator to copy from
Allows the creation of an iterator from another GenericMemberIterator
that is "less const". Especially, creating a non-constant iterator
from a constant iterator are disabled:
\li const -> non-const (not ok)
\li const -> const (ok)
\li non-const -> const (ok)
\li non-const -> non-const (ok)
\note If the \c Const template parameter is already \c false, this
constructor effectively defines a regular copy-constructor.
Otherwise, the copy constructor is implicitly defined.
*/
GenericMemberIterator(const NonConstIterator & it) : ptr_(it.ptr_) {}
Iterator& operator=(const NonConstIterator & it) { ptr_ = it.ptr_; return *this; }
//! @name stepping
//@{
Iterator& operator++(){ ++ptr_; return *this; }
Iterator& operator--(){ --ptr_; return *this; }
Iterator operator++(int){ Iterator old(*this); ++ptr_; return old; }
Iterator operator--(int){ Iterator old(*this); --ptr_; return old; }
//@}
//! @name increment/decrement
//@{
Iterator operator+(DifferenceType n) const { return Iterator(ptr_+n); }
Iterator operator-(DifferenceType n) const { return Iterator(ptr_-n); }
Iterator& operator+=(DifferenceType n) { ptr_+=n; return *this; }
Iterator& operator-=(DifferenceType n) { ptr_-=n; return *this; }
//@}
//! @name relations
//@{
bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; }
bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; }
bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; }
bool operator>=(ConstIterator that) const { return ptr_ >= that.ptr_; }
bool operator< (ConstIterator that) const { return ptr_ < that.ptr_; }
bool operator> (ConstIterator that) const { return ptr_ > that.ptr_; }
//@}
//! @name dereference
//@{
Reference operator*() const { return *ptr_; }
Pointer operator->() const { return ptr_; }
Reference operator[](DifferenceType n) const { return ptr_[n]; }
//@}
//! Distance
DifferenceType operator-(ConstIterator that) const { return ptr_-that.ptr_; }
private:
//! Internal constructor from plain pointer
explicit GenericMemberIterator(Pointer p) : ptr_(p) {}
Pointer ptr_; //!< raw pointer
};
#else // RAPIDJSON_NOMEMBERITERATORCLASS
// class-based member iterator implementation disabled, use plain pointers
template <bool Const, typename Encoding, typename Allocator>
class GenericMemberIterator;
//! non-const GenericMemberIterator
template <typename Encoding, typename Allocator>
class GenericMemberIterator<false,Encoding,Allocator> {
//! use plain pointer as iterator type
typedef GenericMember<Encoding,Allocator>* Iterator;
};
//! const GenericMemberIterator
template <typename Encoding, typename Allocator>
class GenericMemberIterator<true,Encoding,Allocator> {
//! use plain const pointer as iterator type
typedef const GenericMember<Encoding,Allocator>* Iterator;
};
#endif // RAPIDJSON_NOMEMBERITERATORCLASS
///////////////////////////////////////////////////////////////////////////////
// GenericStringRef
//! Reference to a constant string (not taking a copy)
/*!
\tparam CharType character type of the string
This helper class is used to automatically infer constant string
references for string literals, especially from \c const \b (!)
character arrays.
The main use is for creating JSON string values without copying the
source string via an \ref Allocator. This requires that the referenced
string pointers have a sufficient lifetime, which exceeds the lifetime
of the associated GenericValue.
\b Example
\code
Value v("foo"); // ok, no need to copy & calculate length
const char foo[] = "foo";
v.SetString(foo); // ok
const char* bar = foo;
// Value x(bar); // not ok, can't rely on bar's lifetime
Value x(StringRef(bar)); // lifetime explicitly guaranteed by user
Value y(StringRef(bar, 3)); // ok, explicitly pass length
\endcode
\see StringRef, GenericValue::SetString
*/
template<typename CharType>
struct GenericStringRef {
typedef CharType Ch; //!< character type of the string
//! Create string reference from \c const character array
#ifndef __clang__ // -Wdocumentation
/*!
This constructor implicitly creates a constant string reference from
a \c const character array. It has better performance than
\ref StringRef(const CharType*) by inferring the string \ref length
from the array length, and also supports strings containing null
characters.
\tparam N length of the string, automatically inferred
\param str Constant character array, lifetime assumed to be longer
than the use of the string in e.g. a GenericValue
\post \ref s == str
\note Constant complexity.
\note There is a hidden, private overload to disallow references to
non-const character arrays to be created via this constructor.
By this, e.g. function-scope arrays used to be filled via
\c snprintf are excluded from consideration.
In such cases, the referenced string should be \b copied to the
GenericValue instead.
*/
#endif
template<SizeType N>
GenericStringRef(const CharType (&str)[N]) RAPIDJSON_NOEXCEPT
: s(str), length(N-1) {}
//! Explicitly create string reference from \c const character pointer
#ifndef __clang__ // -Wdocumentation
/*!
This constructor can be used to \b explicitly create a reference to
a constant string pointer.
\see StringRef(const CharType*)
\param str Constant character pointer, lifetime assumed to be longer
than the use of the string in e.g. a GenericValue
\post \ref s == str
\note There is a hidden, private overload to disallow references to
non-const character arrays to be created via this constructor.
By this, e.g. function-scope arrays used to be filled via
\c snprintf are excluded from consideration.
In such cases, the referenced string should be \b copied to the
GenericValue instead.
*/
#endif
explicit GenericStringRef(const CharType* str)
: s(str), length(NotNullStrLen(str)) {}
//! Create constant string reference from pointer and length
#ifndef __clang__ // -Wdocumentation
/*! \param str constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
\param len length of the string, excluding the trailing NULL terminator
\post \ref s == str && \ref length == len
\note Constant complexity.
*/
#endif
GenericStringRef(const CharType* str, SizeType len)
: s(RAPIDJSON_LIKELY(str) ? str : emptyString), length(len) { RAPIDJSON_ASSERT(str != 0 || len == 0u); }
GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {}
//! implicit conversion to plain CharType pointer
operator const Ch *() const { return s; }
const Ch* const s; //!< plain CharType pointer
const SizeType length; //!< length of the string (excluding the trailing NULL terminator)
private:
SizeType NotNullStrLen(const CharType* str) {
RAPIDJSON_ASSERT(str != 0);
return internal::StrLen(str);
}
/// Empty string - used when passing in a NULL pointer
static const Ch emptyString[];
//! Disallow construction from non-const array
template<SizeType N>
GenericStringRef(CharType (&str)[N]) /* = delete */;
//! Copy assignment operator not permitted - immutable type
GenericStringRef& operator=(const GenericStringRef& rhs) /* = delete */;
};
template<typename CharType>
const CharType GenericStringRef<CharType>::emptyString[] = { CharType() };
//! Mark a character pointer as constant string
/*! Mark a plain character pointer as a "string literal". This function
can be used to avoid copying a character string to be referenced as a
value in a JSON GenericValue object, if the string's lifetime is known
to be valid long enough.
\tparam CharType Character type of the string
\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
\return GenericStringRef string reference object
\relatesalso GenericStringRef
\see GenericValue::GenericValue(StringRefType), GenericValue::operator=(StringRefType), GenericValue::SetString(StringRefType), GenericValue::PushBack(StringRefType, Allocator&), GenericValue::AddMember
*/
template<typename CharType>
inline GenericStringRef<CharType> StringRef(const CharType* str) {
return GenericStringRef<CharType>(str);
}
//! Mark a character pointer as constant string
/*! Mark a plain character pointer as a "string literal". This function
can be used to avoid copying a character string to be referenced as a
value in a JSON GenericValue object, if the string's lifetime is known
to be valid long enough.
This version has better performance with supplied length, and also
supports string containing null characters.
\tparam CharType character type of the string
\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
\param length The length of source string.
\return GenericStringRef string reference object
\relatesalso GenericStringRef
*/
template<typename CharType>
inline GenericStringRef<CharType> StringRef(const CharType* str, size_t length) {
return GenericStringRef<CharType>(str, SizeType(length));
}
#if RAPIDJSON_HAS_STDSTRING
//! Mark a string object as constant string
/*! Mark a string object (e.g. \c std::string) as a "string literal".
This function can be used to avoid copying a string to be referenced as a
value in a JSON GenericValue object, if the string's lifetime is known
to be valid long enough.
\tparam CharType character type of the string
\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
\return GenericStringRef string reference object
\relatesalso GenericStringRef
\note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
template<typename CharType>
inline GenericStringRef<CharType> StringRef(const std::basic_string<CharType>& str) {
return GenericStringRef<CharType>(str.data(), SizeType(str.size()));
}
#endif
///////////////////////////////////////////////////////////////////////////////
// GenericValue type traits
namespace internal {
template <typename T, typename Encoding = void, typename Allocator = void>
struct IsGenericValueImpl : FalseType {};
// select candidates according to nested encoding and allocator types
template <typename T> struct IsGenericValueImpl<T, typename Void<typename T::EncodingType>::Type, typename Void<typename T::AllocatorType>::Type>
: IsBaseOf<GenericValue<typename T::EncodingType, typename T::AllocatorType>, T>::Type {};
// helper to match arbitrary GenericValue instantiations, including derived classes
template <typename T> struct IsGenericValue : IsGenericValueImpl<T>::Type {};
} // namespace internal
///////////////////////////////////////////////////////////////////////////////
// TypeHelper
namespace internal {
template <typename ValueType, typename T>
struct TypeHelper {};
template<typename ValueType>
struct TypeHelper<ValueType, bool> {
static bool Is(const ValueType& v) { return v.IsBool(); }
static bool Get(const ValueType& v) { return v.GetBool(); }
static ValueType& Set(ValueType& v, bool data) { return v.SetBool(data); }
static ValueType& Set(ValueType& v, bool data, typename ValueType::AllocatorType&) { return v.SetBool(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, int> {
static bool Is(const ValueType& v) { return v.IsInt(); }
static int Get(const ValueType& v) { return v.GetInt(); }
static ValueType& Set(ValueType& v, int data) { return v.SetInt(data); }
static ValueType& Set(ValueType& v, int data, typename ValueType::AllocatorType&) { return v.SetInt(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, unsigned> {
static bool Is(const ValueType& v) { return v.IsUint(); }
static unsigned Get(const ValueType& v) { return v.GetUint(); }
static ValueType& Set(ValueType& v, unsigned data) { return v.SetUint(data); }
static ValueType& Set(ValueType& v, unsigned data, typename ValueType::AllocatorType&) { return v.SetUint(data); }
};
#ifdef _MSC_VER
RAPIDJSON_STATIC_ASSERT(sizeof(long) == sizeof(int));
template<typename ValueType>
struct TypeHelper<ValueType, long> {
static bool Is(const ValueType& v) { return v.IsInt(); }
static long Get(const ValueType& v) { return v.GetInt(); }
static ValueType& Set(ValueType& v, long data) { return v.SetInt(data); }
static ValueType& Set(ValueType& v, long data, typename ValueType::AllocatorType&) { return v.SetInt(data); }
};
RAPIDJSON_STATIC_ASSERT(sizeof(unsigned long) == sizeof(unsigned));
template<typename ValueType>
struct TypeHelper<ValueType, unsigned long> {
static bool Is(const ValueType& v) { return v.IsUint(); }
static unsigned long Get(const ValueType& v) { return v.GetUint(); }
static ValueType& Set(ValueType& v, unsigned long data) { return v.SetUint(data); }
static ValueType& Set(ValueType& v, unsigned long data, typename ValueType::AllocatorType&) { return v.SetUint(data); }
};
#endif
template<typename ValueType>
struct TypeHelper<ValueType, int64_t> {
static bool Is(const ValueType& v) { return v.IsInt64(); }
static int64_t Get(const ValueType& v) { return v.GetInt64(); }
static ValueType& Set(ValueType& v, int64_t data) { return v.SetInt64(data); }
static ValueType& Set(ValueType& v, int64_t data, typename ValueType::AllocatorType&) { return v.SetInt64(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, uint64_t> {
static bool Is(const ValueType& v) { return v.IsUint64(); }
static uint64_t Get(const ValueType& v) { return v.GetUint64(); }
static ValueType& Set(ValueType& v, uint64_t data) { return v.SetUint64(data); }
static ValueType& Set(ValueType& v, uint64_t data, typename ValueType::AllocatorType&) { return v.SetUint64(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, double> {
static bool Is(const ValueType& v) { return v.IsDouble(); }
static double Get(const ValueType& v) { return v.GetDouble(); }
static ValueType& Set(ValueType& v, double data) { return v.SetDouble(data); }
static ValueType& Set(ValueType& v, double data, typename ValueType::AllocatorType&) { return v.SetDouble(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, float> {
static bool Is(const ValueType& v) { return v.IsFloat(); }
static float Get(const ValueType& v) { return v.GetFloat(); }
static ValueType& Set(ValueType& v, float data) { return v.SetFloat(data); }
static ValueType& Set(ValueType& v, float data, typename ValueType::AllocatorType&) { return v.SetFloat(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, const typename ValueType::Ch*> {
typedef const typename ValueType::Ch* StringType;
static bool Is(const ValueType& v) { return v.IsString(); }
static StringType Get(const ValueType& v) { return v.GetString(); }
static ValueType& Set(ValueType& v, const StringType data) { return v.SetString(typename ValueType::StringRefType(data)); }
static ValueType& Set(ValueType& v, const StringType data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); }
};
#if RAPIDJSON_HAS_STDSTRING
template<typename ValueType>
struct TypeHelper<ValueType, std::basic_string<typename ValueType::Ch> > {
typedef std::basic_string<typename ValueType::Ch> StringType;
static bool Is(const ValueType& v) { return v.IsString(); }
static StringType Get(const ValueType& v) { return StringType(v.GetString(), v.GetStringLength()); }
static ValueType& Set(ValueType& v, const StringType& data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); }
};
#endif
template<typename ValueType>
struct TypeHelper<ValueType, typename ValueType::Array> {
typedef typename ValueType::Array ArrayType;
static bool Is(const ValueType& v) { return v.IsArray(); }
static ArrayType Get(ValueType& v) { return v.GetArray(); }
static ValueType& Set(ValueType& v, ArrayType data) { return v = data; }
static ValueType& Set(ValueType& v, ArrayType data, typename ValueType::AllocatorType&) { return v = data; }
};
template<typename ValueType>
struct TypeHelper<ValueType, typename ValueType::ConstArray> {
typedef typename ValueType::ConstArray ArrayType;
static bool Is(const ValueType& v) { return v.IsArray(); }
static ArrayType Get(const ValueType& v) { return v.GetArray(); }
};
template<typename ValueType>
struct TypeHelper<ValueType, typename ValueType::Object> {
typedef typename ValueType::Object ObjectType;
static bool Is(const ValueType& v) { return v.IsObject(); }
static ObjectType Get(ValueType& v) { return v.GetObject(); }
static ValueType& Set(ValueType& v, ObjectType data) { return v = data; }
static ValueType& Set(ValueType& v, ObjectType data, typename ValueType::AllocatorType&) { return v = data; }
};
template<typename ValueType>
struct TypeHelper<ValueType, typename ValueType::ConstObject> {
typedef typename ValueType::ConstObject ObjectType;
static bool Is(const ValueType& v) { return v.IsObject(); }
static ObjectType Get(const ValueType& v) { return v.GetObject(); }
};
} // namespace internal
// Forward declarations
template <bool, typename> class GenericArray;
template <bool, typename> class GenericObject;
///////////////////////////////////////////////////////////////////////////////
// GenericValue
//! Represents a JSON value. Use Value for UTF8 encoding and default allocator.
/*!
A JSON value can be one of 7 types. This class is a variant type supporting
these types.
Use the Value if UTF8 and default allocator
\tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document)
\tparam Allocator Allocator type for allocating memory of object, array and string.
*/
template <typename Encoding, typename Allocator = MemoryPoolAllocator<> >
class GenericValue {
public:
//! Name-value pair in an object.
typedef GenericMember<Encoding, Allocator> Member;
typedef Encoding EncodingType; //!< Encoding type from template parameter.
typedef Allocator AllocatorType; //!< Allocator type from template parameter.
typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding.
typedef GenericStringRef<Ch> StringRefType; //!< Reference to a constant string
typedef typename GenericMemberIterator<false,Encoding,Allocator>::Iterator MemberIterator; //!< Member iterator for iterating in object.
typedef typename GenericMemberIterator<true,Encoding,Allocator>::Iterator ConstMemberIterator; //!< Constant member iterator for iterating in object.
typedef GenericValue* ValueIterator; //!< Value iterator for iterating in array.
typedef const GenericValue* ConstValueIterator; //!< Constant value iterator for iterating in array.
typedef GenericValue<Encoding, Allocator> ValueType; //!< Value type of itself.
typedef GenericArray<false, ValueType> Array;
typedef GenericArray<true, ValueType> ConstArray;
typedef GenericObject<false, ValueType> Object;
typedef GenericObject<true, ValueType> ConstObject;
//!@name Constructors and destructor.
//@{
//! Default constructor creates a null value.
GenericValue() RAPIDJSON_NOEXCEPT : data_() { data_.f.flags = kNullFlag; }
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Move constructor in C++11
GenericValue(GenericValue&& rhs) RAPIDJSON_NOEXCEPT : data_(rhs.data_) {
rhs.data_.f.flags = kNullFlag; // give up contents
}
#endif
private:
//! Copy constructor is not permitted.
GenericValue(const GenericValue& rhs);
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Moving from a GenericDocument is not permitted.
template <typename StackAllocator>
GenericValue(GenericDocument<Encoding,Allocator,StackAllocator>&& rhs);
//! Move assignment from a GenericDocument is not permitted.
template <typename StackAllocator>
GenericValue& operator=(GenericDocument<Encoding,Allocator,StackAllocator>&& rhs);
#endif
public:
//! Constructor with JSON value type.
/*! This creates a Value of specified type with default content.
\param type Type of the value.
\note Default content for number is zero.
*/
explicit GenericValue(Type type) RAPIDJSON_NOEXCEPT : data_() {
static const uint16_t defaultFlags[] = {
kNullFlag, kFalseFlag, kTrueFlag, kObjectFlag, kArrayFlag, kShortStringFlag,
kNumberAnyFlag
};
RAPIDJSON_NOEXCEPT_ASSERT(type >= kNullType && type <= kNumberType);
data_.f.flags = defaultFlags[type];
// Use ShortString to store empty string.
if (type == kStringType)
data_.ss.SetLength(0);
}
//! Explicit copy constructor (with allocator)
/*! Creates a copy of a Value by using the given Allocator
\tparam SourceAllocator allocator of \c rhs
\param rhs Value to copy from (read-only)
\param allocator Allocator for allocating copied elements and buffers. Commonly use GenericDocument::GetAllocator().
\param copyConstStrings Force copying of constant strings (e.g. referencing an in-situ buffer)
\see CopyFrom()
*/
template <typename SourceAllocator>
GenericValue(const GenericValue<Encoding,SourceAllocator>& rhs, Allocator& allocator, bool copyConstStrings = false) {
switch (rhs.GetType()) {
case kObjectType: {
SizeType count = rhs.data_.o.size;
Member* lm = reinterpret_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
const typename GenericValue<Encoding,SourceAllocator>::Member* rm = rhs.GetMembersPointer();
for (SizeType i = 0; i < count; i++) {
new (&lm[i].name) GenericValue(rm[i].name, allocator, copyConstStrings);
new (&lm[i].value) GenericValue(rm[i].value, allocator, copyConstStrings);
}
data_.f.flags = kObjectFlag;
data_.o.size = data_.o.capacity = count;
SetMembersPointer(lm);
}
break;
case kArrayType: {
SizeType count = rhs.data_.a.size;
GenericValue* le = reinterpret_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
const GenericValue<Encoding,SourceAllocator>* re = rhs.GetElementsPointer();
for (SizeType i = 0; i < count; i++)
new (&le[i]) GenericValue(re[i], allocator, copyConstStrings);
data_.f.flags = kArrayFlag;
data_.a.size = data_.a.capacity = count;
SetElementsPointer(le);
}
break;
case kStringType:
if (rhs.data_.f.flags == kConstStringFlag && !copyConstStrings) {
data_.f.flags = rhs.data_.f.flags;
data_ = *reinterpret_cast<const Data*>(&rhs.data_);
}
else
SetStringRaw(StringRef(rhs.GetString(), rhs.GetStringLength()), allocator);
break;
default:
data_.f.flags = rhs.data_.f.flags;
data_ = *reinterpret_cast<const Data*>(&rhs.data_);
break;
}
}
//! Constructor for boolean value.
/*! \param b Boolean value
\note This constructor is limited to \em real boolean values and rejects
implicitly converted types like arbitrary pointers. Use an explicit cast
to \c bool, if you want to construct a boolean JSON value in such cases.
*/
#ifndef RAPIDJSON_DOXYGEN_RUNNING // hide SFINAE from Doxygen
template <typename T>
explicit GenericValue(T b, RAPIDJSON_ENABLEIF((internal::IsSame<bool, T>))) RAPIDJSON_NOEXCEPT // See #472
#else
explicit GenericValue(bool b) RAPIDJSON_NOEXCEPT
#endif
: data_() {
// safe-guard against failing SFINAE
RAPIDJSON_STATIC_ASSERT((internal::IsSame<bool,T>::Value));
data_.f.flags = b ? kTrueFlag : kFalseFlag;
}
//! Constructor for int value.
explicit GenericValue(int i) RAPIDJSON_NOEXCEPT : data_() {
data_.n.i64 = i;
data_.f.flags = (i >= 0) ? (kNumberIntFlag | kUintFlag | kUint64Flag) : kNumberIntFlag;
}
//! Constructor for unsigned value.
explicit GenericValue(unsigned u) RAPIDJSON_NOEXCEPT : data_() {
data_.n.u64 = u;
data_.f.flags = (u & 0x80000000) ? kNumberUintFlag : (kNumberUintFlag | kIntFlag | kInt64Flag);
}
//! Constructor for int64_t value.
explicit GenericValue(int64_t i64) RAPIDJSON_NOEXCEPT : data_() {
data_.n.i64 = i64;
data_.f.flags = kNumberInt64Flag;
if (i64 >= 0) {
data_.f.flags |= kNumberUint64Flag;
if (!(static_cast<uint64_t>(i64) & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x00000000)))
data_.f.flags |= kUintFlag;
if (!(static_cast<uint64_t>(i64) & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
data_.f.flags |= kIntFlag;
}
else if (i64 >= static_cast<int64_t>(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
data_.f.flags |= kIntFlag;
}
//! Constructor for uint64_t value.
explicit GenericValue(uint64_t u64) RAPIDJSON_NOEXCEPT : data_() {
data_.n.u64 = u64;
data_.f.flags = kNumberUint64Flag;
if (!(u64 & RAPIDJSON_UINT64_C2(0x80000000, 0x00000000)))
data_.f.flags |= kInt64Flag;
if (!(u64 & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x00000000)))
data_.f.flags |= kUintFlag;
if (!(u64 & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
data_.f.flags |= kIntFlag;
}
//! Constructor for double value.
explicit GenericValue(double d) RAPIDJSON_NOEXCEPT : data_() { data_.n.d = d; data_.f.flags = kNumberDoubleFlag; }
//! Constructor for float value.
explicit GenericValue(float f) RAPIDJSON_NOEXCEPT : data_() { data_.n.d = static_cast<double>(f); data_.f.flags = kNumberDoubleFlag; }
//! Constructor for constant string (i.e. do not make a copy of string)
GenericValue(const Ch* s, SizeType length) RAPIDJSON_NOEXCEPT : data_() { SetStringRaw(StringRef(s, length)); }
//! Constructor for constant string (i.e. do not make a copy of string)
explicit GenericValue(StringRefType s) RAPIDJSON_NOEXCEPT : data_() { SetStringRaw(s); }
//! Constructor for copy-string (i.e. do make a copy of string)
GenericValue(const Ch* s, SizeType length, Allocator& allocator) : data_() { SetStringRaw(StringRef(s, length), allocator); }
//! Constructor for copy-string (i.e. do make a copy of string)
GenericValue(const Ch*s, Allocator& allocator) : data_() { SetStringRaw(StringRef(s), allocator); }
#if RAPIDJSON_HAS_STDSTRING
//! Constructor for copy-string from a string object (i.e. do make a copy of string)
/*! \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
GenericValue(const std::basic_string<Ch>& s, Allocator& allocator) : data_() { SetStringRaw(StringRef(s), allocator); }
#endif
//! Constructor for Array.
/*!
\param a An array obtained by \c GetArray().
\note \c Array is always pass-by-value.
\note the source array is moved into this value and the sourec array becomes empty.
*/
GenericValue(Array a) RAPIDJSON_NOEXCEPT : data_(a.value_.data_) {
a.value_.data_ = Data();
a.value_.data_.f.flags = kArrayFlag;
}
//! Constructor for Object.
/*!
\param o An object obtained by \c GetObject().
\note \c Object is always pass-by-value.
\note the source object is moved into this value and the sourec object becomes empty.
*/
GenericValue(Object o) RAPIDJSON_NOEXCEPT : data_(o.value_.data_) {
o.value_.data_ = Data();
o.value_.data_.f.flags = kObjectFlag;
}
//! Destructor.
/*! Need to destruct elements of array, members of object, or copy-string.
*/
~GenericValue() {
if (Allocator::kNeedFree) { // Shortcut by Allocator's trait
switch(data_.f.flags) {
case kArrayFlag:
{
GenericValue* e = GetElementsPointer();
for (GenericValue* v = e; v != e + data_.a.size; ++v)
v->~GenericValue();
Allocator::Free(e);
}
break;
case kObjectFlag:
for (MemberIterator m = MemberBegin(); m != MemberEnd(); ++m)
m->~Member();
Allocator::Free(GetMembersPointer());
break;
case kCopyStringFlag:
Allocator::Free(const_cast<Ch*>(GetStringPointer()));
break;
default:
break; // Do nothing for other types.
}
}
}
//@}
//!@name Assignment operators
//@{
//! Assignment with move semantics.
/*! \param rhs Source of the assignment. It will become a null value after assignment.
*/
GenericValue& operator=(GenericValue& rhs) RAPIDJSON_NOEXCEPT {
if (RAPIDJSON_LIKELY(this != &rhs)) {
this->~GenericValue();
RawAssign(rhs);
}
return *this;
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Move assignment in C++11
GenericValue& operator=(GenericValue&& rhs) RAPIDJSON_NOEXCEPT {
return *this = rhs.Move();
}
#endif
//! Assignment of constant string reference (no copy)
/*! \param str Constant string reference to be assigned
\note This overload is needed to avoid clashes with the generic primitive type assignment overload below.
\see GenericStringRef, operator=(T)
*/
GenericValue& operator=(StringRefType str) RAPIDJSON_NOEXCEPT {
GenericValue s(str);
return *this = s;
}
//! Assignment with primitive types.
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t
\param value The value to be assigned.
\note The source type \c T explicitly disallows all pointer types,
especially (\c const) \ref Ch*. This helps avoiding implicitly
referencing character strings with insufficient lifetime, use
\ref SetString(const Ch*, Allocator&) (for copying) or
\ref StringRef() (to explicitly mark the pointer as constant) instead.
All other pointer types would implicitly convert to \c bool,
use \ref SetBool() instead.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::IsPointer<T>), (GenericValue&))
operator=(T value) {
GenericValue v(value);
return *this = v;
}
//! Deep-copy assignment from Value
/*! Assigns a \b copy of the Value to the current Value object
\tparam SourceAllocator Allocator type of \c rhs
\param rhs Value to copy from (read-only)
\param allocator Allocator to use for copying
\param copyConstStrings Force copying of constant strings (e.g. referencing an in-situ buffer)
*/
template <typename SourceAllocator>
GenericValue& CopyFrom(const GenericValue<Encoding, SourceAllocator>& rhs, Allocator& allocator, bool copyConstStrings = false) {
RAPIDJSON_ASSERT(static_cast<void*>(this) != static_cast<void const*>(&rhs));
this->~GenericValue();
new (this) GenericValue(rhs, allocator, copyConstStrings);
return *this;
}
//! Exchange the contents of this value with those of other.
/*!
\param other Another value.
\note Constant complexity.
*/
GenericValue& Swap(GenericValue& other) RAPIDJSON_NOEXCEPT {
GenericValue temp;
temp.RawAssign(*this);
RawAssign(other);
other.RawAssign(temp);
return *this;
}
//! free-standing swap function helper
/*!
Helper function to enable support for common swap implementation pattern based on \c std::swap:
\code
void swap(MyClass& a, MyClass& b) {
using std::swap;
swap(a.value, b.value);
// ...
}
\endcode
\see Swap()
*/
friend inline void swap(GenericValue& a, GenericValue& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }
//! Prepare Value for move semantics
/*! \return *this */
GenericValue& Move() RAPIDJSON_NOEXCEPT { return *this; }
//@}
//!@name Equal-to and not-equal-to operators
//@{
//! Equal-to operator
/*!
\note If an object contains duplicated named member, comparing equality with any object is always \c false.
\note Complexity is quadratic in Object's member number and linear for the rest (number of all values in the subtree and total lengths of all strings).
*/
template <typename SourceAllocator>
bool operator==(const GenericValue<Encoding, SourceAllocator>& rhs) const {
typedef GenericValue<Encoding, SourceAllocator> RhsType;
if (GetType() != rhs.GetType())
return false;
switch (GetType()) {
case kObjectType: // Warning: O(n^2) inner-loop
if (data_.o.size != rhs.data_.o.size)
return false;
for (ConstMemberIterator lhsMemberItr = MemberBegin(); lhsMemberItr != MemberEnd(); ++lhsMemberItr) {
typename RhsType::ConstMemberIterator rhsMemberItr = rhs.FindMember(lhsMemberItr->name);
if (rhsMemberItr == rhs.MemberEnd() || lhsMemberItr->value != rhsMemberItr->value)
return false;
}
return true;
case kArrayType:
if (data_.a.size != rhs.data_.a.size)
return false;
for (SizeType i = 0; i < data_.a.size; i++)
if ((*this)[i] != rhs[i])
return false;
return true;
case kStringType:
return StringEqual(rhs);
case kNumberType:
if (IsDouble() || rhs.IsDouble()) {
double a = GetDouble(); // May convert from integer to double.
double b = rhs.GetDouble(); // Ditto
return a >= b && a <= b; // Prevent -Wfloat-equal
}
else
return data_.n.u64 == rhs.data_.n.u64;
default:
return true;
}
}
//! Equal-to operator with const C-string pointer
bool operator==(const Ch* rhs) const { return *this == GenericValue(StringRef(rhs)); }
#if RAPIDJSON_HAS_STDSTRING
//! Equal-to operator with string object
/*! \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
bool operator==(const std::basic_string<Ch>& rhs) const { return *this == GenericValue(StringRef(rhs)); }
#endif
//! Equal-to operator with primitive types
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t, \c double, \c true, \c false
*/
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>,internal::IsGenericValue<T> >), (bool)) operator==(const T& rhs) const { return *this == GenericValue(rhs); }
//! Not-equal-to operator
/*! \return !(*this == rhs)
*/
template <typename SourceAllocator>
bool operator!=(const GenericValue<Encoding, SourceAllocator>& rhs) const { return !(*this == rhs); }
//! Not-equal-to operator with const C-string pointer
bool operator!=(const Ch* rhs) const { return !(*this == rhs); }
//! Not-equal-to operator with arbitrary types
/*! \return !(*this == rhs)
*/
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue<T>), (bool)) operator!=(const T& rhs) const { return !(*this == rhs); }
//! Equal-to operator with arbitrary types (symmetric version)
/*! \return (rhs == lhs)
*/
template <typename T> friend RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue<T>), (bool)) operator==(const T& lhs, const GenericValue& rhs) { return rhs == lhs; }
//! Not-Equal-to operator with arbitrary types (symmetric version)
/*! \return !(rhs == lhs)
*/
template <typename T> friend RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue<T>), (bool)) operator!=(const T& lhs, const GenericValue& rhs) { return !(rhs == lhs); }
//@}
//!@name Type
//@{
Type GetType() const { return static_cast<Type>(data_.f.flags & kTypeMask); }
bool IsNull() const { return data_.f.flags == kNullFlag; }
bool IsFalse() const { return data_.f.flags == kFalseFlag; }
bool IsTrue() const { return data_.f.flags == kTrueFlag; }
bool IsBool() const { return (data_.f.flags & kBoolFlag) != 0; }
bool IsObject() const { return data_.f.flags == kObjectFlag; }
bool IsArray() const { return data_.f.flags == kArrayFlag; }
bool IsNumber() const { return (data_.f.flags & kNumberFlag) != 0; }
bool IsInt() const { return (data_.f.flags & kIntFlag) != 0; }
bool IsUint() const { return (data_.f.flags & kUintFlag) != 0; }
bool IsInt64() const { return (data_.f.flags & kInt64Flag) != 0; }
bool IsUint64() const { return (data_.f.flags & kUint64Flag) != 0; }
bool IsDouble() const { return (data_.f.flags & kDoubleFlag) != 0; }
bool IsString() const { return (data_.f.flags & kStringFlag) != 0; }
// Checks whether a number can be losslessly converted to a double.
bool IsLosslessDouble() const {
if (!IsNumber()) return false;
if (IsUint64()) {
uint64_t u = GetUint64();
volatile double d = static_cast<double>(u);
return (d >= 0.0)
&& (d < static_cast<double>((std::numeric_limits<uint64_t>::max)()))
&& (u == static_cast<uint64_t>(d));
}
if (IsInt64()) {
int64_t i = GetInt64();
volatile double d = static_cast<double>(i);
return (d >= static_cast<double>((std::numeric_limits<int64_t>::min)()))
&& (d < static_cast<double>((std::numeric_limits<int64_t>::max)()))
&& (i == static_cast<int64_t>(d));
}
return true; // double, int, uint are always lossless
}
// Checks whether a number is a float (possible lossy).
bool IsFloat() const {
if ((data_.f.flags & kDoubleFlag) == 0)
return false;
double d = GetDouble();
return d >= -3.4028234e38 && d <= 3.4028234e38;
}
// Checks whether a number can be losslessly converted to a float.
bool IsLosslessFloat() const {
if (!IsNumber()) return false;
double a = GetDouble();
if (a < static_cast<double>(-(std::numeric_limits<float>::max)())
|| a > static_cast<double>((std::numeric_limits<float>::max)()))
return false;
double b = static_cast<double>(static_cast<float>(a));
return a >= b && a <= b; // Prevent -Wfloat-equal
}
//@}
//!@name Null
//@{
GenericValue& SetNull() { this->~GenericValue(); new (this) GenericValue(); return *this; }
//@}
//!@name Bool
//@{
bool GetBool() const { RAPIDJSON_ASSERT(IsBool()); return data_.f.flags == kTrueFlag; }
//!< Set boolean value
/*! \post IsBool() == true */
GenericValue& SetBool(bool b) { this->~GenericValue(); new (this) GenericValue(b); return *this; }
//@}
//!@name Object
//@{
//! Set this value as an empty object.
/*! \post IsObject() == true */
GenericValue& SetObject() { this->~GenericValue(); new (this) GenericValue(kObjectType); return *this; }
//! Get the number of members in the object.
SizeType MemberCount() const { RAPIDJSON_ASSERT(IsObject()); return data_.o.size; }
//! Get the capacity of object.
SizeType MemberCapacity() const { RAPIDJSON_ASSERT(IsObject()); return data_.o.capacity; }
//! Check whether the object is empty.
bool ObjectEmpty() const { RAPIDJSON_ASSERT(IsObject()); return data_.o.size == 0; }
//! Get a value from an object associated with the name.
/*! \pre IsObject() == true
\tparam T Either \c Ch or \c const \c Ch (template used for disambiguation with \ref operator[](SizeType))
\note In version 0.1x, if the member is not found, this function returns a null value. This makes issue 7.
Since 0.2, if the name is not correct, it will assert.
If user is unsure whether a member exists, user should use HasMember() first.
A better approach is to use FindMember().
\note Linear time complexity.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::NotExpr<internal::IsSame<typename internal::RemoveConst<T>::Type, Ch> >),(GenericValue&)) operator[](T* name) {
GenericValue n(StringRef(name));
return (*this)[n];
}
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::NotExpr<internal::IsSame<typename internal::RemoveConst<T>::Type, Ch> >),(const GenericValue&)) operator[](T* name) const { return const_cast<GenericValue&>(*this)[name]; }
//! Get a value from an object associated with the name.
/*! \pre IsObject() == true
\tparam SourceAllocator Allocator of the \c name value
\note Compared to \ref operator[](T*), this version is faster because it does not need a StrLen().
And it can also handle strings with embedded null characters.
\note Linear time complexity.
*/
template <typename SourceAllocator>
GenericValue& operator[](const GenericValue<Encoding, SourceAllocator>& name) {
MemberIterator member = FindMember(name);
if (member != MemberEnd())
return member->value;
else {
RAPIDJSON_ASSERT(false); // see above note
// This will generate -Wexit-time-destructors in clang
// static GenericValue NullValue;
// return NullValue;
// Use static buffer and placement-new to prevent destruction
static char buffer[sizeof(GenericValue)];
return *new (buffer) GenericValue();
}
}
template <typename SourceAllocator>
const GenericValue& operator[](const GenericValue<Encoding, SourceAllocator>& name) const { return const_cast<GenericValue&>(*this)[name]; }
#if RAPIDJSON_HAS_STDSTRING
//! Get a value from an object associated with name (string object).
GenericValue& operator[](const std::basic_string<Ch>& name) { return (*this)[GenericValue(StringRef(name))]; }
const GenericValue& operator[](const std::basic_string<Ch>& name) const { return (*this)[GenericValue(StringRef(name))]; }
#endif
//! Const member iterator
/*! \pre IsObject() == true */
ConstMemberIterator MemberBegin() const { RAPIDJSON_ASSERT(IsObject()); return ConstMemberIterator(GetMembersPointer()); }
//! Const \em past-the-end member iterator
/*! \pre IsObject() == true */
ConstMemberIterator MemberEnd() const { RAPIDJSON_ASSERT(IsObject()); return ConstMemberIterator(GetMembersPointer() + data_.o.size); }
//! Member iterator
/*! \pre IsObject() == true */
MemberIterator MemberBegin() { RAPIDJSON_ASSERT(IsObject()); return MemberIterator(GetMembersPointer()); }
//! \em Past-the-end member iterator
/*! \pre IsObject() == true */
MemberIterator MemberEnd() { RAPIDJSON_ASSERT(IsObject()); return MemberIterator(GetMembersPointer() + data_.o.size); }
//! Request the object to have enough capacity to store members.
/*! \param newCapacity The capacity that the object at least need to have.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\note Linear time complexity.
*/
GenericValue& MemberReserve(SizeType newCapacity, Allocator &allocator) {
RAPIDJSON_ASSERT(IsObject());
if (newCapacity > data_.o.capacity) {
SetMembersPointer(reinterpret_cast<Member*>(allocator.Realloc(GetMembersPointer(), data_.o.capacity * sizeof(Member), newCapacity * sizeof(Member))));
data_.o.capacity = newCapacity;
}
return *this;
}
//! Check whether a member exists in the object.
/*!
\param name Member name to be searched.
\pre IsObject() == true
\return Whether a member with that name exists.
\note It is better to use FindMember() directly if you need the obtain the value as well.
\note Linear time complexity.
*/
bool HasMember(const Ch* name) const { return FindMember(name) != MemberEnd(); }
#if RAPIDJSON_HAS_STDSTRING
//! Check whether a member exists in the object with string object.
/*!
\param name Member name to be searched.
\pre IsObject() == true
\return Whether a member with that name exists.
\note It is better to use FindMember() directly if you need the obtain the value as well.
\note Linear time complexity.
*/
bool HasMember(const std::basic_string<Ch>& name) const { return FindMember(name) != MemberEnd(); }
#endif
//! Check whether a member exists in the object with GenericValue name.
/*!
This version is faster because it does not need a StrLen(). It can also handle string with null character.
\param name Member name to be searched.
\pre IsObject() == true
\return Whether a member with that name exists.
\note It is better to use FindMember() directly if you need the obtain the value as well.
\note Linear time complexity.
*/
template <typename SourceAllocator>
bool HasMember(const GenericValue<Encoding, SourceAllocator>& name) const { return FindMember(name) != MemberEnd(); }
//! Find member by name.
/*!
\param name Member name to be searched.
\pre IsObject() == true
\return Iterator to member, if it exists.
Otherwise returns \ref MemberEnd().
\note Earlier versions of Rapidjson returned a \c NULL pointer, in case
the requested member doesn't exist. For consistency with e.g.
\c std::map, this has been changed to MemberEnd() now.
\note Linear time complexity.
*/
MemberIterator FindMember(const Ch* name) {
GenericValue n(StringRef(name));
return FindMember(n);
}
ConstMemberIterator FindMember(const Ch* name) const { return const_cast<GenericValue&>(*this).FindMember(name); }
//! Find member by name.
/*!
This version is faster because it does not need a StrLen(). It can also handle string with null character.
\param name Member name to be searched.
\pre IsObject() == true
\return Iterator to member, if it exists.
Otherwise returns \ref MemberEnd().
\note Earlier versions of Rapidjson returned a \c NULL pointer, in case
the requested member doesn't exist. For consistency with e.g.
\c std::map, this has been changed to MemberEnd() now.
\note Linear time complexity.
*/
template <typename SourceAllocator>
MemberIterator FindMember(const GenericValue<Encoding, SourceAllocator>& name) {
RAPIDJSON_ASSERT(IsObject());
RAPIDJSON_ASSERT(name.IsString());
MemberIterator member = MemberBegin();
for ( ; member != MemberEnd(); ++member)
if (name.StringEqual(member->name))
break;
return member;
}
template <typename SourceAllocator> ConstMemberIterator FindMember(const GenericValue<Encoding, SourceAllocator>& name) const { return const_cast<GenericValue&>(*this).FindMember(name); }
#if RAPIDJSON_HAS_STDSTRING
//! Find member by string object name.
/*!
\param name Member name to be searched.
\pre IsObject() == true
\return Iterator to member, if it exists.
Otherwise returns \ref MemberEnd().
*/
MemberIterator FindMember(const std::basic_string<Ch>& name) { return FindMember(GenericValue(StringRef(name))); }
ConstMemberIterator FindMember(const std::basic_string<Ch>& name) const { return FindMember(GenericValue(StringRef(name))); }
#endif
//! Add a member (name-value pair) to the object.
/*! \param name A string value as name of member.
\param value Value of any type.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\note The ownership of \c name and \c value will be transferred to this object on success.
\pre IsObject() && name.IsString()
\post name.IsNull() && value.IsNull()
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(GenericValue& name, GenericValue& value, Allocator& allocator) {
RAPIDJSON_ASSERT(IsObject());
RAPIDJSON_ASSERT(name.IsString());
ObjectData& o = data_.o;
if (o.size >= o.capacity)
MemberReserve(o.capacity == 0 ? kDefaultObjectCapacity : (o.capacity + (o.capacity + 1) / 2), allocator);
Member* members = GetMembersPointer();
members[o.size].name.RawAssign(name);
members[o.size].value.RawAssign(value);
o.size++;
return *this;
}
//! Add a constant string value as member (name-value pair) to the object.
/*! \param name A string value as name of member.
\param value constant string reference as value of member.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note This overload is needed to avoid clashes with the generic primitive type AddMember(GenericValue&,T,Allocator&) overload below.
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(GenericValue& name, StringRefType value, Allocator& allocator) {
GenericValue v(value);
return AddMember(name, v, allocator);
}
#if RAPIDJSON_HAS_STDSTRING
//! Add a string object as member (name-value pair) to the object.
/*! \param name A string value as name of member.
\param value constant string reference as value of member.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note This overload is needed to avoid clashes with the generic primitive type AddMember(GenericValue&,T,Allocator&) overload below.
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(GenericValue& name, std::basic_string<Ch>& value, Allocator& allocator) {
GenericValue v(value, allocator);
return AddMember(name, v, allocator);
}
#endif
//! Add any primitive value as member (name-value pair) to the object.
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t
\param name A string value as name of member.
\param value Value of primitive type \c T as value of member
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note The source type \c T explicitly disallows all pointer types,
especially (\c const) \ref Ch*. This helps avoiding implicitly
referencing character strings with insufficient lifetime, use
\ref AddMember(StringRefType, GenericValue&, Allocator&) or \ref
AddMember(StringRefType, StringRefType, Allocator&).
All other pointer types would implicitly convert to \c bool,
use an explicit cast instead, if needed.
\note Amortized Constant time complexity.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (GenericValue&))
AddMember(GenericValue& name, T value, Allocator& allocator) {
GenericValue v(value);
return AddMember(name, v, allocator);
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericValue& AddMember(GenericValue&& name, GenericValue&& value, Allocator& allocator) {
return AddMember(name, value, allocator);
}
GenericValue& AddMember(GenericValue&& name, GenericValue& value, Allocator& allocator) {
return AddMember(name, value, allocator);
}
GenericValue& AddMember(GenericValue& name, GenericValue&& value, Allocator& allocator) {
return AddMember(name, value, allocator);
}
GenericValue& AddMember(StringRefType name, GenericValue&& value, Allocator& allocator) {
GenericValue n(name);
return AddMember(n, value, allocator);
}
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Add a member (name-value pair) to the object.
/*! \param name A constant string reference as name of member.
\param value Value of any type.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\note The ownership of \c value will be transferred to this object on success.
\pre IsObject()
\post value.IsNull()
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(StringRefType name, GenericValue& value, Allocator& allocator) {
GenericValue n(name);
return AddMember(n, value, allocator);
}
//! Add a constant string value as member (name-value pair) to the object.
/*! \param name A constant string reference as name of member.
\param value constant string reference as value of member.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note This overload is needed to avoid clashes with the generic primitive type AddMember(StringRefType,T,Allocator&) overload below.
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(StringRefType name, StringRefType value, Allocator& allocator) {
GenericValue v(value);
return AddMember(name, v, allocator);
}
//! Add any primitive value as member (name-value pair) to the object.
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t
\param name A constant string reference as name of member.
\param value Value of primitive type \c T as value of member
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note The source type \c T explicitly disallows all pointer types,
especially (\c const) \ref Ch*. This helps avoiding implicitly
referencing character strings with insufficient lifetime, use
\ref AddMember(StringRefType, GenericValue&, Allocator&) or \ref
AddMember(StringRefType, StringRefType, Allocator&).
All other pointer types would implicitly convert to \c bool,
use an explicit cast instead, if needed.
\note Amortized Constant time complexity.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (GenericValue&))
AddMember(StringRefType name, T value, Allocator& allocator) {
GenericValue n(name);
return AddMember(n, value, allocator);
}
//! Remove all members in the object.
/*! This function do not deallocate memory in the object, i.e. the capacity is unchanged.
\note Linear time complexity.
*/
void RemoveAllMembers() {
RAPIDJSON_ASSERT(IsObject());
for (MemberIterator m = MemberBegin(); m != MemberEnd(); ++m)
m->~Member();
data_.o.size = 0;
}
//! Remove a member in object by its name.
/*! \param name Name of member to be removed.
\return Whether the member existed.
\note This function may reorder the object members. Use \ref
EraseMember(ConstMemberIterator) if you need to preserve the
relative order of the remaining members.
\note Linear time complexity.
*/
bool RemoveMember(const Ch* name) {
GenericValue n(StringRef(name));
return RemoveMember(n);
}
#if RAPIDJSON_HAS_STDSTRING
bool RemoveMember(const std::basic_string<Ch>& name) { return RemoveMember(GenericValue(StringRef(name))); }
#endif
template <typename SourceAllocator>
bool RemoveMember(const GenericValue<Encoding, SourceAllocator>& name) {
MemberIterator m = FindMember(name);
if (m != MemberEnd()) {
RemoveMember(m);
return true;
}
else
return false;
}
//! Remove a member in object by iterator.
/*! \param m member iterator (obtained by FindMember() or MemberBegin()).
\return the new iterator after removal.
\note This function may reorder the object members. Use \ref
EraseMember(ConstMemberIterator) if you need to preserve the
relative order of the remaining members.
\note Constant time complexity.
*/
MemberIterator RemoveMember(MemberIterator m) {
RAPIDJSON_ASSERT(IsObject());
RAPIDJSON_ASSERT(data_.o.size > 0);
RAPIDJSON_ASSERT(GetMembersPointer() != 0);
RAPIDJSON_ASSERT(m >= MemberBegin() && m < MemberEnd());
MemberIterator last(GetMembersPointer() + (data_.o.size - 1));
if (data_.o.size > 1 && m != last)
*m = *last; // Move the last one to this place
else
m->~Member(); // Only one left, just destroy
--data_.o.size;
return m;
}
//! Remove a member from an object by iterator.
/*! \param pos iterator to the member to remove
\pre IsObject() == true && \ref MemberBegin() <= \c pos < \ref MemberEnd()
\return Iterator following the removed element.
If the iterator \c pos refers to the last element, the \ref MemberEnd() iterator is returned.
\note This function preserves the relative order of the remaining object
members. If you do not need this, use the more efficient \ref RemoveMember(MemberIterator).
\note Linear time complexity.
*/
MemberIterator EraseMember(ConstMemberIterator pos) {
return EraseMember(pos, pos +1);
}
//! Remove members in the range [first, last) from an object.
/*! \param first iterator to the first member to remove
\param last iterator following the last member to remove
\pre IsObject() == true && \ref MemberBegin() <= \c first <= \c last <= \ref MemberEnd()
\return Iterator following the last removed element.
\note This function preserves the relative order of the remaining object
members.
\note Linear time complexity.
*/
MemberIterator EraseMember(ConstMemberIterator first, ConstMemberIterator last) {
RAPIDJSON_ASSERT(IsObject());
RAPIDJSON_ASSERT(data_.o.size > 0);
RAPIDJSON_ASSERT(GetMembersPointer() != 0);
RAPIDJSON_ASSERT(first >= MemberBegin());
RAPIDJSON_ASSERT(first <= last);
RAPIDJSON_ASSERT(last <= MemberEnd());
MemberIterator pos = MemberBegin() + (first - MemberBegin());
for (MemberIterator itr = pos; itr != last; ++itr)
itr->~Member();
std::memmove(static_cast<void*>(&*pos), &*last, static_cast<size_t>(MemberEnd() - last) * sizeof(Member));
data_.o.size -= static_cast<SizeType>(last - first);
return pos;
}
//! Erase a member in object by its name.
/*! \param name Name of member to be removed.
\return Whether the member existed.
\note Linear time complexity.
*/
bool EraseMember(const Ch* name) {
GenericValue n(StringRef(name));
return EraseMember(n);
}
#if RAPIDJSON_HAS_STDSTRING
bool EraseMember(const std::basic_string<Ch>& name) { return EraseMember(GenericValue(StringRef(name))); }
#endif
template <typename SourceAllocator>
bool EraseMember(const GenericValue<Encoding, SourceAllocator>& name) {
MemberIterator m = FindMember(name);
if (m != MemberEnd()) {
EraseMember(m);
return true;
}
else
return false;
}
Object GetObject() { RAPIDJSON_ASSERT(IsObject()); return Object(*this); }
ConstObject GetObject() const { RAPIDJSON_ASSERT(IsObject()); return ConstObject(*this); }
//@}
//!@name Array
//@{
//! Set this value as an empty array.
/*! \post IsArray == true */
GenericValue& SetArray() { this->~GenericValue(); new (this) GenericValue(kArrayType); return *this; }
//! Get the number of elements in array.
SizeType Size() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.size; }
//! Get the capacity of array.
SizeType Capacity() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.capacity; }
//! Check whether the array is empty.
bool Empty() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.size == 0; }
//! Remove all elements in the array.
/*! This function do not deallocate memory in the array, i.e. the capacity is unchanged.
\note Linear time complexity.
*/
void Clear() {
RAPIDJSON_ASSERT(IsArray());
GenericValue* e = GetElementsPointer();
for (GenericValue* v = e; v != e + data_.a.size; ++v)
v->~GenericValue();
data_.a.size = 0;
}
//! Get an element from array by index.
/*! \pre IsArray() == true
\param index Zero-based index of element.
\see operator[](T*)
*/
GenericValue& operator[](SizeType index) {
RAPIDJSON_ASSERT(IsArray());
RAPIDJSON_ASSERT(index < data_.a.size);
return GetElementsPointer()[index];
}
const GenericValue& operator[](SizeType index) const { return const_cast<GenericValue&>(*this)[index]; }
//! Element iterator
/*! \pre IsArray() == true */
ValueIterator Begin() { RAPIDJSON_ASSERT(IsArray()); return GetElementsPointer(); }
//! \em Past-the-end element iterator
/*! \pre IsArray() == true */
ValueIterator End() { RAPIDJSON_ASSERT(IsArray()); return GetElementsPointer() + data_.a.size; }
//! Constant element iterator
/*! \pre IsArray() == true */
ConstValueIterator Begin() const { return const_cast<GenericValue&>(*this).Begin(); }
//! Constant \em past-the-end element iterator
/*! \pre IsArray() == true */
ConstValueIterator End() const { return const_cast<GenericValue&>(*this).End(); }
//! Request the array to have enough capacity to store elements.
/*! \param newCapacity The capacity that the array at least need to have.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\note Linear time complexity.
*/
GenericValue& Reserve(SizeType newCapacity, Allocator &allocator) {
RAPIDJSON_ASSERT(IsArray());
if (newCapacity > data_.a.capacity) {
SetElementsPointer(reinterpret_cast<GenericValue*>(allocator.Realloc(GetElementsPointer(), data_.a.capacity * sizeof(GenericValue), newCapacity * sizeof(GenericValue))));
data_.a.capacity = newCapacity;
}
return *this;
}
//! Append a GenericValue at the end of the array.
/*! \param value Value to be appended.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\pre IsArray() == true
\post value.IsNull() == true
\return The value itself for fluent API.
\note The ownership of \c value will be transferred to this array on success.
\note If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
\note Amortized constant time complexity.
*/
GenericValue& PushBack(GenericValue& value, Allocator& allocator) {
RAPIDJSON_ASSERT(IsArray());
if (data_.a.size >= data_.a.capacity)
Reserve(data_.a.capacity == 0 ? kDefaultArrayCapacity : (data_.a.capacity + (data_.a.capacity + 1) / 2), allocator);
GetElementsPointer()[data_.a.size++].RawAssign(value);
return *this;
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericValue& PushBack(GenericValue&& value, Allocator& allocator) {
return PushBack(value, allocator);
}
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Append a constant string reference at the end of the array.
/*! \param value Constant string reference to be appended.
\param allocator Allocator for reallocating memory. It must be the same one used previously. Commonly use GenericDocument::GetAllocator().
\pre IsArray() == true
\return The value itself for fluent API.
\note If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
\note Amortized constant time complexity.
\see GenericStringRef
*/
GenericValue& PushBack(StringRefType value, Allocator& allocator) {
return (*this).template PushBack<StringRefType>(value, allocator);
}
//! Append a primitive value at the end of the array.
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t
\param value Value of primitive type T to be appended.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\pre IsArray() == true
\return The value itself for fluent API.
\note If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
\note The source type \c T explicitly disallows all pointer types,
especially (\c const) \ref Ch*. This helps avoiding implicitly
referencing character strings with insufficient lifetime, use
\ref PushBack(GenericValue&, Allocator&) or \ref
PushBack(StringRefType, Allocator&).
All other pointer types would implicitly convert to \c bool,
use an explicit cast instead, if needed.
\note Amortized constant time complexity.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (GenericValue&))
PushBack(T value, Allocator& allocator) {
GenericValue v(value);
return PushBack(v, allocator);
}
//! Remove the last element in the array.
/*!
\note Constant time complexity.
*/
GenericValue& PopBack() {
RAPIDJSON_ASSERT(IsArray());
RAPIDJSON_ASSERT(!Empty());
GetElementsPointer()[--data_.a.size].~GenericValue();
return *this;
}
//! Remove an element of array by iterator.
/*!
\param pos iterator to the element to remove
\pre IsArray() == true && \ref Begin() <= \c pos < \ref End()
\return Iterator following the removed element. If the iterator pos refers to the last element, the End() iterator is returned.
\note Linear time complexity.
*/
ValueIterator Erase(ConstValueIterator pos) {
return Erase(pos, pos + 1);
}
//! Remove elements in the range [first, last) of the array.
/*!
\param first iterator to the first element to remove
\param last iterator following the last element to remove
\pre IsArray() == true && \ref Begin() <= \c first <= \c last <= \ref End()
\return Iterator following the last removed element.
\note Linear time complexity.
*/
ValueIterator Erase(ConstValueIterator first, ConstValueIterator last) {
RAPIDJSON_ASSERT(IsArray());
RAPIDJSON_ASSERT(data_.a.size > 0);
RAPIDJSON_ASSERT(GetElementsPointer() != 0);
RAPIDJSON_ASSERT(first >= Begin());
RAPIDJSON_ASSERT(first <= last);
RAPIDJSON_ASSERT(last <= End());
ValueIterator pos = Begin() + (first - Begin());
for (ValueIterator itr = pos; itr != last; ++itr)
itr->~GenericValue();
std::memmove(static_cast<void*>(pos), last, static_cast<size_t>(End() - last) * sizeof(GenericValue));
data_.a.size -= static_cast<SizeType>(last - first);
return pos;
}
Array GetArray() { RAPIDJSON_ASSERT(IsArray()); return Array(*this); }
ConstArray GetArray() const { RAPIDJSON_ASSERT(IsArray()); return ConstArray(*this); }
//@}
//!@name Number
//@{
int GetInt() const { RAPIDJSON_ASSERT(data_.f.flags & kIntFlag); return data_.n.i.i; }
unsigned GetUint() const { RAPIDJSON_ASSERT(data_.f.flags & kUintFlag); return data_.n.u.u; }
int64_t GetInt64() const { RAPIDJSON_ASSERT(data_.f.flags & kInt64Flag); return data_.n.i64; }
uint64_t GetUint64() const { RAPIDJSON_ASSERT(data_.f.flags & kUint64Flag); return data_.n.u64; }
//! Get the value as double type.
/*! \note If the value is 64-bit integer type, it may lose precision. Use \c IsLosslessDouble() to check whether the converison is lossless.
*/
double GetDouble() const {
RAPIDJSON_ASSERT(IsNumber());
if ((data_.f.flags & kDoubleFlag) != 0) return data_.n.d; // exact type, no conversion.
if ((data_.f.flags & kIntFlag) != 0) return data_.n.i.i; // int -> double
if ((data_.f.flags & kUintFlag) != 0) return data_.n.u.u; // unsigned -> double
if ((data_.f.flags & kInt64Flag) != 0) return static_cast<double>(data_.n.i64); // int64_t -> double (may lose precision)
RAPIDJSON_ASSERT((data_.f.flags & kUint64Flag) != 0); return static_cast<double>(data_.n.u64); // uint64_t -> double (may lose precision)
}
//! Get the value as float type.
/*! \note If the value is 64-bit integer type, it may lose precision. Use \c IsLosslessFloat() to check whether the converison is lossless.
*/
float GetFloat() const {
return static_cast<float>(GetDouble());
}
GenericValue& SetInt(int i) { this->~GenericValue(); new (this) GenericValue(i); return *this; }
GenericValue& SetUint(unsigned u) { this->~GenericValue(); new (this) GenericValue(u); return *this; }
GenericValue& SetInt64(int64_t i64) { this->~GenericValue(); new (this) GenericValue(i64); return *this; }
GenericValue& SetUint64(uint64_t u64) { this->~GenericValue(); new (this) GenericValue(u64); return *this; }
GenericValue& SetDouble(double d) { this->~GenericValue(); new (this) GenericValue(d); return *this; }
GenericValue& SetFloat(float f) { this->~GenericValue(); new (this) GenericValue(static_cast<double>(f)); return *this; }
//@}
//!@name String
//@{
const Ch* GetString() const { RAPIDJSON_ASSERT(IsString()); return (data_.f.flags & kInlineStrFlag) ? data_.ss.str : GetStringPointer(); }
//! Get the length of string.
/*! Since rapidjson permits "\\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().
*/
SizeType GetStringLength() const { RAPIDJSON_ASSERT(IsString()); return ((data_.f.flags & kInlineStrFlag) ? (data_.ss.GetLength()) : data_.s.length); }
//! Set this value as a string without copying source string.
/*! This version has better performance with supplied length, and also support string containing null character.
\param s source string pointer.
\param length The length of source string, excluding the trailing null terminator.
\return The value itself for fluent API.
\post IsString() == true && GetString() == s && GetStringLength() == length
\see SetString(StringRefType)
*/
GenericValue& SetString(const Ch* s, SizeType length) { return SetString(StringRef(s, length)); }
//! Set this value as a string without copying source string.
/*! \param s source string reference
\return The value itself for fluent API.
\post IsString() == true && GetString() == s && GetStringLength() == s.length
*/
GenericValue& SetString(StringRefType s) { this->~GenericValue(); SetStringRaw(s); return *this; }
//! Set this value as a string by copying from source string.
/*! This version has better performance with supplied length, and also support string containing null character.
\param s source string.
\param length The length of source string, excluding the trailing null terminator.
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\post IsString() == true && GetString() != s && strcmp(GetString(),s) == 0 && GetStringLength() == length
*/
GenericValue& SetString(const Ch* s, SizeType length, Allocator& allocator) { return SetString(StringRef(s, length), allocator); }
//! Set this value as a string by copying from source string.
/*! \param s source string.
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\post IsString() == true && GetString() != s && strcmp(GetString(),s) == 0 && GetStringLength() == length
*/
GenericValue& SetString(const Ch* s, Allocator& allocator) { return SetString(StringRef(s), allocator); }
//! Set this value as a string by copying from source string.
/*! \param s source string reference
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\post IsString() == true && GetString() != s.s && strcmp(GetString(),s) == 0 && GetStringLength() == length
*/
GenericValue& SetString(StringRefType s, Allocator& allocator) { this->~GenericValue(); SetStringRaw(s, allocator); return *this; }
#if RAPIDJSON_HAS_STDSTRING
//! Set this value as a string by copying from source string.
/*! \param s source string.
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\post IsString() == true && GetString() != s.data() && strcmp(GetString(),s.data() == 0 && GetStringLength() == s.size()
\note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
GenericValue& SetString(const std::basic_string<Ch>& s, Allocator& allocator) { return SetString(StringRef(s), allocator); }
#endif
//@}
//!@name Array
//@{
//! Templated version for checking whether this value is type T.
/*!
\tparam T Either \c bool, \c int, \c unsigned, \c int64_t, \c uint64_t, \c double, \c float, \c const \c char*, \c std::basic_string<Ch>
*/
template <typename T>
bool Is() const { return internal::TypeHelper<ValueType, T>::Is(*this); }
template <typename T>
T Get() const { return internal::TypeHelper<ValueType, T>::Get(*this); }
template <typename T>
T Get() { return internal::TypeHelper<ValueType, T>::Get(*this); }
template<typename T>
ValueType& Set(const T& data) { return internal::TypeHelper<ValueType, T>::Set(*this, data); }
template<typename T>
ValueType& Set(const T& data, AllocatorType& allocator) { return internal::TypeHelper<ValueType, T>::Set(*this, data, allocator); }
//@}
//! Generate events of this value to a Handler.
/*! This function adopts the GoF visitor pattern.
Typical usage is to output this JSON value as JSON text via Writer, which is a Handler.
It can also be used to deep clone this value via GenericDocument, which is also a Handler.
\tparam Handler type of handler.
\param handler An object implementing concept Handler.
*/
template <typename Handler>
bool Accept(Handler& handler) const {
switch(GetType()) {
case kNullType: return handler.Null();
case kFalseType: return handler.Bool(false);
case kTrueType: return handler.Bool(true);
case kObjectType:
if (RAPIDJSON_UNLIKELY(!handler.StartObject()))
return false;
for (ConstMemberIterator m = MemberBegin(); m != MemberEnd(); ++m) {
RAPIDJSON_ASSERT(m->name.IsString()); // User may change the type of name by MemberIterator.
if (RAPIDJSON_UNLIKELY(!handler.Key(m->name.GetString(), m->name.GetStringLength(), (m->name.data_.f.flags & kCopyFlag) != 0)))
return false;
if (RAPIDJSON_UNLIKELY(!m->value.Accept(handler)))
return false;
}
return handler.EndObject(data_.o.size);
case kArrayType:
if (RAPIDJSON_UNLIKELY(!handler.StartArray()))
return false;
for (const GenericValue* v = Begin(); v != End(); ++v)
if (RAPIDJSON_UNLIKELY(!v->Accept(handler)))
return false;
return handler.EndArray(data_.a.size);
case kStringType:
return handler.String(GetString(), GetStringLength(), (data_.f.flags & kCopyFlag) != 0);
default:
RAPIDJSON_ASSERT(GetType() == kNumberType);
if (IsDouble()) return handler.Double(data_.n.d);
else if (IsInt()) return handler.Int(data_.n.i.i);
else if (IsUint()) return handler.Uint(data_.n.u.u);
else if (IsInt64()) return handler.Int64(data_.n.i64);
else return handler.Uint64(data_.n.u64);
}
}
private:
template <typename, typename> friend class GenericValue;
template <typename, typename, typename> friend class GenericDocument;
enum {
kBoolFlag = 0x0008,
kNumberFlag = 0x0010,
kIntFlag = 0x0020,
kUintFlag = 0x0040,
kInt64Flag = 0x0080,
kUint64Flag = 0x0100,
kDoubleFlag = 0x0200,
kStringFlag = 0x0400,
kCopyFlag = 0x0800,
kInlineStrFlag = 0x1000,
// Initial flags of different types.
kNullFlag = kNullType,
kTrueFlag = kTrueType | kBoolFlag,
kFalseFlag = kFalseType | kBoolFlag,
kNumberIntFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag,
kNumberUintFlag = kNumberType | kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag,
kNumberInt64Flag = kNumberType | kNumberFlag | kInt64Flag,
kNumberUint64Flag = kNumberType | kNumberFlag | kUint64Flag,
kNumberDoubleFlag = kNumberType | kNumberFlag | kDoubleFlag,
kNumberAnyFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag,
kConstStringFlag = kStringType | kStringFlag,
kCopyStringFlag = kStringType | kStringFlag | kCopyFlag,
kShortStringFlag = kStringType | kStringFlag | kCopyFlag | kInlineStrFlag,
kObjectFlag = kObjectType,
kArrayFlag = kArrayType,
kTypeMask = 0x07
};
static const SizeType kDefaultArrayCapacity = 16;
static const SizeType kDefaultObjectCapacity = 16;
struct Flag {
#if RAPIDJSON_48BITPOINTER_OPTIMIZATION
char payload[sizeof(SizeType) * 2 + 6]; // 2 x SizeType + lower 48-bit pointer
#elif RAPIDJSON_64BIT
char payload[sizeof(SizeType) * 2 + sizeof(void*) + 6]; // 6 padding bytes
#else
char payload[sizeof(SizeType) * 2 + sizeof(void*) + 2]; // 2 padding bytes
#endif
uint16_t flags;
};
struct String {
SizeType length;
SizeType hashcode; //!< reserved
const Ch* str;
}; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
// implementation detail: ShortString can represent zero-terminated strings up to MaxSize chars
// (excluding the terminating zero) and store a value to determine the length of the contained
// string in the last character str[LenPos] by storing "MaxSize - length" there. If the string
// to store has the maximal length of MaxSize then str[LenPos] will be 0 and therefore act as
// the string terminator as well. For getting the string length back from that value just use
// "MaxSize - str[LenPos]".
// This allows to store 13-chars strings in 32-bit mode, 21-chars strings in 64-bit mode,
// 13-chars strings for RAPIDJSON_48BITPOINTER_OPTIMIZATION=1 inline (for `UTF8`-encoded strings).
struct ShortString {
enum { MaxChars = sizeof(static_cast<Flag*>(0)->payload) / sizeof(Ch), MaxSize = MaxChars - 1, LenPos = MaxSize };
Ch str[MaxChars];
inline static bool Usable(SizeType len) { return (MaxSize >= len); }
inline void SetLength(SizeType len) { str[LenPos] = static_cast<Ch>(MaxSize - len); }
inline SizeType GetLength() const { return static_cast<SizeType>(MaxSize - str[LenPos]); }
}; // at most as many bytes as "String" above => 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
// By using proper binary layout, retrieval of different integer types do not need conversions.
union Number {
#if RAPIDJSON_ENDIAN == RAPIDJSON_LITTLEENDIAN
struct I {
int i;
char padding[4];
}i;
struct U {
unsigned u;
char padding2[4];
}u;
#else
struct I {
char padding[4];
int i;
}i;
struct U {
char padding2[4];
unsigned u;
}u;
#endif
int64_t i64;
uint64_t u64;
double d;
}; // 8 bytes
struct ObjectData {
SizeType size;
SizeType capacity;
Member* members;
}; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
struct ArrayData {
SizeType size;
SizeType capacity;
GenericValue* elements;
}; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
union Data {
String s;
ShortString ss;
Number n;
ObjectData o;
ArrayData a;
Flag f;
}; // 16 bytes in 32-bit mode, 24 bytes in 64-bit mode, 16 bytes in 64-bit with RAPIDJSON_48BITPOINTER_OPTIMIZATION
RAPIDJSON_FORCEINLINE const Ch* GetStringPointer() const { return RAPIDJSON_GETPOINTER(Ch, data_.s.str); }
RAPIDJSON_FORCEINLINE const Ch* SetStringPointer(const Ch* str) { return RAPIDJSON_SETPOINTER(Ch, data_.s.str, str); }
RAPIDJSON_FORCEINLINE GenericValue* GetElementsPointer() const { return RAPIDJSON_GETPOINTER(GenericValue, data_.a.elements); }
RAPIDJSON_FORCEINLINE GenericValue* SetElementsPointer(GenericValue* elements) { return RAPIDJSON_SETPOINTER(GenericValue, data_.a.elements, elements); }
RAPIDJSON_FORCEINLINE Member* GetMembersPointer() const { return RAPIDJSON_GETPOINTER(Member, data_.o.members); }
RAPIDJSON_FORCEINLINE Member* SetMembersPointer(Member* members) { return RAPIDJSON_SETPOINTER(Member, data_.o.members, members); }
// Initialize this value as array with initial data, without calling destructor.
void SetArrayRaw(GenericValue* values, SizeType count, Allocator& allocator) {
data_.f.flags = kArrayFlag;
if (count) {
GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
SetElementsPointer(e);
std::memcpy(static_cast<void*>(e), values, count * sizeof(GenericValue));
}
else
SetElementsPointer(0);
data_.a.size = data_.a.capacity = count;
}
//! Initialize this value as object with initial data, without calling destructor.
void SetObjectRaw(Member* members, SizeType count, Allocator& allocator) {
data_.f.flags = kObjectFlag;
if (count) {
Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
SetMembersPointer(m);
std::memcpy(static_cast<void*>(m), members, count * sizeof(Member));
}
else
SetMembersPointer(0);
data_.o.size = data_.o.capacity = count;
}
//! Initialize this value as constant string, without calling destructor.
void SetStringRaw(StringRefType s) RAPIDJSON_NOEXCEPT {
data_.f.flags = kConstStringFlag;
SetStringPointer(s);
data_.s.length = s.length;
}
//! Initialize this value as copy string with initial data, without calling destructor.
void SetStringRaw(StringRefType s, Allocator& allocator) {
Ch* str = 0;
if (ShortString::Usable(s.length)) {
data_.f.flags = kShortStringFlag;
data_.ss.SetLength(s.length);
str = data_.ss.str;
} else {
data_.f.flags = kCopyStringFlag;
data_.s.length = s.length;
str = static_cast<Ch *>(allocator.Malloc((s.length + 1) * sizeof(Ch)));
SetStringPointer(str);
}
std::memcpy(str, s, s.length * sizeof(Ch));
str[s.length] = '\0';
}
//! Assignment without calling destructor
void RawAssign(GenericValue& rhs) RAPIDJSON_NOEXCEPT {
data_ = rhs.data_;
// data_.f.flags = rhs.data_.f.flags;
rhs.data_.f.flags = kNullFlag;
}
template <typename SourceAllocator>
bool StringEqual(const GenericValue<Encoding, SourceAllocator>& rhs) const {
RAPIDJSON_ASSERT(IsString());
RAPIDJSON_ASSERT(rhs.IsString());
const SizeType len1 = GetStringLength();
const SizeType len2 = rhs.GetStringLength();
if (len1 != len2) { return false; }
const Ch* const str1 = GetString();
const Ch* const str2 = rhs.GetString();
if (str1 == str2) { return true; } // fast path for constant string
return (std::memcmp(str1, str2, sizeof(Ch) * len1) == 0);
}
Data data_;
};
//! GenericValue with UTF8 encoding
typedef GenericValue<UTF8<> > Value;
///////////////////////////////////////////////////////////////////////////////
// GenericDocument
//! A document for parsing JSON text as DOM.
/*!
\note implements Handler concept
\tparam Encoding Encoding for both parsing and string storage.
\tparam Allocator Allocator for allocating memory for the DOM
\tparam StackAllocator Allocator for allocating memory for stack during parsing.
\warning Although GenericDocument inherits from GenericValue, the API does \b not provide any virtual functions, especially no virtual destructor. To avoid memory leaks, do not \c delete a GenericDocument object via a pointer to a GenericValue.
*/
template <typename Encoding, typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
class GenericDocument : public GenericValue<Encoding, Allocator> {
public:
typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding.
typedef GenericValue<Encoding, Allocator> ValueType; //!< Value type of the document.
typedef Allocator AllocatorType; //!< Allocator type from template parameter.
//! Constructor
/*! Creates an empty document of specified type.
\param type Mandatory type of object to create.
\param allocator Optional allocator for allocating memory.
\param stackCapacity Optional initial capacity of stack in bytes.
\param stackAllocator Optional allocator for allocating memory for stack.
*/
explicit GenericDocument(Type type, Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) :
GenericValue<Encoding, Allocator>(type), allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
{
if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
}
//! Constructor
/*! Creates an empty document which type is Null.
\param allocator Optional allocator for allocating memory.
\param stackCapacity Optional initial capacity of stack in bytes.
\param stackAllocator Optional allocator for allocating memory for stack.
*/
GenericDocument(Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) :
allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
{
if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Move constructor in C++11
GenericDocument(GenericDocument&& rhs) RAPIDJSON_NOEXCEPT
: ValueType(std::forward<ValueType>(rhs)), // explicit cast to avoid prohibited move from Document
allocator_(rhs.allocator_),
ownAllocator_(rhs.ownAllocator_),
stack_(std::move(rhs.stack_)),
parseResult_(rhs.parseResult_)
{
rhs.allocator_ = 0;
rhs.ownAllocator_ = 0;
rhs.parseResult_ = ParseResult();
}
#endif
~GenericDocument() {
Destroy();
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Move assignment in C++11
GenericDocument& operator=(GenericDocument&& rhs) RAPIDJSON_NOEXCEPT
{
// The cast to ValueType is necessary here, because otherwise it would
// attempt to call GenericValue's templated assignment operator.
ValueType::operator=(std::forward<ValueType>(rhs));
// Calling the destructor here would prematurely call stack_'s destructor
Destroy();
allocator_ = rhs.allocator_;
ownAllocator_ = rhs.ownAllocator_;
stack_ = std::move(rhs.stack_);
parseResult_ = rhs.parseResult_;
rhs.allocator_ = 0;
rhs.ownAllocator_ = 0;
rhs.parseResult_ = ParseResult();
return *this;
}
#endif
//! Exchange the contents of this document with those of another.
/*!
\param rhs Another document.
\note Constant complexity.
\see GenericValue::Swap
*/
GenericDocument& Swap(GenericDocument& rhs) RAPIDJSON_NOEXCEPT {
ValueType::Swap(rhs);
stack_.Swap(rhs.stack_);
internal::Swap(allocator_, rhs.allocator_);
internal::Swap(ownAllocator_, rhs.ownAllocator_);
internal::Swap(parseResult_, rhs.parseResult_);
return *this;
}
// Allow Swap with ValueType.
// Refer to Effective C++ 3rd Edition/Item 33: Avoid hiding inherited names.
using ValueType::Swap;
//! free-standing swap function helper
/*!
Helper function to enable support for common swap implementation pattern based on \c std::swap:
\code
void swap(MyClass& a, MyClass& b) {
using std::swap;
swap(a.doc, b.doc);
// ...
}
\endcode
\see Swap()
*/
friend inline void swap(GenericDocument& a, GenericDocument& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }
//! Populate this document by a generator which produces SAX events.
/*! \tparam Generator A functor with <tt>bool f(Handler)</tt> prototype.
\param g Generator functor which sends SAX events to the parameter.
\return The document itself for fluent API.
*/
template <typename Generator>
GenericDocument& Populate(Generator& g) {
ClearStackOnExit scope(*this);
if (g(*this)) {
RAPIDJSON_ASSERT(stack_.GetSize() == sizeof(ValueType)); // Got one and only one root object
ValueType::operator=(*stack_.template Pop<ValueType>(1));// Move value from stack to document
}
return *this;
}
//!@name Parse from stream
//!@{
//! Parse JSON text from an input stream (with Encoding conversion)
/*! \tparam parseFlags Combination of \ref ParseFlag.
\tparam SourceEncoding Encoding of input stream
\tparam InputStream Type of input stream, implementing Stream concept
\param is Input stream to be parsed.
\return The document itself for fluent API.
*/
template <unsigned parseFlags, typename SourceEncoding, typename InputStream>
GenericDocument& ParseStream(InputStream& is) {
GenericReader<SourceEncoding, Encoding, StackAllocator> reader(
stack_.HasAllocator() ? &stack_.GetAllocator() : 0);
ClearStackOnExit scope(*this);
parseResult_ = reader.template Parse<parseFlags>(is, *this);
if (parseResult_) {
RAPIDJSON_ASSERT(stack_.GetSize() == sizeof(ValueType)); // Got one and only one root object
ValueType::operator=(*stack_.template Pop<ValueType>(1));// Move value from stack to document
}
return *this;
}
//! Parse JSON text from an input stream
/*! \tparam parseFlags Combination of \ref ParseFlag.
\tparam InputStream Type of input stream, implementing Stream concept
\param is Input stream to be parsed.
\return The document itself for fluent API.
*/
template <unsigned parseFlags, typename InputStream>
GenericDocument& ParseStream(InputStream& is) {
return ParseStream<parseFlags, Encoding, InputStream>(is);
}
//! Parse JSON text from an input stream (with \ref kParseDefaultFlags)
/*! \tparam InputStream Type of input stream, implementing Stream concept
\param is Input stream to be parsed.
\return The document itself for fluent API.
*/
template <typename InputStream>
GenericDocument& ParseStream(InputStream& is) {
return ParseStream<kParseDefaultFlags, Encoding, InputStream>(is);
}
//!@}
//!@name Parse in-place from mutable string
//!@{
//! Parse JSON text from a mutable string
/*! \tparam parseFlags Combination of \ref ParseFlag.
\param str Mutable zero-terminated string to be parsed.
\return The document itself for fluent API.
*/
template <unsigned parseFlags>
GenericDocument& ParseInsitu(Ch* str) {
GenericInsituStringStream<Encoding> s(str);
return ParseStream<parseFlags | kParseInsituFlag>(s);
}
//! Parse JSON text from a mutable string (with \ref kParseDefaultFlags)
/*! \param str Mutable zero-terminated string to be parsed.
\return The document itself for fluent API.
*/
GenericDocument& ParseInsitu(Ch* str) {
return ParseInsitu<kParseDefaultFlags>(str);
}
//!@}
//!@name Parse from read-only string
//!@{
//! Parse JSON text from a read-only string (with Encoding conversion)
/*! \tparam parseFlags Combination of \ref ParseFlag (must not contain \ref kParseInsituFlag).
\tparam SourceEncoding Transcoding from input Encoding
\param str Read-only zero-terminated string to be parsed.
*/
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& Parse(const typename SourceEncoding::Ch* str) {
RAPIDJSON_ASSERT(!(parseFlags & kParseInsituFlag));
GenericStringStream<SourceEncoding> s(str);
return ParseStream<parseFlags, SourceEncoding>(s);
}
//! Parse JSON text from a read-only string
/*! \tparam parseFlags Combination of \ref ParseFlag (must not contain \ref kParseInsituFlag).
\param str Read-only zero-terminated string to be parsed.
*/
template <unsigned parseFlags>
GenericDocument& Parse(const Ch* str) {
return Parse<parseFlags, Encoding>(str);
}
//! Parse JSON text from a read-only string (with \ref kParseDefaultFlags)
/*! \param str Read-only zero-terminated string to be parsed.
*/
GenericDocument& Parse(const Ch* str) {
return Parse<kParseDefaultFlags>(str);
}
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& Parse(const typename SourceEncoding::Ch* str, size_t length) {
RAPIDJSON_ASSERT(!(parseFlags & kParseInsituFlag));
MemoryStream ms(reinterpret_cast<const char*>(str), length * sizeof(typename SourceEncoding::Ch));
EncodedInputStream<SourceEncoding, MemoryStream> is(ms);
ParseStream<parseFlags, SourceEncoding>(is);
return *this;
}
template <unsigned parseFlags>
GenericDocument& Parse(const Ch* str, size_t length) {
return Parse<parseFlags, Encoding>(str, length);
}
GenericDocument& Parse(const Ch* str, size_t length) {
return Parse<kParseDefaultFlags>(str, length);
}
#if RAPIDJSON_HAS_STDSTRING
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& Parse(const std::basic_string<typename SourceEncoding::Ch>& str) {
// c_str() is constant complexity according to standard. Should be faster than Parse(const char*, size_t)
return Parse<parseFlags, SourceEncoding>(str.c_str());
}
template <unsigned parseFlags>
GenericDocument& Parse(const std::basic_string<Ch>& str) {
return Parse<parseFlags, Encoding>(str.c_str());
}
GenericDocument& Parse(const std::basic_string<Ch>& str) {
return Parse<kParseDefaultFlags>(str);
}
#endif // RAPIDJSON_HAS_STDSTRING
//!@}
//!@name Handling parse errors
//!@{
//! Whether a parse error has occurred in the last parsing.
bool HasParseError() const { return parseResult_.IsError(); }
//! Get the \ref ParseErrorCode of last parsing.
ParseErrorCode GetParseError() const { return parseResult_.Code(); }
//! Get the position of last parsing error in input, 0 otherwise.
size_t GetErrorOffset() const { return parseResult_.Offset(); }
//! Implicit conversion to get the last parse result
#ifndef __clang // -Wdocumentation
/*! \return \ref ParseResult of the last parse operation
\code
Document doc;
ParseResult ok = doc.Parse(json);
if (!ok)
printf( "JSON parse error: %s (%u)\n", GetParseError_En(ok.Code()), ok.Offset());
\endcode
*/
#endif
operator ParseResult() const { return parseResult_; }
//!@}
//! Get the allocator of this document.
Allocator& GetAllocator() {
RAPIDJSON_ASSERT(allocator_);
return *allocator_;
}
//! Get the capacity of stack in bytes.
size_t GetStackCapacity() const { return stack_.GetCapacity(); }
private:
// clear stack on any exit from ParseStream, e.g. due to exception
struct ClearStackOnExit {
explicit ClearStackOnExit(GenericDocument& d) : d_(d) {}
~ClearStackOnExit() { d_.ClearStack(); }
private:
ClearStackOnExit(const ClearStackOnExit&);
ClearStackOnExit& operator=(const ClearStackOnExit&);
GenericDocument& d_;
};
// callers of the following private Handler functions
// template <typename,typename,typename> friend class GenericReader; // for parsing
template <typename, typename> friend class GenericValue; // for deep copying
public:
// Implementation of Handler
bool Null() { new (stack_.template Push<ValueType>()) ValueType(); return true; }
bool Bool(bool b) { new (stack_.template Push<ValueType>()) ValueType(b); return true; }
bool Int(int i) { new (stack_.template Push<ValueType>()) ValueType(i); return true; }
bool Uint(unsigned i) { new (stack_.template Push<ValueType>()) ValueType(i); return true; }
bool Int64(int64_t i) { new (stack_.template Push<ValueType>()) ValueType(i); return true; }
bool Uint64(uint64_t i) { new (stack_.template Push<ValueType>()) ValueType(i); return true; }
bool Double(double d) { new (stack_.template Push<ValueType>()) ValueType(d); return true; }
bool RawNumber(const Ch* str, SizeType length, bool copy) {
if (copy)
new (stack_.template Push<ValueType>()) ValueType(str, length, GetAllocator());
else
new (stack_.template Push<ValueType>()) ValueType(str, length);
return true;
}
bool String(const Ch* str, SizeType length, bool copy) {
if (copy)
new (stack_.template Push<ValueType>()) ValueType(str, length, GetAllocator());
else
new (stack_.template Push<ValueType>()) ValueType(str, length);
return true;
}
bool StartObject() { new (stack_.template Push<ValueType>()) ValueType(kObjectType); return true; }
bool Key(const Ch* str, SizeType length, bool copy) { return String(str, length, copy); }
bool EndObject(SizeType memberCount) {
typename ValueType::Member* members = stack_.template Pop<typename ValueType::Member>(memberCount);
stack_.template Top<ValueType>()->SetObjectRaw(members, memberCount, GetAllocator());
return true;
}
bool StartArray() { new (stack_.template Push<ValueType>()) ValueType(kArrayType); return true; }
bool EndArray(SizeType elementCount) {
ValueType* elements = stack_.template Pop<ValueType>(elementCount);
stack_.template Top<ValueType>()->SetArrayRaw(elements, elementCount, GetAllocator());
return true;
}
private:
//! Prohibit copying
GenericDocument(const GenericDocument&);
//! Prohibit assignment
GenericDocument& operator=(const GenericDocument&);
void ClearStack() {
if (Allocator::kNeedFree)
while (stack_.GetSize() > 0) // Here assumes all elements in stack array are GenericValue (Member is actually 2 GenericValue objects)
(stack_.template Pop<ValueType>(1))->~ValueType();
else
stack_.Clear();
stack_.ShrinkToFit();
}
void Destroy() {
RAPIDJSON_DELETE(ownAllocator_);
}
static const size_t kDefaultStackCapacity = 1024;
Allocator* allocator_;
Allocator* ownAllocator_;
internal::Stack<StackAllocator> stack_;
ParseResult parseResult_;
};
//! GenericDocument with UTF8 encoding
typedef GenericDocument<UTF8<> > Document;
//! Helper class for accessing Value of array type.
/*!
Instance of this helper class is obtained by \c GenericValue::GetArray().
In addition to all APIs for array type, it provides range-based for loop if \c RAPIDJSON_HAS_CXX11_RANGE_FOR=1.
*/
template <bool Const, typename ValueT>
class GenericArray {
public:
typedef GenericArray<true, ValueT> ConstArray;
typedef GenericArray<false, ValueT> Array;
typedef ValueT PlainType;
typedef typename internal::MaybeAddConst<Const,PlainType>::Type ValueType;
typedef ValueType* ValueIterator; // This may be const or non-const iterator
typedef const ValueT* ConstValueIterator;
typedef typename ValueType::AllocatorType AllocatorType;
typedef typename ValueType::StringRefType StringRefType;
template <typename, typename>
friend class GenericValue;
GenericArray(const GenericArray& rhs) : value_(rhs.value_) {}
GenericArray& operator=(const GenericArray& rhs) { value_ = rhs.value_; return *this; }
~GenericArray() {}
SizeType Size() const { return value_.Size(); }
SizeType Capacity() const { return value_.Capacity(); }
bool Empty() const { return value_.Empty(); }
void Clear() const { value_.Clear(); }
ValueType& operator[](SizeType index) const { return value_[index]; }
ValueIterator Begin() const { return value_.Begin(); }
ValueIterator End() const { return value_.End(); }
GenericArray Reserve(SizeType newCapacity, AllocatorType &allocator) const { value_.Reserve(newCapacity, allocator); return *this; }
GenericArray PushBack(ValueType& value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; }
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericArray PushBack(ValueType&& value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; }
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericArray PushBack(StringRefType value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; }
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (const GenericArray&)) PushBack(T value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; }
GenericArray PopBack() const { value_.PopBack(); return *this; }
ValueIterator Erase(ConstValueIterator pos) const { return value_.Erase(pos); }
ValueIterator Erase(ConstValueIterator first, ConstValueIterator last) const { return value_.Erase(first, last); }
#if RAPIDJSON_HAS_CXX11_RANGE_FOR
ValueIterator begin() const { return value_.Begin(); }
ValueIterator end() const { return value_.End(); }
#endif
private:
GenericArray();
GenericArray(ValueType& value) : value_(value) {}
ValueType& value_;
};
//! Helper class for accessing Value of object type.
/*!
Instance of this helper class is obtained by \c GenericValue::GetObject().
In addition to all APIs for array type, it provides range-based for loop if \c RAPIDJSON_HAS_CXX11_RANGE_FOR=1.
*/
template <bool Const, typename ValueT>
class GenericObject {
public:
typedef GenericObject<true, ValueT> ConstObject;
typedef GenericObject<false, ValueT> Object;
typedef ValueT PlainType;
typedef typename internal::MaybeAddConst<Const,PlainType>::Type ValueType;
typedef GenericMemberIterator<Const, typename ValueT::EncodingType, typename ValueT::AllocatorType> MemberIterator; // This may be const or non-const iterator
typedef GenericMemberIterator<true, typename ValueT::EncodingType, typename ValueT::AllocatorType> ConstMemberIterator;
typedef typename ValueType::AllocatorType AllocatorType;
typedef typename ValueType::StringRefType StringRefType;
typedef typename ValueType::EncodingType EncodingType;
typedef typename ValueType::Ch Ch;
template <typename, typename>
friend class GenericValue;
GenericObject(const GenericObject& rhs) : value_(rhs.value_) {}
GenericObject& operator=(const GenericObject& rhs) { value_ = rhs.value_; return *this; }
~GenericObject() {}
SizeType MemberCount() const { return value_.MemberCount(); }
SizeType MemberCapacity() const { return value_.MemberCapacity(); }
bool ObjectEmpty() const { return value_.ObjectEmpty(); }
template <typename T> ValueType& operator[](T* name) const { return value_[name]; }
template <typename SourceAllocator> ValueType& operator[](const GenericValue<EncodingType, SourceAllocator>& name) const { return value_[name]; }
#if RAPIDJSON_HAS_STDSTRING
ValueType& operator[](const std::basic_string<Ch>& name) const { return value_[name]; }
#endif
MemberIterator MemberBegin() const { return value_.MemberBegin(); }
MemberIterator MemberEnd() const { return value_.MemberEnd(); }
GenericObject MemberReserve(SizeType newCapacity, AllocatorType &allocator) const { value_.MemberReserve(newCapacity, allocator); return *this; }
bool HasMember(const Ch* name) const { return value_.HasMember(name); }
#if RAPIDJSON_HAS_STDSTRING
bool HasMember(const std::basic_string<Ch>& name) const { return value_.HasMember(name); }
#endif
template <typename SourceAllocator> bool HasMember(const GenericValue<EncodingType, SourceAllocator>& name) const { return value_.HasMember(name); }
MemberIterator FindMember(const Ch* name) const { return value_.FindMember(name); }
template <typename SourceAllocator> MemberIterator FindMember(const GenericValue<EncodingType, SourceAllocator>& name) const { return value_.FindMember(name); }
#if RAPIDJSON_HAS_STDSTRING
MemberIterator FindMember(const std::basic_string<Ch>& name) const { return value_.FindMember(name); }
#endif
GenericObject AddMember(ValueType& name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(ValueType& name, StringRefType value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
#if RAPIDJSON_HAS_STDSTRING
GenericObject AddMember(ValueType& name, std::basic_string<Ch>& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
#endif
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (ValueType&)) AddMember(ValueType& name, T value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericObject AddMember(ValueType&& name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(ValueType&& name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(ValueType& name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(StringRefType name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericObject AddMember(StringRefType name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(StringRefType name, StringRefType value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (GenericObject)) AddMember(StringRefType name, T value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
void RemoveAllMembers() { value_.RemoveAllMembers(); }
bool RemoveMember(const Ch* name) const { return value_.RemoveMember(name); }
#if RAPIDJSON_HAS_STDSTRING
bool RemoveMember(const std::basic_string<Ch>& name) const { return value_.RemoveMember(name); }
#endif
template <typename SourceAllocator> bool RemoveMember(const GenericValue<EncodingType, SourceAllocator>& name) const { return value_.RemoveMember(name); }
MemberIterator RemoveMember(MemberIterator m) const { return value_.RemoveMember(m); }
MemberIterator EraseMember(ConstMemberIterator pos) const { return value_.EraseMember(pos); }
MemberIterator EraseMember(ConstMemberIterator first, ConstMemberIterator last) const { return value_.EraseMember(first, last); }
bool EraseMember(const Ch* name) const { return value_.EraseMember(name); }
#if RAPIDJSON_HAS_STDSTRING
bool EraseMember(const std::basic_string<Ch>& name) const { return EraseMember(ValueType(StringRef(name))); }
#endif
template <typename SourceAllocator> bool EraseMember(const GenericValue<EncodingType, SourceAllocator>& name) const { return value_.EraseMember(name); }
#if RAPIDJSON_HAS_CXX11_RANGE_FOR
MemberIterator begin() const { return value_.MemberBegin(); }
MemberIterator end() const { return value_.MemberEnd(); }
#endif
private:
GenericObject();
GenericObject(ValueType& value) : value_(value) {}
ValueType& value_;
};
RAPIDJSON_NAMESPACE_END
RAPIDJSON_DIAG_POP
#endif // RAPIDJSON_DOCUMENT_H_
|
// Tencent is pleased to support the open source community by making RapidJSON available.
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#ifndef RAPIDJSON_DOCUMENT_H_
#define RAPIDJSON_DOCUMENT_H_
/*! \file document.h */
#include "reader.h"
#include "internal/meta.h"
#include "internal/strfunc.h"
#include "memorystream.h"
#include "encodedstream.h"
#include <new> // placement new
#include <limits>
RAPIDJSON_DIAG_PUSH
#ifdef __clang__
RAPIDJSON_DIAG_OFF(padded)
RAPIDJSON_DIAG_OFF(switch-enum)
RAPIDJSON_DIAG_OFF(c++98-compat)
#elif defined(_MSC_VER)
RAPIDJSON_DIAG_OFF(4127) // conditional expression is constant
RAPIDJSON_DIAG_OFF(4244) // conversion from kXxxFlags to 'uint16_t', possible loss of data
#endif
#ifdef __GNUC__
RAPIDJSON_DIAG_OFF(effc++)
#endif // __GNUC__
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
#include <iterator> // std::random_access_iterator_tag
#endif
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
#include <utility> // std::move
#endif
RAPIDJSON_NAMESPACE_BEGIN
// Forward declaration.
template <typename Encoding, typename Allocator>
class GenericValue;
template <typename Encoding, typename Allocator, typename StackAllocator>
class GenericDocument;
//! Name-value pair in a JSON object value.
/*!
This class was internal to GenericValue. It used to be a inner struct.
But a compiler (IBM XL C/C++ for AIX) have reported to have problem with that so it moved as a namespace scope struct.
https://code.google.com/p/rapidjson/issues/detail?id=64
*/
template <typename Encoding, typename Allocator>
struct GenericMember {
GenericValue<Encoding, Allocator> name; //!< name of member (must be a string)
GenericValue<Encoding, Allocator> value; //!< value of member.
// swap() for std::sort() and other potential use in STL.
friend inline void swap(GenericMember& a, GenericMember& b) RAPIDJSON_NOEXCEPT {
a.name.Swap(b.name);
a.value.Swap(b.value);
}
};
///////////////////////////////////////////////////////////////////////////////
// GenericMemberIterator
#ifndef RAPIDJSON_NOMEMBERITERATORCLASS
//! (Constant) member iterator for a JSON object value
/*!
\tparam Const Is this a constant iterator?
\tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document)
\tparam Allocator Allocator type for allocating memory of object, array and string.
This class implements a Random Access Iterator for GenericMember elements
of a GenericValue, see ISO/IEC 14882:2003(E) C++ standard, 24.1 [lib.iterator.requirements].
\note This iterator implementation is mainly intended to avoid implicit
conversions from iterator values to \c NULL,
e.g. from GenericValue::FindMember.
\note Define \c RAPIDJSON_NOMEMBERITERATORCLASS to fall back to a
pointer-based implementation, if your platform doesn't provide
the C++ <iterator> header.
\see GenericMember, GenericValue::MemberIterator, GenericValue::ConstMemberIterator
*/
template <bool Const, typename Encoding, typename Allocator>
class GenericMemberIterator {
friend class GenericValue<Encoding,Allocator>;
template <bool, typename, typename> friend class GenericMemberIterator;
typedef GenericMember<Encoding,Allocator> PlainType;
typedef typename internal::MaybeAddConst<Const,PlainType>::Type ValueType;
public:
//! Iterator type itself
typedef GenericMemberIterator Iterator;
//! Constant iterator type
typedef GenericMemberIterator<true,Encoding,Allocator> ConstIterator;
//! Non-constant iterator type
typedef GenericMemberIterator<false,Encoding,Allocator> NonConstIterator;
/** \name std::iterator_traits support */
//@{
typedef ValueType value_type;
typedef ValueType * pointer;
typedef ValueType & reference;
typedef std::ptrdiff_t difference_type;
typedef std::random_access_iterator_tag iterator_category;
//@}
//! Pointer to (const) GenericMember
typedef pointer Pointer;
//! Reference to (const) GenericMember
typedef reference Reference;
//! Signed integer type (e.g. \c ptrdiff_t)
typedef difference_type DifferenceType;
//! Default constructor (singular value)
/*! Creates an iterator pointing to no element.
\note All operations, except for comparisons, are undefined on such values.
*/
GenericMemberIterator() : ptr_() {}
//! Iterator conversions to more const
/*!
\param it (Non-const) iterator to copy from
Allows the creation of an iterator from another GenericMemberIterator
that is "less const". Especially, creating a non-constant iterator
from a constant iterator are disabled:
\li const -> non-const (not ok)
\li const -> const (ok)
\li non-const -> const (ok)
\li non-const -> non-const (ok)
\note If the \c Const template parameter is already \c false, this
constructor effectively defines a regular copy-constructor.
Otherwise, the copy constructor is implicitly defined.
*/
GenericMemberIterator(const NonConstIterator & it) : ptr_(it.ptr_) {}
Iterator& operator=(const NonConstIterator & it) { ptr_ = it.ptr_; return *this; }
//! @name stepping
//@{
Iterator& operator++(){ ++ptr_; return *this; }
Iterator& operator--(){ --ptr_; return *this; }
Iterator operator++(int){ Iterator old(*this); ++ptr_; return old; }
Iterator operator--(int){ Iterator old(*this); --ptr_; return old; }
//@}
//! @name increment/decrement
//@{
Iterator operator+(DifferenceType n) const { return Iterator(ptr_+n); }
Iterator operator-(DifferenceType n) const { return Iterator(ptr_-n); }
Iterator& operator+=(DifferenceType n) { ptr_+=n; return *this; }
Iterator& operator-=(DifferenceType n) { ptr_-=n; return *this; }
//@}
//! @name relations
//@{
bool operator==(ConstIterator that) const { return ptr_ == that.ptr_; }
bool operator!=(ConstIterator that) const { return ptr_ != that.ptr_; }
bool operator<=(ConstIterator that) const { return ptr_ <= that.ptr_; }
bool operator>=(ConstIterator that) const { return ptr_ >= that.ptr_; }
bool operator< (ConstIterator that) const { return ptr_ < that.ptr_; }
bool operator> (ConstIterator that) const { return ptr_ > that.ptr_; }
//@}
//! @name dereference
//@{
Reference operator*() const { return *ptr_; }
Pointer operator->() const { return ptr_; }
Reference operator[](DifferenceType n) const { return ptr_[n]; }
//@}
//! Distance
DifferenceType operator-(ConstIterator that) const { return ptr_-that.ptr_; }
private:
//! Internal constructor from plain pointer
explicit GenericMemberIterator(Pointer p) : ptr_(p) {}
Pointer ptr_; //!< raw pointer
};
#else // RAPIDJSON_NOMEMBERITERATORCLASS
// class-based member iterator implementation disabled, use plain pointers
template <bool Const, typename Encoding, typename Allocator>
class GenericMemberIterator;
//! non-const GenericMemberIterator
template <typename Encoding, typename Allocator>
class GenericMemberIterator<false,Encoding,Allocator> {
//! use plain pointer as iterator type
typedef GenericMember<Encoding,Allocator>* Iterator;
};
//! const GenericMemberIterator
template <typename Encoding, typename Allocator>
class GenericMemberIterator<true,Encoding,Allocator> {
//! use plain const pointer as iterator type
typedef const GenericMember<Encoding,Allocator>* Iterator;
};
#endif // RAPIDJSON_NOMEMBERITERATORCLASS
///////////////////////////////////////////////////////////////////////////////
// GenericStringRef
//! Reference to a constant string (not taking a copy)
/*!
\tparam CharType character type of the string
This helper class is used to automatically infer constant string
references for string literals, especially from \c const \b (!)
character arrays.
The main use is for creating JSON string values without copying the
source string via an \ref Allocator. This requires that the referenced
string pointers have a sufficient lifetime, which exceeds the lifetime
of the associated GenericValue.
\b Example
\code
Value v("foo"); // ok, no need to copy & calculate length
const char foo[] = "foo";
v.SetString(foo); // ok
const char* bar = foo;
// Value x(bar); // not ok, can't rely on bar's lifetime
Value x(StringRef(bar)); // lifetime explicitly guaranteed by user
Value y(StringRef(bar, 3)); // ok, explicitly pass length
\endcode
\see StringRef, GenericValue::SetString
*/
template<typename CharType>
struct GenericStringRef {
typedef CharType Ch; //!< character type of the string
//! Create string reference from \c const character array
#ifndef __clang__ // -Wdocumentation
/*!
This constructor implicitly creates a constant string reference from
a \c const character array. It has better performance than
\ref StringRef(const CharType*) by inferring the string \ref length
from the array length, and also supports strings containing null
characters.
\tparam N length of the string, automatically inferred
\param str Constant character array, lifetime assumed to be longer
than the use of the string in e.g. a GenericValue
\post \ref s == str
\note Constant complexity.
\note There is a hidden, private overload to disallow references to
non-const character arrays to be created via this constructor.
By this, e.g. function-scope arrays used to be filled via
\c snprintf are excluded from consideration.
In such cases, the referenced string should be \b copied to the
GenericValue instead.
*/
#endif
template<SizeType N>
GenericStringRef(const CharType (&str)[N]) RAPIDJSON_NOEXCEPT
: s(str), length(N-1) {}
//! Explicitly create string reference from \c const character pointer
#ifndef __clang__ // -Wdocumentation
/*!
This constructor can be used to \b explicitly create a reference to
a constant string pointer.
\see StringRef(const CharType*)
\param str Constant character pointer, lifetime assumed to be longer
than the use of the string in e.g. a GenericValue
\post \ref s == str
\note There is a hidden, private overload to disallow references to
non-const character arrays to be created via this constructor.
By this, e.g. function-scope arrays used to be filled via
\c snprintf are excluded from consideration.
In such cases, the referenced string should be \b copied to the
GenericValue instead.
*/
#endif
explicit GenericStringRef(const CharType* str)
: s(str), length(NotNullStrLen(str)) {}
//! Create constant string reference from pointer and length
#ifndef __clang__ // -Wdocumentation
/*! \param str constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
\param len length of the string, excluding the trailing NULL terminator
\post \ref s == str && \ref length == len
\note Constant complexity.
*/
#endif
GenericStringRef(const CharType* str, SizeType len)
: s(RAPIDJSON_LIKELY(str) ? str : emptyString), length(len) { RAPIDJSON_ASSERT(str != 0 || len == 0u); }
GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {}
//! implicit conversion to plain CharType pointer
operator const Ch *() const { return s; }
const Ch* const s; //!< plain CharType pointer
const SizeType length; //!< length of the string (excluding the trailing NULL terminator)
private:
SizeType NotNullStrLen(const CharType* str) {
RAPIDJSON_ASSERT(str != 0);
return internal::StrLen(str);
}
/// Empty string - used when passing in a NULL pointer
static const Ch emptyString[];
//! Disallow construction from non-const array
template<SizeType N>
GenericStringRef(CharType (&str)[N]) /* = delete */;
//! Copy assignment operator not permitted - immutable type
GenericStringRef& operator=(const GenericStringRef& rhs) /* = delete */;
};
template<typename CharType>
const CharType GenericStringRef<CharType>::emptyString[] = { CharType() };
//! Mark a character pointer as constant string
/*! Mark a plain character pointer as a "string literal". This function
can be used to avoid copying a character string to be referenced as a
value in a JSON GenericValue object, if the string's lifetime is known
to be valid long enough.
\tparam CharType Character type of the string
\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
\return GenericStringRef string reference object
\relatesalso GenericStringRef
\see GenericValue::GenericValue(StringRefType), GenericValue::operator=(StringRefType), GenericValue::SetString(StringRefType), GenericValue::PushBack(StringRefType, Allocator&), GenericValue::AddMember
*/
template<typename CharType>
inline GenericStringRef<CharType> StringRef(const CharType* str) {
return GenericStringRef<CharType>(str);
}
//! Mark a character pointer as constant string
/*! Mark a plain character pointer as a "string literal". This function
can be used to avoid copying a character string to be referenced as a
value in a JSON GenericValue object, if the string's lifetime is known
to be valid long enough.
This version has better performance with supplied length, and also
supports string containing null characters.
\tparam CharType character type of the string
\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
\param length The length of source string.
\return GenericStringRef string reference object
\relatesalso GenericStringRef
*/
template<typename CharType>
inline GenericStringRef<CharType> StringRef(const CharType* str, size_t length) {
return GenericStringRef<CharType>(str, SizeType(length));
}
#if RAPIDJSON_HAS_STDSTRING
//! Mark a string object as constant string
/*! Mark a string object (e.g. \c std::string) as a "string literal".
This function can be used to avoid copying a string to be referenced as a
value in a JSON GenericValue object, if the string's lifetime is known
to be valid long enough.
\tparam CharType character type of the string
\param str Constant string, lifetime assumed to be longer than the use of the string in e.g. a GenericValue
\return GenericStringRef string reference object
\relatesalso GenericStringRef
\note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
template<typename CharType>
inline GenericStringRef<CharType> StringRef(const std::basic_string<CharType>& str) {
return GenericStringRef<CharType>(str.data(), SizeType(str.size()));
}
#endif
///////////////////////////////////////////////////////////////////////////////
// GenericValue type traits
namespace internal {
template <typename T, typename Encoding = void, typename Allocator = void>
struct IsGenericValueImpl : FalseType {};
// select candidates according to nested encoding and allocator types
template <typename T> struct IsGenericValueImpl<T, typename Void<typename T::EncodingType>::Type, typename Void<typename T::AllocatorType>::Type>
: IsBaseOf<GenericValue<typename T::EncodingType, typename T::AllocatorType>, T>::Type {};
// helper to match arbitrary GenericValue instantiations, including derived classes
template <typename T> struct IsGenericValue : IsGenericValueImpl<T>::Type {};
} // namespace internal
///////////////////////////////////////////////////////////////////////////////
// TypeHelper
namespace internal {
template <typename ValueType, typename T>
struct TypeHelper {};
template<typename ValueType>
struct TypeHelper<ValueType, bool> {
static bool Is(const ValueType& v) { return v.IsBool(); }
static bool Get(const ValueType& v) { return v.GetBool(); }
static ValueType& Set(ValueType& v, bool data) { return v.SetBool(data); }
static ValueType& Set(ValueType& v, bool data, typename ValueType::AllocatorType&) { return v.SetBool(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, int> {
static bool Is(const ValueType& v) { return v.IsInt(); }
static int Get(const ValueType& v) { return v.GetInt(); }
static ValueType& Set(ValueType& v, int data) { return v.SetInt(data); }
static ValueType& Set(ValueType& v, int data, typename ValueType::AllocatorType&) { return v.SetInt(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, unsigned> {
static bool Is(const ValueType& v) { return v.IsUint(); }
static unsigned Get(const ValueType& v) { return v.GetUint(); }
static ValueType& Set(ValueType& v, unsigned data) { return v.SetUint(data); }
static ValueType& Set(ValueType& v, unsigned data, typename ValueType::AllocatorType&) { return v.SetUint(data); }
};
#ifdef _MSC_VER
RAPIDJSON_STATIC_ASSERT(sizeof(long) == sizeof(int));
template<typename ValueType>
struct TypeHelper<ValueType, long> {
static bool Is(const ValueType& v) { return v.IsInt(); }
static long Get(const ValueType& v) { return v.GetInt(); }
static ValueType& Set(ValueType& v, long data) { return v.SetInt(data); }
static ValueType& Set(ValueType& v, long data, typename ValueType::AllocatorType&) { return v.SetInt(data); }
};
RAPIDJSON_STATIC_ASSERT(sizeof(unsigned long) == sizeof(unsigned));
template<typename ValueType>
struct TypeHelper<ValueType, unsigned long> {
static bool Is(const ValueType& v) { return v.IsUint(); }
static unsigned long Get(const ValueType& v) { return v.GetUint(); }
static ValueType& Set(ValueType& v, unsigned long data) { return v.SetUint(data); }
static ValueType& Set(ValueType& v, unsigned long data, typename ValueType::AllocatorType&) { return v.SetUint(data); }
};
#endif
template<typename ValueType>
struct TypeHelper<ValueType, int64_t> {
static bool Is(const ValueType& v) { return v.IsInt64(); }
static int64_t Get(const ValueType& v) { return v.GetInt64(); }
static ValueType& Set(ValueType& v, int64_t data) { return v.SetInt64(data); }
static ValueType& Set(ValueType& v, int64_t data, typename ValueType::AllocatorType&) { return v.SetInt64(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, uint64_t> {
static bool Is(const ValueType& v) { return v.IsUint64(); }
static uint64_t Get(const ValueType& v) { return v.GetUint64(); }
static ValueType& Set(ValueType& v, uint64_t data) { return v.SetUint64(data); }
static ValueType& Set(ValueType& v, uint64_t data, typename ValueType::AllocatorType&) { return v.SetUint64(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, double> {
static bool Is(const ValueType& v) { return v.IsDouble(); }
static double Get(const ValueType& v) { return v.GetDouble(); }
static ValueType& Set(ValueType& v, double data) { return v.SetDouble(data); }
static ValueType& Set(ValueType& v, double data, typename ValueType::AllocatorType&) { return v.SetDouble(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, float> {
static bool Is(const ValueType& v) { return v.IsFloat(); }
static float Get(const ValueType& v) { return v.GetFloat(); }
static ValueType& Set(ValueType& v, float data) { return v.SetFloat(data); }
static ValueType& Set(ValueType& v, float data, typename ValueType::AllocatorType&) { return v.SetFloat(data); }
};
template<typename ValueType>
struct TypeHelper<ValueType, const typename ValueType::Ch*> {
typedef const typename ValueType::Ch* StringType;
static bool Is(const ValueType& v) { return v.IsString(); }
static StringType Get(const ValueType& v) { return v.GetString(); }
static ValueType& Set(ValueType& v, const StringType data) { return v.SetString(typename ValueType::StringRefType(data)); }
static ValueType& Set(ValueType& v, const StringType data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); }
};
#if RAPIDJSON_HAS_STDSTRING
template<typename ValueType>
struct TypeHelper<ValueType, std::basic_string<typename ValueType::Ch> > {
typedef std::basic_string<typename ValueType::Ch> StringType;
static bool Is(const ValueType& v) { return v.IsString(); }
static StringType Get(const ValueType& v) { return StringType(v.GetString(), v.GetStringLength()); }
static ValueType& Set(ValueType& v, const StringType& data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); }
};
#endif
template<typename ValueType>
struct TypeHelper<ValueType, typename ValueType::Array> {
typedef typename ValueType::Array ArrayType;
static bool Is(const ValueType& v) { return v.IsArray(); }
static ArrayType Get(ValueType& v) { return v.GetArray(); }
static ValueType& Set(ValueType& v, ArrayType data) { return v = data; }
static ValueType& Set(ValueType& v, ArrayType data, typename ValueType::AllocatorType&) { return v = data; }
};
template<typename ValueType>
struct TypeHelper<ValueType, typename ValueType::ConstArray> {
typedef typename ValueType::ConstArray ArrayType;
static bool Is(const ValueType& v) { return v.IsArray(); }
static ArrayType Get(const ValueType& v) { return v.GetArray(); }
};
template<typename ValueType>
struct TypeHelper<ValueType, typename ValueType::Object> {
typedef typename ValueType::Object ObjectType;
static bool Is(const ValueType& v) { return v.IsObject(); }
static ObjectType Get(ValueType& v) { return v.GetObject(); }
static ValueType& Set(ValueType& v, ObjectType data) { return v = data; }
static ValueType& Set(ValueType& v, ObjectType data, typename ValueType::AllocatorType&) { return v = data; }
};
template<typename ValueType>
struct TypeHelper<ValueType, typename ValueType::ConstObject> {
typedef typename ValueType::ConstObject ObjectType;
static bool Is(const ValueType& v) { return v.IsObject(); }
static ObjectType Get(const ValueType& v) { return v.GetObject(); }
};
} // namespace internal
// Forward declarations
template <bool, typename> class GenericArray;
template <bool, typename> class GenericObject;
///////////////////////////////////////////////////////////////////////////////
// GenericValue
//! Represents a JSON value. Use Value for UTF8 encoding and default allocator.
/*!
A JSON value can be one of 7 types. This class is a variant type supporting
these types.
Use the Value if UTF8 and default allocator
\tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document)
\tparam Allocator Allocator type for allocating memory of object, array and string.
*/
template <typename Encoding, typename Allocator = MemoryPoolAllocator<> >
class GenericValue {
public:
//! Name-value pair in an object.
typedef GenericMember<Encoding, Allocator> Member;
typedef Encoding EncodingType; //!< Encoding type from template parameter.
typedef Allocator AllocatorType; //!< Allocator type from template parameter.
typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding.
typedef GenericStringRef<Ch> StringRefType; //!< Reference to a constant string
typedef typename GenericMemberIterator<false,Encoding,Allocator>::Iterator MemberIterator; //!< Member iterator for iterating in object.
typedef typename GenericMemberIterator<true,Encoding,Allocator>::Iterator ConstMemberIterator; //!< Constant member iterator for iterating in object.
typedef GenericValue* ValueIterator; //!< Value iterator for iterating in array.
typedef const GenericValue* ConstValueIterator; //!< Constant value iterator for iterating in array.
typedef GenericValue<Encoding, Allocator> ValueType; //!< Value type of itself.
typedef GenericArray<false, ValueType> Array;
typedef GenericArray<true, ValueType> ConstArray;
typedef GenericObject<false, ValueType> Object;
typedef GenericObject<true, ValueType> ConstObject;
//!@name Constructors and destructor.
//@{
//! Default constructor creates a null value.
GenericValue() RAPIDJSON_NOEXCEPT : data_() { data_.f.flags = kNullFlag; }
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Move constructor in C++11
GenericValue(GenericValue&& rhs) RAPIDJSON_NOEXCEPT : data_(rhs.data_) {
rhs.data_.f.flags = kNullFlag; // give up contents
}
#endif
private:
//! Copy constructor is not permitted.
GenericValue(const GenericValue& rhs);
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Moving from a GenericDocument is not permitted.
template <typename StackAllocator>
GenericValue(GenericDocument<Encoding,Allocator,StackAllocator>&& rhs);
//! Move assignment from a GenericDocument is not permitted.
template <typename StackAllocator>
GenericValue& operator=(GenericDocument<Encoding,Allocator,StackAllocator>&& rhs);
#endif
public:
//! Constructor with JSON value type.
/*! This creates a Value of specified type with default content.
\param type Type of the value.
\note Default content for number is zero.
*/
explicit GenericValue(Type type) RAPIDJSON_NOEXCEPT : data_() {
static const uint16_t defaultFlags[] = {
kNullFlag, kFalseFlag, kTrueFlag, kObjectFlag, kArrayFlag, kShortStringFlag,
kNumberAnyFlag
};
RAPIDJSON_NOEXCEPT_ASSERT(type >= kNullType && type <= kNumberType);
data_.f.flags = defaultFlags[type];
// Use ShortString to store empty string.
if (type == kStringType)
data_.ss.SetLength(0);
}
//! Explicit copy constructor (with allocator)
/*! Creates a copy of a Value by using the given Allocator
\tparam SourceAllocator allocator of \c rhs
\param rhs Value to copy from (read-only)
\param allocator Allocator for allocating copied elements and buffers. Commonly use GenericDocument::GetAllocator().
\param copyConstStrings Force copying of constant strings (e.g. referencing an in-situ buffer)
\see CopyFrom()
*/
template <typename SourceAllocator>
GenericValue(const GenericValue<Encoding,SourceAllocator>& rhs, Allocator& allocator, bool copyConstStrings = false) {
switch (rhs.GetType()) {
case kObjectType: {
SizeType count = rhs.data_.o.size;
Member* lm = reinterpret_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
const typename GenericValue<Encoding,SourceAllocator>::Member* rm = rhs.GetMembersPointer();
for (SizeType i = 0; i < count; i++) {
new (&lm[i].name) GenericValue(rm[i].name, allocator, copyConstStrings);
new (&lm[i].value) GenericValue(rm[i].value, allocator, copyConstStrings);
}
data_.f.flags = kObjectFlag;
data_.o.size = data_.o.capacity = count;
SetMembersPointer(lm);
}
break;
case kArrayType: {
SizeType count = rhs.data_.a.size;
GenericValue* le = reinterpret_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
const GenericValue<Encoding,SourceAllocator>* re = rhs.GetElementsPointer();
for (SizeType i = 0; i < count; i++)
new (&le[i]) GenericValue(re[i], allocator, copyConstStrings);
data_.f.flags = kArrayFlag;
data_.a.size = data_.a.capacity = count;
SetElementsPointer(le);
}
break;
case kStringType:
if (rhs.data_.f.flags == kConstStringFlag && !copyConstStrings) {
data_.f.flags = rhs.data_.f.flags;
data_ = *reinterpret_cast<const Data*>(&rhs.data_);
}
else
SetStringRaw(StringRef(rhs.GetString(), rhs.GetStringLength()), allocator);
break;
default:
data_.f.flags = rhs.data_.f.flags;
data_ = *reinterpret_cast<const Data*>(&rhs.data_);
break;
}
}
//! Constructor for boolean value.
/*! \param b Boolean value
\note This constructor is limited to \em real boolean values and rejects
implicitly converted types like arbitrary pointers. Use an explicit cast
to \c bool, if you want to construct a boolean JSON value in such cases.
*/
#ifndef RAPIDJSON_DOXYGEN_RUNNING // hide SFINAE from Doxygen
template <typename T>
explicit GenericValue(T b, RAPIDJSON_ENABLEIF((internal::IsSame<bool, T>))) RAPIDJSON_NOEXCEPT // See #472
#else
explicit GenericValue(bool b) RAPIDJSON_NOEXCEPT
#endif
: data_() {
// safe-guard against failing SFINAE
RAPIDJSON_STATIC_ASSERT((internal::IsSame<bool,T>::Value));
data_.f.flags = b ? kTrueFlag : kFalseFlag;
}
//! Constructor for int value.
explicit GenericValue(int i) RAPIDJSON_NOEXCEPT : data_() {
data_.n.i64 = i;
data_.f.flags = (i >= 0) ? (kNumberIntFlag | kUintFlag | kUint64Flag) : kNumberIntFlag;
}
//! Constructor for unsigned value.
explicit GenericValue(unsigned u) RAPIDJSON_NOEXCEPT : data_() {
data_.n.u64 = u;
data_.f.flags = (u & 0x80000000) ? kNumberUintFlag : (kNumberUintFlag | kIntFlag | kInt64Flag);
}
//! Constructor for int64_t value.
explicit GenericValue(int64_t i64) RAPIDJSON_NOEXCEPT : data_() {
data_.n.i64 = i64;
data_.f.flags = kNumberInt64Flag;
if (i64 >= 0) {
data_.f.flags |= kNumberUint64Flag;
if (!(static_cast<uint64_t>(i64) & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x00000000)))
data_.f.flags |= kUintFlag;
if (!(static_cast<uint64_t>(i64) & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
data_.f.flags |= kIntFlag;
}
else if (i64 >= static_cast<int64_t>(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
data_.f.flags |= kIntFlag;
}
//! Constructor for uint64_t value.
explicit GenericValue(uint64_t u64) RAPIDJSON_NOEXCEPT : data_() {
data_.n.u64 = u64;
data_.f.flags = kNumberUint64Flag;
if (!(u64 & RAPIDJSON_UINT64_C2(0x80000000, 0x00000000)))
data_.f.flags |= kInt64Flag;
if (!(u64 & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x00000000)))
data_.f.flags |= kUintFlag;
if (!(u64 & RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0x80000000)))
data_.f.flags |= kIntFlag;
}
//! Constructor for double value.
explicit GenericValue(double d) RAPIDJSON_NOEXCEPT : data_() { data_.n.d = d; data_.f.flags = kNumberDoubleFlag; }
//! Constructor for float value.
explicit GenericValue(float f) RAPIDJSON_NOEXCEPT : data_() { data_.n.d = static_cast<double>(f); data_.f.flags = kNumberDoubleFlag; }
//! Constructor for constant string (i.e. do not make a copy of string)
GenericValue(const Ch* s, SizeType length) RAPIDJSON_NOEXCEPT : data_() { SetStringRaw(StringRef(s, length)); }
//! Constructor for constant string (i.e. do not make a copy of string)
explicit GenericValue(StringRefType s) RAPIDJSON_NOEXCEPT : data_() { SetStringRaw(s); }
//! Constructor for copy-string (i.e. do make a copy of string)
GenericValue(const Ch* s, SizeType length, Allocator& allocator) : data_() { SetStringRaw(StringRef(s, length), allocator); }
//! Constructor for copy-string (i.e. do make a copy of string)
GenericValue(const Ch*s, Allocator& allocator) : data_() { SetStringRaw(StringRef(s), allocator); }
#if RAPIDJSON_HAS_STDSTRING
//! Constructor for copy-string from a string object (i.e. do make a copy of string)
/*! \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
GenericValue(const std::basic_string<Ch>& s, Allocator& allocator) : data_() { SetStringRaw(StringRef(s), allocator); }
#endif
//! Constructor for Array.
/*!
\param a An array obtained by \c GetArray().
\note \c Array is always pass-by-value.
\note the source array is moved into this value and the sourec array becomes empty.
*/
GenericValue(Array a) RAPIDJSON_NOEXCEPT : data_(a.value_.data_) {
a.value_.data_ = Data();
a.value_.data_.f.flags = kArrayFlag;
}
//! Constructor for Object.
/*!
\param o An object obtained by \c GetObject().
\note \c Object is always pass-by-value.
\note the source object is moved into this value and the sourec object becomes empty.
*/
GenericValue(Object o) RAPIDJSON_NOEXCEPT : data_(o.value_.data_) {
o.value_.data_ = Data();
o.value_.data_.f.flags = kObjectFlag;
}
//! Destructor.
/*! Need to destruct elements of array, members of object, or copy-string.
*/
~GenericValue() {
if (Allocator::kNeedFree) { // Shortcut by Allocator's trait
switch(data_.f.flags) {
case kArrayFlag:
{
GenericValue* e = GetElementsPointer();
for (GenericValue* v = e; v != e + data_.a.size; ++v)
v->~GenericValue();
Allocator::Free(e);
}
break;
case kObjectFlag:
for (MemberIterator m = MemberBegin(); m != MemberEnd(); ++m)
m->~Member();
Allocator::Free(GetMembersPointer());
break;
case kCopyStringFlag:
Allocator::Free(const_cast<Ch*>(GetStringPointer()));
break;
default:
break; // Do nothing for other types.
}
}
}
//@}
//!@name Assignment operators
//@{
//! Assignment with move semantics.
/*! \param rhs Source of the assignment. It will become a null value after assignment.
*/
GenericValue& operator=(GenericValue& rhs) RAPIDJSON_NOEXCEPT {
if (RAPIDJSON_LIKELY(this != &rhs)) {
this->~GenericValue();
RawAssign(rhs);
}
return *this;
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Move assignment in C++11
GenericValue& operator=(GenericValue&& rhs) RAPIDJSON_NOEXCEPT {
return *this = rhs.Move();
}
#endif
//! Assignment of constant string reference (no copy)
/*! \param str Constant string reference to be assigned
\note This overload is needed to avoid clashes with the generic primitive type assignment overload below.
\see GenericStringRef, operator=(T)
*/
GenericValue& operator=(StringRefType str) RAPIDJSON_NOEXCEPT {
GenericValue s(str);
return *this = s;
}
//! Assignment with primitive types.
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t
\param value The value to be assigned.
\note The source type \c T explicitly disallows all pointer types,
especially (\c const) \ref Ch*. This helps avoiding implicitly
referencing character strings with insufficient lifetime, use
\ref SetString(const Ch*, Allocator&) (for copying) or
\ref StringRef() (to explicitly mark the pointer as constant) instead.
All other pointer types would implicitly convert to \c bool,
use \ref SetBool() instead.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::IsPointer<T>), (GenericValue&))
operator=(T value) {
GenericValue v(value);
return *this = v;
}
//! Deep-copy assignment from Value
/*! Assigns a \b copy of the Value to the current Value object
\tparam SourceAllocator Allocator type of \c rhs
\param rhs Value to copy from (read-only)
\param allocator Allocator to use for copying
\param copyConstStrings Force copying of constant strings (e.g. referencing an in-situ buffer)
*/
template <typename SourceAllocator>
GenericValue& CopyFrom(const GenericValue<Encoding, SourceAllocator>& rhs, Allocator& allocator, bool copyConstStrings = false) {
RAPIDJSON_ASSERT(static_cast<void*>(this) != static_cast<void const*>(&rhs));
this->~GenericValue();
new (this) GenericValue(rhs, allocator, copyConstStrings);
return *this;
}
//! Exchange the contents of this value with those of other.
/*!
\param other Another value.
\note Constant complexity.
*/
GenericValue& Swap(GenericValue& other) RAPIDJSON_NOEXCEPT {
GenericValue temp;
temp.RawAssign(*this);
RawAssign(other);
other.RawAssign(temp);
return *this;
}
//! free-standing swap function helper
/*!
Helper function to enable support for common swap implementation pattern based on \c std::swap:
\code
void swap(MyClass& a, MyClass& b) {
using std::swap;
swap(a.value, b.value);
// ...
}
\endcode
\see Swap()
*/
friend inline void swap(GenericValue& a, GenericValue& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }
//! Prepare Value for move semantics
/*! \return *this */
GenericValue& Move() RAPIDJSON_NOEXCEPT { return *this; }
//@}
//!@name Equal-to and not-equal-to operators
//@{
//! Equal-to operator
/*!
\note If an object contains duplicated named member, comparing equality with any object is always \c false.
\note Complexity is quadratic in Object's member number and linear for the rest (number of all values in the subtree and total lengths of all strings).
*/
template <typename SourceAllocator>
bool operator==(const GenericValue<Encoding, SourceAllocator>& rhs) const {
typedef GenericValue<Encoding, SourceAllocator> RhsType;
if (GetType() != rhs.GetType())
return false;
switch (GetType()) {
case kObjectType: // Warning: O(n^2) inner-loop
if (data_.o.size != rhs.data_.o.size)
return false;
for (ConstMemberIterator lhsMemberItr = MemberBegin(); lhsMemberItr != MemberEnd(); ++lhsMemberItr) {
typename RhsType::ConstMemberIterator rhsMemberItr = rhs.FindMember(lhsMemberItr->name);
if (rhsMemberItr == rhs.MemberEnd() || lhsMemberItr->value != rhsMemberItr->value)
return false;
}
return true;
case kArrayType:
if (data_.a.size != rhs.data_.a.size)
return false;
for (SizeType i = 0; i < data_.a.size; i++)
if ((*this)[i] != rhs[i])
return false;
return true;
case kStringType:
return StringEqual(rhs);
case kNumberType:
if (IsDouble() || rhs.IsDouble()) {
double a = GetDouble(); // May convert from integer to double.
double b = rhs.GetDouble(); // Ditto
return a >= b && a <= b; // Prevent -Wfloat-equal
}
else
return data_.n.u64 == rhs.data_.n.u64;
default:
return true;
}
}
//! Equal-to operator with const C-string pointer
bool operator==(const Ch* rhs) const { return *this == GenericValue(StringRef(rhs)); }
#if RAPIDJSON_HAS_STDSTRING
//! Equal-to operator with string object
/*! \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
bool operator==(const std::basic_string<Ch>& rhs) const { return *this == GenericValue(StringRef(rhs)); }
#endif
//! Equal-to operator with primitive types
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t, \c double, \c true, \c false
*/
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>,internal::IsGenericValue<T> >), (bool)) operator==(const T& rhs) const { return *this == GenericValue(rhs); }
//! Not-equal-to operator
/*! \return !(*this == rhs)
*/
template <typename SourceAllocator>
bool operator!=(const GenericValue<Encoding, SourceAllocator>& rhs) const { return !(*this == rhs); }
//! Not-equal-to operator with const C-string pointer
bool operator!=(const Ch* rhs) const { return !(*this == rhs); }
//! Not-equal-to operator with arbitrary types
/*! \return !(*this == rhs)
*/
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue<T>), (bool)) operator!=(const T& rhs) const { return !(*this == rhs); }
//! Equal-to operator with arbitrary types (symmetric version)
/*! \return (rhs == lhs)
*/
template <typename T> friend RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue<T>), (bool)) operator==(const T& lhs, const GenericValue& rhs) { return rhs == lhs; }
//! Not-Equal-to operator with arbitrary types (symmetric version)
/*! \return !(rhs == lhs)
*/
template <typename T> friend RAPIDJSON_DISABLEIF_RETURN((internal::IsGenericValue<T>), (bool)) operator!=(const T& lhs, const GenericValue& rhs) { return !(rhs == lhs); }
//@}
//!@name Type
//@{
Type GetType() const { return static_cast<Type>(data_.f.flags & kTypeMask); }
bool IsNull() const { return data_.f.flags == kNullFlag; }
bool IsFalse() const { return data_.f.flags == kFalseFlag; }
bool IsTrue() const { return data_.f.flags == kTrueFlag; }
bool IsBool() const { return (data_.f.flags & kBoolFlag) != 0; }
bool IsObject() const { return data_.f.flags == kObjectFlag; }
bool IsArray() const { return data_.f.flags == kArrayFlag; }
bool IsNumber() const { return (data_.f.flags & kNumberFlag) != 0; }
bool IsInt() const { return (data_.f.flags & kIntFlag) != 0; }
bool IsUint() const { return (data_.f.flags & kUintFlag) != 0; }
bool IsInt64() const { return (data_.f.flags & kInt64Flag) != 0; }
bool IsUint64() const { return (data_.f.flags & kUint64Flag) != 0; }
bool IsDouble() const { return (data_.f.flags & kDoubleFlag) != 0; }
bool IsString() const { return (data_.f.flags & kStringFlag) != 0; }
// Checks whether a number can be losslessly converted to a double.
bool IsLosslessDouble() const {
if (!IsNumber()) return false;
if (IsUint64()) {
uint64_t u = GetUint64();
volatile double d = static_cast<double>(u);
return (d >= 0.0)
&& (d < static_cast<double>((std::numeric_limits<uint64_t>::max)()))
&& (u == static_cast<uint64_t>(d));
}
if (IsInt64()) {
int64_t i = GetInt64();
volatile double d = static_cast<double>(i);
return (d >= static_cast<double>((std::numeric_limits<int64_t>::min)()))
&& (d < static_cast<double>((std::numeric_limits<int64_t>::max)()))
&& (i == static_cast<int64_t>(d));
}
return true; // double, int, uint are always lossless
}
// Checks whether a number is a float (possible lossy).
bool IsFloat() const {
if ((data_.f.flags & kDoubleFlag) == 0)
return false;
double d = GetDouble();
return d >= -3.4028234e38 && d <= 3.4028234e38;
}
// Checks whether a number can be losslessly converted to a float.
bool IsLosslessFloat() const {
if (!IsNumber()) return false;
double a = GetDouble();
if (a < static_cast<double>(-(std::numeric_limits<float>::max)())
|| a > static_cast<double>((std::numeric_limits<float>::max)()))
return false;
double b = static_cast<double>(static_cast<float>(a));
return a >= b && a <= b; // Prevent -Wfloat-equal
}
//@}
//!@name Null
//@{
GenericValue& SetNull() { this->~GenericValue(); new (this) GenericValue(); return *this; }
//@}
//!@name Bool
//@{
bool GetBool() const { RAPIDJSON_ASSERT(IsBool()); return data_.f.flags == kTrueFlag; }
//!< Set boolean value
/*! \post IsBool() == true */
GenericValue& SetBool(bool b) { this->~GenericValue(); new (this) GenericValue(b); return *this; }
//@}
//!@name Object
//@{
//! Set this value as an empty object.
/*! \post IsObject() == true */
GenericValue& SetObject() { this->~GenericValue(); new (this) GenericValue(kObjectType); return *this; }
//! Get the number of members in the object.
SizeType MemberCount() const { RAPIDJSON_ASSERT(IsObject()); return data_.o.size; }
//! Get the capacity of object.
SizeType MemberCapacity() const { RAPIDJSON_ASSERT(IsObject()); return data_.o.capacity; }
//! Check whether the object is empty.
bool ObjectEmpty() const { RAPIDJSON_ASSERT(IsObject()); return data_.o.size == 0; }
//! Get a value from an object associated with the name.
/*! \pre IsObject() == true
\tparam T Either \c Ch or \c const \c Ch (template used for disambiguation with \ref operator[](SizeType))
\note In version 0.1x, if the member is not found, this function returns a null value. This makes issue 7.
Since 0.2, if the name is not correct, it will assert.
If user is unsure whether a member exists, user should use HasMember() first.
A better approach is to use FindMember().
\note Linear time complexity.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::NotExpr<internal::IsSame<typename internal::RemoveConst<T>::Type, Ch> >),(GenericValue&)) operator[](T* name) {
GenericValue n(StringRef(name));
return (*this)[n];
}
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::NotExpr<internal::IsSame<typename internal::RemoveConst<T>::Type, Ch> >),(const GenericValue&)) operator[](T* name) const { return const_cast<GenericValue&>(*this)[name]; }
//! Get a value from an object associated with the name.
/*! \pre IsObject() == true
\tparam SourceAllocator Allocator of the \c name value
\note Compared to \ref operator[](T*), this version is faster because it does not need a StrLen().
And it can also handle strings with embedded null characters.
\note Linear time complexity.
*/
template <typename SourceAllocator>
GenericValue& operator[](const GenericValue<Encoding, SourceAllocator>& name) {
MemberIterator member = FindMember(name);
if (member != MemberEnd())
return member->value;
else {
RAPIDJSON_ASSERT(false); // see above note
// This will generate -Wexit-time-destructors in clang
// static GenericValue NullValue;
// return NullValue;
// Use static buffer and placement-new to prevent destruction
static char buffer[sizeof(GenericValue)];
return *new (buffer) GenericValue();
}
}
template <typename SourceAllocator>
const GenericValue& operator[](const GenericValue<Encoding, SourceAllocator>& name) const { return const_cast<GenericValue&>(*this)[name]; }
#if RAPIDJSON_HAS_STDSTRING
//! Get a value from an object associated with name (string object).
GenericValue& operator[](const std::basic_string<Ch>& name) { return (*this)[GenericValue(StringRef(name))]; }
const GenericValue& operator[](const std::basic_string<Ch>& name) const { return (*this)[GenericValue(StringRef(name))]; }
#endif
//! Const member iterator
/*! \pre IsObject() == true */
ConstMemberIterator MemberBegin() const { RAPIDJSON_ASSERT(IsObject()); return ConstMemberIterator(GetMembersPointer()); }
//! Const \em past-the-end member iterator
/*! \pre IsObject() == true */
ConstMemberIterator MemberEnd() const { RAPIDJSON_ASSERT(IsObject()); return ConstMemberIterator(GetMembersPointer() + data_.o.size); }
//! Member iterator
/*! \pre IsObject() == true */
MemberIterator MemberBegin() { RAPIDJSON_ASSERT(IsObject()); return MemberIterator(GetMembersPointer()); }
//! \em Past-the-end member iterator
/*! \pre IsObject() == true */
MemberIterator MemberEnd() { RAPIDJSON_ASSERT(IsObject()); return MemberIterator(GetMembersPointer() + data_.o.size); }
//! Request the object to have enough capacity to store members.
/*! \param newCapacity The capacity that the object at least need to have.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\note Linear time complexity.
*/
GenericValue& MemberReserve(SizeType newCapacity, Allocator &allocator) {
RAPIDJSON_ASSERT(IsObject());
if (newCapacity > data_.o.capacity) {
SetMembersPointer(reinterpret_cast<Member*>(allocator.Realloc(GetMembersPointer(), data_.o.capacity * sizeof(Member), newCapacity * sizeof(Member))));
data_.o.capacity = newCapacity;
}
return *this;
}
//! Check whether a member exists in the object.
/*!
\param name Member name to be searched.
\pre IsObject() == true
\return Whether a member with that name exists.
\note It is better to use FindMember() directly if you need the obtain the value as well.
\note Linear time complexity.
*/
bool HasMember(const Ch* name) const { return FindMember(name) != MemberEnd(); }
#if RAPIDJSON_HAS_STDSTRING
//! Check whether a member exists in the object with string object.
/*!
\param name Member name to be searched.
\pre IsObject() == true
\return Whether a member with that name exists.
\note It is better to use FindMember() directly if you need the obtain the value as well.
\note Linear time complexity.
*/
bool HasMember(const std::basic_string<Ch>& name) const { return FindMember(name) != MemberEnd(); }
#endif
//! Check whether a member exists in the object with GenericValue name.
/*!
This version is faster because it does not need a StrLen(). It can also handle string with null character.
\param name Member name to be searched.
\pre IsObject() == true
\return Whether a member with that name exists.
\note It is better to use FindMember() directly if you need the obtain the value as well.
\note Linear time complexity.
*/
template <typename SourceAllocator>
bool HasMember(const GenericValue<Encoding, SourceAllocator>& name) const { return FindMember(name) != MemberEnd(); }
//! Find member by name.
/*!
\param name Member name to be searched.
\pre IsObject() == true
\return Iterator to member, if it exists.
Otherwise returns \ref MemberEnd().
\note Earlier versions of Rapidjson returned a \c NULL pointer, in case
the requested member doesn't exist. For consistency with e.g.
\c std::map, this has been changed to MemberEnd() now.
\note Linear time complexity.
*/
MemberIterator FindMember(const Ch* name) {
GenericValue n(StringRef(name));
return FindMember(n);
}
ConstMemberIterator FindMember(const Ch* name) const { return const_cast<GenericValue&>(*this).FindMember(name); }
//! Find member by name.
/*!
This version is faster because it does not need a StrLen(). It can also handle string with null character.
\param name Member name to be searched.
\pre IsObject() == true
\return Iterator to member, if it exists.
Otherwise returns \ref MemberEnd().
\note Earlier versions of Rapidjson returned a \c NULL pointer, in case
the requested member doesn't exist. For consistency with e.g.
\c std::map, this has been changed to MemberEnd() now.
\note Linear time complexity.
*/
template <typename SourceAllocator>
MemberIterator FindMember(const GenericValue<Encoding, SourceAllocator>& name) {
RAPIDJSON_ASSERT(IsObject());
RAPIDJSON_ASSERT(name.IsString());
MemberIterator member = MemberBegin();
for ( ; member != MemberEnd(); ++member)
if (name.StringEqual(member->name))
break;
return member;
}
template <typename SourceAllocator> ConstMemberIterator FindMember(const GenericValue<Encoding, SourceAllocator>& name) const { return const_cast<GenericValue&>(*this).FindMember(name); }
#if RAPIDJSON_HAS_STDSTRING
//! Find member by string object name.
/*!
\param name Member name to be searched.
\pre IsObject() == true
\return Iterator to member, if it exists.
Otherwise returns \ref MemberEnd().
*/
MemberIterator FindMember(const std::basic_string<Ch>& name) { return FindMember(GenericValue(StringRef(name))); }
ConstMemberIterator FindMember(const std::basic_string<Ch>& name) const { return FindMember(GenericValue(StringRef(name))); }
#endif
//! Add a member (name-value pair) to the object.
/*! \param name A string value as name of member.
\param value Value of any type.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\note The ownership of \c name and \c value will be transferred to this object on success.
\pre IsObject() && name.IsString()
\post name.IsNull() && value.IsNull()
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(GenericValue& name, GenericValue& value, Allocator& allocator) {
RAPIDJSON_ASSERT(IsObject());
RAPIDJSON_ASSERT(name.IsString());
ObjectData& o = data_.o;
if (o.size >= o.capacity)
MemberReserve(o.capacity == 0 ? kDefaultObjectCapacity : (o.capacity + (o.capacity + 1) / 2), allocator);
Member* members = GetMembersPointer();
members[o.size].name.RawAssign(name);
members[o.size].value.RawAssign(value);
o.size++;
return *this;
}
//! Add a constant string value as member (name-value pair) to the object.
/*! \param name A string value as name of member.
\param value constant string reference as value of member.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note This overload is needed to avoid clashes with the generic primitive type AddMember(GenericValue&,T,Allocator&) overload below.
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(GenericValue& name, StringRefType value, Allocator& allocator) {
GenericValue v(value);
return AddMember(name, v, allocator);
}
#if RAPIDJSON_HAS_STDSTRING
//! Add a string object as member (name-value pair) to the object.
/*! \param name A string value as name of member.
\param value constant string reference as value of member.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note This overload is needed to avoid clashes with the generic primitive type AddMember(GenericValue&,T,Allocator&) overload below.
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(GenericValue& name, std::basic_string<Ch>& value, Allocator& allocator) {
GenericValue v(value, allocator);
return AddMember(name, v, allocator);
}
#endif
//! Add any primitive value as member (name-value pair) to the object.
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t
\param name A string value as name of member.
\param value Value of primitive type \c T as value of member
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note The source type \c T explicitly disallows all pointer types,
especially (\c const) \ref Ch*. This helps avoiding implicitly
referencing character strings with insufficient lifetime, use
\ref AddMember(StringRefType, GenericValue&, Allocator&) or \ref
AddMember(StringRefType, StringRefType, Allocator&).
All other pointer types would implicitly convert to \c bool,
use an explicit cast instead, if needed.
\note Amortized Constant time complexity.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (GenericValue&))
AddMember(GenericValue& name, T value, Allocator& allocator) {
GenericValue v(value);
return AddMember(name, v, allocator);
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericValue& AddMember(GenericValue&& name, GenericValue&& value, Allocator& allocator) {
return AddMember(name, value, allocator);
}
GenericValue& AddMember(GenericValue&& name, GenericValue& value, Allocator& allocator) {
return AddMember(name, value, allocator);
}
GenericValue& AddMember(GenericValue& name, GenericValue&& value, Allocator& allocator) {
return AddMember(name, value, allocator);
}
GenericValue& AddMember(StringRefType name, GenericValue&& value, Allocator& allocator) {
GenericValue n(name);
return AddMember(n, value, allocator);
}
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Add a member (name-value pair) to the object.
/*! \param name A constant string reference as name of member.
\param value Value of any type.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\note The ownership of \c value will be transferred to this object on success.
\pre IsObject()
\post value.IsNull()
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(StringRefType name, GenericValue& value, Allocator& allocator) {
GenericValue n(name);
return AddMember(n, value, allocator);
}
//! Add a constant string value as member (name-value pair) to the object.
/*! \param name A constant string reference as name of member.
\param value constant string reference as value of member.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note This overload is needed to avoid clashes with the generic primitive type AddMember(StringRefType,T,Allocator&) overload below.
\note Amortized Constant time complexity.
*/
GenericValue& AddMember(StringRefType name, StringRefType value, Allocator& allocator) {
GenericValue v(value);
return AddMember(name, v, allocator);
}
//! Add any primitive value as member (name-value pair) to the object.
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t
\param name A constant string reference as name of member.
\param value Value of primitive type \c T as value of member
\param allocator Allocator for reallocating memory. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\pre IsObject()
\note The source type \c T explicitly disallows all pointer types,
especially (\c const) \ref Ch*. This helps avoiding implicitly
referencing character strings with insufficient lifetime, use
\ref AddMember(StringRefType, GenericValue&, Allocator&) or \ref
AddMember(StringRefType, StringRefType, Allocator&).
All other pointer types would implicitly convert to \c bool,
use an explicit cast instead, if needed.
\note Amortized Constant time complexity.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (GenericValue&))
AddMember(StringRefType name, T value, Allocator& allocator) {
GenericValue n(name);
return AddMember(n, value, allocator);
}
//! Remove all members in the object.
/*! This function do not deallocate memory in the object, i.e. the capacity is unchanged.
\note Linear time complexity.
*/
void RemoveAllMembers() {
RAPIDJSON_ASSERT(IsObject());
for (MemberIterator m = MemberBegin(); m != MemberEnd(); ++m)
m->~Member();
data_.o.size = 0;
}
//! Remove a member in object by its name.
/*! \param name Name of member to be removed.
\return Whether the member existed.
\note This function may reorder the object members. Use \ref
EraseMember(ConstMemberIterator) if you need to preserve the
relative order of the remaining members.
\note Linear time complexity.
*/
bool RemoveMember(const Ch* name) {
GenericValue n(StringRef(name));
return RemoveMember(n);
}
#if RAPIDJSON_HAS_STDSTRING
bool RemoveMember(const std::basic_string<Ch>& name) { return RemoveMember(GenericValue(StringRef(name))); }
#endif
template <typename SourceAllocator>
bool RemoveMember(const GenericValue<Encoding, SourceAllocator>& name) {
MemberIterator m = FindMember(name);
if (m != MemberEnd()) {
RemoveMember(m);
return true;
}
else
return false;
}
//! Remove a member in object by iterator.
/*! \param m member iterator (obtained by FindMember() or MemberBegin()).
\return the new iterator after removal.
\note This function may reorder the object members. Use \ref
EraseMember(ConstMemberIterator) if you need to preserve the
relative order of the remaining members.
\note Constant time complexity.
*/
MemberIterator RemoveMember(MemberIterator m) {
RAPIDJSON_ASSERT(IsObject());
RAPIDJSON_ASSERT(data_.o.size > 0);
RAPIDJSON_ASSERT(GetMembersPointer() != 0);
RAPIDJSON_ASSERT(m >= MemberBegin() && m < MemberEnd());
MemberIterator last(GetMembersPointer() + (data_.o.size - 1));
if (data_.o.size > 1 && m != last)
*m = *last; // Move the last one to this place
else
m->~Member(); // Only one left, just destroy
--data_.o.size;
return m;
}
//! Remove a member from an object by iterator.
/*! \param pos iterator to the member to remove
\pre IsObject() == true && \ref MemberBegin() <= \c pos < \ref MemberEnd()
\return Iterator following the removed element.
If the iterator \c pos refers to the last element, the \ref MemberEnd() iterator is returned.
\note This function preserves the relative order of the remaining object
members. If you do not need this, use the more efficient \ref RemoveMember(MemberIterator).
\note Linear time complexity.
*/
MemberIterator EraseMember(ConstMemberIterator pos) {
return EraseMember(pos, pos +1);
}
//! Remove members in the range [first, last) from an object.
/*! \param first iterator to the first member to remove
\param last iterator following the last member to remove
\pre IsObject() == true && \ref MemberBegin() <= \c first <= \c last <= \ref MemberEnd()
\return Iterator following the last removed element.
\note This function preserves the relative order of the remaining object
members.
\note Linear time complexity.
*/
MemberIterator EraseMember(ConstMemberIterator first, ConstMemberIterator last) {
RAPIDJSON_ASSERT(IsObject());
RAPIDJSON_ASSERT(data_.o.size > 0);
RAPIDJSON_ASSERT(GetMembersPointer() != 0);
RAPIDJSON_ASSERT(first >= MemberBegin());
RAPIDJSON_ASSERT(first <= last);
RAPIDJSON_ASSERT(last <= MemberEnd());
MemberIterator pos = MemberBegin() + (first - MemberBegin());
for (MemberIterator itr = pos; itr != last; ++itr)
itr->~Member();
std::memmove(static_cast<void*>(&*pos), &*last, static_cast<size_t>(MemberEnd() - last) * sizeof(Member));
data_.o.size -= static_cast<SizeType>(last - first);
return pos;
}
//! Erase a member in object by its name.
/*! \param name Name of member to be removed.
\return Whether the member existed.
\note Linear time complexity.
*/
bool EraseMember(const Ch* name) {
GenericValue n(StringRef(name));
return EraseMember(n);
}
#if RAPIDJSON_HAS_STDSTRING
bool EraseMember(const std::basic_string<Ch>& name) { return EraseMember(GenericValue(StringRef(name))); }
#endif
template <typename SourceAllocator>
bool EraseMember(const GenericValue<Encoding, SourceAllocator>& name) {
MemberIterator m = FindMember(name);
if (m != MemberEnd()) {
EraseMember(m);
return true;
}
else
return false;
}
Object GetObject() { RAPIDJSON_ASSERT(IsObject()); return Object(*this); }
ConstObject GetObject() const { RAPIDJSON_ASSERT(IsObject()); return ConstObject(*this); }
//@}
//!@name Array
//@{
//! Set this value as an empty array.
/*! \post IsArray == true */
GenericValue& SetArray() { this->~GenericValue(); new (this) GenericValue(kArrayType); return *this; }
//! Get the number of elements in array.
SizeType Size() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.size; }
//! Get the capacity of array.
SizeType Capacity() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.capacity; }
//! Check whether the array is empty.
bool Empty() const { RAPIDJSON_ASSERT(IsArray()); return data_.a.size == 0; }
//! Remove all elements in the array.
/*! This function do not deallocate memory in the array, i.e. the capacity is unchanged.
\note Linear time complexity.
*/
void Clear() {
RAPIDJSON_ASSERT(IsArray());
GenericValue* e = GetElementsPointer();
for (GenericValue* v = e; v != e + data_.a.size; ++v)
v->~GenericValue();
data_.a.size = 0;
}
//! Get an element from array by index.
/*! \pre IsArray() == true
\param index Zero-based index of element.
\see operator[](T*)
*/
GenericValue& operator[](SizeType index) {
RAPIDJSON_ASSERT(IsArray());
RAPIDJSON_ASSERT(index < data_.a.size);
return GetElementsPointer()[index];
}
const GenericValue& operator[](SizeType index) const { return const_cast<GenericValue&>(*this)[index]; }
//! Element iterator
/*! \pre IsArray() == true */
ValueIterator Begin() { RAPIDJSON_ASSERT(IsArray()); return GetElementsPointer(); }
//! \em Past-the-end element iterator
/*! \pre IsArray() == true */
ValueIterator End() { RAPIDJSON_ASSERT(IsArray()); return GetElementsPointer() + data_.a.size; }
//! Constant element iterator
/*! \pre IsArray() == true */
ConstValueIterator Begin() const { return const_cast<GenericValue&>(*this).Begin(); }
//! Constant \em past-the-end element iterator
/*! \pre IsArray() == true */
ConstValueIterator End() const { return const_cast<GenericValue&>(*this).End(); }
//! Request the array to have enough capacity to store elements.
/*! \param newCapacity The capacity that the array at least need to have.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\note Linear time complexity.
*/
GenericValue& Reserve(SizeType newCapacity, Allocator &allocator) {
RAPIDJSON_ASSERT(IsArray());
if (newCapacity > data_.a.capacity) {
SetElementsPointer(reinterpret_cast<GenericValue*>(allocator.Realloc(GetElementsPointer(), data_.a.capacity * sizeof(GenericValue), newCapacity * sizeof(GenericValue))));
data_.a.capacity = newCapacity;
}
return *this;
}
//! Append a GenericValue at the end of the array.
/*! \param value Value to be appended.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\pre IsArray() == true
\post value.IsNull() == true
\return The value itself for fluent API.
\note The ownership of \c value will be transferred to this array on success.
\note If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
\note Amortized constant time complexity.
*/
GenericValue& PushBack(GenericValue& value, Allocator& allocator) {
RAPIDJSON_ASSERT(IsArray());
if (data_.a.size >= data_.a.capacity)
Reserve(data_.a.capacity == 0 ? kDefaultArrayCapacity : (data_.a.capacity + (data_.a.capacity + 1) / 2), allocator);
GetElementsPointer()[data_.a.size++].RawAssign(value);
return *this;
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericValue& PushBack(GenericValue&& value, Allocator& allocator) {
return PushBack(value, allocator);
}
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Append a constant string reference at the end of the array.
/*! \param value Constant string reference to be appended.
\param allocator Allocator for reallocating memory. It must be the same one used previously. Commonly use GenericDocument::GetAllocator().
\pre IsArray() == true
\return The value itself for fluent API.
\note If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
\note Amortized constant time complexity.
\see GenericStringRef
*/
GenericValue& PushBack(StringRefType value, Allocator& allocator) {
return (*this).template PushBack<StringRefType>(value, allocator);
}
//! Append a primitive value at the end of the array.
/*! \tparam T Either \ref Type, \c int, \c unsigned, \c int64_t, \c uint64_t
\param value Value of primitive type T to be appended.
\param allocator Allocator for reallocating memory. It must be the same one as used before. Commonly use GenericDocument::GetAllocator().
\pre IsArray() == true
\return The value itself for fluent API.
\note If the number of elements to be appended is known, calls Reserve() once first may be more efficient.
\note The source type \c T explicitly disallows all pointer types,
especially (\c const) \ref Ch*. This helps avoiding implicitly
referencing character strings with insufficient lifetime, use
\ref PushBack(GenericValue&, Allocator&) or \ref
PushBack(StringRefType, Allocator&).
All other pointer types would implicitly convert to \c bool,
use an explicit cast instead, if needed.
\note Amortized constant time complexity.
*/
template <typename T>
RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (GenericValue&))
PushBack(T value, Allocator& allocator) {
GenericValue v(value);
return PushBack(v, allocator);
}
//! Remove the last element in the array.
/*!
\note Constant time complexity.
*/
GenericValue& PopBack() {
RAPIDJSON_ASSERT(IsArray());
RAPIDJSON_ASSERT(!Empty());
GetElementsPointer()[--data_.a.size].~GenericValue();
return *this;
}
//! Remove an element of array by iterator.
/*!
\param pos iterator to the element to remove
\pre IsArray() == true && \ref Begin() <= \c pos < \ref End()
\return Iterator following the removed element. If the iterator pos refers to the last element, the End() iterator is returned.
\note Linear time complexity.
*/
ValueIterator Erase(ConstValueIterator pos) {
return Erase(pos, pos + 1);
}
//! Remove elements in the range [first, last) of the array.
/*!
\param first iterator to the first element to remove
\param last iterator following the last element to remove
\pre IsArray() == true && \ref Begin() <= \c first <= \c last <= \ref End()
\return Iterator following the last removed element.
\note Linear time complexity.
*/
ValueIterator Erase(ConstValueIterator first, ConstValueIterator last) {
RAPIDJSON_ASSERT(IsArray());
RAPIDJSON_ASSERT(data_.a.size > 0);
RAPIDJSON_ASSERT(GetElementsPointer() != 0);
RAPIDJSON_ASSERT(first >= Begin());
RAPIDJSON_ASSERT(first <= last);
RAPIDJSON_ASSERT(last <= End());
ValueIterator pos = Begin() + (first - Begin());
for (ValueIterator itr = pos; itr != last; ++itr)
itr->~GenericValue();
std::memmove(static_cast<void*>(pos), last, static_cast<size_t>(End() - last) * sizeof(GenericValue));
data_.a.size -= static_cast<SizeType>(last - first);
return pos;
}
Array GetArray() { RAPIDJSON_ASSERT(IsArray()); return Array(*this); }
ConstArray GetArray() const { RAPIDJSON_ASSERT(IsArray()); return ConstArray(*this); }
//@}
//!@name Number
//@{
int GetInt() const { RAPIDJSON_ASSERT(data_.f.flags & kIntFlag); return data_.n.i.i; }
unsigned GetUint() const { RAPIDJSON_ASSERT(data_.f.flags & kUintFlag); return data_.n.u.u; }
int64_t GetInt64() const { RAPIDJSON_ASSERT(data_.f.flags & kInt64Flag); return data_.n.i64; }
uint64_t GetUint64() const { RAPIDJSON_ASSERT(data_.f.flags & kUint64Flag); return data_.n.u64; }
//! Get the value as double type.
/*! \note If the value is 64-bit integer type, it may lose precision. Use \c IsLosslessDouble() to check whether the converison is lossless.
*/
double GetDouble() const {
RAPIDJSON_ASSERT(IsNumber());
if ((data_.f.flags & kDoubleFlag) != 0) return data_.n.d; // exact type, no conversion.
if ((data_.f.flags & kIntFlag) != 0) return data_.n.i.i; // int -> double
if ((data_.f.flags & kUintFlag) != 0) return data_.n.u.u; // unsigned -> double
if ((data_.f.flags & kInt64Flag) != 0) return static_cast<double>(data_.n.i64); // int64_t -> double (may lose precision)
RAPIDJSON_ASSERT((data_.f.flags & kUint64Flag) != 0); return static_cast<double>(data_.n.u64); // uint64_t -> double (may lose precision)
}
//! Get the value as float type.
/*! \note If the value is 64-bit integer type, it may lose precision. Use \c IsLosslessFloat() to check whether the converison is lossless.
*/
float GetFloat() const {
return static_cast<float>(GetDouble());
}
GenericValue& SetInt(int i) { this->~GenericValue(); new (this) GenericValue(i); return *this; }
GenericValue& SetUint(unsigned u) { this->~GenericValue(); new (this) GenericValue(u); return *this; }
GenericValue& SetInt64(int64_t i64) { this->~GenericValue(); new (this) GenericValue(i64); return *this; }
GenericValue& SetUint64(uint64_t u64) { this->~GenericValue(); new (this) GenericValue(u64); return *this; }
GenericValue& SetDouble(double d) { this->~GenericValue(); new (this) GenericValue(d); return *this; }
GenericValue& SetFloat(float f) { this->~GenericValue(); new (this) GenericValue(static_cast<double>(f)); return *this; }
//@}
//!@name String
//@{
const Ch* GetString() const { RAPIDJSON_ASSERT(IsString()); return (data_.f.flags & kInlineStrFlag) ? data_.ss.str : GetStringPointer(); }
//! Get the length of string.
/*! Since rapidjson permits "\\u0000" in the json string, strlen(v.GetString()) may not equal to v.GetStringLength().
*/
SizeType GetStringLength() const { RAPIDJSON_ASSERT(IsString()); return ((data_.f.flags & kInlineStrFlag) ? (data_.ss.GetLength()) : data_.s.length); }
//! Set this value as a string without copying source string.
/*! This version has better performance with supplied length, and also support string containing null character.
\param s source string pointer.
\param length The length of source string, excluding the trailing null terminator.
\return The value itself for fluent API.
\post IsString() == true && GetString() == s && GetStringLength() == length
\see SetString(StringRefType)
*/
GenericValue& SetString(const Ch* s, SizeType length) { return SetString(StringRef(s, length)); }
//! Set this value as a string without copying source string.
/*! \param s source string reference
\return The value itself for fluent API.
\post IsString() == true && GetString() == s && GetStringLength() == s.length
*/
GenericValue& SetString(StringRefType s) { this->~GenericValue(); SetStringRaw(s); return *this; }
//! Set this value as a string by copying from source string.
/*! This version has better performance with supplied length, and also support string containing null character.
\param s source string.
\param length The length of source string, excluding the trailing null terminator.
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\post IsString() == true && GetString() != s && strcmp(GetString(),s) == 0 && GetStringLength() == length
*/
GenericValue& SetString(const Ch* s, SizeType length, Allocator& allocator) { return SetString(StringRef(s, length), allocator); }
//! Set this value as a string by copying from source string.
/*! \param s source string.
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\post IsString() == true && GetString() != s && strcmp(GetString(),s) == 0 && GetStringLength() == length
*/
GenericValue& SetString(const Ch* s, Allocator& allocator) { return SetString(StringRef(s), allocator); }
//! Set this value as a string by copying from source string.
/*! \param s source string reference
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\post IsString() == true && GetString() != s.s && strcmp(GetString(),s) == 0 && GetStringLength() == length
*/
GenericValue& SetString(StringRefType s, Allocator& allocator) { this->~GenericValue(); SetStringRaw(s, allocator); return *this; }
#if RAPIDJSON_HAS_STDSTRING
//! Set this value as a string by copying from source string.
/*! \param s source string.
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
\return The value itself for fluent API.
\post IsString() == true && GetString() != s.data() && strcmp(GetString(),s.data() == 0 && GetStringLength() == s.size()
\note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
GenericValue& SetString(const std::basic_string<Ch>& s, Allocator& allocator) { return SetString(StringRef(s), allocator); }
#endif
//@}
//!@name Array
//@{
//! Templated version for checking whether this value is type T.
/*!
\tparam T Either \c bool, \c int, \c unsigned, \c int64_t, \c uint64_t, \c double, \c float, \c const \c char*, \c std::basic_string<Ch>
*/
template <typename T>
bool Is() const { return internal::TypeHelper<ValueType, T>::Is(*this); }
template <typename T>
T Get() const { return internal::TypeHelper<ValueType, T>::Get(*this); }
template <typename T>
T Get() { return internal::TypeHelper<ValueType, T>::Get(*this); }
template<typename T>
ValueType& Set(const T& data) { return internal::TypeHelper<ValueType, T>::Set(*this, data); }
template<typename T>
ValueType& Set(const T& data, AllocatorType& allocator) { return internal::TypeHelper<ValueType, T>::Set(*this, data, allocator); }
//@}
//! Generate events of this value to a Handler.
/*! This function adopts the GoF visitor pattern.
Typical usage is to output this JSON value as JSON text via Writer, which is a Handler.
It can also be used to deep clone this value via GenericDocument, which is also a Handler.
\tparam Handler type of handler.
\param handler An object implementing concept Handler.
*/
template <typename Handler>
bool Accept(Handler& handler) const {
switch(GetType()) {
case kNullType: return handler.Null();
case kFalseType: return handler.Bool(false);
case kTrueType: return handler.Bool(true);
case kObjectType:
if (RAPIDJSON_UNLIKELY(!handler.StartObject()))
return false;
for (ConstMemberIterator m = MemberBegin(); m != MemberEnd(); ++m) {
RAPIDJSON_ASSERT(m->name.IsString()); // User may change the type of name by MemberIterator.
if (RAPIDJSON_UNLIKELY(!handler.Key(m->name.GetString(), m->name.GetStringLength(), (m->name.data_.f.flags & kCopyFlag) != 0)))
return false;
if (RAPIDJSON_UNLIKELY(!m->value.Accept(handler)))
return false;
}
return handler.EndObject(data_.o.size);
case kArrayType:
if (RAPIDJSON_UNLIKELY(!handler.StartArray()))
return false;
for (const GenericValue* v = Begin(); v != End(); ++v)
if (RAPIDJSON_UNLIKELY(!v->Accept(handler)))
return false;
return handler.EndArray(data_.a.size);
case kStringType:
return handler.String(GetString(), GetStringLength(), (data_.f.flags & kCopyFlag) != 0);
default:
RAPIDJSON_ASSERT(GetType() == kNumberType);
if (IsDouble()) return handler.Double(data_.n.d);
else if (IsInt()) return handler.Int(data_.n.i.i);
else if (IsUint()) return handler.Uint(data_.n.u.u);
else if (IsInt64()) return handler.Int64(data_.n.i64);
else return handler.Uint64(data_.n.u64);
}
}
private:
template <typename, typename> friend class GenericValue;
template <typename, typename, typename> friend class GenericDocument;
enum {
kBoolFlag = 0x0008,
kNumberFlag = 0x0010,
kIntFlag = 0x0020,
kUintFlag = 0x0040,
kInt64Flag = 0x0080,
kUint64Flag = 0x0100,
kDoubleFlag = 0x0200,
kStringFlag = 0x0400,
kCopyFlag = 0x0800,
kInlineStrFlag = 0x1000,
// Initial flags of different types.
kNullFlag = kNullType,
kTrueFlag = kTrueType | kBoolFlag,
kFalseFlag = kFalseType | kBoolFlag,
kNumberIntFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag,
kNumberUintFlag = kNumberType | kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag,
kNumberInt64Flag = kNumberType | kNumberFlag | kInt64Flag,
kNumberUint64Flag = kNumberType | kNumberFlag | kUint64Flag,
kNumberDoubleFlag = kNumberType | kNumberFlag | kDoubleFlag,
kNumberAnyFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag,
kConstStringFlag = kStringType | kStringFlag,
kCopyStringFlag = kStringType | kStringFlag | kCopyFlag,
kShortStringFlag = kStringType | kStringFlag | kCopyFlag | kInlineStrFlag,
kObjectFlag = kObjectType,
kArrayFlag = kArrayType,
kTypeMask = 0x07
};
static const SizeType kDefaultArrayCapacity = 16;
static const SizeType kDefaultObjectCapacity = 16;
struct Flag {
#if RAPIDJSON_48BITPOINTER_OPTIMIZATION
char payload[sizeof(SizeType) * 2 + 6]; // 2 x SizeType + lower 48-bit pointer
#elif RAPIDJSON_64BIT
char payload[sizeof(SizeType) * 2 + sizeof(void*) + 6]; // 6 padding bytes
#else
char payload[sizeof(SizeType) * 2 + sizeof(void*) + 2]; // 2 padding bytes
#endif
uint16_t flags;
};
struct String {
SizeType length;
SizeType hashcode; //!< reserved
const Ch* str;
}; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
// implementation detail: ShortString can represent zero-terminated strings up to MaxSize chars
// (excluding the terminating zero) and store a value to determine the length of the contained
// string in the last character str[LenPos] by storing "MaxSize - length" there. If the string
// to store has the maximal length of MaxSize then str[LenPos] will be 0 and therefore act as
// the string terminator as well. For getting the string length back from that value just use
// "MaxSize - str[LenPos]".
// This allows to store 13-chars strings in 32-bit mode, 21-chars strings in 64-bit mode,
// 13-chars strings for RAPIDJSON_48BITPOINTER_OPTIMIZATION=1 inline (for `UTF8`-encoded strings).
struct ShortString {
enum { MaxChars = sizeof(static_cast<Flag*>(0)->payload) / sizeof(Ch), MaxSize = MaxChars - 1, LenPos = MaxSize };
Ch str[MaxChars];
inline static bool Usable(SizeType len) { return (MaxSize >= len); }
inline void SetLength(SizeType len) { str[LenPos] = static_cast<Ch>(MaxSize - len); }
inline SizeType GetLength() const { return static_cast<SizeType>(MaxSize - str[LenPos]); }
}; // at most as many bytes as "String" above => 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
// By using proper binary layout, retrieval of different integer types do not need conversions.
union Number {
#if RAPIDJSON_ENDIAN == RAPIDJSON_LITTLEENDIAN
struct I {
int i;
char padding[4];
}i;
struct U {
unsigned u;
char padding2[4];
}u;
#else
struct I {
char padding[4];
int i;
}i;
struct U {
char padding2[4];
unsigned u;
}u;
#endif
int64_t i64;
uint64_t u64;
double d;
}; // 8 bytes
struct ObjectData {
SizeType size;
SizeType capacity;
Member* members;
}; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
struct ArrayData {
SizeType size;
SizeType capacity;
GenericValue* elements;
}; // 12 bytes in 32-bit mode, 16 bytes in 64-bit mode
union Data {
String s;
ShortString ss;
Number n;
ObjectData o;
ArrayData a;
Flag f;
}; // 16 bytes in 32-bit mode, 24 bytes in 64-bit mode, 16 bytes in 64-bit with RAPIDJSON_48BITPOINTER_OPTIMIZATION
RAPIDJSON_FORCEINLINE const Ch* GetStringPointer() const { return RAPIDJSON_GETPOINTER(Ch, data_.s.str); }
RAPIDJSON_FORCEINLINE const Ch* SetStringPointer(const Ch* str) { return RAPIDJSON_SETPOINTER(Ch, data_.s.str, str); }
RAPIDJSON_FORCEINLINE GenericValue* GetElementsPointer() const { return RAPIDJSON_GETPOINTER(GenericValue, data_.a.elements); }
RAPIDJSON_FORCEINLINE GenericValue* SetElementsPointer(GenericValue* elements) { return RAPIDJSON_SETPOINTER(GenericValue, data_.a.elements, elements); }
RAPIDJSON_FORCEINLINE Member* GetMembersPointer() const { return RAPIDJSON_GETPOINTER(Member, data_.o.members); }
RAPIDJSON_FORCEINLINE Member* SetMembersPointer(Member* members) { return RAPIDJSON_SETPOINTER(Member, data_.o.members, members); }
// Initialize this value as array with initial data, without calling destructor.
void SetArrayRaw(GenericValue* values, SizeType count, Allocator& allocator) {
data_.f.flags = kArrayFlag;
if (count) {
GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
SetElementsPointer(e);
std::memcpy(static_cast<void*>(e), values, count * sizeof(GenericValue));
}
else
SetElementsPointer(0);
data_.a.size = data_.a.capacity = count;
}
//! Initialize this value as object with initial data, without calling destructor.
void SetObjectRaw(Member* members, SizeType count, Allocator& allocator) {
data_.f.flags = kObjectFlag;
if (count) {
Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
SetMembersPointer(m);
std::memcpy(static_cast<void*>(m), members, count * sizeof(Member));
}
else
SetMembersPointer(0);
data_.o.size = data_.o.capacity = count;
}
//! Initialize this value as constant string, without calling destructor.
void SetStringRaw(StringRefType s) RAPIDJSON_NOEXCEPT {
data_.f.flags = kConstStringFlag;
SetStringPointer(s);
data_.s.length = s.length;
}
//! Initialize this value as copy string with initial data, without calling destructor.
void SetStringRaw(StringRefType s, Allocator& allocator) {
Ch* str = 0;
if (ShortString::Usable(s.length)) {
data_.f.flags = kShortStringFlag;
data_.ss.SetLength(s.length);
str = data_.ss.str;
} else {
data_.f.flags = kCopyStringFlag;
data_.s.length = s.length;
str = static_cast<Ch *>(allocator.Malloc((s.length + 1) * sizeof(Ch)));
SetStringPointer(str);
}
std::memcpy(str, s, s.length * sizeof(Ch));
str[s.length] = '\0';
}
//! Assignment without calling destructor
void RawAssign(GenericValue& rhs) RAPIDJSON_NOEXCEPT {
data_ = rhs.data_;
// data_.f.flags = rhs.data_.f.flags;
rhs.data_.f.flags = kNullFlag;
}
template <typename SourceAllocator>
bool StringEqual(const GenericValue<Encoding, SourceAllocator>& rhs) const {
RAPIDJSON_ASSERT(IsString());
RAPIDJSON_ASSERT(rhs.IsString());
const SizeType len1 = GetStringLength();
const SizeType len2 = rhs.GetStringLength();
if (len1 != len2) { return false; }
const Ch* const str1 = GetString();
const Ch* const str2 = rhs.GetString();
if (str1 == str2) { return true; } // fast path for constant string
return (std::memcmp(str1, str2, sizeof(Ch) * len1) == 0);
}
Data data_;
};
//! GenericValue with UTF8 encoding
typedef GenericValue<UTF8<> > Value;
///////////////////////////////////////////////////////////////////////////////
// GenericDocument
//! A document for parsing JSON text as DOM.
/*!
\note implements Handler concept
\tparam Encoding Encoding for both parsing and string storage.
\tparam Allocator Allocator for allocating memory for the DOM
\tparam StackAllocator Allocator for allocating memory for stack during parsing.
\warning Although GenericDocument inherits from GenericValue, the API does \b not provide any virtual functions, especially no virtual destructor. To avoid memory leaks, do not \c delete a GenericDocument object via a pointer to a GenericValue.
*/
template <typename Encoding, typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
class GenericDocument : public GenericValue<Encoding, Allocator> {
public:
typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding.
typedef GenericValue<Encoding, Allocator> ValueType; //!< Value type of the document.
typedef Allocator AllocatorType; //!< Allocator type from template parameter.
//! Constructor
/*! Creates an empty document of specified type.
\param type Mandatory type of object to create.
\param allocator Optional allocator for allocating memory.
\param stackCapacity Optional initial capacity of stack in bytes.
\param stackAllocator Optional allocator for allocating memory for stack.
*/
explicit GenericDocument(Type type, Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) :
GenericValue<Encoding, Allocator>(type), allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
{
if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
}
//! Constructor
/*! Creates an empty document which type is Null.
\param allocator Optional allocator for allocating memory.
\param stackCapacity Optional initial capacity of stack in bytes.
\param stackAllocator Optional allocator for allocating memory for stack.
*/
GenericDocument(Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) :
allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
{
if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Move constructor in C++11
GenericDocument(GenericDocument&& rhs) RAPIDJSON_NOEXCEPT
: ValueType(std::forward<ValueType>(rhs)), // explicit cast to avoid prohibited move from Document
allocator_(rhs.allocator_),
ownAllocator_(rhs.ownAllocator_),
stack_(std::move(rhs.stack_)),
parseResult_(rhs.parseResult_)
{
rhs.allocator_ = 0;
rhs.ownAllocator_ = 0;
rhs.parseResult_ = ParseResult();
}
#endif
~GenericDocument() {
Destroy();
}
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
//! Move assignment in C++11
GenericDocument& operator=(GenericDocument&& rhs) RAPIDJSON_NOEXCEPT
{
// The cast to ValueType is necessary here, because otherwise it would
// attempt to call GenericValue's templated assignment operator.
ValueType::operator=(std::forward<ValueType>(rhs));
// Calling the destructor here would prematurely call stack_'s destructor
Destroy();
allocator_ = rhs.allocator_;
ownAllocator_ = rhs.ownAllocator_;
stack_ = std::move(rhs.stack_);
parseResult_ = rhs.parseResult_;
rhs.allocator_ = 0;
rhs.ownAllocator_ = 0;
rhs.parseResult_ = ParseResult();
return *this;
}
#endif
//! Exchange the contents of this document with those of another.
/*!
\param rhs Another document.
\note Constant complexity.
\see GenericValue::Swap
*/
GenericDocument& Swap(GenericDocument& rhs) RAPIDJSON_NOEXCEPT {
ValueType::Swap(rhs);
stack_.Swap(rhs.stack_);
internal::Swap(allocator_, rhs.allocator_);
internal::Swap(ownAllocator_, rhs.ownAllocator_);
internal::Swap(parseResult_, rhs.parseResult_);
return *this;
}
// Allow Swap with ValueType.
// Refer to Effective C++ 3rd Edition/Item 33: Avoid hiding inherited names.
using ValueType::Swap;
//! free-standing swap function helper
/*!
Helper function to enable support for common swap implementation pattern based on \c std::swap:
\code
void swap(MyClass& a, MyClass& b) {
using std::swap;
swap(a.doc, b.doc);
// ...
}
\endcode
\see Swap()
*/
friend inline void swap(GenericDocument& a, GenericDocument& b) RAPIDJSON_NOEXCEPT { a.Swap(b); }
//! Populate this document by a generator which produces SAX events.
/*! \tparam Generator A functor with <tt>bool f(Handler)</tt> prototype.
\param g Generator functor which sends SAX events to the parameter.
\return The document itself for fluent API.
*/
template <typename Generator>
GenericDocument& Populate(Generator& g) {
ClearStackOnExit scope(*this);
if (g(*this)) {
RAPIDJSON_ASSERT(stack_.GetSize() == sizeof(ValueType)); // Got one and only one root object
ValueType::operator=(*stack_.template Pop<ValueType>(1));// Move value from stack to document
}
return *this;
}
//!@name Parse from stream
//!@{
//! Parse JSON text from an input stream (with Encoding conversion)
/*! \tparam parseFlags Combination of \ref ParseFlag.
\tparam SourceEncoding Encoding of input stream
\tparam InputStream Type of input stream, implementing Stream concept
\param is Input stream to be parsed.
\return The document itself for fluent API.
*/
template <unsigned parseFlags, typename SourceEncoding, typename InputStream>
GenericDocument& ParseStream(InputStream& is) {
GenericReader<SourceEncoding, Encoding, StackAllocator> reader(
stack_.HasAllocator() ? &stack_.GetAllocator() : 0);
ClearStackOnExit scope(*this);
parseResult_ = reader.template Parse<parseFlags>(is, *this);
if (parseResult_) {
RAPIDJSON_ASSERT(stack_.GetSize() == sizeof(ValueType)); // Got one and only one root object
ValueType::operator=(*stack_.template Pop<ValueType>(1));// Move value from stack to document
}
return *this;
}
//! Parse JSON text from an input stream
/*! \tparam parseFlags Combination of \ref ParseFlag.
\tparam InputStream Type of input stream, implementing Stream concept
\param is Input stream to be parsed.
\return The document itself for fluent API.
*/
template <unsigned parseFlags, typename InputStream>
GenericDocument& ParseStream(InputStream& is) {
return ParseStream<parseFlags, Encoding, InputStream>(is);
}
//! Parse JSON text from an input stream (with \ref kParseDefaultFlags)
/*! \tparam InputStream Type of input stream, implementing Stream concept
\param is Input stream to be parsed.
\return The document itself for fluent API.
*/
template <typename InputStream>
GenericDocument& ParseStream(InputStream& is) {
return ParseStream<kParseDefaultFlags, Encoding, InputStream>(is);
}
//!@}
//!@name Parse in-place from mutable string
//!@{
//! Parse JSON text from a mutable string
/*! \tparam parseFlags Combination of \ref ParseFlag.
\param str Mutable zero-terminated string to be parsed.
\return The document itself for fluent API.
*/
template <unsigned parseFlags>
GenericDocument& ParseInsitu(Ch* str) {
GenericInsituStringStream<Encoding> s(str);
return ParseStream<parseFlags | kParseInsituFlag>(s);
}
//! Parse JSON text from a mutable string (with \ref kParseDefaultFlags)
/*! \param str Mutable zero-terminated string to be parsed.
\return The document itself for fluent API.
*/
GenericDocument& ParseInsitu(Ch* str) {
return ParseInsitu<kParseDefaultFlags>(str);
}
//!@}
//!@name Parse from read-only string
//!@{
//! Parse JSON text from a read-only string (with Encoding conversion)
/*! \tparam parseFlags Combination of \ref ParseFlag (must not contain \ref kParseInsituFlag).
\tparam SourceEncoding Transcoding from input Encoding
\param str Read-only zero-terminated string to be parsed.
*/
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& Parse(const typename SourceEncoding::Ch* str) {
RAPIDJSON_ASSERT(!(parseFlags & kParseInsituFlag));
GenericStringStream<SourceEncoding> s(str);
return ParseStream<parseFlags, SourceEncoding>(s);
}
//! Parse JSON text from a read-only string
/*! \tparam parseFlags Combination of \ref ParseFlag (must not contain \ref kParseInsituFlag).
\param str Read-only zero-terminated string to be parsed.
*/
template <unsigned parseFlags>
GenericDocument& Parse(const Ch* str) {
return Parse<parseFlags, Encoding>(str);
}
//! Parse JSON text from a read-only string (with \ref kParseDefaultFlags)
/*! \param str Read-only zero-terminated string to be parsed.
*/
GenericDocument& Parse(const Ch* str) {
return Parse<kParseDefaultFlags>(str);
}
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& Parse(const typename SourceEncoding::Ch* str, size_t length) {
RAPIDJSON_ASSERT(!(parseFlags & kParseInsituFlag));
MemoryStream ms(reinterpret_cast<const char*>(str), length * sizeof(typename SourceEncoding::Ch));
EncodedInputStream<SourceEncoding, MemoryStream> is(ms);
ParseStream<parseFlags, SourceEncoding>(is);
return *this;
}
template <unsigned parseFlags>
GenericDocument& Parse(const Ch* str, size_t length) {
return Parse<parseFlags, Encoding>(str, length);
}
GenericDocument& Parse(const Ch* str, size_t length) {
return Parse<kParseDefaultFlags>(str, length);
}
#if RAPIDJSON_HAS_STDSTRING
template <unsigned parseFlags, typename SourceEncoding>
GenericDocument& Parse(const std::basic_string<typename SourceEncoding::Ch>& str) {
// c_str() is constant complexity according to standard. Should be faster than Parse(const char*, size_t)
return Parse<parseFlags, SourceEncoding>(str.c_str());
}
template <unsigned parseFlags>
GenericDocument& Parse(const std::basic_string<Ch>& str) {
return Parse<parseFlags, Encoding>(str.c_str());
}
GenericDocument& Parse(const std::basic_string<Ch>& str) {
return Parse<kParseDefaultFlags>(str);
}
#endif // RAPIDJSON_HAS_STDSTRING
//!@}
//!@name Handling parse errors
//!@{
//! Whether a parse error has occurred in the last parsing.
bool HasParseError() const { return parseResult_.IsError(); }
//! Get the \ref ParseErrorCode of last parsing.
ParseErrorCode GetParseError() const { return parseResult_.Code(); }
//! Get the position of last parsing error in input, 0 otherwise.
size_t GetErrorOffset() const { return parseResult_.Offset(); }
//! Implicit conversion to get the last parse result
#ifndef __clang // -Wdocumentation
/*! \return \ref ParseResult of the last parse operation
\code
Document doc;
ParseResult ok = doc.Parse(json);
if (!ok)
printf( "JSON parse error: %s (%u)\n", GetParseError_En(ok.Code()), ok.Offset());
\endcode
*/
#endif
operator ParseResult() const { return parseResult_; }
//!@}
//! Get the allocator of this document.
Allocator& GetAllocator() {
RAPIDJSON_ASSERT(allocator_);
return *allocator_;
}
//! Get the capacity of stack in bytes.
size_t GetStackCapacity() const { return stack_.GetCapacity(); }
private:
// clear stack on any exit from ParseStream, e.g. due to exception
struct ClearStackOnExit {
explicit ClearStackOnExit(GenericDocument& d) : d_(d) {}
~ClearStackOnExit() { d_.ClearStack(); }
private:
ClearStackOnExit(const ClearStackOnExit&);
ClearStackOnExit& operator=(const ClearStackOnExit&);
GenericDocument& d_;
};
// callers of the following private Handler functions
// template <typename,typename,typename> friend class GenericReader; // for parsing
template <typename, typename> friend class GenericValue; // for deep copying
public:
// Implementation of Handler
bool Null() { new (stack_.template Push<ValueType>()) ValueType(); return true; }
bool Bool(bool b) { new (stack_.template Push<ValueType>()) ValueType(b); return true; }
bool Int(int i) { new (stack_.template Push<ValueType>()) ValueType(i); return true; }
bool Uint(unsigned i) { new (stack_.template Push<ValueType>()) ValueType(i); return true; }
bool Int64(int64_t i) { new (stack_.template Push<ValueType>()) ValueType(i); return true; }
bool Uint64(uint64_t i) { new (stack_.template Push<ValueType>()) ValueType(i); return true; }
bool Double(double d) { new (stack_.template Push<ValueType>()) ValueType(d); return true; }
bool RawNumber(const Ch* str, SizeType length, bool copy) {
if (copy)
new (stack_.template Push<ValueType>()) ValueType(str, length, GetAllocator());
else
new (stack_.template Push<ValueType>()) ValueType(str, length);
return true;
}
bool String(const Ch* str, SizeType length, bool copy) {
if (copy)
new (stack_.template Push<ValueType>()) ValueType(str, length, GetAllocator());
else
new (stack_.template Push<ValueType>()) ValueType(str, length);
return true;
}
bool StartObject() { new (stack_.template Push<ValueType>()) ValueType(kObjectType); return true; }
bool Key(const Ch* str, SizeType length, bool copy) { return String(str, length, copy); }
bool EndObject(SizeType memberCount) {
typename ValueType::Member* members = stack_.template Pop<typename ValueType::Member>(memberCount);
stack_.template Top<ValueType>()->SetObjectRaw(members, memberCount, GetAllocator());
return true;
}
bool StartArray() { new (stack_.template Push<ValueType>()) ValueType(kArrayType); return true; }
bool EndArray(SizeType elementCount) {
ValueType* elements = stack_.template Pop<ValueType>(elementCount);
stack_.template Top<ValueType>()->SetArrayRaw(elements, elementCount, GetAllocator());
return true;
}
private:
//! Prohibit copying
GenericDocument(const GenericDocument&);
//! Prohibit assignment
GenericDocument& operator=(const GenericDocument&);
void ClearStack() {
if (Allocator::kNeedFree)
while (stack_.GetSize() > 0) // Here assumes all elements in stack array are GenericValue (Member is actually 2 GenericValue objects)
(stack_.template Pop<ValueType>(1))->~ValueType();
else
stack_.Clear();
stack_.ShrinkToFit();
}
void Destroy() {
RAPIDJSON_DELETE(ownAllocator_);
}
static const size_t kDefaultStackCapacity = 1024;
Allocator* allocator_;
Allocator* ownAllocator_;
internal::Stack<StackAllocator> stack_;
ParseResult parseResult_;
};
//! GenericDocument with UTF8 encoding
typedef GenericDocument<UTF8<> > Document;
//! Helper class for accessing Value of array type.
/*!
Instance of this helper class is obtained by \c GenericValue::GetArray().
In addition to all APIs for array type, it provides range-based for loop if \c RAPIDJSON_HAS_CXX11_RANGE_FOR=1.
*/
template <bool Const, typename ValueT>
class GenericArray {
public:
typedef GenericArray<true, ValueT> ConstArray;
typedef GenericArray<false, ValueT> Array;
typedef ValueT PlainType;
typedef typename internal::MaybeAddConst<Const,PlainType>::Type ValueType;
typedef ValueType* ValueIterator; // This may be const or non-const iterator
typedef const ValueT* ConstValueIterator;
typedef typename ValueType::AllocatorType AllocatorType;
typedef typename ValueType::StringRefType StringRefType;
template <typename, typename>
friend class GenericValue;
GenericArray(const GenericArray& rhs) : value_(rhs.value_) {}
GenericArray& operator=(const GenericArray& rhs) { value_ = rhs.value_; return *this; }
~GenericArray() {}
SizeType Size() const { return value_.Size(); }
SizeType Capacity() const { return value_.Capacity(); }
bool Empty() const { return value_.Empty(); }
void Clear() const { value_.Clear(); }
ValueType& operator[](SizeType index) const { return value_[index]; }
ValueIterator Begin() const { return value_.Begin(); }
ValueIterator End() const { return value_.End(); }
GenericArray Reserve(SizeType newCapacity, AllocatorType &allocator) const { value_.Reserve(newCapacity, allocator); return *this; }
GenericArray PushBack(ValueType& value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; }
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericArray PushBack(ValueType&& value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; }
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericArray PushBack(StringRefType value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; }
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (const GenericArray&)) PushBack(T value, AllocatorType& allocator) const { value_.PushBack(value, allocator); return *this; }
GenericArray PopBack() const { value_.PopBack(); return *this; }
ValueIterator Erase(ConstValueIterator pos) const { return value_.Erase(pos); }
ValueIterator Erase(ConstValueIterator first, ConstValueIterator last) const { return value_.Erase(first, last); }
#if RAPIDJSON_HAS_CXX11_RANGE_FOR
ValueIterator begin() const { return value_.Begin(); }
ValueIterator end() const { return value_.End(); }
#endif
private:
GenericArray();
GenericArray(ValueType& value) : value_(value) {}
ValueType& value_;
};
//! Helper class for accessing Value of object type.
/*!
Instance of this helper class is obtained by \c GenericValue::GetObject().
In addition to all APIs for array type, it provides range-based for loop if \c RAPIDJSON_HAS_CXX11_RANGE_FOR=1.
*/
template <bool Const, typename ValueT>
class GenericObject {
public:
typedef GenericObject<true, ValueT> ConstObject;
typedef GenericObject<false, ValueT> Object;
typedef ValueT PlainType;
typedef typename internal::MaybeAddConst<Const,PlainType>::Type ValueType;
typedef GenericMemberIterator<Const, typename ValueT::EncodingType, typename ValueT::AllocatorType> MemberIterator; // This may be const or non-const iterator
typedef GenericMemberIterator<true, typename ValueT::EncodingType, typename ValueT::AllocatorType> ConstMemberIterator;
typedef typename ValueType::AllocatorType AllocatorType;
typedef typename ValueType::StringRefType StringRefType;
typedef typename ValueType::EncodingType EncodingType;
typedef typename ValueType::Ch Ch;
template <typename, typename>
friend class GenericValue;
GenericObject(const GenericObject& rhs) : value_(rhs.value_) {}
GenericObject& operator=(const GenericObject& rhs) { value_ = rhs.value_; return *this; }
~GenericObject() {}
SizeType MemberCount() const { return value_.MemberCount(); }
SizeType MemberCapacity() const { return value_.MemberCapacity(); }
bool ObjectEmpty() const { return value_.ObjectEmpty(); }
template <typename T> ValueType& operator[](T* name) const { return value_[name]; }
template <typename SourceAllocator> ValueType& operator[](const GenericValue<EncodingType, SourceAllocator>& name) const { return value_[name]; }
#if RAPIDJSON_HAS_STDSTRING
ValueType& operator[](const std::basic_string<Ch>& name) const { return value_[name]; }
#endif
MemberIterator MemberBegin() const { return value_.MemberBegin(); }
MemberIterator MemberEnd() const { return value_.MemberEnd(); }
GenericObject MemberReserve(SizeType newCapacity, AllocatorType &allocator) const { value_.MemberReserve(newCapacity, allocator); return *this; }
bool HasMember(const Ch* name) const { return value_.HasMember(name); }
#if RAPIDJSON_HAS_STDSTRING
bool HasMember(const std::basic_string<Ch>& name) const { return value_.HasMember(name); }
#endif
template <typename SourceAllocator> bool HasMember(const GenericValue<EncodingType, SourceAllocator>& name) const { return value_.HasMember(name); }
MemberIterator FindMember(const Ch* name) const { return value_.FindMember(name); }
template <typename SourceAllocator> MemberIterator FindMember(const GenericValue<EncodingType, SourceAllocator>& name) const { return value_.FindMember(name); }
#if RAPIDJSON_HAS_STDSTRING
MemberIterator FindMember(const std::basic_string<Ch>& name) const { return value_.FindMember(name); }
#endif
GenericObject AddMember(ValueType& name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(ValueType& name, StringRefType value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
#if RAPIDJSON_HAS_STDSTRING
GenericObject AddMember(ValueType& name, std::basic_string<Ch>& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
#endif
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (ValueType&)) AddMember(ValueType& name, T value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericObject AddMember(ValueType&& name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(ValueType&& name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(ValueType& name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(StringRefType name, ValueType&& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
#endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS
GenericObject AddMember(StringRefType name, ValueType& value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
GenericObject AddMember(StringRefType name, StringRefType value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
template <typename T> RAPIDJSON_DISABLEIF_RETURN((internal::OrExpr<internal::IsPointer<T>, internal::IsGenericValue<T> >), (GenericObject)) AddMember(StringRefType name, T value, AllocatorType& allocator) const { value_.AddMember(name, value, allocator); return *this; }
void RemoveAllMembers() { value_.RemoveAllMembers(); }
bool RemoveMember(const Ch* name) const { return value_.RemoveMember(name); }
#if RAPIDJSON_HAS_STDSTRING
bool RemoveMember(const std::basic_string<Ch>& name) const { return value_.RemoveMember(name); }
#endif
template <typename SourceAllocator> bool RemoveMember(const GenericValue<EncodingType, SourceAllocator>& name) const { return value_.RemoveMember(name); }
MemberIterator RemoveMember(MemberIterator m) const { return value_.RemoveMember(m); }
MemberIterator EraseMember(ConstMemberIterator pos) const { return value_.EraseMember(pos); }
MemberIterator EraseMember(ConstMemberIterator first, ConstMemberIterator last) const { return value_.EraseMember(first, last); }
bool EraseMember(const Ch* name) const { return value_.EraseMember(name); }
#if RAPIDJSON_HAS_STDSTRING
bool EraseMember(const std::basic_string<Ch>& name) const { return EraseMember(ValueType(StringRef(name))); }
#endif
template <typename SourceAllocator> bool EraseMember(const GenericValue<EncodingType, SourceAllocator>& name) const { return value_.EraseMember(name); }
#if RAPIDJSON_HAS_CXX11_RANGE_FOR
MemberIterator begin() const { return value_.MemberBegin(); }
MemberIterator end() const { return value_.MemberEnd(); }
#endif
private:
GenericObject();
GenericObject(ValueType& value) : value_(value) {}
ValueType& value_;
};
RAPIDJSON_NAMESPACE_END
RAPIDJSON_DIAG_POP
#endif // RAPIDJSON_DOCUMENT_H_
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/classlibnative/bcltype/objectnative.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// File: ObjectNative.h
//
//
// Purpose: Native methods on System.Object
//
//
#ifndef _OBJECTNATIVE_H_
#define _OBJECTNATIVE_H_
#include "fcall.h"
//
// Each function that we call through native only gets one argument,
// which is actually a pointer to it's stack of arguments. Our structs
// for accessing these are defined below.
//
class ObjectNative
{
public:
// This method will return a Class object for the object
// iff the Class object has already been created.
// If the Class object doesn't exist then you must call the GetClass() method.
static FCDECL1(Object*, GetObjectValue, Object* vThisRef);
static FCDECL1(INT32, GetHashCode, Object* vThisRef);
static FCDECL2(FC_BOOL_RET, Equals, Object *pThisRef, Object *pCompareRef);
static FCDECL1(Object*, AllocateUninitializedClone, Object* pObjUNSAFE);
static FCDECL1(Object*, GetClass, Object* pThis);
static FCDECL2(FC_BOOL_RET, WaitTimeout, INT32 Timeout, Object* pThisUNSAFE);
static FCDECL1(void, Pulse, Object* pThisUNSAFE);
static FCDECL1(void, PulseAll, Object* pThisUNSAFE);
static FCDECL1(FC_BOOL_RET, IsLockHeld, Object* pThisUNSAFE);
};
extern "C" INT64 QCALLTYPE ObjectNative_GetMonitorLockContentionCount();
#endif // _OBJECTNATIVE_H_
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// File: ObjectNative.h
//
//
// Purpose: Native methods on System.Object
//
//
#ifndef _OBJECTNATIVE_H_
#define _OBJECTNATIVE_H_
#include "fcall.h"
//
// Each function that we call through native only gets one argument,
// which is actually a pointer to it's stack of arguments. Our structs
// for accessing these are defined below.
//
class ObjectNative
{
public:
// This method will return a Class object for the object
// iff the Class object has already been created.
// If the Class object doesn't exist then you must call the GetClass() method.
static FCDECL1(Object*, GetObjectValue, Object* vThisRef);
static FCDECL1(INT32, GetHashCode, Object* vThisRef);
static FCDECL2(FC_BOOL_RET, Equals, Object *pThisRef, Object *pCompareRef);
static FCDECL1(Object*, AllocateUninitializedClone, Object* pObjUNSAFE);
static FCDECL1(Object*, GetClass, Object* pThis);
static FCDECL2(FC_BOOL_RET, WaitTimeout, INT32 Timeout, Object* pThisUNSAFE);
static FCDECL1(void, Pulse, Object* pThisUNSAFE);
static FCDECL1(void, PulseAll, Object* pThisUNSAFE);
static FCDECL1(FC_BOOL_RET, IsLockHeld, Object* pThisUNSAFE);
};
extern "C" INT64 QCALLTYPE ObjectNative_GetMonitorLockContentionCount();
#endif // _OBJECTNATIVE_H_
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================================
**
** Source: test4.c
**
** Purpose: Tests the pointer specifier (%p).
** This test is modeled after the sprintf series.
**
**
**==========================================================================*/
#include <palsuite.h>
#include "../fwprintf.h"
/*
* Depends on memcmp, strlen, fopen, fseek and fgets.
*/
PALTEST(c_runtime_fwprintf_test4_paltest_fwprintf_test4, "c_runtime/fwprintf/test4/paltest_fwprintf_test4")
{
void *ptr = (void*) 0x123456;
INT64 lptr = I64(0x1234567887654321);
if (PAL_Initialize(argc, argv) != 0)
{
return(FAIL);
}
/*
** Run only on 64 bit platforms
*/
#if defined(HOST_64BIT)
Trace("Testing for 64 Bit Platforms \n");
DoPointerTest(convert("%p"), NULL, "NULL", "0000000000000000", "0x0");
DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "0000000000123456",
"0x123456");
DoPointerTest(convert("%17p"), ptr, "pointer to 0x123456", " 0000000000123456",
" 0x123456");
DoPointerTest(convert("%17p"), ptr, "pointer to 0x123456", " 0000000000123456",
"0x0123456");
DoPointerTest(convert("%-17p"), ptr, "pointer to 0x123456", "0000000000123456 ",
"0x123456 ");
DoPointerTest(convert("%+p"), ptr, "pointer to 0x123456", "0000000000123456",
"0x123456");
DoPointerTest(convert("%#p"), ptr, "pointer to 0x123456", "0X0000000000123456",
"0x123456");
DoPointerTest(convert("%lp"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoPointerTest(convert("%hp"), ptr, "pointer to 0x123456", "00003456",
"0x3456");
DoPointerTest(convert("%Lp"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoI64Test(convert("%I64p"), lptr, "pointer to 0x1234567887654321",
"1234567887654321", "0x1234567887654321");
#else
Trace("Testing for Non 64 Bit Platforms \n");
DoPointerTest(convert("%p"), NULL, "NULL", "00000000", "0x0");
DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoPointerTest(convert("%9p"), ptr, "pointer to 0x123456", " 00123456",
" 0x123456");
DoPointerTest(convert("%09p"), ptr, "pointer to 0x123456", " 00123456",
"0x0123456");
DoPointerTest(convert("%-9p"), ptr, "pointer to 0x123456", "00123456 ",
"0x123456 ");
DoPointerTest(convert("%+p"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoPointerTest(convert("%#p"), ptr, "pointer to 0x123456", "0X00123456",
"0x123456");
DoPointerTest(convert("%lp"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoPointerTest(convert("%hp"), ptr, "pointer to 0x123456", "00003456",
"0x3456");
DoPointerTest(convert("%Lp"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoI64Test(convert("%I64p"), lptr, "pointer to 0x1234567887654321",
"1234567887654321", "0x1234567887654321");
#endif
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================================
**
** Source: test4.c
**
** Purpose: Tests the pointer specifier (%p).
** This test is modeled after the sprintf series.
**
**
**==========================================================================*/
#include <palsuite.h>
#include "../fwprintf.h"
/*
* Depends on memcmp, strlen, fopen, fseek and fgets.
*/
PALTEST(c_runtime_fwprintf_test4_paltest_fwprintf_test4, "c_runtime/fwprintf/test4/paltest_fwprintf_test4")
{
void *ptr = (void*) 0x123456;
INT64 lptr = I64(0x1234567887654321);
if (PAL_Initialize(argc, argv) != 0)
{
return(FAIL);
}
/*
** Run only on 64 bit platforms
*/
#if defined(HOST_64BIT)
Trace("Testing for 64 Bit Platforms \n");
DoPointerTest(convert("%p"), NULL, "NULL", "0000000000000000", "0x0");
DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "0000000000123456",
"0x123456");
DoPointerTest(convert("%17p"), ptr, "pointer to 0x123456", " 0000000000123456",
" 0x123456");
DoPointerTest(convert("%17p"), ptr, "pointer to 0x123456", " 0000000000123456",
"0x0123456");
DoPointerTest(convert("%-17p"), ptr, "pointer to 0x123456", "0000000000123456 ",
"0x123456 ");
DoPointerTest(convert("%+p"), ptr, "pointer to 0x123456", "0000000000123456",
"0x123456");
DoPointerTest(convert("%#p"), ptr, "pointer to 0x123456", "0X0000000000123456",
"0x123456");
DoPointerTest(convert("%lp"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoPointerTest(convert("%hp"), ptr, "pointer to 0x123456", "00003456",
"0x3456");
DoPointerTest(convert("%Lp"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoI64Test(convert("%I64p"), lptr, "pointer to 0x1234567887654321",
"1234567887654321", "0x1234567887654321");
#else
Trace("Testing for Non 64 Bit Platforms \n");
DoPointerTest(convert("%p"), NULL, "NULL", "00000000", "0x0");
DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoPointerTest(convert("%9p"), ptr, "pointer to 0x123456", " 00123456",
" 0x123456");
DoPointerTest(convert("%09p"), ptr, "pointer to 0x123456", " 00123456",
"0x0123456");
DoPointerTest(convert("%-9p"), ptr, "pointer to 0x123456", "00123456 ",
"0x123456 ");
DoPointerTest(convert("%+p"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoPointerTest(convert("%#p"), ptr, "pointer to 0x123456", "0X00123456",
"0x123456");
DoPointerTest(convert("%lp"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoPointerTest(convert("%hp"), ptr, "pointer to 0x123456", "00003456",
"0x3456");
DoPointerTest(convert("%Lp"), ptr, "pointer to 0x123456", "00123456",
"0x123456");
DoI64Test(convert("%I64p"), lptr, "pointer to 0x1234567887654321",
"1234567887654321", "0x1234567887654321");
#endif
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/external/libunwind/src/setjmp/setjmp_i.h
|
/* libunwind - a platform-independent unwind library
Copyright (C) 2003-2005 Hewlett-Packard Co
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#if UNW_TARGET_IA64
#include "libunwind_i.h"
#include "tdep-ia64/rse.h"
static inline int
bsp_match (unw_cursor_t *c, unw_word_t *wp)
{
unw_word_t bsp, pfs, sol;
if (unw_get_reg (c, UNW_IA64_BSP, &bsp) < 0
|| unw_get_reg (c, UNW_IA64_AR_PFS, &pfs) < 0)
abort ();
/* simulate the effect of "br.call sigsetjmp" on ar.bsp: */
sol = (pfs >> 7) & 0x7f;
bsp = rse_skip_regs (bsp, sol);
if (bsp != wp[JB_BSP])
return 0;
if (unlikely (sol == 0))
{
unw_word_t sp, prev_sp;
unw_cursor_t tmp = *c;
/* The caller of {sig,}setjmp() cannot have a NULL-frame. If we
see a NULL-frame, we haven't reached the right target yet.
To have a NULL-frame, the number of locals must be zero and
the stack-frame must also be empty. */
if (unw_step (&tmp) < 0)
abort ();
if (unw_get_reg (&tmp, UNW_REG_SP, &sp) < 0
|| unw_get_reg (&tmp, UNW_REG_SP, &prev_sp) < 0)
abort ();
if (sp == prev_sp)
/* got a NULL-frame; keep looking... */
return 0;
}
return 1;
}
/* On ia64 we cannot always call sigprocmask() at
_UI_siglongjmp_cont() because the signal may have switched stacks
and the old stack's register-backing store may have overflown,
leaving us no space to allocate the stacked registers needed to
call sigprocmask(). Fortunately, we can just let unw_resume() (via
sigreturn) take care of restoring the signal-mask. That's faster
anyhow. */
static inline int
resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
{
unw_word_t sc_addr = ((struct cursor *) c)->sigcontext_addr;
struct sigcontext *sc = (struct sigcontext *) sc_addr;
sigset_t current_mask;
void *mp;
if (!sc_addr)
return 0;
/* let unw_resume() install the desired signal mask */
if (wp[JB_MASK_SAVED])
mp = &wp[JB_MASK];
else
{
if (sigprocmask (SIG_BLOCK, NULL, ¤t_mask) < 0)
abort ();
mp = ¤t_mask;
}
memcpy (&sc->sc_mask, mp, sizeof (sc->sc_mask));
return 1;
}
#else /* !UNW_TARGET_IA64 */
static inline int
bsp_match (unw_cursor_t *c, unw_word_t *wp)
{
return 1;
}
static inline int
resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
{
/* We may want to do this analogously as for ia64... */
return 0;
}
#endif /* !UNW_TARGET_IA64 */
|
/* libunwind - a platform-independent unwind library
Copyright (C) 2003-2005 Hewlett-Packard Co
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#if UNW_TARGET_IA64
#include "libunwind_i.h"
#include "tdep-ia64/rse.h"
static inline int
bsp_match (unw_cursor_t *c, unw_word_t *wp)
{
unw_word_t bsp, pfs, sol;
if (unw_get_reg (c, UNW_IA64_BSP, &bsp) < 0
|| unw_get_reg (c, UNW_IA64_AR_PFS, &pfs) < 0)
abort ();
/* simulate the effect of "br.call sigsetjmp" on ar.bsp: */
sol = (pfs >> 7) & 0x7f;
bsp = rse_skip_regs (bsp, sol);
if (bsp != wp[JB_BSP])
return 0;
if (unlikely (sol == 0))
{
unw_word_t sp, prev_sp;
unw_cursor_t tmp = *c;
/* The caller of {sig,}setjmp() cannot have a NULL-frame. If we
see a NULL-frame, we haven't reached the right target yet.
To have a NULL-frame, the number of locals must be zero and
the stack-frame must also be empty. */
if (unw_step (&tmp) < 0)
abort ();
if (unw_get_reg (&tmp, UNW_REG_SP, &sp) < 0
|| unw_get_reg (&tmp, UNW_REG_SP, &prev_sp) < 0)
abort ();
if (sp == prev_sp)
/* got a NULL-frame; keep looking... */
return 0;
}
return 1;
}
/* On ia64 we cannot always call sigprocmask() at
_UI_siglongjmp_cont() because the signal may have switched stacks
and the old stack's register-backing store may have overflown,
leaving us no space to allocate the stacked registers needed to
call sigprocmask(). Fortunately, we can just let unw_resume() (via
sigreturn) take care of restoring the signal-mask. That's faster
anyhow. */
static inline int
resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
{
unw_word_t sc_addr = ((struct cursor *) c)->sigcontext_addr;
struct sigcontext *sc = (struct sigcontext *) sc_addr;
sigset_t current_mask;
void *mp;
if (!sc_addr)
return 0;
/* let unw_resume() install the desired signal mask */
if (wp[JB_MASK_SAVED])
mp = &wp[JB_MASK];
else
{
if (sigprocmask (SIG_BLOCK, NULL, ¤t_mask) < 0)
abort ();
mp = ¤t_mask;
}
memcpy (&sc->sc_mask, mp, sizeof (sc->sc_mask));
return 1;
}
#else /* !UNW_TARGET_IA64 */
static inline int
bsp_match (unw_cursor_t *c, unw_word_t *wp)
{
return 1;
}
static inline int
resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp)
{
/* We may want to do this analogously as for ia64... */
return 0;
}
#endif /* !UNW_TARGET_IA64 */
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/external/libunwind/include/tdep/jmpbuf.h
|
/* Provide a real file - not a symlink - as it would cause multiarch conflicts
when multiple different arch releases are installed simultaneously. */
#ifndef UNW_REMOTE_ONLY
#if defined __aarch64__
# include "tdep-aarch64/jmpbuf.h"
#elif defined __arm__
# include "tdep-arm/jmpbuf.h"
#elif defined __hppa__
# include "tdep-hppa/jmpbuf.h"
#elif defined __ia64__
# include "tdep-ia64/jmpbuf.h"
#elif defined __mips__
# include "tdep-mips/jmpbuf.h"
#elif defined __powerpc__ && !defined __powerpc64__
# include "tdep-ppc32/jmpbuf.h"
#elif defined __powerpc64__
# include "tdep-ppc64/jmpbuf.h"
#elif defined __i386__
# include "tdep-x86/jmpbuf.h"
#elif defined __x86_64__
# include "tdep-x86_64/jmpbuf.h"
#elif defined __tilegx__
# include "tdep-tilegx/jmpbuf.h"
#elif defined __riscv || defined __riscv__
# include "tdep-riscv/jmpbuf.h"
#elif defined __loongarch64
# include "tdep-loongarch64/jmpbuf.h"
#else
# error "Unsupported arch"
#endif
#endif /* !UNW_REMOTE_ONLY */
|
/* Provide a real file - not a symlink - as it would cause multiarch conflicts
when multiple different arch releases are installed simultaneously. */
#ifndef UNW_REMOTE_ONLY
#if defined __aarch64__
# include "tdep-aarch64/jmpbuf.h"
#elif defined __arm__
# include "tdep-arm/jmpbuf.h"
#elif defined __hppa__
# include "tdep-hppa/jmpbuf.h"
#elif defined __ia64__
# include "tdep-ia64/jmpbuf.h"
#elif defined __mips__
# include "tdep-mips/jmpbuf.h"
#elif defined __powerpc__ && !defined __powerpc64__
# include "tdep-ppc32/jmpbuf.h"
#elif defined __powerpc64__
# include "tdep-ppc64/jmpbuf.h"
#elif defined __i386__
# include "tdep-x86/jmpbuf.h"
#elif defined __x86_64__
# include "tdep-x86_64/jmpbuf.h"
#elif defined __tilegx__
# include "tdep-tilegx/jmpbuf.h"
#elif defined __riscv || defined __riscv__
# include "tdep-riscv/jmpbuf.h"
#elif defined __loongarch64
# include "tdep-loongarch64/jmpbuf.h"
#else
# error "Unsupported arch"
#endif
#endif /* !UNW_REMOTE_ONLY */
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/vm/fieldmarshaler.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// File: FieldMarshaler.cpp
//
//
#include "common.h"
#include "vars.hpp"
#include "class.h"
#include "ceeload.h"
#include "excep.h"
#include "fieldmarshaler.h"
#include "field.h"
#include "frames.h"
#include "dllimport.h"
#include "comdelegate.h"
#include "eeconfig.h"
#include "comdatetime.h"
#include "olevariant.h"
#include <cor.h>
#include <corpriv.h>
#include <corerror.h>
#include "sigformat.h"
#include "marshalnative.h"
#include "typeparse.h"
#ifdef FEATURE_COMINTEROP
#include <winstring.h>
#endif // FEATURE_COMINTEROP
VOID ParseNativeType(Module* pModule,
SigPointer sig,
PTR_FieldDesc pFD,
ParseNativeTypeFlags flags,
NativeFieldDescriptor* pNFD,
const SigTypeContext * pTypeContext
#ifdef _DEBUG
,
LPCUTF8 szNamespace,
LPCUTF8 szClassName,
LPCUTF8 szFieldName
#endif
)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM());
PRECONDITION(CheckPointer(pNFD));
}
CONTRACTL_END;
BOOL fAnsi = (flags == ParseNativeTypeFlags::IsAnsi);
MarshalInfo mlInfo(
pModule,
sig,
pTypeContext,
pFD->GetMemberDef(),
MarshalInfo::MARSHAL_SCENARIO_FIELD,
fAnsi ? nltAnsi : nltUnicode,
nlfNone,
FALSE,
0,
0,
FALSE, // We only need validation of the native signature and the MARSHAL_TYPE_*
FALSE, // so we don't need to accurately get the BestFitCustomAttribute data for this construction.
FALSE, /* fEmitsIL */
nullptr,
FALSE /* fUseCustomMarshal */
#ifdef _DEBUG
,
szFieldName,
szClassName,
-1 /* field */
#endif
);
OverrideProcArgs const* const pargs = mlInfo.GetOverrideProcArgs();
switch (mlInfo.GetMarshalType())
{
case MarshalInfo::MARSHAL_TYPE_GENERIC_1:
case MarshalInfo::MARSHAL_TYPE_GENERIC_U1:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT8), sizeof(INT8));
break;
case MarshalInfo::MARSHAL_TYPE_GENERIC_2:
case MarshalInfo::MARSHAL_TYPE_GENERIC_U2:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT16), sizeof(INT16));
break;
case MarshalInfo::MARSHAL_TYPE_GENERIC_4:
case MarshalInfo::MARSHAL_TYPE_GENERIC_U4:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT32), sizeof(INT32));
break;
case MarshalInfo::MARSHAL_TYPE_GENERIC_8:
#if defined(TARGET_X86) && defined(UNIX_X86_ABI)
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT64), 4);
#else
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT64), sizeof(INT64));
#endif
break;
case MarshalInfo::MARSHAL_TYPE_ANSICHAR:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(CHAR), sizeof(CHAR));
break;
case MarshalInfo::MARSHAL_TYPE_WINBOOL:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(BOOL), sizeof(BOOL));
break;
case MarshalInfo::MARSHAL_TYPE_CBOOL:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(bool), sizeof(bool));
break;
#ifdef FEATURE_COMINTEROP
case MarshalInfo::MARSHAL_TYPE_VTBOOL:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(VARIANT_BOOL), sizeof(VARIANT_BOOL));
break;
#endif
case MarshalInfo::MARSHAL_TYPE_FLOAT:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::FLOAT, sizeof(float), sizeof(float));
break;
case MarshalInfo::MARSHAL_TYPE_DOUBLE:
#if defined(TARGET_X86) && defined(UNIX_X86_ABI)
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::FLOAT, sizeof(double), 4);
#else
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::FLOAT, sizeof(double), sizeof(double));
#endif
break;
case MarshalInfo::MARSHAL_TYPE_CURRENCY:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__CURRENCY));
break;
case MarshalInfo::MARSHAL_TYPE_DECIMAL:
// The decimal type can't be blittable since the managed and native alignment requirements differ.
// Native needs 8-byte alignment since one field is a 64-bit integer, but managed only needs 4-byte alignment since all fields are ints.
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__NATIVEDECIMAL));
break;
case MarshalInfo::MARSHAL_TYPE_GUID:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__GUID));
break;
case MarshalInfo::MARSHAL_TYPE_DATE:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::FLOAT, sizeof(double), sizeof(double));
break;
case MarshalInfo::MARSHAL_TYPE_LPWSTR:
case MarshalInfo::MARSHAL_TYPE_LPSTR:
case MarshalInfo::MARSHAL_TYPE_LPUTF8STR:
case MarshalInfo::MARSHAL_TYPE_BSTR:
case MarshalInfo::MARSHAL_TYPE_ANSIBSTR:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(void*), sizeof(void*));
break;
#ifdef FEATURE_COMINTEROP
case MarshalInfo::MARSHAL_TYPE_INTERFACE:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(IUnknown*), sizeof(IUnknown*));
break;
case MarshalInfo::MARSHAL_TYPE_SAFEARRAY:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(SAFEARRAY*), sizeof(SAFEARRAY*));
break;
#endif
case MarshalInfo::MARSHAL_TYPE_DELEGATE:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(void*), sizeof(void*));
break;
case MarshalInfo::MARSHAL_TYPE_BLITTABLEVALUECLASS:
case MarshalInfo::MARSHAL_TYPE_VALUECLASS:
case MarshalInfo::MARSHAL_TYPE_LAYOUTCLASS:
case MarshalInfo::MARSHAL_TYPE_BLITTABLE_LAYOUTCLASS:
*pNFD = NativeFieldDescriptor(pFD, pargs->m_pMT);
break;
#ifdef FEATURE_COMINTEROP
case MarshalInfo::MARSHAL_TYPE_OBJECT:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__NATIVEVARIANT));
break;
#endif
case MarshalInfo::MARSHAL_TYPE_SAFEHANDLE:
case MarshalInfo::MARSHAL_TYPE_CRITICALHANDLE:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(void*), sizeof(void*));
break;
case MarshalInfo::MARSHAL_TYPE_FIXED_ARRAY:
{
CREATE_MARSHALER_CARRAY_OPERANDS mops;
mlInfo.GetMops(&mops);
MethodTable *pMT = mops.methodTable;
if (pMT->IsEnum())
{
pMT = CoreLibBinder::GetElementType(pMT->GetInternalCorElementType());
}
*pNFD = NativeFieldDescriptor(pFD, OleVariant::GetNativeMethodTableForVarType(mops.elementType, pMT), mops.additive);
break;
}
case MarshalInfo::MARSHAL_TYPE_FIXED_CSTR:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__BYTE), pargs->fs.fixedStringLength);
break;
case MarshalInfo::MARSHAL_TYPE_FIXED_WSTR:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__UINT16), pargs->fs.fixedStringLength);
break;
case MarshalInfo::MARSHAL_TYPE_UNKNOWN:
default:
*pNFD = NativeFieldDescriptor(pFD);
break;
}
}
bool IsFieldBlittable(
Module* pModule,
mdFieldDef fd,
SigPointer fieldSig,
const SigTypeContext* pTypeContext,
ParseNativeTypeFlags flags
)
{
PCCOR_SIGNATURE marshalInfoSig;
ULONG marshalInfoSigLength;
CorNativeType nativeType = NATIVE_TYPE_DEFAULT;
if (pModule->GetMDImport()->GetFieldMarshal(fd, &marshalInfoSig, &marshalInfoSigLength) == S_OK && marshalInfoSigLength > 0)
{
nativeType = (CorNativeType)*marshalInfoSig;
}
bool isBlittable = false;
EX_TRY
{
TypeHandle valueTypeHandle;
CorElementType corElemType = fieldSig.PeekElemTypeNormalized(pModule, pTypeContext, &valueTypeHandle);
switch (corElemType)
{
case ELEMENT_TYPE_CHAR:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT && flags != ParseNativeTypeFlags::IsAnsi) || (nativeType == NATIVE_TYPE_I2) || (nativeType == NATIVE_TYPE_U2);
break;
case ELEMENT_TYPE_I1:
case ELEMENT_TYPE_U1:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_I1) || (nativeType == NATIVE_TYPE_U1);
break;
case ELEMENT_TYPE_I2:
case ELEMENT_TYPE_U2:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_I2) || (nativeType == NATIVE_TYPE_U2);
break;
case ELEMENT_TYPE_I4:
case ELEMENT_TYPE_U4:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_I4) || (nativeType == NATIVE_TYPE_U4) || (nativeType == NATIVE_TYPE_ERROR);
break;
case ELEMENT_TYPE_I8:
case ELEMENT_TYPE_U8:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_I8) || (nativeType == NATIVE_TYPE_U8);
break;
case ELEMENT_TYPE_R4:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_R4);
break;
case ELEMENT_TYPE_R8:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_R8);
break;
case ELEMENT_TYPE_I:
case ELEMENT_TYPE_U:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_INT) || (nativeType == NATIVE_TYPE_UINT);
break;
case ELEMENT_TYPE_PTR:
isBlittable = nativeType == NATIVE_TYPE_DEFAULT;
break;
case ELEMENT_TYPE_FNPTR:
isBlittable = nativeType == NATIVE_TYPE_DEFAULT || nativeType == NATIVE_TYPE_FUNC;
break;
case ELEMENT_TYPE_VALUETYPE:
if (nativeType != NATIVE_TYPE_DEFAULT && nativeType != NATIVE_TYPE_STRUCT)
{
isBlittable = false;
}
else if (valueTypeHandle.GetMethodTable() == CoreLibBinder::GetClass(CLASS__DECIMAL))
{
// The alignment requirements of the managed System.Decimal type do not match the native DECIMAL type.
// As a result, a field of type System.Decimal can't be blittable.
isBlittable = false;
}
else
{
isBlittable = valueTypeHandle.GetMethodTable()->IsBlittable();
}
break;
default:
isBlittable = false;
break;
}
}
EX_CATCH
{
// We were unable to determine the native type, likely because there is a mutually recursive type reference
// in this field's type. A mutually recursive object would never be blittable, so we don't need to do anything.
}
EX_END_CATCH(RethrowTerminalExceptions);
return isBlittable;
}
//=======================================================================
// This function returns TRUE if the type passed in is either a value class or a class and if it has layout information
// and is marshalable. In all other cases it will return FALSE.
//=======================================================================
BOOL IsStructMarshalable(TypeHandle th)
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!th.IsNull());
}
CONTRACTL_END;
if (th.IsBlittable())
{
// th.IsBlittable will return true for arrays of blittable types, however since IsStructMarshalable
// is only supposed to return true for value classes or classes with layout that are marshallable
// we need to return false if the type is an array.
if (th.IsArray())
return FALSE;
else
return TRUE;
}
// Check to see if the type has layout.
if (!th.HasLayout())
return FALSE;
MethodTable *pMT= th.GetMethodTable();
PREFIX_ASSUME(pMT != NULL);
return pMT->GetNativeLayoutInfo()->IsMarshalable() ? TRUE : FALSE;
}
NativeFieldDescriptor::NativeFieldDescriptor()
:m_pFD(NULL),
m_offset(0),
m_category(NativeFieldCategory::ILLEGAL)
{
nativeSizeAndAlignment.m_nativeSize = 1;
nativeSizeAndAlignment.m_alignmentRequirement = 1;
}
NativeFieldDescriptor::NativeFieldDescriptor(PTR_FieldDesc pFD)
:m_pFD(pFD),
m_offset(0),
m_category(NativeFieldCategory::ILLEGAL)
{
nativeSizeAndAlignment.m_nativeSize = 1;
nativeSizeAndAlignment.m_alignmentRequirement = 1;
}
NativeFieldDescriptor::NativeFieldDescriptor(PTR_FieldDesc pFD, NativeFieldCategory flags, ULONG nativeSize, ULONG alignment)
:m_pFD(pFD),
m_offset(0),
m_category(flags)
{
_ASSERTE(flags != NativeFieldCategory::NESTED);
nativeSizeAndAlignment.m_nativeSize = nativeSize;
nativeSizeAndAlignment.m_alignmentRequirement = alignment;
}
NativeFieldDescriptor::NativeFieldDescriptor(PTR_FieldDesc pFD, PTR_MethodTable pMT, int numElements)
:m_pFD(pFD),
m_category(NativeFieldCategory::NESTED)
{
CONTRACTL
{
PRECONDITION(CheckPointer(pMT));
PRECONDITION(pMT->HasLayout());
}
CONTRACTL_END;
nestedTypeAndCount.m_pNestedType = pMT;
nestedTypeAndCount.m_numElements = numElements;
}
NativeFieldDescriptor::NativeFieldDescriptor(const NativeFieldDescriptor& other)
:m_pFD(other.m_pFD),
m_offset(other.m_offset),
m_category(other.m_category)
{
if (IsNestedType())
{
nestedTypeAndCount.m_pNestedType = other.nestedTypeAndCount.m_pNestedType;
nestedTypeAndCount.m_numElements = other.nestedTypeAndCount.m_numElements;
}
else
{
nativeSizeAndAlignment.m_nativeSize = other.nativeSizeAndAlignment.m_nativeSize;
nativeSizeAndAlignment.m_alignmentRequirement = other.nativeSizeAndAlignment.m_alignmentRequirement;
}
}
NativeFieldDescriptor& NativeFieldDescriptor::operator=(const NativeFieldDescriptor& other)
{
m_offset = other.m_offset;
m_category = other.m_category;
m_pFD = other.m_pFD;
if (IsNestedType())
{
nestedTypeAndCount.m_pNestedType = other.nestedTypeAndCount.m_pNestedType;
nestedTypeAndCount.m_numElements = other.nestedTypeAndCount.m_numElements;
}
else
{
nativeSizeAndAlignment.m_nativeSize = other.nativeSizeAndAlignment.m_nativeSize;
nativeSizeAndAlignment.m_alignmentRequirement = other.nativeSizeAndAlignment.m_alignmentRequirement;
}
return *this;
}
UINT32 NativeFieldDescriptor::AlignmentRequirement() const
{
if (IsNestedType())
{
MethodTable* pMT = GetNestedNativeMethodTable();
if (pMT->IsBlittable())
{
return pMT->GetLayoutInfo()->m_ManagedLargestAlignmentRequirementOfAllMembers;
}
return pMT->GetNativeLayoutInfo()->GetLargestAlignmentRequirement();
}
else
{
return nativeSizeAndAlignment.m_alignmentRequirement;
}
}
PTR_MethodTable NativeFieldDescriptor::GetNestedNativeMethodTable() const
{
CONTRACT(PTR_MethodTable)
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
PRECONDITION(IsNestedType());
POSTCONDITION(CheckPointer(RETVAL));
}
CONTRACT_END;
RETURN nestedTypeAndCount.m_pNestedType;
}
PTR_FieldDesc NativeFieldDescriptor::GetFieldDesc() const
{
CONTRACT(PTR_FieldDesc)
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
POSTCONDITION(CheckPointer(RETVAL, NULL_OK));
}
CONTRACT_END;
RETURN m_pFD;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// File: FieldMarshaler.cpp
//
//
#include "common.h"
#include "vars.hpp"
#include "class.h"
#include "ceeload.h"
#include "excep.h"
#include "fieldmarshaler.h"
#include "field.h"
#include "frames.h"
#include "dllimport.h"
#include "comdelegate.h"
#include "eeconfig.h"
#include "comdatetime.h"
#include "olevariant.h"
#include <cor.h>
#include <corpriv.h>
#include <corerror.h>
#include "sigformat.h"
#include "marshalnative.h"
#include "typeparse.h"
#ifdef FEATURE_COMINTEROP
#include <winstring.h>
#endif // FEATURE_COMINTEROP
VOID ParseNativeType(Module* pModule,
SigPointer sig,
PTR_FieldDesc pFD,
ParseNativeTypeFlags flags,
NativeFieldDescriptor* pNFD,
const SigTypeContext * pTypeContext
#ifdef _DEBUG
,
LPCUTF8 szNamespace,
LPCUTF8 szClassName,
LPCUTF8 szFieldName
#endif
)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM());
PRECONDITION(CheckPointer(pNFD));
}
CONTRACTL_END;
BOOL fAnsi = (flags == ParseNativeTypeFlags::IsAnsi);
MarshalInfo mlInfo(
pModule,
sig,
pTypeContext,
pFD->GetMemberDef(),
MarshalInfo::MARSHAL_SCENARIO_FIELD,
fAnsi ? nltAnsi : nltUnicode,
nlfNone,
FALSE,
0,
0,
FALSE, // We only need validation of the native signature and the MARSHAL_TYPE_*
FALSE, // so we don't need to accurately get the BestFitCustomAttribute data for this construction.
FALSE, /* fEmitsIL */
nullptr,
FALSE /* fUseCustomMarshal */
#ifdef _DEBUG
,
szFieldName,
szClassName,
-1 /* field */
#endif
);
OverrideProcArgs const* const pargs = mlInfo.GetOverrideProcArgs();
switch (mlInfo.GetMarshalType())
{
case MarshalInfo::MARSHAL_TYPE_GENERIC_1:
case MarshalInfo::MARSHAL_TYPE_GENERIC_U1:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT8), sizeof(INT8));
break;
case MarshalInfo::MARSHAL_TYPE_GENERIC_2:
case MarshalInfo::MARSHAL_TYPE_GENERIC_U2:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT16), sizeof(INT16));
break;
case MarshalInfo::MARSHAL_TYPE_GENERIC_4:
case MarshalInfo::MARSHAL_TYPE_GENERIC_U4:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT32), sizeof(INT32));
break;
case MarshalInfo::MARSHAL_TYPE_GENERIC_8:
#if defined(TARGET_X86) && defined(UNIX_X86_ABI)
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT64), 4);
#else
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(INT64), sizeof(INT64));
#endif
break;
case MarshalInfo::MARSHAL_TYPE_ANSICHAR:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(CHAR), sizeof(CHAR));
break;
case MarshalInfo::MARSHAL_TYPE_WINBOOL:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(BOOL), sizeof(BOOL));
break;
case MarshalInfo::MARSHAL_TYPE_CBOOL:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(bool), sizeof(bool));
break;
#ifdef FEATURE_COMINTEROP
case MarshalInfo::MARSHAL_TYPE_VTBOOL:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(VARIANT_BOOL), sizeof(VARIANT_BOOL));
break;
#endif
case MarshalInfo::MARSHAL_TYPE_FLOAT:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::FLOAT, sizeof(float), sizeof(float));
break;
case MarshalInfo::MARSHAL_TYPE_DOUBLE:
#if defined(TARGET_X86) && defined(UNIX_X86_ABI)
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::FLOAT, sizeof(double), 4);
#else
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::FLOAT, sizeof(double), sizeof(double));
#endif
break;
case MarshalInfo::MARSHAL_TYPE_CURRENCY:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__CURRENCY));
break;
case MarshalInfo::MARSHAL_TYPE_DECIMAL:
// The decimal type can't be blittable since the managed and native alignment requirements differ.
// Native needs 8-byte alignment since one field is a 64-bit integer, but managed only needs 4-byte alignment since all fields are ints.
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__NATIVEDECIMAL));
break;
case MarshalInfo::MARSHAL_TYPE_GUID:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__GUID));
break;
case MarshalInfo::MARSHAL_TYPE_DATE:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::FLOAT, sizeof(double), sizeof(double));
break;
case MarshalInfo::MARSHAL_TYPE_LPWSTR:
case MarshalInfo::MARSHAL_TYPE_LPSTR:
case MarshalInfo::MARSHAL_TYPE_LPUTF8STR:
case MarshalInfo::MARSHAL_TYPE_BSTR:
case MarshalInfo::MARSHAL_TYPE_ANSIBSTR:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(void*), sizeof(void*));
break;
#ifdef FEATURE_COMINTEROP
case MarshalInfo::MARSHAL_TYPE_INTERFACE:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(IUnknown*), sizeof(IUnknown*));
break;
case MarshalInfo::MARSHAL_TYPE_SAFEARRAY:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(SAFEARRAY*), sizeof(SAFEARRAY*));
break;
#endif
case MarshalInfo::MARSHAL_TYPE_DELEGATE:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(void*), sizeof(void*));
break;
case MarshalInfo::MARSHAL_TYPE_BLITTABLEVALUECLASS:
case MarshalInfo::MARSHAL_TYPE_VALUECLASS:
case MarshalInfo::MARSHAL_TYPE_LAYOUTCLASS:
case MarshalInfo::MARSHAL_TYPE_BLITTABLE_LAYOUTCLASS:
*pNFD = NativeFieldDescriptor(pFD, pargs->m_pMT);
break;
#ifdef FEATURE_COMINTEROP
case MarshalInfo::MARSHAL_TYPE_OBJECT:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__NATIVEVARIANT));
break;
#endif
case MarshalInfo::MARSHAL_TYPE_SAFEHANDLE:
case MarshalInfo::MARSHAL_TYPE_CRITICALHANDLE:
*pNFD = NativeFieldDescriptor(pFD, NativeFieldCategory::INTEGER, sizeof(void*), sizeof(void*));
break;
case MarshalInfo::MARSHAL_TYPE_FIXED_ARRAY:
{
CREATE_MARSHALER_CARRAY_OPERANDS mops;
mlInfo.GetMops(&mops);
MethodTable *pMT = mops.methodTable;
if (pMT->IsEnum())
{
pMT = CoreLibBinder::GetElementType(pMT->GetInternalCorElementType());
}
*pNFD = NativeFieldDescriptor(pFD, OleVariant::GetNativeMethodTableForVarType(mops.elementType, pMT), mops.additive);
break;
}
case MarshalInfo::MARSHAL_TYPE_FIXED_CSTR:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__BYTE), pargs->fs.fixedStringLength);
break;
case MarshalInfo::MARSHAL_TYPE_FIXED_WSTR:
*pNFD = NativeFieldDescriptor(pFD, CoreLibBinder::GetClass(CLASS__UINT16), pargs->fs.fixedStringLength);
break;
case MarshalInfo::MARSHAL_TYPE_UNKNOWN:
default:
*pNFD = NativeFieldDescriptor(pFD);
break;
}
}
bool IsFieldBlittable(
Module* pModule,
mdFieldDef fd,
SigPointer fieldSig,
const SigTypeContext* pTypeContext,
ParseNativeTypeFlags flags
)
{
PCCOR_SIGNATURE marshalInfoSig;
ULONG marshalInfoSigLength;
CorNativeType nativeType = NATIVE_TYPE_DEFAULT;
if (pModule->GetMDImport()->GetFieldMarshal(fd, &marshalInfoSig, &marshalInfoSigLength) == S_OK && marshalInfoSigLength > 0)
{
nativeType = (CorNativeType)*marshalInfoSig;
}
bool isBlittable = false;
EX_TRY
{
TypeHandle valueTypeHandle;
CorElementType corElemType = fieldSig.PeekElemTypeNormalized(pModule, pTypeContext, &valueTypeHandle);
switch (corElemType)
{
case ELEMENT_TYPE_CHAR:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT && flags != ParseNativeTypeFlags::IsAnsi) || (nativeType == NATIVE_TYPE_I2) || (nativeType == NATIVE_TYPE_U2);
break;
case ELEMENT_TYPE_I1:
case ELEMENT_TYPE_U1:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_I1) || (nativeType == NATIVE_TYPE_U1);
break;
case ELEMENT_TYPE_I2:
case ELEMENT_TYPE_U2:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_I2) || (nativeType == NATIVE_TYPE_U2);
break;
case ELEMENT_TYPE_I4:
case ELEMENT_TYPE_U4:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_I4) || (nativeType == NATIVE_TYPE_U4) || (nativeType == NATIVE_TYPE_ERROR);
break;
case ELEMENT_TYPE_I8:
case ELEMENT_TYPE_U8:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_I8) || (nativeType == NATIVE_TYPE_U8);
break;
case ELEMENT_TYPE_R4:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_R4);
break;
case ELEMENT_TYPE_R8:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_R8);
break;
case ELEMENT_TYPE_I:
case ELEMENT_TYPE_U:
isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_INT) || (nativeType == NATIVE_TYPE_UINT);
break;
case ELEMENT_TYPE_PTR:
isBlittable = nativeType == NATIVE_TYPE_DEFAULT;
break;
case ELEMENT_TYPE_FNPTR:
isBlittable = nativeType == NATIVE_TYPE_DEFAULT || nativeType == NATIVE_TYPE_FUNC;
break;
case ELEMENT_TYPE_VALUETYPE:
if (nativeType != NATIVE_TYPE_DEFAULT && nativeType != NATIVE_TYPE_STRUCT)
{
isBlittable = false;
}
else if (valueTypeHandle.GetMethodTable() == CoreLibBinder::GetClass(CLASS__DECIMAL))
{
// The alignment requirements of the managed System.Decimal type do not match the native DECIMAL type.
// As a result, a field of type System.Decimal can't be blittable.
isBlittable = false;
}
else
{
isBlittable = valueTypeHandle.GetMethodTable()->IsBlittable();
}
break;
default:
isBlittable = false;
break;
}
}
EX_CATCH
{
// We were unable to determine the native type, likely because there is a mutually recursive type reference
// in this field's type. A mutually recursive object would never be blittable, so we don't need to do anything.
}
EX_END_CATCH(RethrowTerminalExceptions);
return isBlittable;
}
//=======================================================================
// This function returns TRUE if the type passed in is either a value class or a class and if it has layout information
// and is marshalable. In all other cases it will return FALSE.
//=======================================================================
BOOL IsStructMarshalable(TypeHandle th)
{
CONTRACTL
{
STANDARD_VM_CHECK;
PRECONDITION(!th.IsNull());
}
CONTRACTL_END;
if (th.IsBlittable())
{
// th.IsBlittable will return true for arrays of blittable types, however since IsStructMarshalable
// is only supposed to return true for value classes or classes with layout that are marshallable
// we need to return false if the type is an array.
if (th.IsArray())
return FALSE;
else
return TRUE;
}
// Check to see if the type has layout.
if (!th.HasLayout())
return FALSE;
MethodTable *pMT= th.GetMethodTable();
PREFIX_ASSUME(pMT != NULL);
return pMT->GetNativeLayoutInfo()->IsMarshalable() ? TRUE : FALSE;
}
NativeFieldDescriptor::NativeFieldDescriptor()
:m_pFD(NULL),
m_offset(0),
m_category(NativeFieldCategory::ILLEGAL)
{
nativeSizeAndAlignment.m_nativeSize = 1;
nativeSizeAndAlignment.m_alignmentRequirement = 1;
}
NativeFieldDescriptor::NativeFieldDescriptor(PTR_FieldDesc pFD)
:m_pFD(pFD),
m_offset(0),
m_category(NativeFieldCategory::ILLEGAL)
{
nativeSizeAndAlignment.m_nativeSize = 1;
nativeSizeAndAlignment.m_alignmentRequirement = 1;
}
NativeFieldDescriptor::NativeFieldDescriptor(PTR_FieldDesc pFD, NativeFieldCategory flags, ULONG nativeSize, ULONG alignment)
:m_pFD(pFD),
m_offset(0),
m_category(flags)
{
_ASSERTE(flags != NativeFieldCategory::NESTED);
nativeSizeAndAlignment.m_nativeSize = nativeSize;
nativeSizeAndAlignment.m_alignmentRequirement = alignment;
}
NativeFieldDescriptor::NativeFieldDescriptor(PTR_FieldDesc pFD, PTR_MethodTable pMT, int numElements)
:m_pFD(pFD),
m_category(NativeFieldCategory::NESTED)
{
CONTRACTL
{
PRECONDITION(CheckPointer(pMT));
PRECONDITION(pMT->HasLayout());
}
CONTRACTL_END;
nestedTypeAndCount.m_pNestedType = pMT;
nestedTypeAndCount.m_numElements = numElements;
}
NativeFieldDescriptor::NativeFieldDescriptor(const NativeFieldDescriptor& other)
:m_pFD(other.m_pFD),
m_offset(other.m_offset),
m_category(other.m_category)
{
if (IsNestedType())
{
nestedTypeAndCount.m_pNestedType = other.nestedTypeAndCount.m_pNestedType;
nestedTypeAndCount.m_numElements = other.nestedTypeAndCount.m_numElements;
}
else
{
nativeSizeAndAlignment.m_nativeSize = other.nativeSizeAndAlignment.m_nativeSize;
nativeSizeAndAlignment.m_alignmentRequirement = other.nativeSizeAndAlignment.m_alignmentRequirement;
}
}
NativeFieldDescriptor& NativeFieldDescriptor::operator=(const NativeFieldDescriptor& other)
{
m_offset = other.m_offset;
m_category = other.m_category;
m_pFD = other.m_pFD;
if (IsNestedType())
{
nestedTypeAndCount.m_pNestedType = other.nestedTypeAndCount.m_pNestedType;
nestedTypeAndCount.m_numElements = other.nestedTypeAndCount.m_numElements;
}
else
{
nativeSizeAndAlignment.m_nativeSize = other.nativeSizeAndAlignment.m_nativeSize;
nativeSizeAndAlignment.m_alignmentRequirement = other.nativeSizeAndAlignment.m_alignmentRequirement;
}
return *this;
}
UINT32 NativeFieldDescriptor::AlignmentRequirement() const
{
if (IsNestedType())
{
MethodTable* pMT = GetNestedNativeMethodTable();
if (pMT->IsBlittable())
{
return pMT->GetLayoutInfo()->m_ManagedLargestAlignmentRequirementOfAllMembers;
}
return pMT->GetNativeLayoutInfo()->GetLargestAlignmentRequirement();
}
else
{
return nativeSizeAndAlignment.m_alignmentRequirement;
}
}
PTR_MethodTable NativeFieldDescriptor::GetNestedNativeMethodTable() const
{
CONTRACT(PTR_MethodTable)
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
PRECONDITION(IsNestedType());
POSTCONDITION(CheckPointer(RETVAL));
}
CONTRACT_END;
RETURN nestedTypeAndCount.m_pNestedType;
}
PTR_FieldDesc NativeFieldDescriptor::GetFieldDesc() const
{
CONTRACT(PTR_FieldDesc)
{
NOTHROW;
GC_NOTRIGGER;
MODE_ANY;
POSTCONDITION(CheckPointer(RETVAL, NULL_OK));
}
CONTRACT_END;
RETURN m_pFD;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/external/rapidjson/encodedstream.h
|
// Tencent is pleased to support the open source community by making RapidJSON available.
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#ifndef RAPIDJSON_ENCODEDSTREAM_H_
#define RAPIDJSON_ENCODEDSTREAM_H_
#include "stream.h"
#include "memorystream.h"
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
#endif
#ifdef __clang__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(padded)
#endif
RAPIDJSON_NAMESPACE_BEGIN
//! Input byte stream wrapper with a statically bound encoding.
/*!
\tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE.
\tparam InputByteStream Type of input byte stream. For example, FileReadStream.
*/
template <typename Encoding, typename InputByteStream>
class EncodedInputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
public:
typedef typename Encoding::Ch Ch;
EncodedInputStream(InputByteStream& is) : is_(is) {
current_ = Encoding::TakeBOM(is_);
}
Ch Peek() const { return current_; }
Ch Take() { Ch c = current_; current_ = Encoding::Take(is_); return c; }
size_t Tell() const { return is_.Tell(); }
// Not implemented
void Put(Ch) { RAPIDJSON_ASSERT(false); }
void Flush() { RAPIDJSON_ASSERT(false); }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
EncodedInputStream(const EncodedInputStream&);
EncodedInputStream& operator=(const EncodedInputStream&);
InputByteStream& is_;
Ch current_;
};
//! Specialized for UTF8 MemoryStream.
template <>
class EncodedInputStream<UTF8<>, MemoryStream> {
public:
typedef UTF8<>::Ch Ch;
EncodedInputStream(MemoryStream& is) : is_(is) {
if (static_cast<unsigned char>(is_.Peek()) == 0xEFu) is_.Take();
if (static_cast<unsigned char>(is_.Peek()) == 0xBBu) is_.Take();
if (static_cast<unsigned char>(is_.Peek()) == 0xBFu) is_.Take();
}
Ch Peek() const { return is_.Peek(); }
Ch Take() { return is_.Take(); }
size_t Tell() const { return is_.Tell(); }
// Not implemented
void Put(Ch) {}
void Flush() {}
Ch* PutBegin() { return 0; }
size_t PutEnd(Ch*) { return 0; }
MemoryStream& is_;
private:
EncodedInputStream(const EncodedInputStream&);
EncodedInputStream& operator=(const EncodedInputStream&);
};
//! Output byte stream wrapper with statically bound encoding.
/*!
\tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE.
\tparam OutputByteStream Type of input byte stream. For example, FileWriteStream.
*/
template <typename Encoding, typename OutputByteStream>
class EncodedOutputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
public:
typedef typename Encoding::Ch Ch;
EncodedOutputStream(OutputByteStream& os, bool putBOM = true) : os_(os) {
if (putBOM)
Encoding::PutBOM(os_);
}
void Put(Ch c) { Encoding::Put(os_, c); }
void Flush() { os_.Flush(); }
// Not implemented
Ch Peek() const { RAPIDJSON_ASSERT(false); return 0;}
Ch Take() { RAPIDJSON_ASSERT(false); return 0;}
size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
EncodedOutputStream(const EncodedOutputStream&);
EncodedOutputStream& operator=(const EncodedOutputStream&);
OutputByteStream& os_;
};
#define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x
//! Input stream wrapper with dynamically bound encoding and automatic encoding detection.
/*!
\tparam CharType Type of character for reading.
\tparam InputByteStream type of input byte stream to be wrapped.
*/
template <typename CharType, typename InputByteStream>
class AutoUTFInputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
public:
typedef CharType Ch;
//! Constructor.
/*!
\param is input stream to be wrapped.
\param type UTF encoding type if it is not detected from the stream.
*/
AutoUTFInputStream(InputByteStream& is, UTFType type = kUTF8) : is_(&is), type_(type), hasBOM_(false) {
RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE);
DetectType();
static const TakeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Take) };
takeFunc_ = f[type_];
current_ = takeFunc_(*is_);
}
UTFType GetType() const { return type_; }
bool HasBOM() const { return hasBOM_; }
Ch Peek() const { return current_; }
Ch Take() { Ch c = current_; current_ = takeFunc_(*is_); return c; }
size_t Tell() const { return is_->Tell(); }
// Not implemented
void Put(Ch) { RAPIDJSON_ASSERT(false); }
void Flush() { RAPIDJSON_ASSERT(false); }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
AutoUTFInputStream(const AutoUTFInputStream&);
AutoUTFInputStream& operator=(const AutoUTFInputStream&);
// Detect encoding type with BOM or RFC 4627
void DetectType() {
// BOM (Byte Order Mark):
// 00 00 FE FF UTF-32BE
// FF FE 00 00 UTF-32LE
// FE FF UTF-16BE
// FF FE UTF-16LE
// EF BB BF UTF-8
const unsigned char* c = reinterpret_cast<const unsigned char *>(is_->Peek4());
if (!c)
return;
unsigned bom = static_cast<unsigned>(c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24));
hasBOM_ = false;
if (bom == 0xFFFE0000) { type_ = kUTF32BE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); }
else if (bom == 0x0000FEFF) { type_ = kUTF32LE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); }
else if ((bom & 0xFFFF) == 0xFFFE) { type_ = kUTF16BE; hasBOM_ = true; is_->Take(); is_->Take(); }
else if ((bom & 0xFFFF) == 0xFEFF) { type_ = kUTF16LE; hasBOM_ = true; is_->Take(); is_->Take(); }
else if ((bom & 0xFFFFFF) == 0xBFBBEF) { type_ = kUTF8; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); }
// RFC 4627: Section 3
// "Since the first two characters of a JSON text will always be ASCII
// characters [RFC0020], it is possible to determine whether an octet
// stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking
// at the pattern of nulls in the first four octets."
// 00 00 00 xx UTF-32BE
// 00 xx 00 xx UTF-16BE
// xx 00 00 00 UTF-32LE
// xx 00 xx 00 UTF-16LE
// xx xx xx xx UTF-8
if (!hasBOM_) {
int pattern = (c[0] ? 1 : 0) | (c[1] ? 2 : 0) | (c[2] ? 4 : 0) | (c[3] ? 8 : 0);
switch (pattern) {
case 0x08: type_ = kUTF32BE; break;
case 0x0A: type_ = kUTF16BE; break;
case 0x01: type_ = kUTF32LE; break;
case 0x05: type_ = kUTF16LE; break;
case 0x0F: type_ = kUTF8; break;
default: break; // Use type defined by user.
}
}
// Runtime check whether the size of character type is sufficient. It only perform checks with assertion.
if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2);
if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
}
typedef Ch (*TakeFunc)(InputByteStream& is);
InputByteStream* is_;
UTFType type_;
Ch current_;
TakeFunc takeFunc_;
bool hasBOM_;
};
//! Output stream wrapper with dynamically bound encoding and automatic encoding detection.
/*!
\tparam CharType Type of character for writing.
\tparam OutputByteStream type of output byte stream to be wrapped.
*/
template <typename CharType, typename OutputByteStream>
class AutoUTFOutputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
public:
typedef CharType Ch;
//! Constructor.
/*!
\param os output stream to be wrapped.
\param type UTF encoding type.
\param putBOM Whether to write BOM at the beginning of the stream.
*/
AutoUTFOutputStream(OutputByteStream& os, UTFType type, bool putBOM) : os_(&os), type_(type) {
RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE);
// Runtime check whether the size of character type is sufficient. It only perform checks with assertion.
if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2);
if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
static const PutFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Put) };
putFunc_ = f[type_];
if (putBOM)
PutBOM();
}
UTFType GetType() const { return type_; }
void Put(Ch c) { putFunc_(*os_, c); }
void Flush() { os_->Flush(); }
// Not implemented
Ch Peek() const { RAPIDJSON_ASSERT(false); return 0;}
Ch Take() { RAPIDJSON_ASSERT(false); return 0;}
size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
AutoUTFOutputStream(const AutoUTFOutputStream&);
AutoUTFOutputStream& operator=(const AutoUTFOutputStream&);
void PutBOM() {
typedef void (*PutBOMFunc)(OutputByteStream&);
static const PutBOMFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(PutBOM) };
f[type_](*os_);
}
typedef void (*PutFunc)(OutputByteStream&, Ch);
OutputByteStream* os_;
UTFType type_;
PutFunc putFunc_;
};
#undef RAPIDJSON_ENCODINGS_FUNC
RAPIDJSON_NAMESPACE_END
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
#ifdef __GNUC__
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_FILESTREAM_H_
|
// Tencent is pleased to support the open source community by making RapidJSON available.
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#ifndef RAPIDJSON_ENCODEDSTREAM_H_
#define RAPIDJSON_ENCODEDSTREAM_H_
#include "stream.h"
#include "memorystream.h"
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
#endif
#ifdef __clang__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(padded)
#endif
RAPIDJSON_NAMESPACE_BEGIN
//! Input byte stream wrapper with a statically bound encoding.
/*!
\tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE.
\tparam InputByteStream Type of input byte stream. For example, FileReadStream.
*/
template <typename Encoding, typename InputByteStream>
class EncodedInputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
public:
typedef typename Encoding::Ch Ch;
EncodedInputStream(InputByteStream& is) : is_(is) {
current_ = Encoding::TakeBOM(is_);
}
Ch Peek() const { return current_; }
Ch Take() { Ch c = current_; current_ = Encoding::Take(is_); return c; }
size_t Tell() const { return is_.Tell(); }
// Not implemented
void Put(Ch) { RAPIDJSON_ASSERT(false); }
void Flush() { RAPIDJSON_ASSERT(false); }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
EncodedInputStream(const EncodedInputStream&);
EncodedInputStream& operator=(const EncodedInputStream&);
InputByteStream& is_;
Ch current_;
};
//! Specialized for UTF8 MemoryStream.
template <>
class EncodedInputStream<UTF8<>, MemoryStream> {
public:
typedef UTF8<>::Ch Ch;
EncodedInputStream(MemoryStream& is) : is_(is) {
if (static_cast<unsigned char>(is_.Peek()) == 0xEFu) is_.Take();
if (static_cast<unsigned char>(is_.Peek()) == 0xBBu) is_.Take();
if (static_cast<unsigned char>(is_.Peek()) == 0xBFu) is_.Take();
}
Ch Peek() const { return is_.Peek(); }
Ch Take() { return is_.Take(); }
size_t Tell() const { return is_.Tell(); }
// Not implemented
void Put(Ch) {}
void Flush() {}
Ch* PutBegin() { return 0; }
size_t PutEnd(Ch*) { return 0; }
MemoryStream& is_;
private:
EncodedInputStream(const EncodedInputStream&);
EncodedInputStream& operator=(const EncodedInputStream&);
};
//! Output byte stream wrapper with statically bound encoding.
/*!
\tparam Encoding The interpretation of encoding of the stream. Either UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE.
\tparam OutputByteStream Type of input byte stream. For example, FileWriteStream.
*/
template <typename Encoding, typename OutputByteStream>
class EncodedOutputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
public:
typedef typename Encoding::Ch Ch;
EncodedOutputStream(OutputByteStream& os, bool putBOM = true) : os_(os) {
if (putBOM)
Encoding::PutBOM(os_);
}
void Put(Ch c) { Encoding::Put(os_, c); }
void Flush() { os_.Flush(); }
// Not implemented
Ch Peek() const { RAPIDJSON_ASSERT(false); return 0;}
Ch Take() { RAPIDJSON_ASSERT(false); return 0;}
size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
EncodedOutputStream(const EncodedOutputStream&);
EncodedOutputStream& operator=(const EncodedOutputStream&);
OutputByteStream& os_;
};
#define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x
//! Input stream wrapper with dynamically bound encoding and automatic encoding detection.
/*!
\tparam CharType Type of character for reading.
\tparam InputByteStream type of input byte stream to be wrapped.
*/
template <typename CharType, typename InputByteStream>
class AutoUTFInputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename InputByteStream::Ch) == 1);
public:
typedef CharType Ch;
//! Constructor.
/*!
\param is input stream to be wrapped.
\param type UTF encoding type if it is not detected from the stream.
*/
AutoUTFInputStream(InputByteStream& is, UTFType type = kUTF8) : is_(&is), type_(type), hasBOM_(false) {
RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE);
DetectType();
static const TakeFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Take) };
takeFunc_ = f[type_];
current_ = takeFunc_(*is_);
}
UTFType GetType() const { return type_; }
bool HasBOM() const { return hasBOM_; }
Ch Peek() const { return current_; }
Ch Take() { Ch c = current_; current_ = takeFunc_(*is_); return c; }
size_t Tell() const { return is_->Tell(); }
// Not implemented
void Put(Ch) { RAPIDJSON_ASSERT(false); }
void Flush() { RAPIDJSON_ASSERT(false); }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
AutoUTFInputStream(const AutoUTFInputStream&);
AutoUTFInputStream& operator=(const AutoUTFInputStream&);
// Detect encoding type with BOM or RFC 4627
void DetectType() {
// BOM (Byte Order Mark):
// 00 00 FE FF UTF-32BE
// FF FE 00 00 UTF-32LE
// FE FF UTF-16BE
// FF FE UTF-16LE
// EF BB BF UTF-8
const unsigned char* c = reinterpret_cast<const unsigned char *>(is_->Peek4());
if (!c)
return;
unsigned bom = static_cast<unsigned>(c[0] | (c[1] << 8) | (c[2] << 16) | (c[3] << 24));
hasBOM_ = false;
if (bom == 0xFFFE0000) { type_ = kUTF32BE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); }
else if (bom == 0x0000FEFF) { type_ = kUTF32LE; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); is_->Take(); }
else if ((bom & 0xFFFF) == 0xFFFE) { type_ = kUTF16BE; hasBOM_ = true; is_->Take(); is_->Take(); }
else if ((bom & 0xFFFF) == 0xFEFF) { type_ = kUTF16LE; hasBOM_ = true; is_->Take(); is_->Take(); }
else if ((bom & 0xFFFFFF) == 0xBFBBEF) { type_ = kUTF8; hasBOM_ = true; is_->Take(); is_->Take(); is_->Take(); }
// RFC 4627: Section 3
// "Since the first two characters of a JSON text will always be ASCII
// characters [RFC0020], it is possible to determine whether an octet
// stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking
// at the pattern of nulls in the first four octets."
// 00 00 00 xx UTF-32BE
// 00 xx 00 xx UTF-16BE
// xx 00 00 00 UTF-32LE
// xx 00 xx 00 UTF-16LE
// xx xx xx xx UTF-8
if (!hasBOM_) {
int pattern = (c[0] ? 1 : 0) | (c[1] ? 2 : 0) | (c[2] ? 4 : 0) | (c[3] ? 8 : 0);
switch (pattern) {
case 0x08: type_ = kUTF32BE; break;
case 0x0A: type_ = kUTF16BE; break;
case 0x01: type_ = kUTF32LE; break;
case 0x05: type_ = kUTF16LE; break;
case 0x0F: type_ = kUTF8; break;
default: break; // Use type defined by user.
}
}
// Runtime check whether the size of character type is sufficient. It only perform checks with assertion.
if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2);
if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
}
typedef Ch (*TakeFunc)(InputByteStream& is);
InputByteStream* is_;
UTFType type_;
Ch current_;
TakeFunc takeFunc_;
bool hasBOM_;
};
//! Output stream wrapper with dynamically bound encoding and automatic encoding detection.
/*!
\tparam CharType Type of character for writing.
\tparam OutputByteStream type of output byte stream to be wrapped.
*/
template <typename CharType, typename OutputByteStream>
class AutoUTFOutputStream {
RAPIDJSON_STATIC_ASSERT(sizeof(typename OutputByteStream::Ch) == 1);
public:
typedef CharType Ch;
//! Constructor.
/*!
\param os output stream to be wrapped.
\param type UTF encoding type.
\param putBOM Whether to write BOM at the beginning of the stream.
*/
AutoUTFOutputStream(OutputByteStream& os, UTFType type, bool putBOM) : os_(&os), type_(type) {
RAPIDJSON_ASSERT(type >= kUTF8 && type <= kUTF32BE);
// Runtime check whether the size of character type is sufficient. It only perform checks with assertion.
if (type_ == kUTF16LE || type_ == kUTF16BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 2);
if (type_ == kUTF32LE || type_ == kUTF32BE) RAPIDJSON_ASSERT(sizeof(Ch) >= 4);
static const PutFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(Put) };
putFunc_ = f[type_];
if (putBOM)
PutBOM();
}
UTFType GetType() const { return type_; }
void Put(Ch c) { putFunc_(*os_, c); }
void Flush() { os_->Flush(); }
// Not implemented
Ch Peek() const { RAPIDJSON_ASSERT(false); return 0;}
Ch Take() { RAPIDJSON_ASSERT(false); return 0;}
size_t Tell() const { RAPIDJSON_ASSERT(false); return 0; }
Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }
private:
AutoUTFOutputStream(const AutoUTFOutputStream&);
AutoUTFOutputStream& operator=(const AutoUTFOutputStream&);
void PutBOM() {
typedef void (*PutBOMFunc)(OutputByteStream&);
static const PutBOMFunc f[] = { RAPIDJSON_ENCODINGS_FUNC(PutBOM) };
f[type_](*os_);
}
typedef void (*PutFunc)(OutputByteStream&, Ch);
OutputByteStream* os_;
UTFType type_;
PutFunc putFunc_;
};
#undef RAPIDJSON_ENCODINGS_FUNC
RAPIDJSON_NAMESPACE_END
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
#ifdef __GNUC__
RAPIDJSON_DIAG_POP
#endif
#endif // RAPIDJSON_FILESTREAM_H_
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/tests/palsuite/filemapping_memmgt/VirtualFree/test1/VirtualFree.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================
**
** Source: virtualfree.c
**
** Purpose: Positive test the VirtualFree API.
** Call VirtualFree with MEM_DECOMMIT
** free operation type
**
**
**============================================================*/
#include <palsuite.h>
PALTEST(filemapping_memmgt_VirtualFree_test1_paltest_virtualfree_test1, "filemapping_memmgt/VirtualFree/test1/paltest_virtualfree_test1")
{
int err;
LPVOID lpVirtualAddress;
//Initialize the PAL environment
err = PAL_Initialize(argc, argv);
if(0 != err)
{
ExitProcess(FAIL);
}
//Allocate the physical storage in memory or in the paging file on disk
lpVirtualAddress = VirtualAlloc(NULL,//system determine where to allocate the region
1024, //specify the size
MEM_COMMIT, //allocation type
PAGE_READONLY); //access protection
if(NULL == lpVirtualAddress)
{
Fail("\nFailed to call VirtualAlloc API!\n");
}
//decommit the specified region
err = VirtualFree(lpVirtualAddress,1024,MEM_DECOMMIT);
if(0 == err)
{
Fail("\nFailed to call VirtualFree API!\n");
}
PAL_Terminate();
return PASS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*=============================================================
**
** Source: virtualfree.c
**
** Purpose: Positive test the VirtualFree API.
** Call VirtualFree with MEM_DECOMMIT
** free operation type
**
**
**============================================================*/
#include <palsuite.h>
PALTEST(filemapping_memmgt_VirtualFree_test1_paltest_virtualfree_test1, "filemapping_memmgt/VirtualFree/test1/paltest_virtualfree_test1")
{
int err;
LPVOID lpVirtualAddress;
//Initialize the PAL environment
err = PAL_Initialize(argc, argv);
if(0 != err)
{
ExitProcess(FAIL);
}
//Allocate the physical storage in memory or in the paging file on disk
lpVirtualAddress = VirtualAlloc(NULL,//system determine where to allocate the region
1024, //specify the size
MEM_COMMIT, //allocation type
PAGE_READONLY); //access protection
if(NULL == lpVirtualAddress)
{
Fail("\nFailed to call VirtualAlloc API!\n");
}
//decommit the specified region
err = VirtualFree(lpVirtualAddress,1024,MEM_DECOMMIT);
if(0 == err)
{
Fail("\nFailed to call VirtualFree API!\n");
}
PAL_Terminate();
return PASS;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/external/libunwind/include/mempool.h
|
/* libunwind - a platform-independent unwind library
Copyright (C) 2002-2003 Hewlett-Packard Co
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef mempool_h
#define mempool_h
/* Memory pools provide simple memory management of fixed-size
objects. Memory pools are used for two purposes:
o To ensure a stack can be unwound even when a process
is out of memory.
o To ensure a stack can be unwound at any time in a
multi-threaded process (e.g., even at a time when the normal
malloc-lock is taken, possibly by the very thread that is
being unwind).
To achieve the second objective, memory pools allocate memory
directly via mmap() system call (or an equivalent facility).
The first objective is accomplished by reserving memory ahead of
time. Since the memory requirements of stack unwinding generally
depends on the complexity of the procedures being unwind, there is
no absolute guarantee that unwinding will always work, but in
practice, this should not be a serious problem. */
#include <sys/types.h>
#include "libunwind_i.h"
#define sos_alloc(s) UNWI_ARCH_OBJ(_sos_alloc)(s)
#define mempool_init(p,s,r) UNWI_ARCH_OBJ(_mempool_init)(p,s,r)
#define mempool_alloc(p) UNWI_ARCH_OBJ(_mempool_alloc)(p)
#define mempool_free(p,o) UNWI_ARCH_OBJ(_mempool_free)(p,o)
/* The mempool structure should be treated as an opaque object. It's
declared here only to enable static allocation of mempools. */
struct mempool
{
pthread_mutex_t lock;
size_t obj_size; /* object size (rounded up for alignment) */
size_t chunk_size; /* allocation granularity */
size_t reserve; /* minimum (desired) size of the free-list */
size_t num_free; /* number of objects on the free-list */
struct object
{
struct object *next;
}
*free_list;
};
/* Emergency allocation for one-time stuff that doesn't fit the memory
pool model. A limited amount of memory is available in this
fashion and once allocated, there is no way to free it. */
extern void *sos_alloc (size_t size);
/* Initialize POOL for an object size of OBJECT_SIZE bytes. RESERVE
is the number of objects that should be reserved for use under
tight memory situations. If it is zero, mempool attempts to pick a
reasonable default value. */
extern void mempool_init (struct mempool *pool,
size_t obj_size, size_t reserve);
extern void *mempool_alloc (struct mempool *pool);
extern void mempool_free (struct mempool *pool, void *object);
#endif /* mempool_h */
|
/* libunwind - a platform-independent unwind library
Copyright (C) 2002-2003 Hewlett-Packard Co
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef mempool_h
#define mempool_h
/* Memory pools provide simple memory management of fixed-size
objects. Memory pools are used for two purposes:
o To ensure a stack can be unwound even when a process
is out of memory.
o To ensure a stack can be unwound at any time in a
multi-threaded process (e.g., even at a time when the normal
malloc-lock is taken, possibly by the very thread that is
being unwind).
To achieve the second objective, memory pools allocate memory
directly via mmap() system call (or an equivalent facility).
The first objective is accomplished by reserving memory ahead of
time. Since the memory requirements of stack unwinding generally
depends on the complexity of the procedures being unwind, there is
no absolute guarantee that unwinding will always work, but in
practice, this should not be a serious problem. */
#include <sys/types.h>
#include "libunwind_i.h"
#define sos_alloc(s) UNWI_ARCH_OBJ(_sos_alloc)(s)
#define mempool_init(p,s,r) UNWI_ARCH_OBJ(_mempool_init)(p,s,r)
#define mempool_alloc(p) UNWI_ARCH_OBJ(_mempool_alloc)(p)
#define mempool_free(p,o) UNWI_ARCH_OBJ(_mempool_free)(p,o)
/* The mempool structure should be treated as an opaque object. It's
declared here only to enable static allocation of mempools. */
struct mempool
{
pthread_mutex_t lock;
size_t obj_size; /* object size (rounded up for alignment) */
size_t chunk_size; /* allocation granularity */
size_t reserve; /* minimum (desired) size of the free-list */
size_t num_free; /* number of objects on the free-list */
struct object
{
struct object *next;
}
*free_list;
};
/* Emergency allocation for one-time stuff that doesn't fit the memory
pool model. A limited amount of memory is available in this
fashion and once allocated, there is no way to free it. */
extern void *sos_alloc (size_t size);
/* Initialize POOL for an object size of OBJECT_SIZE bytes. RESERVE
is the number of objects that should be reserved for use under
tight memory situations. If it is zero, mempool attempts to pick a
reasonable default value. */
extern void mempool_init (struct mempool *pool,
size_t obj_size, size_t reserve);
extern void *mempool_alloc (struct mempool *pool);
extern void mempool_free (struct mempool *pool, void *object);
#endif /* mempool_h */
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/Microsoft.Extensions.Configuration.Xml/tests/Microsoft.Extensions.Configuration.Xml.Tests.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
<EnableDefaultItems>true</EnableDefaultItems>
<IncludePlatformAttributes>false</IncludePlatformAttributes>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(LibrariesProjectRoot)Microsoft.Extensions.Configuration\tests\ConfigurationProviderTestBase.cs"
Link="Microsoft.Extensions.Configuration\tests\ConfigurationProviderTestBase.cs" />
<Compile Include="$(LibrariesProjectRoot)Microsoft.Extensions.Configuration\tests\Common\ConfigurationProviderExtensions.cs"
Link="Microsoft.Extensions.Configuration\tests\Common\ConfigurationProviderExtensions.cs" />
<Compile Include="$(LibrariesProjectRoot)Microsoft.Extensions.Configuration\tests\Common\TestStreamHelpers.cs"
Link="Microsoft.Extensions.Configuration\tests\Common\TestStreamHelpers.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Configuration.Binder\src\Microsoft.Extensions.Configuration.Binder.csproj" />
<ProjectReference Include="..\src\Microsoft.Extensions.Configuration.Xml.csproj" SkipUseReferenceAssembly="true" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Security" />
<!-- Manually reference the transitive dependency to make NuGet pick the package over the transitive project: https://github.com/NuGet/Home/issues/10368 -->
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsVersion)" PrivateAssets="all" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
<EnableDefaultItems>true</EnableDefaultItems>
<IncludePlatformAttributes>false</IncludePlatformAttributes>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(LibrariesProjectRoot)Microsoft.Extensions.Configuration\tests\ConfigurationProviderTestBase.cs"
Link="Microsoft.Extensions.Configuration\tests\ConfigurationProviderTestBase.cs" />
<Compile Include="$(LibrariesProjectRoot)Microsoft.Extensions.Configuration\tests\Common\ConfigurationProviderExtensions.cs"
Link="Microsoft.Extensions.Configuration\tests\Common\ConfigurationProviderExtensions.cs" />
<Compile Include="$(LibrariesProjectRoot)Microsoft.Extensions.Configuration\tests\Common\TestStreamHelpers.cs"
Link="Microsoft.Extensions.Configuration\tests\Common\TestStreamHelpers.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Configuration.Binder\src\Microsoft.Extensions.Configuration.Binder.csproj" />
<ProjectReference Include="..\src\Microsoft.Extensions.Configuration.Xml.csproj" SkipUseReferenceAssembly="true" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Reference Include="System.Security" />
<!-- Manually reference the transitive dependency to make NuGet pick the package over the transitive project: https://github.com/NuGet/Home/issues/10368 -->
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsVersion)" PrivateAssets="all" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Threading.RateLimiting/src/System/Threading/RateLimiting/TokenBucketRateLimiterOptions.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Threading.RateLimiting
{
/// <summary>
/// Options to control the behavior of a <see cref="TokenBucketRateLimiter"/>.
/// </summary>
public sealed class TokenBucketRateLimiterOptions
{
/// <summary>
/// Initializes the <see cref="TokenBucketRateLimiterOptions"/>.
/// </summary>
/// <param name="tokenLimit">Maximum number of tokens that can be in the token bucket.</param>
/// <param name="queueProcessingOrder"></param>
/// <param name="queueLimit">Maximum number of unprocessed tokens waiting via <see cref="RateLimiter.WaitAsync(int, CancellationToken)"/>.</param>
/// <param name="replenishmentPeriod">
/// Specifies how often tokens can be replenished. Replenishing is triggered either by an internal timer if <paramref name="autoReplenishment"/> is true, or by calling <see cref="TokenBucketRateLimiter.TryReplenish"/>.
/// </param>
/// <param name="tokensPerPeriod">Specified how many tokens can be added to the token bucket on a successful replenish. Available token count will not exceed <paramref name="tokenLimit"/>.</param>
/// <param name="autoReplenishment">
/// Specifies whether token replenishment will be handled by the <see cref="TokenBucketRateLimiter"/> or by another party via <see cref="TokenBucketRateLimiter.TryReplenish"/>.
/// </param>
/// <exception cref="ArgumentOutOfRangeException">When <paramref name="tokenLimit"/>, <paramref name="queueLimit"/>, or <paramref name="tokensPerPeriod"/> are less than 0.</exception>
public TokenBucketRateLimiterOptions(
int tokenLimit,
QueueProcessingOrder queueProcessingOrder,
int queueLimit,
TimeSpan replenishmentPeriod,
int tokensPerPeriod,
bool autoReplenishment = true)
{
if (tokenLimit < 0)
{
throw new ArgumentOutOfRangeException(nameof(tokenLimit));
}
if (queueLimit < 0)
{
throw new ArgumentOutOfRangeException(nameof(queueLimit));
}
if (tokensPerPeriod <= 0)
{
throw new ArgumentOutOfRangeException(nameof(tokensPerPeriod));
}
TokenLimit = tokenLimit;
QueueProcessingOrder = queueProcessingOrder;
QueueLimit = queueLimit;
ReplenishmentPeriod = replenishmentPeriod;
TokensPerPeriod = tokensPerPeriod;
AutoReplenishment = autoReplenishment;
}
/// <summary>
/// Specifies the minimum period between replenishments.
/// </summary>
public TimeSpan ReplenishmentPeriod { get; }
/// <summary>
/// Specifies the maximum number of tokens to restore each replenishment.
/// </summary>
public int TokensPerPeriod { get; }
/// <summary>
/// Specified whether the <see cref="TokenBucketRateLimiter"/> is automatically replenishing tokens or if someone else
/// will be calling <see cref="TokenBucketRateLimiter.TryReplenish"/> to replenish tokens.
/// </summary>
public bool AutoReplenishment { get; }
/// <summary>
/// Maximum number of tokens that can be in the bucket at any time.
/// </summary>
public int TokenLimit { get; }
/// <summary>
/// Determines the behaviour of <see cref="RateLimiter.WaitAsync"/> when not enough resources can be leased.
/// </summary>
/// <value>
/// <see cref="QueueProcessingOrder.OldestFirst"/> by default.
/// </value>
public QueueProcessingOrder QueueProcessingOrder { get; }
/// <summary>
/// Maximum cumulative token count of queued acquisition requests.
/// </summary>
public int QueueLimit { get; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Threading.RateLimiting
{
/// <summary>
/// Options to control the behavior of a <see cref="TokenBucketRateLimiter"/>.
/// </summary>
public sealed class TokenBucketRateLimiterOptions
{
/// <summary>
/// Initializes the <see cref="TokenBucketRateLimiterOptions"/>.
/// </summary>
/// <param name="tokenLimit">Maximum number of tokens that can be in the token bucket.</param>
/// <param name="queueProcessingOrder"></param>
/// <param name="queueLimit">Maximum number of unprocessed tokens waiting via <see cref="RateLimiter.WaitAsync(int, CancellationToken)"/>.</param>
/// <param name="replenishmentPeriod">
/// Specifies how often tokens can be replenished. Replenishing is triggered either by an internal timer if <paramref name="autoReplenishment"/> is true, or by calling <see cref="TokenBucketRateLimiter.TryReplenish"/>.
/// </param>
/// <param name="tokensPerPeriod">Specified how many tokens can be added to the token bucket on a successful replenish. Available token count will not exceed <paramref name="tokenLimit"/>.</param>
/// <param name="autoReplenishment">
/// Specifies whether token replenishment will be handled by the <see cref="TokenBucketRateLimiter"/> or by another party via <see cref="TokenBucketRateLimiter.TryReplenish"/>.
/// </param>
/// <exception cref="ArgumentOutOfRangeException">When <paramref name="tokenLimit"/>, <paramref name="queueLimit"/>, or <paramref name="tokensPerPeriod"/> are less than 0.</exception>
public TokenBucketRateLimiterOptions(
int tokenLimit,
QueueProcessingOrder queueProcessingOrder,
int queueLimit,
TimeSpan replenishmentPeriod,
int tokensPerPeriod,
bool autoReplenishment = true)
{
if (tokenLimit < 0)
{
throw new ArgumentOutOfRangeException(nameof(tokenLimit));
}
if (queueLimit < 0)
{
throw new ArgumentOutOfRangeException(nameof(queueLimit));
}
if (tokensPerPeriod <= 0)
{
throw new ArgumentOutOfRangeException(nameof(tokensPerPeriod));
}
TokenLimit = tokenLimit;
QueueProcessingOrder = queueProcessingOrder;
QueueLimit = queueLimit;
ReplenishmentPeriod = replenishmentPeriod;
TokensPerPeriod = tokensPerPeriod;
AutoReplenishment = autoReplenishment;
}
/// <summary>
/// Specifies the minimum period between replenishments.
/// </summary>
public TimeSpan ReplenishmentPeriod { get; }
/// <summary>
/// Specifies the maximum number of tokens to restore each replenishment.
/// </summary>
public int TokensPerPeriod { get; }
/// <summary>
/// Specified whether the <see cref="TokenBucketRateLimiter"/> is automatically replenishing tokens or if someone else
/// will be calling <see cref="TokenBucketRateLimiter.TryReplenish"/> to replenish tokens.
/// </summary>
public bool AutoReplenishment { get; }
/// <summary>
/// Maximum number of tokens that can be in the bucket at any time.
/// </summary>
public int TokenLimit { get; }
/// <summary>
/// Determines the behaviour of <see cref="RateLimiter.WaitAsync"/> when not enough resources can be leased.
/// </summary>
/// <value>
/// <see cref="QueueProcessingOrder.OldestFirst"/> by default.
/// </value>
public QueueProcessingOrder QueueProcessingOrder { get; }
/// <summary>
/// Maximum cumulative token count of queued acquisition requests.
/// </summary>
public int QueueLimit { get; }
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/ShiftArithmeticSaturateScalar.Vector64.Int32.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void ShiftArithmeticSaturateScalar_Vector64_Int32()
{
var test = new SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Int32[] inArray1, Int32[] inArray2, Int32[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int32, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Int32> _fld1;
public Vector64<Int32> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
return testStruct;
}
public void RunStructFldScenario(SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32 testClass)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(_fld1, _fld2);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32 testClass)
{
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector64<Int32>* pFld2 = &_fld2)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((Int32*)(pFld2))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
private static Vector64<Int32> _clsVar1;
private static Vector64<Int32> _clsVar2;
private Vector64<Int32> _fld1;
private Vector64<Int32> _fld2;
private DataTable _dataTable;
static SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
}
public SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); }
_dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray2Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ShiftArithmeticSaturateScalar), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int32>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ShiftArithmeticSaturateScalar), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int32>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray2Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
_clsVar1,
_clsVar2
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<Int32>* pClsVar1 = &_clsVar1)
fixed (Vector64<Int32>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pClsVar1)),
AdvSimd.LoadVector64((Int32*)(pClsVar2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr);
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray2Ptr));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32();
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32();
fixed (Vector64<Int32>* pFld1 = &test._fld1)
fixed (Vector64<Int32>* pFld2 = &test._fld2)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((Int32*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(_fld1, _fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector64<Int32>* pFld2 = &_fld2)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((Int32*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(&test._fld1)),
AdvSimd.LoadVector64((Int32*)(&test._fld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<Int32> op1, Vector64<Int32> op2, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), op2);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] left, Int32[] right, Int32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.ShiftArithmeticSaturate(left[0], right[0]) != result[0])
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.ShiftArithmeticSaturateScalar)}<Int32>(Vector64<Int32>, Vector64<Int32>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void ShiftArithmeticSaturateScalar_Vector64_Int32()
{
var test = new SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Int32[] inArray1, Int32[] inArray2, Int32[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int32, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Int32> _fld1;
public Vector64<Int32> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
return testStruct;
}
public void RunStructFldScenario(SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32 testClass)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(_fld1, _fld2);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32 testClass)
{
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector64<Int32>* pFld2 = &_fld2)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((Int32*)(pFld2))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int32[] _data2 = new Int32[Op2ElementCount];
private static Vector64<Int32> _clsVar1;
private static Vector64<Int32> _clsVar2;
private Vector64<Int32> _fld1;
private Vector64<Int32> _fld2;
private DataTable _dataTable;
static SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
}
public SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); }
_dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray2Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ShiftArithmeticSaturateScalar), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int32>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ShiftArithmeticSaturateScalar), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int32>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray2Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
_clsVar1,
_clsVar2
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<Int32>* pClsVar1 = &_clsVar1)
fixed (Vector64<Int32>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pClsVar1)),
AdvSimd.LoadVector64((Int32*)(pClsVar2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr);
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray2Ptr));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32();
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleBinaryOpTest__ShiftArithmeticSaturateScalar_Vector64_Int32();
fixed (Vector64<Int32>* pFld1 = &test._fld1)
fixed (Vector64<Int32>* pFld2 = &test._fld2)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((Int32*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(_fld1, _fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector64<Int32>* pFld2 = &_fld2)
{
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((Int32*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.ShiftArithmeticSaturateScalar(
AdvSimd.LoadVector64((Int32*)(&test._fld1)),
AdvSimd.LoadVector64((Int32*)(&test._fld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<Int32> op1, Vector64<Int32> op2, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), op2);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] inArray2 = new Int32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] left, Int32[] right, Int32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.ShiftArithmeticSaturate(left[0], right[0]) != result[0])
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.ShiftArithmeticSaturateScalar)}<Int32>(Vector64<Int32>, Vector64<Int32>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/vm/mngstdinterfaces.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================
**
** Header: MngStdInterfaceMap.h
**
**
** Purpose: Contains types and method signatures for the Com wrapper class
**
**
===========================================================*/
#ifndef _MNGSTDINTERFACEMAP_H
#define _MNGSTDINTERFACEMAP_H
#ifndef FEATURE_COMINTEROP
#error FEATURE_COMINTEROP is required for this file
#endif // FEATURE_COMINTEROP
#include "vars.hpp"
#include "eehash.h"
#include "class.h"
#include "mlinfo.h"
#ifndef DACCESS_COMPILE
//
// This class is used to establish a mapping between a managed standard interface and its
// unmanaged counterpart.
//
class MngStdInterfaceMap
{
public:
// This method retrieves the native IID of the interface that the specified
// managed type is a standard interface for. If the specified type is not
// a standard interface then GUIDNULL is returned.
inline static IID* GetNativeIIDForType(TypeHandle th)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END
// Only simple class types can have native IIDs
if (th.IsTypeDesc() || th.IsArray())
return NULL;
HashDatum Data;
// Retrieve the name of the type.
LPCUTF8 ns, name;
LPUTF8 strTypeName;
name = th.GetMethodTable()->GetFullyQualifiedNameInfo(&ns);
MAKE_FULL_PATH_ON_STACK_UTF8(strTypeName, ns, name);
if (m_pMngStdItfMap == NULL) {
MngStdInterfaceMap *tmp = new MngStdInterfaceMap;
if (FastInterlockCompareExchangePointer(&m_pMngStdItfMap, tmp, NULL) != NULL) {
tmp->m_TypeNameToNativeIIDMap.ClearHashTable();
delete tmp;
}
}
if (m_pMngStdItfMap->m_TypeNameToNativeIIDMap.GetValue(strTypeName, &Data) && (*((GUID*)Data) != GUID_NULL))
{
// The type is a standard interface.
return (IID*)Data;
}
else
{
// The type is not a standard interface.
return NULL;
}
}
private:
// Disalow creation of this class by anybody outside of it.
MngStdInterfaceMap();
// The map of type names to native IID's.
EEUtf8StringHashTable m_TypeNameToNativeIIDMap;
// The one and only instance of the managed std interface map.
static MngStdInterfaceMap *m_pMngStdItfMap;
};
#endif // DACCESS_COMPILE
//
// Base class for all the classes that contain the ECall's for the managed standard interfaces.
//
class MngStdItfBase
{
protected:
static void InitHelper(
LPCUTF8 strMngItfTypeName,
LPCUTF8 strUComItfTypeName,
LPCUTF8 strCMTypeName,
LPCUTF8 strCookie,
LPCUTF8 strManagedViewName,
TypeHandle *pMngItfType,
TypeHandle *pUComItfType,
TypeHandle *pCustomMarshalerType,
TypeHandle *pManagedViewType,
OBJECTHANDLE *phndMarshaler);
static LPVOID ForwardCallToManagedView(
OBJECTHANDLE hndMarshaler,
MethodDesc *pMngItfMD,
MethodDesc *pUComItfMD,
MethodDesc *pMarshalNativeToManagedMD,
MethodDesc *pMngViewMD,
IID *pMngItfIID,
IID *pNativeItfIID,
ARG_SLOT* pArgs);
};
//
// Define the enum of methods on the managed standard interface.
//
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
enum FriendlyName##Methods \
{ \
FriendlyName##Methods_Dummy = -1,
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl) \
FriendlyName##Methods_##ECallMethName,
#define MNGSTDITF_END_INTERFACE(FriendlyName) \
FriendlyName##Methods_LastMember \
}; \
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
//
// Define the class that implements the ECall's for the managed standard interface.
//
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
class FriendlyName : public MngStdItfBase \
{ \
public: \
FriendlyName() \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
InitHelper(strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, &m_MngItfType, &m_UComItfType, &m_CustomMarshalerType, &m_ManagedViewType, &m_hndCustomMarshaler); \
m_NativeItfIID = NativeItfIID; \
m_UComItfType.GetMethodTable()->GetGuid(&m_MngItfIID, TRUE); \
memset(m_apCustomMarshalerMD, 0, CustomMarshalerMethods_LastMember * sizeof(MethodDesc *)); \
memset(m_apManagedViewMD, 0, FriendlyName##Methods_LastMember * sizeof(MethodDesc *)); \
memset(m_apUComItfMD, 0, FriendlyName##Methods_LastMember * sizeof(MethodDesc *)); \
memset(m_apMngItfMD, 0, FriendlyName##Methods_LastMember * sizeof(MethodDesc *)); \
} \
\
OBJECTREF GetCustomMarshaler() \
{ \
WRAPPER_NO_CONTRACT; \
return ObjectFromHandle(m_hndCustomMarshaler); \
} \
\
MethodDesc* GetCustomMarshalerMD(EnumCustomMarshalerMethods Method) \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
MethodDesc *pMD = NULL; \
\
if (m_apCustomMarshalerMD[Method]) \
return m_apCustomMarshalerMD[Method]; \
\
pMD = CustomMarshalerInfo::GetCustomMarshalerMD(Method, m_CustomMarshalerType); \
_ASSERTE(pMD && "Unable to find specified method on the custom marshaler"); \
MetaSig::EnsureSigValueTypesLoaded(pMD); \
\
m_apCustomMarshalerMD[Method] = pMD; \
return pMD; \
} \
\
MethodDesc* GetManagedViewMD(FriendlyName##Methods Method, LPCUTF8 strMethName, LPHARDCODEDMETASIG pSig) \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
MethodDesc *pMD = NULL; \
\
if (m_apManagedViewMD[Method]) \
return m_apManagedViewMD[Method]; \
\
pMD = MemberLoader::FindMethod(m_ManagedViewType.GetMethodTable(), strMethName, pSig); \
_ASSERTE(pMD && "Unable to find specified method on the managed view"); \
MetaSig::EnsureSigValueTypesLoaded(pMD); \
\
m_apManagedViewMD[Method] = pMD; \
return pMD; \
} \
\
MethodDesc* GetUComItfMD(FriendlyName##Methods Method, LPCUTF8 strMethName, LPHARDCODEDMETASIG pSig) \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
MethodDesc *pMD = NULL; \
\
if (m_apUComItfMD[Method]) \
return m_apUComItfMD[Method]; \
\
pMD = MemberLoader::FindMethod(m_UComItfType.GetMethodTable(), strMethName, pSig); \
_ASSERTE(pMD && "Unable to find specified method in UCom interface"); \
MetaSig::EnsureSigValueTypesLoaded(pMD); \
\
m_apUComItfMD[Method] = pMD; \
return pMD; \
} \
\
MethodDesc* GetMngItfMD(FriendlyName##Methods Method, LPCUTF8 strMethName, LPHARDCODEDMETASIG pSig) \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
MethodDesc *pMD = NULL; \
\
if (m_apMngItfMD[Method]) \
return m_apMngItfMD[Method]; \
\
pMD = MemberLoader::FindMethod(m_MngItfType.GetMethodTable(), strMethName, pSig); \
_ASSERTE(pMD && "Unable to find specified method in UCom interface"); \
MetaSig::EnsureSigValueTypesLoaded(pMD); \
\
m_apMngItfMD[Method] = pMD; \
return pMD; \
} \
\
private: \
MethodDesc* m_apCustomMarshalerMD[CustomMarshalerMethods_LastMember]; \
MethodDesc* m_apManagedViewMD[FriendlyName##Methods_LastMember]; \
MethodDesc* m_apUComItfMD[FriendlyName##Methods_LastMember]; \
MethodDesc* m_apMngItfMD[FriendlyName##Methods_LastMember]; \
TypeHandle m_CustomMarshalerType; \
TypeHandle m_ManagedViewType; \
TypeHandle m_UComItfType; \
TypeHandle m_MngItfType; \
OBJECTHANDLE m_hndCustomMarshaler; \
GUID m_MngItfIID; \
GUID m_NativeItfIID; \
\
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl) \
\
public: static LPVOID __stdcall ECallMethName##Worker(ARG_SLOT* pArgs); \
public: static FcallDecl; \
\
#define MNGSTDITF_END_INTERFACE(FriendlyName) \
}; \
\
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
//
// App domain level information on the managed standard interfaces .
//
class MngStdInterfacesInfo
{
public:
// Constructor and destructor.
MngStdInterfacesInfo()
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_FAULT;
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
m_p##FriendlyName = 0; \
\
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl)
#define MNGSTDITF_END_INTERFACE(FriendlyName)
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
}
~MngStdInterfacesInfo()
{
WRAPPER_NO_CONTRACT;
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
if (m_p##FriendlyName) \
delete m_p##FriendlyName; \
\
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl)
#define MNGSTDITF_END_INTERFACE(FriendlyName)
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
}
// Accessors for each of the managed standard interfaces.
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
public: \
FriendlyName *Get##FriendlyName() \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
if (!m_p##FriendlyName) \
{ \
NewHolder<FriendlyName> pFriendlyName = new FriendlyName(); \
if (InterlockedCompareExchangeT(&m_p##FriendlyName, pFriendlyName.GetValue(), NULL) == NULL) \
pFriendlyName.SuppressRelease(); \
} \
return m_p##FriendlyName; \
} \
\
private: \
FriendlyName *m_p##FriendlyName; \
\
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl)
#define MNGSTDITF_END_INTERFACE(FriendlyName)
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
};
#endif // _MNGSTDINTERFACEMAP_H
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*============================================================
**
** Header: MngStdInterfaceMap.h
**
**
** Purpose: Contains types and method signatures for the Com wrapper class
**
**
===========================================================*/
#ifndef _MNGSTDINTERFACEMAP_H
#define _MNGSTDINTERFACEMAP_H
#ifndef FEATURE_COMINTEROP
#error FEATURE_COMINTEROP is required for this file
#endif // FEATURE_COMINTEROP
#include "vars.hpp"
#include "eehash.h"
#include "class.h"
#include "mlinfo.h"
#ifndef DACCESS_COMPILE
//
// This class is used to establish a mapping between a managed standard interface and its
// unmanaged counterpart.
//
class MngStdInterfaceMap
{
public:
// This method retrieves the native IID of the interface that the specified
// managed type is a standard interface for. If the specified type is not
// a standard interface then GUIDNULL is returned.
inline static IID* GetNativeIIDForType(TypeHandle th)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END
// Only simple class types can have native IIDs
if (th.IsTypeDesc() || th.IsArray())
return NULL;
HashDatum Data;
// Retrieve the name of the type.
LPCUTF8 ns, name;
LPUTF8 strTypeName;
name = th.GetMethodTable()->GetFullyQualifiedNameInfo(&ns);
MAKE_FULL_PATH_ON_STACK_UTF8(strTypeName, ns, name);
if (m_pMngStdItfMap == NULL) {
MngStdInterfaceMap *tmp = new MngStdInterfaceMap;
if (FastInterlockCompareExchangePointer(&m_pMngStdItfMap, tmp, NULL) != NULL) {
tmp->m_TypeNameToNativeIIDMap.ClearHashTable();
delete tmp;
}
}
if (m_pMngStdItfMap->m_TypeNameToNativeIIDMap.GetValue(strTypeName, &Data) && (*((GUID*)Data) != GUID_NULL))
{
// The type is a standard interface.
return (IID*)Data;
}
else
{
// The type is not a standard interface.
return NULL;
}
}
private:
// Disalow creation of this class by anybody outside of it.
MngStdInterfaceMap();
// The map of type names to native IID's.
EEUtf8StringHashTable m_TypeNameToNativeIIDMap;
// The one and only instance of the managed std interface map.
static MngStdInterfaceMap *m_pMngStdItfMap;
};
#endif // DACCESS_COMPILE
//
// Base class for all the classes that contain the ECall's for the managed standard interfaces.
//
class MngStdItfBase
{
protected:
static void InitHelper(
LPCUTF8 strMngItfTypeName,
LPCUTF8 strUComItfTypeName,
LPCUTF8 strCMTypeName,
LPCUTF8 strCookie,
LPCUTF8 strManagedViewName,
TypeHandle *pMngItfType,
TypeHandle *pUComItfType,
TypeHandle *pCustomMarshalerType,
TypeHandle *pManagedViewType,
OBJECTHANDLE *phndMarshaler);
static LPVOID ForwardCallToManagedView(
OBJECTHANDLE hndMarshaler,
MethodDesc *pMngItfMD,
MethodDesc *pUComItfMD,
MethodDesc *pMarshalNativeToManagedMD,
MethodDesc *pMngViewMD,
IID *pMngItfIID,
IID *pNativeItfIID,
ARG_SLOT* pArgs);
};
//
// Define the enum of methods on the managed standard interface.
//
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
enum FriendlyName##Methods \
{ \
FriendlyName##Methods_Dummy = -1,
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl) \
FriendlyName##Methods_##ECallMethName,
#define MNGSTDITF_END_INTERFACE(FriendlyName) \
FriendlyName##Methods_LastMember \
}; \
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
//
// Define the class that implements the ECall's for the managed standard interface.
//
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
class FriendlyName : public MngStdItfBase \
{ \
public: \
FriendlyName() \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
InitHelper(strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, &m_MngItfType, &m_UComItfType, &m_CustomMarshalerType, &m_ManagedViewType, &m_hndCustomMarshaler); \
m_NativeItfIID = NativeItfIID; \
m_UComItfType.GetMethodTable()->GetGuid(&m_MngItfIID, TRUE); \
memset(m_apCustomMarshalerMD, 0, CustomMarshalerMethods_LastMember * sizeof(MethodDesc *)); \
memset(m_apManagedViewMD, 0, FriendlyName##Methods_LastMember * sizeof(MethodDesc *)); \
memset(m_apUComItfMD, 0, FriendlyName##Methods_LastMember * sizeof(MethodDesc *)); \
memset(m_apMngItfMD, 0, FriendlyName##Methods_LastMember * sizeof(MethodDesc *)); \
} \
\
OBJECTREF GetCustomMarshaler() \
{ \
WRAPPER_NO_CONTRACT; \
return ObjectFromHandle(m_hndCustomMarshaler); \
} \
\
MethodDesc* GetCustomMarshalerMD(EnumCustomMarshalerMethods Method) \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
MethodDesc *pMD = NULL; \
\
if (m_apCustomMarshalerMD[Method]) \
return m_apCustomMarshalerMD[Method]; \
\
pMD = CustomMarshalerInfo::GetCustomMarshalerMD(Method, m_CustomMarshalerType); \
_ASSERTE(pMD && "Unable to find specified method on the custom marshaler"); \
MetaSig::EnsureSigValueTypesLoaded(pMD); \
\
m_apCustomMarshalerMD[Method] = pMD; \
return pMD; \
} \
\
MethodDesc* GetManagedViewMD(FriendlyName##Methods Method, LPCUTF8 strMethName, LPHARDCODEDMETASIG pSig) \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
MethodDesc *pMD = NULL; \
\
if (m_apManagedViewMD[Method]) \
return m_apManagedViewMD[Method]; \
\
pMD = MemberLoader::FindMethod(m_ManagedViewType.GetMethodTable(), strMethName, pSig); \
_ASSERTE(pMD && "Unable to find specified method on the managed view"); \
MetaSig::EnsureSigValueTypesLoaded(pMD); \
\
m_apManagedViewMD[Method] = pMD; \
return pMD; \
} \
\
MethodDesc* GetUComItfMD(FriendlyName##Methods Method, LPCUTF8 strMethName, LPHARDCODEDMETASIG pSig) \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
MethodDesc *pMD = NULL; \
\
if (m_apUComItfMD[Method]) \
return m_apUComItfMD[Method]; \
\
pMD = MemberLoader::FindMethod(m_UComItfType.GetMethodTable(), strMethName, pSig); \
_ASSERTE(pMD && "Unable to find specified method in UCom interface"); \
MetaSig::EnsureSigValueTypesLoaded(pMD); \
\
m_apUComItfMD[Method] = pMD; \
return pMD; \
} \
\
MethodDesc* GetMngItfMD(FriendlyName##Methods Method, LPCUTF8 strMethName, LPHARDCODEDMETASIG pSig) \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
MethodDesc *pMD = NULL; \
\
if (m_apMngItfMD[Method]) \
return m_apMngItfMD[Method]; \
\
pMD = MemberLoader::FindMethod(m_MngItfType.GetMethodTable(), strMethName, pSig); \
_ASSERTE(pMD && "Unable to find specified method in UCom interface"); \
MetaSig::EnsureSigValueTypesLoaded(pMD); \
\
m_apMngItfMD[Method] = pMD; \
return pMD; \
} \
\
private: \
MethodDesc* m_apCustomMarshalerMD[CustomMarshalerMethods_LastMember]; \
MethodDesc* m_apManagedViewMD[FriendlyName##Methods_LastMember]; \
MethodDesc* m_apUComItfMD[FriendlyName##Methods_LastMember]; \
MethodDesc* m_apMngItfMD[FriendlyName##Methods_LastMember]; \
TypeHandle m_CustomMarshalerType; \
TypeHandle m_ManagedViewType; \
TypeHandle m_UComItfType; \
TypeHandle m_MngItfType; \
OBJECTHANDLE m_hndCustomMarshaler; \
GUID m_MngItfIID; \
GUID m_NativeItfIID; \
\
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl) \
\
public: static LPVOID __stdcall ECallMethName##Worker(ARG_SLOT* pArgs); \
public: static FcallDecl; \
\
#define MNGSTDITF_END_INTERFACE(FriendlyName) \
}; \
\
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
//
// App domain level information on the managed standard interfaces .
//
class MngStdInterfacesInfo
{
public:
// Constructor and destructor.
MngStdInterfacesInfo()
{
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_FAULT;
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
m_p##FriendlyName = 0; \
\
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl)
#define MNGSTDITF_END_INTERFACE(FriendlyName)
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
}
~MngStdInterfacesInfo()
{
WRAPPER_NO_CONTRACT;
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
if (m_p##FriendlyName) \
delete m_p##FriendlyName; \
\
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl)
#define MNGSTDITF_END_INTERFACE(FriendlyName)
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
}
// Accessors for each of the managed standard interfaces.
#define MNGSTDITF_BEGIN_INTERFACE(FriendlyName, strMngItfName, strUCOMMngItfName, strCustomMarshalerName, strCustomMarshalerCookie, strManagedViewName, NativeItfIID, bCanCastOnNativeItfQI) \
\
public: \
FriendlyName *Get##FriendlyName() \
{ \
CONTRACTL \
{ \
THROWS; \
GC_TRIGGERS; \
INJECT_FAULT(COMPlusThrowOM()); \
} \
CONTRACTL_END \
if (!m_p##FriendlyName) \
{ \
NewHolder<FriendlyName> pFriendlyName = new FriendlyName(); \
if (InterlockedCompareExchangeT(&m_p##FriendlyName, pFriendlyName.GetValue(), NULL) == NULL) \
pFriendlyName.SuppressRelease(); \
} \
return m_p##FriendlyName; \
} \
\
private: \
FriendlyName *m_p##FriendlyName; \
\
#define MNGSTDITF_DEFINE_METH_IMPL(FriendlyName, ECallMethName, MethName, MethSig, FcallDecl)
#define MNGSTDITF_END_INTERFACE(FriendlyName)
#include "mngstditflist.h"
#undef MNGSTDITF_BEGIN_INTERFACE
#undef MNGSTDITF_DEFINE_METH_IMPL
#undef MNGSTDITF_END_INTERFACE
};
#endif // _MNGSTDINTERFACEMAP_H
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/Loader/classloader/TypeGeneratorTests/TypeGeneratorTest468/Generated468.ilproj
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="Generated468.il" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TestFramework\TestFramework.csproj" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="Generated468.il" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TestFramework\TestFramework.csproj" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/Regressions/coreclr/0416/hello.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="hello.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="hello.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Private.CoreLib/src/System/Environment.Linux.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
namespace System
{
public static partial class Environment
{
public static long WorkingSet => (long)(Interop.procfs.TryReadStatusFile(ProcessId, out Interop.procfs.ParsedStatus status) ? status.VmRSS : 0);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
namespace System
{
public static partial class Environment
{
public static long WorkingSet => (long)(Interop.procfs.TryReadStatusFile(ProcessId, out Interop.procfs.ParsedStatus status) ? status.VmRSS : 0);
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/jit/emit.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XX
XX emit.cpp XX
XX XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/
#include "jitpch.h"
#ifdef _MSC_VER
#pragma hdrstop
#endif
#include "hostallocator.h"
#include "instr.h"
#include "emit.h"
#include "codegen.h"
/*****************************************************************************
*
* Represent an emitter location.
*/
void emitLocation::CaptureLocation(emitter* emit)
{
ig = emit->emitCurIG;
codePos = emit->emitCurOffset();
assert(Valid());
}
bool emitLocation::IsCurrentLocation(emitter* emit) const
{
assert(Valid());
return (ig == emit->emitCurIG) && (codePos == emit->emitCurOffset());
}
UNATIVE_OFFSET emitLocation::CodeOffset(emitter* emit) const
{
assert(Valid());
return emit->emitCodeOffset(ig, codePos);
}
int emitLocation::GetInsNum() const
{
return emitGetInsNumFromCodePos(codePos);
}
// Get the instruction offset in the current instruction group, which must be a funclet prolog group.
// This is used to find an instruction offset used in unwind data.
// TODO-AMD64-Bug?: We only support a single main function prolog group, but allow for multiple funclet prolog
// groups (not that we actually use that flexibility, since the funclet prolog will be small). How to
// handle that?
UNATIVE_OFFSET emitLocation::GetFuncletPrologOffset(emitter* emit) const
{
assert(ig->igFuncIdx != 0);
assert((ig->igFlags & IGF_FUNCLET_PROLOG) != 0);
assert(ig == emit->emitCurIG);
return emit->emitCurIGsize;
}
//------------------------------------------------------------------------
// IsPreviousInsNum: Returns true if the emitter is on the next instruction
// of the same group as this emitLocation.
//
// Arguments:
// emit - an emitter* instance
//
bool emitLocation::IsPreviousInsNum(emitter* emit) const
{
assert(Valid());
// Within the same IG?
if (ig == emit->emitCurIG)
{
return (emitGetInsNumFromCodePos(codePos) == emitGetInsNumFromCodePos(emit->emitCurOffset()) - 1);
}
// Spanning an IG boundary?
if (ig->igNext == emit->emitCurIG)
{
return (emitGetInsNumFromCodePos(codePos) == ig->igInsCnt) && (emit->emitCurIGinsCnt == 1);
}
return false;
}
#ifdef DEBUG
void emitLocation::Print(LONG compMethodID) const
{
unsigned insNum = emitGetInsNumFromCodePos(codePos);
unsigned insOfs = emitGetInsOfsFromCodePos(codePos);
printf("(G_M%03u_IG%02u,ins#%d,ofs#%d)", compMethodID, ig->igNum, insNum, insOfs);
}
#endif // DEBUG
/*****************************************************************************
*
* Return the name of an instruction format.
*/
#if defined(DEBUG) || EMITTER_STATS
const char* emitter::emitIfName(unsigned f)
{
static const char* const ifNames[] = {
#define IF_DEF(en, op1, op2) "IF_" #en,
#include "emitfmts.h"
};
static char errBuff[32];
if (f < ArrLen(ifNames))
{
return ifNames[f];
}
sprintf_s(errBuff, sizeof(errBuff), "??%u??", f);
return errBuff;
}
#endif
/*****************************************************************************/
#if EMITTER_STATS
static unsigned totAllocdSize;
static unsigned totActualSize;
unsigned emitter::emitIFcounts[emitter::IF_COUNT];
static unsigned emitSizeBuckets[] = {100, 1024 * 1, 1024 * 2, 1024 * 3, 1024 * 4, 1024 * 5, 1024 * 10, 0};
static Histogram emitSizeTable(emitSizeBuckets);
static unsigned GCrefsBuckets[] = {0, 1, 2, 5, 10, 20, 50, 128, 256, 512, 1024, 0};
static Histogram GCrefsTable(GCrefsBuckets);
static unsigned stkDepthBuckets[] = {0, 1, 2, 5, 10, 16, 32, 128, 1024, 0};
static Histogram stkDepthTable(stkDepthBuckets);
size_t emitter::emitSizeMethod;
size_t emitter::emitTotMemAlloc;
unsigned emitter::emitTotalInsCnt;
unsigned emitter::emitCurPrologInsCnt;
size_t emitter::emitCurPrologIGSize;
unsigned emitter::emitMaxPrologInsCnt;
size_t emitter::emitMaxPrologIGSize;
unsigned emitter::emitTotalIGcnt;
unsigned emitter::emitTotalPhIGcnt;
unsigned emitter::emitTotalIGjmps;
unsigned emitter::emitTotalIGptrs;
unsigned emitter::emitTotalIGicnt;
size_t emitter::emitTotalIGsize;
unsigned emitter::emitTotalIGmcnt;
unsigned emitter::emitTotalIGExtend;
unsigned emitter::emitTotalIDescSmallCnt;
unsigned emitter::emitTotalIDescCnt;
unsigned emitter::emitTotalIDescJmpCnt;
#if !defined(TARGET_ARM64)
unsigned emitter::emitTotalIDescLblCnt;
#endif // !defined(TARGET_ARM64)
unsigned emitter::emitTotalIDescCnsCnt;
unsigned emitter::emitTotalIDescDspCnt;
unsigned emitter::emitTotalIDescCnsDspCnt;
#ifdef TARGET_XARCH
unsigned emitter::emitTotalIDescAmdCnt;
unsigned emitter::emitTotalIDescCnsAmdCnt;
#endif // TARGET_XARCH
unsigned emitter::emitTotalIDescCGCACnt;
#ifdef TARGET_ARM
unsigned emitter::emitTotalIDescRelocCnt;
#endif // TARGET_ARM
unsigned emitter::emitSmallDspCnt;
unsigned emitter::emitLargeDspCnt;
unsigned emitter::emitSmallCnsCnt;
unsigned emitter::emitLargeCnsCnt;
unsigned emitter::emitSmallCns[SMALL_CNS_TSZ];
unsigned emitter::emitTotalDescAlignCnt;
void emitterStaticStats(FILE* fout)
{
// insGroup members
insGroup* igDummy = nullptr;
fprintf(fout, "\n");
fprintf(fout, "insGroup:\n");
fprintf(fout, "Offset / size of igNext = %2zu / %2zu\n", offsetof(insGroup, igNext),
sizeof(igDummy->igNext));
#ifdef DEBUG
fprintf(fout, "Offset / size of igSelf = %2zu / %2zu\n", offsetof(insGroup, igSelf),
sizeof(igDummy->igSelf));
#endif
fprintf(fout, "Offset / size of igNum = %2zu / %2zu\n", offsetof(insGroup, igNum),
sizeof(igDummy->igNum));
fprintf(fout, "Offset / size of igOffs = %2zu / %2zu\n", offsetof(insGroup, igOffs),
sizeof(igDummy->igOffs));
fprintf(fout, "Offset / size of igFuncIdx = %2zu / %2zu\n", offsetof(insGroup, igFuncIdx),
sizeof(igDummy->igFuncIdx));
fprintf(fout, "Offset / size of igFlags = %2zu / %2zu\n", offsetof(insGroup, igFlags),
sizeof(igDummy->igFlags));
fprintf(fout, "Offset / size of igSize = %2zu / %2zu\n", offsetof(insGroup, igSize),
sizeof(igDummy->igSize));
fprintf(fout, "Offset / size of igData = %2zu / %2zu\n", offsetof(insGroup, igData),
sizeof(igDummy->igData));
fprintf(fout, "Offset / size of igPhData = %2zu / %2zu\n", offsetof(insGroup, igPhData),
sizeof(igDummy->igPhData));
#if EMIT_TRACK_STACK_DEPTH
fprintf(fout, "Offset / size of igStkLvl = %2zu / %2zu\n", offsetof(insGroup, igStkLvl),
sizeof(igDummy->igStkLvl));
#endif
fprintf(fout, "Offset / size of igGCregs = %2zu / %2zu\n", offsetof(insGroup, igGCregs),
sizeof(igDummy->igGCregs));
fprintf(fout, "Offset / size of igInsCnt = %2zu / %2zu\n", offsetof(insGroup, igInsCnt),
sizeof(igDummy->igInsCnt));
fprintf(fout, "\n");
fprintf(fout, "Size of insGroup = %zu\n", sizeof(insGroup));
// insPlaceholderGroupData members
fprintf(fout, "\n");
fprintf(fout, "insPlaceholderGroupData:\n");
fprintf(fout, "Offset of igPhNext = %2zu\n", offsetof(insPlaceholderGroupData, igPhNext));
fprintf(fout, "Offset of igPhBB = %2zu\n", offsetof(insPlaceholderGroupData, igPhBB));
fprintf(fout, "Offset of igPhInitGCrefVars = %2zu\n", offsetof(insPlaceholderGroupData, igPhInitGCrefVars));
fprintf(fout, "Offset of igPhInitGCrefRegs = %2zu\n", offsetof(insPlaceholderGroupData, igPhInitGCrefRegs));
fprintf(fout, "Offset of igPhInitByrefRegs = %2zu\n", offsetof(insPlaceholderGroupData, igPhInitByrefRegs));
fprintf(fout, "Offset of igPhPrevGCrefVars = %2zu\n", offsetof(insPlaceholderGroupData, igPhPrevGCrefVars));
fprintf(fout, "Offset of igPhPrevGCrefRegs = %2zu\n", offsetof(insPlaceholderGroupData, igPhPrevGCrefRegs));
fprintf(fout, "Offset of igPhPrevByrefRegs = %2zu\n", offsetof(insPlaceholderGroupData, igPhPrevByrefRegs));
fprintf(fout, "Offset of igPhType = %2zu\n", offsetof(insPlaceholderGroupData, igPhType));
fprintf(fout, "Size of insPlaceholderGroupData = %zu\n", sizeof(insPlaceholderGroupData));
fprintf(fout, "\n");
fprintf(fout, "SMALL_IDSC_SIZE = %2u\n", SMALL_IDSC_SIZE);
fprintf(fout, "Size of instrDesc = %2zu\n", sizeof(emitter::instrDesc));
// fprintf(fout, "Offset of _idIns = %2zu\n", offsetof(emitter::instrDesc, _idIns ));
// fprintf(fout, "Offset of _idInsFmt = %2zu\n", offsetof(emitter::instrDesc, _idInsFmt ));
// fprintf(fout, "Offset of _idOpSize = %2zu\n", offsetof(emitter::instrDesc, _idOpSize ));
// fprintf(fout, "Offset of idSmallCns = %2zu\n", offsetof(emitter::instrDesc, idSmallCns ));
// fprintf(fout, "Offset of _idAddrUnion= %2zu\n", offsetof(emitter::instrDesc, _idAddrUnion));
// fprintf(fout, "\n");
// fprintf(fout, "Size of _idAddrUnion= %2zu\n", sizeof(((emitter::instrDesc*)0)->_idAddrUnion));
fprintf(fout, "Size of instrDescJmp = %2zu\n", sizeof(emitter::instrDescJmp));
#if !defined(TARGET_ARM64)
fprintf(fout, "Size of instrDescLbl = %2zu\n", sizeof(emitter::instrDescLbl));
#endif // !defined(TARGET_ARM64)
fprintf(fout, "Size of instrDescCns = %2zu\n", sizeof(emitter::instrDescCns));
fprintf(fout, "Size of instrDescDsp = %2zu\n", sizeof(emitter::instrDescDsp));
fprintf(fout, "Size of instrDescCnsDsp = %2zu\n", sizeof(emitter::instrDescCnsDsp));
#ifdef TARGET_XARCH
fprintf(fout, "Size of instrDescAmd = %2zu\n", sizeof(emitter::instrDescAmd));
fprintf(fout, "Size of instrDescCnsAmd = %2zu\n", sizeof(emitter::instrDescCnsAmd));
#endif // TARGET_XARCH
fprintf(fout, "Size of instrDescCGCA = %2zu\n", sizeof(emitter::instrDescCGCA));
#ifdef TARGET_ARM
fprintf(fout, "Size of instrDescReloc = %2zu\n", sizeof(emitter::instrDescReloc));
#endif // TARGET_ARM
fprintf(fout, "\n");
fprintf(fout, "SC_IG_BUFFER_SIZE = %2zu\n", SC_IG_BUFFER_SIZE);
fprintf(fout, "SMALL_IDSC_SIZE per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / SMALL_IDSC_SIZE);
fprintf(fout, "instrDesc per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDesc));
fprintf(fout, "instrDescJmp per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescJmp));
#if !defined(TARGET_ARM64)
fprintf(fout, "instrDescLbl per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescLbl));
#endif // !defined(TARGET_ARM64)
fprintf(fout, "instrDescCns per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescCns));
fprintf(fout, "instrDescDsp per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescDsp));
fprintf(fout, "instrDescCnsDsp per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescCnsDsp));
#ifdef TARGET_XARCH
fprintf(fout, "instrDescAmd per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescAmd));
fprintf(fout, "instrDescCnsAmd per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescCnsAmd));
#endif // TARGET_XARCH
fprintf(fout, "instrDescCGCA per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescCGCA));
#ifdef TARGET_ARM
fprintf(fout, "instrDescReloc per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescReloc));
#endif // TARGET_ARM
fprintf(fout, "\n");
fprintf(fout, "GCInfo::regPtrDsc:\n");
fprintf(fout, "Offset of rpdNext = %2zu\n", offsetof(GCInfo::regPtrDsc, rpdNext));
fprintf(fout, "Offset of rpdOffs = %2zu\n", offsetof(GCInfo::regPtrDsc, rpdOffs));
fprintf(fout, "Offset of <union> = %2zu\n", offsetof(GCInfo::regPtrDsc, rpdPtrArg));
fprintf(fout, "Size of GCInfo::regPtrDsc = %2zu\n", sizeof(GCInfo::regPtrDsc));
fprintf(fout, "\n");
}
void emitterStats(FILE* fout)
{
if (totAllocdSize > 0)
{
assert(totActualSize <= totAllocdSize);
fprintf(fout, "\nTotal allocated code size = %u\n", totAllocdSize);
if (totActualSize < totAllocdSize)
{
fprintf(fout, "Total generated code size = %u ", totActualSize);
fprintf(fout, "(%4.3f%% waste)", 100 * ((totAllocdSize - totActualSize) / (double)totActualSize));
fprintf(fout, "\n");
}
assert(emitter::emitTotalInsCnt > 0);
fprintf(fout, "Average of %4.2f bytes of code generated per instruction\n",
(double)totActualSize / emitter::emitTotalInsCnt);
}
fprintf(fout, "\nInstruction format frequency table:\n\n");
unsigned f, ic = 0, dc = 0;
for (f = 0; f < emitter::IF_COUNT; f++)
{
ic += emitter::emitIFcounts[f];
}
for (f = 0; f < emitter::IF_COUNT; f++)
{
unsigned c = emitter::emitIFcounts[f];
if ((c > 0) && (1000 * c >= ic))
{
dc += c;
fprintf(fout, " %-14s %8u (%5.2f%%)\n", emitter::emitIfName(f), c, 100.0 * c / ic);
}
}
fprintf(fout, " ---------------------------------\n");
fprintf(fout, " %-14s %8u (%5.2f%%)\n", "Total shown", dc, 100.0 * dc / ic);
if (emitter::emitTotalIGmcnt > 0)
{
fprintf(fout, "\n");
fprintf(fout, "Total of %8u methods\n", emitter::emitTotalIGmcnt);
fprintf(fout, "Total of %8u insGroup\n", emitter::emitTotalIGcnt);
fprintf(fout, "Total of %8u insPlaceholderGroupData\n", emitter::emitTotalPhIGcnt);
fprintf(fout, "Total of %8u extend insGroup\n", emitter::emitTotalIGExtend);
fprintf(fout, "Total of %8u instructions\n", emitter::emitTotalIGicnt);
fprintf(fout, "Total of %8u jumps\n", emitter::emitTotalIGjmps);
fprintf(fout, "Total of %8u GC livesets\n", emitter::emitTotalIGptrs);
fprintf(fout, "\n");
fprintf(fout, "Max prolog instrDesc count: %8u\n", emitter::emitMaxPrologInsCnt);
fprintf(fout, "Max prolog insGroup size : %8zu\n", emitter::emitMaxPrologIGSize);
fprintf(fout, "\n");
fprintf(fout, "Average of %8.1lf insGroup per method\n",
(double)emitter::emitTotalIGcnt / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf insPhGroup per method\n",
(double)emitter::emitTotalPhIGcnt / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf extend IG per method\n",
(double)emitter::emitTotalIGExtend / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf instructions per method\n",
(double)emitter::emitTotalIGicnt / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf desc. bytes per method\n",
(double)emitter::emitTotalIGsize / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf jumps per method\n",
(double)emitter::emitTotalIGjmps / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf GC livesets per method\n",
(double)emitter::emitTotalIGptrs / emitter::emitTotalIGmcnt);
fprintf(fout, "\n");
fprintf(fout, "Average of %8.1lf instructions per group \n",
(double)emitter::emitTotalIGicnt / emitter::emitTotalIGcnt);
fprintf(fout, "Average of %8.1lf desc. bytes per group \n",
(double)emitter::emitTotalIGsize / emitter::emitTotalIGcnt);
fprintf(fout, "Average of %8.1lf jumps per group \n",
(double)emitter::emitTotalIGjmps / emitter::emitTotalIGcnt);
fprintf(fout, "\n");
fprintf(fout, "Average of %8.1lf bytes per instrDesc\n",
(double)emitter::emitTotalIGsize / emitter::emitTotalIGicnt);
fprintf(fout, "\n");
fprintf(fout, "A total of %8zu desc. bytes\n", emitter::emitTotalIGsize);
fprintf(fout, "\n");
fprintf(fout, "Total instructions: %8u\n", emitter::emitTotalInsCnt);
fprintf(fout, "Total small instrDesc: %8u (%5.2f%%)\n", emitter::emitTotalIDescSmallCnt,
100.0 * emitter::emitTotalIDescSmallCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDesc: %8u (%5.2f%%)\n", emitter::emitTotalIDescCnt,
100.0 * emitter::emitTotalIDescCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDescJmp: %8u (%5.2f%%)\n", emitter::emitTotalIDescJmpCnt,
100.0 * emitter::emitTotalIDescJmpCnt / emitter::emitTotalInsCnt);
#if !defined(TARGET_ARM64)
fprintf(fout, "Total instrDescLbl: %8u (%5.2f%%)\n", emitter::emitTotalIDescLblCnt,
100.0 * emitter::emitTotalIDescLblCnt / emitter::emitTotalInsCnt);
#endif // !defined(TARGET_ARM64)
fprintf(fout, "Total instrDescCns: %8u (%5.2f%%)\n", emitter::emitTotalIDescCnsCnt,
100.0 * emitter::emitTotalIDescCnsCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDescDsp: %8u (%5.2f%%)\n", emitter::emitTotalIDescDspCnt,
100.0 * emitter::emitTotalIDescDspCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDescCnsDsp: %8u (%5.2f%%)\n", emitter::emitTotalIDescCnsDspCnt,
100.0 * emitter::emitTotalIDescCnsDspCnt / emitter::emitTotalInsCnt);
#ifdef TARGET_XARCH
fprintf(fout, "Total instrDescAmd: %8u (%5.2f%%)\n", emitter::emitTotalIDescAmdCnt,
100.0 * emitter::emitTotalIDescAmdCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDescCnsAmd: %8u (%5.2f%%)\n", emitter::emitTotalIDescCnsAmdCnt,
100.0 * emitter::emitTotalIDescCnsAmdCnt / emitter::emitTotalInsCnt);
#endif // TARGET_XARCH
fprintf(fout, "Total instrDescCGCA: %8u (%5.2f%%)\n", emitter::emitTotalIDescCGCACnt,
100.0 * emitter::emitTotalIDescCGCACnt / emitter::emitTotalInsCnt);
#ifdef TARGET_ARM
fprintf(fout, "Total instrDescReloc: %8u (%5.2f%%)\n", emitter::emitTotalIDescRelocCnt,
100.0 * emitter::emitTotalIDescRelocCnt / emitter::emitTotalInsCnt);
#endif // TARGET_ARM
fprintf(fout, "Total instrDescAlign: %8u (%5.2f%%)\n", emitter::emitTotalDescAlignCnt,
100.0 * emitter::emitTotalDescAlignCnt / emitter::emitTotalInsCnt);
fprintf(fout, "\n");
}
fprintf(fout, "Descriptor size distribution:\n");
emitSizeTable.dump(fout);
fprintf(fout, "\n");
fprintf(fout, "GC ref frame variable counts:\n");
GCrefsTable.dump(fout);
fprintf(fout, "\n");
fprintf(fout, "Max. stack depth distribution:\n");
stkDepthTable.dump(fout);
fprintf(fout, "\n");
if ((emitter::emitSmallCnsCnt > 0) || (emitter::emitLargeCnsCnt > 0))
{
fprintf(fout, "SmallCnsCnt = %6u\n", emitter::emitSmallCnsCnt);
fprintf(fout, "LargeCnsCnt = %6u (%3u %% of total)\n", emitter::emitLargeCnsCnt,
100 * emitter::emitLargeCnsCnt / (emitter::emitLargeCnsCnt + emitter::emitSmallCnsCnt));
}
// Print out the most common small constants.
if (emitter::emitSmallCnsCnt > 0)
{
fprintf(fout, "\n\n");
fprintf(fout, "Common small constants >= %2u, <= %2u\n", ID_MIN_SMALL_CNS, ID_MAX_SMALL_CNS);
unsigned m = emitter::emitSmallCnsCnt / 1000 + 1;
for (int i = ID_MIN_SMALL_CNS; (i <= ID_MAX_SMALL_CNS) && (i < SMALL_CNS_TSZ); i++)
{
unsigned c = emitter::emitSmallCns[i - ID_MIN_SMALL_CNS];
if (c >= m)
{
if (i == SMALL_CNS_TSZ - 1)
{
fprintf(fout, "cns[>=%4d] = %u\n", i, c);
}
else
{
fprintf(fout, "cns[%4d] = %u\n", i, c);
}
}
}
}
fprintf(fout, "%8zu bytes allocated in the emitter\n", emitter::emitTotMemAlloc);
}
#endif // EMITTER_STATS
/*****************************************************************************/
const unsigned short emitTypeSizes[] = {
#define DEF_TP(tn, nm, jitType, verType, sz, sze, asze, st, al, tf, howUsed) sze,
#include "typelist.h"
#undef DEF_TP
};
const unsigned short emitTypeActSz[] = {
#define DEF_TP(tn, nm, jitType, verType, sz, sze, asze, st, al, tf, howUsed) asze,
#include "typelist.h"
#undef DEF_TP
};
/*****************************************************************************/
/*****************************************************************************
*
* Initialize the emitter - called once, at DLL load time.
*/
void emitter::emitInit()
{
}
/*****************************************************************************
*
* Shut down the emitter - called once, at DLL exit time.
*/
void emitter::emitDone()
{
}
/*****************************************************************************
*
* Allocate memory.
*/
void* emitter::emitGetMem(size_t sz)
{
assert(sz % sizeof(int) == 0);
#if EMITTER_STATS
emitTotMemAlloc += sz;
#endif
return emitComp->getAllocator(CMK_InstDesc).allocate<char>(sz);
}
/*****************************************************************************
*
* emitLclVarAddr support methods
*/
void emitLclVarAddr::initLclVarAddr(int varNum, unsigned offset)
{
if (varNum < 32768)
{
if (varNum >= 0)
{
if (offset < 32768)
{
_lvaTag = LVA_STANDARD_ENCODING;
_lvaExtra = offset; // offset known to be in [0..32767]
_lvaVarNum = (unsigned)varNum; // varNum known to be in [0..32767]
}
else // offset >= 32768
{
// We could support larger local offsets here at the cost of less varNums
if (offset >= 65536)
{
IMPL_LIMITATION("JIT doesn't support offsets larger than 65535 into valuetypes\n");
}
_lvaTag = LVA_LARGE_OFFSET;
_lvaExtra = (offset - 32768); // (offset-32768) is known to be in [0..32767]
_lvaVarNum = (unsigned)varNum; // varNum known to be in [0..32767]
}
}
else // varNum < 0, These are used for Compiler spill temps
{
if (varNum < -32767)
{
IMPL_LIMITATION("JIT doesn't support more than 32767 Compiler Spill temps\n");
}
if (offset > 32767)
{
IMPL_LIMITATION(
"JIT doesn't support offsets larger than 32767 into valuetypes for Compiler Spill temps\n");
}
_lvaTag = LVA_COMPILER_TEMP;
_lvaExtra = offset; // offset known to be in [0..32767]
_lvaVarNum = (unsigned)(-varNum); // -varNum known to be in [1..32767]
}
}
else // varNum >= 32768
{
if (offset >= 256)
{
IMPL_LIMITATION("JIT doesn't support offsets larger than 255 into valuetypes for local vars > 32767\n");
}
if (varNum >= 0x00400000)
{ // 0x00400000 == 2^22
IMPL_LIMITATION("JIT doesn't support more than 2^22 variables\n");
}
_lvaTag = LVA_LARGE_VARNUM;
_lvaVarNum = varNum & 0x00007FFF; // varNum bits 14 to 0
_lvaExtra = (varNum & 0x003F8000) >> 15; // varNum bits 21 to 15 in _lvaExtra bits 6 to 0, 7 bits total
_lvaExtra |= (offset << 7); // offset bits 7 to 0 in _lvaExtra bits 14 to 7, 8 bits total
}
}
// Returns the variable to access. Note that it returns a negative number for compiler spill temps.
int emitLclVarAddr::lvaVarNum()
{
switch (_lvaTag)
{
case LVA_COMPILER_TEMP:
return -((int)_lvaVarNum);
case LVA_LARGE_VARNUM:
return (int)(((_lvaExtra & 0x007F) << 15) + _lvaVarNum);
default: // LVA_STANDARD_ENCODING or LVA_LARGE_OFFSET
assert((_lvaTag == LVA_STANDARD_ENCODING) || (_lvaTag == LVA_LARGE_OFFSET));
return (int)_lvaVarNum;
}
}
unsigned emitLclVarAddr::lvaOffset() // returns the offset into the variable to access
{
switch (_lvaTag)
{
case LVA_LARGE_OFFSET:
return (32768 + _lvaExtra);
case LVA_LARGE_VARNUM:
return (_lvaExtra & 0x7F80) >> 7;
default: // LVA_STANDARD_ENCODING or LVA_COMPILER_TEMP
assert((_lvaTag == LVA_STANDARD_ENCODING) || (_lvaTag == LVA_COMPILER_TEMP));
return _lvaExtra;
}
}
/*****************************************************************************
*
* Record some info about the method about to be emitted.
*/
void emitter::emitBegCG(Compiler* comp, COMP_HANDLE cmpHandle)
{
emitComp = comp;
emitCmpHandle = cmpHandle;
}
void emitter::emitEndCG()
{
}
/*****************************************************************************
*
* Prepare the given IG for emission of code.
*/
void emitter::emitGenIG(insGroup* ig)
{
/* Set the "current IG" value */
emitCurIG = ig;
#if EMIT_TRACK_STACK_DEPTH
/* Record the stack level on entry to this group */
ig->igStkLvl = emitCurStackLvl;
// If we don't have enough bits in igStkLvl, refuse to compile
if (ig->igStkLvl != emitCurStackLvl)
{
IMPL_LIMITATION("Too many arguments pushed on stack");
}
// printf("Start IG #%02u [stk=%02u]\n", ig->igNum, emitCurStackLvl);
#endif
if (emitNoGCIG)
{
ig->igFlags |= IGF_NOGCINTERRUPT;
}
/* Prepare to issue instructions */
emitCurIGinsCnt = 0;
emitCurIGsize = 0;
assert(emitCurIGjmpList == nullptr);
#if FEATURE_LOOP_ALIGN
assert(emitCurIGAlignList == nullptr);
#endif
/* Allocate the temp instruction buffer if we haven't done so */
if (emitCurIGfreeBase == nullptr)
{
emitIGbuffSize = SC_IG_BUFFER_SIZE;
emitCurIGfreeBase = (BYTE*)emitGetMem(emitIGbuffSize);
}
emitCurIGfreeNext = emitCurIGfreeBase;
emitCurIGfreeEndp = emitCurIGfreeBase + emitIGbuffSize;
}
/*****************************************************************************
*
* Finish and save the current IG.
*/
insGroup* emitter::emitSavIG(bool emitAdd)
{
insGroup* ig;
BYTE* id;
size_t sz;
size_t gs;
assert(emitCurIGfreeNext <= emitCurIGfreeEndp);
// Get hold of the IG descriptor
ig = emitCurIG;
assert(ig);
#ifdef TARGET_ARMARCH
// Reset emitLastMemBarrier for new IG
emitLastMemBarrier = nullptr;
#endif
// Compute how much code we've generated
sz = emitCurIGfreeNext - emitCurIGfreeBase;
// Compute the total size we need to allocate
gs = roundUp(sz);
// Do we need space for GC?
if (!(ig->igFlags & IGF_EXTEND))
{
// Is the initial set of live GC vars different from the previous one?
if (emitForceStoreGCState || !VarSetOps::Equal(emitComp, emitPrevGCrefVars, emitInitGCrefVars))
{
// Remember that we will have a new set of live GC variables
ig->igFlags |= IGF_GC_VARS;
#if EMITTER_STATS
emitTotalIGptrs++;
#endif
// We'll allocate extra space to record the liveset
gs += sizeof(VARSET_TP);
}
// Is the initial set of live Byref regs different from the previous one?
// Remember that we will have a new set of live GC variables
ig->igFlags |= IGF_BYREF_REGS;
// We'll allocate extra space (DWORD aligned) to record the GC regs
gs += sizeof(int);
}
// Allocate space for the instructions and optional liveset
id = (BYTE*)emitGetMem(gs);
// Do we need to store the byref regs
if (ig->igFlags & IGF_BYREF_REGS)
{
// Record the byref regs in front the of the instructions
*castto(id, unsigned*)++ = (unsigned)emitInitByrefRegs;
}
// Do we need to store the liveset?
if (ig->igFlags & IGF_GC_VARS)
{
// Record the liveset in front the of the instructions
VarSetOps::AssignNoCopy(emitComp, (*castto(id, VARSET_TP*)), VarSetOps::MakeEmpty(emitComp));
VarSetOps::Assign(emitComp, (*castto(id, VARSET_TP*)++), emitInitGCrefVars);
}
// Record the collected instructions
assert((ig->igFlags & IGF_PLACEHOLDER) == 0);
ig->igData = id;
memcpy(id, emitCurIGfreeBase, sz);
#ifdef DEBUG
if (false && emitComp->verbose) // this is not useful in normal dumps (hence it is normally under if (false))
{
// If there's an error during emission, we may want to connect the post-copy address
// of an instrDesc with the pre-copy address (the one that was originally created). This
// printing enables that.
printf("copying instruction group from [0x%x..0x%x) to [0x%x..0x%x).\n", dspPtr(emitCurIGfreeBase),
dspPtr(emitCurIGfreeBase + sz), dspPtr(id), dspPtr(id + sz));
}
#endif
// Record how many instructions and bytes of code this group contains
noway_assert((BYTE)emitCurIGinsCnt == emitCurIGinsCnt);
noway_assert((unsigned short)emitCurIGsize == emitCurIGsize);
ig->igInsCnt = (BYTE)emitCurIGinsCnt;
ig->igSize = (unsigned short)emitCurIGsize;
emitCurCodeOffset += emitCurIGsize;
assert(IsCodeAligned(emitCurCodeOffset));
#if EMITTER_STATS
emitTotalIGicnt += emitCurIGinsCnt;
emitTotalIGsize += sz;
emitSizeMethod += sz;
if (emitIGisInProlog(ig))
{
emitCurPrologInsCnt += emitCurIGinsCnt;
emitCurPrologIGSize += sz;
// Keep track of the maximums.
if (emitCurPrologInsCnt > emitMaxPrologInsCnt)
{
emitMaxPrologInsCnt = emitCurPrologInsCnt;
}
if (emitCurPrologIGSize > emitMaxPrologIGSize)
{
emitMaxPrologIGSize = emitCurPrologIGSize;
}
}
#endif
// Record the live GC register set - if and only if it is not an extension
// block, in which case the GC register sets are inherited from the previous
// block.
if (!(ig->igFlags & IGF_EXTEND))
{
ig->igGCregs = (regMaskSmall)emitInitGCrefRegs;
}
if (!emitAdd)
{
// Update the previous recorded live GC ref sets, but not if if we are
// starting an "overflow" buffer. Note that this is only used to
// determine whether we need to store or not store the GC ref sets for
// the next IG, which is dependent on exactly what the state of the
// emitter GC ref sets will be when the next IG is processed in the
// emitter.
VarSetOps::Assign(emitComp, emitPrevGCrefVars, emitThisGCrefVars);
emitPrevGCrefRegs = emitThisGCrefRegs;
emitPrevByrefRegs = emitThisByrefRegs;
emitForceStoreGCState = false;
}
#ifdef DEBUG
if (emitComp->opts.dspCode)
{
printf("\n %s:", emitLabelString(ig));
if (emitComp->verbose)
{
printf(" ; offs=%06XH, funclet=%02u, bbWeight=%s", ig->igOffs, ig->igFuncIdx,
refCntWtd2str(ig->igWeight));
}
else
{
printf(" ; funclet=%02u", ig->igFuncIdx);
}
printf("\n");
}
#endif
#if FEATURE_LOOP_ALIGN
// Did we have any align instructions in this group?
if (emitCurIGAlignList)
{
instrDescAlign* list = nullptr;
instrDescAlign* last = nullptr;
// Move align instructions to the global list, update their 'next' links
do
{
// Grab the align and remove it from the list
instrDescAlign* oa = emitCurIGAlignList;
emitCurIGAlignList = oa->idaNext;
// Figure out the address of where the align got copied
size_t of = (BYTE*)oa - emitCurIGfreeBase;
instrDescAlign* na = (instrDescAlign*)(ig->igData + of);
assert(na->idaIG == ig);
assert(na->idIns() == oa->idIns());
assert(na->idaNext == oa->idaNext);
assert(na->idIns() == INS_align);
na->idaNext = list;
list = na;
if (last == nullptr)
{
last = na;
}
} while (emitCurIGAlignList);
// Should have at least one align instruction
assert(last);
if (emitAlignList == nullptr)
{
assert(emitAlignLast == nullptr);
last->idaNext = emitAlignList;
emitAlignList = list;
}
else
{
last->idaNext = nullptr;
emitAlignLast->idaNext = list;
}
emitAlignLast = last;
// Point to the first instruction of most recent
// align instruction(s) added.
//
// Since emitCurIGAlignList is created in inverse of
// program order, the `list` reverses that in forms it
// in correct order.
emitAlignLastGroup = list;
}
#endif
// Did we have any jumps in this group?
if (emitCurIGjmpList)
{
instrDescJmp* list = nullptr;
instrDescJmp* last = nullptr;
// Move jumps to the global list, update their 'next' links
do
{
// Grab the jump and remove it from the list
instrDescJmp* oj = emitCurIGjmpList;
emitCurIGjmpList = oj->idjNext;
// Figure out the address of where the jump got copied
size_t of = (BYTE*)oj - emitCurIGfreeBase;
instrDescJmp* nj = (instrDescJmp*)(ig->igData + of);
assert(nj->idjIG == ig);
assert(nj->idIns() == oj->idIns());
assert(nj->idjNext == oj->idjNext);
// Make sure the jumps are correctly ordered
assert(last == nullptr || last->idjOffs > nj->idjOffs);
if (ig->igFlags & IGF_FUNCLET_PROLOG)
{
// Our funclet prologs have short jumps, if the prolog would ever have
// long jumps, then we'd have to insert the list in sorted order than
// just append to the emitJumpList.
noway_assert(nj->idjShort);
if (nj->idjShort)
{
continue;
}
}
// Append the new jump to the list
nj->idjNext = list;
list = nj;
if (last == nullptr)
{
last = nj;
}
} while (emitCurIGjmpList);
if (last != nullptr)
{
// Append the jump(s) from this IG to the global list
bool prologJump = (ig == emitPrologIG);
if ((emitJumpList == nullptr) || prologJump)
{
last->idjNext = emitJumpList;
emitJumpList = list;
}
else
{
last->idjNext = nullptr;
emitJumpLast->idjNext = list;
}
if (!prologJump || (emitJumpLast == nullptr))
{
emitJumpLast = last;
}
}
}
// Fix the last instruction field
if (sz != 0)
{
assert(emitLastIns != nullptr);
assert(emitCurIGfreeBase <= (BYTE*)emitLastIns);
assert((BYTE*)emitLastIns < emitCurIGfreeBase + sz);
emitLastIns = (instrDesc*)((BYTE*)id + ((BYTE*)emitLastIns - (BYTE*)emitCurIGfreeBase));
}
// Reset the buffer free pointers
emitCurIGfreeNext = emitCurIGfreeBase;
return ig;
}
/*****************************************************************************
*
* Start generating code to be scheduled; called once per method.
*/
void emitter::emitBegFN(bool hasFramePtr
#if defined(DEBUG)
,
bool chkAlign
#endif
,
unsigned maxTmpSize)
{
insGroup* ig;
/* Assume we won't need the temp instruction buffer */
emitCurIGfreeBase = nullptr;
emitIGbuffSize = 0;
#if FEATURE_LOOP_ALIGN
emitLastAlignedIgNum = 0;
emitLastLoopStart = 0;
emitLastLoopEnd = 0;
#endif
/* Record stack frame info (the temp size is just an estimate) */
emitHasFramePtr = hasFramePtr;
emitMaxTmpSize = maxTmpSize;
#ifdef DEBUG
emitChkAlign = chkAlign;
#endif
/* We have no epilogs yet */
emitEpilogSize = 0;
emitEpilogCnt = 0;
#ifdef TARGET_XARCH
emitExitSeqBegLoc.Init();
emitExitSeqSize = INT_MAX;
#endif // TARGET_XARCH
emitPlaceholderList = emitPlaceholderLast = nullptr;
#ifdef JIT32_GCENCODER
emitEpilogList = emitEpilogLast = nullptr;
#endif // JIT32_GCENCODER
/* We don't have any jumps */
emitJumpList = emitJumpLast = nullptr;
emitCurIGjmpList = nullptr;
emitFwdJumps = false;
emitNoGCIG = false;
emitForceNewIG = false;
#if FEATURE_LOOP_ALIGN
/* We don't have any align instructions */
emitAlignList = emitAlignLastGroup = emitAlignLast = nullptr;
emitCurIGAlignList = nullptr;
#endif
/* We have not recorded any live sets */
assert(VarSetOps::IsEmpty(emitComp, emitThisGCrefVars));
assert(VarSetOps::IsEmpty(emitComp, emitInitGCrefVars));
assert(VarSetOps::IsEmpty(emitComp, emitPrevGCrefVars));
emitThisGCrefRegs = RBM_NONE;
emitInitGCrefRegs = RBM_NONE;
emitPrevGCrefRegs = RBM_NONE;
emitThisByrefRegs = RBM_NONE;
emitInitByrefRegs = RBM_NONE;
emitPrevByrefRegs = RBM_NONE;
emitForceStoreGCState = false;
#ifdef DEBUG
emitIssuing = false;
#endif
/* Assume there will be no GC ref variables */
emitGCrFrameOffsMin = emitGCrFrameOffsMax = emitGCrFrameOffsCnt = 0;
#ifdef DEBUG
emitGCrFrameLiveTab = nullptr;
#endif
/* We have no groups / code at this point */
emitIGlist = emitIGlast = nullptr;
emitCurCodeOffset = 0;
emitFirstColdIG = nullptr;
emitTotalCodeSize = 0;
#ifdef TARGET_LOONGARCH64
emitCounts_INS_OPTS_J = 0;
#endif
#if EMITTER_STATS
emitTotalIGmcnt++;
emitSizeMethod = 0;
emitCurPrologInsCnt = 0;
emitCurPrologIGSize = 0;
#endif
emitInsCount = 0;
/* The stack is empty now */
emitCurStackLvl = 0;
#if EMIT_TRACK_STACK_DEPTH
emitMaxStackDepth = 0;
emitCntStackDepth = sizeof(int);
#endif
#ifdef PSEUDORANDOM_NOP_INSERTION
// for random NOP insertion
emitEnableRandomNops();
emitComp->info.compRNG.Init(emitComp->info.compChecksum);
emitNextNop = emitNextRandomNop();
emitInInstrumentation = false;
#endif // PSEUDORANDOM_NOP_INSERTION
/* Create the first IG, it will be used for the prolog */
emitNxtIGnum = 1;
emitPrologIG = emitIGlist = emitIGlast = emitCurIG = ig = emitAllocIG();
emitLastIns = nullptr;
#ifdef TARGET_ARMARCH
emitLastMemBarrier = nullptr;
#endif
ig->igNext = nullptr;
#ifdef DEBUG
emitScratchSigInfo = nullptr;
#endif // DEBUG
/* Append another group, to start generating the method body */
emitNewIG();
}
#ifdef PSEUDORANDOM_NOP_INSERTION
int emitter::emitNextRandomNop()
{
return emitComp->info.compRNG.Next(1, 9);
}
#endif
/*****************************************************************************
*
* Done generating code to be scheduled; called once per method.
*/
void emitter::emitEndFN()
{
}
// member function iiaIsJitDataOffset for idAddrUnion, defers to Compiler::eeIsJitDataOffs
bool emitter::instrDesc::idAddrUnion::iiaIsJitDataOffset() const
{
return Compiler::eeIsJitDataOffs(iiaFieldHnd);
}
// member function iiaGetJitDataOffset for idAddrUnion, defers to Compiler::eeGetJitDataOffs
int emitter::instrDesc::idAddrUnion::iiaGetJitDataOffset() const
{
assert(iiaIsJitDataOffset());
return Compiler::eeGetJitDataOffs(iiaFieldHnd);
}
#if defined(DEBUG) || defined(LATE_DISASM)
//----------------------------------------------------------------------------------------
// insEvaluateExecutionCost:
// Returns the estimated execution cost for the current instruction
//
// Arguments:
// id - The current instruction descriptor to be evaluated
//
// Return Value:
// calls getInsExecutionCharacteristics and uses the result
// to compute an estimated execution cost
//
float emitter::insEvaluateExecutionCost(instrDesc* id)
{
insExecutionCharacteristics result = getInsExecutionCharacteristics(id);
float throughput = result.insThroughput;
float latency = result.insLatency;
unsigned memAccessKind = result.insMemoryAccessKind;
// Check for PERFSCORE_THROUGHPUT_ILLEGAL and PERFSCORE_LATENCY_ILLEGAL.
// Note that 0.0 throughput is allowed for pseudo-instructions in the instrDesc list that won't actually
// generate code.
assert(throughput >= 0.0);
assert(latency >= 0.0);
if (memAccessKind == PERFSCORE_MEMORY_WRITE || memAccessKind == PERFSCORE_MEMORY_READ_WRITE)
{
// We assume that we won't read back from memory for the next WR_GENERAL cycles
// Thus we normally won't pay latency costs for writes.
latency = max(0.0f, latency - PERFSCORE_LATENCY_WR_GENERAL);
}
else if (latency >= 1.0) // Otherwise, If we aren't performing a memory write
{
// We assume that the processor's speculation will typically eliminate one cycle of latency
//
latency -= 1.0;
}
return max(throughput, latency);
}
//------------------------------------------------------------------------------------
// perfScoreUnhandledInstruction:
// Helper method used to report an unhandled instruction
//
// Arguments:
// id - The current instruction descriptor to be evaluated
// pResult - pointer to struct holding the instruction characteristics
// if we return these are updated with default values
//
// Notes:
// We print the instruction and instruction group
// and instead of returning we will assert
//
// This method asserts with a debug/checked build
// and returns default latencies of 1 cycle otherwise.
//
void emitter::perfScoreUnhandledInstruction(instrDesc* id, insExecutionCharacteristics* pResult)
{
#ifdef DEBUG
printf("PerfScore: unhandled instruction: %s, format %s", codeGen->genInsDisplayName(id),
emitIfName(id->idInsFmt()));
assert(!"PerfScore: unhandled instruction");
#endif
pResult->insThroughput = PERFSCORE_THROUGHPUT_1C;
pResult->insLatency = PERFSCORE_LATENCY_1C;
}
#endif // defined(DEBUG) || defined(LATE_DISASM)
//----------------------------------------------------------------------------------------
// getCurrentBlockWeight: Return the block weight for the currently active block
//
// Arguments:
// None
//
// Return Value:
// The block weight for the current block
//
// Notes:
// The current block is recorded in emitComp->compCurBB by
// CodeGen::genCodeForBBlist() as it walks the blocks.
// When we are in the prolog/epilog this value is nullptr.
//
weight_t emitter::getCurrentBlockWeight()
{
// If we have a non-null compCurBB, then use it to get the current block weight
if (emitComp->compCurBB != nullptr)
{
return emitComp->compCurBB->getBBWeight(emitComp);
}
else // we have a null compCurBB
{
// prolog or epilog case, so just use the standard weight
return BB_UNITY_WEIGHT;
}
}
#if defined(TARGET_LOONGARCH64)
void emitter::dispIns(instrDesc* id)
{
// For LoongArch64 using the emitDisInsName().
NYI_LOONGARCH64("Not used on LOONGARCH64.");
}
#else
void emitter::dispIns(instrDesc* id)
{
#ifdef DEBUG
emitInsSanityCheck(id);
if (emitComp->opts.dspCode)
{
emitDispIns(id, true, false, false);
}
#if EMIT_TRACK_STACK_DEPTH
assert((int)emitCurStackLvl >= 0);
#endif
size_t sz = emitSizeOfInsDsc(id);
assert(id->idDebugOnlyInfo()->idSize == sz);
#endif // DEBUG
#if EMITTER_STATS
emitIFcounts[id->idInsFmt()]++;
#endif
}
#endif
void emitter::appendToCurIG(instrDesc* id)
{
#ifdef TARGET_ARMARCH
if (id->idIns() == INS_dmb)
{
emitLastMemBarrier = id;
}
else if (emitInsIsLoadOrStore(id->idIns()))
{
// A memory access - reset saved memory barrier
emitLastMemBarrier = nullptr;
}
#endif
emitCurIGsize += id->idCodeSize();
}
/*****************************************************************************
*
* Display (optionally) an instruction offset.
*/
#ifdef DEBUG
void emitter::emitDispInsAddr(BYTE* code)
{
if (emitComp->opts.disAddr)
{
printf(FMT_ADDR, DBG_ADDR(code));
}
}
void emitter::emitDispInsOffs(unsigned offs, bool doffs)
{
if (doffs)
{
printf("%06X", offs);
}
else
{
printf(" ");
}
}
#endif // DEBUG
#ifdef JIT32_GCENCODER
/*****************************************************************************
*
* Call the specified function pointer for each epilog block in the current
* method with the epilog's relative code offset. Returns the sum of the
* values returned by the callback.
*/
size_t emitter::emitGenEpilogLst(size_t (*fp)(void*, unsigned), void* cp)
{
EpilogList* el;
size_t sz;
for (el = emitEpilogList, sz = 0; el != nullptr; el = el->elNext)
{
assert(el->elLoc.GetIG()->igFlags & IGF_EPILOG);
// The epilog starts at the location recorded in the epilog list.
sz += fp(cp, el->elLoc.CodeOffset(this));
}
return sz;
}
#endif // JIT32_GCENCODER
/*****************************************************************************
*
* The following series of methods allocates instruction descriptors.
*/
void* emitter::emitAllocAnyInstr(size_t sz, emitAttr opsz)
{
instrDesc* id;
#ifdef DEBUG
// Under STRESS_EMITTER, put every instruction in its own instruction group.
// We can't do this for a prolog, epilog, funclet prolog, or funclet epilog,
// because those are generated out of order. We currently have a limitation
// where the jump shortening pass uses the instruction group number to determine
// if something is earlier or later in the code stream. This implies that
// these groups cannot be more than a single instruction group. Note that
// the prolog/epilog placeholder groups ARE generated in order, and are
// re-used. But generating additional groups would not work.
if (emitComp->compStressCompile(Compiler::STRESS_EMITTER, 1) && emitCurIGinsCnt && !emitIGisInProlog(emitCurIG) &&
!emitIGisInEpilog(emitCurIG) && !emitCurIG->endsWithAlignInstr()
#if defined(FEATURE_EH_FUNCLETS)
&& !emitIGisInFuncletProlog(emitCurIG) && !emitIGisInFuncletEpilog(emitCurIG)
#endif // FEATURE_EH_FUNCLETS
)
{
emitNxtIG(true);
}
#endif
#ifdef PSEUDORANDOM_NOP_INSERTION
// TODO-ARM-Bug?: PSEUDORANDOM_NOP_INSERTION is not defined for TARGET_ARM
// ARM - This is currently broken on TARGET_ARM
// When nopSize is odd we misalign emitCurIGsize
//
if (!emitComp->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT) && !emitInInstrumentation &&
!emitIGisInProlog(emitCurIG) && // don't do this in prolog or epilog
!emitIGisInEpilog(emitCurIG) &&
emitRandomNops // sometimes we turn off where exact codegen is needed (pinvoke inline)
)
{
if (emitNextNop == 0)
{
int nopSize = 4;
emitInInstrumentation = true;
instrDesc* idnop = emitNewInstr();
emitInInstrumentation = false;
idnop->idInsFmt(IF_NONE);
idnop->idIns(INS_nop);
#if defined(TARGET_XARCH)
idnop->idCodeSize(nopSize);
#else
#error "Undefined target for pseudorandom NOP insertion"
#endif
emitCurIGsize += nopSize;
emitNextNop = emitNextRandomNop();
}
else
emitNextNop--;
}
#endif // PSEUDORANDOM_NOP_INSERTION
assert(IsCodeAligned(emitCurIGsize));
// Make sure we have enough space for the new instruction.
// `igInsCnt` is currently a byte, so we can't have more than 255 instructions in a single insGroup.
if ((emitCurIGfreeNext + sz >= emitCurIGfreeEndp) || emitForceNewIG || (emitCurIGinsCnt >= 255))
{
emitNxtIG(true);
}
/* Grab the space for the instruction */
emitLastIns = id = (instrDesc*)emitCurIGfreeNext;
emitCurIGfreeNext += sz;
assert(sz >= sizeof(void*));
memset(id, 0, sz);
// These fields should have been zero-ed by the above
assert(id->idReg1() == regNumber(0));
assert(id->idReg2() == regNumber(0));
#ifdef TARGET_XARCH
assert(id->idCodeSize() == 0);
#endif
// Make sure that idAddrUnion is just a union of various pointer sized things
C_ASSERT(sizeof(CORINFO_FIELD_HANDLE) <= sizeof(void*));
C_ASSERT(sizeof(CORINFO_METHOD_HANDLE) <= sizeof(void*));
#ifdef TARGET_XARCH
C_ASSERT(sizeof(emitter::emitAddrMode) <= sizeof(void*));
#endif // TARGET_XARCH
C_ASSERT(sizeof(emitLclVarAddr) <= sizeof(void*));
C_ASSERT(sizeof(emitter::instrDesc) == (SMALL_IDSC_SIZE + sizeof(void*)));
emitInsCount++;
#if defined(DEBUG)
/* In debug mode we clear/set some additional fields */
instrDescDebugInfo* info = (instrDescDebugInfo*)emitGetMem(sizeof(*info));
info->idNum = emitInsCount;
info->idSize = sz;
info->idVarRefOffs = 0;
info->idMemCookie = 0;
info->idFlags = GTF_EMPTY;
info->idFinallyCall = false;
info->idCatchRet = false;
info->idCallSig = nullptr;
id->idDebugOnlyInfo(info);
#endif // defined(DEBUG)
/* Store the size and handle the two special values
that indicate GCref and ByRef */
if (EA_IS_GCREF(opsz))
{
/* A special value indicates a GCref pointer value */
id->idGCref(GCT_GCREF);
id->idOpSize(EA_PTRSIZE);
}
else if (EA_IS_BYREF(opsz))
{
/* A special value indicates a Byref pointer value */
id->idGCref(GCT_BYREF);
id->idOpSize(EA_PTRSIZE);
}
else
{
id->idGCref(GCT_NONE);
id->idOpSize(EA_SIZE(opsz));
}
// Amd64: ip-relative addressing is supported even when not generating relocatable ngen code
if (EA_IS_DSP_RELOC(opsz)
#ifndef TARGET_AMD64
&& emitComp->opts.compReloc
#endif // TARGET_AMD64
)
{
/* Mark idInfo()->idDspReloc to remember that the */
/* address mode has a displacement that is relocatable */
id->idSetIsDspReloc();
}
if (EA_IS_CNS_RELOC(opsz) && emitComp->opts.compReloc)
{
/* Mark idInfo()->idCnsReloc to remember that the */
/* instruction has an immediate constant that is relocatable */
id->idSetIsCnsReloc();
}
#if EMITTER_STATS
emitTotalInsCnt++;
#endif
/* Update the instruction count */
emitCurIGinsCnt++;
#ifdef DEBUG
if (emitComp->compCurBB != emitCurIG->lastGeneratedBlock)
{
emitCurIG->igBlocks.push_back(emitComp->compCurBB);
emitCurIG->lastGeneratedBlock = emitComp->compCurBB;
}
#endif // DEBUG
return id;
}
#ifdef DEBUG
//------------------------------------------------------------------------
// emitCheckIGoffsets: Make sure the code offsets of all instruction groups look reasonable.
//
// Note: It checks that each instruction group starts right after the previous ig.
// For the first cold ig offset is also should be the last hot ig + its size.
// emitCurCodeOffs maintains distance for the split case to look like they are consistent.
// Also it checks total code size.
//
void emitter::emitCheckIGoffsets()
{
size_t currentOffset = 0;
for (insGroup* tempIG = emitIGlist; tempIG != nullptr; tempIG = tempIG->igNext)
{
if (tempIG->igOffs != currentOffset)
{
printf("IG%02u has offset %08X, expected %08X\n", tempIG->igNum, tempIG->igOffs, currentOffset);
assert(!"bad block offset");
}
currentOffset += tempIG->igSize;
}
if (emitTotalCodeSize != 0 && emitTotalCodeSize != currentOffset)
{
printf("Total code size is %08X, expected %08X\n", emitTotalCodeSize, currentOffset);
assert(!"bad total code size");
}
}
#endif // DEBUG
/*****************************************************************************
*
* Begin generating a method prolog.
*/
void emitter::emitBegProlog()
{
assert(emitComp->compGeneratingProlog);
#if EMIT_TRACK_STACK_DEPTH
/* Don't measure stack depth inside the prolog, it's misleading */
emitCntStackDepth = 0;
assert(emitCurStackLvl == 0);
#endif
emitNoGCIG = true;
emitForceNewIG = false;
/* Switch to the pre-allocated prolog IG */
emitGenIG(emitPrologIG);
/* Nothing is live on entry to the prolog */
// These were initialized to Empty at the start of compilation.
VarSetOps::ClearD(emitComp, emitInitGCrefVars);
VarSetOps::ClearD(emitComp, emitPrevGCrefVars);
emitInitGCrefRegs = RBM_NONE;
emitPrevGCrefRegs = RBM_NONE;
emitInitByrefRegs = RBM_NONE;
emitPrevByrefRegs = RBM_NONE;
}
/*****************************************************************************
*
* Return the code offset of the current location in the prolog.
*/
unsigned emitter::emitGetPrologOffsetEstimate()
{
/* For now only allow a single prolog ins group */
assert(emitPrologIG);
assert(emitPrologIG == emitCurIG);
return emitCurIGsize;
}
/*****************************************************************************
*
* Mark the code offset of the current location as the end of the prolog,
* so it can be used later to compute the actual size of the prolog.
*/
void emitter::emitMarkPrologEnd()
{
assert(emitComp->compGeneratingProlog);
/* For now only allow a single prolog ins group */
assert(emitPrologIG);
assert(emitPrologIG == emitCurIG);
emitPrologEndPos = emitCurOffset();
}
/*****************************************************************************
*
* Finish generating a method prolog.
*/
void emitter::emitEndProlog()
{
assert(emitComp->compGeneratingProlog);
emitNoGCIG = false;
/* Save the prolog IG if non-empty or if only one block */
if (emitCurIGnonEmpty() || emitCurIG == emitPrologIG)
{
emitSavIG();
}
#if EMIT_TRACK_STACK_DEPTH
/* Reset the stack depth values */
emitCurStackLvl = 0;
emitCntStackDepth = sizeof(int);
#endif
}
/*****************************************************************************
*
* Create a placeholder instruction group to be used by a prolog or epilog,
* either for the main function, or a funclet.
*/
void emitter::emitCreatePlaceholderIG(insGroupPlaceholderType igType,
BasicBlock* igBB,
VARSET_VALARG_TP GCvars,
regMaskTP gcrefRegs,
regMaskTP byrefRegs,
bool last)
{
assert(igBB != nullptr);
bool extend = false;
if (igType == IGPT_EPILOG
#if defined(FEATURE_EH_FUNCLETS)
|| igType == IGPT_FUNCLET_EPILOG
#endif // FEATURE_EH_FUNCLETS
)
{
#ifdef TARGET_AMD64
emitOutputPreEpilogNOP();
#endif // TARGET_AMD64
extend = true;
}
if (emitCurIGnonEmpty())
{
emitNxtIG(extend);
}
/* Update GC tracking for the beginning of the placeholder IG */
if (!extend)
{
VarSetOps::Assign(emitComp, emitThisGCrefVars, GCvars);
VarSetOps::Assign(emitComp, emitInitGCrefVars, GCvars);
emitThisGCrefRegs = emitInitGCrefRegs = gcrefRegs;
emitThisByrefRegs = emitInitByrefRegs = byrefRegs;
}
/* Convert the group to a placeholder group */
insGroup* igPh = emitCurIG;
igPh->igFlags |= IGF_PLACEHOLDER;
/* Note that we might be re-using a previously created but empty IG. In this
* case, we need to make sure any re-used fields, such as igFuncIdx, are correct.
*/
igPh->igFuncIdx = emitComp->compCurrFuncIdx;
/* Create a separate block of memory to store placeholder information.
* We could use unions to put some of this into the insGroup itself, but we don't
* want to grow the insGroup, and it's difficult to make sure the
* insGroup fields are getting set and used elsewhere.
*/
igPh->igPhData = new (emitComp, CMK_InstDesc) insPlaceholderGroupData;
igPh->igPhData->igPhNext = nullptr;
igPh->igPhData->igPhType = igType;
igPh->igPhData->igPhBB = igBB;
VarSetOps::AssignNoCopy(emitComp, igPh->igPhData->igPhPrevGCrefVars, VarSetOps::UninitVal());
VarSetOps::Assign(emitComp, igPh->igPhData->igPhPrevGCrefVars, emitPrevGCrefVars);
igPh->igPhData->igPhPrevGCrefRegs = emitPrevGCrefRegs;
igPh->igPhData->igPhPrevByrefRegs = emitPrevByrefRegs;
VarSetOps::AssignNoCopy(emitComp, igPh->igPhData->igPhInitGCrefVars, VarSetOps::UninitVal());
VarSetOps::Assign(emitComp, igPh->igPhData->igPhInitGCrefVars, emitInitGCrefVars);
igPh->igPhData->igPhInitGCrefRegs = emitInitGCrefRegs;
igPh->igPhData->igPhInitByrefRegs = emitInitByrefRegs;
#if EMITTER_STATS
emitTotalPhIGcnt += 1;
#endif
// Mark function prologs and epilogs properly in the igFlags bits. These bits
// will get used and propagated when the placeholder is converted to a non-placeholder
// during prolog/epilog generation.
if (igType == IGPT_EPILOG)
{
igPh->igFlags |= IGF_EPILOG;
}
#if defined(FEATURE_EH_FUNCLETS)
else if (igType == IGPT_FUNCLET_PROLOG)
{
igPh->igFlags |= IGF_FUNCLET_PROLOG;
}
else if (igType == IGPT_FUNCLET_EPILOG)
{
igPh->igFlags |= IGF_FUNCLET_EPILOG;
}
#endif // FEATURE_EH_FUNCLETS
/* Link it into the placeholder list */
if (emitPlaceholderList)
{
emitPlaceholderLast->igPhData->igPhNext = igPh;
}
else
{
emitPlaceholderList = igPh;
}
emitPlaceholderLast = igPh;
// Give an estimated size of this placeholder IG and
// increment emitCurCodeOffset since we are not calling emitNewIG()
//
emitCurIGsize += MAX_PLACEHOLDER_IG_SIZE;
emitCurCodeOffset += emitCurIGsize;
#if defined(FEATURE_EH_FUNCLETS)
// Add the appropriate IP mapping debugging record for this placeholder
// group. genExitCode() adds the mapping for main function epilogs.
if (emitComp->opts.compDbgInfo)
{
if (igType == IGPT_FUNCLET_PROLOG)
{
codeGen->genIPmappingAdd(IPmappingDscKind::Prolog, DebugInfo(), true);
}
else if (igType == IGPT_FUNCLET_EPILOG)
{
codeGen->genIPmappingAdd(IPmappingDscKind::Epilog, DebugInfo(), true);
}
}
#endif // FEATURE_EH_FUNCLETS
/* Start a new IG if more code follows */
if (last)
{
emitCurIG = nullptr;
}
else
{
if (igType == IGPT_EPILOG
#if defined(FEATURE_EH_FUNCLETS)
|| igType == IGPT_FUNCLET_EPILOG
#endif // FEATURE_EH_FUNCLETS
)
{
// If this was an epilog, then assume this is the end of any currently in progress
// no-GC region. If a block after the epilog needs to be no-GC, it needs to call
// emitter::emitDisableGC() directly. This behavior is depended upon by the fast
// tailcall implementation, which disables GC at the beginning of argument setup,
// but assumes that after the epilog it will be re-enabled.
emitNoGCIG = false;
}
emitNewIG();
// We don't know what the GC ref state will be at the end of the placeholder
// group. So, force the next IG to store all the GC ref state variables;
// don't omit them because emitPrev* is the same as emitInit*, because emitPrev*
// will be inaccurate. (Note that, currently, GCrefRegs and ByrefRegs are always
// saved anyway.)
//
// There is no need to re-initialize the emitPrev* variables, as they won't be used
// with emitForceStoreGCState==true, and will be re-initialized just before
// emitForceStoreGCState is set to false;
emitForceStoreGCState = true;
/* The group after the placeholder group doesn't get the "propagate" flags */
emitCurIG->igFlags &= ~IGF_PROPAGATE_MASK;
}
#ifdef DEBUG
if (emitComp->verbose)
{
printf("*************** After placeholder IG creation\n");
emitDispIGlist(false);
}
#endif
}
/*****************************************************************************
*
* Generate all prologs and epilogs
*/
void emitter::emitGeneratePrologEpilog()
{
#ifdef DEBUG
unsigned prologCnt = 0;
unsigned epilogCnt = 0;
#if defined(FEATURE_EH_FUNCLETS)
unsigned funcletPrologCnt = 0;
unsigned funcletEpilogCnt = 0;
#endif // FEATURE_EH_FUNCLETS
#endif // DEBUG
insGroup* igPh;
insGroup* igPhNext;
// Generating the prolog/epilog is going to destroy the placeholder group,
// so save the "next" pointer before that happens.
for (igPh = emitPlaceholderList; igPh != nullptr; igPh = igPhNext)
{
assert(igPh->igFlags & IGF_PLACEHOLDER);
igPhNext = igPh->igPhData->igPhNext;
BasicBlock* igPhBB = igPh->igPhData->igPhBB;
switch (igPh->igPhData->igPhType)
{
case IGPT_PROLOG: // currently unused
INDEBUG(++prologCnt);
break;
case IGPT_EPILOG:
INDEBUG(++epilogCnt);
emitBegFnEpilog(igPh);
codeGen->genFnEpilog(igPhBB);
emitEndFnEpilog();
break;
#if defined(FEATURE_EH_FUNCLETS)
case IGPT_FUNCLET_PROLOG:
INDEBUG(++funcletPrologCnt);
emitBegFuncletProlog(igPh);
codeGen->genFuncletProlog(igPhBB);
emitEndFuncletProlog();
break;
case IGPT_FUNCLET_EPILOG:
INDEBUG(++funcletEpilogCnt);
emitBegFuncletEpilog(igPh);
codeGen->genFuncletEpilog();
emitEndFuncletEpilog();
break;
#endif // FEATURE_EH_FUNCLETS
default:
unreached();
}
}
#ifdef DEBUG
if (emitComp->verbose)
{
printf("%d prologs, %d epilogs", prologCnt, epilogCnt);
#if defined(FEATURE_EH_FUNCLETS)
printf(", %d funclet prologs, %d funclet epilogs", funcletPrologCnt, funcletEpilogCnt);
#endif // FEATURE_EH_FUNCLETS
printf("\n");
// prolog/epilog code doesn't use this yet
// noway_assert(prologCnt == 1);
// noway_assert(epilogCnt == emitEpilogCnt); // Is this correct?
#if defined(FEATURE_EH_FUNCLETS)
assert(funcletPrologCnt == emitComp->ehFuncletCount());
#endif // FEATURE_EH_FUNCLETS
}
#endif // DEBUG
}
/*****************************************************************************
*
* Begin all prolog and epilog generation
*/
void emitter::emitStartPrologEpilogGeneration()
{
/* Save the current IG if it's non-empty */
if (emitCurIGnonEmpty())
{
emitSavIG();
}
else
{
assert(emitCurIG == nullptr);
}
}
/*****************************************************************************
*
* Finish all prolog and epilog generation
*/
void emitter::emitFinishPrologEpilogGeneration()
{
/* Update the offsets of all the blocks */
emitRecomputeIGoffsets();
/* We should not generate any more code after this */
emitCurIG = nullptr;
}
/*****************************************************************************
*
* Common code for prolog / epilog beginning. Convert the placeholder group to actual code IG,
* and set it as the current group.
*/
void emitter::emitBegPrologEpilog(insGroup* igPh)
{
assert(igPh->igFlags & IGF_PLACEHOLDER);
/* Save the current IG if it's non-empty */
if (emitCurIGnonEmpty())
{
emitSavIG();
}
/* Convert the placeholder group to a normal group.
* We need to be very careful to re-initialize the IG properly.
* It turns out, this means we only need to clear the placeholder bit
* and clear the igPhData field, and emitGenIG() will do the rest,
* since in the placeholder IG we didn't touch anything that is set by emitAllocIG().
*/
igPh->igFlags &= ~IGF_PLACEHOLDER;
emitNoGCIG = true;
emitForceNewIG = false;
/* Set up the GC info that we stored in the placeholder */
VarSetOps::Assign(emitComp, emitPrevGCrefVars, igPh->igPhData->igPhPrevGCrefVars);
emitPrevGCrefRegs = igPh->igPhData->igPhPrevGCrefRegs;
emitPrevByrefRegs = igPh->igPhData->igPhPrevByrefRegs;
VarSetOps::Assign(emitComp, emitThisGCrefVars, igPh->igPhData->igPhInitGCrefVars);
VarSetOps::Assign(emitComp, emitInitGCrefVars, igPh->igPhData->igPhInitGCrefVars);
emitThisGCrefRegs = emitInitGCrefRegs = igPh->igPhData->igPhInitGCrefRegs;
emitThisByrefRegs = emitInitByrefRegs = igPh->igPhData->igPhInitByrefRegs;
igPh->igPhData = nullptr;
/* Create a non-placeholder group pointer that we'll now use */
insGroup* ig = igPh;
/* Set the current function using the function index we stored */
emitComp->funSetCurrentFunc(ig->igFuncIdx);
/* Set the new IG as the place to generate code */
emitGenIG(ig);
#if EMIT_TRACK_STACK_DEPTH
/* Don't measure stack depth inside the prolog / epilog, it's misleading */
emitCntStackDepth = 0;
assert(emitCurStackLvl == 0);
#endif
}
/*****************************************************************************
*
* Common code for end of prolog / epilog
*/
void emitter::emitEndPrologEpilog()
{
emitNoGCIG = false;
/* Save the IG if non-empty */
if (emitCurIGnonEmpty())
{
emitSavIG();
}
assert(emitCurIGsize <= MAX_PLACEHOLDER_IG_SIZE);
#if EMIT_TRACK_STACK_DEPTH
/* Reset the stack depth values */
emitCurStackLvl = 0;
emitCntStackDepth = sizeof(int);
#endif
}
/*****************************************************************************
*
* Begin generating a main function epilog.
*/
void emitter::emitBegFnEpilog(insGroup* igPh)
{
emitEpilogCnt++;
emitBegPrologEpilog(igPh);
#ifdef JIT32_GCENCODER
EpilogList* el = new (emitComp, CMK_GC) EpilogList();
if (emitEpilogLast != nullptr)
{
emitEpilogLast->elNext = el;
}
else
{
emitEpilogList = el;
}
emitEpilogLast = el;
#endif // JIT32_GCENCODER
}
/*****************************************************************************
*
* Finish generating a funclet epilog.
*/
void emitter::emitEndFnEpilog()
{
emitEndPrologEpilog();
#ifdef JIT32_GCENCODER
assert(emitEpilogLast != nullptr);
UNATIVE_OFFSET epilogBegCodeOffset = emitEpilogLast->elLoc.CodeOffset(this);
UNATIVE_OFFSET epilogExitSeqStartCodeOffset = emitExitSeqBegLoc.CodeOffset(this);
UNATIVE_OFFSET newSize = epilogExitSeqStartCodeOffset - epilogBegCodeOffset;
/* Compute total epilog size */
assert(emitEpilogSize == 0 || emitEpilogSize == newSize); // All epilogs must be identical
emitEpilogSize = newSize;
UNATIVE_OFFSET epilogEndCodeOffset = emitCodeOffset(emitCurIG, emitCurOffset());
assert(epilogExitSeqStartCodeOffset != epilogEndCodeOffset);
newSize = epilogEndCodeOffset - epilogExitSeqStartCodeOffset;
if (newSize < emitExitSeqSize)
{
// We expect either the epilog to be the same every time, or that
// one will be a ret or a ret <n> and others will be a jmp addr or jmp [addr];
// we make the epilogs the minimum of these. Note that this ONLY works
// because the only instruction is the last one and thus a slight
// underestimation of the epilog size is harmless (since the EIP
// can not be between instructions).
assert(emitEpilogCnt == 1 ||
(emitExitSeqSize - newSize) <= 5 // delta between size of various forms of jmp (size is either 6 or 5),
// and various forms of ret (size is either 1 or 3). The combination can
// be anything between 1 and 5.
);
emitExitSeqSize = newSize;
}
#endif // JIT32_GCENCODER
}
#if defined(FEATURE_EH_FUNCLETS)
/*****************************************************************************
*
* Begin generating a funclet prolog.
*/
void emitter::emitBegFuncletProlog(insGroup* igPh)
{
emitBegPrologEpilog(igPh);
}
/*****************************************************************************
*
* Finish generating a funclet prolog.
*/
void emitter::emitEndFuncletProlog()
{
emitEndPrologEpilog();
}
/*****************************************************************************
*
* Begin generating a funclet epilog.
*/
void emitter::emitBegFuncletEpilog(insGroup* igPh)
{
emitBegPrologEpilog(igPh);
}
/*****************************************************************************
*
* Finish generating a funclet epilog.
*/
void emitter::emitEndFuncletEpilog()
{
emitEndPrologEpilog();
}
#endif // FEATURE_EH_FUNCLETS
#ifdef JIT32_GCENCODER
//
// emitter::emitStartEpilog:
// Mark the current position so that we can later compute the total epilog size.
//
void emitter::emitStartEpilog()
{
assert(emitEpilogLast != nullptr);
emitEpilogLast->elLoc.CaptureLocation(this);
}
/*****************************************************************************
*
* Return non-zero if the current method only has one epilog, which is
* at the very end of the method body.
*/
bool emitter::emitHasEpilogEnd()
{
if (emitEpilogCnt == 1 && (emitIGlast->igFlags & IGF_EPILOG)) // This wouldn't work for funclets
return true;
else
return false;
}
#endif // JIT32_GCENCODER
#ifdef TARGET_XARCH
/*****************************************************************************
*
* Mark the beginning of the epilog exit sequence by remembering our position.
*/
void emitter::emitStartExitSeq()
{
assert(emitComp->compGeneratingEpilog);
emitExitSeqBegLoc.CaptureLocation(this);
}
#endif // TARGET_XARCH
/*****************************************************************************
*
* The code generator tells us the range of GC ref locals through this
* method. Needless to say, locals and temps should be allocated so that
* the size of the range is as small as possible.
*
* offsLo - The FP offset from which the GC pointer range starts.
* offsHi - The FP offset at which the GC pointer region ends (exclusive).
*/
void emitter::emitSetFrameRangeGCRs(int offsLo, int offsHi)
{
assert(emitComp->compGeneratingProlog);
assert(offsHi > offsLo);
#ifdef DEBUG
// A total of 47254 methods compiled.
//
// GC ref frame variable counts:
//
// <= 0 ===> 43175 count ( 91% of total)
// 1 .. 1 ===> 2367 count ( 96% of total)
// 2 .. 2 ===> 887 count ( 98% of total)
// 3 .. 5 ===> 579 count ( 99% of total)
// 6 .. 10 ===> 141 count ( 99% of total)
// 11 .. 20 ===> 40 count ( 99% of total)
// 21 .. 50 ===> 42 count ( 99% of total)
// 51 .. 128 ===> 15 count ( 99% of total)
// 129 .. 256 ===> 4 count ( 99% of total)
// 257 .. 512 ===> 4 count (100% of total)
// 513 .. 1024 ===> 0 count (100% of total)
if (emitComp->verbose)
{
unsigned count = (offsHi - offsLo) / TARGET_POINTER_SIZE;
printf("%u tracked GC refs are at stack offsets ", count);
if (offsLo >= 0)
{
printf(" %04X ... %04X\n", offsLo, offsHi);
assert(offsHi >= 0);
}
else
#if defined(TARGET_ARM) && defined(PROFILING_SUPPORTED)
if (!emitComp->compIsProfilerHookNeeded())
#endif
{
#ifdef TARGET_AMD64
// doesn't have to be all negative on amd
printf("-%04X ... %04X\n", -offsLo, offsHi);
#elif defined(TARGET_LOONGARCH64)
if (offsHi < 0)
printf("-%04X ... -%04X\n", -offsLo, -offsHi);
else
printf("-%04X ... %04X\n", -offsLo, offsHi);
#else
printf("-%04X ... -%04X\n", -offsLo, -offsHi);
assert(offsHi <= 0);
#endif
}
#if defined(TARGET_ARM) && defined(PROFILING_SUPPORTED)
else
{
// Under profiler due to prespilling of arguments, offHi need not be < 0
if (offsHi < 0)
printf("-%04X ... -%04X\n", -offsLo, -offsHi);
else
printf("-%04X ... %04X\n", -offsLo, offsHi);
}
#endif
}
#endif // DEBUG
assert(((offsHi - offsLo) % TARGET_POINTER_SIZE) == 0);
assert((offsLo % TARGET_POINTER_SIZE) == 0);
assert((offsHi % TARGET_POINTER_SIZE) == 0);
emitGCrFrameOffsMin = offsLo;
emitGCrFrameOffsMax = offsHi;
emitGCrFrameOffsCnt = (offsHi - offsLo) / TARGET_POINTER_SIZE;
}
/*****************************************************************************
*
* The code generator tells us the range of local variables through this
* method.
*/
void emitter::emitSetFrameRangeLcls(int offsLo, int offsHi)
{
}
/*****************************************************************************
*
* The code generator tells us the range of used arguments through this
* method.
*/
void emitter::emitSetFrameRangeArgs(int offsLo, int offsHi)
{
}
/*****************************************************************************
*
* A conversion table used to map an operand size value (in bytes) into its
* small encoding (0 through 3), and vice versa.
*/
const emitter::opSize emitter::emitSizeEncode[] = {
emitter::OPSZ1, emitter::OPSZ2, OPSIZE_INVALID, emitter::OPSZ4, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID,
emitter::OPSZ8, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID,
OPSIZE_INVALID, emitter::OPSZ16, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID,
OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID,
OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, emitter::OPSZ32,
};
const emitAttr emitter::emitSizeDecode[emitter::OPSZ_COUNT] = {EA_1BYTE, EA_2BYTE, EA_4BYTE,
EA_8BYTE, EA_16BYTE, EA_32BYTE};
/*****************************************************************************
*
* Allocate an instruction descriptor for an instruction that uses both
* a displacement and a constant.
*/
emitter::instrDesc* emitter::emitNewInstrCnsDsp(emitAttr size, target_ssize_t cns, int dsp)
{
if (dsp == 0)
{
if (instrDesc::fitsInSmallCns(cns))
{
instrDesc* id = emitAllocInstr(size);
id->idSmallCns(cns);
#if EMITTER_STATS
emitSmallCnsCnt++;
if ((cns - ID_MIN_SMALL_CNS) >= (SMALL_CNS_TSZ - 1))
emitSmallCns[SMALL_CNS_TSZ - 1]++;
else
emitSmallCns[cns - ID_MIN_SMALL_CNS]++;
emitSmallDspCnt++;
#endif
return id;
}
else
{
instrDescCns* id = emitAllocInstrCns(size, cns);
#if EMITTER_STATS
emitLargeCnsCnt++;
emitSmallDspCnt++;
#endif
return id;
}
}
else
{
if (instrDesc::fitsInSmallCns(cns))
{
instrDescDsp* id = emitAllocInstrDsp(size);
id->idSetIsLargeDsp();
id->iddDspVal = dsp;
id->idSmallCns(cns);
#if EMITTER_STATS
emitLargeDspCnt++;
emitSmallCnsCnt++;
if ((cns - ID_MIN_SMALL_CNS) >= (SMALL_CNS_TSZ - 1))
emitSmallCns[SMALL_CNS_TSZ - 1]++;
else
emitSmallCns[cns - ID_MIN_SMALL_CNS]++;
#endif
return id;
}
else
{
instrDescCnsDsp* id = emitAllocInstrCnsDsp(size);
id->idSetIsLargeCns();
id->iddcCnsVal = cns;
id->idSetIsLargeDsp();
id->iddcDspVal = dsp;
#if EMITTER_STATS
emitLargeDspCnt++;
emitLargeCnsCnt++;
#endif
return id;
}
}
}
//------------------------------------------------------------------------
// emitNoGChelper: Returns true if garbage collection won't happen within the helper call.
//
// Notes:
// There is no need to record live pointers for such call sites.
//
// Arguments:
// helpFunc - a helper signature for the call, can be CORINFO_HELP_UNDEF, that means that the call is not a helper.
//
// Return value:
// true if GC can't happen within this call, false otherwise.
bool emitter::emitNoGChelper(CorInfoHelpFunc helpFunc)
{
// TODO-Throughput: Make this faster (maybe via a simple table of bools?)
switch (helpFunc)
{
case CORINFO_HELP_UNDEF:
return false;
case CORINFO_HELP_PROF_FCN_LEAVE:
case CORINFO_HELP_PROF_FCN_ENTER:
case CORINFO_HELP_PROF_FCN_TAILCALL:
case CORINFO_HELP_LLSH:
case CORINFO_HELP_LRSH:
case CORINFO_HELP_LRSZ:
// case CORINFO_HELP_LMUL:
// case CORINFO_HELP_LDIV:
// case CORINFO_HELP_LMOD:
// case CORINFO_HELP_ULDIV:
// case CORINFO_HELP_ULMOD:
#ifdef TARGET_X86
case CORINFO_HELP_ASSIGN_REF_EAX:
case CORINFO_HELP_ASSIGN_REF_ECX:
case CORINFO_HELP_ASSIGN_REF_EBX:
case CORINFO_HELP_ASSIGN_REF_EBP:
case CORINFO_HELP_ASSIGN_REF_ESI:
case CORINFO_HELP_ASSIGN_REF_EDI:
case CORINFO_HELP_CHECKED_ASSIGN_REF_EAX:
case CORINFO_HELP_CHECKED_ASSIGN_REF_ECX:
case CORINFO_HELP_CHECKED_ASSIGN_REF_EBX:
case CORINFO_HELP_CHECKED_ASSIGN_REF_EBP:
case CORINFO_HELP_CHECKED_ASSIGN_REF_ESI:
case CORINFO_HELP_CHECKED_ASSIGN_REF_EDI:
#endif
case CORINFO_HELP_ASSIGN_REF:
case CORINFO_HELP_CHECKED_ASSIGN_REF:
case CORINFO_HELP_ASSIGN_BYREF:
case CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR:
case CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR:
case CORINFO_HELP_INIT_PINVOKE_FRAME:
case CORINFO_HELP_VALIDATE_INDIRECT_CALL:
return true;
default:
return false;
}
}
//------------------------------------------------------------------------
// emitNoGChelper: Returns true if garbage collection won't happen within the helper call.
//
// Notes:
// There is no need to record live pointers for such call sites.
//
// Arguments:
// methHnd - a method handle for the call.
//
// Return value:
// true if GC can't happen within this call, false otherwise.
bool emitter::emitNoGChelper(CORINFO_METHOD_HANDLE methHnd)
{
CorInfoHelpFunc helpFunc = Compiler::eeGetHelperNum(methHnd);
if (helpFunc == CORINFO_HELP_UNDEF)
{
return false;
}
return emitNoGChelper(helpFunc);
}
/*****************************************************************************
*
* Mark the current spot as having a label.
*/
void* emitter::emitAddLabel(VARSET_VALARG_TP GCvars,
regMaskTP gcrefRegs,
regMaskTP byrefRegs,
bool isFinallyTarget DEBUG_ARG(BasicBlock* block))
{
/* Create a new IG if the current one is non-empty */
if (emitCurIGnonEmpty())
{
emitNxtIG();
}
#if defined(DEBUG) || defined(LATE_DISASM)
else
{
emitCurIG->igWeight = getCurrentBlockWeight();
emitCurIG->igPerfScore = 0.0;
}
#endif
VarSetOps::Assign(emitComp, emitThisGCrefVars, GCvars);
VarSetOps::Assign(emitComp, emitInitGCrefVars, GCvars);
emitThisGCrefRegs = emitInitGCrefRegs = gcrefRegs;
emitThisByrefRegs = emitInitByrefRegs = byrefRegs;
#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
if (isFinallyTarget)
{
emitCurIG->igFlags |= IGF_FINALLY_TARGET;
}
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
#ifdef DEBUG
JITDUMP("Mapped " FMT_BB " to %s\n", block->bbNum, emitLabelString(emitCurIG));
if (EMIT_GC_VERBOSE)
{
printf("Label: IG%02u, GCvars=%s ", emitCurIG->igNum, VarSetOps::ToString(emitComp, GCvars));
dumpConvertedVarSet(emitComp, GCvars);
printf(", gcrefRegs=");
printRegMaskInt(gcrefRegs);
emitDispRegSet(gcrefRegs);
printf(", byrefRegs=");
printRegMaskInt(byrefRegs);
emitDispRegSet(byrefRegs);
printf("\n");
}
#endif
return emitCurIG;
}
void* emitter::emitAddInlineLabel()
{
if (emitCurIGnonEmpty())
{
emitNxtIG(true);
}
return emitCurIG;
}
#ifdef DEBUG
//-----------------------------------------------------------------------------
// emitPrintLabel: Print the assembly label for an insGroup. We could use emitter::emitLabelString()
// to be consistent, but that seems silly.
//
void emitter::emitPrintLabel(insGroup* ig)
{
printf("G_M%03u_IG%02u", emitComp->compMethodID, ig->igNum);
}
//-----------------------------------------------------------------------------
// emitLabelString: Return label string for an insGroup, for use in debug output.
// This can be called up to four times in a single 'printf' before the static buffers
// get reused.
//
// Returns:
// String with insGroup label
//
const char* emitter::emitLabelString(insGroup* ig)
{
const int TEMP_BUFFER_LEN = 40;
static unsigned curBuf = 0;
static char buf[4][TEMP_BUFFER_LEN];
const char* retbuf;
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "G_M%03u_IG%02u", emitComp->compMethodID, ig->igNum);
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}
#endif // DEBUG
#if defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
// Does the argument location point to an IG at the end of a function or funclet?
// We can ignore the codePos part of the location, since it doesn't affect the
// determination. If 'emitLocNextFragment' is non-NULL, it indicates the first
// IG of the next fragment, so it represents a function end.
bool emitter::emitIsFuncEnd(emitLocation* emitLoc, emitLocation* emitLocNextFragment /* = NULL */)
{
assert(emitLoc);
insGroup* ig = emitLoc->GetIG();
assert(ig);
// Are we at the end of the IG list?
if ((emitLocNextFragment != NULL) && (ig->igNext == emitLocNextFragment->GetIG()))
return true;
// Safety check
if (ig->igNext == NULL)
return true;
// Is the next IG the start of a funclet prolog?
if (ig->igNext->igFlags & IGF_FUNCLET_PROLOG)
return true;
#if defined(FEATURE_EH_FUNCLETS)
// Is the next IG a placeholder group for a funclet prolog?
if ((ig->igNext->igFlags & IGF_PLACEHOLDER) && (ig->igNext->igPhData->igPhType == IGPT_FUNCLET_PROLOG))
{
return true;
}
#endif // FEATURE_EH_FUNCLETS
return false;
}
/*****************************************************************************
*
* Split the region from 'startLoc' to 'endLoc' into fragments by calling
* a callback function to indicate the beginning of a fragment. The initial code,
* starting at 'startLoc', doesn't get a callback, but the first code fragment,
* about 'maxSplitSize' bytes out does, as does the beginning of each fragment
* after that. There is no callback for the end (only the beginning of the last
* fragment gets a callback). A fragment must contain at least one instruction
* group. It should be smaller than 'maxSplitSize', although it may be larger to
* satisfy the "at least one instruction group" rule. Do not split prologs or
* epilogs. (Currently, prologs exist in a single instruction group at the main
* function beginning, so they aren't split. Funclets, however, might span IGs,
* so we can't split in between them.)
*
* Note that the locations must be the start of instruction groups; the part of
* the location indicating offset within a group must be zero.
*
* If 'startLoc' is NULL, it means the start of the code.
* If 'endLoc' is NULL, it means the end of the code.
*/
void emitter::emitSplit(emitLocation* startLoc,
emitLocation* endLoc,
UNATIVE_OFFSET maxSplitSize,
void* context,
emitSplitCallbackType callbackFunc)
{
insGroup* igStart = (startLoc == NULL) ? emitIGlist : startLoc->GetIG();
insGroup* igEnd = (endLoc == NULL) ? NULL : endLoc->GetIG();
insGroup* igPrev;
insGroup* ig;
insGroup* igLastReported;
insGroup* igLastCandidate;
UNATIVE_OFFSET curSize;
UNATIVE_OFFSET candidateSize;
for (igPrev = NULL, ig = igLastReported = igStart, igLastCandidate = NULL, candidateSize = 0, curSize = 0;
ig != igEnd && ig != NULL; igPrev = ig, ig = ig->igNext)
{
// Keep looking until we've gone past the maximum split size
if (curSize >= maxSplitSize)
{
bool reportCandidate = true;
// Is there a candidate?
if (igLastCandidate == NULL)
{
#ifdef DEBUG
if (EMITVERBOSE)
printf("emitSplit: can't split at IG%02u; we don't have a candidate to report\n", ig->igNum);
#endif
reportCandidate = false;
}
// Don't report the same thing twice (this also happens for the first block, since igLastReported is
// initialized to igStart).
if (igLastCandidate == igLastReported)
{
#ifdef DEBUG
if (EMITVERBOSE)
printf("emitSplit: can't split at IG%02u; we already reported it\n", igLastCandidate->igNum);
#endif
reportCandidate = false;
}
// Don't report a zero-size candidate. This will only occur in a stress mode with JitSplitFunctionSize
// set to something small, and a zero-sized IG (possibly inserted for use by the alignment code). Normally,
// the split size will be much larger than the maximum size of an instruction group. The invariant we want
// to maintain is that each fragment contains a non-zero amount of code.
if (reportCandidate && (candidateSize == 0))
{
#ifdef DEBUG
if (EMITVERBOSE)
printf("emitSplit: can't split at IG%02u; zero-sized candidate\n", igLastCandidate->igNum);
#endif
reportCandidate = false;
}
// Report it!
if (reportCandidate)
{
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("emitSplit: split at IG%02u is size %d, %s than requested maximum size of %d\n",
igLastCandidate->igNum, candidateSize, (candidateSize >= maxSplitSize) ? "larger" : "less",
maxSplitSize);
}
#endif
// hand memory ownership to the callback function
emitLocation* pEmitLoc = new (emitComp, CMK_Unknown) emitLocation(igLastCandidate);
callbackFunc(context, pEmitLoc);
igLastReported = igLastCandidate;
igLastCandidate = NULL;
curSize -= candidateSize;
}
}
// Update the current candidate to be this block, if it isn't in the middle of a
// prolog or epilog, which we can't split. All we know is that certain
// IGs are marked as prolog or epilog. We don't actually know if two adjacent
// IGs are part of the *same* prolog or epilog, so we have to assume they are.
if (igPrev && (((igPrev->igFlags & IGF_FUNCLET_PROLOG) && (ig->igFlags & IGF_FUNCLET_PROLOG)) ||
((igPrev->igFlags & IGF_EPILOG) && (ig->igFlags & IGF_EPILOG))))
{
// We can't update the candidate
}
else
{
igLastCandidate = ig;
candidateSize = curSize;
}
curSize += ig->igSize;
} // end for loop
}
/*****************************************************************************
*
* Given an instruction group, find the array of instructions (instrDesc) and
* number of instructions in the array. If the IG is the current IG, we assume
* that igData does NOT hold the instructions; they are unsaved and pointed
* to by emitCurIGfreeBase.
*
* This function can't be called for placeholder groups, which have no instrDescs.
*/
void emitter::emitGetInstrDescs(insGroup* ig, instrDesc** id, int* insCnt)
{
assert(!(ig->igFlags & IGF_PLACEHOLDER));
if (ig == emitCurIG)
{
*id = (instrDesc*)emitCurIGfreeBase;
*insCnt = emitCurIGinsCnt;
}
else
{
*id = (instrDesc*)ig->igData;
*insCnt = ig->igInsCnt;
}
assert(*id);
}
/*****************************************************************************
*
* Given a location (an 'emitLocation'), find the instruction group (IG) and
* instruction descriptor (instrDesc) corresponding to that location. Returns
* 'true' if there is an instruction, 'false' if there is no instruction
* (i.e., we're at the end of the instruction list). Also, optionally return
* the number of instructions that follow that instruction in the IG (in *pinsRemaining,
* if pinsRemaining is non-NULL), which can be used for iterating over the
* remaining instrDescs in the IG.
*
* We assume that emitCurIG points to the end of the instructions we care about.
* For the prologs or epilogs, it points to the last IG of the prolog or epilog
* that is being generated. For body code gen, it points to the place we are currently
* adding code, namely, the end of currently generated code.
*/
bool emitter::emitGetLocationInfo(emitLocation* emitLoc,
insGroup** pig,
instrDesc** pid,
int* pinsRemaining /* = NULL */)
{
assert(emitLoc != nullptr);
assert(emitLoc->Valid());
assert(emitLoc->GetIG() != nullptr);
assert(pig != nullptr);
assert(pid != nullptr);
insGroup* ig = emitLoc->GetIG();
instrDesc* id;
int insNum = emitLoc->GetInsNum();
int insCnt;
emitGetInstrDescs(ig, &id, &insCnt);
assert(insNum <= insCnt);
// There is a special-case: if the insNum points to the end, then we "wrap" and
// consider that the instruction it is pointing at is actually the first instruction
// of the next non-empty IG (which has its own valid emitLocation). This handles the
// case where you capture a location, then the next instruction creates a new IG.
if (insNum == insCnt)
{
if (ig == emitCurIG)
{
// No instructions beyond the current location.
return false;
}
for (ig = ig->igNext; ig; ig = ig->igNext)
{
emitGetInstrDescs(ig, &id, &insCnt);
if (insCnt > 0)
{
insNum = 0; // Pretend the index is 0 -- the first instruction
break;
}
if (ig == emitCurIG)
{
// There aren't any instructions in the current IG, and this is
// the current location, so we're at the end.
return false;
}
}
if (ig == NULL)
{
// 'ig' can't be NULL, or we went past the current IG represented by 'emitCurIG'.
// Perhaps 'loc' was corrupt coming in?
noway_assert(!"corrupt emitter location");
return false;
}
}
// Now find the instrDesc within this group that corresponds to the location
assert(insNum < insCnt);
int i;
for (i = 0; i != insNum; ++i)
{
castto(id, BYTE*) += emitSizeOfInsDsc(id);
}
// Return the info we found
*pig = ig;
*pid = id;
if (pinsRemaining)
{
*pinsRemaining = insCnt - insNum - 1;
}
return true;
}
/*****************************************************************************
*
* Compute the next instrDesc, either in this IG, or in a subsequent IG. 'id'
* will point to this instrDesc. 'ig' and 'insRemaining' will also be updated.
* Returns true if there is an instruction, or false if we've iterated over all
* the instructions up to the current instruction (based on 'emitCurIG').
*/
bool emitter::emitNextID(insGroup*& ig, instrDesc*& id, int& insRemaining)
{
if (insRemaining > 0)
{
castto(id, BYTE*) += emitSizeOfInsDsc(id);
--insRemaining;
return true;
}
// We're out of instrDesc in 'ig'. Is this the current IG? If so, we're done.
if (ig == emitCurIG)
{
return false;
}
for (ig = ig->igNext; ig; ig = ig->igNext)
{
int insCnt;
emitGetInstrDescs(ig, &id, &insCnt);
if (insCnt > 0)
{
insRemaining = insCnt - 1;
return true;
}
if (ig == emitCurIG)
{
return false;
}
}
return false;
}
/*****************************************************************************
*
* Walk instrDesc's from the location given by 'locFrom', up to the current location.
* For each instruction, call the callback function 'processFunc'. 'context' is simply
* passed through to the callback function.
*/
void emitter::emitWalkIDs(emitLocation* locFrom, emitProcessInstrFunc_t processFunc, void* context)
{
insGroup* ig;
instrDesc* id;
int insRemaining;
if (!emitGetLocationInfo(locFrom, &ig, &id, &insRemaining))
return; // no instructions at the 'from' location
do
{
// process <<id>>
(*processFunc)(id, context);
} while (emitNextID(ig, id, insRemaining));
}
/*****************************************************************************
*
* A callback function for emitWalkIDs() that calls Compiler::unwindNop().
*/
void emitter::emitGenerateUnwindNop(instrDesc* id, void* context)
{
Compiler* comp = (Compiler*)context;
#if defined(TARGET_ARM)
comp->unwindNop(id->idCodeSize());
#elif defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64)
comp->unwindNop();
#endif // defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64)
}
/*****************************************************************************
*
* emitUnwindNopPadding: call unwindNop() for every instruction from a given
* location 'emitLoc' up to the current location.
*/
void emitter::emitUnwindNopPadding(emitLocation* locFrom, Compiler* comp)
{
emitWalkIDs(locFrom, emitGenerateUnwindNop, comp);
}
#endif // TARGET_ARMARCH || TARGET_LOONGARCH64
#if defined(TARGET_ARM)
/*****************************************************************************
*
* Return the instruction size in bytes for the instruction at the specified location.
* This is used to assert that the unwind code being generated on ARM has the
* same size as the instruction for which it is being generated (since on ARM
* the unwind codes have a one-to-one relationship with instructions, and the
* unwind codes have an implicit instruction size that must match the instruction size.)
* An instruction must exist at the specified location.
*/
unsigned emitter::emitGetInstructionSize(emitLocation* emitLoc)
{
insGroup* ig;
instrDesc* id;
bool anyInstrs = emitGetLocationInfo(emitLoc, &ig, &id);
assert(anyInstrs); // There better be an instruction at this location (otherwise, we're at the end of the
// instruction list)
return id->idCodeSize();
}
#endif // defined(TARGET_ARM)
/*****************************************************************************/
#ifdef DEBUG
/*****************************************************************************
*
* Returns the name for the register to use to access frame based variables
*/
const char* emitter::emitGetFrameReg()
{
if (emitHasFramePtr)
{
return STR_FPBASE;
}
else
{
return STR_SPBASE;
}
}
/*****************************************************************************
*
* Display a register set in a readable form.
*/
void emitter::emitDispRegSet(regMaskTP regs)
{
regNumber reg;
bool sp = false;
printf(" {");
for (reg = REG_FIRST; reg < ACTUAL_REG_COUNT; reg = REG_NEXT(reg))
{
if ((regs & genRegMask(reg)) == 0)
{
continue;
}
if (sp)
{
printf(" ");
}
else
{
sp = true;
}
printf("%s", emitRegName(reg));
}
printf("}");
}
/*****************************************************************************
*
* Display the current GC ref variable set in a readable form.
*/
void emitter::emitDispVarSet()
{
unsigned vn;
int of;
bool sp = false;
for (vn = 0, of = emitGCrFrameOffsMin; vn < emitGCrFrameOffsCnt; vn += 1, of += TARGET_POINTER_SIZE)
{
if (emitGCrFrameLiveTab[vn])
{
if (sp)
{
printf(" ");
}
else
{
sp = true;
}
printf("[%s", emitGetFrameReg());
if (of < 0)
{
printf("-%02XH", -of);
}
else if (of > 0)
{
printf("+%02XH", +of);
}
printf("]");
}
}
if (!sp)
{
printf("none");
}
}
/*****************************************************************************/
#endif // DEBUG
#if MULTIREG_HAS_SECOND_GC_RET
//------------------------------------------------------------------------
// emitSetSecondRetRegGCType: Sets the GC type of the second return register for instrDescCGCA struct.
//
// Arguments:
// id - The large call instr descriptor to set the second GC return register type on.
// secondRetSize - The EA_SIZE for second return register type.
//
// Return Value:
// None
//
void emitter::emitSetSecondRetRegGCType(instrDescCGCA* id, emitAttr secondRetSize)
{
if (EA_IS_GCREF(secondRetSize))
{
id->idSecondGCref(GCT_GCREF);
}
else if (EA_IS_BYREF(secondRetSize))
{
id->idSecondGCref(GCT_BYREF);
}
else
{
id->idSecondGCref(GCT_NONE);
}
}
#endif // MULTIREG_HAS_SECOND_GC_RET
/*****************************************************************************
*
* Allocate an instruction descriptor for an indirect call.
*
* We use two different descriptors to save space - the common case records
* no GC variables and has both a very small argument count and an address
* mode displacement; the other case records the current GC var set,
* the call scope, and an arbitrarily large argument count and the
* address mode displacement.
*/
emitter::instrDesc* emitter::emitNewInstrCallInd(int argCnt,
ssize_t disp,
VARSET_VALARG_TP GCvars,
regMaskTP gcrefRegs,
regMaskTP byrefRegs,
emitAttr retSizeIn
MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(emitAttr secondRetSize))
{
emitAttr retSize = (retSizeIn != EA_UNKNOWN) ? retSizeIn : EA_PTRSIZE;
bool gcRefRegsInScratch = ((gcrefRegs & RBM_CALLEE_TRASH) != 0);
// Allocate a larger descriptor if any GC values need to be saved
// or if we have an absurd number of arguments or a large address
// mode displacement, or we have some byref registers
//
// On Amd64 System V OSs a larger descriptor is also needed if the
// call returns a two-register-returned struct and the second
// register (RDX) is a GCRef or ByRef pointer.
if (!VarSetOps::IsEmpty(emitComp, GCvars) || // any frame GCvars live
(gcRefRegsInScratch) || // any register gc refs live in scratch regs
(byrefRegs != 0) || // any register byrefs live
#ifdef TARGET_XARCH
(disp < AM_DISP_MIN) || // displacement too negative
(disp > AM_DISP_MAX) || // displacement too positive
#endif // TARGET_XARCH
(argCnt > ID_MAX_SMALL_CNS) || // too many args
(argCnt < 0) // caller pops arguments
// There is a second ref/byref return register.
MULTIREG_HAS_SECOND_GC_RET_ONLY(|| EA_IS_GCREF_OR_BYREF(secondRetSize)))
{
instrDescCGCA* id;
id = emitAllocInstrCGCA(retSize);
id->idSetIsLargeCall();
VarSetOps::Assign(emitComp, id->idcGCvars, GCvars);
id->idcGcrefRegs = gcrefRegs;
id->idcByrefRegs = byrefRegs;
id->idcArgCnt = argCnt;
id->idcDisp = disp;
#if MULTIREG_HAS_SECOND_GC_RET
emitSetSecondRetRegGCType(id, secondRetSize);
#endif // MULTIREG_HAS_SECOND_GC_RET
return id;
}
else
{
instrDesc* id;
id = emitNewInstrCns(retSize, argCnt);
/* Make sure we didn't waste space unexpectedly */
assert(!id->idIsLargeCns());
#ifdef TARGET_XARCH
/* Store the displacement and make sure the value fit */
id->idAddr()->iiaAddrMode.amDisp = disp;
assert(id->idAddr()->iiaAddrMode.amDisp == disp);
#endif // TARGET_XARCH
/* Save the the live GC registers in the unused register fields */
emitEncodeCallGCregs(gcrefRegs, id);
return id;
}
}
/*****************************************************************************
*
* Allocate an instruction descriptor for a direct call.
*
* We use two different descriptors to save space - the common case records
* with no GC variables or byrefs and has a very small argument count, and no
* explicit scope;
* the other case records the current GC var set, the call scope,
* and an arbitrarily large argument count.
*/
emitter::instrDesc* emitter::emitNewInstrCallDir(int argCnt,
VARSET_VALARG_TP GCvars,
regMaskTP gcrefRegs,
regMaskTP byrefRegs,
emitAttr retSizeIn
MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(emitAttr secondRetSize))
{
emitAttr retSize = (retSizeIn != EA_UNKNOWN) ? retSizeIn : EA_PTRSIZE;
// Allocate a larger descriptor if new GC values need to be saved
// or if we have an absurd number of arguments or if we need to
// save the scope.
//
// On Amd64 System V OSs a larger descriptor is also needed if the
// call returns a two-register-returned struct and the second
// register (RDX) is a GCRef or ByRef pointer.
bool gcRefRegsInScratch = ((gcrefRegs & RBM_CALLEE_TRASH) != 0);
if (!VarSetOps::IsEmpty(emitComp, GCvars) || // any frame GCvars live
gcRefRegsInScratch || // any register gc refs live in scratch regs
(byrefRegs != 0) || // any register byrefs live
(argCnt > ID_MAX_SMALL_CNS) || // too many args
(argCnt < 0) // caller pops arguments
// There is a second ref/byref return register.
MULTIREG_HAS_SECOND_GC_RET_ONLY(|| EA_IS_GCREF_OR_BYREF(secondRetSize)))
{
instrDescCGCA* id = emitAllocInstrCGCA(retSize);
// printf("Direct call with GC vars / big arg cnt / explicit scope\n");
id->idSetIsLargeCall();
VarSetOps::Assign(emitComp, id->idcGCvars, GCvars);
id->idcGcrefRegs = gcrefRegs;
id->idcByrefRegs = byrefRegs;
id->idcDisp = 0;
id->idcArgCnt = argCnt;
#if MULTIREG_HAS_SECOND_GC_RET
emitSetSecondRetRegGCType(id, secondRetSize);
#endif // MULTIREG_HAS_SECOND_GC_RET
return id;
}
else
{
instrDesc* id = emitNewInstrCns(retSize, argCnt);
// printf("Direct call w/o GC vars / big arg cnt / explicit scope\n");
/* Make sure we didn't waste space unexpectedly */
assert(!id->idIsLargeCns());
/* Save the the live GC registers in the unused register fields */
emitEncodeCallGCregs(gcrefRegs, id);
return id;
}
}
/*****************************************************************************/
#ifdef DEBUG
/*****************************************************************************
*
* Return a string with the name of the given class field (blank string (not
* NULL) is returned when the name isn't available).
*/
const char* emitter::emitFldName(CORINFO_FIELD_HANDLE fieldVal)
{
if (emitComp->opts.varNames)
{
const char* memberName;
const char* className;
const int TEMP_BUFFER_LEN = 1024;
static char buff[TEMP_BUFFER_LEN];
memberName = emitComp->eeGetFieldName(fieldVal, &className);
sprintf_s(buff, TEMP_BUFFER_LEN, "'<%s>.%s'", className, memberName);
return buff;
}
else
{
return "";
}
}
/*****************************************************************************
*
* Return a string with the name of the given function (blank string (not
* NULL) is returned when the name isn't available).
*/
const char* emitter::emitFncName(CORINFO_METHOD_HANDLE methHnd)
{
return emitComp->eeGetMethodFullName(methHnd);
}
#endif // DEBUG
/*****************************************************************************
*
* Be very careful, some instruction descriptors are allocated as "tiny" and
* don't have some of the tail fields of instrDesc (in particular, "idInfo").
*/
const BYTE emitter::emitFmtToOps[] = {
#define IF_DEF(en, op1, op2) ID_OP_##op2,
#include "emitfmts.h"
};
#ifdef DEBUG
const unsigned emitter::emitFmtCount = ArrLen(emitFmtToOps);
#endif
//------------------------------------------------------------------------
// Interleaved GC info dumping.
// We'll attempt to line this up with the opcode, which indented differently for
// diffable and non-diffable dumps.
// This is approximate, and is better tuned for disassembly than for jitdumps.
// See emitDispInsHex().
#ifdef TARGET_AMD64
const size_t basicIndent = 7;
const size_t hexEncodingSize = 21;
#elif defined(TARGET_X86)
const size_t basicIndent = 7;
const size_t hexEncodingSize = 13;
#elif defined(TARGET_ARM64)
const size_t basicIndent = 12;
const size_t hexEncodingSize = 19;
#elif defined(TARGET_ARM)
const size_t basicIndent = 12;
const size_t hexEncodingSize = 11;
#elif defined(TARGET_LOONGARCH64)
const size_t basicIndent = 12;
const size_t hexEncodingSize = 19;
#endif
#ifdef DEBUG
//------------------------------------------------------------------------
// emitDispInsIndent: Print indentation corresponding to an instruction's
// indentation.
//
void emitter::emitDispInsIndent()
{
size_t indent = emitComp->opts.disDiffable ? basicIndent : basicIndent + hexEncodingSize;
printf("%.*s", indent, " ");
}
//------------------------------------------------------------------------
// emitDispGCDeltaTitle: Print an appropriately indented title for a GC info delta
//
// Arguments:
// title - The type of GC info delta we're printing
//
void emitter::emitDispGCDeltaTitle(const char* title)
{
emitDispInsIndent();
printf("; %s", title);
}
//------------------------------------------------------------------------
// emitDispGCRegDelta: Print a delta for GC registers
//
// Arguments:
// title - The type of GC info delta we're printing
// prevRegs - The live GC registers before the recent instruction.
// curRegs - The live GC registers after the recent instruction.
//
void emitter::emitDispGCRegDelta(const char* title, regMaskTP prevRegs, regMaskTP curRegs)
{
if (prevRegs != curRegs)
{
emitDispGCDeltaTitle(title);
regMaskTP sameRegs = prevRegs & curRegs;
regMaskTP removedRegs = prevRegs - sameRegs;
regMaskTP addedRegs = curRegs - sameRegs;
if (removedRegs != RBM_NONE)
{
printf(" -");
dspRegMask(removedRegs);
}
if (addedRegs != RBM_NONE)
{
printf(" +");
dspRegMask(addedRegs);
}
printf("\n");
}
}
//------------------------------------------------------------------------
// emitDispGCVarDelta: Print a delta for GC variables
//
// Notes:
// Uses the debug-only variables 'debugThisGCrefVars' and 'debugPrevGCrefVars'.
// to print deltas from the last time this was called.
//
void emitter::emitDispGCVarDelta()
{
if (!VarSetOps::Equal(emitComp, debugPrevGCrefVars, debugThisGCrefVars))
{
emitDispGCDeltaTitle("GC ptr vars");
VARSET_TP sameGCrefVars(VarSetOps::Intersection(emitComp, debugPrevGCrefVars, debugThisGCrefVars));
VARSET_TP GCrefVarsRemoved(VarSetOps::Diff(emitComp, debugPrevGCrefVars, debugThisGCrefVars));
VARSET_TP GCrefVarsAdded(VarSetOps::Diff(emitComp, debugThisGCrefVars, debugPrevGCrefVars));
if (!VarSetOps::IsEmpty(emitComp, GCrefVarsRemoved))
{
printf(" -");
dumpConvertedVarSet(emitComp, GCrefVarsRemoved);
}
if (!VarSetOps::IsEmpty(emitComp, GCrefVarsAdded))
{
printf(" +");
dumpConvertedVarSet(emitComp, GCrefVarsAdded);
}
VarSetOps::Assign(emitComp, debugPrevGCrefVars, debugThisGCrefVars);
printf("\n");
}
}
//------------------------------------------------------------------------
// emitDispRegPtrListDelta: Print a delta for regPtrDsc GC transitions
//
// Notes:
// Uses the debug-only variable 'debugPrevRegPtrDsc' to print deltas from the last time this was
// called.
//
void emitter::emitDispRegPtrListDelta()
{
// Dump any deltas in regPtrDsc's for outgoing args; these aren't captured in the other sets.
if (debugPrevRegPtrDsc != codeGen->gcInfo.gcRegPtrLast)
{
for (regPtrDsc* dsc = (debugPrevRegPtrDsc == nullptr) ? codeGen->gcInfo.gcRegPtrList
: debugPrevRegPtrDsc->rpdNext;
dsc != nullptr; dsc = dsc->rpdNext)
{
// The non-arg regPtrDscs are reflected in the register sets debugPrevGCrefRegs/emitThisGCrefRegs
// and debugPrevByrefRegs/emitThisByrefRegs, and dumped using those sets.
if (!dsc->rpdArg)
{
continue;
}
emitDispGCDeltaTitle(GCtypeStr((GCtype)dsc->rpdGCtype));
switch (dsc->rpdArgType)
{
case GCInfo::rpdARG_PUSH:
#if FEATURE_FIXED_OUT_ARGS
// For FEATURE_FIXED_OUT_ARGS, we report a write to the outgoing arg area
// as a 'rpdARG_PUSH' even though it doesn't actually push. Note that
// we also have 'rpdARG_POP's even though we don't actually pop, and
// we can have those even if there's no stack arg.
printf(" arg write");
break;
#else
printf(" arg push %u", dsc->rpdPtrArg);
break;
#endif
case GCInfo::rpdARG_POP:
printf(" arg pop %u", dsc->rpdPtrArg);
break;
case GCInfo::rpdARG_KILL:
printf(" arg kill %u", dsc->rpdPtrArg);
break;
default:
printf(" arg ??? %u", dsc->rpdPtrArg);
break;
}
printf("\n");
}
debugPrevRegPtrDsc = codeGen->gcInfo.gcRegPtrLast;
}
}
//------------------------------------------------------------------------
// emitDispGCInfoDelta: Print a delta for GC info
//
void emitter::emitDispGCInfoDelta()
{
emitDispGCRegDelta("gcrRegs", debugPrevGCrefRegs, emitThisGCrefRegs);
emitDispGCRegDelta("byrRegs", debugPrevByrefRegs, emitThisByrefRegs);
debugPrevGCrefRegs = emitThisGCrefRegs;
debugPrevByrefRegs = emitThisByrefRegs;
emitDispGCVarDelta();
emitDispRegPtrListDelta();
}
/*****************************************************************************
*
* Display the current instruction group list.
*/
void emitter::emitDispIGflags(unsigned flags)
{
if (flags & IGF_GC_VARS)
{
printf(", gcvars");
}
if (flags & IGF_BYREF_REGS)
{
printf(", byref");
}
#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
if (flags & IGF_FINALLY_TARGET)
{
printf(", ftarget");
}
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
if (flags & IGF_FUNCLET_PROLOG)
{
printf(", funclet prolog");
}
if (flags & IGF_FUNCLET_EPILOG)
{
printf(", funclet epilog");
}
if (flags & IGF_EPILOG)
{
printf(", epilog");
}
if (flags & IGF_NOGCINTERRUPT)
{
printf(", nogc");
}
if (flags & IGF_UPD_ISZ)
{
printf(", isz");
}
if (flags & IGF_EXTEND)
{
printf(", extend");
}
if (flags & IGF_HAS_ALIGN)
{
printf(", align");
}
}
void emitter::emitDispIG(insGroup* ig, insGroup* igPrev, bool verbose)
{
const int TEMP_BUFFER_LEN = 40;
char buff[TEMP_BUFFER_LEN];
sprintf_s(buff, TEMP_BUFFER_LEN, "%s: ", emitLabelString(ig));
printf("%s; ", buff);
// We dump less information when we're only interleaving GC info with a disassembly listing,
// than we do in the jitdump case. (Note that the verbose argument to this method is
// distinct from the verbose on Compiler.)
bool jitdump = emitComp->verbose;
if (jitdump && ((igPrev == nullptr) || (igPrev->igFuncIdx != ig->igFuncIdx)))
{
printf("func=%02u, ", ig->igFuncIdx);
}
if (ig->igFlags & IGF_PLACEHOLDER)
{
insGroup* igPh = ig;
const char* pszType;
switch (igPh->igPhData->igPhType)
{
case IGPT_PROLOG:
pszType = "prolog";
break;
case IGPT_EPILOG:
pszType = "epilog";
break;
#if defined(FEATURE_EH_FUNCLETS)
case IGPT_FUNCLET_PROLOG:
pszType = "funclet prolog";
break;
case IGPT_FUNCLET_EPILOG:
pszType = "funclet epilog";
break;
#endif // FEATURE_EH_FUNCLETS
default:
pszType = "UNKNOWN";
break;
}
printf("%s placeholder, next placeholder=", pszType);
if (igPh->igPhData->igPhNext)
{
printf("IG%02u ", igPh->igPhData->igPhNext->igNum);
}
else
{
printf("<END>");
}
if (igPh->igPhData->igPhBB != nullptr)
{
printf(", %s", igPh->igPhData->igPhBB->dspToString());
}
emitDispIGflags(igPh->igFlags);
if (ig == emitCurIG)
{
printf(" <-- Current IG");
}
if (igPh == emitPlaceholderList)
{
printf(" <-- First placeholder");
}
if (igPh == emitPlaceholderLast)
{
printf(" <-- Last placeholder");
}
printf("\n");
printf("%*s; PrevGCVars=%s ", strlen(buff), "",
VarSetOps::ToString(emitComp, igPh->igPhData->igPhPrevGCrefVars));
dumpConvertedVarSet(emitComp, igPh->igPhData->igPhPrevGCrefVars);
printf(", PrevGCrefRegs=");
printRegMaskInt(igPh->igPhData->igPhPrevGCrefRegs);
emitDispRegSet(igPh->igPhData->igPhPrevGCrefRegs);
printf(", PrevByrefRegs=");
printRegMaskInt(igPh->igPhData->igPhPrevByrefRegs);
emitDispRegSet(igPh->igPhData->igPhPrevByrefRegs);
printf("\n");
printf("%*s; InitGCVars=%s ", strlen(buff), "",
VarSetOps::ToString(emitComp, igPh->igPhData->igPhInitGCrefVars));
dumpConvertedVarSet(emitComp, igPh->igPhData->igPhInitGCrefVars);
printf(", InitGCrefRegs=");
printRegMaskInt(igPh->igPhData->igPhInitGCrefRegs);
emitDispRegSet(igPh->igPhData->igPhInitGCrefRegs);
printf(", InitByrefRegs=");
printRegMaskInt(igPh->igPhData->igPhInitByrefRegs);
emitDispRegSet(igPh->igPhData->igPhInitByrefRegs);
printf("\n");
assert(!(ig->igFlags & IGF_GC_VARS));
assert(!(ig->igFlags & IGF_BYREF_REGS));
}
else
{
const char* separator = "";
if (jitdump)
{
printf("%soffs=%06XH, size=%04XH", separator, ig->igOffs, ig->igSize);
separator = ", ";
}
if (emitComp->compCodeGenDone)
{
printf("%sbbWeight=%s PerfScore %.2f", separator, refCntWtd2str(ig->igWeight), ig->igPerfScore);
separator = ", ";
}
if (ig->igFlags & IGF_GC_VARS)
{
printf("%sgcVars=%s ", separator, VarSetOps::ToString(emitComp, ig->igGCvars()));
dumpConvertedVarSet(emitComp, ig->igGCvars());
separator = ", ";
}
if (!(ig->igFlags & IGF_EXTEND))
{
printf("%sgcrefRegs=", separator);
printRegMaskInt(ig->igGCregs);
emitDispRegSet(ig->igGCregs);
separator = ", ";
}
if (ig->igFlags & IGF_BYREF_REGS)
{
printf("%sbyrefRegs=", separator);
printRegMaskInt(ig->igByrefRegs());
emitDispRegSet(ig->igByrefRegs());
separator = ", ";
}
#if FEATURE_LOOP_ALIGN
if (ig->igLoopBackEdge != nullptr)
{
printf("%sloop=IG%02u", separator, ig->igLoopBackEdge->igNum);
separator = ", ";
}
#endif // FEATURE_LOOP_ALIGN
if (jitdump && !ig->igBlocks.empty())
{
for (auto block : ig->igBlocks)
{
printf("%s%s", separator, block->dspToString());
separator = ", ";
}
}
emitDispIGflags(ig->igFlags);
if (ig == emitCurIG)
{
printf(" <-- Current IG");
}
if (ig == emitPrologIG)
{
printf(" <-- Prolog IG");
}
printf("\n");
if (verbose)
{
BYTE* ins = ig->igData;
UNATIVE_OFFSET ofs = ig->igOffs;
unsigned cnt = ig->igInsCnt;
if (cnt)
{
printf("\n");
do
{
instrDesc* id = (instrDesc*)ins;
emitDispIns(id, false, true, false, ofs, nullptr, 0, ig);
ins += emitSizeOfInsDsc(id);
ofs += id->idCodeSize();
} while (--cnt);
printf("\n");
}
}
}
}
void emitter::emitDispIGlist(bool verbose)
{
insGroup* ig;
insGroup* igPrev;
for (igPrev = nullptr, ig = emitIGlist; ig; igPrev = ig, ig = ig->igNext)
{
emitDispIG(ig, igPrev, verbose);
}
}
void emitter::emitDispGCinfo()
{
printf("Emitter GC tracking info:");
printf("\n emitPrevGCrefVars ");
dumpConvertedVarSet(emitComp, emitPrevGCrefVars);
printf("\n emitPrevGCrefRegs(0x%p)=", dspPtr(&emitPrevGCrefRegs));
printRegMaskInt(emitPrevGCrefRegs);
emitDispRegSet(emitPrevGCrefRegs);
printf("\n emitPrevByrefRegs(0x%p)=", dspPtr(&emitPrevByrefRegs));
printRegMaskInt(emitPrevByrefRegs);
emitDispRegSet(emitPrevByrefRegs);
printf("\n emitInitGCrefVars ");
dumpConvertedVarSet(emitComp, emitInitGCrefVars);
printf("\n emitInitGCrefRegs(0x%p)=", dspPtr(&emitInitGCrefRegs));
printRegMaskInt(emitInitGCrefRegs);
emitDispRegSet(emitInitGCrefRegs);
printf("\n emitInitByrefRegs(0x%p)=", dspPtr(&emitInitByrefRegs));
printRegMaskInt(emitInitByrefRegs);
emitDispRegSet(emitInitByrefRegs);
printf("\n emitThisGCrefVars ");
dumpConvertedVarSet(emitComp, emitThisGCrefVars);
printf("\n emitThisGCrefRegs(0x%p)=", dspPtr(&emitThisGCrefRegs));
printRegMaskInt(emitThisGCrefRegs);
emitDispRegSet(emitThisGCrefRegs);
printf("\n emitThisByrefRegs(0x%p)=", dspPtr(&emitThisByrefRegs));
printRegMaskInt(emitThisByrefRegs);
emitDispRegSet(emitThisByrefRegs);
printf("\n\n");
}
#endif // DEBUG
/*****************************************************************************
*
* Issue the given instruction. Basically, this is just a thin wrapper around
* emitOutputInstr() that does a few debug checks.
*/
size_t emitter::emitIssue1Instr(insGroup* ig, instrDesc* id, BYTE** dp)
{
size_t is;
/* Record the beginning offset of the instruction */
BYTE* curInsAdr = *dp;
/* Issue the next instruction */
// printf("[S=%02u] " , emitCurStackLvl);
is = emitOutputInstr(ig, id, dp);
#if defined(DEBUG) || defined(LATE_DISASM)
float insExeCost = insEvaluateExecutionCost(id);
// All compPerfScore calculations must be performed using doubles
double insPerfScore = (double)(ig->igWeight / (double)BB_UNITY_WEIGHT) * insExeCost;
emitComp->info.compPerfScore += insPerfScore;
ig->igPerfScore += insPerfScore;
#endif // defined(DEBUG) || defined(LATE_DISASM)
// printf("[S=%02u]\n", emitCurStackLvl);
#if EMIT_TRACK_STACK_DEPTH
/*
If we're generating a full pointer map and the stack
is empty, there better not be any "pending" argument
push entries.
*/
assert(emitFullGCinfo == false || emitCurStackLvl != 0 || u2.emitGcArgTrackCnt == 0);
#endif
/* Did the size of the instruction match our expectations? */
UNATIVE_OFFSET actualSize = (UNATIVE_OFFSET)(*dp - curInsAdr);
unsigned estimatedSize = id->idCodeSize();
if (actualSize != estimatedSize)
{
// It is fatal to under-estimate the instruction size, except for alignment instructions
noway_assert(estimatedSize >= actualSize);
#if FEATURE_LOOP_ALIGN
// Should never over-estimate align instruction or any instruction before the last align instruction of a method
assert(id->idIns() != INS_align && emitCurIG->igNum > emitLastAlignedIgNum);
#endif
#if DEBUG_EMIT
if (EMITVERBOSE)
{
printf("Instruction predicted size = %u, actual = %u\n", estimatedSize, actualSize);
}
#endif // DEBUG_EMIT
// Add the shrinkage to the ongoing offset adjustment. This needs to happen during the
// processing of an instruction group, and not only at the beginning of an instruction
// group, or else the difference of IG sizes between debug and release builds can cause
// debug/non-debug asm diffs.
int offsShrinkage = estimatedSize - actualSize;
JITDUMP("Increasing size adj %d by %d => %d\n", emitOffsAdj, offsShrinkage, emitOffsAdj + offsShrinkage);
emitOffsAdj += offsShrinkage;
/* The instruction size estimate wasn't accurate; remember this */
ig->igFlags |= IGF_UPD_ISZ;
#if defined(TARGET_XARCH)
id->idCodeSize(actualSize);
#elif defined(TARGET_ARM)
// This is done as part of emitSetShortJump();
// insSize isz = emitInsSize(id->idInsFmt());
// id->idInsSize(isz);
#else
/* It is fatal to over-estimate the instruction size */
IMPL_LIMITATION("Over-estimated instruction size");
#endif
}
#ifdef DEBUG
/* Make sure the instruction descriptor size also matches our expectations */
if (is != emitSizeOfInsDsc(id))
{
printf("%s at %u: Expected size = %u , actual size = %u\n", emitIfName(id->idInsFmt()),
id->idDebugOnlyInfo()->idNum, is, emitSizeOfInsDsc(id));
assert(is == emitSizeOfInsDsc(id));
}
#endif // DEBUG
return is;
}
/*****************************************************************************
*
* Update the offsets of all the instruction groups (note: please don't be
* lazy and call this routine frequently, it walks the list of instruction
* groups and thus it isn't cheap).
*/
void emitter::emitRecomputeIGoffsets()
{
UNATIVE_OFFSET offs;
insGroup* ig;
for (ig = emitIGlist, offs = 0; ig; ig = ig->igNext)
{
ig->igOffs = offs;
assert(IsCodeAligned(ig->igOffs));
offs += ig->igSize;
}
/* Set the total code size */
emitTotalCodeSize = offs;
#ifdef DEBUG
emitCheckIGoffsets();
#endif
}
//----------------------------------------------------------------------------------------
// emitDispCommentForHandle:
// Displays a comment for a handle, e.g. displays a raw string for GTF_ICON_STR_HDL
// or a class name for GTF_ICON_CLASS_HDL
//
// Arguments:
// handle - a constant value to display a comment for
// flags - a flag that the describes the handle
//
void emitter::emitDispCommentForHandle(size_t handle, GenTreeFlags flag)
{
#ifdef DEBUG
if (handle == 0)
{
return;
}
#ifdef TARGET_XARCH
const char* commentPrefix = " ;";
#else
const char* commentPrefix = " //";
#endif
flag &= GTF_ICON_HDL_MASK;
const char* str = nullptr;
if (flag == GTF_ICON_STR_HDL)
{
const WCHAR* wstr = emitComp->eeGetCPString(handle);
// NOTE: eGetCPString always returns nullptr on Linux/ARM
if (wstr == nullptr)
{
str = "string handle";
}
else
{
const size_t actualLen = wcslen(wstr);
const size_t maxLength = 63;
const size_t newLen = min(maxLength, actualLen);
// +1 for null terminator
WCHAR buf[maxLength + 1] = {0};
wcsncpy(buf, wstr, newLen);
for (size_t i = 0; i < newLen; i++)
{
// Escape \n and \r symbols
if (buf[i] == L'\n' || buf[i] == L'\r')
{
buf[i] = L' ';
}
}
if (actualLen > maxLength)
{
// Append "..." for long strings
buf[maxLength - 3] = L'.';
buf[maxLength - 2] = L'.';
buf[maxLength - 1] = L'.';
}
printf("%s \"%S\"", commentPrefix, buf);
}
}
else if (flag == GTF_ICON_CLASS_HDL)
{
str = emitComp->eeGetClassName(reinterpret_cast<CORINFO_CLASS_HANDLE>(handle));
}
#ifndef TARGET_XARCH
// These are less useful for xarch:
else if (flag == GTF_ICON_CONST_PTR)
{
str = "const ptr";
}
else if (flag == GTF_ICON_GLOBAL_PTR)
{
str = "global ptr";
}
else if (flag == GTF_ICON_FIELD_HDL)
{
str = emitComp->eeGetFieldName(reinterpret_cast<CORINFO_FIELD_HANDLE>(handle));
}
else if (flag == GTF_ICON_STATIC_HDL)
{
str = "static handle";
}
else if (flag == GTF_ICON_METHOD_HDL)
{
str = emitComp->eeGetMethodFullName(reinterpret_cast<CORINFO_METHOD_HANDLE>(handle));
}
else if (flag == GTF_ICON_FTN_ADDR)
{
str = "function address";
}
else if (flag == GTF_ICON_TOKEN_HDL)
{
str = "token handle";
}
else
{
str = "unknown";
}
#endif // TARGET_XARCH
if (str != nullptr)
{
printf("%s %s", commentPrefix, str);
}
#endif // DEBUG
}
/*****************************************************************************
* Bind targets of relative jumps to choose the smallest possible encoding.
* X86 and AMD64 have a small and large encoding.
* ARM has a small, medium, and large encoding. The large encoding is a pseudo-op
* to handle greater range than the conditional branch instructions can handle.
* ARM64 has a small and large encoding for both conditional branch and loading label addresses.
* The large encodings are pseudo-ops that represent a multiple instruction sequence, similar to ARM. (Currently
* NYI).
* LoongArch64 has an individual implementation for emitJumpDistBind().
*/
#ifndef TARGET_LOONGARCH64
void emitter::emitJumpDistBind()
{
#ifdef DEBUG
if (emitComp->verbose)
{
printf("*************** In emitJumpDistBind()\n");
}
if (EMIT_INSTLIST_VERBOSE)
{
printf("\nInstruction list before jump distance binding:\n\n");
emitDispIGlist(true);
}
#endif
instrDescJmp* jmp;
UNATIVE_OFFSET minShortExtra; // The smallest offset greater than that required for a jump to be converted
// to a small jump. If it is small enough, we will iterate in hopes of
// converting those jumps we missed converting the first (or second...) time.
#if defined(TARGET_ARM)
UNATIVE_OFFSET minMediumExtra; // Same as 'minShortExtra', but for medium-sized jumps.
#endif // TARGET_ARM
UNATIVE_OFFSET adjIG;
UNATIVE_OFFSET adjLJ;
insGroup* lstIG;
#ifdef DEBUG
insGroup* prologIG = emitPrologIG;
#endif // DEBUG
int jmp_iteration = 1;
/*****************************************************************************/
/* If we iterate to look for more jumps to shorten, we start again here. */
/*****************************************************************************/
AGAIN:
#ifdef DEBUG
emitCheckIGoffsets();
#endif
/*
In the following loop we convert all jump targets from "BasicBlock *"
to "insGroup *" values. We also estimate which jumps will be short.
*/
#ifdef DEBUG
insGroup* lastIG = nullptr;
instrDescJmp* lastLJ = nullptr;
#endif
lstIG = nullptr;
adjLJ = 0;
adjIG = 0;
minShortExtra = (UNATIVE_OFFSET)-1;
#if defined(TARGET_ARM)
minMediumExtra = (UNATIVE_OFFSET)-1;
#endif // TARGET_ARM
for (jmp = emitJumpList; jmp; jmp = jmp->idjNext)
{
insGroup* jmpIG;
insGroup* tgtIG;
UNATIVE_OFFSET jsz; // size of the jump instruction in bytes
UNATIVE_OFFSET ssz = 0; // small jump size
NATIVE_OFFSET nsd = 0; // small jump max. neg distance
NATIVE_OFFSET psd = 0; // small jump max. pos distance
#if defined(TARGET_ARM)
UNATIVE_OFFSET msz = 0; // medium jump size
NATIVE_OFFSET nmd = 0; // medium jump max. neg distance
NATIVE_OFFSET pmd = 0; // medium jump max. pos distance
NATIVE_OFFSET mextra; // How far beyond the medium jump range is this jump offset?
#endif // TARGET_ARM
NATIVE_OFFSET extra; // How far beyond the short jump range is this jump offset?
UNATIVE_OFFSET srcInstrOffs; // offset of the source instruction of the jump
UNATIVE_OFFSET srcEncodingOffs; // offset of the source used by the instruction set to calculate the relative
// offset of the jump
UNATIVE_OFFSET dstOffs;
NATIVE_OFFSET jmpDist; // the relative jump distance, as it will be encoded
UNATIVE_OFFSET oldSize;
UNATIVE_OFFSET sizeDif;
#ifdef TARGET_XARCH
assert(jmp->idInsFmt() == IF_LABEL || jmp->idInsFmt() == IF_RWR_LABEL || jmp->idInsFmt() == IF_SWR_LABEL);
/* Figure out the smallest size we can end up with */
if (jmp->idInsFmt() == IF_LABEL)
{
if (emitIsCondJump(jmp))
{
ssz = JCC_SIZE_SMALL;
nsd = JCC_DIST_SMALL_MAX_NEG;
psd = JCC_DIST_SMALL_MAX_POS;
}
else
{
ssz = JMP_SIZE_SMALL;
nsd = JMP_DIST_SMALL_MAX_NEG;
psd = JMP_DIST_SMALL_MAX_POS;
}
}
#endif // TARGET_XARCH
#ifdef TARGET_ARM
assert((jmp->idInsFmt() == IF_T2_J1) || (jmp->idInsFmt() == IF_T2_J2) || (jmp->idInsFmt() == IF_T1_I) ||
(jmp->idInsFmt() == IF_T1_K) || (jmp->idInsFmt() == IF_T1_M) || (jmp->idInsFmt() == IF_T2_M1) ||
(jmp->idInsFmt() == IF_T2_N1) || (jmp->idInsFmt() == IF_T1_J3) || (jmp->idInsFmt() == IF_LARGEJMP));
/* Figure out the smallest size we can end up with */
if (emitIsCondJump(jmp))
{
ssz = JCC_SIZE_SMALL;
nsd = JCC_DIST_SMALL_MAX_NEG;
psd = JCC_DIST_SMALL_MAX_POS;
msz = JCC_SIZE_MEDIUM;
nmd = JCC_DIST_MEDIUM_MAX_NEG;
pmd = JCC_DIST_MEDIUM_MAX_POS;
}
else if (emitIsCmpJump(jmp))
{
ssz = JMP_SIZE_SMALL;
nsd = 0;
psd = 126;
}
else if (emitIsUncondJump(jmp))
{
ssz = JMP_SIZE_SMALL;
nsd = JMP_DIST_SMALL_MAX_NEG;
psd = JMP_DIST_SMALL_MAX_POS;
}
else if (emitIsLoadLabel(jmp))
{
ssz = LBL_SIZE_SMALL;
nsd = LBL_DIST_SMALL_MAX_NEG;
psd = LBL_DIST_SMALL_MAX_POS;
}
else
{
assert(!"Unknown jump instruction");
}
#endif // TARGET_ARM
#ifdef TARGET_ARM64
/* Figure out the smallest size we can end up with */
if (emitIsCondJump(jmp))
{
ssz = JCC_SIZE_SMALL;
bool isTest = (jmp->idIns() == INS_tbz) || (jmp->idIns() == INS_tbnz);
nsd = (isTest) ? TB_DIST_SMALL_MAX_NEG : JCC_DIST_SMALL_MAX_NEG;
psd = (isTest) ? TB_DIST_SMALL_MAX_POS : JCC_DIST_SMALL_MAX_POS;
}
else if (emitIsUncondJump(jmp))
{
// Nothing to do; we don't shrink these.
assert(jmp->idjShort);
ssz = JMP_SIZE_SMALL;
}
else if (emitIsLoadLabel(jmp))
{
ssz = LBL_SIZE_SMALL;
nsd = LBL_DIST_SMALL_MAX_NEG;
psd = LBL_DIST_SMALL_MAX_POS;
}
else if (emitIsLoadConstant(jmp))
{
ssz = LDC_SIZE_SMALL;
nsd = LDC_DIST_SMALL_MAX_NEG;
psd = LDC_DIST_SMALL_MAX_POS;
}
else
{
assert(!"Unknown jump instruction");
}
#endif // TARGET_ARM64
/* Make sure the jumps are properly ordered */
#ifdef DEBUG
assert(lastLJ == nullptr || lastIG != jmp->idjIG || lastLJ->idjOffs < jmp->idjOffs);
lastLJ = (lastIG == jmp->idjIG) ? jmp : nullptr;
assert(lastIG == nullptr || lastIG->igNum <= jmp->idjIG->igNum || jmp->idjIG == prologIG ||
emitNxtIGnum > unsigned(0xFFFF)); // igNum might overflow
lastIG = jmp->idjIG;
#endif // DEBUG
/* Get hold of the current jump size */
jsz = jmp->idCodeSize();
/* Get the group the jump is in */
jmpIG = jmp->idjIG;
/* Are we in a group different from the previous jump? */
if (lstIG != jmpIG)
{
/* Were there any jumps before this one? */
if (lstIG)
{
/* Adjust the offsets of the intervening blocks */
do
{
lstIG = lstIG->igNext;
assert(lstIG);
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Adjusted offset of " FMT_BB " from %04X to %04X\n", lstIG->igNum, lstIG->igOffs,
lstIG->igOffs - adjIG);
}
#endif // DEBUG
lstIG->igOffs -= adjIG;
assert(IsCodeAligned(lstIG->igOffs));
} while (lstIG != jmpIG);
}
/* We've got the first jump in a new group */
adjLJ = 0;
lstIG = jmpIG;
}
/* Apply any local size adjustment to the jump's relative offset */
jmp->idjOffs -= adjLJ;
// If this is a jump via register, the instruction size does not change, so we are done.
CLANG_FORMAT_COMMENT_ANCHOR;
#if defined(TARGET_ARM64)
// JIT code and data will be allocated together for arm64 so the relative offset to JIT data is known.
// In case such offset can be encodeable for `ldr` (+-1MB), shorten it.
if (jmp->idAddr()->iiaIsJitDataOffset())
{
// Reference to JIT data
assert(jmp->idIsBound());
UNATIVE_OFFSET srcOffs = jmpIG->igOffs + jmp->idjOffs;
int doff = jmp->idAddr()->iiaGetJitDataOffset();
assert(doff >= 0);
ssize_t imm = emitGetInsSC(jmp);
assert((imm >= 0) && (imm < 0x1000)); // 0x1000 is arbitrary, currently 'imm' is always 0
unsigned dataOffs = (unsigned)(doff + imm);
assert(dataOffs < emitDataSize());
// Conservately assume JIT data starts after the entire code size.
// TODO-ARM64: we might consider only hot code size which will be computed later in emitComputeCodeSizes().
assert(emitTotalCodeSize > 0);
UNATIVE_OFFSET maxDstOffs = emitTotalCodeSize + dataOffs;
// Check if the distance is within the encoding length.
jmpDist = maxDstOffs - srcOffs;
extra = jmpDist - psd;
if (extra <= 0)
{
goto SHORT_JMP;
}
// Keep the large form.
continue;
}
#endif
/* Have we bound this jump's target already? */
if (jmp->idIsBound())
{
/* Does the jump already have the smallest size? */
if (jmp->idjShort)
{
assert(jmp->idCodeSize() == ssz);
// We should not be jumping/branching across funclets/functions
emitCheckFuncletBranch(jmp, jmpIG);
continue;
}
tgtIG = jmp->idAddr()->iiaIGlabel;
}
else
{
/* First time we've seen this label, convert its target */
CLANG_FORMAT_COMMENT_ANCHOR;
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Binding: ");
emitDispIns(jmp, false, false, false);
printf("Binding L_M%03u_" FMT_BB, emitComp->compMethodID, jmp->idAddr()->iiaBBlabel->bbNum);
}
#endif // DEBUG
tgtIG = (insGroup*)emitCodeGetCookie(jmp->idAddr()->iiaBBlabel);
#ifdef DEBUG
if (EMITVERBOSE)
{
if (tgtIG)
{
printf(" to %s\n", emitLabelString(tgtIG));
}
else
{
printf("-- ERROR, no emitter cookie for " FMT_BB "; it is probably missing BBF_HAS_LABEL.\n",
jmp->idAddr()->iiaBBlabel->bbNum);
}
}
assert(tgtIG);
#endif // DEBUG
/* Record the bound target */
jmp->idAddr()->iiaIGlabel = tgtIG;
jmp->idSetIsBound();
}
// We should not be jumping/branching across funclets/functions
emitCheckFuncletBranch(jmp, jmpIG);
#ifdef TARGET_XARCH
/* Done if this is not a variable-sized jump */
if ((jmp->idIns() == INS_push) || (jmp->idIns() == INS_mov) || (jmp->idIns() == INS_call) ||
(jmp->idIns() == INS_push_hide))
{
continue;
}
#endif
#ifdef TARGET_ARM
if ((jmp->idIns() == INS_push) || (jmp->idIns() == INS_mov) || (jmp->idIns() == INS_movt) ||
(jmp->idIns() == INS_movw))
{
continue;
}
#endif
#ifdef TARGET_ARM64
// There is only one size of unconditional branch; we don't support functions larger than 2^28 bytes (our branch
// range).
if (emitIsUncondJump(jmp))
{
continue;
}
#endif
/*
In the following distance calculations, if we're not actually
scheduling the code (i.e. reordering instructions), we can
use the actual offset of the jump (rather than the beg/end of
the instruction group) since the jump will not be moved around
and thus its offset is accurate.
First we need to figure out whether this jump is a forward or
backward one; to do this we simply look at the ordinals of the
group that contains the jump and the target.
*/
srcInstrOffs = jmpIG->igOffs + jmp->idjOffs;
/* Note that the destination is always the beginning of an IG, so no need for an offset inside it */
dstOffs = tgtIG->igOffs;
#if defined(TARGET_ARM)
srcEncodingOffs =
srcInstrOffs + 4; // For relative branches, ARM PC is always considered to be the instruction address + 4
#elif defined(TARGET_ARM64)
srcEncodingOffs =
srcInstrOffs; // For relative branches, ARM64 PC is always considered to be the instruction address
#else
srcEncodingOffs = srcInstrOffs + ssz; // Encoding offset of relative offset for small branch
#endif
if (jmpIG->igNum < tgtIG->igNum)
{
/* Forward jump */
/* Adjust the target offset by the current delta. This is a worst-case estimate, as jumps between
here and the target could be shortened, causing the actual distance to shrink.
*/
dstOffs -= adjIG;
/* Compute the distance estimate */
jmpDist = dstOffs - srcEncodingOffs;
/* How much beyond the max. short distance does the jump go? */
extra = jmpDist - psd;
#if DEBUG_EMIT
assert(jmp->idDebugOnlyInfo() != nullptr);
if (jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM || INTERESTING_JUMP_NUM == 0)
{
if (INTERESTING_JUMP_NUM == 0)
{
printf("[1] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
}
printf("[1] Jump block is at %08X\n", jmpIG->igOffs);
printf("[1] Jump reloffset is %04X\n", jmp->idjOffs);
printf("[1] Jump source is at %08X\n", srcEncodingOffs);
printf("[1] Label block is at %08X\n", dstOffs);
printf("[1] Jump dist. is %04X\n", jmpDist);
if (extra > 0)
{
printf("[1] Dist excess [S] = %d \n", extra);
}
}
if (EMITVERBOSE)
{
printf("Estimate of fwd jump [%08X/%03u]: %04X -> %04X = %04X\n", dspPtr(jmp),
jmp->idDebugOnlyInfo()->idNum, srcInstrOffs, dstOffs, jmpDist);
}
#endif // DEBUG_EMIT
if (extra <= 0)
{
/* This jump will be a short one */
goto SHORT_JMP;
}
}
else
{
/* Backward jump */
/* Compute the distance estimate */
jmpDist = srcEncodingOffs - dstOffs;
/* How much beyond the max. short distance does the jump go? */
extra = jmpDist + nsd;
#if DEBUG_EMIT
assert(jmp->idDebugOnlyInfo() != nullptr);
if (jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM || INTERESTING_JUMP_NUM == 0)
{
if (INTERESTING_JUMP_NUM == 0)
{
printf("[2] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
}
printf("[2] Jump block is at %08X\n", jmpIG->igOffs);
printf("[2] Jump reloffset is %04X\n", jmp->idjOffs);
printf("[2] Jump source is at %08X\n", srcEncodingOffs);
printf("[2] Label block is at %08X\n", dstOffs);
printf("[2] Jump dist. is %04X\n", jmpDist);
if (extra > 0)
{
printf("[2] Dist excess [S] = %d \n", extra);
}
}
if (EMITVERBOSE)
{
printf("Estimate of bwd jump [%08X/%03u]: %04X -> %04X = %04X\n", dspPtr(jmp),
jmp->idDebugOnlyInfo()->idNum, srcInstrOffs, dstOffs, jmpDist);
}
#endif // DEBUG_EMIT
if (extra <= 0)
{
/* This jump will be a short one */
goto SHORT_JMP;
}
}
/* We arrive here if the jump couldn't be made short, at least for now */
/* We had better not have eagerly marked the jump as short
* in emitIns_J(). If we did, then it has to be able to stay short
* as emitIns_J() uses the worst case scenario, and blocks can
* only move closer together after that.
*/
assert(jmp->idjShort == 0);
/* Keep track of the closest distance we got */
if (minShortExtra > (unsigned)extra)
{
minShortExtra = (unsigned)extra;
}
#if defined(TARGET_ARM)
// If we're here, we couldn't convert to a small jump.
// Handle conversion to medium-sized conditional jumps.
// 'srcInstrOffs', 'srcEncodingOffs', 'dstOffs', 'jmpDist' have already been computed
// and don't need to be recomputed.
if (emitIsCondJump(jmp))
{
if (jmpIG->igNum < tgtIG->igNum)
{
/* Forward jump */
/* How much beyond the max. medium distance does the jump go? */
mextra = jmpDist - pmd;
#if DEBUG_EMIT
assert(jmp->idDebugOnlyInfo() != NULL);
if (jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM || INTERESTING_JUMP_NUM == 0)
{
if (mextra > 0)
{
if (INTERESTING_JUMP_NUM == 0)
printf("[6] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
printf("[6] Dist excess [S] = %d \n", mextra);
}
}
#endif // DEBUG_EMIT
if (mextra <= 0)
{
/* This jump will be a medium one */
goto MEDIUM_JMP;
}
}
else
{
/* Backward jump */
/* How much beyond the max. medium distance does the jump go? */
mextra = jmpDist + nmd;
#if DEBUG_EMIT
assert(jmp->idDebugOnlyInfo() != NULL);
if (jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM || INTERESTING_JUMP_NUM == 0)
{
if (mextra > 0)
{
if (INTERESTING_JUMP_NUM == 0)
printf("[7] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
printf("[7] Dist excess [S] = %d \n", mextra);
}
}
#endif // DEBUG_EMIT
if (mextra <= 0)
{
/* This jump will be a medium one */
goto MEDIUM_JMP;
}
}
/* We arrive here if the jump couldn't be made medium, at least for now */
/* Keep track of the closest distance we got */
if (minMediumExtra > (unsigned)mextra)
minMediumExtra = (unsigned)mextra;
}
#endif // TARGET_ARM
/*****************************************************************************
* We arrive here if the jump must stay long, at least for now.
* Go try the next one.
*/
continue;
/*****************************************************************************/
/* Handle conversion to short jump */
/*****************************************************************************/
SHORT_JMP:
/* Try to make this jump a short one */
emitSetShortJump(jmp);
if (!jmp->idjShort)
{
continue; // This jump must be kept long
}
/* This jump is becoming either short or medium */
oldSize = jsz;
jsz = ssz;
assert(oldSize >= jsz);
sizeDif = oldSize - jsz;
#if defined(TARGET_XARCH)
jmp->idCodeSize(jsz);
#elif defined(TARGET_ARM)
#if 0
// This is done as part of emitSetShortJump():
insSize isz = emitInsSize(jmp->idInsFmt());
jmp->idInsSize(isz);
#endif
#elif defined(TARGET_ARM64)
// The size of IF_LARGEJMP/IF_LARGEADR/IF_LARGELDC are 8 or 12.
// All other code size is 4.
assert((sizeDif == 4) || (sizeDif == 8));
#else
#error Unsupported or unset target architecture
#endif
goto NEXT_JMP;
#if defined(TARGET_ARM)
/*****************************************************************************/
/* Handle conversion to medium jump */
/*****************************************************************************/
MEDIUM_JMP:
/* Try to make this jump a medium one */
emitSetMediumJump(jmp);
if (jmp->idCodeSize() > msz)
{
continue; // This jump wasn't shortened
}
assert(jmp->idCodeSize() == msz);
/* This jump is becoming medium */
oldSize = jsz;
jsz = msz;
assert(oldSize >= jsz);
sizeDif = oldSize - jsz;
goto NEXT_JMP;
#endif // TARGET_ARM
/*****************************************************************************/
NEXT_JMP:
/* Make sure the size of the jump is marked correctly */
assert((0 == (jsz | jmpDist)) || (jsz == jmp->idCodeSize()));
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Shrinking jump [%08X/%03u]\n", dspPtr(jmp), jmp->idDebugOnlyInfo()->idNum);
}
#endif
noway_assert((unsigned short)sizeDif == sizeDif);
adjIG += sizeDif;
adjLJ += sizeDif;
jmpIG->igSize -= (unsigned short)sizeDif;
emitTotalCodeSize -= sizeDif;
/* The jump size estimate wasn't accurate; flag its group */
jmpIG->igFlags |= IGF_UPD_ISZ;
} // end for each jump
/* Did we shorten any jumps? */
if (adjIG)
{
/* Adjust offsets of any remaining blocks */
assert(lstIG);
for (;;)
{
lstIG = lstIG->igNext;
if (!lstIG)
{
break;
}
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Adjusted offset of " FMT_BB " from %04X to %04X\n", lstIG->igNum, lstIG->igOffs,
lstIG->igOffs - adjIG);
}
#endif // DEBUG
lstIG->igOffs -= adjIG;
assert(IsCodeAligned(lstIG->igOffs));
}
#ifdef DEBUG
emitCheckIGoffsets();
#endif
/* Is there a chance of other jumps becoming short? */
CLANG_FORMAT_COMMENT_ANCHOR;
#ifdef DEBUG
#if defined(TARGET_ARM)
if (EMITVERBOSE)
printf("Total shrinkage = %3u, min extra short jump size = %3u, min extra medium jump size = %u\n", adjIG,
minShortExtra, minMediumExtra);
#else
if (EMITVERBOSE)
{
printf("Total shrinkage = %3u, min extra jump size = %3u\n", adjIG, minShortExtra);
}
#endif
#endif
if ((minShortExtra <= adjIG)
#if defined(TARGET_ARM)
|| (minMediumExtra <= adjIG)
#endif // TARGET_ARM
)
{
jmp_iteration++;
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Iterating branch shortening. Iteration = %d\n", jmp_iteration);
}
#endif
goto AGAIN;
}
}
#ifdef DEBUG
if (EMIT_INSTLIST_VERBOSE)
{
printf("\nLabels list after the jump dist binding:\n\n");
emitDispIGlist(false);
}
emitCheckIGoffsets();
#endif // DEBUG
}
#endif
#if FEATURE_LOOP_ALIGN
//-----------------------------------------------------------------------------
// emitCheckAlignFitInCurIG: Check if adding current align instruction will
// create new 'ig'. For multi align instructions, this sets `emitForceNewIG` so
// so all 'align' instructions are under same IG.
//
// Arguments:
// nAlignInstr - Number of align instructions about to be added.
//
void emitter::emitCheckAlignFitInCurIG(unsigned nAlignInstr)
{
unsigned instrDescSize = nAlignInstr * sizeof(instrDescAlign);
// Ensure that all align instructions fall in same IG.
if (emitCurIGfreeNext + instrDescSize >= emitCurIGfreeEndp)
{
emitForceNewIG = true;
}
}
//-----------------------------------------------------------------------------
//
// emitLoopAlign: The next instruction will be a loop head entry point
// So insert an alignment instruction of "paddingBytes" to ensure that
// the code is properly aligned.
// Arguments:
// paddingBytes - Number of padding bytes to insert.
// isFirstAlign - For multiple 'align' instructions case, if this is the first
// 'align' instruction of that group.
//
void emitter::emitLoopAlign(unsigned paddingBytes, bool isFirstAlign DEBUG_ARG(bool isPlacedBehindJmp))
{
// Determine if 'align' instruction about to be generated will
// fall in current IG or next.
bool alignInstrInNewIG = emitForceNewIG;
if (!alignInstrInNewIG)
{
// If align fits in current IG, then mark that it contains alignment
// instruction in the end.
emitCurIG->igFlags |= IGF_HAS_ALIGN;
}
/* Insert a pseudo-instruction to ensure that we align
the next instruction properly */
instrDescAlign* id = emitNewInstrAlign();
if (alignInstrInNewIG)
{
// Mark this IG has alignment in the end, so during emitter we can check the instruction count
// heuristics of all IGs that follows this IG that participate in a loop.
emitCurIG->igFlags |= IGF_HAS_ALIGN;
}
else
{
// Otherwise, make sure it was already marked such.
assert(emitCurIG->endsWithAlignInstr());
}
#if defined(TARGET_XARCH)
assert(paddingBytes <= MAX_ENCODED_SIZE);
id->idCodeSize(paddingBytes);
#elif defined(TARGET_ARM64)
assert(paddingBytes == INSTR_ENCODED_SIZE);
#endif
id->idaIG = emitCurIG;
if (isFirstAlign)
{
// For multiple align instructions, set the idaLoopHeadPredIG only for the
// first align instruction
id->idaLoopHeadPredIG = emitCurIG;
emitAlignLastGroup = id;
}
else
{
id->idaLoopHeadPredIG = nullptr;
}
#ifdef DEBUG
id->isPlacedAfterJmp = isPlacedBehindJmp;
#endif
/* Append this instruction to this IG's alignment list */
id->idaNext = emitCurIGAlignList;
emitCurIGsize += paddingBytes;
dispIns(id);
emitCurIGAlignList = id;
}
//-----------------------------------------------------------------------------
//
// emitLongLoopAlign: The next instruction will be a loop head entry point
// So insert alignment instruction(s) here to ensure that
// we can properly align the code.
//
// This emits more than one `INS_align` instruction depending on the
// alignmentBoundary parameter.
//
// Arguments:
// alignmentBoundary - The boundary at which loop needs to be aligned.
//
void emitter::emitLongLoopAlign(unsigned alignmentBoundary DEBUG_ARG(bool isPlacedBehindJmp))
{
#if defined(TARGET_XARCH)
unsigned nPaddingBytes = alignmentBoundary - 1;
unsigned nAlignInstr = (nPaddingBytes + (MAX_ENCODED_SIZE - 1)) / MAX_ENCODED_SIZE;
unsigned insAlignCount = nPaddingBytes / MAX_ENCODED_SIZE;
unsigned lastInsAlignSize = nPaddingBytes % MAX_ENCODED_SIZE;
unsigned paddingBytes = MAX_ENCODED_SIZE;
#elif defined(TARGET_ARM64)
unsigned nAlignInstr = alignmentBoundary / INSTR_ENCODED_SIZE;
unsigned insAlignCount = nAlignInstr;
unsigned paddingBytes = INSTR_ENCODED_SIZE;
#endif
emitCheckAlignFitInCurIG(nAlignInstr);
/* Insert a pseudo-instruction to ensure that we align
the next instruction properly */
bool isFirstAlign = true;
while (insAlignCount)
{
emitLoopAlign(paddingBytes, isFirstAlign DEBUG_ARG(isPlacedBehindJmp));
insAlignCount--;
isFirstAlign = false;
}
#if defined(TARGET_XARCH)
emitLoopAlign(lastInsAlignSize, isFirstAlign DEBUG_ARG(isPlacedBehindJmp));
#endif
}
//-----------------------------------------------------------------------------
// emitConnectAlignInstrWithCurIG: If "align" instruction is not just before the loop start,
// setting idaLoopHeadPredIG lets us know the exact IG that the "align"
// instruction is trying to align. This is used to track the last IG that
// needs alignment after which VEX encoding optimization is enabled.
//
// TODO: Once over-estimation problem is solved, consider replacing
// idaLoopHeadPredIG with idaLoopHeadIG itself.
//
void emitter::emitConnectAlignInstrWithCurIG()
{
JITDUMP("Mapping 'align' instruction in IG%02u to target IG%02u\n", emitAlignLastGroup->idaIG->igNum,
emitCurIG->igNum);
// Since we never align overlapping instructions, it is always guaranteed that
// the emitAlignLastGroup points to the loop that is in process of getting aligned.
emitAlignLastGroup->idaLoopHeadPredIG = emitCurIG;
// For a new IG to ensure that loop doesn't start from IG that idaLoopHeadPredIG points to.
emitNxtIG();
}
//-----------------------------------------------------------------------------
// emitLoopAlignment: Insert an align instruction at the end of emitCurIG and
// mark it as IGF_HAS_ALIGN to indicate that a next or a future
// IG is a loop that needs alignment.
//
void emitter::emitLoopAlignment(DEBUG_ARG1(bool isPlacedBehindJmp))
{
unsigned paddingBytes;
#if defined(TARGET_XARCH)
// For xarch, each align instruction can be maximum of MAX_ENCODED_SIZE bytes and if
// more padding is needed, multiple MAX_ENCODED_SIZE bytes instructions are added.
if ((emitComp->opts.compJitAlignLoopBoundary > 16) && (!emitComp->opts.compJitAlignLoopAdaptive))
{
paddingBytes = emitComp->opts.compJitAlignLoopBoundary;
emitLongLoopAlign(paddingBytes DEBUG_ARG(isPlacedBehindJmp));
}
else
{
emitCheckAlignFitInCurIG(1);
paddingBytes = MAX_ENCODED_SIZE;
emitLoopAlign(paddingBytes, true DEBUG_ARG(isPlacedBehindJmp));
}
#elif defined(TARGET_ARM64)
// For Arm64, each align instruction is 4-bytes long because of fixed-length encoding.
// The padding added will be always be in multiple of 4-bytes.
if (emitComp->opts.compJitAlignLoopAdaptive)
{
paddingBytes = emitComp->opts.compJitAlignLoopBoundary >> 1;
}
else
{
paddingBytes = emitComp->opts.compJitAlignLoopBoundary;
}
emitLongLoopAlign(paddingBytes DEBUG_ARG(isPlacedBehindJmp));
#endif
assert(emitLastIns->idIns() == INS_align);
JITDUMP("Adding 'align' instruction of %d bytes in %s.\n", paddingBytes, emitLabelString(emitCurIG));
}
//-----------------------------------------------------------------------------
// emitEndsWithAlignInstr: Checks if current IG ends with loop align instruction.
//
// Returns: true if current IG ends with align instruction.
//
bool emitter::emitEndsWithAlignInstr()
{
return emitCurIG->endsWithAlignInstr();
}
//-----------------------------------------------------------------------------
// getLoopSize: Starting from loopHeaderIg, find the size of the smallest possible loop
// such that it doesn't exceed the maxLoopSize.
//
// Arguments:
// igLoopHeader - The header IG of a loop
// maxLoopSize - Maximum loop size. If the loop is bigger than this value, we will just
// return this value.
// isAlignAdjusted - Determine if adjustments are done to the align instructions or not.
// During generating code, it is 'false' (because we haven't adjusted the size yet).
// During outputting code, it is 'true'.
//
// Returns: size of a loop in bytes.
//
unsigned emitter::getLoopSize(insGroup* igLoopHeader, unsigned maxLoopSize DEBUG_ARG(bool isAlignAdjusted))
{
unsigned loopSize = 0;
for (insGroup* igInLoop = igLoopHeader; igInLoop != nullptr; igInLoop = igInLoop->igNext)
{
loopSize += igInLoop->igSize;
if (igInLoop->endsWithAlignInstr())
{
// If IGF_HAS_ALIGN is present, igInLoop contains align instruction at the end,
// for next IG or some future IG.
//
// For both cases, remove the padding bytes from igInLoop's size so it is not included in loopSize.
//
// If the loop was formed because of forward jumps like the loop IG18 below, the backedge is not
// set for them and such loops are not aligned. For such cases, the loop size threshold will never
// be met and we would break as soon as loopSize > maxLoopSize.
//
// IG05:
// ...
// jmp IG18
// ...
// IG18:
// ...
// jne IG05
//
// If igInLoop is a legitimate loop, and igInLoop's end with another 'align' instruction for different IG
// representing a loop that needs alignment, then igInLoop should be the last IG of the current loop and
// should have backedge to current loop header.
//
// Below, IG05 is the last IG of loop IG04-IG05 and its backedge points to IG04.
//
// IG03:
// ...
// align
// IG04:
// ...
// ...
// IG05:
// ...
// jne IG04
// align ; <---
// IG06:
// ...
// jne IG06
//
//
assert((igInLoop->igLoopBackEdge == nullptr) || (igInLoop->igLoopBackEdge == igLoopHeader));
#ifdef DEBUG
if (isAlignAdjusted)
{
// If this IG is already align adjusted, get the adjusted padding already calculated.
instrDescAlign* alignInstr = emitAlignList;
bool foundAlignInstr = false;
// Find the alignInstr for igInLoop IG.
for (; alignInstr != nullptr; alignInstr = alignInstr->idaNext)
{
if (alignInstr->idaIG->igNum == igInLoop->igNum)
{
foundAlignInstr = true;
break;
}
}
assert(foundAlignInstr);
unsigned adjustedPadding = 0;
if (emitComp->opts.compJitAlignLoopAdaptive)
{
adjustedPadding = alignInstr->idCodeSize();
}
else
{
instrDescAlign* alignInstrToAdj = alignInstr;
for (; alignInstrToAdj != nullptr && alignInstrToAdj->idaIG == alignInstr->idaIG;
alignInstrToAdj = alignInstrToAdj->idaNext)
{
adjustedPadding += alignInstrToAdj->idCodeSize();
}
}
loopSize -= adjustedPadding;
}
else
#endif
{
// The current loop size should exclude the align instruction size reserved for next loop.
loopSize -= emitComp->opts.compJitAlignPaddingLimit;
}
}
if ((igInLoop->igLoopBackEdge == igLoopHeader) || (loopSize > maxLoopSize))
{
break;
}
}
return loopSize;
}
//-----------------------------------------------------------------------------
// emitSetLoopBackEdge : Sets igLoopBackEdge field, if not already set and
// if currIG has back-edge to dstIG.
//
// Notes:
// Despite we align only inner most loop, we might see intersected loops because of control flow
// re-arrangement like adding a split edge in LSRA.
//
// If there is an intersection of current loop with last loop that is already marked as align,
// then *do not align* one of the loop that completely encloses the other one. Or if they both intersect,
// then *do not align* either of them because since the flow is complicated enough that aligning one of them
// will not improve the performance.
//
void emitter::emitSetLoopBackEdge(BasicBlock* loopTopBlock)
{
insGroup* dstIG = (insGroup*)loopTopBlock->bbEmitCookie;
bool alignCurrentLoop = true;
bool alignLastLoop = true;
// With (dstIG != nullptr), ensure that only back edges are tracked.
// If there is forward jump, dstIG is not yet generated.
//
// We don't rely on (block->bbJumpDest->bbNum <= block->bbNum) because the basic
// block numbering is not guaranteed to be sequential.
if ((dstIG != nullptr) && (dstIG->igNum <= emitCurIG->igNum))
{
unsigned currLoopStart = dstIG->igNum;
unsigned currLoopEnd = emitCurIG->igNum;
// Only mark back-edge if current loop starts after the last inner loop ended.
if (emitLastLoopEnd < currLoopStart)
{
emitCurIG->igLoopBackEdge = dstIG;
JITDUMP("** IG%02u jumps back to IG%02u forming a loop.\n", currLoopEnd, currLoopStart);
emitLastLoopStart = currLoopStart;
emitLastLoopEnd = currLoopEnd;
}
else if (currLoopStart == emitLastLoopStart)
{
// Note: If current and last loop starts at same point,
// retain the alignment flag of the smaller loop.
// |
// .---->|<----.
// last | | |
// loop | | | current
// .---->| | loop
// | |
// |-----.
//
}
else if ((currLoopStart < emitLastLoopStart) && (emitLastLoopEnd < currLoopEnd))
{
// if current loop completely encloses last loop,
// then current loop should not be aligned.
alignCurrentLoop = false;
}
else if ((emitLastLoopStart < currLoopStart) && (currLoopEnd < emitLastLoopEnd))
{
// if last loop completely encloses current loop,
// then last loop should not be aligned.
alignLastLoop = false;
}
else
{
// The loops intersect and should not align either of the loops
alignLastLoop = false;
alignCurrentLoop = false;
}
if (!alignLastLoop || !alignCurrentLoop)
{
instrDescAlign* alignInstr = emitAlignList;
bool markedLastLoop = alignLastLoop;
bool markedCurrLoop = alignCurrentLoop;
while ((alignInstr != nullptr))
{
insGroup* loopHeadIG = alignInstr->loopHeadIG();
// Find the IG that has 'align' instruction to align the current loop
// and clear the IGF_HAS_ALIGN flag.
if (!alignCurrentLoop && (loopHeadIG == dstIG))
{
assert(!markedCurrLoop);
// This IG should no longer contain alignment instruction
alignInstr->removeAlignFlags();
markedCurrLoop = true;
JITDUMP("** Skip alignment for current loop IG%02u ~ IG%02u because it encloses an aligned loop "
"IG%02u ~ IG%02u.\n",
currLoopStart, currLoopEnd, emitLastLoopStart, emitLastLoopEnd);
}
// Find the IG that has 'align' instruction to align the last loop
// and clear the IGF_HAS_ALIGN flag.
if (!alignLastLoop && (loopHeadIG != nullptr) && (loopHeadIG->igNum == emitLastLoopStart))
{
assert(!markedLastLoop);
assert(alignInstr->idaIG->endsWithAlignInstr());
// This IG should no longer contain alignment instruction
alignInstr->removeAlignFlags();
markedLastLoop = true;
JITDUMP("** Skip alignment for aligned loop IG%02u ~ IG%02u because it encloses the current loop "
"IG%02u ~ IG%02u.\n",
emitLastLoopStart, emitLastLoopEnd, currLoopStart, currLoopEnd);
}
if (markedLastLoop && markedCurrLoop)
{
break;
}
alignInstr = emitAlignInNextIG(alignInstr);
}
assert(markedLastLoop && markedCurrLoop);
}
}
}
//-----------------------------------------------------------------------------
// emitLoopAlignAdjustments: Walk all the align instructions and update them
// with actual padding needed.
//
// Notes:
// For IGs that have align instructions in the end, calculate the actual offset
// of loop start and determine how much padding is needed. Based on that, update
// the igOffs, igSize and emitTotalCodeSize.
//
void emitter::emitLoopAlignAdjustments()
{
// no align instructions
if (emitAlignList == nullptr)
{
return;
}
JITDUMP("*************** In emitLoopAlignAdjustments()\n");
JITDUMP("compJitAlignLoopAdaptive = %s\n", dspBool(emitComp->opts.compJitAlignLoopAdaptive));
JITDUMP("compJitAlignLoopBoundary = %u\n", emitComp->opts.compJitAlignLoopBoundary);
JITDUMP("compJitAlignLoopMinBlockWeight = %u\n", emitComp->opts.compJitAlignLoopMinBlockWeight);
JITDUMP("compJitAlignLoopForJcc = %s\n", dspBool(emitComp->opts.compJitAlignLoopForJcc));
JITDUMP("compJitAlignLoopMaxCodeSize = %u\n", emitComp->opts.compJitAlignLoopMaxCodeSize);
JITDUMP("compJitAlignPaddingLimit = %u\n", emitComp->opts.compJitAlignPaddingLimit);
unsigned estimatedPaddingNeeded = emitComp->opts.compJitAlignPaddingLimit;
unsigned alignBytesRemoved = 0;
unsigned loopIGOffset = 0;
instrDescAlign* alignInstr = emitAlignList;
for (; alignInstr != nullptr;)
{
assert(alignInstr->idIns() == INS_align);
insGroup* loopHeadPredIG = alignInstr->idaLoopHeadPredIG;
insGroup* loopHeadIG = alignInstr->loopHeadIG();
insGroup* containingIG = alignInstr->idaIG;
JITDUMP(" Adjusting 'align' instruction in IG%02u that is targeted for IG%02u \n", containingIG->igNum,
loopHeadIG->igNum);
// Since we only adjust the padding up to the next align instruction which is behind the jump, we make sure
// that we take into account all the alignBytes we removed until that point. Hence " - alignBytesRemoved"
loopIGOffset = loopHeadIG->igOffs - alignBytesRemoved;
// igSize also includes INS_align instruction, take it off.
loopIGOffset -= estimatedPaddingNeeded;
// IG can be marked as not needing alignment if during setting igLoopBackEdge, it is detected
// that the igLoopBackEdge encloses an IG that is marked for alignment.
unsigned actualPaddingNeeded =
containingIG->endsWithAlignInstr()
? emitCalculatePaddingForLoopAlignment(loopHeadIG, loopIGOffset DEBUG_ARG(false))
: 0;
assert(estimatedPaddingNeeded >= actualPaddingNeeded);
unsigned short diff = (unsigned short)(estimatedPaddingNeeded - actualPaddingNeeded);
if (diff != 0)
{
containingIG->igSize -= diff;
alignBytesRemoved += diff;
emitTotalCodeSize -= diff;
// Update the flags
containingIG->igFlags |= IGF_UPD_ISZ;
if (actualPaddingNeeded == 0)
{
alignInstr->removeAlignFlags();
}
#ifdef TARGET_XARCH
if (emitComp->opts.compJitAlignLoopAdaptive)
{
assert(actualPaddingNeeded < MAX_ENCODED_SIZE);
alignInstr->idCodeSize(actualPaddingNeeded);
}
else
#endif
{
unsigned paddingToAdj = actualPaddingNeeded;
#ifdef DEBUG
#if defined(TARGET_XARCH)
int instrAdjusted =
(emitComp->opts.compJitAlignLoopBoundary + (MAX_ENCODED_SIZE - 1)) / MAX_ENCODED_SIZE;
#elif defined(TARGET_ARM64)
unsigned short instrAdjusted = (emitComp->opts.compJitAlignLoopBoundary >> 1) / INSTR_ENCODED_SIZE;
if (!emitComp->opts.compJitAlignLoopAdaptive)
{
instrAdjusted = emitComp->opts.compJitAlignLoopBoundary / INSTR_ENCODED_SIZE;
}
#endif // TARGET_XARCH & TARGET_ARM64
#endif // DEBUG
// Adjust the padding amount in all align instructions in this IG
instrDescAlign *alignInstrToAdj = alignInstr, *prevAlignInstr = nullptr;
for (; alignInstrToAdj != nullptr && alignInstrToAdj->idaIG == alignInstr->idaIG;
alignInstrToAdj = alignInstrToAdj->idaNext)
{
#if defined(TARGET_XARCH)
unsigned newPadding = min(paddingToAdj, MAX_ENCODED_SIZE);
alignInstrToAdj->idCodeSize(newPadding);
#elif defined(TARGET_ARM64)
unsigned newPadding = min(paddingToAdj, INSTR_ENCODED_SIZE);
if (newPadding == 0)
{
alignInstrToAdj->idInsOpt(INS_OPTS_NONE);
}
#endif
paddingToAdj -= newPadding;
prevAlignInstr = alignInstrToAdj;
#ifdef DEBUG
instrAdjusted--;
#endif
}
assert(paddingToAdj == 0);
assert(instrAdjusted == 0);
}
JITDUMP("Adjusted alignment for %s from %u to %u.\n", emitLabelString(loopHeadIG), estimatedPaddingNeeded,
actualPaddingNeeded);
JITDUMP("Adjusted size of %s from %u to %u.\n", emitLabelString(containingIG),
(containingIG->igSize + diff), containingIG->igSize);
}
// Adjust the offset of all IGs starting from next IG until we reach the IG having the next
// align instruction or the end of IG list.
insGroup* adjOffIG = containingIG->igNext;
instrDescAlign* nextAlign = emitAlignInNextIG(alignInstr);
insGroup* adjOffUptoIG = nextAlign != nullptr ? nextAlign->idaIG : emitIGlast;
while ((adjOffIG != nullptr) && (adjOffIG->igNum <= adjOffUptoIG->igNum))
{
JITDUMP("Adjusted offset of %s from %04X to %04X\n", emitLabelString(adjOffIG), adjOffIG->igOffs,
(adjOffIG->igOffs - alignBytesRemoved));
adjOffIG->igOffs -= alignBytesRemoved;
adjOffIG = adjOffIG->igNext;
}
alignInstr = nextAlign;
if (actualPaddingNeeded > 0)
{
// Record the last loop IG that will be aligned. No overestimation
// adjustment will be done after emitLastAlignedIgNum.
JITDUMP("Recording last aligned IG: %s\n", emitLabelString(loopHeadPredIG));
emitLastAlignedIgNum = loopHeadPredIG->igNum;
}
}
#ifdef DEBUG
emitCheckIGoffsets();
#endif
}
//-----------------------------------------------------------------------------
// emitCalculatePaddingForLoopAlignment: Calculate the padding amount to insert at the
// end of 'ig' so the loop that starts after 'ig' is aligned.
//
// Arguments:
// loopHeadIG - The IG that has the loop head that need to be aligned.
// offset - The offset at which the IG that follows 'ig' starts.
// isAlignAdjusted - Determine if adjustments are done to the align instructions or not.
// During generating code, it is 'false' (because we haven't adjusted the size yet).
// During outputting code, it is 'true'.
//
// Returns: Padding amount.
// 0 means no padding is needed, either because loop is already aligned or it
// is too expensive to align loop and hence it will not be aligned.
//
// Notes:
// Below are the steps (in this order) to calculate the padding amount.
// 1. If loop is already aligned to desired boundary, then return 0. // already aligned
// 2. If loop size exceed maximum allowed loop size, then return 0. // already aligned
//
// For adaptive loop alignment:
// 3a. Calculate paddingNeeded and maxPaddingAmount to align to 32B boundary.
// 3b. If paddingNeeded > maxPaddingAmount, then recalculate to align to 16B boundary.
// 3b. If paddingNeeded == 0, then return 0. // already aligned at 16B
// 3c. If paddingNeeded > maxPaddingAmount, then return 0. // expensive to align
// 3d. If the loop already fits in minimum 32B blocks, then return 0. // already best aligned
// 3e. return paddingNeeded.
//
// For non-adaptive loop alignment:
// 3a. Calculate paddingNeeded.
// 3b. If the loop already fits in minimum alignmentBoundary blocks, then return 0. // already best aligned
// 3c. return paddingNeeded.
//
unsigned emitter::emitCalculatePaddingForLoopAlignment(insGroup* loopHeadIG,
size_t offset DEBUG_ARG(bool isAlignAdjusted))
{
unsigned alignmentBoundary = emitComp->opts.compJitAlignLoopBoundary;
// No padding if loop is already aligned
if ((offset & (alignmentBoundary - 1)) == 0)
{
JITDUMP(";; Skip alignment: 'Loop at %s already aligned at %dB boundary.'\n", emitLabelString(loopHeadIG),
alignmentBoundary);
return 0;
}
unsigned maxLoopSize = 0;
int maxLoopBlocksAllowed = 0;
if (emitComp->opts.compJitAlignLoopAdaptive)
{
// For adaptive, adjust the loop size depending on the alignment boundary
maxLoopBlocksAllowed = genLog2((unsigned)alignmentBoundary) - 1;
maxLoopSize = alignmentBoundary * maxLoopBlocksAllowed;
}
else
{
// For non-adaptive, just take whatever is supplied using COMPlus_ variables
maxLoopSize = emitComp->opts.compJitAlignLoopMaxCodeSize;
}
unsigned loopSize = getLoopSize(loopHeadIG, maxLoopSize DEBUG_ARG(isAlignAdjusted));
// No padding if loop is big
if (loopSize > maxLoopSize)
{
JITDUMP(";; Skip alignment: 'Loop at %s is big. LoopSize= %d, MaxLoopSize= %d.'\n", emitLabelString(loopHeadIG),
loopSize, maxLoopSize);
return 0;
}
unsigned paddingToAdd = 0;
unsigned minBlocksNeededForLoop = (loopSize + alignmentBoundary - 1) / alignmentBoundary;
bool skipPadding = false;
if (emitComp->opts.compJitAlignLoopAdaptive)
{
// adaptive loop alignment
unsigned nMaxPaddingBytes = (1 << (maxLoopBlocksAllowed - minBlocksNeededForLoop + 1));
#ifdef TARGET_XARCH
// Max padding for adaptive alignment has alignmentBoundary of 32 bytes with
// max padding limit of 15 bytes ((alignmentBoundary >> 1) - 1)
nMaxPaddingBytes -= 1;
#endif
unsigned nPaddingBytes = (-(int)(size_t)offset) & (alignmentBoundary - 1);
// Check if the alignment exceeds maxPadding limit
if (nPaddingBytes > nMaxPaddingBytes)
{
#ifdef TARGET_XARCH
// Cannot align to 32B, so try to align to 16B boundary.
// Only applicable for xarch. For arm64, it is recommended to align
// at 32B only.
alignmentBoundary >>= 1;
nMaxPaddingBytes = 1 << (maxLoopBlocksAllowed - minBlocksNeededForLoop + 1);
nPaddingBytes = (-(int)(size_t)offset) & (alignmentBoundary - 1);
#endif
// Check if the loop is already at new alignment boundary
if (nPaddingBytes == 0)
{
skipPadding = true;
JITDUMP(";; Skip alignment: 'Loop at %s already aligned at %uB boundary.'\n",
emitLabelString(loopHeadIG), alignmentBoundary);
}
// Check if the alignment exceeds new maxPadding limit
else if (nPaddingBytes > nMaxPaddingBytes)
{
skipPadding = true;
JITDUMP(";; Skip alignment: 'Loop at %s PaddingNeeded= %d, MaxPadding= %d, LoopSize= %d, "
"AlignmentBoundary= %dB.'\n",
emitLabelString(loopHeadIG), nPaddingBytes, nMaxPaddingBytes, loopSize, alignmentBoundary);
}
}
// If within maxPaddingLimit
if (!skipPadding)
{
// Padding is needed only if loop starts at or after the current offset.
// Otherwise, the loop just fits in minBlocksNeededForLoop and so can skip alignment.
size_t extraBytesNotInLoop =
(size_t)(emitComp->opts.compJitAlignLoopBoundary * minBlocksNeededForLoop) - loopSize;
size_t currentOffset = (size_t)offset % alignmentBoundary;
if (currentOffset > extraBytesNotInLoop)
{
// Padding is needed only if loop starts at or after the current offset and hence might not
// fit in minBlocksNeededForLoop
paddingToAdd = nPaddingBytes;
}
else
{
// Otherwise, the loop just fits in minBlocksNeededForLoop and so can skip alignment.
JITDUMP(";; Skip alignment: 'Loop at %s is aligned to fit in %d blocks of %d chunks.'\n",
emitLabelString(loopHeadIG), minBlocksNeededForLoop, alignmentBoundary);
}
}
}
else
{
// non-adaptive loop alignment
unsigned extraBytesNotInLoop = (alignmentBoundary * minBlocksNeededForLoop) - loopSize;
unsigned currentOffset = (size_t)offset % alignmentBoundary;
#ifdef DEBUG
// Mitigate JCC erratum by making sure the jmp doesn't fall on the boundary
if (emitComp->opts.compJitAlignLoopForJcc)
{
// TODO: See if extra padding we might end up adding to mitigate JCC erratum is worth doing?
currentOffset++;
}
#endif
if (currentOffset > extraBytesNotInLoop)
{
// Padding is needed only if loop starts at or after the current offset and hence might not
// fit in minBlocksNeededForLoop
paddingToAdd = (-(int)(size_t)offset) & (alignmentBoundary - 1);
}
else
{
// Otherwise, the loop just fits in minBlocksNeededForLoop and so can skip alignment.
JITDUMP(";; Skip alignment: 'Loop at %s is aligned to fit in %d blocks of %d chunks.'\n",
emitLabelString(loopHeadIG), minBlocksNeededForLoop, alignmentBoundary);
}
}
JITDUMP(";; Calculated padding to add %d bytes to align %s at %dB boundary.\n", paddingToAdd,
emitLabelString(loopHeadIG), alignmentBoundary);
// Either no padding is added because it is too expensive or the offset gets aligned
// to the alignment boundary
assert(paddingToAdd == 0 || (((offset + paddingToAdd) & (alignmentBoundary - 1)) == 0));
return paddingToAdd;
}
// emitAlignInNextIG: On xarch, for adaptive alignment, this will usually return the next instruction in
// 'emitAlignList'. But for arm64 or non-adaptive alignment on xarch, where multiple
// align instructions are emitted, this method will skip the 'align' instruction present
// in the same IG and return the first instruction that is present in next IG.
// Arguments:
// alignInstr - Current 'align' instruction for which next IG's first 'align' should be returned.
//
emitter::instrDescAlign* emitter::emitAlignInNextIG(instrDescAlign* alignInstr)
{
// If there are multiple align instructions, skip the align instructions after
// the first align instruction and fast forward to the next IG
insGroup* alignIG = alignInstr->idaIG;
while ((alignInstr != nullptr) && (alignInstr->idaNext != nullptr) && (alignInstr->idaNext->idaIG == alignIG))
{
alignInstr = alignInstr->idaNext;
}
return alignInstr != nullptr ? alignInstr->idaNext : nullptr;
}
#endif // FEATURE_LOOP_ALIGN
void emitter::emitCheckFuncletBranch(instrDesc* jmp, insGroup* jmpIG)
{
#ifdef TARGET_LOONGARCH64
// TODO-LoongArch64: support idDebugOnlyInfo.
return;
#else
#ifdef DEBUG
// We should not be jumping/branching across funclets/functions
// Except possibly a 'call' to a finally funclet for a local unwind
// or a 'return' from a catch handler (that can go just about anywhere)
// This routine attempts to validate that any branches across funclets
// meets one of those criteria...
assert(jmp->idIsBound());
#ifdef TARGET_XARCH
// An lea of a code address (for constant data stored with the code)
// is treated like a jump for emission purposes but is not really a jump so
// we don't have to check anything here.
if (jmp->idIns() == INS_lea)
{
return;
}
#endif
if (jmp->idAddr()->iiaHasInstrCount())
{
// Too hard to figure out funclets from just an instruction count
// You're on your own!
return;
}
#ifdef TARGET_ARM64
// No interest if it's not jmp.
if (emitIsLoadLabel(jmp) || emitIsLoadConstant(jmp))
{
return;
}
#endif // TARGET_ARM64
insGroup* tgtIG = jmp->idAddr()->iiaIGlabel;
assert(tgtIG);
if (tgtIG->igFuncIdx != jmpIG->igFuncIdx)
{
if (jmp->idDebugOnlyInfo()->idFinallyCall)
{
// We don't record enough information to determine this accurately, so instead
// we assume that any branch to the very start of a finally is OK.
// No branches back to the root method
assert(tgtIG->igFuncIdx > 0);
FuncInfoDsc* tgtFunc = emitComp->funGetFunc(tgtIG->igFuncIdx);
assert(tgtFunc->funKind == FUNC_HANDLER);
EHblkDsc* tgtEH = emitComp->ehGetDsc(tgtFunc->funEHIndex);
// Only branches to finallys (not faults, catches, filters, etc.)
assert(tgtEH->HasFinallyHandler());
// Only to the first block of the finally (which is properly marked)
BasicBlock* tgtBlk = tgtEH->ebdHndBeg;
assert(tgtBlk->bbFlags & BBF_FUNCLET_BEG);
// And now we made it back to where we started
assert(tgtIG == emitCodeGetCookie(tgtBlk));
assert(tgtIG->igFuncIdx == emitComp->funGetFuncIdx(tgtBlk));
}
else if (jmp->idDebugOnlyInfo()->idCatchRet)
{
// Again there isn't enough information to prove this correct
// so just allow a 'branch' to any other 'parent' funclet
FuncInfoDsc* jmpFunc = emitComp->funGetFunc(jmpIG->igFuncIdx);
assert(jmpFunc->funKind == FUNC_HANDLER);
EHblkDsc* jmpEH = emitComp->ehGetDsc(jmpFunc->funEHIndex);
// Only branches out of catches
assert(jmpEH->HasCatchHandler());
FuncInfoDsc* tgtFunc = emitComp->funGetFunc(tgtIG->igFuncIdx);
assert(tgtFunc);
if (tgtFunc->funKind == FUNC_HANDLER)
{
// An outward chain to the containing funclet/EH handler
// Note that it might be anywhere within nested try bodies
assert(jmpEH->ebdEnclosingHndIndex == tgtFunc->funEHIndex);
}
else
{
// This funclet is 'top level' and so it is branching back to the
// root function, and should have no containing EH handlers
// but it could be nested within try bodies...
assert(tgtFunc->funKind == FUNC_ROOT);
assert(jmpEH->ebdEnclosingHndIndex == EHblkDsc::NO_ENCLOSING_INDEX);
}
}
else
{
printf("Hit an illegal branch between funclets!");
assert(tgtIG->igFuncIdx == jmpIG->igFuncIdx);
}
}
#endif // DEBUG
#endif
}
/*****************************************************************************
*
* Compute the code sizes that we're going to use to allocate the code buffers.
*
* This sets:
*
* emitTotalHotCodeSize
* emitTotalColdCodeSize
* Compiler::info.compTotalHotCodeSize
* Compiler::info.compTotalColdCodeSize
*/
void emitter::emitComputeCodeSizes()
{
assert((emitComp->fgFirstColdBlock == nullptr) == (emitFirstColdIG == nullptr));
if (emitFirstColdIG)
{
emitTotalHotCodeSize = emitFirstColdIG->igOffs;
emitTotalColdCodeSize = emitTotalCodeSize - emitTotalHotCodeSize;
}
else
{
emitTotalHotCodeSize = emitTotalCodeSize;
emitTotalColdCodeSize = 0;
}
emitComp->info.compTotalHotCodeSize = emitTotalHotCodeSize;
emitComp->info.compTotalColdCodeSize = emitTotalColdCodeSize;
#ifdef DEBUG
if (emitComp->verbose)
{
printf("\nHot code size = 0x%X bytes\n", emitTotalHotCodeSize);
printf("Cold code size = 0x%X bytes\n", emitTotalColdCodeSize);
}
#endif
}
//------------------------------------------------------------------------
// emitEndCodeGen: called at end of code generation to create code, data, and gc info
//
// Arguments:
// comp - compiler instance
// contTrkPtrLcls - true if tracked stack pointers are contiguous on the stack
// fullInt - true if method has fully interruptible gc reporting
// fullPtrMap - true if gc reporting should use full register pointer map
// xcptnsCount - number of EH clauses to report for the method
// prologSize [OUT] - prolog size in bytes
// epilogSize [OUT] - epilog size in bytes (see notes)
// codeAddr [OUT] - address of the code buffer
// coldCodeAddr [OUT] - address of the cold code buffer (if any)
// consAddr [OUT] - address of the read only constant buffer (if any)
//
// Notes:
// Currently, in methods with multiple epilogs, all epilogs must have the same
// size. epilogSize is the size of just one of these epilogs, not the cumulative
// size of all of the method's epilogs.
//
// Returns:
// size of the method code, in bytes
//
unsigned emitter::emitEndCodeGen(Compiler* comp,
bool contTrkPtrLcls,
bool fullyInt,
bool fullPtrMap,
unsigned xcptnsCount,
unsigned* prologSize,
unsigned* epilogSize,
void** codeAddr,
void** coldCodeAddr,
void** consAddr DEBUGARG(unsigned* instrCount))
{
#ifdef DEBUG
if (emitComp->verbose)
{
printf("*************** In emitEndCodeGen()\n");
}
#endif
BYTE* consBlock;
BYTE* consBlockRW;
BYTE* codeBlock;
BYTE* codeBlockRW;
BYTE* coldCodeBlock;
BYTE* coldCodeBlockRW;
BYTE* cp;
assert(emitCurIG == nullptr);
emitCodeBlock = nullptr;
emitConsBlock = nullptr;
emitOffsAdj = 0;
/* Tell everyone whether we have fully interruptible code or not */
emitFullyInt = fullyInt;
emitFullGCinfo = fullPtrMap;
#ifndef UNIX_X86_ABI
emitFullArgInfo = !emitHasFramePtr;
#else
emitFullArgInfo = fullPtrMap;
#endif
#if EMITTER_STATS
GCrefsTable.record(emitGCrFrameOffsCnt);
emitSizeTable.record(static_cast<unsigned>(emitSizeMethod));
stkDepthTable.record(emitMaxStackDepth);
#endif // EMITTER_STATS
// Default values, correct even if EMIT_TRACK_STACK_DEPTH is 0.
emitSimpleStkUsed = true;
u1.emitSimpleStkMask = 0;
u1.emitSimpleByrefStkMask = 0;
#if EMIT_TRACK_STACK_DEPTH
/* Convert max. stack depth from # of bytes to # of entries */
unsigned maxStackDepthIn4ByteElements = emitMaxStackDepth / sizeof(int);
JITDUMP("Converting emitMaxStackDepth from bytes (%d) to elements (%d)\n", emitMaxStackDepth,
maxStackDepthIn4ByteElements);
emitMaxStackDepth = maxStackDepthIn4ByteElements;
/* Should we use the simple stack */
if (emitMaxStackDepth > MAX_SIMPLE_STK_DEPTH || emitFullGCinfo)
{
/* We won't use the "simple" argument table */
emitSimpleStkUsed = false;
/* Allocate the argument tracking table */
if (emitMaxStackDepth <= sizeof(u2.emitArgTrackLcl))
{
u2.emitArgTrackTab = (BYTE*)u2.emitArgTrackLcl;
}
else
{
u2.emitArgTrackTab = (BYTE*)emitGetMem(roundUp(emitMaxStackDepth));
}
u2.emitArgTrackTop = u2.emitArgTrackTab;
u2.emitGcArgTrackCnt = 0;
}
#endif
if (emitEpilogCnt == 0)
{
/* No epilogs, make sure the epilog size is set to 0 */
emitEpilogSize = 0;
#ifdef TARGET_XARCH
emitExitSeqSize = 0;
#endif // TARGET_XARCH
}
/* Return the size of the epilog to the caller */
*epilogSize = emitEpilogSize;
#ifdef TARGET_XARCH
*epilogSize += emitExitSeqSize;
#endif // TARGET_XARCH
#ifdef DEBUG
if (EMIT_INSTLIST_VERBOSE)
{
printf("\nInstruction list before instruction issue:\n\n");
emitDispIGlist(true);
}
emitCheckIGoffsets();
#endif
/* Allocate the code block (and optionally the data blocks) */
// If we're doing procedure splitting and we found cold blocks, then
// allocate hot and cold buffers. Otherwise only allocate a hot
// buffer.
coldCodeBlock = nullptr;
CorJitAllocMemFlag allocMemFlag = CORJIT_ALLOCMEM_DEFAULT_CODE_ALIGN;
#ifdef TARGET_X86
//
// These are the heuristics we use to decide whether or not to force the
// code to be 16-byte aligned.
//
// 1. For ngen code with IBC data, use 16-byte alignment if the method
// has been called more than ScenarioHotWeight times.
// 2. For JITed code and ngen code without IBC data, use 16-byte alignment
// when the code is 16 bytes or smaller. We align small getters/setters
// because of they are penalized heavily on certain hardware when not 16-byte
// aligned (VSWhidbey #373938). To minimize size impact of this optimization,
// we do not align large methods because of the penalty is amortized for them.
//
if (emitComp->fgHaveProfileData())
{
const weight_t scenarioHotWeight = 256.0;
if (emitComp->fgCalledCount > (scenarioHotWeight * emitComp->fgProfileRunsCount()))
{
allocMemFlag = CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN;
}
}
else
{
if (emitTotalHotCodeSize <= 16)
{
allocMemFlag = CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN;
}
}
#endif
#if defined(TARGET_XARCH) || defined(TARGET_ARM64)
// For x64/x86/arm64, align methods that are "optimizations enabled" to 32 byte boundaries if
// they are larger than 16 bytes and contain a loop.
//
if (emitComp->opts.OptimizationEnabled() && !emitComp->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT) &&
(emitTotalHotCodeSize > 16) && emitComp->fgHasLoops)
{
allocMemFlag = CORJIT_ALLOCMEM_FLG_32BYTE_ALIGN;
}
#endif
// This restricts the emitConsDsc.alignment to: 1, 2, 4, 8, 16, or 32 bytes
// Alignments greater than 32 would require VM support in ICorJitInfo::allocMem
assert(isPow2(emitConsDsc.alignment) && (emitConsDsc.alignment <= 32));
if (emitConsDsc.alignment == 16)
{
allocMemFlag = static_cast<CorJitAllocMemFlag>(allocMemFlag | CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN);
}
else if (emitConsDsc.alignment == 32)
{
allocMemFlag = static_cast<CorJitAllocMemFlag>(allocMemFlag | CORJIT_ALLOCMEM_FLG_RODATA_32BYTE_ALIGN);
}
AllocMemArgs args;
memset(&args, 0, sizeof(args));
#ifdef TARGET_ARM64
// For arm64, we want to allocate JIT data always adjacent to code similar to what native compiler does.
// This way allows us to use a single `ldr` to access such data like float constant/jmp table.
if (emitTotalColdCodeSize > 0)
{
// JIT data might be far away from the cold code.
NYI_ARM64("Need to handle fix-up to data from cold code.");
}
UNATIVE_OFFSET roDataAlignmentDelta = 0;
if (emitConsDsc.dsdOffs && (emitConsDsc.alignment == TARGET_POINTER_SIZE))
{
UNATIVE_OFFSET roDataAlignment = TARGET_POINTER_SIZE; // 8 Byte align by default.
roDataAlignmentDelta = (UNATIVE_OFFSET)ALIGN_UP(emitTotalHotCodeSize, roDataAlignment) - emitTotalHotCodeSize;
assert((roDataAlignmentDelta == 0) || (roDataAlignmentDelta == 4));
}
args.hotCodeSize = emitTotalHotCodeSize + roDataAlignmentDelta + emitConsDsc.dsdOffs;
args.coldCodeSize = emitTotalColdCodeSize;
args.roDataSize = 0;
args.xcptnsCount = xcptnsCount;
args.flag = allocMemFlag;
emitCmpHandle->allocMem(&args);
codeBlock = (BYTE*)args.hotCodeBlock;
codeBlockRW = (BYTE*)args.hotCodeBlockRW;
coldCodeBlock = (BYTE*)args.coldCodeBlock;
coldCodeBlockRW = (BYTE*)args.coldCodeBlockRW;
consBlock = codeBlock + emitTotalHotCodeSize + roDataAlignmentDelta;
consBlockRW = codeBlockRW + emitTotalHotCodeSize + roDataAlignmentDelta;
#else
args.hotCodeSize = emitTotalHotCodeSize;
args.coldCodeSize = emitTotalColdCodeSize;
args.roDataSize = emitConsDsc.dsdOffs;
args.xcptnsCount = xcptnsCount;
args.flag = allocMemFlag;
emitCmpHandle->allocMem(&args);
codeBlock = (BYTE*)args.hotCodeBlock;
codeBlockRW = (BYTE*)args.hotCodeBlockRW;
coldCodeBlock = (BYTE*)args.coldCodeBlock;
coldCodeBlockRW = (BYTE*)args.coldCodeBlockRW;
consBlock = (BYTE*)args.roDataBlock;
consBlockRW = (BYTE*)args.roDataBlockRW;
#endif
#ifdef DEBUG
if ((allocMemFlag & CORJIT_ALLOCMEM_FLG_32BYTE_ALIGN) != 0)
{
assert(((size_t)codeBlock & 31) == 0);
}
#endif
// if (emitConsDsc.dsdOffs)
// printf("Cons=%08X\n", consBlock);
/* Give the block addresses to the caller and other functions here */
*codeAddr = emitCodeBlock = codeBlock;
*coldCodeAddr = emitColdCodeBlock = coldCodeBlock;
*consAddr = emitConsBlock = consBlock;
/* Nothing has been pushed on the stack */
CLANG_FORMAT_COMMENT_ANCHOR;
#if EMIT_TRACK_STACK_DEPTH
emitCurStackLvl = 0;
#endif
/* Assume no live GC ref variables on entry */
VarSetOps::ClearD(emitComp, emitThisGCrefVars); // This is initialized to Empty at the start of codegen.
#if defined(DEBUG) && defined(JIT32_ENCODER)
VarSetOps::ClearD(emitComp, debugThisGCRefVars);
VarSetOps::ClearD(emitComp, debugPrevGCRefVars);
debugPrevRegPtrDsc = nullptr;
#endif
emitThisGCrefRegs = emitThisByrefRegs = RBM_NONE;
emitThisGCrefVset = true;
#ifdef DEBUG
emitIssuing = true;
// We don't use these after this point
VarSetOps::AssignNoCopy(emitComp, emitPrevGCrefVars, VarSetOps::UninitVal());
emitPrevGCrefRegs = emitPrevByrefRegs = 0xBAADFEED;
VarSetOps::AssignNoCopy(emitComp, emitInitGCrefVars, VarSetOps::UninitVal());
emitInitGCrefRegs = emitInitByrefRegs = 0xBAADFEED;
#endif
/* Initialize the GC ref variable lifetime tracking logic */
codeGen->gcInfo.gcVarPtrSetInit();
emitSyncThisObjOffs = -1; /* -1 means no offset set */
emitSyncThisObjReg = REG_NA; /* REG_NA means not set */
#ifdef JIT32_GCENCODER
if (emitComp->lvaKeepAliveAndReportThis())
{
assert(emitComp->lvaIsOriginalThisArg(0));
LclVarDsc* thisDsc = emitComp->lvaGetDesc(0U);
/* If "this" (which is passed in as a register argument in REG_ARG_0)
is enregistered, we normally spot the "mov REG_ARG_0 -> thisReg"
in the prolog and note the location of "this" at that point.
However, if 'this' is enregistered into REG_ARG_0 itself, no code
will be generated in the prolog, so we explicitly need to note
the location of "this" here.
NOTE that we can do this even if "this" is not enregistered in
REG_ARG_0, and it will result in more accurate "this" info over the
prolog. However, as methods are not interruptible over the prolog,
we try to save space by avoiding that.
*/
if (thisDsc->lvRegister)
{
emitSyncThisObjReg = thisDsc->GetRegNum();
if (emitSyncThisObjReg == (int)REG_ARG_0 &&
(codeGen->intRegState.rsCalleeRegArgMaskLiveIn & genRegMask(REG_ARG_0)))
{
if (emitFullGCinfo)
{
emitGCregLiveSet(GCT_GCREF, genRegMask(REG_ARG_0),
emitCodeBlock, // from offset 0
true);
}
else
{
/* If emitFullGCinfo==false, then we don't use any
regPtrDsc's and so explictly note the location
of "this" in GCEncode.cpp
*/
}
}
}
}
#endif // JIT32_GCENCODER
emitContTrkPtrLcls = contTrkPtrLcls;
/* Are there any GC ref variables on the stack? */
if (emitGCrFrameOffsCnt)
{
size_t siz;
unsigned cnt;
unsigned num;
LclVarDsc* dsc;
int* tab;
/* Allocate and clear emitGCrFrameLiveTab[]. This is the table
mapping "stkOffs -> varPtrDsc". It holds a pointer to
the liveness descriptor that was created when the
variable became alive. When the variable becomes dead, the
descriptor will be appended to the liveness descriptor list, and
the entry in emitGCrFrameLiveTab[] will be made NULL.
Note that if all GC refs are assigned consecutively,
emitGCrFrameLiveTab[] can be only as big as the number of GC refs
present, instead of lvaTrackedCount.
*/
siz = emitGCrFrameOffsCnt * sizeof(*emitGCrFrameLiveTab);
emitGCrFrameLiveTab = (varPtrDsc**)emitGetMem(roundUp(siz));
memset(emitGCrFrameLiveTab, 0, siz);
/* Allocate and fill in emitGCrFrameOffsTab[]. This is the table
mapping "varIndex -> stkOffs".
Non-ptrs or reg vars have entries of -1.
Entries of Tracked stack byrefs have the lower bit set to 1.
*/
emitTrkVarCnt = cnt = emitComp->lvaTrackedCount;
assert(cnt);
emitGCrFrameOffsTab = tab = (int*)emitGetMem(cnt * sizeof(int));
memset(emitGCrFrameOffsTab, -1, cnt * sizeof(int));
/* Now fill in all the actual used entries */
for (num = 0, dsc = emitComp->lvaTable, cnt = emitComp->lvaCount; num < cnt; num++, dsc++)
{
if (!dsc->lvOnFrame || (dsc->lvIsParam && !dsc->lvIsRegArg))
{
continue;
}
#if FEATURE_FIXED_OUT_ARGS
if (num == emitComp->lvaOutgoingArgSpaceVar)
{
continue;
}
#endif // FEATURE_FIXED_OUT_ARGS
int offs = dsc->GetStackOffset();
/* Is it within the interesting range of offsets */
if (offs >= emitGCrFrameOffsMin && offs < emitGCrFrameOffsMax)
{
/* Are tracked stack ptr locals laid out contiguously?
If not, skip non-ptrs. The emitter is optimized to work
with contiguous ptrs, but for EditNContinue, the variables
are laid out in the order they occur in the local-sig.
*/
if (!emitContTrkPtrLcls)
{
if (!emitComp->lvaIsGCTracked(dsc))
{
continue;
}
}
unsigned indx = dsc->lvVarIndex;
assert(!dsc->lvRegister);
assert(dsc->lvTracked);
assert(dsc->lvRefCnt() != 0);
assert(dsc->TypeGet() == TYP_REF || dsc->TypeGet() == TYP_BYREF);
assert(indx < emitComp->lvaTrackedCount);
// printf("Variable #%2u/%2u is at stack offset %d\n", num, indx, offs);
#ifdef JIT32_GCENCODER
#ifndef FEATURE_EH_FUNCLETS
// Remember the frame offset of the "this" argument for synchronized methods.
if (emitComp->lvaIsOriginalThisArg(num) && emitComp->lvaKeepAliveAndReportThis())
{
emitSyncThisObjOffs = offs;
offs |= this_OFFSET_FLAG;
}
#endif
#endif // JIT32_GCENCODER
if (dsc->TypeGet() == TYP_BYREF)
{
offs |= byref_OFFSET_FLAG;
}
tab[indx] = offs;
}
}
}
else
{
#ifdef DEBUG
emitTrkVarCnt = 0;
emitGCrFrameOffsTab = nullptr;
#endif
}
#ifdef DEBUG
if (emitComp->verbose)
{
printf("\n***************************************************************************\n");
printf("Instructions as they come out of the scheduler\n\n");
}
#endif
/* Issue all instruction groups in order */
cp = codeBlock;
writeableOffset = codeBlockRW - codeBlock;
#define DEFAULT_CODE_BUFFER_INIT 0xcc
#ifdef DEBUG
*instrCount = 0;
jitstd::list<PreciseIPMapping>::iterator nextMapping = emitComp->genPreciseIPmappings.begin();
#endif
for (insGroup* ig = emitIGlist; ig != nullptr; ig = ig->igNext)
{
assert(!(ig->igFlags & IGF_PLACEHOLDER)); // There better not be any placeholder groups left
/* Is this the first cold block? */
if (ig == emitFirstColdIG)
{
assert(emitCurCodeOffs(cp) == emitTotalHotCodeSize);
assert(coldCodeBlock);
cp = coldCodeBlock;
writeableOffset = coldCodeBlockRW - coldCodeBlock;
#ifdef DEBUG
if (emitComp->opts.disAsm || emitComp->verbose)
{
printf("\n************** Beginning of cold code **************\n");
}
#endif
}
/* Are we overflowing? */
if (ig->igNext && (ig->igNum + 1 != ig->igNext->igNum))
{
NO_WAY("Too many instruction groups");
}
// If this instruction group is returned to from a funclet implementing a finally,
// on architectures where it is necessary generate GC info for the current instruction as
// if it were the instruction following a call.
emitGenGCInfoIfFuncletRetTarget(ig, cp);
instrDesc* id = (instrDesc*)ig->igData;
#ifdef DEBUG
/* Print the IG label, but only if it is a branch label */
if (emitComp->opts.disAsm || emitComp->verbose)
{
if (emitComp->verbose || emitComp->opts.disasmWithGC)
{
printf("\n");
emitDispIG(ig); // Display the flags, IG data, etc.
}
else
{
printf("\n%s:", emitLabelString(ig));
if (!emitComp->opts.disDiffable)
{
printf(" ;; offset=%04XH", emitCurCodeOffs(cp));
}
printf("\n");
}
}
#endif // DEBUG
BYTE* bp = cp;
/* Record the actual offset of the block, noting the difference */
int newOffsAdj = ig->igOffs - emitCurCodeOffs(cp);
#if DEBUG_EMIT
#ifdef DEBUG
// Under DEBUG, only output under verbose flag.
if (emitComp->verbose)
#endif // DEBUG
{
if (newOffsAdj != 0)
{
printf("Block predicted offs = %08X, actual = %08X -> size adj = %d\n", ig->igOffs, emitCurCodeOffs(cp),
newOffsAdj);
}
if (emitOffsAdj != newOffsAdj)
{
printf("Block expected size adj %d not equal to actual size adj %d (probably some instruction size was "
"underestimated but not included in the running `emitOffsAdj` count)\n",
emitOffsAdj, newOffsAdj);
}
}
// Make it noisy in DEBUG if these don't match. In release, the noway_assert below checks the
// fatal condition.
assert(emitOffsAdj == newOffsAdj);
#endif // DEBUG_EMIT
// We can't have over-estimated the adjustment, or we might have underestimated a jump distance.
noway_assert(emitOffsAdj <= newOffsAdj);
emitOffsAdj = newOffsAdj;
assert(emitOffsAdj >= 0);
ig->igOffs = emitCurCodeOffs(cp);
assert(IsCodeAligned(ig->igOffs));
#if EMIT_TRACK_STACK_DEPTH
/* Set the proper stack level if appropriate */
if (ig->igStkLvl != emitCurStackLvl)
{
/* We are pushing stuff implicitly at this label */
assert((unsigned)ig->igStkLvl > (unsigned)emitCurStackLvl);
emitStackPushN(cp, (ig->igStkLvl - (unsigned)emitCurStackLvl) / sizeof(int));
}
#endif
/* Update current GC information for IG's that do not extend the previous IG */
if (!(ig->igFlags & IGF_EXTEND))
{
/* Is there a new set of live GC ref variables? */
if (ig->igFlags & IGF_GC_VARS)
{
emitUpdateLiveGCvars(ig->igGCvars(), cp);
}
else if (!emitThisGCrefVset)
{
emitUpdateLiveGCvars(emitThisGCrefVars, cp);
}
/* Update the set of live GC ref registers */
{
regMaskTP GCregs = ig->igGCregs;
if (GCregs != emitThisGCrefRegs)
{
emitUpdateLiveGCregs(GCT_GCREF, GCregs, cp);
}
}
/* Is there a new set of live byref registers? */
if (ig->igFlags & IGF_BYREF_REGS)
{
unsigned byrefRegs = ig->igByrefRegs();
if (byrefRegs != emitThisByrefRegs)
{
emitUpdateLiveGCregs(GCT_BYREF, byrefRegs, cp);
}
}
#ifdef DEBUG
if (EMIT_GC_VERBOSE || emitComp->opts.disasmWithGC)
{
emitDispGCInfoDelta();
}
#endif // DEBUG
}
else
{
// These are not set for "overflow" groups
assert(!(ig->igFlags & IGF_GC_VARS));
assert(!(ig->igFlags & IGF_BYREF_REGS));
}
/* Issue each instruction in order */
emitCurIG = ig;
for (unsigned cnt = ig->igInsCnt; cnt > 0; cnt--)
{
#ifdef DEBUG
size_t curInstrAddr = (size_t)cp;
instrDesc* curInstrDesc = id;
if ((emitComp->opts.disAsm || emitComp->verbose) && (JitConfig.JitDisasmWithDebugInfo() != 0) &&
(id->idCodeSize() > 0))
{
UNATIVE_OFFSET curCodeOffs = emitCurCodeOffs(cp);
while (nextMapping != emitComp->genPreciseIPmappings.end())
{
UNATIVE_OFFSET mappingOffs = nextMapping->nativeLoc.CodeOffset(this);
if (mappingOffs > curCodeOffs)
{
// Still haven't reached instruction that next mapping belongs to.
break;
}
// We reached the mapping or went past it.
if (mappingOffs == curCodeOffs)
{
emitDispInsIndent();
printf("; ");
nextMapping->debugInfo.Dump(true);
printf("\n");
}
++nextMapping;
}
}
#endif
castto(id, BYTE*) += emitIssue1Instr(ig, id, &cp);
#ifdef DEBUG
// Print the alignment boundary
if ((emitComp->opts.disAsm || emitComp->verbose) && (emitComp->opts.disAddr || emitComp->opts.disAlignment))
{
size_t afterInstrAddr = (size_t)cp;
instruction curIns = curInstrDesc->idIns();
bool isJccAffectedIns = false;
#if defined(TARGET_XARCH)
// Determine if this instruction is part of a set that matches the Intel jcc erratum characteristic
// described here:
// https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf
// This is the case when a jump instruction crosses a 32-byte boundary, or ends on a 32-byte boundary.
// "Jump instruction" in this case includes conditional jump (jcc), macro-fused op-jcc (where 'op' is
// one of cmp, test, add, sub, and, inc, or dec), direct unconditional jump, indirect jump,
// direct/indirect call, and return.
size_t jccAlignBoundary = 32;
size_t jccAlignBoundaryMask = jccAlignBoundary - 1;
size_t jccLastBoundaryAddr = afterInstrAddr & ~jccAlignBoundaryMask;
if (curInstrAddr < jccLastBoundaryAddr)
{
isJccAffectedIns = IsJccInstruction(curIns) || IsJmpInstruction(curIns) || (curIns == INS_call) ||
(curIns == INS_ret);
// For op-Jcc there are two cases: (1) curIns is the jcc, in which case the above condition
// already covers us. (2) curIns is the `op` and the next instruction is the `jcc`. Note that
// we will never have a `jcc` as the first instruction of a group, so we don't need to worry
// about looking ahead to the next group after a an `op` of `op-Jcc`.
if (!isJccAffectedIns && (cnt > 1))
{
// The current `id` is valid, namely, there is another instruction in this group.
instruction nextIns = id->idIns();
if (((curIns == INS_cmp) || (curIns == INS_test) || (curIns == INS_add) ||
(curIns == INS_sub) || (curIns == INS_and) || (curIns == INS_inc) ||
(curIns == INS_dec)) &&
IsJccInstruction(nextIns))
{
isJccAffectedIns = true;
}
}
if (isJccAffectedIns)
{
unsigned bytesCrossedBoundary = (unsigned)(afterInstrAddr & jccAlignBoundaryMask);
printf("; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (%s: %d ; jcc erratum) %dB boundary "
"...............................\n",
codeGen->genInsDisplayName(curInstrDesc), bytesCrossedBoundary, jccAlignBoundary);
}
}
#elif defined(TARGET_LOONGARCH64)
isJccAffectedIns = true;
#endif // TARGET_LOONGARCH64
// Jcc affected instruction boundaries were printed above; handle other cases here.
if (!isJccAffectedIns)
{
size_t alignBoundaryMask = (size_t)emitComp->opts.compJitAlignLoopBoundary - 1;
size_t lastBoundaryAddr = afterInstrAddr & ~alignBoundaryMask;
// draw boundary if beforeAddr was before the lastBoundary.
if (curInstrAddr < lastBoundaryAddr)
{
// Indicate if instruction is at the alignment boundary or is split
unsigned bytesCrossedBoundary = (unsigned)(afterInstrAddr & alignBoundaryMask);
if (bytesCrossedBoundary != 0)
{
printf("; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (%s: %d)",
codeGen->genInsDisplayName(curInstrDesc), bytesCrossedBoundary);
}
else
{
printf("; ...............................");
}
printf(" %dB boundary ...............................\n",
emitComp->opts.compJitAlignLoopBoundary);
}
}
}
#endif // DEBUG
}
#ifdef DEBUG
if (emitComp->opts.disAsm || emitComp->verbose)
{
printf("\t\t\t\t\t\t;; size=%d bbWeight=%s PerfScore %.2f", ig->igSize, refCntWtd2str(ig->igWeight),
ig->igPerfScore);
}
*instrCount += ig->igInsCnt;
#endif // DEBUG
emitCurIG = nullptr;
assert(ig->igSize >= cp - bp);
// Is it the last ig in the hot part?
bool lastHotIG = (emitFirstColdIG != nullptr && ig->igNext == emitFirstColdIG);
if (lastHotIG)
{
unsigned actualHotCodeSize = emitCurCodeOffs(cp);
unsigned allocatedHotCodeSize = emitTotalHotCodeSize;
assert(actualHotCodeSize <= allocatedHotCodeSize);
if (actualHotCodeSize < allocatedHotCodeSize)
{
// The allocated chunk is bigger than used, fill in unused space in it.
unsigned unusedSize = allocatedHotCodeSize - emitCurCodeOffs(cp);
for (unsigned i = 0; i < unusedSize; ++i)
{
*cp++ = DEFAULT_CODE_BUFFER_INIT;
}
assert(allocatedHotCodeSize == emitCurCodeOffs(cp));
}
}
assert((ig->igSize >= cp - bp) || lastHotIG);
ig->igSize = (unsigned short)(cp - bp);
}
#if EMIT_TRACK_STACK_DEPTH
assert(emitCurStackLvl == 0);
#endif
/* Output any initialized data we may have */
if (emitConsDsc.dsdOffs != 0)
{
emitOutputDataSec(&emitConsDsc, consBlock);
}
/* Make sure all GC ref variables are marked as dead */
if (emitGCrFrameOffsCnt != 0)
{
unsigned vn;
int of;
varPtrDsc** dp;
for (vn = 0, of = emitGCrFrameOffsMin, dp = emitGCrFrameLiveTab; vn < emitGCrFrameOffsCnt;
vn++, of += TARGET_POINTER_SIZE, dp++)
{
if (*dp)
{
emitGCvarDeadSet(of, cp, vn);
}
}
}
/* No GC registers are live any more */
if (emitThisByrefRegs)
{
emitUpdateLiveGCregs(GCT_BYREF, RBM_NONE, cp);
}
if (emitThisGCrefRegs)
{
emitUpdateLiveGCregs(GCT_GCREF, RBM_NONE, cp);
}
/* Patch any forward jumps */
if (emitFwdJumps)
{
for (instrDescJmp* jmp = emitJumpList; jmp != nullptr; jmp = jmp->idjNext)
{
#ifdef TARGET_XARCH
assert(jmp->idInsFmt() == IF_LABEL || jmp->idInsFmt() == IF_RWR_LABEL || jmp->idInsFmt() == IF_SWR_LABEL);
#endif
insGroup* tgt = jmp->idAddr()->iiaIGlabel;
if (jmp->idjTemp.idjAddr == nullptr)
{
continue;
}
if (jmp->idjOffs != tgt->igOffs)
{
BYTE* adr = jmp->idjTemp.idjAddr;
int adj = jmp->idjOffs - tgt->igOffs;
#ifdef TARGET_ARM
// On Arm, the offset is encoded in unit of 2 bytes.
adj >>= 1;
#endif
#if DEBUG_EMIT
if ((jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM) || (INTERESTING_JUMP_NUM == 0))
{
#ifdef TARGET_ARM
printf("[5] This output is broken for ARM, since it doesn't properly decode the jump offsets of "
"the instruction at adr\n");
#endif
if (INTERESTING_JUMP_NUM == 0)
{
printf("[5] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
}
if (jmp->idjShort)
{
printf("[5] Jump is at %08X\n", (adr + 1 - emitCodeBlock));
printf("[5] Jump distance is %02X - %02X = %02X\n", *(BYTE*)adr, adj, *(BYTE*)adr - adj);
}
else
{
printf("[5] Jump is at %08X\n", (adr + 4 - emitCodeBlock));
printf("[5] Jump distance is %08X - %02X = %08X\n", *(int*)adr, adj, *(int*)adr - adj);
}
}
#endif // DEBUG_EMIT
if (jmp->idjShort)
{
// Patch Forward Short Jump
CLANG_FORMAT_COMMENT_ANCHOR;
#if defined(TARGET_XARCH)
*(BYTE*)(adr + writeableOffset) -= (BYTE)adj;
#elif defined(TARGET_ARM)
// The following works because the jump offset is in the low order bits of the instruction.
// Presumably we could also just call "emitOutputLJ(NULL, adr, jmp)", like for long jumps?
*(short int*)(adr + writeableOffset) -= (short)adj;
#elif defined(TARGET_ARM64)
assert(!jmp->idAddr()->iiaHasInstrCount());
emitOutputLJ(NULL, adr, jmp);
#elif defined(TARGET_LOONGARCH64)
// For LoongArch64 `emitFwdJumps` is always false.
unreached();
#else
#error Unsupported or unset target architecture
#endif
}
else
{
// Patch Forward non-Short Jump
CLANG_FORMAT_COMMENT_ANCHOR;
#if defined(TARGET_XARCH)
*(int*)(adr + writeableOffset) -= adj;
#elif defined(TARGET_ARMARCH)
assert(!jmp->idAddr()->iiaHasInstrCount());
emitOutputLJ(NULL, adr, jmp);
#elif defined(TARGET_LOONGARCH64)
// For LoongArch64 `emitFwdJumps` is always false.
unreached();
#else
#error Unsupported or unset target architecture
#endif
}
}
}
}
#ifdef DEBUG
if (emitComp->opts.disAsm)
{
printf("\n");
}
#endif
unsigned actualCodeSize = emitCurCodeOffs(cp);
#if defined(TARGET_ARM64)
assert(emitTotalCodeSize == actualCodeSize);
#else
assert(emitTotalCodeSize >= actualCodeSize);
#endif
#if EMITTER_STATS
totAllocdSize += emitTotalCodeSize;
totActualSize += actualCodeSize;
#endif
// Fill in eventual unused space, but do not report this space as used.
// If you add this padding during the emitIGlist loop, then it will
// emit offsets after the loop with wrong value (for example for GC ref variables).
unsigned unusedSize = emitTotalCodeSize - actualCodeSize;
JITDUMP("Allocated method code size = %4u , actual size = %4u, unused size = %4u\n", emitTotalCodeSize,
actualCodeSize, unusedSize);
BYTE* cpRW = cp + writeableOffset;
for (unsigned i = 0; i < unusedSize; ++i)
{
*cpRW++ = DEFAULT_CODE_BUFFER_INIT;
}
cp = cpRW - writeableOffset;
assert(emitTotalCodeSize == emitCurCodeOffs(cp));
// Total code size is sum of all IG->size and doesn't include padding in the last IG.
emitTotalCodeSize = actualCodeSize;
#ifdef DEBUG
// Make sure these didn't change during the "issuing" phase
assert(VarSetOps::MayBeUninit(emitPrevGCrefVars));
assert(emitPrevGCrefRegs == 0xBAADFEED);
assert(emitPrevByrefRegs == 0xBAADFEED);
assert(VarSetOps::MayBeUninit(emitInitGCrefVars));
assert(emitInitGCrefRegs == 0xBAADFEED);
assert(emitInitByrefRegs == 0xBAADFEED);
if (EMIT_INSTLIST_VERBOSE)
{
printf("\nLabels list after the end of codegen:\n\n");
emitDispIGlist(false);
}
emitCheckIGoffsets();
#endif // DEBUG
// Assign the real prolog size
*prologSize = emitCodeOffset(emitPrologIG, emitPrologEndPos);
/* Return the amount of code we've generated */
return actualCodeSize;
}
// See specification comment at the declaration.
void emitter::emitGenGCInfoIfFuncletRetTarget(insGroup* ig, BYTE* cp)
{
#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
// We only emit this GC information on targets where finally's are implemented via funclets,
// and the finally is invoked, during non-exceptional execution, via a branch with a predefined
// link register, rather than a "true call" for which we would already generate GC info. Currently,
// this means precisely ARM.
if (ig->igFlags & IGF_FINALLY_TARGET)
{
// We don't actually have a call instruction in this case, so we don't have
// a real size for that instruction. We'll use 1.
emitStackPop(cp, /*isCall*/ true, /*callInstrSize*/ 1, /*args*/ 0);
/* Do we need to record a call location for GC purposes? */
if (!emitFullGCinfo)
{
emitRecordGCcall(cp, /*callInstrSize*/ 1);
}
}
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
}
/*****************************************************************************
*
* We have an instruction in an insGroup and we need to know the
* instruction number for this instruction
*/
unsigned emitter::emitFindInsNum(insGroup* ig, instrDesc* idMatch)
{
instrDesc* id = (instrDesc*)ig->igData;
// Check if we are the first instruction in the group
if (id == idMatch)
{
return 0;
}
/* Walk the list of instructions until we find a match */
unsigned insNum = 0;
unsigned insRemaining = ig->igInsCnt;
while (insRemaining > 0)
{
castto(id, BYTE*) += emitSizeOfInsDsc(id);
insNum++;
insRemaining--;
if (id == idMatch)
{
return insNum;
}
}
assert(!"emitFindInsNum failed");
return -1;
}
/*****************************************************************************
*
* We've been asked for the code offset of an instruction but alas one or
* more instruction sizes in the block have been mis-predicted, so we have
* to find the true offset by looking for the instruction within the group.
*/
UNATIVE_OFFSET emitter::emitFindOffset(insGroup* ig, unsigned insNum)
{
instrDesc* id = (instrDesc*)ig->igData;
UNATIVE_OFFSET of = 0;
#ifdef DEBUG
/* Make sure we were passed reasonable arguments */
assert(ig && ig->igSelf == ig);
assert(ig->igInsCnt >= insNum);
#endif
/* Walk the instruction list until all are counted */
while (insNum > 0)
{
of += id->idCodeSize();
castto(id, BYTE*) += emitSizeOfInsDsc(id);
insNum--;
}
return of;
}
//---------------------------------------------------------------------------
// emitDataGenBeg:
// - Allocate space for a constant or block of the size and alignment requested
// Returns the offset in the data section to use
//
// Arguments:
// size - The size in bytes of the constant or block
// alignment - The requested alignment for the data
// dataType - The type of the constant int/float/etc
//
// Note: This method only allocate the space for the constant or block. It doesn't
// initialize the value. You call emitDataGenData to initialize the value.
//
UNATIVE_OFFSET emitter::emitDataGenBeg(unsigned size, unsigned alignment, var_types dataType)
{
unsigned secOffs;
dataSection* secDesc;
assert(emitDataSecCur == nullptr);
// The size must not be zero and must be a multiple of MIN_DATA_ALIGN
// Additionally, MIN_DATA_ALIGN is the minimum alignment that will
// actually be used. That is, if the user requests an alignment
// less than MIN_DATA_ALIGN, they will get something that is at least
// MIN_DATA_ALIGN. We allow smaller alignment to be specified since it is
// simpler to allow it than to check and block it.
//
assert((size != 0) && ((size % dataSection::MIN_DATA_ALIGN) == 0));
assert(isPow2(alignment) && (alignment <= dataSection::MAX_DATA_ALIGN));
/* Get hold of the current offset */
secOffs = emitConsDsc.dsdOffs;
if (((secOffs % alignment) != 0) && (alignment > dataSection::MIN_DATA_ALIGN))
{
// As per the above comment, the minimum alignment is actually (MIN_DATA_ALIGN)
// bytes so we don't need to make any adjustments if the requested
// alignment is less than MIN_DATA_ALIGN.
//
// The maximum requested alignment is tracked and the memory allocator
// will end up ensuring offset 0 is at an address matching that
// alignment. So if the requested alignment is greater than MIN_DATA_ALIGN,
// we need to pad the space out so the offset is a multiple of the requested.
//
uint8_t zeros[dataSection::MAX_DATA_ALIGN] = {}; // auto initialize to all zeros
unsigned zeroSize = alignment - (secOffs % alignment);
unsigned zeroAlign = dataSection::MIN_DATA_ALIGN;
var_types zeroType = TYP_INT;
emitBlkConst(&zeros, zeroSize, zeroAlign, zeroType);
secOffs = emitConsDsc.dsdOffs;
}
assert((secOffs % alignment) == 0);
emitConsDsc.alignment = max(emitConsDsc.alignment, alignment);
/* Advance the current offset */
emitConsDsc.dsdOffs += size;
/* Allocate a data section descriptor and add it to the list */
secDesc = emitDataSecCur = (dataSection*)emitGetMem(roundUp(sizeof(*secDesc) + size));
secDesc->dsSize = size;
secDesc->dsType = dataSection::data;
secDesc->dsDataType = dataType;
secDesc->dsNext = nullptr;
if (emitConsDsc.dsdLast)
{
emitConsDsc.dsdLast->dsNext = secDesc;
}
else
{
emitConsDsc.dsdList = secDesc;
}
emitConsDsc.dsdLast = secDesc;
return secOffs;
}
// Start generating a constant data section for the current function
// populated with BasicBlock references.
// You can choose the references to be either absolute pointers, or
// 4-byte relative addresses.
// Currently the relative references are relative to the start of the
// first block (this is somewhat arbitrary)
UNATIVE_OFFSET emitter::emitBBTableDataGenBeg(unsigned numEntries, bool relativeAddr)
{
unsigned secOffs;
dataSection* secDesc;
assert(emitDataSecCur == nullptr);
UNATIVE_OFFSET emittedSize;
if (relativeAddr)
{
emittedSize = numEntries * 4;
}
else
{
emittedSize = numEntries * TARGET_POINTER_SIZE;
}
/* Get hold of the current offset */
secOffs = emitConsDsc.dsdOffs;
/* Advance the current offset */
emitConsDsc.dsdOffs += emittedSize;
/* Allocate a data section descriptor and add it to the list */
secDesc = emitDataSecCur = (dataSection*)emitGetMem(roundUp(sizeof(*secDesc) + numEntries * sizeof(BasicBlock*)));
secDesc->dsSize = emittedSize;
secDesc->dsType = relativeAddr ? dataSection::blockRelative32 : dataSection::blockAbsoluteAddr;
secDesc->dsDataType = TYP_UNKNOWN;
secDesc->dsNext = nullptr;
if (emitConsDsc.dsdLast)
{
emitConsDsc.dsdLast->dsNext = secDesc;
}
else
{
emitConsDsc.dsdList = secDesc;
}
emitConsDsc.dsdLast = secDesc;
return secOffs;
}
/*****************************************************************************
*
* Emit the given block of bits into the current data section.
*/
void emitter::emitDataGenData(unsigned offs, const void* data, UNATIVE_OFFSET size)
{
assert(emitDataSecCur && (emitDataSecCur->dsSize >= offs + size));
assert(emitDataSecCur->dsType == dataSection::data);
memcpy(emitDataSecCur->dsCont + offs, data, size);
}
/*****************************************************************************
*
* Emit the address of the given basic block into the current data section.
*/
void emitter::emitDataGenData(unsigned index, BasicBlock* label)
{
assert(emitDataSecCur != nullptr);
assert(emitDataSecCur->dsType == dataSection::blockAbsoluteAddr ||
emitDataSecCur->dsType == dataSection::blockRelative32);
unsigned emittedElemSize = emitDataSecCur->dsType == dataSection::blockAbsoluteAddr ? TARGET_POINTER_SIZE : 4;
assert(emitDataSecCur->dsSize >= emittedElemSize * (index + 1));
((BasicBlock**)(emitDataSecCur->dsCont))[index] = label;
}
/*****************************************************************************
*
* We're done generating a data section.
*/
void emitter::emitDataGenEnd()
{
#ifdef DEBUG
assert(emitDataSecCur);
emitDataSecCur = nullptr;
#endif
}
//---------------------------------------------------------------------------
// emitDataGenFind:
// - Returns the offset of an existing constant in the data section
// or INVALID_UNATIVE_OFFSET if there was no matching constant
//
// Arguments:
// cnsAddr - A pointer to the value of the constant that we need
// cnsSize - The size in bytes of the constant
// alignment - The requested alignment for the data
// dataType - The type of the constant int/float/etc
//
UNATIVE_OFFSET emitter::emitDataGenFind(const void* cnsAddr, unsigned cnsSize, unsigned alignment, var_types dataType)
{
UNATIVE_OFFSET cnum = INVALID_UNATIVE_OFFSET;
unsigned cmpCount = 0;
unsigned curOffs = 0;
dataSection* secDesc = emitConsDsc.dsdList;
while (secDesc != nullptr)
{
// Search the existing secDesc entries
// We can match as smaller 'cnsSize' value at the start of a larger 'secDesc->dsSize' block
// We match the bit pattern, so the dataType can be different
// Only match constants when the dsType is 'data'
//
if ((secDesc->dsType == dataSection::data) && (secDesc->dsSize >= cnsSize) && ((curOffs % alignment) == 0))
{
if (memcmp(cnsAddr, secDesc->dsCont, cnsSize) == 0)
{
cnum = curOffs;
// We also might want to update the dsDataType
//
if ((secDesc->dsDataType != dataType) && (secDesc->dsSize == cnsSize))
{
// If the subsequent dataType is floating point then change the original dsDataType
//
if (varTypeIsFloating(dataType))
{
secDesc->dsDataType = dataType;
}
}
break;
}
}
curOffs += secDesc->dsSize;
secDesc = secDesc->dsNext;
if (++cmpCount > 64)
{
// If we don't find a match in the first 64, then we just add the new constant
// This prevents an O(n^2) search cost
break;
}
}
return cnum;
}
//---------------------------------------------------------------------------
// emitDataConst:
// - Returns the valid offset in the data section to use for the constant
// described by the arguments to this method
//
// Arguments:
// cnsAddr - A pointer to the value of the constant that we need
// cnsSize - The size in bytes of the constant
// alignment - The requested alignment for the data
// dataType - The type of the constant int/float/etc
//
//
// Notes: we call the method emitDataGenFind() to see if we already have
// a matching constant that can be reused.
//
UNATIVE_OFFSET emitter::emitDataConst(const void* cnsAddr, unsigned cnsSize, unsigned cnsAlign, var_types dataType)
{
UNATIVE_OFFSET cnum = emitDataGenFind(cnsAddr, cnsSize, cnsAlign, dataType);
if (cnum == INVALID_UNATIVE_OFFSET)
{
cnum = emitDataGenBeg(cnsSize, cnsAlign, dataType);
emitDataGenData(0, cnsAddr, cnsSize);
emitDataGenEnd();
}
return cnum;
}
//------------------------------------------------------------------------
// emitBlkConst: Create a data section constant of arbitrary size.
//
// Arguments:
// cnsAddr - pointer to the block of data to be placed in the data section
// cnsSize - total size of the block of data in bytes
// cnsAlign - alignment of the data in bytes
// elemType - The type of the elements in the constant
//
// Return Value:
// A field handle representing the data offset to access the constant.
//
CORINFO_FIELD_HANDLE emitter::emitBlkConst(const void* cnsAddr, unsigned cnsSize, unsigned cnsAlign, var_types elemType)
{
UNATIVE_OFFSET cnum = emitDataGenBeg(cnsSize, cnsAlign, elemType);
emitDataGenData(0, cnsAddr, cnsSize);
emitDataGenEnd();
return emitComp->eeFindJitDataOffs(cnum);
}
//------------------------------------------------------------------------
// emitFltOrDblConst: Create a float or double data section constant.
//
// Arguments:
// constValue - constant value
// attr - constant size
//
// Return Value:
// A field handle representing the data offset to access the constant.
//
// Notes:
// If attr is EA_4BYTE then the double value is converted to a float value.
// If attr is EA_8BYTE then 8 byte alignment is automatically requested.
//
CORINFO_FIELD_HANDLE emitter::emitFltOrDblConst(double constValue, emitAttr attr)
{
assert((attr == EA_4BYTE) || (attr == EA_8BYTE));
void* cnsAddr;
float f;
var_types dataType;
if (attr == EA_4BYTE)
{
f = forceCastToFloat(constValue);
cnsAddr = &f;
dataType = TYP_FLOAT;
}
else
{
cnsAddr = &constValue;
dataType = TYP_DOUBLE;
}
// Access to inline data is 'abstracted' by a special type of static member
// (produced by eeFindJitDataOffs) which the emitter recognizes as being a reference
// to constant data, not a real static field.
unsigned cnsSize = (attr == EA_4BYTE) ? sizeof(float) : sizeof(double);
unsigned cnsAlign = cnsSize;
#ifdef TARGET_XARCH
if (emitComp->compCodeOpt() == Compiler::SMALL_CODE)
{
// Some platforms don't require doubles to be aligned and so
// we can use a smaller alignment to help with smaller code
cnsAlign = dataSection::MIN_DATA_ALIGN;
}
#endif // TARGET_XARCH
UNATIVE_OFFSET cnum = emitDataConst(cnsAddr, cnsSize, cnsAlign, dataType);
return emitComp->eeFindJitDataOffs(cnum);
}
/*****************************************************************************
*
* Output the given data section at the specified address.
*/
void emitter::emitOutputDataSec(dataSecDsc* sec, BYTE* dst)
{
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("\nEmitting data sections: %u total bytes\n", sec->dsdOffs);
}
if (emitComp->opts.disAsm)
{
emitDispDataSec(sec);
}
unsigned secNum = 0;
#endif
assert(dst);
assert(sec->dsdOffs);
assert(sec->dsdList);
/* Walk and emit the contents of all the data blocks */
dataSection* dsc;
size_t curOffs = 0;
for (dsc = sec->dsdList; dsc; dsc = dsc->dsNext)
{
size_t dscSize = dsc->dsSize;
BYTE* dstRW = dst + writeableOffset;
// absolute label table
if (dsc->dsType == dataSection::blockAbsoluteAddr)
{
JITDUMP(" section %u, size %u, block absolute addr\n", secNum++, dscSize);
assert(dscSize && dscSize % TARGET_POINTER_SIZE == 0);
size_t numElems = dscSize / TARGET_POINTER_SIZE;
target_size_t* bDstRW = (target_size_t*)dstRW;
for (unsigned i = 0; i < numElems; i++)
{
BasicBlock* block = ((BasicBlock**)dsc->dsCont)[i];
// Convert the BasicBlock* value to an IG address
insGroup* lab = (insGroup*)emitCodeGetCookie(block);
// Append the appropriate address to the destination
BYTE* target = emitOffsetToPtr(lab->igOffs);
#ifdef TARGET_ARM
target = (BYTE*)((size_t)target | 1); // Or in thumb bit
#endif
bDstRW[i] = (target_size_t)(size_t)target;
if (emitComp->opts.compReloc)
{
emitRecordRelocation(&(bDstRW[i]), target, IMAGE_REL_BASED_HIGHLOW);
}
JITDUMP(" " FMT_BB ": 0x%p\n", block->bbNum, bDstRW[i]);
}
}
// relative label table
else if (dsc->dsType == dataSection::blockRelative32)
{
JITDUMP(" section %u, size %u, block relative addr\n", secNum++, dscSize);
size_t numElems = dscSize / 4;
unsigned* uDstRW = (unsigned*)dstRW;
insGroup* labFirst = (insGroup*)emitCodeGetCookie(emitComp->fgFirstBB);
for (unsigned i = 0; i < numElems; i++)
{
BasicBlock* block = ((BasicBlock**)dsc->dsCont)[i];
// Convert the BasicBlock* value to an IG address
insGroup* lab = (insGroup*)emitCodeGetCookie(block);
assert(FitsIn<uint32_t>(lab->igOffs - labFirst->igOffs));
uDstRW[i] = lab->igOffs - labFirst->igOffs;
JITDUMP(" " FMT_BB ": 0x%x\n", block->bbNum, uDstRW[i]);
}
}
else
{
// Simple binary data: copy the bytes to the target
assert(dsc->dsType == dataSection::data);
memcpy(dstRW, dsc->dsCont, dscSize);
#ifdef DEBUG
if (EMITVERBOSE)
{
printf(" section %3u, size %2u, RWD%2u:\t", secNum++, dscSize, curOffs);
for (size_t i = 0; i < dscSize; i++)
{
printf("%02x ", dsc->dsCont[i]);
if ((((i + 1) % 16) == 0) && (i + 1 != dscSize))
{
printf("\n\t\t\t\t\t");
}
}
switch (dsc->dsDataType)
{
case TYP_FLOAT:
printf(" ; float %9.6g", (double)*reinterpret_cast<float*>(&dsc->dsCont));
break;
case TYP_DOUBLE:
printf(" ; double %12.9g", *reinterpret_cast<double*>(&dsc->dsCont));
break;
default:
break;
}
printf("\n");
}
#endif // DEBUG
}
curOffs += dscSize;
dst += dscSize;
}
}
#ifdef DEBUG
//------------------------------------------------------------------------
// emitDispDataSec: Dump a data section to stdout.
//
// Arguments:
// section - the data section description
//
// Notes:
// The output format attempts to mirror typical assembler syntax.
// Data section entries lack type information so float/double entries
// are displayed as if they are integers/longs.
//
void emitter::emitDispDataSec(dataSecDsc* section)
{
printf("\n");
unsigned offset = 0;
for (dataSection* data = section->dsdList; data != nullptr; data = data->dsNext)
{
const char* labelFormat = "%-7s";
char label[64];
sprintf_s(label, ArrLen(label), "RWD%02u", offset);
printf(labelFormat, label);
offset += data->dsSize;
if ((data->dsType == dataSection::blockRelative32) || (data->dsType == dataSection::blockAbsoluteAddr))
{
insGroup* igFirst = static_cast<insGroup*>(emitCodeGetCookie(emitComp->fgFirstBB));
bool isRelative = (data->dsType == dataSection::blockRelative32);
size_t blockCount = data->dsSize / (isRelative ? 4 : TARGET_POINTER_SIZE);
for (unsigned i = 0; i < blockCount; i++)
{
if (i > 0)
{
printf(labelFormat, "");
}
BasicBlock* block = reinterpret_cast<BasicBlock**>(data->dsCont)[i];
insGroup* ig = static_cast<insGroup*>(emitCodeGetCookie(block));
const char* blockLabel = emitLabelString(ig);
const char* firstLabel = emitLabelString(igFirst);
if (isRelative)
{
if (emitComp->opts.disDiffable)
{
printf("\tdd\t%s - %s\n", blockLabel, firstLabel);
}
else
{
printf("\tdd\t%08Xh", ig->igOffs - igFirst->igOffs);
}
}
else
{
#ifndef TARGET_64BIT
// We have a 32-BIT target
if (emitComp->opts.disDiffable)
{
printf("\tdd\t%s\n", blockLabel);
}
else
{
printf("\tdd\t%08Xh", (uint32_t)(size_t)emitOffsetToPtr(ig->igOffs));
}
#else // TARGET_64BIT
// We have a 64-BIT target
if (emitComp->opts.disDiffable)
{
printf("\tdq\t%s\n", blockLabel);
}
else
{
printf("\tdq\t%016llXh", reinterpret_cast<uint64_t>(emitOffsetToPtr(ig->igOffs)));
}
#endif // TARGET_64BIT
}
if (!emitComp->opts.disDiffable)
{
printf(" ; case %s\n", blockLabel);
}
}
}
else
{
assert(data->dsType == dataSection::data);
unsigned elemSize = genTypeSize(data->dsDataType);
if (elemSize == 0)
{
if ((data->dsSize % 8) == 0)
{
elemSize = 8;
}
else if ((data->dsSize % 4) == 0)
{
elemSize = 4;
}
else if ((data->dsSize % 2) == 0)
{
elemSize = 2;
}
else
{
elemSize = 1;
}
}
unsigned i = 0;
unsigned j;
while (i < data->dsSize)
{
switch (data->dsDataType)
{
case TYP_FLOAT:
assert(data->dsSize >= 4);
printf("\tdd\t%08llXh\t", *reinterpret_cast<uint32_t*>(&data->dsCont[i]));
printf("\t; %9.6g", *reinterpret_cast<float*>(&data->dsCont[i]));
i += 4;
break;
case TYP_DOUBLE:
assert(data->dsSize >= 8);
printf("\tdq\t%016llXh", *reinterpret_cast<uint64_t*>(&data->dsCont[i]));
printf("\t; %12.9g", *reinterpret_cast<double*>(&data->dsCont[i]));
i += 8;
break;
default:
switch (elemSize)
{
case 1:
printf("\tdb\t%02Xh", *reinterpret_cast<uint8_t*>(&data->dsCont[i]));
for (j = 1; j < 16; j++)
{
if (i + j >= data->dsSize)
break;
printf(", %02Xh", *reinterpret_cast<uint8_t*>(&data->dsCont[i + j]));
}
i += j;
break;
case 2:
assert((data->dsSize % 2) == 0);
printf("\tdw\t%04Xh", *reinterpret_cast<uint16_t*>(&data->dsCont[i]));
for (j = 2; j < 24; j += 2)
{
if (i + j >= data->dsSize)
break;
printf(", %04Xh", *reinterpret_cast<uint16_t*>(&data->dsCont[i + j]));
}
i += j;
break;
case 12:
case 4:
assert((data->dsSize % 4) == 0);
printf("\tdd\t%08Xh", *reinterpret_cast<uint32_t*>(&data->dsCont[i]));
for (j = 4; j < 24; j += 4)
{
if (i + j >= data->dsSize)
break;
printf(", %08Xh", *reinterpret_cast<uint32_t*>(&data->dsCont[i + j]));
}
i += j;
break;
case 32:
case 16:
case 8:
assert((data->dsSize % 8) == 0);
printf("\tdq\t%016llXh", *reinterpret_cast<uint64_t*>(&data->dsCont[i]));
for (j = 8; j < 32; j += 8)
{
if (i + j >= data->dsSize)
break;
printf(", %016llXh", *reinterpret_cast<uint64_t*>(&data->dsCont[i + j]));
}
i += j;
break;
default:
assert(!"unexpected elemSize");
break;
}
}
printf("\n");
}
}
}
}
#endif
/*****************************************************************************/
/*****************************************************************************
*
* Record the fact that the given variable now contains a live GC ref.
*/
void emitter::emitGCvarLiveSet(int offs, GCtype gcType, BYTE* addr, ssize_t disp)
{
assert(emitIssuing);
varPtrDsc* desc;
assert((abs(offs) % TARGET_POINTER_SIZE) == 0);
assert(needsGC(gcType));
/* Compute the index into the GC frame table if the caller didn't do it */
if (disp == -1)
{
disp = (offs - emitGCrFrameOffsMin) / TARGET_POINTER_SIZE;
}
assert((size_t)disp < emitGCrFrameOffsCnt);
/* Allocate a lifetime record */
desc = new (emitComp, CMK_GC) varPtrDsc;
desc->vpdBegOfs = emitCurCodeOffs(addr);
#ifdef DEBUG
desc->vpdEndOfs = 0xFACEDEAD;
#endif
desc->vpdVarNum = offs;
desc->vpdNext = nullptr;
#if !defined(JIT32_GCENCODER) || !defined(FEATURE_EH_FUNCLETS)
/* the lower 2 bits encode props about the stk ptr */
if (offs == emitSyncThisObjOffs)
{
desc->vpdVarNum |= this_OFFSET_FLAG;
}
#endif
if (gcType == GCT_BYREF)
{
desc->vpdVarNum |= byref_OFFSET_FLAG;
}
/* Append the new entry to the end of the list */
if (codeGen->gcInfo.gcVarPtrLast == nullptr)
{
assert(codeGen->gcInfo.gcVarPtrList == nullptr);
codeGen->gcInfo.gcVarPtrList = codeGen->gcInfo.gcVarPtrLast = desc;
}
else
{
assert(codeGen->gcInfo.gcVarPtrList != nullptr);
codeGen->gcInfo.gcVarPtrLast->vpdNext = desc;
codeGen->gcInfo.gcVarPtrLast = desc;
}
/* Record the variable descriptor in the table */
assert(emitGCrFrameLiveTab[disp] == nullptr);
emitGCrFrameLiveTab[disp] = desc;
/* The "global" live GC variable mask is no longer up-to-date */
emitThisGCrefVset = false;
}
/*****************************************************************************
*
* Record the fact that the given variable no longer contains a live GC ref.
*/
void emitter::emitGCvarDeadSet(int offs, BYTE* addr, ssize_t disp)
{
assert(emitIssuing);
varPtrDsc* desc;
assert(abs(offs) % sizeof(int) == 0);
/* Compute the index into the GC frame table if the caller didn't do it */
if (disp == -1)
{
disp = (offs - emitGCrFrameOffsMin) / TARGET_POINTER_SIZE;
}
assert((unsigned)disp < emitGCrFrameOffsCnt);
/* Get hold of the lifetime descriptor and clear the entry */
desc = emitGCrFrameLiveTab[disp];
emitGCrFrameLiveTab[disp] = nullptr;
assert(desc);
assert((desc->vpdVarNum & ~OFFSET_MASK) == (unsigned)offs);
/* Record the death code offset */
assert(desc->vpdEndOfs == 0xFACEDEAD);
desc->vpdEndOfs = emitCurCodeOffs(addr);
/* The "global" live GC variable mask is no longer up-to-date */
emitThisGCrefVset = false;
}
/*****************************************************************************
*
* Record a new set of live GC ref variables.
*/
void emitter::emitUpdateLiveGCvars(VARSET_VALARG_TP vars, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
/* Is the current set accurate and unchanged? */
if (emitThisGCrefVset && VarSetOps::Equal(emitComp, emitThisGCrefVars, vars))
{
return;
}
#ifdef DEBUG
if (EMIT_GC_VERBOSE || emitComp->opts.disasmWithGC)
{
VarSetOps::Assign(emitComp, debugThisGCrefVars, vars);
}
#endif
VarSetOps::Assign(emitComp, emitThisGCrefVars, vars);
/* Are there any GC ref variables on the stack? */
if (emitGCrFrameOffsCnt)
{
int* tab;
unsigned cnt = emitTrkVarCnt;
unsigned num;
/* Test all the tracked variable bits in the mask */
for (num = 0, tab = emitGCrFrameOffsTab; num < cnt; num++, tab++)
{
int val = *tab;
if (val != -1)
{
// byref_OFFSET_FLAG and this_OFFSET_FLAG are set
// in the table-offsets for byrefs and this-ptr
int offs = val & ~OFFSET_MASK;
// printf("var #%2u at %3d is now %s\n", num, offs, (vars & 1) ? "live" : "dead");
if (VarSetOps::IsMember(emitComp, vars, num))
{
GCtype gcType = (val & byref_OFFSET_FLAG) ? GCT_BYREF : GCT_GCREF;
emitGCvarLiveUpd(offs, INT_MAX, gcType, addr DEBUG_ARG(num));
}
else
{
emitGCvarDeadUpd(offs, addr DEBUG_ARG(num));
}
}
}
}
emitThisGCrefVset = true;
}
/*****************************************************************************
*
* Record a call location for GC purposes (we know that this is a method that
* will not be fully interruptible).
*/
void emitter::emitRecordGCcall(BYTE* codePos, unsigned char callInstrSize)
{
assert(emitIssuing);
assert(!emitFullGCinfo);
unsigned offs = emitCurCodeOffs(codePos);
callDsc* call;
#ifdef JIT32_GCENCODER
unsigned regs = (emitThisGCrefRegs | emitThisByrefRegs) & ~RBM_INTRET;
// The JIT32 GCInfo encoder allows us to (as the comment previously here said):
// "Bail if this is a totally boring call", but the GCInfoEncoder/Decoder interface
// requires a definition for every call site, so we skip these "early outs" when we're
// using the general encoder.
if (regs == 0)
{
#if EMIT_TRACK_STACK_DEPTH
if (emitCurStackLvl == 0)
return;
#endif
/* Nope, only interesting calls get recorded */
if (emitSimpleStkUsed)
{
if (!u1.emitSimpleStkMask)
return;
}
else
{
if (u2.emitGcArgTrackCnt == 0)
return;
}
}
#endif // JIT32_GCENCODER
#ifdef DEBUG
if (EMIT_GC_VERBOSE)
{
printf("; Call at %04X [stk=%u], GCvars=", offs - callInstrSize, emitCurStackLvl);
emitDispVarSet();
printf(", gcrefRegs=");
printRegMaskInt(emitThisGCrefRegs);
emitDispRegSet(emitThisGCrefRegs);
// printRegMaskInt(emitThisGCrefRegs & ~RBM_INTRET & RBM_CALLEE_SAVED); // only display callee-saved
// emitDispRegSet (emitThisGCrefRegs & ~RBM_INTRET & RBM_CALLEE_SAVED); // only display callee-saved
printf(", byrefRegs=");
printRegMaskInt(emitThisByrefRegs);
emitDispRegSet(emitThisByrefRegs);
// printRegMaskInt(emitThisByrefRegs & ~RBM_INTRET & RBM_CALLEE_SAVED); // only display callee-saved
// emitDispRegSet (emitThisByrefRegs & ~RBM_INTRET & RBM_CALLEE_SAVED); // only display callee-saved
printf("\n");
}
#endif
/* Allocate a 'call site' descriptor and start filling it in */
call = new (emitComp, CMK_GC) callDsc;
call->cdBlock = nullptr;
call->cdOffs = offs;
#ifndef JIT32_GCENCODER
call->cdCallInstrSize = callInstrSize;
#endif
call->cdNext = nullptr;
call->cdGCrefRegs = (regMaskSmall)emitThisGCrefRegs;
call->cdByrefRegs = (regMaskSmall)emitThisByrefRegs;
#if EMIT_TRACK_STACK_DEPTH
#ifndef UNIX_AMD64_ABI
noway_assert(FitsIn<USHORT>(emitCurStackLvl / ((unsigned)sizeof(unsigned))));
#endif // UNIX_AMD64_ABI
#endif
// Append the call descriptor to the list */
if (codeGen->gcInfo.gcCallDescLast == nullptr)
{
assert(codeGen->gcInfo.gcCallDescList == nullptr);
codeGen->gcInfo.gcCallDescList = codeGen->gcInfo.gcCallDescLast = call;
}
else
{
assert(codeGen->gcInfo.gcCallDescList != nullptr);
codeGen->gcInfo.gcCallDescLast->cdNext = call;
codeGen->gcInfo.gcCallDescLast = call;
}
/* Record the current "pending" argument list */
if (emitSimpleStkUsed)
{
/* The biggest call is less than MAX_SIMPLE_STK_DEPTH. So use
small format */
call->u1.cdArgMask = u1.emitSimpleStkMask;
call->u1.cdByrefArgMask = u1.emitSimpleByrefStkMask;
call->cdArgCnt = 0;
}
else
{
/* The current call has too many arguments, so we need to report the
offsets of each individual GC arg. */
call->cdArgCnt = u2.emitGcArgTrackCnt;
if (call->cdArgCnt == 0)
{
call->u1.cdArgMask = call->u1.cdByrefArgMask = 0;
return;
}
call->cdArgTable = new (emitComp, CMK_GC) unsigned[u2.emitGcArgTrackCnt];
unsigned gcArgs = 0;
unsigned stkLvl = emitCurStackLvl / sizeof(int);
for (unsigned i = 0; i < stkLvl; i++)
{
GCtype gcType = (GCtype)u2.emitArgTrackTab[stkLvl - i - 1];
if (needsGC(gcType))
{
call->cdArgTable[gcArgs] = i * TARGET_POINTER_SIZE;
if (gcType == GCT_BYREF)
{
call->cdArgTable[gcArgs] |= byref_OFFSET_FLAG;
}
gcArgs++;
}
}
assert(gcArgs == u2.emitGcArgTrackCnt);
}
}
/*****************************************************************************
*
* Record a new set of live GC ref registers.
*/
void emitter::emitUpdateLiveGCregs(GCtype gcType, regMaskTP regs, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
regMaskTP life;
regMaskTP dead;
regMaskTP chg;
assert(needsGC(gcType));
regMaskTP& emitThisXXrefRegs = (gcType == GCT_GCREF) ? emitThisGCrefRegs : emitThisByrefRegs;
regMaskTP& emitThisYYrefRegs = (gcType == GCT_GCREF) ? emitThisByrefRegs : emitThisGCrefRegs;
assert(emitThisXXrefRegs != regs);
if (emitFullGCinfo)
{
/* Figure out which GC registers are becoming live/dead at this point */
dead = (emitThisXXrefRegs & ~regs);
life = (~emitThisXXrefRegs & regs);
/* Can't simultaneously become live and dead at the same time */
assert((dead | life) != 0);
assert((dead & life) == 0);
/* Compute the 'changing state' mask */
chg = (dead | life);
do
{
regMaskTP bit = genFindLowestBit(chg);
regNumber reg = genRegNumFromMask(bit);
if (life & bit)
{
emitGCregLiveUpd(gcType, reg, addr);
}
else
{
emitGCregDeadUpd(reg, addr);
}
chg -= bit;
} while (chg);
assert(emitThisXXrefRegs == regs);
}
else
{
emitThisYYrefRegs &= ~regs; // Kill the regs from the other GC type (if live)
emitThisXXrefRegs = regs; // Mark them as live in the requested GC type
}
// The 2 GC reg masks can't be overlapping
assert((emitThisGCrefRegs & emitThisByrefRegs) == 0);
}
/*****************************************************************************
*
* Record the fact that the given register now contains a live GC ref.
*/
void emitter::emitGCregLiveSet(GCtype gcType, regMaskTP regMask, BYTE* addr, bool isThis)
{
assert(emitIssuing);
assert(needsGC(gcType));
regPtrDsc* regPtrNext;
assert(!isThis || emitComp->lvaKeepAliveAndReportThis());
// assert(emitFullyInt || isThis);
assert(emitFullGCinfo);
assert(((emitThisGCrefRegs | emitThisByrefRegs) & regMask) == 0);
/* Allocate a new regptr entry and fill it in */
regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = gcType;
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdArg = false;
regPtrNext->rpdCall = false;
regPtrNext->rpdIsThis = isThis;
regPtrNext->rpdCompiler.rpdAdd = (regMaskSmall)regMask;
regPtrNext->rpdCompiler.rpdDel = 0;
}
/*****************************************************************************
*
* Record the fact that the given register no longer contains a live GC ref.
*/
void emitter::emitGCregDeadSet(GCtype gcType, regMaskTP regMask, BYTE* addr)
{
assert(emitIssuing);
assert(needsGC(gcType));
regPtrDsc* regPtrNext;
// assert(emitFullyInt);
assert(emitFullGCinfo);
assert(((emitThisGCrefRegs | emitThisByrefRegs) & regMask) != 0);
/* Allocate a new regptr entry and fill it in */
regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = gcType;
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdCall = false;
regPtrNext->rpdIsThis = false;
regPtrNext->rpdArg = false;
regPtrNext->rpdCompiler.rpdAdd = 0;
regPtrNext->rpdCompiler.rpdDel = (regMaskSmall)regMask;
}
/*****************************************************************************
*
* Emit an 8-bit integer as code.
*/
unsigned char emitter::emitOutputByte(BYTE* dst, ssize_t val)
{
BYTE* dstRW = dst + writeableOffset;
*castto(dstRW, unsigned char*) = (unsigned char)val;
#ifdef DEBUG
#ifdef TARGET_AMD64
// if we're emitting code bytes, ensure that we've already emitted the rex prefix!
assert(((val & 0xFF00000000LL) == 0) || ((val & 0xFFFFFFFF00000000LL) == 0xFFFFFFFF00000000LL));
#endif // TARGET_AMD64
#endif
return sizeof(unsigned char);
}
/*****************************************************************************
*
* Emit a 16-bit integer as code.
*/
unsigned char emitter::emitOutputWord(BYTE* dst, ssize_t val)
{
BYTE* dstRW = dst + writeableOffset;
MISALIGNED_WR_I2(dstRW, (short)val);
#ifdef DEBUG
#ifdef TARGET_AMD64
// if we're emitting code bytes, ensure that we've already emitted the rex prefix!
assert(((val & 0xFF00000000LL) == 0) || ((val & 0xFFFFFFFF00000000LL) == 0xFFFFFFFF00000000LL));
#endif // TARGET_AMD64
#endif
return sizeof(short);
}
/*****************************************************************************
*
* Emit a 32-bit integer as code.
*/
unsigned char emitter::emitOutputLong(BYTE* dst, ssize_t val)
{
BYTE* dstRW = dst + writeableOffset;
MISALIGNED_WR_I4(dstRW, (int)val);
#ifdef DEBUG
#ifdef TARGET_AMD64
// if we're emitting code bytes, ensure that we've already emitted the rex prefix!
assert(((val & 0xFF00000000LL) == 0) || ((val & 0xFFFFFFFF00000000LL) == 0xFFFFFFFF00000000LL));
#endif // TARGET_AMD64
#endif
return sizeof(int);
}
/*****************************************************************************
*
* Emit a pointer-sized integer as code.
*/
unsigned char emitter::emitOutputSizeT(BYTE* dst, ssize_t val)
{
BYTE* dstRW = dst + writeableOffset;
#if !defined(TARGET_64BIT)
MISALIGNED_WR_I4(dstRW, (int)val);
#else
MISALIGNED_WR_ST(dstRW, val);
#endif
return TARGET_POINTER_SIZE;
}
//------------------------------------------------------------------------
// Wrappers to emitOutputByte, emitOutputWord, emitOutputLong, emitOutputSizeT
// that take unsigned __int64 or size_t type instead of ssize_t. Used on RyuJIT/x86.
//
// Arguments:
// dst - passed through
// val - passed through
//
// Return Value:
// Same as wrapped function.
//
#if !defined(HOST_64BIT)
#if defined(TARGET_X86)
unsigned char emitter::emitOutputByte(BYTE* dst, size_t val)
{
return emitOutputByte(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputWord(BYTE* dst, size_t val)
{
return emitOutputWord(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputLong(BYTE* dst, size_t val)
{
return emitOutputLong(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputSizeT(BYTE* dst, size_t val)
{
return emitOutputSizeT(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputByte(BYTE* dst, unsigned __int64 val)
{
return emitOutputByte(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputWord(BYTE* dst, unsigned __int64 val)
{
return emitOutputWord(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputLong(BYTE* dst, unsigned __int64 val)
{
return emitOutputLong(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputSizeT(BYTE* dst, unsigned __int64 val)
{
return emitOutputSizeT(dst, (ssize_t)val);
}
#endif // defined(TARGET_X86)
#endif // !defined(HOST_64BIT)
/*****************************************************************************
*
* Given a block cookie and a code position, return the actual code offset;
* this can only be called at the end of code generation.
*/
UNATIVE_OFFSET emitter::emitCodeOffset(void* blockPtr, unsigned codePos)
{
insGroup* ig;
UNATIVE_OFFSET of;
unsigned no = emitGetInsNumFromCodePos(codePos);
/* Make sure we weren't passed some kind of a garbage thing */
ig = (insGroup*)blockPtr;
#ifdef DEBUG
assert(ig && ig->igSelf == ig);
#endif
/* The first and last offsets are always easy */
if (no == 0)
{
of = 0;
}
else if (no == ig->igInsCnt)
{
of = ig->igSize;
}
else if (ig->igFlags & IGF_UPD_ISZ)
{
/*
Some instruction sizes have changed, so we'll have to figure
out the instruction offset "the hard way".
*/
of = emitFindOffset(ig, no);
}
else
{
/* All instructions correctly predicted, the offset stays the same */
of = emitGetInsOfsFromCodePos(codePos);
// printf("[IG=%02u;ID=%03u;OF=%04X] <= %08X\n", ig->igNum, emitGetInsNumFromCodePos(codePos), of, codePos);
/* Make sure the offset estimate is accurate */
assert(of == emitFindOffset(ig, emitGetInsNumFromCodePos(codePos)));
}
return ig->igOffs + of;
}
/*****************************************************************************
*
* Record the fact that the given register now contains a live GC ref.
*/
void emitter::emitGCregLiveUpd(GCtype gcType, regNumber reg, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
assert(needsGC(gcType));
regMaskTP regMask = genRegMask(reg);
regMaskTP& emitThisXXrefRegs = (gcType == GCT_GCREF) ? emitThisGCrefRegs : emitThisByrefRegs;
regMaskTP& emitThisYYrefRegs = (gcType == GCT_GCREF) ? emitThisByrefRegs : emitThisGCrefRegs;
if ((emitThisXXrefRegs & regMask) == 0)
{
// If the register was holding the other GC type, that type should
// go dead now
if (emitThisYYrefRegs & regMask)
{
emitGCregDeadUpd(reg, addr);
}
// For synchronized methods, "this" is always alive and in the same register.
// However, if we generate any code after the epilog block (where "this"
// goes dead), "this" will come alive again. We need to notice that.
// Note that we only expect isThis to be true at an insGroup boundary.
bool isThis = (reg == emitSyncThisObjReg) ? true : false;
if (emitFullGCinfo)
{
emitGCregLiveSet(gcType, regMask, addr, isThis);
}
emitThisXXrefRegs |= regMask;
}
// The 2 GC reg masks can't be overlapping
assert((emitThisGCrefRegs & emitThisByrefRegs) == 0);
}
/*****************************************************************************
*
* Record the fact that the given set of registers no longer contain live GC refs.
*/
void emitter::emitGCregDeadUpdMask(regMaskTP regs, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
// First, handle the gcref regs going dead
regMaskTP gcrefRegs = emitThisGCrefRegs & regs;
// "this" can never go dead in synchronized methods, except in the epilog
// after the call to CORINFO_HELP_MON_EXIT.
assert(emitSyncThisObjReg == REG_NA || (genRegMask(emitSyncThisObjReg) & regs) == 0);
if (gcrefRegs)
{
assert((emitThisByrefRegs & gcrefRegs) == 0);
if (emitFullGCinfo)
{
emitGCregDeadSet(GCT_GCREF, gcrefRegs, addr);
}
emitThisGCrefRegs &= ~gcrefRegs;
}
// Second, handle the byref regs going dead
regMaskTP byrefRegs = emitThisByrefRegs & regs;
if (byrefRegs)
{
assert((emitThisGCrefRegs & byrefRegs) == 0);
if (emitFullGCinfo)
{
emitGCregDeadSet(GCT_BYREF, byrefRegs, addr);
}
emitThisByrefRegs &= ~byrefRegs;
}
}
/*****************************************************************************
*
* Record the fact that the given register no longer contains a live GC ref.
*/
void emitter::emitGCregDeadUpd(regNumber reg, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
regMaskTP regMask = genRegMask(reg);
if ((emitThisGCrefRegs & regMask) != 0)
{
assert((emitThisByrefRegs & regMask) == 0);
if (emitFullGCinfo)
{
emitGCregDeadSet(GCT_GCREF, regMask, addr);
}
emitThisGCrefRegs &= ~regMask;
}
else if ((emitThisByrefRegs & regMask) != 0)
{
if (emitFullGCinfo)
{
emitGCregDeadSet(GCT_BYREF, regMask, addr);
}
emitThisByrefRegs &= ~regMask;
}
}
/*****************************************************************************
*
* Record the fact that the given variable now contains a live GC ref.
* varNum may be INT_MAX or negative (indicating a spill temp) only if
* offs is guaranteed to be the offset of a tracked GC ref. Else we
* need a valid value to check if the variable is tracked or not.
*/
void emitter::emitGCvarLiveUpd(int offs, int varNum, GCtype gcType, BYTE* addr DEBUG_ARG(unsigned actualVarNum))
{
assert(abs(offs) % sizeof(int) == 0);
assert(needsGC(gcType));
#if FEATURE_FIXED_OUT_ARGS
if ((unsigned)varNum == emitComp->lvaOutgoingArgSpaceVar)
{
if (emitFullGCinfo)
{
/* Append an "arg push" entry to track a GC written to the
outgoing argument space.
Allocate a new ptr arg entry and fill it in */
regPtrDsc* regPtrNext = gcInfo->gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = gcType;
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdArg = true;
regPtrNext->rpdCall = false;
noway_assert(FitsIn<unsigned short>(offs));
regPtrNext->rpdPtrArg = (unsigned short)offs;
regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_PUSH;
regPtrNext->rpdIsThis = false;
}
}
else
#endif // FEATURE_FIXED_OUT_ARGS
{
/* Is the frame offset within the "interesting" range? */
if (offs >= emitGCrFrameOffsMin && offs < emitGCrFrameOffsMax)
{
/* Normally all variables in this range must be tracked stack
pointers. However, for EnC, we relax this condition. So we
must check if this is not such a variable.
Note that varNum might be negative, indicating a spill temp.
*/
if (varNum != INT_MAX)
{
bool isTracked = false;
if (varNum >= 0)
{
// This is NOT a spill temp
const LclVarDsc* varDsc = emitComp->lvaGetDesc(varNum);
isTracked = emitComp->lvaIsGCTracked(varDsc);
}
if (!isTracked)
{
#if DOUBLE_ALIGN
assert(!emitContTrkPtrLcls ||
// EBP based variables in the double-aligned frames are indeed input arguments.
// and we don't require them to fall into the "interesting" range.
((emitComp->rpFrameType == FT_DOUBLE_ALIGN_FRAME) && (varNum >= 0) &&
(emitComp->lvaTable[varNum].lvFramePointerBased == 1)));
#else
assert(!emitContTrkPtrLcls);
#endif
return;
}
}
size_t disp;
/* Compute the index into the GC frame table */
disp = (offs - emitGCrFrameOffsMin) / TARGET_POINTER_SIZE;
assert(disp < emitGCrFrameOffsCnt);
/* If the variable is currently dead, mark it as live */
if (emitGCrFrameLiveTab[disp] == nullptr)
{
emitGCvarLiveSet(offs, gcType, addr, disp);
#ifdef DEBUG
if ((EMIT_GC_VERBOSE || emitComp->opts.disasmWithGC) && (actualVarNum < emitComp->lvaCount) &&
emitComp->lvaGetDesc(actualVarNum)->lvTracked)
{
VarSetOps::AddElemD(emitComp, debugThisGCrefVars, emitComp->lvaGetDesc(actualVarNum)->lvVarIndex);
}
#endif
}
}
}
}
/*****************************************************************************
*
* Record the fact that the given variable no longer contains a live GC ref.
*/
void emitter::emitGCvarDeadUpd(int offs, BYTE* addr DEBUG_ARG(unsigned varNum))
{
assert(emitIssuing);
assert(abs(offs) % sizeof(int) == 0);
/* Is the frame offset within the "interesting" range? */
if (offs >= emitGCrFrameOffsMin && offs < emitGCrFrameOffsMax)
{
size_t disp;
/* Compute the index into the GC frame table */
disp = (offs - emitGCrFrameOffsMin) / TARGET_POINTER_SIZE;
assert(disp < emitGCrFrameOffsCnt);
/* If the variable is currently live, mark it as dead */
if (emitGCrFrameLiveTab[disp] != nullptr)
{
assert(!emitComp->lvaKeepAliveAndReportThis() || (offs != emitSyncThisObjOffs));
emitGCvarDeadSet(offs, addr, disp);
#ifdef DEBUG
if ((EMIT_GC_VERBOSE || emitComp->opts.disasmWithGC) && (varNum < emitComp->lvaCount) &&
emitComp->lvaGetDesc(varNum)->lvTracked)
{
VarSetOps::RemoveElemD(emitComp, debugThisGCrefVars, emitComp->lvaGetDesc(varNum)->lvVarIndex);
}
#endif
}
}
}
/*****************************************************************************
*
* Allocate a new IG and link it in to the global list after the current IG
*/
insGroup* emitter::emitAllocAndLinkIG()
{
insGroup* ig = emitAllocIG();
assert(emitCurIG);
emitInsertIGAfter(emitCurIG, ig);
/* Propagate some IG flags from the current group to the new group */
ig->igFlags |= (emitCurIG->igFlags & IGF_PROPAGATE_MASK);
/* Set the new IG as the current IG */
emitCurIG = ig;
return ig;
}
/*****************************************************************************
*
* Allocate an instruction group descriptor and assign it the next index.
*/
insGroup* emitter::emitAllocIG()
{
insGroup* ig;
/* Allocate a group descriptor */
size_t sz = sizeof(insGroup);
ig = (insGroup*)emitGetMem(sz);
#ifdef DEBUG
ig->igSelf = ig;
#endif
#if EMITTER_STATS
emitTotalIGcnt += 1;
emitTotalIGsize += sz;
emitSizeMethod += sz;
#endif
/* Do basic initialization */
emitInitIG(ig);
return ig;
}
/*****************************************************************************
*
* Initialize an instruction group
*/
void emitter::emitInitIG(insGroup* ig)
{
/* Assign the next available index to the instruction group */
ig->igNum = emitNxtIGnum;
emitNxtIGnum++;
/* Record the (estimated) code offset of the group */
ig->igOffs = emitCurCodeOffset;
assert(IsCodeAligned(ig->igOffs));
/* Set the current function index */
ig->igFuncIdx = emitComp->compCurrFuncIdx;
ig->igFlags = 0;
#if defined(DEBUG) || defined(LATE_DISASM)
ig->igWeight = getCurrentBlockWeight();
ig->igPerfScore = 0.0;
#endif
/* Zero out some fields to avoid printing garbage in JitDumps. These
really only need to be set in DEBUG, but do it in all cases to make
sure we act the same in non-DEBUG builds.
*/
ig->igSize = 0;
ig->igGCregs = RBM_NONE;
ig->igInsCnt = 0;
#if FEATURE_LOOP_ALIGN
ig->igLoopBackEdge = nullptr;
#endif
#ifdef DEBUG
ig->lastGeneratedBlock = nullptr;
// Explicitly call init, since IGs don't actually have a constructor.
ig->igBlocks.jitstd::list<BasicBlock*>::init(emitComp->getAllocator(CMK_LoopOpt));
#endif
}
/*****************************************************************************
*
* Insert instruction group 'ig' after 'igInsertAfterIG'
*/
void emitter::emitInsertIGAfter(insGroup* insertAfterIG, insGroup* ig)
{
assert(emitIGlist);
assert(emitIGlast);
ig->igNext = insertAfterIG->igNext;
insertAfterIG->igNext = ig;
if (emitIGlast == insertAfterIG)
{
// If we are inserting at the end, then update the 'last' pointer
emitIGlast = ig;
}
}
/*****************************************************************************
*
* Save the current IG and start a new one.
*/
void emitter::emitNxtIG(bool extend)
{
/* Right now we don't allow multi-IG prologs */
assert(emitCurIG != emitPrologIG);
/* First save the current group */
emitSavIG(extend);
/* Update the GC live sets for the group's start
* Do it only if not an extension block */
if (!extend)
{
VarSetOps::Assign(emitComp, emitInitGCrefVars, emitThisGCrefVars);
emitInitGCrefRegs = emitThisGCrefRegs;
emitInitByrefRegs = emitThisByrefRegs;
}
/* Start generating the new group */
emitNewIG();
/* If this is an emitter added block, flag it */
if (extend)
{
emitCurIG->igFlags |= IGF_EXTEND;
#if EMITTER_STATS
emitTotalIGExtend++;
#endif // EMITTER_STATS
}
// We've created a new IG; no need to force another one.
emitForceNewIG = false;
#ifdef DEBUG
// We haven't written any code into the IG yet, so clear our record of the last block written to the IG.
emitCurIG->lastGeneratedBlock = nullptr;
#endif
}
/*****************************************************************************
*
* emitGetInsSC: Get the instruction's constant value.
*/
cnsval_ssize_t emitter::emitGetInsSC(instrDesc* id)
{
#ifdef TARGET_ARM // should it be TARGET_ARMARCH? Why do we need this? Note that on ARM64 we store scaled immediates
// for some formats
if (id->idIsLclVar())
{
int varNum = id->idAddr()->iiaLclVar.lvaVarNum();
regNumber baseReg;
int offs = id->idAddr()->iiaLclVar.lvaOffset();
#if defined(TARGET_ARM)
int adr =
emitComp->lvaFrameAddress(varNum, id->idIsLclFPBase(), &baseReg, offs, CodeGen::instIsFP(id->idIns()));
int dsp = adr + offs;
if ((id->idIns() == INS_sub) || (id->idIns() == INS_subw))
dsp = -dsp;
#elif defined(TARGET_ARM64)
// TODO-ARM64-Cleanup: this is currently unreachable. Do we need it?
bool FPbased;
int adr = emitComp->lvaFrameAddress(varNum, &FPbased);
int dsp = adr + offs;
if (id->idIns() == INS_sub)
dsp = -dsp;
#endif
return dsp;
}
else
#endif // TARGET_ARM
if (id->idIsLargeCns())
{
return ((instrDescCns*)id)->idcCnsVal;
}
else
{
return id->idSmallCns();
}
}
#ifdef TARGET_ARM
BYTE* emitter::emitGetInsRelocValue(instrDesc* id)
{
return ((instrDescReloc*)id)->idrRelocVal;
}
#endif // TARGET_ARM
/*****************************************************************************/
#if EMIT_TRACK_STACK_DEPTH
/*****************************************************************************
*
* Record a push of a single dword on the stack.
*/
void emitter::emitStackPush(BYTE* addr, GCtype gcType)
{
#ifdef DEBUG
assert(IsValidGCtype(gcType));
#endif
if (emitSimpleStkUsed)
{
assert(!emitFullGCinfo); // Simple stk not used for emitFullGCinfo
assert(emitCurStackLvl / sizeof(int) < MAX_SIMPLE_STK_DEPTH);
u1.emitSimpleStkMask <<= 1;
u1.emitSimpleStkMask |= (unsigned)needsGC(gcType);
u1.emitSimpleByrefStkMask <<= 1;
u1.emitSimpleByrefStkMask |= (gcType == GCT_BYREF);
assert((u1.emitSimpleStkMask & u1.emitSimpleByrefStkMask) == u1.emitSimpleByrefStkMask);
}
else
{
emitStackPushLargeStk(addr, gcType);
}
emitCurStackLvl += sizeof(int);
}
/*****************************************************************************
*
* Record a push of a bunch of non-GC dwords on the stack.
*/
void emitter::emitStackPushN(BYTE* addr, unsigned count)
{
assert(count);
if (emitSimpleStkUsed)
{
assert(!emitFullGCinfo); // Simple stk not used for emitFullGCinfo
u1.emitSimpleStkMask <<= count;
u1.emitSimpleByrefStkMask <<= count;
}
else
{
emitStackPushLargeStk(addr, GCT_NONE, count);
}
emitCurStackLvl += count * sizeof(int);
}
/*****************************************************************************
*
* Record a pop of the given number of dwords from the stack.
*/
void emitter::emitStackPop(BYTE* addr, bool isCall, unsigned char callInstrSize, unsigned count)
{
assert(emitCurStackLvl / sizeof(int) >= count);
assert(!isCall || callInstrSize > 0);
if (count)
{
if (emitSimpleStkUsed)
{
assert(!emitFullGCinfo); // Simple stk not used for emitFullGCinfo
unsigned cnt = count;
do
{
u1.emitSimpleStkMask >>= 1;
u1.emitSimpleByrefStkMask >>= 1;
} while (--cnt);
}
else
{
emitStackPopLargeStk(addr, isCall, callInstrSize, count);
}
emitCurStackLvl -= count * sizeof(int);
}
else
{
assert(isCall);
// For the general encoder we do the call below always when it's a call, to ensure that the call is
// recorded (when we're doing the ptr reg map for a non-fully-interruptible method).
if (emitFullGCinfo
#ifndef JIT32_GCENCODER
|| (emitComp->IsFullPtrRegMapRequired() && (!emitComp->GetInterruptible()) && isCall)
#endif // JIT32_GCENCODER
)
{
emitStackPopLargeStk(addr, isCall, callInstrSize, 0);
}
}
}
/*****************************************************************************
*
* Record a push of a single word on the stack for a full pointer map.
*/
void emitter::emitStackPushLargeStk(BYTE* addr, GCtype gcType, unsigned count)
{
S_UINT32 level(emitCurStackLvl / sizeof(int));
assert(IsValidGCtype(gcType));
assert(count);
assert(!emitSimpleStkUsed);
do
{
/* Push an entry for this argument on the tracking stack */
// printf("Pushed [%d] at lvl %2u [max=%u]\n", isGCref, emitArgTrackTop - emitArgTrackTab, emitMaxStackDepth);
assert(level.IsOverflow() || u2.emitArgTrackTop == u2.emitArgTrackTab + level.Value());
*u2.emitArgTrackTop++ = (BYTE)gcType;
assert(u2.emitArgTrackTop <= u2.emitArgTrackTab + emitMaxStackDepth);
if (emitFullArgInfo || needsGC(gcType))
{
if (emitFullGCinfo)
{
/* Append an "arg push" entry if this is a GC ref or
FPO method. Allocate a new ptr arg entry and fill it in */
regPtrDsc* regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = gcType;
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdArg = true;
regPtrNext->rpdCall = false;
if (level.IsOverflow() || !FitsIn<unsigned short>(level.Value()))
{
IMPL_LIMITATION("Too many/too big arguments to encode GC information");
}
regPtrNext->rpdPtrArg = (unsigned short)level.Value();
regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_PUSH;
regPtrNext->rpdIsThis = false;
}
/* This is an "interesting" argument push */
u2.emitGcArgTrackCnt++;
}
level += 1;
assert(!level.IsOverflow());
} while (--count);
}
/*****************************************************************************
*
* Record a pop of the given number of words from the stack for a full ptr
* map.
*/
void emitter::emitStackPopLargeStk(BYTE* addr, bool isCall, unsigned char callInstrSize, unsigned count)
{
assert(emitIssuing);
unsigned argStkCnt;
S_UINT16 argRecCnt(0); // arg count for ESP, ptr-arg count for EBP
unsigned gcrefRegs, byrefRegs;
#ifdef JIT32_GCENCODER
// For the general encoder, we always need to record calls, so we make this call
// even when emitSimpleStkUsed is true.
assert(!emitSimpleStkUsed);
#endif
/* Count how many pointer records correspond to this "pop" */
for (argStkCnt = count; argStkCnt; argStkCnt--)
{
assert(u2.emitArgTrackTop > u2.emitArgTrackTab);
GCtype gcType = (GCtype)(*--u2.emitArgTrackTop);
assert(IsValidGCtype(gcType));
// printf("Popped [%d] at lvl %u\n", GCtypeStr(gcType), emitArgTrackTop - emitArgTrackTab);
// This is an "interesting" argument
if (emitFullArgInfo || needsGC(gcType))
{
argRecCnt += 1;
}
}
assert(u2.emitArgTrackTop >= u2.emitArgTrackTab);
assert(u2.emitArgTrackTop == u2.emitArgTrackTab + emitCurStackLvl / sizeof(int) - count);
noway_assert(!argRecCnt.IsOverflow());
/* We're about to pop the corresponding arg records */
u2.emitGcArgTrackCnt -= argRecCnt.Value();
#ifdef JIT32_GCENCODER
// For the general encoder, we always have to record calls, so we don't take this early return.
if (!emitFullGCinfo)
return;
#endif
// Do we have any interesting (i.e., callee-saved) registers live here?
gcrefRegs = byrefRegs = 0;
// We make a bitmask whose bits correspond to callee-saved register indices (in the sequence
// of callee-saved registers only).
for (unsigned calleeSavedRegIdx = 0; calleeSavedRegIdx < CNT_CALLEE_SAVED; calleeSavedRegIdx++)
{
regMaskTP calleeSavedRbm = raRbmCalleeSaveOrder[calleeSavedRegIdx];
if (emitThisGCrefRegs & calleeSavedRbm)
{
gcrefRegs |= (1 << calleeSavedRegIdx);
}
if (emitThisByrefRegs & calleeSavedRbm)
{
byrefRegs |= (1 << calleeSavedRegIdx);
}
}
#ifdef JIT32_GCENCODER
// For the general encoder, we always have to record calls, so we don't take this early return. /* Are there any
// args to pop at this call site?
if (argRecCnt.Value() == 0)
{
/*
Or do we have a partially interruptible EBP-less frame, and any
of EDI,ESI,EBX,EBP are live, or is there an outer/pending call?
*/
CLANG_FORMAT_COMMENT_ANCHOR;
#if !FPO_INTERRUPTIBLE
if (emitFullyInt || (gcrefRegs == 0 && byrefRegs == 0 && u2.emitGcArgTrackCnt == 0))
#endif
return;
}
#endif // JIT32_GCENCODER
/* Only calls may pop more than one value */
// More detail:
// _cdecl calls accomplish this popping via a post-call-instruction SP adjustment.
// The "rpdCall" field below should be interpreted as "the instruction accomplishes
// call-related popping, even if it's not itself a call". Therefore, we don't just
// use the "isCall" input argument, which means that the instruction actually is a call --
// we use the OR of "isCall" or the "pops more than one value."
bool isCallRelatedPop = (argRecCnt.Value() > 1);
/* Allocate a new ptr arg entry and fill it in */
regPtrDsc* regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = GCT_GCREF; // Pops need a non-0 value (??)
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdCall = (isCall || isCallRelatedPop);
#ifndef JIT32_GCENCODER
if (regPtrNext->rpdCall)
{
assert(isCall || callInstrSize == 0);
regPtrNext->rpdCallInstrSize = callInstrSize;
}
#endif
regPtrNext->rpdCallGCrefRegs = gcrefRegs;
regPtrNext->rpdCallByrefRegs = byrefRegs;
regPtrNext->rpdArg = true;
regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_POP;
regPtrNext->rpdPtrArg = argRecCnt.Value();
}
/*****************************************************************************
* For caller-pop arguments, we report the arguments as pending arguments.
* However, any GC arguments are now dead, so we need to report them
* as non-GC.
*/
void emitter::emitStackKillArgs(BYTE* addr, unsigned count, unsigned char callInstrSize)
{
assert(count > 0);
if (emitSimpleStkUsed)
{
assert(!emitFullGCinfo); // Simple stk not used for emitFullGCInfo
/* We don't need to report this to the GC info, but we do need
to kill mark the ptrs on the stack as non-GC */
assert(emitCurStackLvl / sizeof(int) >= count);
for (unsigned lvl = 0; lvl < count; lvl++)
{
u1.emitSimpleStkMask &= ~(1 << lvl);
u1.emitSimpleByrefStkMask &= ~(1 << lvl);
}
}
else
{
BYTE* argTrackTop = u2.emitArgTrackTop;
S_UINT16 gcCnt(0);
for (unsigned i = 0; i < count; i++)
{
assert(argTrackTop > u2.emitArgTrackTab);
--argTrackTop;
GCtype gcType = (GCtype)(*argTrackTop);
assert(IsValidGCtype(gcType));
if (needsGC(gcType))
{
// printf("Killed %s at lvl %u\n", GCtypeStr(gcType), argTrackTop - emitArgTrackTab);
*argTrackTop = GCT_NONE;
gcCnt += 1;
}
}
noway_assert(!gcCnt.IsOverflow());
/* We're about to kill the corresponding (pointer) arg records */
if (!emitFullArgInfo)
{
u2.emitGcArgTrackCnt -= gcCnt.Value();
}
if (!emitFullGCinfo)
{
return;
}
/* Right after the call, the arguments are still sitting on the
stack, but they are effectively dead. For fully-interruptible
methods, we need to report that */
if (gcCnt.Value())
{
/* Allocate a new ptr arg entry and fill it in */
regPtrDsc* regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = GCT_GCREF; // Kills need a non-0 value (??)
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdArg = TRUE;
regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_KILL;
regPtrNext->rpdPtrArg = gcCnt.Value();
}
/* Now that ptr args have been marked as non-ptrs, we need to record
the call itself as one that has no arguments. */
emitStackPopLargeStk(addr, true, callInstrSize, 0);
}
}
/*****************************************************************************
* A helper for recording a relocation with the EE.
*/
#ifdef DEBUG
void emitter::emitRecordRelocationHelp(void* location, /* IN */
void* target, /* IN */
uint16_t fRelocType, /* IN */
const char* relocTypeName, /* IN */
int32_t addlDelta /* = 0 */) /* IN */
#else // !DEBUG
void emitter::emitRecordRelocation(void* location, /* IN */
void* target, /* IN */
uint16_t fRelocType, /* IN */
int32_t addlDelta /* = 0 */) /* IN */
#endif // !DEBUG
{
void* locationRW = (BYTE*)location + writeableOffset;
JITDUMP("recordRelocation: %p (rw: %p) => %p, type %u (%s), delta %d\n", dspPtr(location), dspPtr(locationRW),
dspPtr(target), fRelocType, relocTypeName, addlDelta);
// If we're an unmatched altjit, don't tell the VM anything. We still record the relocation for
// late disassembly; maybe we'll need it?
if (emitComp->info.compMatchedVM)
{
// slotNum is unused on all supported platforms.
emitCmpHandle->recordRelocation(location, locationRW, target, fRelocType, /* slotNum */ 0, addlDelta);
}
#if defined(LATE_DISASM)
codeGen->getDisAssembler().disRecordRelocation((size_t)location, (size_t)target);
#endif // defined(LATE_DISASM)
}
#ifdef TARGET_ARM
/*****************************************************************************
* A helper for handling a Thumb-Mov32 of position-independent (PC-relative) value
*
* This routine either records relocation for the location with the EE,
* or creates a virtual relocation entry to perform offset fixup during
* compilation without recording it with EE - depending on which of
* absolute/relocative relocations mode are used for code section.
*/
void emitter::emitHandlePCRelativeMov32(void* location, /* IN */
void* target) /* IN */
{
if (emitComp->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_RELATIVE_CODE_RELOCS))
{
emitRecordRelocation(location, target, IMAGE_REL_BASED_REL_THUMB_MOV32_PCREL);
}
else
{
emitRecordRelocation(location, target, IMAGE_REL_BASED_THUMB_MOV32);
}
}
#endif // TARGET_ARM
/*****************************************************************************
* A helper for recording a call site with the EE.
*/
void emitter::emitRecordCallSite(ULONG instrOffset, /* IN */
CORINFO_SIG_INFO* callSig, /* IN */
CORINFO_METHOD_HANDLE methodHandle) /* IN */
{
#if defined(DEBUG)
// Since CORINFO_SIG_INFO is a heavyweight structure, in most cases we can
// lazily obtain it here using the given method handle (we only save the sig
// info when we explicitly need it, i.e. for CALLI calls, vararg calls, and
// tail calls).
CORINFO_SIG_INFO sigInfo;
if (callSig == nullptr)
{
assert(methodHandle != nullptr);
if (Compiler::eeGetHelperNum(methodHandle) == CORINFO_HELP_UNDEF)
{
emitComp->eeGetMethodSig(methodHandle, &sigInfo);
callSig = &sigInfo;
}
}
emitCmpHandle->recordCallSite(instrOffset, callSig, methodHandle);
#endif // defined(DEBUG)
}
/*****************************************************************************/
#endif // EMIT_TRACK_STACK_DEPTH
/*****************************************************************************/
/*****************************************************************************/
#ifdef DEBUG
/*****************************************************************************
* Given a code offset, return a string representing a label for that offset.
* If the code offset is just after the end of the code of the function, the
* label will be "END". If the code offset doesn't correspond to any known
* offset, the label will be "UNKNOWN". The strings are returned from static
* buffers. This function rotates amongst four such static buffers (there are
* cases where this function is called four times to provide data for a single
* printf()).
*/
const char* emitter::emitOffsetToLabel(unsigned offs)
{
const size_t TEMP_BUFFER_LEN = 40;
static unsigned curBuf = 0;
static char buf[4][TEMP_BUFFER_LEN];
char* retbuf;
UNATIVE_OFFSET nextof = 0;
for (insGroup* ig = emitIGlist; ig != nullptr; ig = ig->igNext)
{
// There is an eventual unused space after the last actual hot block
// before the first allocated cold block.
assert((nextof == ig->igOffs) || (ig == emitFirstColdIG));
if (ig->igOffs == offs)
{
return emitLabelString(ig);
}
else if (ig->igOffs > offs)
{
// We went past the requested offset but didn't find it.
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "UNKNOWN");
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}
nextof = ig->igOffs + ig->igSize;
}
if (nextof == offs)
{
// It's a pseudo-label to the end.
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "END");
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}
else
{
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "UNKNOWN");
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}
}
#endif // DEBUG
//------------------------------------------------------------------------
// emitGetGCRegsSavedOrModified: Returns the set of registers that keeps gcrefs and byrefs across the call.
//
// Notes: it returns union of two sets:
// 1) registers that could contain GC/byRefs before the call and call doesn't touch them;
// 2) registers that contain GC/byRefs before the call and call modifies them, but they still
// contain GC/byRefs.
//
// Arguments:
// methHnd - the method handler of the call.
//
// Return value:
// the saved set of registers.
//
regMaskTP emitter::emitGetGCRegsSavedOrModified(CORINFO_METHOD_HANDLE methHnd)
{
// Is it a helper with a special saved set?
bool isNoGCHelper = emitNoGChelper(methHnd);
if (isNoGCHelper)
{
CorInfoHelpFunc helpFunc = Compiler::eeGetHelperNum(methHnd);
// Get the set of registers that this call kills and remove it from the saved set.
regMaskTP savedSet = RBM_ALLINT & ~emitGetGCRegsKilledByNoGCCall(helpFunc);
#ifdef DEBUG
if (emitComp->verbose)
{
printf("NoGC Call: savedSet=");
printRegMaskInt(savedSet);
emitDispRegSet(savedSet);
printf("\n");
}
#endif
return savedSet;
}
else
{
// This is the saved set of registers after a normal call.
return RBM_CALLEE_SAVED;
}
}
//----------------------------------------------------------------------
// emitGetGCRegsKilledByNoGCCall: Gets a register mask that represents the set of registers that no longer
// contain GC or byref pointers, for "NO GC" helper calls. This is used by the emitter when determining
// what registers to remove from the current live GC/byref sets (and thus what to report as dead in the
// GC info). Note that for the CORINFO_HELP_ASSIGN_BYREF helper, in particular, the kill set reported by
// compHelperCallKillSet() doesn't match this kill set. compHelperCallKillSet() reports the dst/src
// address registers as killed for liveness purposes, since their values change. However, they still are
// valid byref pointers after the call, so the dst/src address registers are NOT reported as killed here.
//
// Note: This list may not be complete and defaults to the default RBM_CALLEE_TRASH_NOGC registers.
//
// Arguments:
// helper - The helper being inquired about
//
// Return Value:
// Mask of GC register kills
//
regMaskTP emitter::emitGetGCRegsKilledByNoGCCall(CorInfoHelpFunc helper)
{
assert(emitNoGChelper(helper));
regMaskTP result;
switch (helper)
{
case CORINFO_HELP_ASSIGN_BYREF:
#if defined(TARGET_X86)
// This helper only trashes ECX.
result = RBM_ECX;
break;
#elif defined(TARGET_AMD64)
// This uses and defs RDI and RSI.
result = RBM_CALLEE_TRASH_NOGC & ~(RBM_RDI | RBM_RSI);
break;
#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
result = RBM_CALLEE_GCTRASH_WRITEBARRIER_BYREF;
break;
#else
assert(!"unknown arch");
#endif
#if !defined(TARGET_LOONGARCH64)
case CORINFO_HELP_PROF_FCN_ENTER:
result = RBM_PROFILER_ENTER_TRASH;
break;
case CORINFO_HELP_PROF_FCN_LEAVE:
#if defined(TARGET_ARM)
// profiler scratch remains gc live
result = RBM_PROFILER_LEAVE_TRASH & ~RBM_PROFILER_RET_SCRATCH;
#else
result = RBM_PROFILER_LEAVE_TRASH;
#endif
break;
case CORINFO_HELP_PROF_FCN_TAILCALL:
result = RBM_PROFILER_TAILCALL_TRASH;
break;
#endif // !defined(TARGET_LOONGARCH64)
#if defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
case CORINFO_HELP_ASSIGN_REF:
case CORINFO_HELP_CHECKED_ASSIGN_REF:
result = RBM_CALLEE_GCTRASH_WRITEBARRIER;
break;
#endif // defined(TARGET_ARMARCH)
#if defined(TARGET_X86)
case CORINFO_HELP_INIT_PINVOKE_FRAME:
result = RBM_INIT_PINVOKE_FRAME_TRASH;
break;
#endif // defined(TARGET_X86)
case CORINFO_HELP_VALIDATE_INDIRECT_CALL:
result = RBM_VALIDATE_INDIRECT_CALL_TRASH;
break;
default:
result = RBM_CALLEE_TRASH_NOGC;
break;
}
// compHelperCallKillSet returns a superset of the registers which values are not guranteed to be the same
// after the call, if a register loses its GC or byref it has to be in the compHelperCallKillSet set as well.
assert((result & emitComp->compHelperCallKillSet(helper)) == result);
return result;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XX
XX emit.cpp XX
XX XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/
#include "jitpch.h"
#ifdef _MSC_VER
#pragma hdrstop
#endif
#include "hostallocator.h"
#include "instr.h"
#include "emit.h"
#include "codegen.h"
/*****************************************************************************
*
* Represent an emitter location.
*/
void emitLocation::CaptureLocation(emitter* emit)
{
ig = emit->emitCurIG;
codePos = emit->emitCurOffset();
assert(Valid());
}
bool emitLocation::IsCurrentLocation(emitter* emit) const
{
assert(Valid());
return (ig == emit->emitCurIG) && (codePos == emit->emitCurOffset());
}
UNATIVE_OFFSET emitLocation::CodeOffset(emitter* emit) const
{
assert(Valid());
return emit->emitCodeOffset(ig, codePos);
}
int emitLocation::GetInsNum() const
{
return emitGetInsNumFromCodePos(codePos);
}
// Get the instruction offset in the current instruction group, which must be a funclet prolog group.
// This is used to find an instruction offset used in unwind data.
// TODO-AMD64-Bug?: We only support a single main function prolog group, but allow for multiple funclet prolog
// groups (not that we actually use that flexibility, since the funclet prolog will be small). How to
// handle that?
UNATIVE_OFFSET emitLocation::GetFuncletPrologOffset(emitter* emit) const
{
assert(ig->igFuncIdx != 0);
assert((ig->igFlags & IGF_FUNCLET_PROLOG) != 0);
assert(ig == emit->emitCurIG);
return emit->emitCurIGsize;
}
//------------------------------------------------------------------------
// IsPreviousInsNum: Returns true if the emitter is on the next instruction
// of the same group as this emitLocation.
//
// Arguments:
// emit - an emitter* instance
//
bool emitLocation::IsPreviousInsNum(emitter* emit) const
{
assert(Valid());
// Within the same IG?
if (ig == emit->emitCurIG)
{
return (emitGetInsNumFromCodePos(codePos) == emitGetInsNumFromCodePos(emit->emitCurOffset()) - 1);
}
// Spanning an IG boundary?
if (ig->igNext == emit->emitCurIG)
{
return (emitGetInsNumFromCodePos(codePos) == ig->igInsCnt) && (emit->emitCurIGinsCnt == 1);
}
return false;
}
#ifdef DEBUG
void emitLocation::Print(LONG compMethodID) const
{
unsigned insNum = emitGetInsNumFromCodePos(codePos);
unsigned insOfs = emitGetInsOfsFromCodePos(codePos);
printf("(G_M%03u_IG%02u,ins#%d,ofs#%d)", compMethodID, ig->igNum, insNum, insOfs);
}
#endif // DEBUG
/*****************************************************************************
*
* Return the name of an instruction format.
*/
#if defined(DEBUG) || EMITTER_STATS
const char* emitter::emitIfName(unsigned f)
{
static const char* const ifNames[] = {
#define IF_DEF(en, op1, op2) "IF_" #en,
#include "emitfmts.h"
};
static char errBuff[32];
if (f < ArrLen(ifNames))
{
return ifNames[f];
}
sprintf_s(errBuff, sizeof(errBuff), "??%u??", f);
return errBuff;
}
#endif
/*****************************************************************************/
#if EMITTER_STATS
static unsigned totAllocdSize;
static unsigned totActualSize;
unsigned emitter::emitIFcounts[emitter::IF_COUNT];
static unsigned emitSizeBuckets[] = {100, 1024 * 1, 1024 * 2, 1024 * 3, 1024 * 4, 1024 * 5, 1024 * 10, 0};
static Histogram emitSizeTable(emitSizeBuckets);
static unsigned GCrefsBuckets[] = {0, 1, 2, 5, 10, 20, 50, 128, 256, 512, 1024, 0};
static Histogram GCrefsTable(GCrefsBuckets);
static unsigned stkDepthBuckets[] = {0, 1, 2, 5, 10, 16, 32, 128, 1024, 0};
static Histogram stkDepthTable(stkDepthBuckets);
size_t emitter::emitSizeMethod;
size_t emitter::emitTotMemAlloc;
unsigned emitter::emitTotalInsCnt;
unsigned emitter::emitCurPrologInsCnt;
size_t emitter::emitCurPrologIGSize;
unsigned emitter::emitMaxPrologInsCnt;
size_t emitter::emitMaxPrologIGSize;
unsigned emitter::emitTotalIGcnt;
unsigned emitter::emitTotalPhIGcnt;
unsigned emitter::emitTotalIGjmps;
unsigned emitter::emitTotalIGptrs;
unsigned emitter::emitTotalIGicnt;
size_t emitter::emitTotalIGsize;
unsigned emitter::emitTotalIGmcnt;
unsigned emitter::emitTotalIGExtend;
unsigned emitter::emitTotalIDescSmallCnt;
unsigned emitter::emitTotalIDescCnt;
unsigned emitter::emitTotalIDescJmpCnt;
#if !defined(TARGET_ARM64)
unsigned emitter::emitTotalIDescLblCnt;
#endif // !defined(TARGET_ARM64)
unsigned emitter::emitTotalIDescCnsCnt;
unsigned emitter::emitTotalIDescDspCnt;
unsigned emitter::emitTotalIDescCnsDspCnt;
#ifdef TARGET_XARCH
unsigned emitter::emitTotalIDescAmdCnt;
unsigned emitter::emitTotalIDescCnsAmdCnt;
#endif // TARGET_XARCH
unsigned emitter::emitTotalIDescCGCACnt;
#ifdef TARGET_ARM
unsigned emitter::emitTotalIDescRelocCnt;
#endif // TARGET_ARM
unsigned emitter::emitSmallDspCnt;
unsigned emitter::emitLargeDspCnt;
unsigned emitter::emitSmallCnsCnt;
unsigned emitter::emitLargeCnsCnt;
unsigned emitter::emitSmallCns[SMALL_CNS_TSZ];
unsigned emitter::emitTotalDescAlignCnt;
void emitterStaticStats(FILE* fout)
{
// insGroup members
insGroup* igDummy = nullptr;
fprintf(fout, "\n");
fprintf(fout, "insGroup:\n");
fprintf(fout, "Offset / size of igNext = %2zu / %2zu\n", offsetof(insGroup, igNext),
sizeof(igDummy->igNext));
#ifdef DEBUG
fprintf(fout, "Offset / size of igSelf = %2zu / %2zu\n", offsetof(insGroup, igSelf),
sizeof(igDummy->igSelf));
#endif
fprintf(fout, "Offset / size of igNum = %2zu / %2zu\n", offsetof(insGroup, igNum),
sizeof(igDummy->igNum));
fprintf(fout, "Offset / size of igOffs = %2zu / %2zu\n", offsetof(insGroup, igOffs),
sizeof(igDummy->igOffs));
fprintf(fout, "Offset / size of igFuncIdx = %2zu / %2zu\n", offsetof(insGroup, igFuncIdx),
sizeof(igDummy->igFuncIdx));
fprintf(fout, "Offset / size of igFlags = %2zu / %2zu\n", offsetof(insGroup, igFlags),
sizeof(igDummy->igFlags));
fprintf(fout, "Offset / size of igSize = %2zu / %2zu\n", offsetof(insGroup, igSize),
sizeof(igDummy->igSize));
fprintf(fout, "Offset / size of igData = %2zu / %2zu\n", offsetof(insGroup, igData),
sizeof(igDummy->igData));
fprintf(fout, "Offset / size of igPhData = %2zu / %2zu\n", offsetof(insGroup, igPhData),
sizeof(igDummy->igPhData));
#if EMIT_TRACK_STACK_DEPTH
fprintf(fout, "Offset / size of igStkLvl = %2zu / %2zu\n", offsetof(insGroup, igStkLvl),
sizeof(igDummy->igStkLvl));
#endif
fprintf(fout, "Offset / size of igGCregs = %2zu / %2zu\n", offsetof(insGroup, igGCregs),
sizeof(igDummy->igGCregs));
fprintf(fout, "Offset / size of igInsCnt = %2zu / %2zu\n", offsetof(insGroup, igInsCnt),
sizeof(igDummy->igInsCnt));
fprintf(fout, "\n");
fprintf(fout, "Size of insGroup = %zu\n", sizeof(insGroup));
// insPlaceholderGroupData members
fprintf(fout, "\n");
fprintf(fout, "insPlaceholderGroupData:\n");
fprintf(fout, "Offset of igPhNext = %2zu\n", offsetof(insPlaceholderGroupData, igPhNext));
fprintf(fout, "Offset of igPhBB = %2zu\n", offsetof(insPlaceholderGroupData, igPhBB));
fprintf(fout, "Offset of igPhInitGCrefVars = %2zu\n", offsetof(insPlaceholderGroupData, igPhInitGCrefVars));
fprintf(fout, "Offset of igPhInitGCrefRegs = %2zu\n", offsetof(insPlaceholderGroupData, igPhInitGCrefRegs));
fprintf(fout, "Offset of igPhInitByrefRegs = %2zu\n", offsetof(insPlaceholderGroupData, igPhInitByrefRegs));
fprintf(fout, "Offset of igPhPrevGCrefVars = %2zu\n", offsetof(insPlaceholderGroupData, igPhPrevGCrefVars));
fprintf(fout, "Offset of igPhPrevGCrefRegs = %2zu\n", offsetof(insPlaceholderGroupData, igPhPrevGCrefRegs));
fprintf(fout, "Offset of igPhPrevByrefRegs = %2zu\n", offsetof(insPlaceholderGroupData, igPhPrevByrefRegs));
fprintf(fout, "Offset of igPhType = %2zu\n", offsetof(insPlaceholderGroupData, igPhType));
fprintf(fout, "Size of insPlaceholderGroupData = %zu\n", sizeof(insPlaceholderGroupData));
fprintf(fout, "\n");
fprintf(fout, "SMALL_IDSC_SIZE = %2u\n", SMALL_IDSC_SIZE);
fprintf(fout, "Size of instrDesc = %2zu\n", sizeof(emitter::instrDesc));
// fprintf(fout, "Offset of _idIns = %2zu\n", offsetof(emitter::instrDesc, _idIns ));
// fprintf(fout, "Offset of _idInsFmt = %2zu\n", offsetof(emitter::instrDesc, _idInsFmt ));
// fprintf(fout, "Offset of _idOpSize = %2zu\n", offsetof(emitter::instrDesc, _idOpSize ));
// fprintf(fout, "Offset of idSmallCns = %2zu\n", offsetof(emitter::instrDesc, idSmallCns ));
// fprintf(fout, "Offset of _idAddrUnion= %2zu\n", offsetof(emitter::instrDesc, _idAddrUnion));
// fprintf(fout, "\n");
// fprintf(fout, "Size of _idAddrUnion= %2zu\n", sizeof(((emitter::instrDesc*)0)->_idAddrUnion));
fprintf(fout, "Size of instrDescJmp = %2zu\n", sizeof(emitter::instrDescJmp));
#if !defined(TARGET_ARM64)
fprintf(fout, "Size of instrDescLbl = %2zu\n", sizeof(emitter::instrDescLbl));
#endif // !defined(TARGET_ARM64)
fprintf(fout, "Size of instrDescCns = %2zu\n", sizeof(emitter::instrDescCns));
fprintf(fout, "Size of instrDescDsp = %2zu\n", sizeof(emitter::instrDescDsp));
fprintf(fout, "Size of instrDescCnsDsp = %2zu\n", sizeof(emitter::instrDescCnsDsp));
#ifdef TARGET_XARCH
fprintf(fout, "Size of instrDescAmd = %2zu\n", sizeof(emitter::instrDescAmd));
fprintf(fout, "Size of instrDescCnsAmd = %2zu\n", sizeof(emitter::instrDescCnsAmd));
#endif // TARGET_XARCH
fprintf(fout, "Size of instrDescCGCA = %2zu\n", sizeof(emitter::instrDescCGCA));
#ifdef TARGET_ARM
fprintf(fout, "Size of instrDescReloc = %2zu\n", sizeof(emitter::instrDescReloc));
#endif // TARGET_ARM
fprintf(fout, "\n");
fprintf(fout, "SC_IG_BUFFER_SIZE = %2zu\n", SC_IG_BUFFER_SIZE);
fprintf(fout, "SMALL_IDSC_SIZE per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / SMALL_IDSC_SIZE);
fprintf(fout, "instrDesc per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDesc));
fprintf(fout, "instrDescJmp per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescJmp));
#if !defined(TARGET_ARM64)
fprintf(fout, "instrDescLbl per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescLbl));
#endif // !defined(TARGET_ARM64)
fprintf(fout, "instrDescCns per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescCns));
fprintf(fout, "instrDescDsp per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescDsp));
fprintf(fout, "instrDescCnsDsp per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescCnsDsp));
#ifdef TARGET_XARCH
fprintf(fout, "instrDescAmd per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescAmd));
fprintf(fout, "instrDescCnsAmd per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescCnsAmd));
#endif // TARGET_XARCH
fprintf(fout, "instrDescCGCA per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescCGCA));
#ifdef TARGET_ARM
fprintf(fout, "instrDescReloc per IG buffer = %2zu\n", SC_IG_BUFFER_SIZE / sizeof(emitter::instrDescReloc));
#endif // TARGET_ARM
fprintf(fout, "\n");
fprintf(fout, "GCInfo::regPtrDsc:\n");
fprintf(fout, "Offset of rpdNext = %2zu\n", offsetof(GCInfo::regPtrDsc, rpdNext));
fprintf(fout, "Offset of rpdOffs = %2zu\n", offsetof(GCInfo::regPtrDsc, rpdOffs));
fprintf(fout, "Offset of <union> = %2zu\n", offsetof(GCInfo::regPtrDsc, rpdPtrArg));
fprintf(fout, "Size of GCInfo::regPtrDsc = %2zu\n", sizeof(GCInfo::regPtrDsc));
fprintf(fout, "\n");
}
void emitterStats(FILE* fout)
{
if (totAllocdSize > 0)
{
assert(totActualSize <= totAllocdSize);
fprintf(fout, "\nTotal allocated code size = %u\n", totAllocdSize);
if (totActualSize < totAllocdSize)
{
fprintf(fout, "Total generated code size = %u ", totActualSize);
fprintf(fout, "(%4.3f%% waste)", 100 * ((totAllocdSize - totActualSize) / (double)totActualSize));
fprintf(fout, "\n");
}
assert(emitter::emitTotalInsCnt > 0);
fprintf(fout, "Average of %4.2f bytes of code generated per instruction\n",
(double)totActualSize / emitter::emitTotalInsCnt);
}
fprintf(fout, "\nInstruction format frequency table:\n\n");
unsigned f, ic = 0, dc = 0;
for (f = 0; f < emitter::IF_COUNT; f++)
{
ic += emitter::emitIFcounts[f];
}
for (f = 0; f < emitter::IF_COUNT; f++)
{
unsigned c = emitter::emitIFcounts[f];
if ((c > 0) && (1000 * c >= ic))
{
dc += c;
fprintf(fout, " %-14s %8u (%5.2f%%)\n", emitter::emitIfName(f), c, 100.0 * c / ic);
}
}
fprintf(fout, " ---------------------------------\n");
fprintf(fout, " %-14s %8u (%5.2f%%)\n", "Total shown", dc, 100.0 * dc / ic);
if (emitter::emitTotalIGmcnt > 0)
{
fprintf(fout, "\n");
fprintf(fout, "Total of %8u methods\n", emitter::emitTotalIGmcnt);
fprintf(fout, "Total of %8u insGroup\n", emitter::emitTotalIGcnt);
fprintf(fout, "Total of %8u insPlaceholderGroupData\n", emitter::emitTotalPhIGcnt);
fprintf(fout, "Total of %8u extend insGroup\n", emitter::emitTotalIGExtend);
fprintf(fout, "Total of %8u instructions\n", emitter::emitTotalIGicnt);
fprintf(fout, "Total of %8u jumps\n", emitter::emitTotalIGjmps);
fprintf(fout, "Total of %8u GC livesets\n", emitter::emitTotalIGptrs);
fprintf(fout, "\n");
fprintf(fout, "Max prolog instrDesc count: %8u\n", emitter::emitMaxPrologInsCnt);
fprintf(fout, "Max prolog insGroup size : %8zu\n", emitter::emitMaxPrologIGSize);
fprintf(fout, "\n");
fprintf(fout, "Average of %8.1lf insGroup per method\n",
(double)emitter::emitTotalIGcnt / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf insPhGroup per method\n",
(double)emitter::emitTotalPhIGcnt / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf extend IG per method\n",
(double)emitter::emitTotalIGExtend / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf instructions per method\n",
(double)emitter::emitTotalIGicnt / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf desc. bytes per method\n",
(double)emitter::emitTotalIGsize / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf jumps per method\n",
(double)emitter::emitTotalIGjmps / emitter::emitTotalIGmcnt);
fprintf(fout, "Average of %8.1lf GC livesets per method\n",
(double)emitter::emitTotalIGptrs / emitter::emitTotalIGmcnt);
fprintf(fout, "\n");
fprintf(fout, "Average of %8.1lf instructions per group \n",
(double)emitter::emitTotalIGicnt / emitter::emitTotalIGcnt);
fprintf(fout, "Average of %8.1lf desc. bytes per group \n",
(double)emitter::emitTotalIGsize / emitter::emitTotalIGcnt);
fprintf(fout, "Average of %8.1lf jumps per group \n",
(double)emitter::emitTotalIGjmps / emitter::emitTotalIGcnt);
fprintf(fout, "\n");
fprintf(fout, "Average of %8.1lf bytes per instrDesc\n",
(double)emitter::emitTotalIGsize / emitter::emitTotalIGicnt);
fprintf(fout, "\n");
fprintf(fout, "A total of %8zu desc. bytes\n", emitter::emitTotalIGsize);
fprintf(fout, "\n");
fprintf(fout, "Total instructions: %8u\n", emitter::emitTotalInsCnt);
fprintf(fout, "Total small instrDesc: %8u (%5.2f%%)\n", emitter::emitTotalIDescSmallCnt,
100.0 * emitter::emitTotalIDescSmallCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDesc: %8u (%5.2f%%)\n", emitter::emitTotalIDescCnt,
100.0 * emitter::emitTotalIDescCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDescJmp: %8u (%5.2f%%)\n", emitter::emitTotalIDescJmpCnt,
100.0 * emitter::emitTotalIDescJmpCnt / emitter::emitTotalInsCnt);
#if !defined(TARGET_ARM64)
fprintf(fout, "Total instrDescLbl: %8u (%5.2f%%)\n", emitter::emitTotalIDescLblCnt,
100.0 * emitter::emitTotalIDescLblCnt / emitter::emitTotalInsCnt);
#endif // !defined(TARGET_ARM64)
fprintf(fout, "Total instrDescCns: %8u (%5.2f%%)\n", emitter::emitTotalIDescCnsCnt,
100.0 * emitter::emitTotalIDescCnsCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDescDsp: %8u (%5.2f%%)\n", emitter::emitTotalIDescDspCnt,
100.0 * emitter::emitTotalIDescDspCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDescCnsDsp: %8u (%5.2f%%)\n", emitter::emitTotalIDescCnsDspCnt,
100.0 * emitter::emitTotalIDescCnsDspCnt / emitter::emitTotalInsCnt);
#ifdef TARGET_XARCH
fprintf(fout, "Total instrDescAmd: %8u (%5.2f%%)\n", emitter::emitTotalIDescAmdCnt,
100.0 * emitter::emitTotalIDescAmdCnt / emitter::emitTotalInsCnt);
fprintf(fout, "Total instrDescCnsAmd: %8u (%5.2f%%)\n", emitter::emitTotalIDescCnsAmdCnt,
100.0 * emitter::emitTotalIDescCnsAmdCnt / emitter::emitTotalInsCnt);
#endif // TARGET_XARCH
fprintf(fout, "Total instrDescCGCA: %8u (%5.2f%%)\n", emitter::emitTotalIDescCGCACnt,
100.0 * emitter::emitTotalIDescCGCACnt / emitter::emitTotalInsCnt);
#ifdef TARGET_ARM
fprintf(fout, "Total instrDescReloc: %8u (%5.2f%%)\n", emitter::emitTotalIDescRelocCnt,
100.0 * emitter::emitTotalIDescRelocCnt / emitter::emitTotalInsCnt);
#endif // TARGET_ARM
fprintf(fout, "Total instrDescAlign: %8u (%5.2f%%)\n", emitter::emitTotalDescAlignCnt,
100.0 * emitter::emitTotalDescAlignCnt / emitter::emitTotalInsCnt);
fprintf(fout, "\n");
}
fprintf(fout, "Descriptor size distribution:\n");
emitSizeTable.dump(fout);
fprintf(fout, "\n");
fprintf(fout, "GC ref frame variable counts:\n");
GCrefsTable.dump(fout);
fprintf(fout, "\n");
fprintf(fout, "Max. stack depth distribution:\n");
stkDepthTable.dump(fout);
fprintf(fout, "\n");
if ((emitter::emitSmallCnsCnt > 0) || (emitter::emitLargeCnsCnt > 0))
{
fprintf(fout, "SmallCnsCnt = %6u\n", emitter::emitSmallCnsCnt);
fprintf(fout, "LargeCnsCnt = %6u (%3u %% of total)\n", emitter::emitLargeCnsCnt,
100 * emitter::emitLargeCnsCnt / (emitter::emitLargeCnsCnt + emitter::emitSmallCnsCnt));
}
// Print out the most common small constants.
if (emitter::emitSmallCnsCnt > 0)
{
fprintf(fout, "\n\n");
fprintf(fout, "Common small constants >= %2u, <= %2u\n", ID_MIN_SMALL_CNS, ID_MAX_SMALL_CNS);
unsigned m = emitter::emitSmallCnsCnt / 1000 + 1;
for (int i = ID_MIN_SMALL_CNS; (i <= ID_MAX_SMALL_CNS) && (i < SMALL_CNS_TSZ); i++)
{
unsigned c = emitter::emitSmallCns[i - ID_MIN_SMALL_CNS];
if (c >= m)
{
if (i == SMALL_CNS_TSZ - 1)
{
fprintf(fout, "cns[>=%4d] = %u\n", i, c);
}
else
{
fprintf(fout, "cns[%4d] = %u\n", i, c);
}
}
}
}
fprintf(fout, "%8zu bytes allocated in the emitter\n", emitter::emitTotMemAlloc);
}
#endif // EMITTER_STATS
/*****************************************************************************/
const unsigned short emitTypeSizes[] = {
#define DEF_TP(tn, nm, jitType, verType, sz, sze, asze, st, al, tf, howUsed) sze,
#include "typelist.h"
#undef DEF_TP
};
const unsigned short emitTypeActSz[] = {
#define DEF_TP(tn, nm, jitType, verType, sz, sze, asze, st, al, tf, howUsed) asze,
#include "typelist.h"
#undef DEF_TP
};
/*****************************************************************************/
/*****************************************************************************
*
* Initialize the emitter - called once, at DLL load time.
*/
void emitter::emitInit()
{
}
/*****************************************************************************
*
* Shut down the emitter - called once, at DLL exit time.
*/
void emitter::emitDone()
{
}
/*****************************************************************************
*
* Allocate memory.
*/
void* emitter::emitGetMem(size_t sz)
{
assert(sz % sizeof(int) == 0);
#if EMITTER_STATS
emitTotMemAlloc += sz;
#endif
return emitComp->getAllocator(CMK_InstDesc).allocate<char>(sz);
}
/*****************************************************************************
*
* emitLclVarAddr support methods
*/
void emitLclVarAddr::initLclVarAddr(int varNum, unsigned offset)
{
if (varNum < 32768)
{
if (varNum >= 0)
{
if (offset < 32768)
{
_lvaTag = LVA_STANDARD_ENCODING;
_lvaExtra = offset; // offset known to be in [0..32767]
_lvaVarNum = (unsigned)varNum; // varNum known to be in [0..32767]
}
else // offset >= 32768
{
// We could support larger local offsets here at the cost of less varNums
if (offset >= 65536)
{
IMPL_LIMITATION("JIT doesn't support offsets larger than 65535 into valuetypes\n");
}
_lvaTag = LVA_LARGE_OFFSET;
_lvaExtra = (offset - 32768); // (offset-32768) is known to be in [0..32767]
_lvaVarNum = (unsigned)varNum; // varNum known to be in [0..32767]
}
}
else // varNum < 0, These are used for Compiler spill temps
{
if (varNum < -32767)
{
IMPL_LIMITATION("JIT doesn't support more than 32767 Compiler Spill temps\n");
}
if (offset > 32767)
{
IMPL_LIMITATION(
"JIT doesn't support offsets larger than 32767 into valuetypes for Compiler Spill temps\n");
}
_lvaTag = LVA_COMPILER_TEMP;
_lvaExtra = offset; // offset known to be in [0..32767]
_lvaVarNum = (unsigned)(-varNum); // -varNum known to be in [1..32767]
}
}
else // varNum >= 32768
{
if (offset >= 256)
{
IMPL_LIMITATION("JIT doesn't support offsets larger than 255 into valuetypes for local vars > 32767\n");
}
if (varNum >= 0x00400000)
{ // 0x00400000 == 2^22
IMPL_LIMITATION("JIT doesn't support more than 2^22 variables\n");
}
_lvaTag = LVA_LARGE_VARNUM;
_lvaVarNum = varNum & 0x00007FFF; // varNum bits 14 to 0
_lvaExtra = (varNum & 0x003F8000) >> 15; // varNum bits 21 to 15 in _lvaExtra bits 6 to 0, 7 bits total
_lvaExtra |= (offset << 7); // offset bits 7 to 0 in _lvaExtra bits 14 to 7, 8 bits total
}
}
// Returns the variable to access. Note that it returns a negative number for compiler spill temps.
int emitLclVarAddr::lvaVarNum()
{
switch (_lvaTag)
{
case LVA_COMPILER_TEMP:
return -((int)_lvaVarNum);
case LVA_LARGE_VARNUM:
return (int)(((_lvaExtra & 0x007F) << 15) + _lvaVarNum);
default: // LVA_STANDARD_ENCODING or LVA_LARGE_OFFSET
assert((_lvaTag == LVA_STANDARD_ENCODING) || (_lvaTag == LVA_LARGE_OFFSET));
return (int)_lvaVarNum;
}
}
unsigned emitLclVarAddr::lvaOffset() // returns the offset into the variable to access
{
switch (_lvaTag)
{
case LVA_LARGE_OFFSET:
return (32768 + _lvaExtra);
case LVA_LARGE_VARNUM:
return (_lvaExtra & 0x7F80) >> 7;
default: // LVA_STANDARD_ENCODING or LVA_COMPILER_TEMP
assert((_lvaTag == LVA_STANDARD_ENCODING) || (_lvaTag == LVA_COMPILER_TEMP));
return _lvaExtra;
}
}
/*****************************************************************************
*
* Record some info about the method about to be emitted.
*/
void emitter::emitBegCG(Compiler* comp, COMP_HANDLE cmpHandle)
{
emitComp = comp;
emitCmpHandle = cmpHandle;
}
void emitter::emitEndCG()
{
}
/*****************************************************************************
*
* Prepare the given IG for emission of code.
*/
void emitter::emitGenIG(insGroup* ig)
{
/* Set the "current IG" value */
emitCurIG = ig;
#if EMIT_TRACK_STACK_DEPTH
/* Record the stack level on entry to this group */
ig->igStkLvl = emitCurStackLvl;
// If we don't have enough bits in igStkLvl, refuse to compile
if (ig->igStkLvl != emitCurStackLvl)
{
IMPL_LIMITATION("Too many arguments pushed on stack");
}
// printf("Start IG #%02u [stk=%02u]\n", ig->igNum, emitCurStackLvl);
#endif
if (emitNoGCIG)
{
ig->igFlags |= IGF_NOGCINTERRUPT;
}
/* Prepare to issue instructions */
emitCurIGinsCnt = 0;
emitCurIGsize = 0;
assert(emitCurIGjmpList == nullptr);
#if FEATURE_LOOP_ALIGN
assert(emitCurIGAlignList == nullptr);
#endif
/* Allocate the temp instruction buffer if we haven't done so */
if (emitCurIGfreeBase == nullptr)
{
emitIGbuffSize = SC_IG_BUFFER_SIZE;
emitCurIGfreeBase = (BYTE*)emitGetMem(emitIGbuffSize);
}
emitCurIGfreeNext = emitCurIGfreeBase;
emitCurIGfreeEndp = emitCurIGfreeBase + emitIGbuffSize;
}
/*****************************************************************************
*
* Finish and save the current IG.
*/
insGroup* emitter::emitSavIG(bool emitAdd)
{
insGroup* ig;
BYTE* id;
size_t sz;
size_t gs;
assert(emitCurIGfreeNext <= emitCurIGfreeEndp);
// Get hold of the IG descriptor
ig = emitCurIG;
assert(ig);
#ifdef TARGET_ARMARCH
// Reset emitLastMemBarrier for new IG
emitLastMemBarrier = nullptr;
#endif
// Compute how much code we've generated
sz = emitCurIGfreeNext - emitCurIGfreeBase;
// Compute the total size we need to allocate
gs = roundUp(sz);
// Do we need space for GC?
if (!(ig->igFlags & IGF_EXTEND))
{
// Is the initial set of live GC vars different from the previous one?
if (emitForceStoreGCState || !VarSetOps::Equal(emitComp, emitPrevGCrefVars, emitInitGCrefVars))
{
// Remember that we will have a new set of live GC variables
ig->igFlags |= IGF_GC_VARS;
#if EMITTER_STATS
emitTotalIGptrs++;
#endif
// We'll allocate extra space to record the liveset
gs += sizeof(VARSET_TP);
}
// Is the initial set of live Byref regs different from the previous one?
// Remember that we will have a new set of live GC variables
ig->igFlags |= IGF_BYREF_REGS;
// We'll allocate extra space (DWORD aligned) to record the GC regs
gs += sizeof(int);
}
// Allocate space for the instructions and optional liveset
id = (BYTE*)emitGetMem(gs);
// Do we need to store the byref regs
if (ig->igFlags & IGF_BYREF_REGS)
{
// Record the byref regs in front the of the instructions
*castto(id, unsigned*)++ = (unsigned)emitInitByrefRegs;
}
// Do we need to store the liveset?
if (ig->igFlags & IGF_GC_VARS)
{
// Record the liveset in front the of the instructions
VarSetOps::AssignNoCopy(emitComp, (*castto(id, VARSET_TP*)), VarSetOps::MakeEmpty(emitComp));
VarSetOps::Assign(emitComp, (*castto(id, VARSET_TP*)++), emitInitGCrefVars);
}
// Record the collected instructions
assert((ig->igFlags & IGF_PLACEHOLDER) == 0);
ig->igData = id;
memcpy(id, emitCurIGfreeBase, sz);
#ifdef DEBUG
if (false && emitComp->verbose) // this is not useful in normal dumps (hence it is normally under if (false))
{
// If there's an error during emission, we may want to connect the post-copy address
// of an instrDesc with the pre-copy address (the one that was originally created). This
// printing enables that.
printf("copying instruction group from [0x%x..0x%x) to [0x%x..0x%x).\n", dspPtr(emitCurIGfreeBase),
dspPtr(emitCurIGfreeBase + sz), dspPtr(id), dspPtr(id + sz));
}
#endif
// Record how many instructions and bytes of code this group contains
noway_assert((BYTE)emitCurIGinsCnt == emitCurIGinsCnt);
noway_assert((unsigned short)emitCurIGsize == emitCurIGsize);
ig->igInsCnt = (BYTE)emitCurIGinsCnt;
ig->igSize = (unsigned short)emitCurIGsize;
emitCurCodeOffset += emitCurIGsize;
assert(IsCodeAligned(emitCurCodeOffset));
#if EMITTER_STATS
emitTotalIGicnt += emitCurIGinsCnt;
emitTotalIGsize += sz;
emitSizeMethod += sz;
if (emitIGisInProlog(ig))
{
emitCurPrologInsCnt += emitCurIGinsCnt;
emitCurPrologIGSize += sz;
// Keep track of the maximums.
if (emitCurPrologInsCnt > emitMaxPrologInsCnt)
{
emitMaxPrologInsCnt = emitCurPrologInsCnt;
}
if (emitCurPrologIGSize > emitMaxPrologIGSize)
{
emitMaxPrologIGSize = emitCurPrologIGSize;
}
}
#endif
// Record the live GC register set - if and only if it is not an extension
// block, in which case the GC register sets are inherited from the previous
// block.
if (!(ig->igFlags & IGF_EXTEND))
{
ig->igGCregs = (regMaskSmall)emitInitGCrefRegs;
}
if (!emitAdd)
{
// Update the previous recorded live GC ref sets, but not if if we are
// starting an "overflow" buffer. Note that this is only used to
// determine whether we need to store or not store the GC ref sets for
// the next IG, which is dependent on exactly what the state of the
// emitter GC ref sets will be when the next IG is processed in the
// emitter.
VarSetOps::Assign(emitComp, emitPrevGCrefVars, emitThisGCrefVars);
emitPrevGCrefRegs = emitThisGCrefRegs;
emitPrevByrefRegs = emitThisByrefRegs;
emitForceStoreGCState = false;
}
#ifdef DEBUG
if (emitComp->opts.dspCode)
{
printf("\n %s:", emitLabelString(ig));
if (emitComp->verbose)
{
printf(" ; offs=%06XH, funclet=%02u, bbWeight=%s", ig->igOffs, ig->igFuncIdx,
refCntWtd2str(ig->igWeight));
}
else
{
printf(" ; funclet=%02u", ig->igFuncIdx);
}
printf("\n");
}
#endif
#if FEATURE_LOOP_ALIGN
// Did we have any align instructions in this group?
if (emitCurIGAlignList)
{
instrDescAlign* list = nullptr;
instrDescAlign* last = nullptr;
// Move align instructions to the global list, update their 'next' links
do
{
// Grab the align and remove it from the list
instrDescAlign* oa = emitCurIGAlignList;
emitCurIGAlignList = oa->idaNext;
// Figure out the address of where the align got copied
size_t of = (BYTE*)oa - emitCurIGfreeBase;
instrDescAlign* na = (instrDescAlign*)(ig->igData + of);
assert(na->idaIG == ig);
assert(na->idIns() == oa->idIns());
assert(na->idaNext == oa->idaNext);
assert(na->idIns() == INS_align);
na->idaNext = list;
list = na;
if (last == nullptr)
{
last = na;
}
} while (emitCurIGAlignList);
// Should have at least one align instruction
assert(last);
if (emitAlignList == nullptr)
{
assert(emitAlignLast == nullptr);
last->idaNext = emitAlignList;
emitAlignList = list;
}
else
{
last->idaNext = nullptr;
emitAlignLast->idaNext = list;
}
emitAlignLast = last;
// Point to the first instruction of most recent
// align instruction(s) added.
//
// Since emitCurIGAlignList is created in inverse of
// program order, the `list` reverses that in forms it
// in correct order.
emitAlignLastGroup = list;
}
#endif
// Did we have any jumps in this group?
if (emitCurIGjmpList)
{
instrDescJmp* list = nullptr;
instrDescJmp* last = nullptr;
// Move jumps to the global list, update their 'next' links
do
{
// Grab the jump and remove it from the list
instrDescJmp* oj = emitCurIGjmpList;
emitCurIGjmpList = oj->idjNext;
// Figure out the address of where the jump got copied
size_t of = (BYTE*)oj - emitCurIGfreeBase;
instrDescJmp* nj = (instrDescJmp*)(ig->igData + of);
assert(nj->idjIG == ig);
assert(nj->idIns() == oj->idIns());
assert(nj->idjNext == oj->idjNext);
// Make sure the jumps are correctly ordered
assert(last == nullptr || last->idjOffs > nj->idjOffs);
if (ig->igFlags & IGF_FUNCLET_PROLOG)
{
// Our funclet prologs have short jumps, if the prolog would ever have
// long jumps, then we'd have to insert the list in sorted order than
// just append to the emitJumpList.
noway_assert(nj->idjShort);
if (nj->idjShort)
{
continue;
}
}
// Append the new jump to the list
nj->idjNext = list;
list = nj;
if (last == nullptr)
{
last = nj;
}
} while (emitCurIGjmpList);
if (last != nullptr)
{
// Append the jump(s) from this IG to the global list
bool prologJump = (ig == emitPrologIG);
if ((emitJumpList == nullptr) || prologJump)
{
last->idjNext = emitJumpList;
emitJumpList = list;
}
else
{
last->idjNext = nullptr;
emitJumpLast->idjNext = list;
}
if (!prologJump || (emitJumpLast == nullptr))
{
emitJumpLast = last;
}
}
}
// Fix the last instruction field
if (sz != 0)
{
assert(emitLastIns != nullptr);
assert(emitCurIGfreeBase <= (BYTE*)emitLastIns);
assert((BYTE*)emitLastIns < emitCurIGfreeBase + sz);
emitLastIns = (instrDesc*)((BYTE*)id + ((BYTE*)emitLastIns - (BYTE*)emitCurIGfreeBase));
}
// Reset the buffer free pointers
emitCurIGfreeNext = emitCurIGfreeBase;
return ig;
}
/*****************************************************************************
*
* Start generating code to be scheduled; called once per method.
*/
void emitter::emitBegFN(bool hasFramePtr
#if defined(DEBUG)
,
bool chkAlign
#endif
,
unsigned maxTmpSize)
{
insGroup* ig;
/* Assume we won't need the temp instruction buffer */
emitCurIGfreeBase = nullptr;
emitIGbuffSize = 0;
#if FEATURE_LOOP_ALIGN
emitLastAlignedIgNum = 0;
emitLastLoopStart = 0;
emitLastLoopEnd = 0;
#endif
/* Record stack frame info (the temp size is just an estimate) */
emitHasFramePtr = hasFramePtr;
emitMaxTmpSize = maxTmpSize;
#ifdef DEBUG
emitChkAlign = chkAlign;
#endif
/* We have no epilogs yet */
emitEpilogSize = 0;
emitEpilogCnt = 0;
#ifdef TARGET_XARCH
emitExitSeqBegLoc.Init();
emitExitSeqSize = INT_MAX;
#endif // TARGET_XARCH
emitPlaceholderList = emitPlaceholderLast = nullptr;
#ifdef JIT32_GCENCODER
emitEpilogList = emitEpilogLast = nullptr;
#endif // JIT32_GCENCODER
/* We don't have any jumps */
emitJumpList = emitJumpLast = nullptr;
emitCurIGjmpList = nullptr;
emitFwdJumps = false;
emitNoGCIG = false;
emitForceNewIG = false;
#if FEATURE_LOOP_ALIGN
/* We don't have any align instructions */
emitAlignList = emitAlignLastGroup = emitAlignLast = nullptr;
emitCurIGAlignList = nullptr;
#endif
/* We have not recorded any live sets */
assert(VarSetOps::IsEmpty(emitComp, emitThisGCrefVars));
assert(VarSetOps::IsEmpty(emitComp, emitInitGCrefVars));
assert(VarSetOps::IsEmpty(emitComp, emitPrevGCrefVars));
emitThisGCrefRegs = RBM_NONE;
emitInitGCrefRegs = RBM_NONE;
emitPrevGCrefRegs = RBM_NONE;
emitThisByrefRegs = RBM_NONE;
emitInitByrefRegs = RBM_NONE;
emitPrevByrefRegs = RBM_NONE;
emitForceStoreGCState = false;
#ifdef DEBUG
emitIssuing = false;
#endif
/* Assume there will be no GC ref variables */
emitGCrFrameOffsMin = emitGCrFrameOffsMax = emitGCrFrameOffsCnt = 0;
#ifdef DEBUG
emitGCrFrameLiveTab = nullptr;
#endif
/* We have no groups / code at this point */
emitIGlist = emitIGlast = nullptr;
emitCurCodeOffset = 0;
emitFirstColdIG = nullptr;
emitTotalCodeSize = 0;
#ifdef TARGET_LOONGARCH64
emitCounts_INS_OPTS_J = 0;
#endif
#if EMITTER_STATS
emitTotalIGmcnt++;
emitSizeMethod = 0;
emitCurPrologInsCnt = 0;
emitCurPrologIGSize = 0;
#endif
emitInsCount = 0;
/* The stack is empty now */
emitCurStackLvl = 0;
#if EMIT_TRACK_STACK_DEPTH
emitMaxStackDepth = 0;
emitCntStackDepth = sizeof(int);
#endif
#ifdef PSEUDORANDOM_NOP_INSERTION
// for random NOP insertion
emitEnableRandomNops();
emitComp->info.compRNG.Init(emitComp->info.compChecksum);
emitNextNop = emitNextRandomNop();
emitInInstrumentation = false;
#endif // PSEUDORANDOM_NOP_INSERTION
/* Create the first IG, it will be used for the prolog */
emitNxtIGnum = 1;
emitPrologIG = emitIGlist = emitIGlast = emitCurIG = ig = emitAllocIG();
emitLastIns = nullptr;
#ifdef TARGET_ARMARCH
emitLastMemBarrier = nullptr;
#endif
ig->igNext = nullptr;
#ifdef DEBUG
emitScratchSigInfo = nullptr;
#endif // DEBUG
/* Append another group, to start generating the method body */
emitNewIG();
}
#ifdef PSEUDORANDOM_NOP_INSERTION
int emitter::emitNextRandomNop()
{
return emitComp->info.compRNG.Next(1, 9);
}
#endif
/*****************************************************************************
*
* Done generating code to be scheduled; called once per method.
*/
void emitter::emitEndFN()
{
}
// member function iiaIsJitDataOffset for idAddrUnion, defers to Compiler::eeIsJitDataOffs
bool emitter::instrDesc::idAddrUnion::iiaIsJitDataOffset() const
{
return Compiler::eeIsJitDataOffs(iiaFieldHnd);
}
// member function iiaGetJitDataOffset for idAddrUnion, defers to Compiler::eeGetJitDataOffs
int emitter::instrDesc::idAddrUnion::iiaGetJitDataOffset() const
{
assert(iiaIsJitDataOffset());
return Compiler::eeGetJitDataOffs(iiaFieldHnd);
}
#if defined(DEBUG) || defined(LATE_DISASM)
//----------------------------------------------------------------------------------------
// insEvaluateExecutionCost:
// Returns the estimated execution cost for the current instruction
//
// Arguments:
// id - The current instruction descriptor to be evaluated
//
// Return Value:
// calls getInsExecutionCharacteristics and uses the result
// to compute an estimated execution cost
//
float emitter::insEvaluateExecutionCost(instrDesc* id)
{
insExecutionCharacteristics result = getInsExecutionCharacteristics(id);
float throughput = result.insThroughput;
float latency = result.insLatency;
unsigned memAccessKind = result.insMemoryAccessKind;
// Check for PERFSCORE_THROUGHPUT_ILLEGAL and PERFSCORE_LATENCY_ILLEGAL.
// Note that 0.0 throughput is allowed for pseudo-instructions in the instrDesc list that won't actually
// generate code.
assert(throughput >= 0.0);
assert(latency >= 0.0);
if (memAccessKind == PERFSCORE_MEMORY_WRITE || memAccessKind == PERFSCORE_MEMORY_READ_WRITE)
{
// We assume that we won't read back from memory for the next WR_GENERAL cycles
// Thus we normally won't pay latency costs for writes.
latency = max(0.0f, latency - PERFSCORE_LATENCY_WR_GENERAL);
}
else if (latency >= 1.0) // Otherwise, If we aren't performing a memory write
{
// We assume that the processor's speculation will typically eliminate one cycle of latency
//
latency -= 1.0;
}
return max(throughput, latency);
}
//------------------------------------------------------------------------------------
// perfScoreUnhandledInstruction:
// Helper method used to report an unhandled instruction
//
// Arguments:
// id - The current instruction descriptor to be evaluated
// pResult - pointer to struct holding the instruction characteristics
// if we return these are updated with default values
//
// Notes:
// We print the instruction and instruction group
// and instead of returning we will assert
//
// This method asserts with a debug/checked build
// and returns default latencies of 1 cycle otherwise.
//
void emitter::perfScoreUnhandledInstruction(instrDesc* id, insExecutionCharacteristics* pResult)
{
#ifdef DEBUG
printf("PerfScore: unhandled instruction: %s, format %s", codeGen->genInsDisplayName(id),
emitIfName(id->idInsFmt()));
assert(!"PerfScore: unhandled instruction");
#endif
pResult->insThroughput = PERFSCORE_THROUGHPUT_1C;
pResult->insLatency = PERFSCORE_LATENCY_1C;
}
#endif // defined(DEBUG) || defined(LATE_DISASM)
//----------------------------------------------------------------------------------------
// getCurrentBlockWeight: Return the block weight for the currently active block
//
// Arguments:
// None
//
// Return Value:
// The block weight for the current block
//
// Notes:
// The current block is recorded in emitComp->compCurBB by
// CodeGen::genCodeForBBlist() as it walks the blocks.
// When we are in the prolog/epilog this value is nullptr.
//
weight_t emitter::getCurrentBlockWeight()
{
// If we have a non-null compCurBB, then use it to get the current block weight
if (emitComp->compCurBB != nullptr)
{
return emitComp->compCurBB->getBBWeight(emitComp);
}
else // we have a null compCurBB
{
// prolog or epilog case, so just use the standard weight
return BB_UNITY_WEIGHT;
}
}
#if defined(TARGET_LOONGARCH64)
void emitter::dispIns(instrDesc* id)
{
// For LoongArch64 using the emitDisInsName().
NYI_LOONGARCH64("Not used on LOONGARCH64.");
}
#else
void emitter::dispIns(instrDesc* id)
{
#ifdef DEBUG
emitInsSanityCheck(id);
if (emitComp->opts.dspCode)
{
emitDispIns(id, true, false, false);
}
#if EMIT_TRACK_STACK_DEPTH
assert((int)emitCurStackLvl >= 0);
#endif
size_t sz = emitSizeOfInsDsc(id);
assert(id->idDebugOnlyInfo()->idSize == sz);
#endif // DEBUG
#if EMITTER_STATS
emitIFcounts[id->idInsFmt()]++;
#endif
}
#endif
void emitter::appendToCurIG(instrDesc* id)
{
#ifdef TARGET_ARMARCH
if (id->idIns() == INS_dmb)
{
emitLastMemBarrier = id;
}
else if (emitInsIsLoadOrStore(id->idIns()))
{
// A memory access - reset saved memory barrier
emitLastMemBarrier = nullptr;
}
#endif
emitCurIGsize += id->idCodeSize();
}
/*****************************************************************************
*
* Display (optionally) an instruction offset.
*/
#ifdef DEBUG
void emitter::emitDispInsAddr(BYTE* code)
{
if (emitComp->opts.disAddr)
{
printf(FMT_ADDR, DBG_ADDR(code));
}
}
void emitter::emitDispInsOffs(unsigned offs, bool doffs)
{
if (doffs)
{
printf("%06X", offs);
}
else
{
printf(" ");
}
}
#endif // DEBUG
#ifdef JIT32_GCENCODER
/*****************************************************************************
*
* Call the specified function pointer for each epilog block in the current
* method with the epilog's relative code offset. Returns the sum of the
* values returned by the callback.
*/
size_t emitter::emitGenEpilogLst(size_t (*fp)(void*, unsigned), void* cp)
{
EpilogList* el;
size_t sz;
for (el = emitEpilogList, sz = 0; el != nullptr; el = el->elNext)
{
assert(el->elLoc.GetIG()->igFlags & IGF_EPILOG);
// The epilog starts at the location recorded in the epilog list.
sz += fp(cp, el->elLoc.CodeOffset(this));
}
return sz;
}
#endif // JIT32_GCENCODER
/*****************************************************************************
*
* The following series of methods allocates instruction descriptors.
*/
void* emitter::emitAllocAnyInstr(size_t sz, emitAttr opsz)
{
instrDesc* id;
#ifdef DEBUG
// Under STRESS_EMITTER, put every instruction in its own instruction group.
// We can't do this for a prolog, epilog, funclet prolog, or funclet epilog,
// because those are generated out of order. We currently have a limitation
// where the jump shortening pass uses the instruction group number to determine
// if something is earlier or later in the code stream. This implies that
// these groups cannot be more than a single instruction group. Note that
// the prolog/epilog placeholder groups ARE generated in order, and are
// re-used. But generating additional groups would not work.
if (emitComp->compStressCompile(Compiler::STRESS_EMITTER, 1) && emitCurIGinsCnt && !emitIGisInProlog(emitCurIG) &&
!emitIGisInEpilog(emitCurIG) && !emitCurIG->endsWithAlignInstr()
#if defined(FEATURE_EH_FUNCLETS)
&& !emitIGisInFuncletProlog(emitCurIG) && !emitIGisInFuncletEpilog(emitCurIG)
#endif // FEATURE_EH_FUNCLETS
)
{
emitNxtIG(true);
}
#endif
#ifdef PSEUDORANDOM_NOP_INSERTION
// TODO-ARM-Bug?: PSEUDORANDOM_NOP_INSERTION is not defined for TARGET_ARM
// ARM - This is currently broken on TARGET_ARM
// When nopSize is odd we misalign emitCurIGsize
//
if (!emitComp->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT) && !emitInInstrumentation &&
!emitIGisInProlog(emitCurIG) && // don't do this in prolog or epilog
!emitIGisInEpilog(emitCurIG) &&
emitRandomNops // sometimes we turn off where exact codegen is needed (pinvoke inline)
)
{
if (emitNextNop == 0)
{
int nopSize = 4;
emitInInstrumentation = true;
instrDesc* idnop = emitNewInstr();
emitInInstrumentation = false;
idnop->idInsFmt(IF_NONE);
idnop->idIns(INS_nop);
#if defined(TARGET_XARCH)
idnop->idCodeSize(nopSize);
#else
#error "Undefined target for pseudorandom NOP insertion"
#endif
emitCurIGsize += nopSize;
emitNextNop = emitNextRandomNop();
}
else
emitNextNop--;
}
#endif // PSEUDORANDOM_NOP_INSERTION
assert(IsCodeAligned(emitCurIGsize));
// Make sure we have enough space for the new instruction.
// `igInsCnt` is currently a byte, so we can't have more than 255 instructions in a single insGroup.
if ((emitCurIGfreeNext + sz >= emitCurIGfreeEndp) || emitForceNewIG || (emitCurIGinsCnt >= 255))
{
emitNxtIG(true);
}
/* Grab the space for the instruction */
emitLastIns = id = (instrDesc*)emitCurIGfreeNext;
emitCurIGfreeNext += sz;
assert(sz >= sizeof(void*));
memset(id, 0, sz);
// These fields should have been zero-ed by the above
assert(id->idReg1() == regNumber(0));
assert(id->idReg2() == regNumber(0));
#ifdef TARGET_XARCH
assert(id->idCodeSize() == 0);
#endif
// Make sure that idAddrUnion is just a union of various pointer sized things
C_ASSERT(sizeof(CORINFO_FIELD_HANDLE) <= sizeof(void*));
C_ASSERT(sizeof(CORINFO_METHOD_HANDLE) <= sizeof(void*));
#ifdef TARGET_XARCH
C_ASSERT(sizeof(emitter::emitAddrMode) <= sizeof(void*));
#endif // TARGET_XARCH
C_ASSERT(sizeof(emitLclVarAddr) <= sizeof(void*));
C_ASSERT(sizeof(emitter::instrDesc) == (SMALL_IDSC_SIZE + sizeof(void*)));
emitInsCount++;
#if defined(DEBUG)
/* In debug mode we clear/set some additional fields */
instrDescDebugInfo* info = (instrDescDebugInfo*)emitGetMem(sizeof(*info));
info->idNum = emitInsCount;
info->idSize = sz;
info->idVarRefOffs = 0;
info->idMemCookie = 0;
info->idFlags = GTF_EMPTY;
info->idFinallyCall = false;
info->idCatchRet = false;
info->idCallSig = nullptr;
id->idDebugOnlyInfo(info);
#endif // defined(DEBUG)
/* Store the size and handle the two special values
that indicate GCref and ByRef */
if (EA_IS_GCREF(opsz))
{
/* A special value indicates a GCref pointer value */
id->idGCref(GCT_GCREF);
id->idOpSize(EA_PTRSIZE);
}
else if (EA_IS_BYREF(opsz))
{
/* A special value indicates a Byref pointer value */
id->idGCref(GCT_BYREF);
id->idOpSize(EA_PTRSIZE);
}
else
{
id->idGCref(GCT_NONE);
id->idOpSize(EA_SIZE(opsz));
}
// Amd64: ip-relative addressing is supported even when not generating relocatable ngen code
if (EA_IS_DSP_RELOC(opsz)
#ifndef TARGET_AMD64
&& emitComp->opts.compReloc
#endif // TARGET_AMD64
)
{
/* Mark idInfo()->idDspReloc to remember that the */
/* address mode has a displacement that is relocatable */
id->idSetIsDspReloc();
}
if (EA_IS_CNS_RELOC(opsz) && emitComp->opts.compReloc)
{
/* Mark idInfo()->idCnsReloc to remember that the */
/* instruction has an immediate constant that is relocatable */
id->idSetIsCnsReloc();
}
#if EMITTER_STATS
emitTotalInsCnt++;
#endif
/* Update the instruction count */
emitCurIGinsCnt++;
#ifdef DEBUG
if (emitComp->compCurBB != emitCurIG->lastGeneratedBlock)
{
emitCurIG->igBlocks.push_back(emitComp->compCurBB);
emitCurIG->lastGeneratedBlock = emitComp->compCurBB;
}
#endif // DEBUG
return id;
}
#ifdef DEBUG
//------------------------------------------------------------------------
// emitCheckIGoffsets: Make sure the code offsets of all instruction groups look reasonable.
//
// Note: It checks that each instruction group starts right after the previous ig.
// For the first cold ig offset is also should be the last hot ig + its size.
// emitCurCodeOffs maintains distance for the split case to look like they are consistent.
// Also it checks total code size.
//
void emitter::emitCheckIGoffsets()
{
size_t currentOffset = 0;
for (insGroup* tempIG = emitIGlist; tempIG != nullptr; tempIG = tempIG->igNext)
{
if (tempIG->igOffs != currentOffset)
{
printf("IG%02u has offset %08X, expected %08X\n", tempIG->igNum, tempIG->igOffs, currentOffset);
assert(!"bad block offset");
}
currentOffset += tempIG->igSize;
}
if (emitTotalCodeSize != 0 && emitTotalCodeSize != currentOffset)
{
printf("Total code size is %08X, expected %08X\n", emitTotalCodeSize, currentOffset);
assert(!"bad total code size");
}
}
#endif // DEBUG
/*****************************************************************************
*
* Begin generating a method prolog.
*/
void emitter::emitBegProlog()
{
assert(emitComp->compGeneratingProlog);
#if EMIT_TRACK_STACK_DEPTH
/* Don't measure stack depth inside the prolog, it's misleading */
emitCntStackDepth = 0;
assert(emitCurStackLvl == 0);
#endif
emitNoGCIG = true;
emitForceNewIG = false;
/* Switch to the pre-allocated prolog IG */
emitGenIG(emitPrologIG);
/* Nothing is live on entry to the prolog */
// These were initialized to Empty at the start of compilation.
VarSetOps::ClearD(emitComp, emitInitGCrefVars);
VarSetOps::ClearD(emitComp, emitPrevGCrefVars);
emitInitGCrefRegs = RBM_NONE;
emitPrevGCrefRegs = RBM_NONE;
emitInitByrefRegs = RBM_NONE;
emitPrevByrefRegs = RBM_NONE;
}
/*****************************************************************************
*
* Return the code offset of the current location in the prolog.
*/
unsigned emitter::emitGetPrologOffsetEstimate()
{
/* For now only allow a single prolog ins group */
assert(emitPrologIG);
assert(emitPrologIG == emitCurIG);
return emitCurIGsize;
}
/*****************************************************************************
*
* Mark the code offset of the current location as the end of the prolog,
* so it can be used later to compute the actual size of the prolog.
*/
void emitter::emitMarkPrologEnd()
{
assert(emitComp->compGeneratingProlog);
/* For now only allow a single prolog ins group */
assert(emitPrologIG);
assert(emitPrologIG == emitCurIG);
emitPrologEndPos = emitCurOffset();
}
/*****************************************************************************
*
* Finish generating a method prolog.
*/
void emitter::emitEndProlog()
{
assert(emitComp->compGeneratingProlog);
emitNoGCIG = false;
/* Save the prolog IG if non-empty or if only one block */
if (emitCurIGnonEmpty() || emitCurIG == emitPrologIG)
{
emitSavIG();
}
#if EMIT_TRACK_STACK_DEPTH
/* Reset the stack depth values */
emitCurStackLvl = 0;
emitCntStackDepth = sizeof(int);
#endif
}
/*****************************************************************************
*
* Create a placeholder instruction group to be used by a prolog or epilog,
* either for the main function, or a funclet.
*/
void emitter::emitCreatePlaceholderIG(insGroupPlaceholderType igType,
BasicBlock* igBB,
VARSET_VALARG_TP GCvars,
regMaskTP gcrefRegs,
regMaskTP byrefRegs,
bool last)
{
assert(igBB != nullptr);
bool extend = false;
if (igType == IGPT_EPILOG
#if defined(FEATURE_EH_FUNCLETS)
|| igType == IGPT_FUNCLET_EPILOG
#endif // FEATURE_EH_FUNCLETS
)
{
#ifdef TARGET_AMD64
emitOutputPreEpilogNOP();
#endif // TARGET_AMD64
extend = true;
}
if (emitCurIGnonEmpty())
{
emitNxtIG(extend);
}
/* Update GC tracking for the beginning of the placeholder IG */
if (!extend)
{
VarSetOps::Assign(emitComp, emitThisGCrefVars, GCvars);
VarSetOps::Assign(emitComp, emitInitGCrefVars, GCvars);
emitThisGCrefRegs = emitInitGCrefRegs = gcrefRegs;
emitThisByrefRegs = emitInitByrefRegs = byrefRegs;
}
/* Convert the group to a placeholder group */
insGroup* igPh = emitCurIG;
igPh->igFlags |= IGF_PLACEHOLDER;
/* Note that we might be re-using a previously created but empty IG. In this
* case, we need to make sure any re-used fields, such as igFuncIdx, are correct.
*/
igPh->igFuncIdx = emitComp->compCurrFuncIdx;
/* Create a separate block of memory to store placeholder information.
* We could use unions to put some of this into the insGroup itself, but we don't
* want to grow the insGroup, and it's difficult to make sure the
* insGroup fields are getting set and used elsewhere.
*/
igPh->igPhData = new (emitComp, CMK_InstDesc) insPlaceholderGroupData;
igPh->igPhData->igPhNext = nullptr;
igPh->igPhData->igPhType = igType;
igPh->igPhData->igPhBB = igBB;
VarSetOps::AssignNoCopy(emitComp, igPh->igPhData->igPhPrevGCrefVars, VarSetOps::UninitVal());
VarSetOps::Assign(emitComp, igPh->igPhData->igPhPrevGCrefVars, emitPrevGCrefVars);
igPh->igPhData->igPhPrevGCrefRegs = emitPrevGCrefRegs;
igPh->igPhData->igPhPrevByrefRegs = emitPrevByrefRegs;
VarSetOps::AssignNoCopy(emitComp, igPh->igPhData->igPhInitGCrefVars, VarSetOps::UninitVal());
VarSetOps::Assign(emitComp, igPh->igPhData->igPhInitGCrefVars, emitInitGCrefVars);
igPh->igPhData->igPhInitGCrefRegs = emitInitGCrefRegs;
igPh->igPhData->igPhInitByrefRegs = emitInitByrefRegs;
#if EMITTER_STATS
emitTotalPhIGcnt += 1;
#endif
// Mark function prologs and epilogs properly in the igFlags bits. These bits
// will get used and propagated when the placeholder is converted to a non-placeholder
// during prolog/epilog generation.
if (igType == IGPT_EPILOG)
{
igPh->igFlags |= IGF_EPILOG;
}
#if defined(FEATURE_EH_FUNCLETS)
else if (igType == IGPT_FUNCLET_PROLOG)
{
igPh->igFlags |= IGF_FUNCLET_PROLOG;
}
else if (igType == IGPT_FUNCLET_EPILOG)
{
igPh->igFlags |= IGF_FUNCLET_EPILOG;
}
#endif // FEATURE_EH_FUNCLETS
/* Link it into the placeholder list */
if (emitPlaceholderList)
{
emitPlaceholderLast->igPhData->igPhNext = igPh;
}
else
{
emitPlaceholderList = igPh;
}
emitPlaceholderLast = igPh;
// Give an estimated size of this placeholder IG and
// increment emitCurCodeOffset since we are not calling emitNewIG()
//
emitCurIGsize += MAX_PLACEHOLDER_IG_SIZE;
emitCurCodeOffset += emitCurIGsize;
#if defined(FEATURE_EH_FUNCLETS)
// Add the appropriate IP mapping debugging record for this placeholder
// group. genExitCode() adds the mapping for main function epilogs.
if (emitComp->opts.compDbgInfo)
{
if (igType == IGPT_FUNCLET_PROLOG)
{
codeGen->genIPmappingAdd(IPmappingDscKind::Prolog, DebugInfo(), true);
}
else if (igType == IGPT_FUNCLET_EPILOG)
{
codeGen->genIPmappingAdd(IPmappingDscKind::Epilog, DebugInfo(), true);
}
}
#endif // FEATURE_EH_FUNCLETS
/* Start a new IG if more code follows */
if (last)
{
emitCurIG = nullptr;
}
else
{
if (igType == IGPT_EPILOG
#if defined(FEATURE_EH_FUNCLETS)
|| igType == IGPT_FUNCLET_EPILOG
#endif // FEATURE_EH_FUNCLETS
)
{
// If this was an epilog, then assume this is the end of any currently in progress
// no-GC region. If a block after the epilog needs to be no-GC, it needs to call
// emitter::emitDisableGC() directly. This behavior is depended upon by the fast
// tailcall implementation, which disables GC at the beginning of argument setup,
// but assumes that after the epilog it will be re-enabled.
emitNoGCIG = false;
}
emitNewIG();
// We don't know what the GC ref state will be at the end of the placeholder
// group. So, force the next IG to store all the GC ref state variables;
// don't omit them because emitPrev* is the same as emitInit*, because emitPrev*
// will be inaccurate. (Note that, currently, GCrefRegs and ByrefRegs are always
// saved anyway.)
//
// There is no need to re-initialize the emitPrev* variables, as they won't be used
// with emitForceStoreGCState==true, and will be re-initialized just before
// emitForceStoreGCState is set to false;
emitForceStoreGCState = true;
/* The group after the placeholder group doesn't get the "propagate" flags */
emitCurIG->igFlags &= ~IGF_PROPAGATE_MASK;
}
#ifdef DEBUG
if (emitComp->verbose)
{
printf("*************** After placeholder IG creation\n");
emitDispIGlist(false);
}
#endif
}
/*****************************************************************************
*
* Generate all prologs and epilogs
*/
void emitter::emitGeneratePrologEpilog()
{
#ifdef DEBUG
unsigned prologCnt = 0;
unsigned epilogCnt = 0;
#if defined(FEATURE_EH_FUNCLETS)
unsigned funcletPrologCnt = 0;
unsigned funcletEpilogCnt = 0;
#endif // FEATURE_EH_FUNCLETS
#endif // DEBUG
insGroup* igPh;
insGroup* igPhNext;
// Generating the prolog/epilog is going to destroy the placeholder group,
// so save the "next" pointer before that happens.
for (igPh = emitPlaceholderList; igPh != nullptr; igPh = igPhNext)
{
assert(igPh->igFlags & IGF_PLACEHOLDER);
igPhNext = igPh->igPhData->igPhNext;
BasicBlock* igPhBB = igPh->igPhData->igPhBB;
switch (igPh->igPhData->igPhType)
{
case IGPT_PROLOG: // currently unused
INDEBUG(++prologCnt);
break;
case IGPT_EPILOG:
INDEBUG(++epilogCnt);
emitBegFnEpilog(igPh);
codeGen->genFnEpilog(igPhBB);
emitEndFnEpilog();
break;
#if defined(FEATURE_EH_FUNCLETS)
case IGPT_FUNCLET_PROLOG:
INDEBUG(++funcletPrologCnt);
emitBegFuncletProlog(igPh);
codeGen->genFuncletProlog(igPhBB);
emitEndFuncletProlog();
break;
case IGPT_FUNCLET_EPILOG:
INDEBUG(++funcletEpilogCnt);
emitBegFuncletEpilog(igPh);
codeGen->genFuncletEpilog();
emitEndFuncletEpilog();
break;
#endif // FEATURE_EH_FUNCLETS
default:
unreached();
}
}
#ifdef DEBUG
if (emitComp->verbose)
{
printf("%d prologs, %d epilogs", prologCnt, epilogCnt);
#if defined(FEATURE_EH_FUNCLETS)
printf(", %d funclet prologs, %d funclet epilogs", funcletPrologCnt, funcletEpilogCnt);
#endif // FEATURE_EH_FUNCLETS
printf("\n");
// prolog/epilog code doesn't use this yet
// noway_assert(prologCnt == 1);
// noway_assert(epilogCnt == emitEpilogCnt); // Is this correct?
#if defined(FEATURE_EH_FUNCLETS)
assert(funcletPrologCnt == emitComp->ehFuncletCount());
#endif // FEATURE_EH_FUNCLETS
}
#endif // DEBUG
}
/*****************************************************************************
*
* Begin all prolog and epilog generation
*/
void emitter::emitStartPrologEpilogGeneration()
{
/* Save the current IG if it's non-empty */
if (emitCurIGnonEmpty())
{
emitSavIG();
}
else
{
assert(emitCurIG == nullptr);
}
}
/*****************************************************************************
*
* Finish all prolog and epilog generation
*/
void emitter::emitFinishPrologEpilogGeneration()
{
/* Update the offsets of all the blocks */
emitRecomputeIGoffsets();
/* We should not generate any more code after this */
emitCurIG = nullptr;
}
/*****************************************************************************
*
* Common code for prolog / epilog beginning. Convert the placeholder group to actual code IG,
* and set it as the current group.
*/
void emitter::emitBegPrologEpilog(insGroup* igPh)
{
assert(igPh->igFlags & IGF_PLACEHOLDER);
/* Save the current IG if it's non-empty */
if (emitCurIGnonEmpty())
{
emitSavIG();
}
/* Convert the placeholder group to a normal group.
* We need to be very careful to re-initialize the IG properly.
* It turns out, this means we only need to clear the placeholder bit
* and clear the igPhData field, and emitGenIG() will do the rest,
* since in the placeholder IG we didn't touch anything that is set by emitAllocIG().
*/
igPh->igFlags &= ~IGF_PLACEHOLDER;
emitNoGCIG = true;
emitForceNewIG = false;
/* Set up the GC info that we stored in the placeholder */
VarSetOps::Assign(emitComp, emitPrevGCrefVars, igPh->igPhData->igPhPrevGCrefVars);
emitPrevGCrefRegs = igPh->igPhData->igPhPrevGCrefRegs;
emitPrevByrefRegs = igPh->igPhData->igPhPrevByrefRegs;
VarSetOps::Assign(emitComp, emitThisGCrefVars, igPh->igPhData->igPhInitGCrefVars);
VarSetOps::Assign(emitComp, emitInitGCrefVars, igPh->igPhData->igPhInitGCrefVars);
emitThisGCrefRegs = emitInitGCrefRegs = igPh->igPhData->igPhInitGCrefRegs;
emitThisByrefRegs = emitInitByrefRegs = igPh->igPhData->igPhInitByrefRegs;
igPh->igPhData = nullptr;
/* Create a non-placeholder group pointer that we'll now use */
insGroup* ig = igPh;
/* Set the current function using the function index we stored */
emitComp->funSetCurrentFunc(ig->igFuncIdx);
/* Set the new IG as the place to generate code */
emitGenIG(ig);
#if EMIT_TRACK_STACK_DEPTH
/* Don't measure stack depth inside the prolog / epilog, it's misleading */
emitCntStackDepth = 0;
assert(emitCurStackLvl == 0);
#endif
}
/*****************************************************************************
*
* Common code for end of prolog / epilog
*/
void emitter::emitEndPrologEpilog()
{
emitNoGCIG = false;
/* Save the IG if non-empty */
if (emitCurIGnonEmpty())
{
emitSavIG();
}
assert(emitCurIGsize <= MAX_PLACEHOLDER_IG_SIZE);
#if EMIT_TRACK_STACK_DEPTH
/* Reset the stack depth values */
emitCurStackLvl = 0;
emitCntStackDepth = sizeof(int);
#endif
}
/*****************************************************************************
*
* Begin generating a main function epilog.
*/
void emitter::emitBegFnEpilog(insGroup* igPh)
{
emitEpilogCnt++;
emitBegPrologEpilog(igPh);
#ifdef JIT32_GCENCODER
EpilogList* el = new (emitComp, CMK_GC) EpilogList();
if (emitEpilogLast != nullptr)
{
emitEpilogLast->elNext = el;
}
else
{
emitEpilogList = el;
}
emitEpilogLast = el;
#endif // JIT32_GCENCODER
}
/*****************************************************************************
*
* Finish generating a funclet epilog.
*/
void emitter::emitEndFnEpilog()
{
emitEndPrologEpilog();
#ifdef JIT32_GCENCODER
assert(emitEpilogLast != nullptr);
UNATIVE_OFFSET epilogBegCodeOffset = emitEpilogLast->elLoc.CodeOffset(this);
UNATIVE_OFFSET epilogExitSeqStartCodeOffset = emitExitSeqBegLoc.CodeOffset(this);
UNATIVE_OFFSET newSize = epilogExitSeqStartCodeOffset - epilogBegCodeOffset;
/* Compute total epilog size */
assert(emitEpilogSize == 0 || emitEpilogSize == newSize); // All epilogs must be identical
emitEpilogSize = newSize;
UNATIVE_OFFSET epilogEndCodeOffset = emitCodeOffset(emitCurIG, emitCurOffset());
assert(epilogExitSeqStartCodeOffset != epilogEndCodeOffset);
newSize = epilogEndCodeOffset - epilogExitSeqStartCodeOffset;
if (newSize < emitExitSeqSize)
{
// We expect either the epilog to be the same every time, or that
// one will be a ret or a ret <n> and others will be a jmp addr or jmp [addr];
// we make the epilogs the minimum of these. Note that this ONLY works
// because the only instruction is the last one and thus a slight
// underestimation of the epilog size is harmless (since the EIP
// can not be between instructions).
assert(emitEpilogCnt == 1 ||
(emitExitSeqSize - newSize) <= 5 // delta between size of various forms of jmp (size is either 6 or 5),
// and various forms of ret (size is either 1 or 3). The combination can
// be anything between 1 and 5.
);
emitExitSeqSize = newSize;
}
#endif // JIT32_GCENCODER
}
#if defined(FEATURE_EH_FUNCLETS)
/*****************************************************************************
*
* Begin generating a funclet prolog.
*/
void emitter::emitBegFuncletProlog(insGroup* igPh)
{
emitBegPrologEpilog(igPh);
}
/*****************************************************************************
*
* Finish generating a funclet prolog.
*/
void emitter::emitEndFuncletProlog()
{
emitEndPrologEpilog();
}
/*****************************************************************************
*
* Begin generating a funclet epilog.
*/
void emitter::emitBegFuncletEpilog(insGroup* igPh)
{
emitBegPrologEpilog(igPh);
}
/*****************************************************************************
*
* Finish generating a funclet epilog.
*/
void emitter::emitEndFuncletEpilog()
{
emitEndPrologEpilog();
}
#endif // FEATURE_EH_FUNCLETS
#ifdef JIT32_GCENCODER
//
// emitter::emitStartEpilog:
// Mark the current position so that we can later compute the total epilog size.
//
void emitter::emitStartEpilog()
{
assert(emitEpilogLast != nullptr);
emitEpilogLast->elLoc.CaptureLocation(this);
}
/*****************************************************************************
*
* Return non-zero if the current method only has one epilog, which is
* at the very end of the method body.
*/
bool emitter::emitHasEpilogEnd()
{
if (emitEpilogCnt == 1 && (emitIGlast->igFlags & IGF_EPILOG)) // This wouldn't work for funclets
return true;
else
return false;
}
#endif // JIT32_GCENCODER
#ifdef TARGET_XARCH
/*****************************************************************************
*
* Mark the beginning of the epilog exit sequence by remembering our position.
*/
void emitter::emitStartExitSeq()
{
assert(emitComp->compGeneratingEpilog);
emitExitSeqBegLoc.CaptureLocation(this);
}
#endif // TARGET_XARCH
/*****************************************************************************
*
* The code generator tells us the range of GC ref locals through this
* method. Needless to say, locals and temps should be allocated so that
* the size of the range is as small as possible.
*
* offsLo - The FP offset from which the GC pointer range starts.
* offsHi - The FP offset at which the GC pointer region ends (exclusive).
*/
void emitter::emitSetFrameRangeGCRs(int offsLo, int offsHi)
{
assert(emitComp->compGeneratingProlog);
assert(offsHi > offsLo);
#ifdef DEBUG
// A total of 47254 methods compiled.
//
// GC ref frame variable counts:
//
// <= 0 ===> 43175 count ( 91% of total)
// 1 .. 1 ===> 2367 count ( 96% of total)
// 2 .. 2 ===> 887 count ( 98% of total)
// 3 .. 5 ===> 579 count ( 99% of total)
// 6 .. 10 ===> 141 count ( 99% of total)
// 11 .. 20 ===> 40 count ( 99% of total)
// 21 .. 50 ===> 42 count ( 99% of total)
// 51 .. 128 ===> 15 count ( 99% of total)
// 129 .. 256 ===> 4 count ( 99% of total)
// 257 .. 512 ===> 4 count (100% of total)
// 513 .. 1024 ===> 0 count (100% of total)
if (emitComp->verbose)
{
unsigned count = (offsHi - offsLo) / TARGET_POINTER_SIZE;
printf("%u tracked GC refs are at stack offsets ", count);
if (offsLo >= 0)
{
printf(" %04X ... %04X\n", offsLo, offsHi);
assert(offsHi >= 0);
}
else
#if defined(TARGET_ARM) && defined(PROFILING_SUPPORTED)
if (!emitComp->compIsProfilerHookNeeded())
#endif
{
#ifdef TARGET_AMD64
// doesn't have to be all negative on amd
printf("-%04X ... %04X\n", -offsLo, offsHi);
#elif defined(TARGET_LOONGARCH64)
if (offsHi < 0)
printf("-%04X ... -%04X\n", -offsLo, -offsHi);
else
printf("-%04X ... %04X\n", -offsLo, offsHi);
#else
printf("-%04X ... -%04X\n", -offsLo, -offsHi);
assert(offsHi <= 0);
#endif
}
#if defined(TARGET_ARM) && defined(PROFILING_SUPPORTED)
else
{
// Under profiler due to prespilling of arguments, offHi need not be < 0
if (offsHi < 0)
printf("-%04X ... -%04X\n", -offsLo, -offsHi);
else
printf("-%04X ... %04X\n", -offsLo, offsHi);
}
#endif
}
#endif // DEBUG
assert(((offsHi - offsLo) % TARGET_POINTER_SIZE) == 0);
assert((offsLo % TARGET_POINTER_SIZE) == 0);
assert((offsHi % TARGET_POINTER_SIZE) == 0);
emitGCrFrameOffsMin = offsLo;
emitGCrFrameOffsMax = offsHi;
emitGCrFrameOffsCnt = (offsHi - offsLo) / TARGET_POINTER_SIZE;
}
/*****************************************************************************
*
* The code generator tells us the range of local variables through this
* method.
*/
void emitter::emitSetFrameRangeLcls(int offsLo, int offsHi)
{
}
/*****************************************************************************
*
* The code generator tells us the range of used arguments through this
* method.
*/
void emitter::emitSetFrameRangeArgs(int offsLo, int offsHi)
{
}
/*****************************************************************************
*
* A conversion table used to map an operand size value (in bytes) into its
* small encoding (0 through 3), and vice versa.
*/
const emitter::opSize emitter::emitSizeEncode[] = {
emitter::OPSZ1, emitter::OPSZ2, OPSIZE_INVALID, emitter::OPSZ4, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID,
emitter::OPSZ8, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID,
OPSIZE_INVALID, emitter::OPSZ16, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID,
OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID,
OPSIZE_INVALID, OPSIZE_INVALID, OPSIZE_INVALID, emitter::OPSZ32,
};
const emitAttr emitter::emitSizeDecode[emitter::OPSZ_COUNT] = {EA_1BYTE, EA_2BYTE, EA_4BYTE,
EA_8BYTE, EA_16BYTE, EA_32BYTE};
/*****************************************************************************
*
* Allocate an instruction descriptor for an instruction that uses both
* a displacement and a constant.
*/
emitter::instrDesc* emitter::emitNewInstrCnsDsp(emitAttr size, target_ssize_t cns, int dsp)
{
if (dsp == 0)
{
if (instrDesc::fitsInSmallCns(cns))
{
instrDesc* id = emitAllocInstr(size);
id->idSmallCns(cns);
#if EMITTER_STATS
emitSmallCnsCnt++;
if ((cns - ID_MIN_SMALL_CNS) >= (SMALL_CNS_TSZ - 1))
emitSmallCns[SMALL_CNS_TSZ - 1]++;
else
emitSmallCns[cns - ID_MIN_SMALL_CNS]++;
emitSmallDspCnt++;
#endif
return id;
}
else
{
instrDescCns* id = emitAllocInstrCns(size, cns);
#if EMITTER_STATS
emitLargeCnsCnt++;
emitSmallDspCnt++;
#endif
return id;
}
}
else
{
if (instrDesc::fitsInSmallCns(cns))
{
instrDescDsp* id = emitAllocInstrDsp(size);
id->idSetIsLargeDsp();
id->iddDspVal = dsp;
id->idSmallCns(cns);
#if EMITTER_STATS
emitLargeDspCnt++;
emitSmallCnsCnt++;
if ((cns - ID_MIN_SMALL_CNS) >= (SMALL_CNS_TSZ - 1))
emitSmallCns[SMALL_CNS_TSZ - 1]++;
else
emitSmallCns[cns - ID_MIN_SMALL_CNS]++;
#endif
return id;
}
else
{
instrDescCnsDsp* id = emitAllocInstrCnsDsp(size);
id->idSetIsLargeCns();
id->iddcCnsVal = cns;
id->idSetIsLargeDsp();
id->iddcDspVal = dsp;
#if EMITTER_STATS
emitLargeDspCnt++;
emitLargeCnsCnt++;
#endif
return id;
}
}
}
//------------------------------------------------------------------------
// emitNoGChelper: Returns true if garbage collection won't happen within the helper call.
//
// Notes:
// There is no need to record live pointers for such call sites.
//
// Arguments:
// helpFunc - a helper signature for the call, can be CORINFO_HELP_UNDEF, that means that the call is not a helper.
//
// Return value:
// true if GC can't happen within this call, false otherwise.
bool emitter::emitNoGChelper(CorInfoHelpFunc helpFunc)
{
// TODO-Throughput: Make this faster (maybe via a simple table of bools?)
switch (helpFunc)
{
case CORINFO_HELP_UNDEF:
return false;
case CORINFO_HELP_PROF_FCN_LEAVE:
case CORINFO_HELP_PROF_FCN_ENTER:
case CORINFO_HELP_PROF_FCN_TAILCALL:
case CORINFO_HELP_LLSH:
case CORINFO_HELP_LRSH:
case CORINFO_HELP_LRSZ:
// case CORINFO_HELP_LMUL:
// case CORINFO_HELP_LDIV:
// case CORINFO_HELP_LMOD:
// case CORINFO_HELP_ULDIV:
// case CORINFO_HELP_ULMOD:
#ifdef TARGET_X86
case CORINFO_HELP_ASSIGN_REF_EAX:
case CORINFO_HELP_ASSIGN_REF_ECX:
case CORINFO_HELP_ASSIGN_REF_EBX:
case CORINFO_HELP_ASSIGN_REF_EBP:
case CORINFO_HELP_ASSIGN_REF_ESI:
case CORINFO_HELP_ASSIGN_REF_EDI:
case CORINFO_HELP_CHECKED_ASSIGN_REF_EAX:
case CORINFO_HELP_CHECKED_ASSIGN_REF_ECX:
case CORINFO_HELP_CHECKED_ASSIGN_REF_EBX:
case CORINFO_HELP_CHECKED_ASSIGN_REF_EBP:
case CORINFO_HELP_CHECKED_ASSIGN_REF_ESI:
case CORINFO_HELP_CHECKED_ASSIGN_REF_EDI:
#endif
case CORINFO_HELP_ASSIGN_REF:
case CORINFO_HELP_CHECKED_ASSIGN_REF:
case CORINFO_HELP_ASSIGN_BYREF:
case CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR:
case CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR:
case CORINFO_HELP_INIT_PINVOKE_FRAME:
case CORINFO_HELP_VALIDATE_INDIRECT_CALL:
return true;
default:
return false;
}
}
//------------------------------------------------------------------------
// emitNoGChelper: Returns true if garbage collection won't happen within the helper call.
//
// Notes:
// There is no need to record live pointers for such call sites.
//
// Arguments:
// methHnd - a method handle for the call.
//
// Return value:
// true if GC can't happen within this call, false otherwise.
bool emitter::emitNoGChelper(CORINFO_METHOD_HANDLE methHnd)
{
CorInfoHelpFunc helpFunc = Compiler::eeGetHelperNum(methHnd);
if (helpFunc == CORINFO_HELP_UNDEF)
{
return false;
}
return emitNoGChelper(helpFunc);
}
/*****************************************************************************
*
* Mark the current spot as having a label.
*/
void* emitter::emitAddLabel(VARSET_VALARG_TP GCvars,
regMaskTP gcrefRegs,
regMaskTP byrefRegs,
bool isFinallyTarget DEBUG_ARG(BasicBlock* block))
{
/* Create a new IG if the current one is non-empty */
if (emitCurIGnonEmpty())
{
emitNxtIG();
}
#if defined(DEBUG) || defined(LATE_DISASM)
else
{
emitCurIG->igWeight = getCurrentBlockWeight();
emitCurIG->igPerfScore = 0.0;
}
#endif
VarSetOps::Assign(emitComp, emitThisGCrefVars, GCvars);
VarSetOps::Assign(emitComp, emitInitGCrefVars, GCvars);
emitThisGCrefRegs = emitInitGCrefRegs = gcrefRegs;
emitThisByrefRegs = emitInitByrefRegs = byrefRegs;
#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
if (isFinallyTarget)
{
emitCurIG->igFlags |= IGF_FINALLY_TARGET;
}
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
#ifdef DEBUG
JITDUMP("Mapped " FMT_BB " to %s\n", block->bbNum, emitLabelString(emitCurIG));
if (EMIT_GC_VERBOSE)
{
printf("Label: IG%02u, GCvars=%s ", emitCurIG->igNum, VarSetOps::ToString(emitComp, GCvars));
dumpConvertedVarSet(emitComp, GCvars);
printf(", gcrefRegs=");
printRegMaskInt(gcrefRegs);
emitDispRegSet(gcrefRegs);
printf(", byrefRegs=");
printRegMaskInt(byrefRegs);
emitDispRegSet(byrefRegs);
printf("\n");
}
#endif
return emitCurIG;
}
void* emitter::emitAddInlineLabel()
{
if (emitCurIGnonEmpty())
{
emitNxtIG(true);
}
return emitCurIG;
}
#ifdef DEBUG
//-----------------------------------------------------------------------------
// emitPrintLabel: Print the assembly label for an insGroup. We could use emitter::emitLabelString()
// to be consistent, but that seems silly.
//
void emitter::emitPrintLabel(insGroup* ig)
{
printf("G_M%03u_IG%02u", emitComp->compMethodID, ig->igNum);
}
//-----------------------------------------------------------------------------
// emitLabelString: Return label string for an insGroup, for use in debug output.
// This can be called up to four times in a single 'printf' before the static buffers
// get reused.
//
// Returns:
// String with insGroup label
//
const char* emitter::emitLabelString(insGroup* ig)
{
const int TEMP_BUFFER_LEN = 40;
static unsigned curBuf = 0;
static char buf[4][TEMP_BUFFER_LEN];
const char* retbuf;
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "G_M%03u_IG%02u", emitComp->compMethodID, ig->igNum);
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}
#endif // DEBUG
#if defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
// Does the argument location point to an IG at the end of a function or funclet?
// We can ignore the codePos part of the location, since it doesn't affect the
// determination. If 'emitLocNextFragment' is non-NULL, it indicates the first
// IG of the next fragment, so it represents a function end.
bool emitter::emitIsFuncEnd(emitLocation* emitLoc, emitLocation* emitLocNextFragment /* = NULL */)
{
assert(emitLoc);
insGroup* ig = emitLoc->GetIG();
assert(ig);
// Are we at the end of the IG list?
if ((emitLocNextFragment != NULL) && (ig->igNext == emitLocNextFragment->GetIG()))
return true;
// Safety check
if (ig->igNext == NULL)
return true;
// Is the next IG the start of a funclet prolog?
if (ig->igNext->igFlags & IGF_FUNCLET_PROLOG)
return true;
#if defined(FEATURE_EH_FUNCLETS)
// Is the next IG a placeholder group for a funclet prolog?
if ((ig->igNext->igFlags & IGF_PLACEHOLDER) && (ig->igNext->igPhData->igPhType == IGPT_FUNCLET_PROLOG))
{
return true;
}
#endif // FEATURE_EH_FUNCLETS
return false;
}
/*****************************************************************************
*
* Split the region from 'startLoc' to 'endLoc' into fragments by calling
* a callback function to indicate the beginning of a fragment. The initial code,
* starting at 'startLoc', doesn't get a callback, but the first code fragment,
* about 'maxSplitSize' bytes out does, as does the beginning of each fragment
* after that. There is no callback for the end (only the beginning of the last
* fragment gets a callback). A fragment must contain at least one instruction
* group. It should be smaller than 'maxSplitSize', although it may be larger to
* satisfy the "at least one instruction group" rule. Do not split prologs or
* epilogs. (Currently, prologs exist in a single instruction group at the main
* function beginning, so they aren't split. Funclets, however, might span IGs,
* so we can't split in between them.)
*
* Note that the locations must be the start of instruction groups; the part of
* the location indicating offset within a group must be zero.
*
* If 'startLoc' is NULL, it means the start of the code.
* If 'endLoc' is NULL, it means the end of the code.
*/
void emitter::emitSplit(emitLocation* startLoc,
emitLocation* endLoc,
UNATIVE_OFFSET maxSplitSize,
void* context,
emitSplitCallbackType callbackFunc)
{
insGroup* igStart = (startLoc == NULL) ? emitIGlist : startLoc->GetIG();
insGroup* igEnd = (endLoc == NULL) ? NULL : endLoc->GetIG();
insGroup* igPrev;
insGroup* ig;
insGroup* igLastReported;
insGroup* igLastCandidate;
UNATIVE_OFFSET curSize;
UNATIVE_OFFSET candidateSize;
for (igPrev = NULL, ig = igLastReported = igStart, igLastCandidate = NULL, candidateSize = 0, curSize = 0;
ig != igEnd && ig != NULL; igPrev = ig, ig = ig->igNext)
{
// Keep looking until we've gone past the maximum split size
if (curSize >= maxSplitSize)
{
bool reportCandidate = true;
// Is there a candidate?
if (igLastCandidate == NULL)
{
#ifdef DEBUG
if (EMITVERBOSE)
printf("emitSplit: can't split at IG%02u; we don't have a candidate to report\n", ig->igNum);
#endif
reportCandidate = false;
}
// Don't report the same thing twice (this also happens for the first block, since igLastReported is
// initialized to igStart).
if (igLastCandidate == igLastReported)
{
#ifdef DEBUG
if (EMITVERBOSE)
printf("emitSplit: can't split at IG%02u; we already reported it\n", igLastCandidate->igNum);
#endif
reportCandidate = false;
}
// Don't report a zero-size candidate. This will only occur in a stress mode with JitSplitFunctionSize
// set to something small, and a zero-sized IG (possibly inserted for use by the alignment code). Normally,
// the split size will be much larger than the maximum size of an instruction group. The invariant we want
// to maintain is that each fragment contains a non-zero amount of code.
if (reportCandidate && (candidateSize == 0))
{
#ifdef DEBUG
if (EMITVERBOSE)
printf("emitSplit: can't split at IG%02u; zero-sized candidate\n", igLastCandidate->igNum);
#endif
reportCandidate = false;
}
// Report it!
if (reportCandidate)
{
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("emitSplit: split at IG%02u is size %d, %s than requested maximum size of %d\n",
igLastCandidate->igNum, candidateSize, (candidateSize >= maxSplitSize) ? "larger" : "less",
maxSplitSize);
}
#endif
// hand memory ownership to the callback function
emitLocation* pEmitLoc = new (emitComp, CMK_Unknown) emitLocation(igLastCandidate);
callbackFunc(context, pEmitLoc);
igLastReported = igLastCandidate;
igLastCandidate = NULL;
curSize -= candidateSize;
}
}
// Update the current candidate to be this block, if it isn't in the middle of a
// prolog or epilog, which we can't split. All we know is that certain
// IGs are marked as prolog or epilog. We don't actually know if two adjacent
// IGs are part of the *same* prolog or epilog, so we have to assume they are.
if (igPrev && (((igPrev->igFlags & IGF_FUNCLET_PROLOG) && (ig->igFlags & IGF_FUNCLET_PROLOG)) ||
((igPrev->igFlags & IGF_EPILOG) && (ig->igFlags & IGF_EPILOG))))
{
// We can't update the candidate
}
else
{
igLastCandidate = ig;
candidateSize = curSize;
}
curSize += ig->igSize;
} // end for loop
}
/*****************************************************************************
*
* Given an instruction group, find the array of instructions (instrDesc) and
* number of instructions in the array. If the IG is the current IG, we assume
* that igData does NOT hold the instructions; they are unsaved and pointed
* to by emitCurIGfreeBase.
*
* This function can't be called for placeholder groups, which have no instrDescs.
*/
void emitter::emitGetInstrDescs(insGroup* ig, instrDesc** id, int* insCnt)
{
assert(!(ig->igFlags & IGF_PLACEHOLDER));
if (ig == emitCurIG)
{
*id = (instrDesc*)emitCurIGfreeBase;
*insCnt = emitCurIGinsCnt;
}
else
{
*id = (instrDesc*)ig->igData;
*insCnt = ig->igInsCnt;
}
assert(*id);
}
/*****************************************************************************
*
* Given a location (an 'emitLocation'), find the instruction group (IG) and
* instruction descriptor (instrDesc) corresponding to that location. Returns
* 'true' if there is an instruction, 'false' if there is no instruction
* (i.e., we're at the end of the instruction list). Also, optionally return
* the number of instructions that follow that instruction in the IG (in *pinsRemaining,
* if pinsRemaining is non-NULL), which can be used for iterating over the
* remaining instrDescs in the IG.
*
* We assume that emitCurIG points to the end of the instructions we care about.
* For the prologs or epilogs, it points to the last IG of the prolog or epilog
* that is being generated. For body code gen, it points to the place we are currently
* adding code, namely, the end of currently generated code.
*/
bool emitter::emitGetLocationInfo(emitLocation* emitLoc,
insGroup** pig,
instrDesc** pid,
int* pinsRemaining /* = NULL */)
{
assert(emitLoc != nullptr);
assert(emitLoc->Valid());
assert(emitLoc->GetIG() != nullptr);
assert(pig != nullptr);
assert(pid != nullptr);
insGroup* ig = emitLoc->GetIG();
instrDesc* id;
int insNum = emitLoc->GetInsNum();
int insCnt;
emitGetInstrDescs(ig, &id, &insCnt);
assert(insNum <= insCnt);
// There is a special-case: if the insNum points to the end, then we "wrap" and
// consider that the instruction it is pointing at is actually the first instruction
// of the next non-empty IG (which has its own valid emitLocation). This handles the
// case where you capture a location, then the next instruction creates a new IG.
if (insNum == insCnt)
{
if (ig == emitCurIG)
{
// No instructions beyond the current location.
return false;
}
for (ig = ig->igNext; ig; ig = ig->igNext)
{
emitGetInstrDescs(ig, &id, &insCnt);
if (insCnt > 0)
{
insNum = 0; // Pretend the index is 0 -- the first instruction
break;
}
if (ig == emitCurIG)
{
// There aren't any instructions in the current IG, and this is
// the current location, so we're at the end.
return false;
}
}
if (ig == NULL)
{
// 'ig' can't be NULL, or we went past the current IG represented by 'emitCurIG'.
// Perhaps 'loc' was corrupt coming in?
noway_assert(!"corrupt emitter location");
return false;
}
}
// Now find the instrDesc within this group that corresponds to the location
assert(insNum < insCnt);
int i;
for (i = 0; i != insNum; ++i)
{
castto(id, BYTE*) += emitSizeOfInsDsc(id);
}
// Return the info we found
*pig = ig;
*pid = id;
if (pinsRemaining)
{
*pinsRemaining = insCnt - insNum - 1;
}
return true;
}
/*****************************************************************************
*
* Compute the next instrDesc, either in this IG, or in a subsequent IG. 'id'
* will point to this instrDesc. 'ig' and 'insRemaining' will also be updated.
* Returns true if there is an instruction, or false if we've iterated over all
* the instructions up to the current instruction (based on 'emitCurIG').
*/
bool emitter::emitNextID(insGroup*& ig, instrDesc*& id, int& insRemaining)
{
if (insRemaining > 0)
{
castto(id, BYTE*) += emitSizeOfInsDsc(id);
--insRemaining;
return true;
}
// We're out of instrDesc in 'ig'. Is this the current IG? If so, we're done.
if (ig == emitCurIG)
{
return false;
}
for (ig = ig->igNext; ig; ig = ig->igNext)
{
int insCnt;
emitGetInstrDescs(ig, &id, &insCnt);
if (insCnt > 0)
{
insRemaining = insCnt - 1;
return true;
}
if (ig == emitCurIG)
{
return false;
}
}
return false;
}
/*****************************************************************************
*
* Walk instrDesc's from the location given by 'locFrom', up to the current location.
* For each instruction, call the callback function 'processFunc'. 'context' is simply
* passed through to the callback function.
*/
void emitter::emitWalkIDs(emitLocation* locFrom, emitProcessInstrFunc_t processFunc, void* context)
{
insGroup* ig;
instrDesc* id;
int insRemaining;
if (!emitGetLocationInfo(locFrom, &ig, &id, &insRemaining))
return; // no instructions at the 'from' location
do
{
// process <<id>>
(*processFunc)(id, context);
} while (emitNextID(ig, id, insRemaining));
}
/*****************************************************************************
*
* A callback function for emitWalkIDs() that calls Compiler::unwindNop().
*/
void emitter::emitGenerateUnwindNop(instrDesc* id, void* context)
{
Compiler* comp = (Compiler*)context;
#if defined(TARGET_ARM)
comp->unwindNop(id->idCodeSize());
#elif defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64)
comp->unwindNop();
#endif // defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64)
}
/*****************************************************************************
*
* emitUnwindNopPadding: call unwindNop() for every instruction from a given
* location 'emitLoc' up to the current location.
*/
void emitter::emitUnwindNopPadding(emitLocation* locFrom, Compiler* comp)
{
emitWalkIDs(locFrom, emitGenerateUnwindNop, comp);
}
#endif // TARGET_ARMARCH || TARGET_LOONGARCH64
#if defined(TARGET_ARM)
/*****************************************************************************
*
* Return the instruction size in bytes for the instruction at the specified location.
* This is used to assert that the unwind code being generated on ARM has the
* same size as the instruction for which it is being generated (since on ARM
* the unwind codes have a one-to-one relationship with instructions, and the
* unwind codes have an implicit instruction size that must match the instruction size.)
* An instruction must exist at the specified location.
*/
unsigned emitter::emitGetInstructionSize(emitLocation* emitLoc)
{
insGroup* ig;
instrDesc* id;
bool anyInstrs = emitGetLocationInfo(emitLoc, &ig, &id);
assert(anyInstrs); // There better be an instruction at this location (otherwise, we're at the end of the
// instruction list)
return id->idCodeSize();
}
#endif // defined(TARGET_ARM)
/*****************************************************************************/
#ifdef DEBUG
/*****************************************************************************
*
* Returns the name for the register to use to access frame based variables
*/
const char* emitter::emitGetFrameReg()
{
if (emitHasFramePtr)
{
return STR_FPBASE;
}
else
{
return STR_SPBASE;
}
}
/*****************************************************************************
*
* Display a register set in a readable form.
*/
void emitter::emitDispRegSet(regMaskTP regs)
{
regNumber reg;
bool sp = false;
printf(" {");
for (reg = REG_FIRST; reg < ACTUAL_REG_COUNT; reg = REG_NEXT(reg))
{
if ((regs & genRegMask(reg)) == 0)
{
continue;
}
if (sp)
{
printf(" ");
}
else
{
sp = true;
}
printf("%s", emitRegName(reg));
}
printf("}");
}
/*****************************************************************************
*
* Display the current GC ref variable set in a readable form.
*/
void emitter::emitDispVarSet()
{
unsigned vn;
int of;
bool sp = false;
for (vn = 0, of = emitGCrFrameOffsMin; vn < emitGCrFrameOffsCnt; vn += 1, of += TARGET_POINTER_SIZE)
{
if (emitGCrFrameLiveTab[vn])
{
if (sp)
{
printf(" ");
}
else
{
sp = true;
}
printf("[%s", emitGetFrameReg());
if (of < 0)
{
printf("-%02XH", -of);
}
else if (of > 0)
{
printf("+%02XH", +of);
}
printf("]");
}
}
if (!sp)
{
printf("none");
}
}
/*****************************************************************************/
#endif // DEBUG
#if MULTIREG_HAS_SECOND_GC_RET
//------------------------------------------------------------------------
// emitSetSecondRetRegGCType: Sets the GC type of the second return register for instrDescCGCA struct.
//
// Arguments:
// id - The large call instr descriptor to set the second GC return register type on.
// secondRetSize - The EA_SIZE for second return register type.
//
// Return Value:
// None
//
void emitter::emitSetSecondRetRegGCType(instrDescCGCA* id, emitAttr secondRetSize)
{
if (EA_IS_GCREF(secondRetSize))
{
id->idSecondGCref(GCT_GCREF);
}
else if (EA_IS_BYREF(secondRetSize))
{
id->idSecondGCref(GCT_BYREF);
}
else
{
id->idSecondGCref(GCT_NONE);
}
}
#endif // MULTIREG_HAS_SECOND_GC_RET
/*****************************************************************************
*
* Allocate an instruction descriptor for an indirect call.
*
* We use two different descriptors to save space - the common case records
* no GC variables and has both a very small argument count and an address
* mode displacement; the other case records the current GC var set,
* the call scope, and an arbitrarily large argument count and the
* address mode displacement.
*/
emitter::instrDesc* emitter::emitNewInstrCallInd(int argCnt,
ssize_t disp,
VARSET_VALARG_TP GCvars,
regMaskTP gcrefRegs,
regMaskTP byrefRegs,
emitAttr retSizeIn
MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(emitAttr secondRetSize))
{
emitAttr retSize = (retSizeIn != EA_UNKNOWN) ? retSizeIn : EA_PTRSIZE;
bool gcRefRegsInScratch = ((gcrefRegs & RBM_CALLEE_TRASH) != 0);
// Allocate a larger descriptor if any GC values need to be saved
// or if we have an absurd number of arguments or a large address
// mode displacement, or we have some byref registers
//
// On Amd64 System V OSs a larger descriptor is also needed if the
// call returns a two-register-returned struct and the second
// register (RDX) is a GCRef or ByRef pointer.
if (!VarSetOps::IsEmpty(emitComp, GCvars) || // any frame GCvars live
(gcRefRegsInScratch) || // any register gc refs live in scratch regs
(byrefRegs != 0) || // any register byrefs live
#ifdef TARGET_XARCH
(disp < AM_DISP_MIN) || // displacement too negative
(disp > AM_DISP_MAX) || // displacement too positive
#endif // TARGET_XARCH
(argCnt > ID_MAX_SMALL_CNS) || // too many args
(argCnt < 0) // caller pops arguments
// There is a second ref/byref return register.
MULTIREG_HAS_SECOND_GC_RET_ONLY(|| EA_IS_GCREF_OR_BYREF(secondRetSize)))
{
instrDescCGCA* id;
id = emitAllocInstrCGCA(retSize);
id->idSetIsLargeCall();
VarSetOps::Assign(emitComp, id->idcGCvars, GCvars);
id->idcGcrefRegs = gcrefRegs;
id->idcByrefRegs = byrefRegs;
id->idcArgCnt = argCnt;
id->idcDisp = disp;
#if MULTIREG_HAS_SECOND_GC_RET
emitSetSecondRetRegGCType(id, secondRetSize);
#endif // MULTIREG_HAS_SECOND_GC_RET
return id;
}
else
{
instrDesc* id;
id = emitNewInstrCns(retSize, argCnt);
/* Make sure we didn't waste space unexpectedly */
assert(!id->idIsLargeCns());
#ifdef TARGET_XARCH
/* Store the displacement and make sure the value fit */
id->idAddr()->iiaAddrMode.amDisp = disp;
assert(id->idAddr()->iiaAddrMode.amDisp == disp);
#endif // TARGET_XARCH
/* Save the the live GC registers in the unused register fields */
emitEncodeCallGCregs(gcrefRegs, id);
return id;
}
}
/*****************************************************************************
*
* Allocate an instruction descriptor for a direct call.
*
* We use two different descriptors to save space - the common case records
* with no GC variables or byrefs and has a very small argument count, and no
* explicit scope;
* the other case records the current GC var set, the call scope,
* and an arbitrarily large argument count.
*/
emitter::instrDesc* emitter::emitNewInstrCallDir(int argCnt,
VARSET_VALARG_TP GCvars,
regMaskTP gcrefRegs,
regMaskTP byrefRegs,
emitAttr retSizeIn
MULTIREG_HAS_SECOND_GC_RET_ONLY_ARG(emitAttr secondRetSize))
{
emitAttr retSize = (retSizeIn != EA_UNKNOWN) ? retSizeIn : EA_PTRSIZE;
// Allocate a larger descriptor if new GC values need to be saved
// or if we have an absurd number of arguments or if we need to
// save the scope.
//
// On Amd64 System V OSs a larger descriptor is also needed if the
// call returns a two-register-returned struct and the second
// register (RDX) is a GCRef or ByRef pointer.
bool gcRefRegsInScratch = ((gcrefRegs & RBM_CALLEE_TRASH) != 0);
if (!VarSetOps::IsEmpty(emitComp, GCvars) || // any frame GCvars live
gcRefRegsInScratch || // any register gc refs live in scratch regs
(byrefRegs != 0) || // any register byrefs live
(argCnt > ID_MAX_SMALL_CNS) || // too many args
(argCnt < 0) // caller pops arguments
// There is a second ref/byref return register.
MULTIREG_HAS_SECOND_GC_RET_ONLY(|| EA_IS_GCREF_OR_BYREF(secondRetSize)))
{
instrDescCGCA* id = emitAllocInstrCGCA(retSize);
// printf("Direct call with GC vars / big arg cnt / explicit scope\n");
id->idSetIsLargeCall();
VarSetOps::Assign(emitComp, id->idcGCvars, GCvars);
id->idcGcrefRegs = gcrefRegs;
id->idcByrefRegs = byrefRegs;
id->idcDisp = 0;
id->idcArgCnt = argCnt;
#if MULTIREG_HAS_SECOND_GC_RET
emitSetSecondRetRegGCType(id, secondRetSize);
#endif // MULTIREG_HAS_SECOND_GC_RET
return id;
}
else
{
instrDesc* id = emitNewInstrCns(retSize, argCnt);
// printf("Direct call w/o GC vars / big arg cnt / explicit scope\n");
/* Make sure we didn't waste space unexpectedly */
assert(!id->idIsLargeCns());
/* Save the the live GC registers in the unused register fields */
emitEncodeCallGCregs(gcrefRegs, id);
return id;
}
}
/*****************************************************************************/
#ifdef DEBUG
/*****************************************************************************
*
* Return a string with the name of the given class field (blank string (not
* NULL) is returned when the name isn't available).
*/
const char* emitter::emitFldName(CORINFO_FIELD_HANDLE fieldVal)
{
if (emitComp->opts.varNames)
{
const char* memberName;
const char* className;
const int TEMP_BUFFER_LEN = 1024;
static char buff[TEMP_BUFFER_LEN];
memberName = emitComp->eeGetFieldName(fieldVal, &className);
sprintf_s(buff, TEMP_BUFFER_LEN, "'<%s>.%s'", className, memberName);
return buff;
}
else
{
return "";
}
}
/*****************************************************************************
*
* Return a string with the name of the given function (blank string (not
* NULL) is returned when the name isn't available).
*/
const char* emitter::emitFncName(CORINFO_METHOD_HANDLE methHnd)
{
return emitComp->eeGetMethodFullName(methHnd);
}
#endif // DEBUG
/*****************************************************************************
*
* Be very careful, some instruction descriptors are allocated as "tiny" and
* don't have some of the tail fields of instrDesc (in particular, "idInfo").
*/
const BYTE emitter::emitFmtToOps[] = {
#define IF_DEF(en, op1, op2) ID_OP_##op2,
#include "emitfmts.h"
};
#ifdef DEBUG
const unsigned emitter::emitFmtCount = ArrLen(emitFmtToOps);
#endif
//------------------------------------------------------------------------
// Interleaved GC info dumping.
// We'll attempt to line this up with the opcode, which indented differently for
// diffable and non-diffable dumps.
// This is approximate, and is better tuned for disassembly than for jitdumps.
// See emitDispInsHex().
#ifdef TARGET_AMD64
const size_t basicIndent = 7;
const size_t hexEncodingSize = 21;
#elif defined(TARGET_X86)
const size_t basicIndent = 7;
const size_t hexEncodingSize = 13;
#elif defined(TARGET_ARM64)
const size_t basicIndent = 12;
const size_t hexEncodingSize = 19;
#elif defined(TARGET_ARM)
const size_t basicIndent = 12;
const size_t hexEncodingSize = 11;
#elif defined(TARGET_LOONGARCH64)
const size_t basicIndent = 12;
const size_t hexEncodingSize = 19;
#endif
#ifdef DEBUG
//------------------------------------------------------------------------
// emitDispInsIndent: Print indentation corresponding to an instruction's
// indentation.
//
void emitter::emitDispInsIndent()
{
size_t indent = emitComp->opts.disDiffable ? basicIndent : basicIndent + hexEncodingSize;
printf("%.*s", indent, " ");
}
//------------------------------------------------------------------------
// emitDispGCDeltaTitle: Print an appropriately indented title for a GC info delta
//
// Arguments:
// title - The type of GC info delta we're printing
//
void emitter::emitDispGCDeltaTitle(const char* title)
{
emitDispInsIndent();
printf("; %s", title);
}
//------------------------------------------------------------------------
// emitDispGCRegDelta: Print a delta for GC registers
//
// Arguments:
// title - The type of GC info delta we're printing
// prevRegs - The live GC registers before the recent instruction.
// curRegs - The live GC registers after the recent instruction.
//
void emitter::emitDispGCRegDelta(const char* title, regMaskTP prevRegs, regMaskTP curRegs)
{
if (prevRegs != curRegs)
{
emitDispGCDeltaTitle(title);
regMaskTP sameRegs = prevRegs & curRegs;
regMaskTP removedRegs = prevRegs - sameRegs;
regMaskTP addedRegs = curRegs - sameRegs;
if (removedRegs != RBM_NONE)
{
printf(" -");
dspRegMask(removedRegs);
}
if (addedRegs != RBM_NONE)
{
printf(" +");
dspRegMask(addedRegs);
}
printf("\n");
}
}
//------------------------------------------------------------------------
// emitDispGCVarDelta: Print a delta for GC variables
//
// Notes:
// Uses the debug-only variables 'debugThisGCrefVars' and 'debugPrevGCrefVars'.
// to print deltas from the last time this was called.
//
void emitter::emitDispGCVarDelta()
{
if (!VarSetOps::Equal(emitComp, debugPrevGCrefVars, debugThisGCrefVars))
{
emitDispGCDeltaTitle("GC ptr vars");
VARSET_TP sameGCrefVars(VarSetOps::Intersection(emitComp, debugPrevGCrefVars, debugThisGCrefVars));
VARSET_TP GCrefVarsRemoved(VarSetOps::Diff(emitComp, debugPrevGCrefVars, debugThisGCrefVars));
VARSET_TP GCrefVarsAdded(VarSetOps::Diff(emitComp, debugThisGCrefVars, debugPrevGCrefVars));
if (!VarSetOps::IsEmpty(emitComp, GCrefVarsRemoved))
{
printf(" -");
dumpConvertedVarSet(emitComp, GCrefVarsRemoved);
}
if (!VarSetOps::IsEmpty(emitComp, GCrefVarsAdded))
{
printf(" +");
dumpConvertedVarSet(emitComp, GCrefVarsAdded);
}
VarSetOps::Assign(emitComp, debugPrevGCrefVars, debugThisGCrefVars);
printf("\n");
}
}
//------------------------------------------------------------------------
// emitDispRegPtrListDelta: Print a delta for regPtrDsc GC transitions
//
// Notes:
// Uses the debug-only variable 'debugPrevRegPtrDsc' to print deltas from the last time this was
// called.
//
void emitter::emitDispRegPtrListDelta()
{
// Dump any deltas in regPtrDsc's for outgoing args; these aren't captured in the other sets.
if (debugPrevRegPtrDsc != codeGen->gcInfo.gcRegPtrLast)
{
for (regPtrDsc* dsc = (debugPrevRegPtrDsc == nullptr) ? codeGen->gcInfo.gcRegPtrList
: debugPrevRegPtrDsc->rpdNext;
dsc != nullptr; dsc = dsc->rpdNext)
{
// The non-arg regPtrDscs are reflected in the register sets debugPrevGCrefRegs/emitThisGCrefRegs
// and debugPrevByrefRegs/emitThisByrefRegs, and dumped using those sets.
if (!dsc->rpdArg)
{
continue;
}
emitDispGCDeltaTitle(GCtypeStr((GCtype)dsc->rpdGCtype));
switch (dsc->rpdArgType)
{
case GCInfo::rpdARG_PUSH:
#if FEATURE_FIXED_OUT_ARGS
// For FEATURE_FIXED_OUT_ARGS, we report a write to the outgoing arg area
// as a 'rpdARG_PUSH' even though it doesn't actually push. Note that
// we also have 'rpdARG_POP's even though we don't actually pop, and
// we can have those even if there's no stack arg.
printf(" arg write");
break;
#else
printf(" arg push %u", dsc->rpdPtrArg);
break;
#endif
case GCInfo::rpdARG_POP:
printf(" arg pop %u", dsc->rpdPtrArg);
break;
case GCInfo::rpdARG_KILL:
printf(" arg kill %u", dsc->rpdPtrArg);
break;
default:
printf(" arg ??? %u", dsc->rpdPtrArg);
break;
}
printf("\n");
}
debugPrevRegPtrDsc = codeGen->gcInfo.gcRegPtrLast;
}
}
//------------------------------------------------------------------------
// emitDispGCInfoDelta: Print a delta for GC info
//
void emitter::emitDispGCInfoDelta()
{
emitDispGCRegDelta("gcrRegs", debugPrevGCrefRegs, emitThisGCrefRegs);
emitDispGCRegDelta("byrRegs", debugPrevByrefRegs, emitThisByrefRegs);
debugPrevGCrefRegs = emitThisGCrefRegs;
debugPrevByrefRegs = emitThisByrefRegs;
emitDispGCVarDelta();
emitDispRegPtrListDelta();
}
/*****************************************************************************
*
* Display the current instruction group list.
*/
void emitter::emitDispIGflags(unsigned flags)
{
if (flags & IGF_GC_VARS)
{
printf(", gcvars");
}
if (flags & IGF_BYREF_REGS)
{
printf(", byref");
}
#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
if (flags & IGF_FINALLY_TARGET)
{
printf(", ftarget");
}
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
if (flags & IGF_FUNCLET_PROLOG)
{
printf(", funclet prolog");
}
if (flags & IGF_FUNCLET_EPILOG)
{
printf(", funclet epilog");
}
if (flags & IGF_EPILOG)
{
printf(", epilog");
}
if (flags & IGF_NOGCINTERRUPT)
{
printf(", nogc");
}
if (flags & IGF_UPD_ISZ)
{
printf(", isz");
}
if (flags & IGF_EXTEND)
{
printf(", extend");
}
if (flags & IGF_HAS_ALIGN)
{
printf(", align");
}
}
void emitter::emitDispIG(insGroup* ig, insGroup* igPrev, bool verbose)
{
const int TEMP_BUFFER_LEN = 40;
char buff[TEMP_BUFFER_LEN];
sprintf_s(buff, TEMP_BUFFER_LEN, "%s: ", emitLabelString(ig));
printf("%s; ", buff);
// We dump less information when we're only interleaving GC info with a disassembly listing,
// than we do in the jitdump case. (Note that the verbose argument to this method is
// distinct from the verbose on Compiler.)
bool jitdump = emitComp->verbose;
if (jitdump && ((igPrev == nullptr) || (igPrev->igFuncIdx != ig->igFuncIdx)))
{
printf("func=%02u, ", ig->igFuncIdx);
}
if (ig->igFlags & IGF_PLACEHOLDER)
{
insGroup* igPh = ig;
const char* pszType;
switch (igPh->igPhData->igPhType)
{
case IGPT_PROLOG:
pszType = "prolog";
break;
case IGPT_EPILOG:
pszType = "epilog";
break;
#if defined(FEATURE_EH_FUNCLETS)
case IGPT_FUNCLET_PROLOG:
pszType = "funclet prolog";
break;
case IGPT_FUNCLET_EPILOG:
pszType = "funclet epilog";
break;
#endif // FEATURE_EH_FUNCLETS
default:
pszType = "UNKNOWN";
break;
}
printf("%s placeholder, next placeholder=", pszType);
if (igPh->igPhData->igPhNext)
{
printf("IG%02u ", igPh->igPhData->igPhNext->igNum);
}
else
{
printf("<END>");
}
if (igPh->igPhData->igPhBB != nullptr)
{
printf(", %s", igPh->igPhData->igPhBB->dspToString());
}
emitDispIGflags(igPh->igFlags);
if (ig == emitCurIG)
{
printf(" <-- Current IG");
}
if (igPh == emitPlaceholderList)
{
printf(" <-- First placeholder");
}
if (igPh == emitPlaceholderLast)
{
printf(" <-- Last placeholder");
}
printf("\n");
printf("%*s; PrevGCVars=%s ", strlen(buff), "",
VarSetOps::ToString(emitComp, igPh->igPhData->igPhPrevGCrefVars));
dumpConvertedVarSet(emitComp, igPh->igPhData->igPhPrevGCrefVars);
printf(", PrevGCrefRegs=");
printRegMaskInt(igPh->igPhData->igPhPrevGCrefRegs);
emitDispRegSet(igPh->igPhData->igPhPrevGCrefRegs);
printf(", PrevByrefRegs=");
printRegMaskInt(igPh->igPhData->igPhPrevByrefRegs);
emitDispRegSet(igPh->igPhData->igPhPrevByrefRegs);
printf("\n");
printf("%*s; InitGCVars=%s ", strlen(buff), "",
VarSetOps::ToString(emitComp, igPh->igPhData->igPhInitGCrefVars));
dumpConvertedVarSet(emitComp, igPh->igPhData->igPhInitGCrefVars);
printf(", InitGCrefRegs=");
printRegMaskInt(igPh->igPhData->igPhInitGCrefRegs);
emitDispRegSet(igPh->igPhData->igPhInitGCrefRegs);
printf(", InitByrefRegs=");
printRegMaskInt(igPh->igPhData->igPhInitByrefRegs);
emitDispRegSet(igPh->igPhData->igPhInitByrefRegs);
printf("\n");
assert(!(ig->igFlags & IGF_GC_VARS));
assert(!(ig->igFlags & IGF_BYREF_REGS));
}
else
{
const char* separator = "";
if (jitdump)
{
printf("%soffs=%06XH, size=%04XH", separator, ig->igOffs, ig->igSize);
separator = ", ";
}
if (emitComp->compCodeGenDone)
{
printf("%sbbWeight=%s PerfScore %.2f", separator, refCntWtd2str(ig->igWeight), ig->igPerfScore);
separator = ", ";
}
if (ig->igFlags & IGF_GC_VARS)
{
printf("%sgcVars=%s ", separator, VarSetOps::ToString(emitComp, ig->igGCvars()));
dumpConvertedVarSet(emitComp, ig->igGCvars());
separator = ", ";
}
if (!(ig->igFlags & IGF_EXTEND))
{
printf("%sgcrefRegs=", separator);
printRegMaskInt(ig->igGCregs);
emitDispRegSet(ig->igGCregs);
separator = ", ";
}
if (ig->igFlags & IGF_BYREF_REGS)
{
printf("%sbyrefRegs=", separator);
printRegMaskInt(ig->igByrefRegs());
emitDispRegSet(ig->igByrefRegs());
separator = ", ";
}
#if FEATURE_LOOP_ALIGN
if (ig->igLoopBackEdge != nullptr)
{
printf("%sloop=IG%02u", separator, ig->igLoopBackEdge->igNum);
separator = ", ";
}
#endif // FEATURE_LOOP_ALIGN
if (jitdump && !ig->igBlocks.empty())
{
for (auto block : ig->igBlocks)
{
printf("%s%s", separator, block->dspToString());
separator = ", ";
}
}
emitDispIGflags(ig->igFlags);
if (ig == emitCurIG)
{
printf(" <-- Current IG");
}
if (ig == emitPrologIG)
{
printf(" <-- Prolog IG");
}
printf("\n");
if (verbose)
{
BYTE* ins = ig->igData;
UNATIVE_OFFSET ofs = ig->igOffs;
unsigned cnt = ig->igInsCnt;
if (cnt)
{
printf("\n");
do
{
instrDesc* id = (instrDesc*)ins;
emitDispIns(id, false, true, false, ofs, nullptr, 0, ig);
ins += emitSizeOfInsDsc(id);
ofs += id->idCodeSize();
} while (--cnt);
printf("\n");
}
}
}
}
void emitter::emitDispIGlist(bool verbose)
{
insGroup* ig;
insGroup* igPrev;
for (igPrev = nullptr, ig = emitIGlist; ig; igPrev = ig, ig = ig->igNext)
{
emitDispIG(ig, igPrev, verbose);
}
}
void emitter::emitDispGCinfo()
{
printf("Emitter GC tracking info:");
printf("\n emitPrevGCrefVars ");
dumpConvertedVarSet(emitComp, emitPrevGCrefVars);
printf("\n emitPrevGCrefRegs(0x%p)=", dspPtr(&emitPrevGCrefRegs));
printRegMaskInt(emitPrevGCrefRegs);
emitDispRegSet(emitPrevGCrefRegs);
printf("\n emitPrevByrefRegs(0x%p)=", dspPtr(&emitPrevByrefRegs));
printRegMaskInt(emitPrevByrefRegs);
emitDispRegSet(emitPrevByrefRegs);
printf("\n emitInitGCrefVars ");
dumpConvertedVarSet(emitComp, emitInitGCrefVars);
printf("\n emitInitGCrefRegs(0x%p)=", dspPtr(&emitInitGCrefRegs));
printRegMaskInt(emitInitGCrefRegs);
emitDispRegSet(emitInitGCrefRegs);
printf("\n emitInitByrefRegs(0x%p)=", dspPtr(&emitInitByrefRegs));
printRegMaskInt(emitInitByrefRegs);
emitDispRegSet(emitInitByrefRegs);
printf("\n emitThisGCrefVars ");
dumpConvertedVarSet(emitComp, emitThisGCrefVars);
printf("\n emitThisGCrefRegs(0x%p)=", dspPtr(&emitThisGCrefRegs));
printRegMaskInt(emitThisGCrefRegs);
emitDispRegSet(emitThisGCrefRegs);
printf("\n emitThisByrefRegs(0x%p)=", dspPtr(&emitThisByrefRegs));
printRegMaskInt(emitThisByrefRegs);
emitDispRegSet(emitThisByrefRegs);
printf("\n\n");
}
#endif // DEBUG
/*****************************************************************************
*
* Issue the given instruction. Basically, this is just a thin wrapper around
* emitOutputInstr() that does a few debug checks.
*/
size_t emitter::emitIssue1Instr(insGroup* ig, instrDesc* id, BYTE** dp)
{
size_t is;
/* Record the beginning offset of the instruction */
BYTE* curInsAdr = *dp;
/* Issue the next instruction */
// printf("[S=%02u] " , emitCurStackLvl);
is = emitOutputInstr(ig, id, dp);
#if defined(DEBUG) || defined(LATE_DISASM)
float insExeCost = insEvaluateExecutionCost(id);
// All compPerfScore calculations must be performed using doubles
double insPerfScore = (double)(ig->igWeight / (double)BB_UNITY_WEIGHT) * insExeCost;
emitComp->info.compPerfScore += insPerfScore;
ig->igPerfScore += insPerfScore;
#endif // defined(DEBUG) || defined(LATE_DISASM)
// printf("[S=%02u]\n", emitCurStackLvl);
#if EMIT_TRACK_STACK_DEPTH
/*
If we're generating a full pointer map and the stack
is empty, there better not be any "pending" argument
push entries.
*/
assert(emitFullGCinfo == false || emitCurStackLvl != 0 || u2.emitGcArgTrackCnt == 0);
#endif
/* Did the size of the instruction match our expectations? */
UNATIVE_OFFSET actualSize = (UNATIVE_OFFSET)(*dp - curInsAdr);
unsigned estimatedSize = id->idCodeSize();
if (actualSize != estimatedSize)
{
// It is fatal to under-estimate the instruction size, except for alignment instructions
noway_assert(estimatedSize >= actualSize);
#if FEATURE_LOOP_ALIGN
// Should never over-estimate align instruction or any instruction before the last align instruction of a method
assert(id->idIns() != INS_align && emitCurIG->igNum > emitLastAlignedIgNum);
#endif
#if DEBUG_EMIT
if (EMITVERBOSE)
{
printf("Instruction predicted size = %u, actual = %u\n", estimatedSize, actualSize);
}
#endif // DEBUG_EMIT
// Add the shrinkage to the ongoing offset adjustment. This needs to happen during the
// processing of an instruction group, and not only at the beginning of an instruction
// group, or else the difference of IG sizes between debug and release builds can cause
// debug/non-debug asm diffs.
int offsShrinkage = estimatedSize - actualSize;
JITDUMP("Increasing size adj %d by %d => %d\n", emitOffsAdj, offsShrinkage, emitOffsAdj + offsShrinkage);
emitOffsAdj += offsShrinkage;
/* The instruction size estimate wasn't accurate; remember this */
ig->igFlags |= IGF_UPD_ISZ;
#if defined(TARGET_XARCH)
id->idCodeSize(actualSize);
#elif defined(TARGET_ARM)
// This is done as part of emitSetShortJump();
// insSize isz = emitInsSize(id->idInsFmt());
// id->idInsSize(isz);
#else
/* It is fatal to over-estimate the instruction size */
IMPL_LIMITATION("Over-estimated instruction size");
#endif
}
#ifdef DEBUG
/* Make sure the instruction descriptor size also matches our expectations */
if (is != emitSizeOfInsDsc(id))
{
printf("%s at %u: Expected size = %u , actual size = %u\n", emitIfName(id->idInsFmt()),
id->idDebugOnlyInfo()->idNum, is, emitSizeOfInsDsc(id));
assert(is == emitSizeOfInsDsc(id));
}
#endif // DEBUG
return is;
}
/*****************************************************************************
*
* Update the offsets of all the instruction groups (note: please don't be
* lazy and call this routine frequently, it walks the list of instruction
* groups and thus it isn't cheap).
*/
void emitter::emitRecomputeIGoffsets()
{
UNATIVE_OFFSET offs;
insGroup* ig;
for (ig = emitIGlist, offs = 0; ig; ig = ig->igNext)
{
ig->igOffs = offs;
assert(IsCodeAligned(ig->igOffs));
offs += ig->igSize;
}
/* Set the total code size */
emitTotalCodeSize = offs;
#ifdef DEBUG
emitCheckIGoffsets();
#endif
}
//----------------------------------------------------------------------------------------
// emitDispCommentForHandle:
// Displays a comment for a handle, e.g. displays a raw string for GTF_ICON_STR_HDL
// or a class name for GTF_ICON_CLASS_HDL
//
// Arguments:
// handle - a constant value to display a comment for
// flags - a flag that the describes the handle
//
void emitter::emitDispCommentForHandle(size_t handle, GenTreeFlags flag)
{
#ifdef DEBUG
if (handle == 0)
{
return;
}
#ifdef TARGET_XARCH
const char* commentPrefix = " ;";
#else
const char* commentPrefix = " //";
#endif
flag &= GTF_ICON_HDL_MASK;
const char* str = nullptr;
if (flag == GTF_ICON_STR_HDL)
{
const WCHAR* wstr = emitComp->eeGetCPString(handle);
// NOTE: eGetCPString always returns nullptr on Linux/ARM
if (wstr == nullptr)
{
str = "string handle";
}
else
{
const size_t actualLen = wcslen(wstr);
const size_t maxLength = 63;
const size_t newLen = min(maxLength, actualLen);
// +1 for null terminator
WCHAR buf[maxLength + 1] = {0};
wcsncpy(buf, wstr, newLen);
for (size_t i = 0; i < newLen; i++)
{
// Escape \n and \r symbols
if (buf[i] == L'\n' || buf[i] == L'\r')
{
buf[i] = L' ';
}
}
if (actualLen > maxLength)
{
// Append "..." for long strings
buf[maxLength - 3] = L'.';
buf[maxLength - 2] = L'.';
buf[maxLength - 1] = L'.';
}
printf("%s \"%S\"", commentPrefix, buf);
}
}
else if (flag == GTF_ICON_CLASS_HDL)
{
str = emitComp->eeGetClassName(reinterpret_cast<CORINFO_CLASS_HANDLE>(handle));
}
#ifndef TARGET_XARCH
// These are less useful for xarch:
else if (flag == GTF_ICON_CONST_PTR)
{
str = "const ptr";
}
else if (flag == GTF_ICON_GLOBAL_PTR)
{
str = "global ptr";
}
else if (flag == GTF_ICON_FIELD_HDL)
{
str = emitComp->eeGetFieldName(reinterpret_cast<CORINFO_FIELD_HANDLE>(handle));
}
else if (flag == GTF_ICON_STATIC_HDL)
{
str = "static handle";
}
else if (flag == GTF_ICON_METHOD_HDL)
{
str = emitComp->eeGetMethodFullName(reinterpret_cast<CORINFO_METHOD_HANDLE>(handle));
}
else if (flag == GTF_ICON_FTN_ADDR)
{
str = "function address";
}
else if (flag == GTF_ICON_TOKEN_HDL)
{
str = "token handle";
}
else
{
str = "unknown";
}
#endif // TARGET_XARCH
if (str != nullptr)
{
printf("%s %s", commentPrefix, str);
}
#endif // DEBUG
}
/*****************************************************************************
* Bind targets of relative jumps to choose the smallest possible encoding.
* X86 and AMD64 have a small and large encoding.
* ARM has a small, medium, and large encoding. The large encoding is a pseudo-op
* to handle greater range than the conditional branch instructions can handle.
* ARM64 has a small and large encoding for both conditional branch and loading label addresses.
* The large encodings are pseudo-ops that represent a multiple instruction sequence, similar to ARM. (Currently
* NYI).
* LoongArch64 has an individual implementation for emitJumpDistBind().
*/
#ifndef TARGET_LOONGARCH64
void emitter::emitJumpDistBind()
{
#ifdef DEBUG
if (emitComp->verbose)
{
printf("*************** In emitJumpDistBind()\n");
}
if (EMIT_INSTLIST_VERBOSE)
{
printf("\nInstruction list before jump distance binding:\n\n");
emitDispIGlist(true);
}
#endif
instrDescJmp* jmp;
UNATIVE_OFFSET minShortExtra; // The smallest offset greater than that required for a jump to be converted
// to a small jump. If it is small enough, we will iterate in hopes of
// converting those jumps we missed converting the first (or second...) time.
#if defined(TARGET_ARM)
UNATIVE_OFFSET minMediumExtra; // Same as 'minShortExtra', but for medium-sized jumps.
#endif // TARGET_ARM
UNATIVE_OFFSET adjIG;
UNATIVE_OFFSET adjLJ;
insGroup* lstIG;
#ifdef DEBUG
insGroup* prologIG = emitPrologIG;
#endif // DEBUG
int jmp_iteration = 1;
/*****************************************************************************/
/* If we iterate to look for more jumps to shorten, we start again here. */
/*****************************************************************************/
AGAIN:
#ifdef DEBUG
emitCheckIGoffsets();
#endif
/*
In the following loop we convert all jump targets from "BasicBlock *"
to "insGroup *" values. We also estimate which jumps will be short.
*/
#ifdef DEBUG
insGroup* lastIG = nullptr;
instrDescJmp* lastLJ = nullptr;
#endif
lstIG = nullptr;
adjLJ = 0;
adjIG = 0;
minShortExtra = (UNATIVE_OFFSET)-1;
#if defined(TARGET_ARM)
minMediumExtra = (UNATIVE_OFFSET)-1;
#endif // TARGET_ARM
for (jmp = emitJumpList; jmp; jmp = jmp->idjNext)
{
insGroup* jmpIG;
insGroup* tgtIG;
UNATIVE_OFFSET jsz; // size of the jump instruction in bytes
UNATIVE_OFFSET ssz = 0; // small jump size
NATIVE_OFFSET nsd = 0; // small jump max. neg distance
NATIVE_OFFSET psd = 0; // small jump max. pos distance
#if defined(TARGET_ARM)
UNATIVE_OFFSET msz = 0; // medium jump size
NATIVE_OFFSET nmd = 0; // medium jump max. neg distance
NATIVE_OFFSET pmd = 0; // medium jump max. pos distance
NATIVE_OFFSET mextra; // How far beyond the medium jump range is this jump offset?
#endif // TARGET_ARM
NATIVE_OFFSET extra; // How far beyond the short jump range is this jump offset?
UNATIVE_OFFSET srcInstrOffs; // offset of the source instruction of the jump
UNATIVE_OFFSET srcEncodingOffs; // offset of the source used by the instruction set to calculate the relative
// offset of the jump
UNATIVE_OFFSET dstOffs;
NATIVE_OFFSET jmpDist; // the relative jump distance, as it will be encoded
UNATIVE_OFFSET oldSize;
UNATIVE_OFFSET sizeDif;
#ifdef TARGET_XARCH
assert(jmp->idInsFmt() == IF_LABEL || jmp->idInsFmt() == IF_RWR_LABEL || jmp->idInsFmt() == IF_SWR_LABEL);
/* Figure out the smallest size we can end up with */
if (jmp->idInsFmt() == IF_LABEL)
{
if (emitIsCondJump(jmp))
{
ssz = JCC_SIZE_SMALL;
nsd = JCC_DIST_SMALL_MAX_NEG;
psd = JCC_DIST_SMALL_MAX_POS;
}
else
{
ssz = JMP_SIZE_SMALL;
nsd = JMP_DIST_SMALL_MAX_NEG;
psd = JMP_DIST_SMALL_MAX_POS;
}
}
#endif // TARGET_XARCH
#ifdef TARGET_ARM
assert((jmp->idInsFmt() == IF_T2_J1) || (jmp->idInsFmt() == IF_T2_J2) || (jmp->idInsFmt() == IF_T1_I) ||
(jmp->idInsFmt() == IF_T1_K) || (jmp->idInsFmt() == IF_T1_M) || (jmp->idInsFmt() == IF_T2_M1) ||
(jmp->idInsFmt() == IF_T2_N1) || (jmp->idInsFmt() == IF_T1_J3) || (jmp->idInsFmt() == IF_LARGEJMP));
/* Figure out the smallest size we can end up with */
if (emitIsCondJump(jmp))
{
ssz = JCC_SIZE_SMALL;
nsd = JCC_DIST_SMALL_MAX_NEG;
psd = JCC_DIST_SMALL_MAX_POS;
msz = JCC_SIZE_MEDIUM;
nmd = JCC_DIST_MEDIUM_MAX_NEG;
pmd = JCC_DIST_MEDIUM_MAX_POS;
}
else if (emitIsCmpJump(jmp))
{
ssz = JMP_SIZE_SMALL;
nsd = 0;
psd = 126;
}
else if (emitIsUncondJump(jmp))
{
ssz = JMP_SIZE_SMALL;
nsd = JMP_DIST_SMALL_MAX_NEG;
psd = JMP_DIST_SMALL_MAX_POS;
}
else if (emitIsLoadLabel(jmp))
{
ssz = LBL_SIZE_SMALL;
nsd = LBL_DIST_SMALL_MAX_NEG;
psd = LBL_DIST_SMALL_MAX_POS;
}
else
{
assert(!"Unknown jump instruction");
}
#endif // TARGET_ARM
#ifdef TARGET_ARM64
/* Figure out the smallest size we can end up with */
if (emitIsCondJump(jmp))
{
ssz = JCC_SIZE_SMALL;
bool isTest = (jmp->idIns() == INS_tbz) || (jmp->idIns() == INS_tbnz);
nsd = (isTest) ? TB_DIST_SMALL_MAX_NEG : JCC_DIST_SMALL_MAX_NEG;
psd = (isTest) ? TB_DIST_SMALL_MAX_POS : JCC_DIST_SMALL_MAX_POS;
}
else if (emitIsUncondJump(jmp))
{
// Nothing to do; we don't shrink these.
assert(jmp->idjShort);
ssz = JMP_SIZE_SMALL;
}
else if (emitIsLoadLabel(jmp))
{
ssz = LBL_SIZE_SMALL;
nsd = LBL_DIST_SMALL_MAX_NEG;
psd = LBL_DIST_SMALL_MAX_POS;
}
else if (emitIsLoadConstant(jmp))
{
ssz = LDC_SIZE_SMALL;
nsd = LDC_DIST_SMALL_MAX_NEG;
psd = LDC_DIST_SMALL_MAX_POS;
}
else
{
assert(!"Unknown jump instruction");
}
#endif // TARGET_ARM64
/* Make sure the jumps are properly ordered */
#ifdef DEBUG
assert(lastLJ == nullptr || lastIG != jmp->idjIG || lastLJ->idjOffs < jmp->idjOffs);
lastLJ = (lastIG == jmp->idjIG) ? jmp : nullptr;
assert(lastIG == nullptr || lastIG->igNum <= jmp->idjIG->igNum || jmp->idjIG == prologIG ||
emitNxtIGnum > unsigned(0xFFFF)); // igNum might overflow
lastIG = jmp->idjIG;
#endif // DEBUG
/* Get hold of the current jump size */
jsz = jmp->idCodeSize();
/* Get the group the jump is in */
jmpIG = jmp->idjIG;
/* Are we in a group different from the previous jump? */
if (lstIG != jmpIG)
{
/* Were there any jumps before this one? */
if (lstIG)
{
/* Adjust the offsets of the intervening blocks */
do
{
lstIG = lstIG->igNext;
assert(lstIG);
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Adjusted offset of " FMT_BB " from %04X to %04X\n", lstIG->igNum, lstIG->igOffs,
lstIG->igOffs - adjIG);
}
#endif // DEBUG
lstIG->igOffs -= adjIG;
assert(IsCodeAligned(lstIG->igOffs));
} while (lstIG != jmpIG);
}
/* We've got the first jump in a new group */
adjLJ = 0;
lstIG = jmpIG;
}
/* Apply any local size adjustment to the jump's relative offset */
jmp->idjOffs -= adjLJ;
// If this is a jump via register, the instruction size does not change, so we are done.
CLANG_FORMAT_COMMENT_ANCHOR;
#if defined(TARGET_ARM64)
// JIT code and data will be allocated together for arm64 so the relative offset to JIT data is known.
// In case such offset can be encodeable for `ldr` (+-1MB), shorten it.
if (jmp->idAddr()->iiaIsJitDataOffset())
{
// Reference to JIT data
assert(jmp->idIsBound());
UNATIVE_OFFSET srcOffs = jmpIG->igOffs + jmp->idjOffs;
int doff = jmp->idAddr()->iiaGetJitDataOffset();
assert(doff >= 0);
ssize_t imm = emitGetInsSC(jmp);
assert((imm >= 0) && (imm < 0x1000)); // 0x1000 is arbitrary, currently 'imm' is always 0
unsigned dataOffs = (unsigned)(doff + imm);
assert(dataOffs < emitDataSize());
// Conservately assume JIT data starts after the entire code size.
// TODO-ARM64: we might consider only hot code size which will be computed later in emitComputeCodeSizes().
assert(emitTotalCodeSize > 0);
UNATIVE_OFFSET maxDstOffs = emitTotalCodeSize + dataOffs;
// Check if the distance is within the encoding length.
jmpDist = maxDstOffs - srcOffs;
extra = jmpDist - psd;
if (extra <= 0)
{
goto SHORT_JMP;
}
// Keep the large form.
continue;
}
#endif
/* Have we bound this jump's target already? */
if (jmp->idIsBound())
{
/* Does the jump already have the smallest size? */
if (jmp->idjShort)
{
assert(jmp->idCodeSize() == ssz);
// We should not be jumping/branching across funclets/functions
emitCheckFuncletBranch(jmp, jmpIG);
continue;
}
tgtIG = jmp->idAddr()->iiaIGlabel;
}
else
{
/* First time we've seen this label, convert its target */
CLANG_FORMAT_COMMENT_ANCHOR;
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Binding: ");
emitDispIns(jmp, false, false, false);
printf("Binding L_M%03u_" FMT_BB, emitComp->compMethodID, jmp->idAddr()->iiaBBlabel->bbNum);
}
#endif // DEBUG
tgtIG = (insGroup*)emitCodeGetCookie(jmp->idAddr()->iiaBBlabel);
#ifdef DEBUG
if (EMITVERBOSE)
{
if (tgtIG)
{
printf(" to %s\n", emitLabelString(tgtIG));
}
else
{
printf("-- ERROR, no emitter cookie for " FMT_BB "; it is probably missing BBF_HAS_LABEL.\n",
jmp->idAddr()->iiaBBlabel->bbNum);
}
}
assert(tgtIG);
#endif // DEBUG
/* Record the bound target */
jmp->idAddr()->iiaIGlabel = tgtIG;
jmp->idSetIsBound();
}
// We should not be jumping/branching across funclets/functions
emitCheckFuncletBranch(jmp, jmpIG);
#ifdef TARGET_XARCH
/* Done if this is not a variable-sized jump */
if ((jmp->idIns() == INS_push) || (jmp->idIns() == INS_mov) || (jmp->idIns() == INS_call) ||
(jmp->idIns() == INS_push_hide))
{
continue;
}
#endif
#ifdef TARGET_ARM
if ((jmp->idIns() == INS_push) || (jmp->idIns() == INS_mov) || (jmp->idIns() == INS_movt) ||
(jmp->idIns() == INS_movw))
{
continue;
}
#endif
#ifdef TARGET_ARM64
// There is only one size of unconditional branch; we don't support functions larger than 2^28 bytes (our branch
// range).
if (emitIsUncondJump(jmp))
{
continue;
}
#endif
/*
In the following distance calculations, if we're not actually
scheduling the code (i.e. reordering instructions), we can
use the actual offset of the jump (rather than the beg/end of
the instruction group) since the jump will not be moved around
and thus its offset is accurate.
First we need to figure out whether this jump is a forward or
backward one; to do this we simply look at the ordinals of the
group that contains the jump and the target.
*/
srcInstrOffs = jmpIG->igOffs + jmp->idjOffs;
/* Note that the destination is always the beginning of an IG, so no need for an offset inside it */
dstOffs = tgtIG->igOffs;
#if defined(TARGET_ARM)
srcEncodingOffs =
srcInstrOffs + 4; // For relative branches, ARM PC is always considered to be the instruction address + 4
#elif defined(TARGET_ARM64)
srcEncodingOffs =
srcInstrOffs; // For relative branches, ARM64 PC is always considered to be the instruction address
#else
srcEncodingOffs = srcInstrOffs + ssz; // Encoding offset of relative offset for small branch
#endif
if (jmpIG->igNum < tgtIG->igNum)
{
/* Forward jump */
/* Adjust the target offset by the current delta. This is a worst-case estimate, as jumps between
here and the target could be shortened, causing the actual distance to shrink.
*/
dstOffs -= adjIG;
/* Compute the distance estimate */
jmpDist = dstOffs - srcEncodingOffs;
/* How much beyond the max. short distance does the jump go? */
extra = jmpDist - psd;
#if DEBUG_EMIT
assert(jmp->idDebugOnlyInfo() != nullptr);
if (jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM || INTERESTING_JUMP_NUM == 0)
{
if (INTERESTING_JUMP_NUM == 0)
{
printf("[1] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
}
printf("[1] Jump block is at %08X\n", jmpIG->igOffs);
printf("[1] Jump reloffset is %04X\n", jmp->idjOffs);
printf("[1] Jump source is at %08X\n", srcEncodingOffs);
printf("[1] Label block is at %08X\n", dstOffs);
printf("[1] Jump dist. is %04X\n", jmpDist);
if (extra > 0)
{
printf("[1] Dist excess [S] = %d \n", extra);
}
}
if (EMITVERBOSE)
{
printf("Estimate of fwd jump [%08X/%03u]: %04X -> %04X = %04X\n", dspPtr(jmp),
jmp->idDebugOnlyInfo()->idNum, srcInstrOffs, dstOffs, jmpDist);
}
#endif // DEBUG_EMIT
if (extra <= 0)
{
/* This jump will be a short one */
goto SHORT_JMP;
}
}
else
{
/* Backward jump */
/* Compute the distance estimate */
jmpDist = srcEncodingOffs - dstOffs;
/* How much beyond the max. short distance does the jump go? */
extra = jmpDist + nsd;
#if DEBUG_EMIT
assert(jmp->idDebugOnlyInfo() != nullptr);
if (jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM || INTERESTING_JUMP_NUM == 0)
{
if (INTERESTING_JUMP_NUM == 0)
{
printf("[2] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
}
printf("[2] Jump block is at %08X\n", jmpIG->igOffs);
printf("[2] Jump reloffset is %04X\n", jmp->idjOffs);
printf("[2] Jump source is at %08X\n", srcEncodingOffs);
printf("[2] Label block is at %08X\n", dstOffs);
printf("[2] Jump dist. is %04X\n", jmpDist);
if (extra > 0)
{
printf("[2] Dist excess [S] = %d \n", extra);
}
}
if (EMITVERBOSE)
{
printf("Estimate of bwd jump [%08X/%03u]: %04X -> %04X = %04X\n", dspPtr(jmp),
jmp->idDebugOnlyInfo()->idNum, srcInstrOffs, dstOffs, jmpDist);
}
#endif // DEBUG_EMIT
if (extra <= 0)
{
/* This jump will be a short one */
goto SHORT_JMP;
}
}
/* We arrive here if the jump couldn't be made short, at least for now */
/* We had better not have eagerly marked the jump as short
* in emitIns_J(). If we did, then it has to be able to stay short
* as emitIns_J() uses the worst case scenario, and blocks can
* only move closer together after that.
*/
assert(jmp->idjShort == 0);
/* Keep track of the closest distance we got */
if (minShortExtra > (unsigned)extra)
{
minShortExtra = (unsigned)extra;
}
#if defined(TARGET_ARM)
// If we're here, we couldn't convert to a small jump.
// Handle conversion to medium-sized conditional jumps.
// 'srcInstrOffs', 'srcEncodingOffs', 'dstOffs', 'jmpDist' have already been computed
// and don't need to be recomputed.
if (emitIsCondJump(jmp))
{
if (jmpIG->igNum < tgtIG->igNum)
{
/* Forward jump */
/* How much beyond the max. medium distance does the jump go? */
mextra = jmpDist - pmd;
#if DEBUG_EMIT
assert(jmp->idDebugOnlyInfo() != NULL);
if (jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM || INTERESTING_JUMP_NUM == 0)
{
if (mextra > 0)
{
if (INTERESTING_JUMP_NUM == 0)
printf("[6] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
printf("[6] Dist excess [S] = %d \n", mextra);
}
}
#endif // DEBUG_EMIT
if (mextra <= 0)
{
/* This jump will be a medium one */
goto MEDIUM_JMP;
}
}
else
{
/* Backward jump */
/* How much beyond the max. medium distance does the jump go? */
mextra = jmpDist + nmd;
#if DEBUG_EMIT
assert(jmp->idDebugOnlyInfo() != NULL);
if (jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM || INTERESTING_JUMP_NUM == 0)
{
if (mextra > 0)
{
if (INTERESTING_JUMP_NUM == 0)
printf("[7] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
printf("[7] Dist excess [S] = %d \n", mextra);
}
}
#endif // DEBUG_EMIT
if (mextra <= 0)
{
/* This jump will be a medium one */
goto MEDIUM_JMP;
}
}
/* We arrive here if the jump couldn't be made medium, at least for now */
/* Keep track of the closest distance we got */
if (minMediumExtra > (unsigned)mextra)
minMediumExtra = (unsigned)mextra;
}
#endif // TARGET_ARM
/*****************************************************************************
* We arrive here if the jump must stay long, at least for now.
* Go try the next one.
*/
continue;
/*****************************************************************************/
/* Handle conversion to short jump */
/*****************************************************************************/
SHORT_JMP:
/* Try to make this jump a short one */
emitSetShortJump(jmp);
if (!jmp->idjShort)
{
continue; // This jump must be kept long
}
/* This jump is becoming either short or medium */
oldSize = jsz;
jsz = ssz;
assert(oldSize >= jsz);
sizeDif = oldSize - jsz;
#if defined(TARGET_XARCH)
jmp->idCodeSize(jsz);
#elif defined(TARGET_ARM)
#if 0
// This is done as part of emitSetShortJump():
insSize isz = emitInsSize(jmp->idInsFmt());
jmp->idInsSize(isz);
#endif
#elif defined(TARGET_ARM64)
// The size of IF_LARGEJMP/IF_LARGEADR/IF_LARGELDC are 8 or 12.
// All other code size is 4.
assert((sizeDif == 4) || (sizeDif == 8));
#else
#error Unsupported or unset target architecture
#endif
goto NEXT_JMP;
#if defined(TARGET_ARM)
/*****************************************************************************/
/* Handle conversion to medium jump */
/*****************************************************************************/
MEDIUM_JMP:
/* Try to make this jump a medium one */
emitSetMediumJump(jmp);
if (jmp->idCodeSize() > msz)
{
continue; // This jump wasn't shortened
}
assert(jmp->idCodeSize() == msz);
/* This jump is becoming medium */
oldSize = jsz;
jsz = msz;
assert(oldSize >= jsz);
sizeDif = oldSize - jsz;
goto NEXT_JMP;
#endif // TARGET_ARM
/*****************************************************************************/
NEXT_JMP:
/* Make sure the size of the jump is marked correctly */
assert((0 == (jsz | jmpDist)) || (jsz == jmp->idCodeSize()));
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Shrinking jump [%08X/%03u]\n", dspPtr(jmp), jmp->idDebugOnlyInfo()->idNum);
}
#endif
noway_assert((unsigned short)sizeDif == sizeDif);
adjIG += sizeDif;
adjLJ += sizeDif;
jmpIG->igSize -= (unsigned short)sizeDif;
emitTotalCodeSize -= sizeDif;
/* The jump size estimate wasn't accurate; flag its group */
jmpIG->igFlags |= IGF_UPD_ISZ;
} // end for each jump
/* Did we shorten any jumps? */
if (adjIG)
{
/* Adjust offsets of any remaining blocks */
assert(lstIG);
for (;;)
{
lstIG = lstIG->igNext;
if (!lstIG)
{
break;
}
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Adjusted offset of " FMT_BB " from %04X to %04X\n", lstIG->igNum, lstIG->igOffs,
lstIG->igOffs - adjIG);
}
#endif // DEBUG
lstIG->igOffs -= adjIG;
assert(IsCodeAligned(lstIG->igOffs));
}
#ifdef DEBUG
emitCheckIGoffsets();
#endif
/* Is there a chance of other jumps becoming short? */
CLANG_FORMAT_COMMENT_ANCHOR;
#ifdef DEBUG
#if defined(TARGET_ARM)
if (EMITVERBOSE)
printf("Total shrinkage = %3u, min extra short jump size = %3u, min extra medium jump size = %u\n", adjIG,
minShortExtra, minMediumExtra);
#else
if (EMITVERBOSE)
{
printf("Total shrinkage = %3u, min extra jump size = %3u\n", adjIG, minShortExtra);
}
#endif
#endif
if ((minShortExtra <= adjIG)
#if defined(TARGET_ARM)
|| (minMediumExtra <= adjIG)
#endif // TARGET_ARM
)
{
jmp_iteration++;
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("Iterating branch shortening. Iteration = %d\n", jmp_iteration);
}
#endif
goto AGAIN;
}
}
#ifdef DEBUG
if (EMIT_INSTLIST_VERBOSE)
{
printf("\nLabels list after the jump dist binding:\n\n");
emitDispIGlist(false);
}
emitCheckIGoffsets();
#endif // DEBUG
}
#endif
#if FEATURE_LOOP_ALIGN
//-----------------------------------------------------------------------------
// emitCheckAlignFitInCurIG: Check if adding current align instruction will
// create new 'ig'. For multi align instructions, this sets `emitForceNewIG` so
// so all 'align' instructions are under same IG.
//
// Arguments:
// nAlignInstr - Number of align instructions about to be added.
//
void emitter::emitCheckAlignFitInCurIG(unsigned nAlignInstr)
{
unsigned instrDescSize = nAlignInstr * sizeof(instrDescAlign);
// Ensure that all align instructions fall in same IG.
if (emitCurIGfreeNext + instrDescSize >= emitCurIGfreeEndp)
{
emitForceNewIG = true;
}
}
//-----------------------------------------------------------------------------
//
// emitLoopAlign: The next instruction will be a loop head entry point
// So insert an alignment instruction of "paddingBytes" to ensure that
// the code is properly aligned.
// Arguments:
// paddingBytes - Number of padding bytes to insert.
// isFirstAlign - For multiple 'align' instructions case, if this is the first
// 'align' instruction of that group.
//
void emitter::emitLoopAlign(unsigned paddingBytes, bool isFirstAlign DEBUG_ARG(bool isPlacedBehindJmp))
{
// Determine if 'align' instruction about to be generated will
// fall in current IG or next.
bool alignInstrInNewIG = emitForceNewIG;
if (!alignInstrInNewIG)
{
// If align fits in current IG, then mark that it contains alignment
// instruction in the end.
emitCurIG->igFlags |= IGF_HAS_ALIGN;
}
/* Insert a pseudo-instruction to ensure that we align
the next instruction properly */
instrDescAlign* id = emitNewInstrAlign();
if (alignInstrInNewIG)
{
// Mark this IG has alignment in the end, so during emitter we can check the instruction count
// heuristics of all IGs that follows this IG that participate in a loop.
emitCurIG->igFlags |= IGF_HAS_ALIGN;
}
else
{
// Otherwise, make sure it was already marked such.
assert(emitCurIG->endsWithAlignInstr());
}
#if defined(TARGET_XARCH)
assert(paddingBytes <= MAX_ENCODED_SIZE);
id->idCodeSize(paddingBytes);
#elif defined(TARGET_ARM64)
assert(paddingBytes == INSTR_ENCODED_SIZE);
#endif
id->idaIG = emitCurIG;
if (isFirstAlign)
{
// For multiple align instructions, set the idaLoopHeadPredIG only for the
// first align instruction
id->idaLoopHeadPredIG = emitCurIG;
emitAlignLastGroup = id;
}
else
{
id->idaLoopHeadPredIG = nullptr;
}
#ifdef DEBUG
id->isPlacedAfterJmp = isPlacedBehindJmp;
#endif
/* Append this instruction to this IG's alignment list */
id->idaNext = emitCurIGAlignList;
emitCurIGsize += paddingBytes;
dispIns(id);
emitCurIGAlignList = id;
}
//-----------------------------------------------------------------------------
//
// emitLongLoopAlign: The next instruction will be a loop head entry point
// So insert alignment instruction(s) here to ensure that
// we can properly align the code.
//
// This emits more than one `INS_align` instruction depending on the
// alignmentBoundary parameter.
//
// Arguments:
// alignmentBoundary - The boundary at which loop needs to be aligned.
//
void emitter::emitLongLoopAlign(unsigned alignmentBoundary DEBUG_ARG(bool isPlacedBehindJmp))
{
#if defined(TARGET_XARCH)
unsigned nPaddingBytes = alignmentBoundary - 1;
unsigned nAlignInstr = (nPaddingBytes + (MAX_ENCODED_SIZE - 1)) / MAX_ENCODED_SIZE;
unsigned insAlignCount = nPaddingBytes / MAX_ENCODED_SIZE;
unsigned lastInsAlignSize = nPaddingBytes % MAX_ENCODED_SIZE;
unsigned paddingBytes = MAX_ENCODED_SIZE;
#elif defined(TARGET_ARM64)
unsigned nAlignInstr = alignmentBoundary / INSTR_ENCODED_SIZE;
unsigned insAlignCount = nAlignInstr;
unsigned paddingBytes = INSTR_ENCODED_SIZE;
#endif
emitCheckAlignFitInCurIG(nAlignInstr);
/* Insert a pseudo-instruction to ensure that we align
the next instruction properly */
bool isFirstAlign = true;
while (insAlignCount)
{
emitLoopAlign(paddingBytes, isFirstAlign DEBUG_ARG(isPlacedBehindJmp));
insAlignCount--;
isFirstAlign = false;
}
#if defined(TARGET_XARCH)
emitLoopAlign(lastInsAlignSize, isFirstAlign DEBUG_ARG(isPlacedBehindJmp));
#endif
}
//-----------------------------------------------------------------------------
// emitConnectAlignInstrWithCurIG: If "align" instruction is not just before the loop start,
// setting idaLoopHeadPredIG lets us know the exact IG that the "align"
// instruction is trying to align. This is used to track the last IG that
// needs alignment after which VEX encoding optimization is enabled.
//
// TODO: Once over-estimation problem is solved, consider replacing
// idaLoopHeadPredIG with idaLoopHeadIG itself.
//
void emitter::emitConnectAlignInstrWithCurIG()
{
JITDUMP("Mapping 'align' instruction in IG%02u to target IG%02u\n", emitAlignLastGroup->idaIG->igNum,
emitCurIG->igNum);
// Since we never align overlapping instructions, it is always guaranteed that
// the emitAlignLastGroup points to the loop that is in process of getting aligned.
emitAlignLastGroup->idaLoopHeadPredIG = emitCurIG;
// For a new IG to ensure that loop doesn't start from IG that idaLoopHeadPredIG points to.
emitNxtIG();
}
//-----------------------------------------------------------------------------
// emitLoopAlignment: Insert an align instruction at the end of emitCurIG and
// mark it as IGF_HAS_ALIGN to indicate that a next or a future
// IG is a loop that needs alignment.
//
void emitter::emitLoopAlignment(DEBUG_ARG1(bool isPlacedBehindJmp))
{
unsigned paddingBytes;
#if defined(TARGET_XARCH)
// For xarch, each align instruction can be maximum of MAX_ENCODED_SIZE bytes and if
// more padding is needed, multiple MAX_ENCODED_SIZE bytes instructions are added.
if ((emitComp->opts.compJitAlignLoopBoundary > 16) && (!emitComp->opts.compJitAlignLoopAdaptive))
{
paddingBytes = emitComp->opts.compJitAlignLoopBoundary;
emitLongLoopAlign(paddingBytes DEBUG_ARG(isPlacedBehindJmp));
}
else
{
emitCheckAlignFitInCurIG(1);
paddingBytes = MAX_ENCODED_SIZE;
emitLoopAlign(paddingBytes, true DEBUG_ARG(isPlacedBehindJmp));
}
#elif defined(TARGET_ARM64)
// For Arm64, each align instruction is 4-bytes long because of fixed-length encoding.
// The padding added will be always be in multiple of 4-bytes.
if (emitComp->opts.compJitAlignLoopAdaptive)
{
paddingBytes = emitComp->opts.compJitAlignLoopBoundary >> 1;
}
else
{
paddingBytes = emitComp->opts.compJitAlignLoopBoundary;
}
emitLongLoopAlign(paddingBytes DEBUG_ARG(isPlacedBehindJmp));
#endif
assert(emitLastIns->idIns() == INS_align);
JITDUMP("Adding 'align' instruction of %d bytes in %s.\n", paddingBytes, emitLabelString(emitCurIG));
}
//-----------------------------------------------------------------------------
// emitEndsWithAlignInstr: Checks if current IG ends with loop align instruction.
//
// Returns: true if current IG ends with align instruction.
//
bool emitter::emitEndsWithAlignInstr()
{
return emitCurIG->endsWithAlignInstr();
}
//-----------------------------------------------------------------------------
// getLoopSize: Starting from loopHeaderIg, find the size of the smallest possible loop
// such that it doesn't exceed the maxLoopSize.
//
// Arguments:
// igLoopHeader - The header IG of a loop
// maxLoopSize - Maximum loop size. If the loop is bigger than this value, we will just
// return this value.
// isAlignAdjusted - Determine if adjustments are done to the align instructions or not.
// During generating code, it is 'false' (because we haven't adjusted the size yet).
// During outputting code, it is 'true'.
//
// Returns: size of a loop in bytes.
//
unsigned emitter::getLoopSize(insGroup* igLoopHeader, unsigned maxLoopSize DEBUG_ARG(bool isAlignAdjusted))
{
unsigned loopSize = 0;
for (insGroup* igInLoop = igLoopHeader; igInLoop != nullptr; igInLoop = igInLoop->igNext)
{
loopSize += igInLoop->igSize;
if (igInLoop->endsWithAlignInstr())
{
// If IGF_HAS_ALIGN is present, igInLoop contains align instruction at the end,
// for next IG or some future IG.
//
// For both cases, remove the padding bytes from igInLoop's size so it is not included in loopSize.
//
// If the loop was formed because of forward jumps like the loop IG18 below, the backedge is not
// set for them and such loops are not aligned. For such cases, the loop size threshold will never
// be met and we would break as soon as loopSize > maxLoopSize.
//
// IG05:
// ...
// jmp IG18
// ...
// IG18:
// ...
// jne IG05
//
// If igInLoop is a legitimate loop, and igInLoop's end with another 'align' instruction for different IG
// representing a loop that needs alignment, then igInLoop should be the last IG of the current loop and
// should have backedge to current loop header.
//
// Below, IG05 is the last IG of loop IG04-IG05 and its backedge points to IG04.
//
// IG03:
// ...
// align
// IG04:
// ...
// ...
// IG05:
// ...
// jne IG04
// align ; <---
// IG06:
// ...
// jne IG06
//
//
assert((igInLoop->igLoopBackEdge == nullptr) || (igInLoop->igLoopBackEdge == igLoopHeader));
#ifdef DEBUG
if (isAlignAdjusted)
{
// If this IG is already align adjusted, get the adjusted padding already calculated.
instrDescAlign* alignInstr = emitAlignList;
bool foundAlignInstr = false;
// Find the alignInstr for igInLoop IG.
for (; alignInstr != nullptr; alignInstr = alignInstr->idaNext)
{
if (alignInstr->idaIG->igNum == igInLoop->igNum)
{
foundAlignInstr = true;
break;
}
}
assert(foundAlignInstr);
unsigned adjustedPadding = 0;
if (emitComp->opts.compJitAlignLoopAdaptive)
{
adjustedPadding = alignInstr->idCodeSize();
}
else
{
instrDescAlign* alignInstrToAdj = alignInstr;
for (; alignInstrToAdj != nullptr && alignInstrToAdj->idaIG == alignInstr->idaIG;
alignInstrToAdj = alignInstrToAdj->idaNext)
{
adjustedPadding += alignInstrToAdj->idCodeSize();
}
}
loopSize -= adjustedPadding;
}
else
#endif
{
// The current loop size should exclude the align instruction size reserved for next loop.
loopSize -= emitComp->opts.compJitAlignPaddingLimit;
}
}
if ((igInLoop->igLoopBackEdge == igLoopHeader) || (loopSize > maxLoopSize))
{
break;
}
}
return loopSize;
}
//-----------------------------------------------------------------------------
// emitSetLoopBackEdge : Sets igLoopBackEdge field, if not already set and
// if currIG has back-edge to dstIG.
//
// Notes:
// Despite we align only inner most loop, we might see intersected loops because of control flow
// re-arrangement like adding a split edge in LSRA.
//
// If there is an intersection of current loop with last loop that is already marked as align,
// then *do not align* one of the loop that completely encloses the other one. Or if they both intersect,
// then *do not align* either of them because since the flow is complicated enough that aligning one of them
// will not improve the performance.
//
void emitter::emitSetLoopBackEdge(BasicBlock* loopTopBlock)
{
insGroup* dstIG = (insGroup*)loopTopBlock->bbEmitCookie;
bool alignCurrentLoop = true;
bool alignLastLoop = true;
// With (dstIG != nullptr), ensure that only back edges are tracked.
// If there is forward jump, dstIG is not yet generated.
//
// We don't rely on (block->bbJumpDest->bbNum <= block->bbNum) because the basic
// block numbering is not guaranteed to be sequential.
if ((dstIG != nullptr) && (dstIG->igNum <= emitCurIG->igNum))
{
unsigned currLoopStart = dstIG->igNum;
unsigned currLoopEnd = emitCurIG->igNum;
// Only mark back-edge if current loop starts after the last inner loop ended.
if (emitLastLoopEnd < currLoopStart)
{
emitCurIG->igLoopBackEdge = dstIG;
JITDUMP("** IG%02u jumps back to IG%02u forming a loop.\n", currLoopEnd, currLoopStart);
emitLastLoopStart = currLoopStart;
emitLastLoopEnd = currLoopEnd;
}
else if (currLoopStart == emitLastLoopStart)
{
// Note: If current and last loop starts at same point,
// retain the alignment flag of the smaller loop.
// |
// .---->|<----.
// last | | |
// loop | | | current
// .---->| | loop
// | |
// |-----.
//
}
else if ((currLoopStart < emitLastLoopStart) && (emitLastLoopEnd < currLoopEnd))
{
// if current loop completely encloses last loop,
// then current loop should not be aligned.
alignCurrentLoop = false;
}
else if ((emitLastLoopStart < currLoopStart) && (currLoopEnd < emitLastLoopEnd))
{
// if last loop completely encloses current loop,
// then last loop should not be aligned.
alignLastLoop = false;
}
else
{
// The loops intersect and should not align either of the loops
alignLastLoop = false;
alignCurrentLoop = false;
}
if (!alignLastLoop || !alignCurrentLoop)
{
instrDescAlign* alignInstr = emitAlignList;
bool markedLastLoop = alignLastLoop;
bool markedCurrLoop = alignCurrentLoop;
while ((alignInstr != nullptr))
{
insGroup* loopHeadIG = alignInstr->loopHeadIG();
// Find the IG that has 'align' instruction to align the current loop
// and clear the IGF_HAS_ALIGN flag.
if (!alignCurrentLoop && (loopHeadIG == dstIG))
{
assert(!markedCurrLoop);
// This IG should no longer contain alignment instruction
alignInstr->removeAlignFlags();
markedCurrLoop = true;
JITDUMP("** Skip alignment for current loop IG%02u ~ IG%02u because it encloses an aligned loop "
"IG%02u ~ IG%02u.\n",
currLoopStart, currLoopEnd, emitLastLoopStart, emitLastLoopEnd);
}
// Find the IG that has 'align' instruction to align the last loop
// and clear the IGF_HAS_ALIGN flag.
if (!alignLastLoop && (loopHeadIG != nullptr) && (loopHeadIG->igNum == emitLastLoopStart))
{
assert(!markedLastLoop);
assert(alignInstr->idaIG->endsWithAlignInstr());
// This IG should no longer contain alignment instruction
alignInstr->removeAlignFlags();
markedLastLoop = true;
JITDUMP("** Skip alignment for aligned loop IG%02u ~ IG%02u because it encloses the current loop "
"IG%02u ~ IG%02u.\n",
emitLastLoopStart, emitLastLoopEnd, currLoopStart, currLoopEnd);
}
if (markedLastLoop && markedCurrLoop)
{
break;
}
alignInstr = emitAlignInNextIG(alignInstr);
}
assert(markedLastLoop && markedCurrLoop);
}
}
}
//-----------------------------------------------------------------------------
// emitLoopAlignAdjustments: Walk all the align instructions and update them
// with actual padding needed.
//
// Notes:
// For IGs that have align instructions in the end, calculate the actual offset
// of loop start and determine how much padding is needed. Based on that, update
// the igOffs, igSize and emitTotalCodeSize.
//
void emitter::emitLoopAlignAdjustments()
{
// no align instructions
if (emitAlignList == nullptr)
{
return;
}
JITDUMP("*************** In emitLoopAlignAdjustments()\n");
JITDUMP("compJitAlignLoopAdaptive = %s\n", dspBool(emitComp->opts.compJitAlignLoopAdaptive));
JITDUMP("compJitAlignLoopBoundary = %u\n", emitComp->opts.compJitAlignLoopBoundary);
JITDUMP("compJitAlignLoopMinBlockWeight = %u\n", emitComp->opts.compJitAlignLoopMinBlockWeight);
JITDUMP("compJitAlignLoopForJcc = %s\n", dspBool(emitComp->opts.compJitAlignLoopForJcc));
JITDUMP("compJitAlignLoopMaxCodeSize = %u\n", emitComp->opts.compJitAlignLoopMaxCodeSize);
JITDUMP("compJitAlignPaddingLimit = %u\n", emitComp->opts.compJitAlignPaddingLimit);
unsigned estimatedPaddingNeeded = emitComp->opts.compJitAlignPaddingLimit;
unsigned alignBytesRemoved = 0;
unsigned loopIGOffset = 0;
instrDescAlign* alignInstr = emitAlignList;
for (; alignInstr != nullptr;)
{
assert(alignInstr->idIns() == INS_align);
insGroup* loopHeadPredIG = alignInstr->idaLoopHeadPredIG;
insGroup* loopHeadIG = alignInstr->loopHeadIG();
insGroup* containingIG = alignInstr->idaIG;
JITDUMP(" Adjusting 'align' instruction in IG%02u that is targeted for IG%02u \n", containingIG->igNum,
loopHeadIG->igNum);
// Since we only adjust the padding up to the next align instruction which is behind the jump, we make sure
// that we take into account all the alignBytes we removed until that point. Hence " - alignBytesRemoved"
loopIGOffset = loopHeadIG->igOffs - alignBytesRemoved;
// igSize also includes INS_align instruction, take it off.
loopIGOffset -= estimatedPaddingNeeded;
// IG can be marked as not needing alignment if during setting igLoopBackEdge, it is detected
// that the igLoopBackEdge encloses an IG that is marked for alignment.
unsigned actualPaddingNeeded =
containingIG->endsWithAlignInstr()
? emitCalculatePaddingForLoopAlignment(loopHeadIG, loopIGOffset DEBUG_ARG(false))
: 0;
assert(estimatedPaddingNeeded >= actualPaddingNeeded);
unsigned short diff = (unsigned short)(estimatedPaddingNeeded - actualPaddingNeeded);
if (diff != 0)
{
containingIG->igSize -= diff;
alignBytesRemoved += diff;
emitTotalCodeSize -= diff;
// Update the flags
containingIG->igFlags |= IGF_UPD_ISZ;
if (actualPaddingNeeded == 0)
{
alignInstr->removeAlignFlags();
}
#ifdef TARGET_XARCH
if (emitComp->opts.compJitAlignLoopAdaptive)
{
assert(actualPaddingNeeded < MAX_ENCODED_SIZE);
alignInstr->idCodeSize(actualPaddingNeeded);
}
else
#endif
{
unsigned paddingToAdj = actualPaddingNeeded;
#ifdef DEBUG
#if defined(TARGET_XARCH)
int instrAdjusted =
(emitComp->opts.compJitAlignLoopBoundary + (MAX_ENCODED_SIZE - 1)) / MAX_ENCODED_SIZE;
#elif defined(TARGET_ARM64)
unsigned short instrAdjusted = (emitComp->opts.compJitAlignLoopBoundary >> 1) / INSTR_ENCODED_SIZE;
if (!emitComp->opts.compJitAlignLoopAdaptive)
{
instrAdjusted = emitComp->opts.compJitAlignLoopBoundary / INSTR_ENCODED_SIZE;
}
#endif // TARGET_XARCH & TARGET_ARM64
#endif // DEBUG
// Adjust the padding amount in all align instructions in this IG
instrDescAlign *alignInstrToAdj = alignInstr, *prevAlignInstr = nullptr;
for (; alignInstrToAdj != nullptr && alignInstrToAdj->idaIG == alignInstr->idaIG;
alignInstrToAdj = alignInstrToAdj->idaNext)
{
#if defined(TARGET_XARCH)
unsigned newPadding = min(paddingToAdj, MAX_ENCODED_SIZE);
alignInstrToAdj->idCodeSize(newPadding);
#elif defined(TARGET_ARM64)
unsigned newPadding = min(paddingToAdj, INSTR_ENCODED_SIZE);
if (newPadding == 0)
{
alignInstrToAdj->idInsOpt(INS_OPTS_NONE);
}
#endif
paddingToAdj -= newPadding;
prevAlignInstr = alignInstrToAdj;
#ifdef DEBUG
instrAdjusted--;
#endif
}
assert(paddingToAdj == 0);
assert(instrAdjusted == 0);
}
JITDUMP("Adjusted alignment for %s from %u to %u.\n", emitLabelString(loopHeadIG), estimatedPaddingNeeded,
actualPaddingNeeded);
JITDUMP("Adjusted size of %s from %u to %u.\n", emitLabelString(containingIG),
(containingIG->igSize + diff), containingIG->igSize);
}
// Adjust the offset of all IGs starting from next IG until we reach the IG having the next
// align instruction or the end of IG list.
insGroup* adjOffIG = containingIG->igNext;
instrDescAlign* nextAlign = emitAlignInNextIG(alignInstr);
insGroup* adjOffUptoIG = nextAlign != nullptr ? nextAlign->idaIG : emitIGlast;
while ((adjOffIG != nullptr) && (adjOffIG->igNum <= adjOffUptoIG->igNum))
{
JITDUMP("Adjusted offset of %s from %04X to %04X\n", emitLabelString(adjOffIG), adjOffIG->igOffs,
(adjOffIG->igOffs - alignBytesRemoved));
adjOffIG->igOffs -= alignBytesRemoved;
adjOffIG = adjOffIG->igNext;
}
alignInstr = nextAlign;
if (actualPaddingNeeded > 0)
{
// Record the last loop IG that will be aligned. No overestimation
// adjustment will be done after emitLastAlignedIgNum.
JITDUMP("Recording last aligned IG: %s\n", emitLabelString(loopHeadPredIG));
emitLastAlignedIgNum = loopHeadPredIG->igNum;
}
}
#ifdef DEBUG
emitCheckIGoffsets();
#endif
}
//-----------------------------------------------------------------------------
// emitCalculatePaddingForLoopAlignment: Calculate the padding amount to insert at the
// end of 'ig' so the loop that starts after 'ig' is aligned.
//
// Arguments:
// loopHeadIG - The IG that has the loop head that need to be aligned.
// offset - The offset at which the IG that follows 'ig' starts.
// isAlignAdjusted - Determine if adjustments are done to the align instructions or not.
// During generating code, it is 'false' (because we haven't adjusted the size yet).
// During outputting code, it is 'true'.
//
// Returns: Padding amount.
// 0 means no padding is needed, either because loop is already aligned or it
// is too expensive to align loop and hence it will not be aligned.
//
// Notes:
// Below are the steps (in this order) to calculate the padding amount.
// 1. If loop is already aligned to desired boundary, then return 0. // already aligned
// 2. If loop size exceed maximum allowed loop size, then return 0. // already aligned
//
// For adaptive loop alignment:
// 3a. Calculate paddingNeeded and maxPaddingAmount to align to 32B boundary.
// 3b. If paddingNeeded > maxPaddingAmount, then recalculate to align to 16B boundary.
// 3b. If paddingNeeded == 0, then return 0. // already aligned at 16B
// 3c. If paddingNeeded > maxPaddingAmount, then return 0. // expensive to align
// 3d. If the loop already fits in minimum 32B blocks, then return 0. // already best aligned
// 3e. return paddingNeeded.
//
// For non-adaptive loop alignment:
// 3a. Calculate paddingNeeded.
// 3b. If the loop already fits in minimum alignmentBoundary blocks, then return 0. // already best aligned
// 3c. return paddingNeeded.
//
unsigned emitter::emitCalculatePaddingForLoopAlignment(insGroup* loopHeadIG,
size_t offset DEBUG_ARG(bool isAlignAdjusted))
{
unsigned alignmentBoundary = emitComp->opts.compJitAlignLoopBoundary;
// No padding if loop is already aligned
if ((offset & (alignmentBoundary - 1)) == 0)
{
JITDUMP(";; Skip alignment: 'Loop at %s already aligned at %dB boundary.'\n", emitLabelString(loopHeadIG),
alignmentBoundary);
return 0;
}
unsigned maxLoopSize = 0;
int maxLoopBlocksAllowed = 0;
if (emitComp->opts.compJitAlignLoopAdaptive)
{
// For adaptive, adjust the loop size depending on the alignment boundary
maxLoopBlocksAllowed = genLog2((unsigned)alignmentBoundary) - 1;
maxLoopSize = alignmentBoundary * maxLoopBlocksAllowed;
}
else
{
// For non-adaptive, just take whatever is supplied using COMPlus_ variables
maxLoopSize = emitComp->opts.compJitAlignLoopMaxCodeSize;
}
unsigned loopSize = getLoopSize(loopHeadIG, maxLoopSize DEBUG_ARG(isAlignAdjusted));
// No padding if loop is big
if (loopSize > maxLoopSize)
{
JITDUMP(";; Skip alignment: 'Loop at %s is big. LoopSize= %d, MaxLoopSize= %d.'\n", emitLabelString(loopHeadIG),
loopSize, maxLoopSize);
return 0;
}
unsigned paddingToAdd = 0;
unsigned minBlocksNeededForLoop = (loopSize + alignmentBoundary - 1) / alignmentBoundary;
bool skipPadding = false;
if (emitComp->opts.compJitAlignLoopAdaptive)
{
// adaptive loop alignment
unsigned nMaxPaddingBytes = (1 << (maxLoopBlocksAllowed - minBlocksNeededForLoop + 1));
#ifdef TARGET_XARCH
// Max padding for adaptive alignment has alignmentBoundary of 32 bytes with
// max padding limit of 15 bytes ((alignmentBoundary >> 1) - 1)
nMaxPaddingBytes -= 1;
#endif
unsigned nPaddingBytes = (-(int)(size_t)offset) & (alignmentBoundary - 1);
// Check if the alignment exceeds maxPadding limit
if (nPaddingBytes > nMaxPaddingBytes)
{
#ifdef TARGET_XARCH
// Cannot align to 32B, so try to align to 16B boundary.
// Only applicable for xarch. For arm64, it is recommended to align
// at 32B only.
alignmentBoundary >>= 1;
nMaxPaddingBytes = 1 << (maxLoopBlocksAllowed - minBlocksNeededForLoop + 1);
nPaddingBytes = (-(int)(size_t)offset) & (alignmentBoundary - 1);
#endif
// Check if the loop is already at new alignment boundary
if (nPaddingBytes == 0)
{
skipPadding = true;
JITDUMP(";; Skip alignment: 'Loop at %s already aligned at %uB boundary.'\n",
emitLabelString(loopHeadIG), alignmentBoundary);
}
// Check if the alignment exceeds new maxPadding limit
else if (nPaddingBytes > nMaxPaddingBytes)
{
skipPadding = true;
JITDUMP(";; Skip alignment: 'Loop at %s PaddingNeeded= %d, MaxPadding= %d, LoopSize= %d, "
"AlignmentBoundary= %dB.'\n",
emitLabelString(loopHeadIG), nPaddingBytes, nMaxPaddingBytes, loopSize, alignmentBoundary);
}
}
// If within maxPaddingLimit
if (!skipPadding)
{
// Padding is needed only if loop starts at or after the current offset.
// Otherwise, the loop just fits in minBlocksNeededForLoop and so can skip alignment.
size_t extraBytesNotInLoop =
(size_t)(emitComp->opts.compJitAlignLoopBoundary * minBlocksNeededForLoop) - loopSize;
size_t currentOffset = (size_t)offset % alignmentBoundary;
if (currentOffset > extraBytesNotInLoop)
{
// Padding is needed only if loop starts at or after the current offset and hence might not
// fit in minBlocksNeededForLoop
paddingToAdd = nPaddingBytes;
}
else
{
// Otherwise, the loop just fits in minBlocksNeededForLoop and so can skip alignment.
JITDUMP(";; Skip alignment: 'Loop at %s is aligned to fit in %d blocks of %d chunks.'\n",
emitLabelString(loopHeadIG), minBlocksNeededForLoop, alignmentBoundary);
}
}
}
else
{
// non-adaptive loop alignment
unsigned extraBytesNotInLoop = (alignmentBoundary * minBlocksNeededForLoop) - loopSize;
unsigned currentOffset = (size_t)offset % alignmentBoundary;
#ifdef DEBUG
// Mitigate JCC erratum by making sure the jmp doesn't fall on the boundary
if (emitComp->opts.compJitAlignLoopForJcc)
{
// TODO: See if extra padding we might end up adding to mitigate JCC erratum is worth doing?
currentOffset++;
}
#endif
if (currentOffset > extraBytesNotInLoop)
{
// Padding is needed only if loop starts at or after the current offset and hence might not
// fit in minBlocksNeededForLoop
paddingToAdd = (-(int)(size_t)offset) & (alignmentBoundary - 1);
}
else
{
// Otherwise, the loop just fits in minBlocksNeededForLoop and so can skip alignment.
JITDUMP(";; Skip alignment: 'Loop at %s is aligned to fit in %d blocks of %d chunks.'\n",
emitLabelString(loopHeadIG), minBlocksNeededForLoop, alignmentBoundary);
}
}
JITDUMP(";; Calculated padding to add %d bytes to align %s at %dB boundary.\n", paddingToAdd,
emitLabelString(loopHeadIG), alignmentBoundary);
// Either no padding is added because it is too expensive or the offset gets aligned
// to the alignment boundary
assert(paddingToAdd == 0 || (((offset + paddingToAdd) & (alignmentBoundary - 1)) == 0));
return paddingToAdd;
}
// emitAlignInNextIG: On xarch, for adaptive alignment, this will usually return the next instruction in
// 'emitAlignList'. But for arm64 or non-adaptive alignment on xarch, where multiple
// align instructions are emitted, this method will skip the 'align' instruction present
// in the same IG and return the first instruction that is present in next IG.
// Arguments:
// alignInstr - Current 'align' instruction for which next IG's first 'align' should be returned.
//
emitter::instrDescAlign* emitter::emitAlignInNextIG(instrDescAlign* alignInstr)
{
// If there are multiple align instructions, skip the align instructions after
// the first align instruction and fast forward to the next IG
insGroup* alignIG = alignInstr->idaIG;
while ((alignInstr != nullptr) && (alignInstr->idaNext != nullptr) && (alignInstr->idaNext->idaIG == alignIG))
{
alignInstr = alignInstr->idaNext;
}
return alignInstr != nullptr ? alignInstr->idaNext : nullptr;
}
#endif // FEATURE_LOOP_ALIGN
void emitter::emitCheckFuncletBranch(instrDesc* jmp, insGroup* jmpIG)
{
#ifdef TARGET_LOONGARCH64
// TODO-LoongArch64: support idDebugOnlyInfo.
return;
#else
#ifdef DEBUG
// We should not be jumping/branching across funclets/functions
// Except possibly a 'call' to a finally funclet for a local unwind
// or a 'return' from a catch handler (that can go just about anywhere)
// This routine attempts to validate that any branches across funclets
// meets one of those criteria...
assert(jmp->idIsBound());
#ifdef TARGET_XARCH
// An lea of a code address (for constant data stored with the code)
// is treated like a jump for emission purposes but is not really a jump so
// we don't have to check anything here.
if (jmp->idIns() == INS_lea)
{
return;
}
#endif
if (jmp->idAddr()->iiaHasInstrCount())
{
// Too hard to figure out funclets from just an instruction count
// You're on your own!
return;
}
#ifdef TARGET_ARM64
// No interest if it's not jmp.
if (emitIsLoadLabel(jmp) || emitIsLoadConstant(jmp))
{
return;
}
#endif // TARGET_ARM64
insGroup* tgtIG = jmp->idAddr()->iiaIGlabel;
assert(tgtIG);
if (tgtIG->igFuncIdx != jmpIG->igFuncIdx)
{
if (jmp->idDebugOnlyInfo()->idFinallyCall)
{
// We don't record enough information to determine this accurately, so instead
// we assume that any branch to the very start of a finally is OK.
// No branches back to the root method
assert(tgtIG->igFuncIdx > 0);
FuncInfoDsc* tgtFunc = emitComp->funGetFunc(tgtIG->igFuncIdx);
assert(tgtFunc->funKind == FUNC_HANDLER);
EHblkDsc* tgtEH = emitComp->ehGetDsc(tgtFunc->funEHIndex);
// Only branches to finallys (not faults, catches, filters, etc.)
assert(tgtEH->HasFinallyHandler());
// Only to the first block of the finally (which is properly marked)
BasicBlock* tgtBlk = tgtEH->ebdHndBeg;
assert(tgtBlk->bbFlags & BBF_FUNCLET_BEG);
// And now we made it back to where we started
assert(tgtIG == emitCodeGetCookie(tgtBlk));
assert(tgtIG->igFuncIdx == emitComp->funGetFuncIdx(tgtBlk));
}
else if (jmp->idDebugOnlyInfo()->idCatchRet)
{
// Again there isn't enough information to prove this correct
// so just allow a 'branch' to any other 'parent' funclet
FuncInfoDsc* jmpFunc = emitComp->funGetFunc(jmpIG->igFuncIdx);
assert(jmpFunc->funKind == FUNC_HANDLER);
EHblkDsc* jmpEH = emitComp->ehGetDsc(jmpFunc->funEHIndex);
// Only branches out of catches
assert(jmpEH->HasCatchHandler());
FuncInfoDsc* tgtFunc = emitComp->funGetFunc(tgtIG->igFuncIdx);
assert(tgtFunc);
if (tgtFunc->funKind == FUNC_HANDLER)
{
// An outward chain to the containing funclet/EH handler
// Note that it might be anywhere within nested try bodies
assert(jmpEH->ebdEnclosingHndIndex == tgtFunc->funEHIndex);
}
else
{
// This funclet is 'top level' and so it is branching back to the
// root function, and should have no containing EH handlers
// but it could be nested within try bodies...
assert(tgtFunc->funKind == FUNC_ROOT);
assert(jmpEH->ebdEnclosingHndIndex == EHblkDsc::NO_ENCLOSING_INDEX);
}
}
else
{
printf("Hit an illegal branch between funclets!");
assert(tgtIG->igFuncIdx == jmpIG->igFuncIdx);
}
}
#endif // DEBUG
#endif
}
/*****************************************************************************
*
* Compute the code sizes that we're going to use to allocate the code buffers.
*
* This sets:
*
* emitTotalHotCodeSize
* emitTotalColdCodeSize
* Compiler::info.compTotalHotCodeSize
* Compiler::info.compTotalColdCodeSize
*/
void emitter::emitComputeCodeSizes()
{
assert((emitComp->fgFirstColdBlock == nullptr) == (emitFirstColdIG == nullptr));
if (emitFirstColdIG)
{
emitTotalHotCodeSize = emitFirstColdIG->igOffs;
emitTotalColdCodeSize = emitTotalCodeSize - emitTotalHotCodeSize;
}
else
{
emitTotalHotCodeSize = emitTotalCodeSize;
emitTotalColdCodeSize = 0;
}
emitComp->info.compTotalHotCodeSize = emitTotalHotCodeSize;
emitComp->info.compTotalColdCodeSize = emitTotalColdCodeSize;
#ifdef DEBUG
if (emitComp->verbose)
{
printf("\nHot code size = 0x%X bytes\n", emitTotalHotCodeSize);
printf("Cold code size = 0x%X bytes\n", emitTotalColdCodeSize);
}
#endif
}
//------------------------------------------------------------------------
// emitEndCodeGen: called at end of code generation to create code, data, and gc info
//
// Arguments:
// comp - compiler instance
// contTrkPtrLcls - true if tracked stack pointers are contiguous on the stack
// fullInt - true if method has fully interruptible gc reporting
// fullPtrMap - true if gc reporting should use full register pointer map
// xcptnsCount - number of EH clauses to report for the method
// prologSize [OUT] - prolog size in bytes
// epilogSize [OUT] - epilog size in bytes (see notes)
// codeAddr [OUT] - address of the code buffer
// coldCodeAddr [OUT] - address of the cold code buffer (if any)
// consAddr [OUT] - address of the read only constant buffer (if any)
//
// Notes:
// Currently, in methods with multiple epilogs, all epilogs must have the same
// size. epilogSize is the size of just one of these epilogs, not the cumulative
// size of all of the method's epilogs.
//
// Returns:
// size of the method code, in bytes
//
unsigned emitter::emitEndCodeGen(Compiler* comp,
bool contTrkPtrLcls,
bool fullyInt,
bool fullPtrMap,
unsigned xcptnsCount,
unsigned* prologSize,
unsigned* epilogSize,
void** codeAddr,
void** coldCodeAddr,
void** consAddr DEBUGARG(unsigned* instrCount))
{
#ifdef DEBUG
if (emitComp->verbose)
{
printf("*************** In emitEndCodeGen()\n");
}
#endif
BYTE* consBlock;
BYTE* consBlockRW;
BYTE* codeBlock;
BYTE* codeBlockRW;
BYTE* coldCodeBlock;
BYTE* coldCodeBlockRW;
BYTE* cp;
assert(emitCurIG == nullptr);
emitCodeBlock = nullptr;
emitConsBlock = nullptr;
emitOffsAdj = 0;
/* Tell everyone whether we have fully interruptible code or not */
emitFullyInt = fullyInt;
emitFullGCinfo = fullPtrMap;
#ifndef UNIX_X86_ABI
emitFullArgInfo = !emitHasFramePtr;
#else
emitFullArgInfo = fullPtrMap;
#endif
#if EMITTER_STATS
GCrefsTable.record(emitGCrFrameOffsCnt);
emitSizeTable.record(static_cast<unsigned>(emitSizeMethod));
stkDepthTable.record(emitMaxStackDepth);
#endif // EMITTER_STATS
// Default values, correct even if EMIT_TRACK_STACK_DEPTH is 0.
emitSimpleStkUsed = true;
u1.emitSimpleStkMask = 0;
u1.emitSimpleByrefStkMask = 0;
#if EMIT_TRACK_STACK_DEPTH
/* Convert max. stack depth from # of bytes to # of entries */
unsigned maxStackDepthIn4ByteElements = emitMaxStackDepth / sizeof(int);
JITDUMP("Converting emitMaxStackDepth from bytes (%d) to elements (%d)\n", emitMaxStackDepth,
maxStackDepthIn4ByteElements);
emitMaxStackDepth = maxStackDepthIn4ByteElements;
/* Should we use the simple stack */
if (emitMaxStackDepth > MAX_SIMPLE_STK_DEPTH || emitFullGCinfo)
{
/* We won't use the "simple" argument table */
emitSimpleStkUsed = false;
/* Allocate the argument tracking table */
if (emitMaxStackDepth <= sizeof(u2.emitArgTrackLcl))
{
u2.emitArgTrackTab = (BYTE*)u2.emitArgTrackLcl;
}
else
{
u2.emitArgTrackTab = (BYTE*)emitGetMem(roundUp(emitMaxStackDepth));
}
u2.emitArgTrackTop = u2.emitArgTrackTab;
u2.emitGcArgTrackCnt = 0;
}
#endif
if (emitEpilogCnt == 0)
{
/* No epilogs, make sure the epilog size is set to 0 */
emitEpilogSize = 0;
#ifdef TARGET_XARCH
emitExitSeqSize = 0;
#endif // TARGET_XARCH
}
/* Return the size of the epilog to the caller */
*epilogSize = emitEpilogSize;
#ifdef TARGET_XARCH
*epilogSize += emitExitSeqSize;
#endif // TARGET_XARCH
#ifdef DEBUG
if (EMIT_INSTLIST_VERBOSE)
{
printf("\nInstruction list before instruction issue:\n\n");
emitDispIGlist(true);
}
emitCheckIGoffsets();
#endif
/* Allocate the code block (and optionally the data blocks) */
// If we're doing procedure splitting and we found cold blocks, then
// allocate hot and cold buffers. Otherwise only allocate a hot
// buffer.
coldCodeBlock = nullptr;
CorJitAllocMemFlag allocMemFlag = CORJIT_ALLOCMEM_DEFAULT_CODE_ALIGN;
#ifdef TARGET_X86
//
// These are the heuristics we use to decide whether or not to force the
// code to be 16-byte aligned.
//
// 1. For ngen code with IBC data, use 16-byte alignment if the method
// has been called more than ScenarioHotWeight times.
// 2. For JITed code and ngen code without IBC data, use 16-byte alignment
// when the code is 16 bytes or smaller. We align small getters/setters
// because of they are penalized heavily on certain hardware when not 16-byte
// aligned (VSWhidbey #373938). To minimize size impact of this optimization,
// we do not align large methods because of the penalty is amortized for them.
//
if (emitComp->fgHaveProfileData())
{
const weight_t scenarioHotWeight = 256.0;
if (emitComp->fgCalledCount > (scenarioHotWeight * emitComp->fgProfileRunsCount()))
{
allocMemFlag = CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN;
}
}
else
{
if (emitTotalHotCodeSize <= 16)
{
allocMemFlag = CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN;
}
}
#endif
#if defined(TARGET_XARCH) || defined(TARGET_ARM64)
// For x64/x86/arm64, align methods that are "optimizations enabled" to 32 byte boundaries if
// they are larger than 16 bytes and contain a loop.
//
if (emitComp->opts.OptimizationEnabled() && !emitComp->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT) &&
(emitTotalHotCodeSize > 16) && emitComp->fgHasLoops)
{
allocMemFlag = CORJIT_ALLOCMEM_FLG_32BYTE_ALIGN;
}
#endif
// This restricts the emitConsDsc.alignment to: 1, 2, 4, 8, 16, or 32 bytes
// Alignments greater than 32 would require VM support in ICorJitInfo::allocMem
assert(isPow2(emitConsDsc.alignment) && (emitConsDsc.alignment <= 32));
if (emitConsDsc.alignment == 16)
{
allocMemFlag = static_cast<CorJitAllocMemFlag>(allocMemFlag | CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN);
}
else if (emitConsDsc.alignment == 32)
{
allocMemFlag = static_cast<CorJitAllocMemFlag>(allocMemFlag | CORJIT_ALLOCMEM_FLG_RODATA_32BYTE_ALIGN);
}
AllocMemArgs args;
memset(&args, 0, sizeof(args));
#ifdef TARGET_ARM64
// For arm64, we want to allocate JIT data always adjacent to code similar to what native compiler does.
// This way allows us to use a single `ldr` to access such data like float constant/jmp table.
if (emitTotalColdCodeSize > 0)
{
// JIT data might be far away from the cold code.
NYI_ARM64("Need to handle fix-up to data from cold code.");
}
UNATIVE_OFFSET roDataAlignmentDelta = 0;
if (emitConsDsc.dsdOffs && (emitConsDsc.alignment == TARGET_POINTER_SIZE))
{
UNATIVE_OFFSET roDataAlignment = TARGET_POINTER_SIZE; // 8 Byte align by default.
roDataAlignmentDelta = (UNATIVE_OFFSET)ALIGN_UP(emitTotalHotCodeSize, roDataAlignment) - emitTotalHotCodeSize;
assert((roDataAlignmentDelta == 0) || (roDataAlignmentDelta == 4));
}
args.hotCodeSize = emitTotalHotCodeSize + roDataAlignmentDelta + emitConsDsc.dsdOffs;
args.coldCodeSize = emitTotalColdCodeSize;
args.roDataSize = 0;
args.xcptnsCount = xcptnsCount;
args.flag = allocMemFlag;
emitCmpHandle->allocMem(&args);
codeBlock = (BYTE*)args.hotCodeBlock;
codeBlockRW = (BYTE*)args.hotCodeBlockRW;
coldCodeBlock = (BYTE*)args.coldCodeBlock;
coldCodeBlockRW = (BYTE*)args.coldCodeBlockRW;
consBlock = codeBlock + emitTotalHotCodeSize + roDataAlignmentDelta;
consBlockRW = codeBlockRW + emitTotalHotCodeSize + roDataAlignmentDelta;
#else
args.hotCodeSize = emitTotalHotCodeSize;
args.coldCodeSize = emitTotalColdCodeSize;
args.roDataSize = emitConsDsc.dsdOffs;
args.xcptnsCount = xcptnsCount;
args.flag = allocMemFlag;
emitCmpHandle->allocMem(&args);
codeBlock = (BYTE*)args.hotCodeBlock;
codeBlockRW = (BYTE*)args.hotCodeBlockRW;
coldCodeBlock = (BYTE*)args.coldCodeBlock;
coldCodeBlockRW = (BYTE*)args.coldCodeBlockRW;
consBlock = (BYTE*)args.roDataBlock;
consBlockRW = (BYTE*)args.roDataBlockRW;
#endif
#ifdef DEBUG
if ((allocMemFlag & CORJIT_ALLOCMEM_FLG_32BYTE_ALIGN) != 0)
{
assert(((size_t)codeBlock & 31) == 0);
}
#endif
// if (emitConsDsc.dsdOffs)
// printf("Cons=%08X\n", consBlock);
/* Give the block addresses to the caller and other functions here */
*codeAddr = emitCodeBlock = codeBlock;
*coldCodeAddr = emitColdCodeBlock = coldCodeBlock;
*consAddr = emitConsBlock = consBlock;
/* Nothing has been pushed on the stack */
CLANG_FORMAT_COMMENT_ANCHOR;
#if EMIT_TRACK_STACK_DEPTH
emitCurStackLvl = 0;
#endif
/* Assume no live GC ref variables on entry */
VarSetOps::ClearD(emitComp, emitThisGCrefVars); // This is initialized to Empty at the start of codegen.
#if defined(DEBUG) && defined(JIT32_ENCODER)
VarSetOps::ClearD(emitComp, debugThisGCRefVars);
VarSetOps::ClearD(emitComp, debugPrevGCRefVars);
debugPrevRegPtrDsc = nullptr;
#endif
emitThisGCrefRegs = emitThisByrefRegs = RBM_NONE;
emitThisGCrefVset = true;
#ifdef DEBUG
emitIssuing = true;
// We don't use these after this point
VarSetOps::AssignNoCopy(emitComp, emitPrevGCrefVars, VarSetOps::UninitVal());
emitPrevGCrefRegs = emitPrevByrefRegs = 0xBAADFEED;
VarSetOps::AssignNoCopy(emitComp, emitInitGCrefVars, VarSetOps::UninitVal());
emitInitGCrefRegs = emitInitByrefRegs = 0xBAADFEED;
#endif
/* Initialize the GC ref variable lifetime tracking logic */
codeGen->gcInfo.gcVarPtrSetInit();
emitSyncThisObjOffs = -1; /* -1 means no offset set */
emitSyncThisObjReg = REG_NA; /* REG_NA means not set */
#ifdef JIT32_GCENCODER
if (emitComp->lvaKeepAliveAndReportThis())
{
assert(emitComp->lvaIsOriginalThisArg(0));
LclVarDsc* thisDsc = emitComp->lvaGetDesc(0U);
/* If "this" (which is passed in as a register argument in REG_ARG_0)
is enregistered, we normally spot the "mov REG_ARG_0 -> thisReg"
in the prolog and note the location of "this" at that point.
However, if 'this' is enregistered into REG_ARG_0 itself, no code
will be generated in the prolog, so we explicitly need to note
the location of "this" here.
NOTE that we can do this even if "this" is not enregistered in
REG_ARG_0, and it will result in more accurate "this" info over the
prolog. However, as methods are not interruptible over the prolog,
we try to save space by avoiding that.
*/
if (thisDsc->lvRegister)
{
emitSyncThisObjReg = thisDsc->GetRegNum();
if (emitSyncThisObjReg == (int)REG_ARG_0 &&
(codeGen->intRegState.rsCalleeRegArgMaskLiveIn & genRegMask(REG_ARG_0)))
{
if (emitFullGCinfo)
{
emitGCregLiveSet(GCT_GCREF, genRegMask(REG_ARG_0),
emitCodeBlock, // from offset 0
true);
}
else
{
/* If emitFullGCinfo==false, then we don't use any
regPtrDsc's and so explictly note the location
of "this" in GCEncode.cpp
*/
}
}
}
}
#endif // JIT32_GCENCODER
emitContTrkPtrLcls = contTrkPtrLcls;
/* Are there any GC ref variables on the stack? */
if (emitGCrFrameOffsCnt)
{
size_t siz;
unsigned cnt;
unsigned num;
LclVarDsc* dsc;
int* tab;
/* Allocate and clear emitGCrFrameLiveTab[]. This is the table
mapping "stkOffs -> varPtrDsc". It holds a pointer to
the liveness descriptor that was created when the
variable became alive. When the variable becomes dead, the
descriptor will be appended to the liveness descriptor list, and
the entry in emitGCrFrameLiveTab[] will be made NULL.
Note that if all GC refs are assigned consecutively,
emitGCrFrameLiveTab[] can be only as big as the number of GC refs
present, instead of lvaTrackedCount.
*/
siz = emitGCrFrameOffsCnt * sizeof(*emitGCrFrameLiveTab);
emitGCrFrameLiveTab = (varPtrDsc**)emitGetMem(roundUp(siz));
memset(emitGCrFrameLiveTab, 0, siz);
/* Allocate and fill in emitGCrFrameOffsTab[]. This is the table
mapping "varIndex -> stkOffs".
Non-ptrs or reg vars have entries of -1.
Entries of Tracked stack byrefs have the lower bit set to 1.
*/
emitTrkVarCnt = cnt = emitComp->lvaTrackedCount;
assert(cnt);
emitGCrFrameOffsTab = tab = (int*)emitGetMem(cnt * sizeof(int));
memset(emitGCrFrameOffsTab, -1, cnt * sizeof(int));
/* Now fill in all the actual used entries */
for (num = 0, dsc = emitComp->lvaTable, cnt = emitComp->lvaCount; num < cnt; num++, dsc++)
{
if (!dsc->lvOnFrame || (dsc->lvIsParam && !dsc->lvIsRegArg))
{
continue;
}
#if FEATURE_FIXED_OUT_ARGS
if (num == emitComp->lvaOutgoingArgSpaceVar)
{
continue;
}
#endif // FEATURE_FIXED_OUT_ARGS
int offs = dsc->GetStackOffset();
/* Is it within the interesting range of offsets */
if (offs >= emitGCrFrameOffsMin && offs < emitGCrFrameOffsMax)
{
/* Are tracked stack ptr locals laid out contiguously?
If not, skip non-ptrs. The emitter is optimized to work
with contiguous ptrs, but for EditNContinue, the variables
are laid out in the order they occur in the local-sig.
*/
if (!emitContTrkPtrLcls)
{
if (!emitComp->lvaIsGCTracked(dsc))
{
continue;
}
}
unsigned indx = dsc->lvVarIndex;
assert(!dsc->lvRegister);
assert(dsc->lvTracked);
assert(dsc->lvRefCnt() != 0);
assert(dsc->TypeGet() == TYP_REF || dsc->TypeGet() == TYP_BYREF);
assert(indx < emitComp->lvaTrackedCount);
// printf("Variable #%2u/%2u is at stack offset %d\n", num, indx, offs);
#ifdef JIT32_GCENCODER
#ifndef FEATURE_EH_FUNCLETS
// Remember the frame offset of the "this" argument for synchronized methods.
if (emitComp->lvaIsOriginalThisArg(num) && emitComp->lvaKeepAliveAndReportThis())
{
emitSyncThisObjOffs = offs;
offs |= this_OFFSET_FLAG;
}
#endif
#endif // JIT32_GCENCODER
if (dsc->TypeGet() == TYP_BYREF)
{
offs |= byref_OFFSET_FLAG;
}
tab[indx] = offs;
}
}
}
else
{
#ifdef DEBUG
emitTrkVarCnt = 0;
emitGCrFrameOffsTab = nullptr;
#endif
}
#ifdef DEBUG
if (emitComp->verbose)
{
printf("\n***************************************************************************\n");
printf("Instructions as they come out of the scheduler\n\n");
}
#endif
/* Issue all instruction groups in order */
cp = codeBlock;
writeableOffset = codeBlockRW - codeBlock;
#define DEFAULT_CODE_BUFFER_INIT 0xcc
#ifdef DEBUG
*instrCount = 0;
jitstd::list<PreciseIPMapping>::iterator nextMapping = emitComp->genPreciseIPmappings.begin();
#endif
for (insGroup* ig = emitIGlist; ig != nullptr; ig = ig->igNext)
{
assert(!(ig->igFlags & IGF_PLACEHOLDER)); // There better not be any placeholder groups left
/* Is this the first cold block? */
if (ig == emitFirstColdIG)
{
assert(emitCurCodeOffs(cp) == emitTotalHotCodeSize);
assert(coldCodeBlock);
cp = coldCodeBlock;
writeableOffset = coldCodeBlockRW - coldCodeBlock;
#ifdef DEBUG
if (emitComp->opts.disAsm || emitComp->verbose)
{
printf("\n************** Beginning of cold code **************\n");
}
#endif
}
/* Are we overflowing? */
if (ig->igNext && (ig->igNum + 1 != ig->igNext->igNum))
{
NO_WAY("Too many instruction groups");
}
// If this instruction group is returned to from a funclet implementing a finally,
// on architectures where it is necessary generate GC info for the current instruction as
// if it were the instruction following a call.
emitGenGCInfoIfFuncletRetTarget(ig, cp);
instrDesc* id = (instrDesc*)ig->igData;
#ifdef DEBUG
/* Print the IG label, but only if it is a branch label */
if (emitComp->opts.disAsm || emitComp->verbose)
{
if (emitComp->verbose || emitComp->opts.disasmWithGC)
{
printf("\n");
emitDispIG(ig); // Display the flags, IG data, etc.
}
else
{
printf("\n%s:", emitLabelString(ig));
if (!emitComp->opts.disDiffable)
{
printf(" ;; offset=%04XH", emitCurCodeOffs(cp));
}
printf("\n");
}
}
#endif // DEBUG
BYTE* bp = cp;
/* Record the actual offset of the block, noting the difference */
int newOffsAdj = ig->igOffs - emitCurCodeOffs(cp);
#if DEBUG_EMIT
#ifdef DEBUG
// Under DEBUG, only output under verbose flag.
if (emitComp->verbose)
#endif // DEBUG
{
if (newOffsAdj != 0)
{
printf("Block predicted offs = %08X, actual = %08X -> size adj = %d\n", ig->igOffs, emitCurCodeOffs(cp),
newOffsAdj);
}
if (emitOffsAdj != newOffsAdj)
{
printf("Block expected size adj %d not equal to actual size adj %d (probably some instruction size was "
"underestimated but not included in the running `emitOffsAdj` count)\n",
emitOffsAdj, newOffsAdj);
}
}
// Make it noisy in DEBUG if these don't match. In release, the noway_assert below checks the
// fatal condition.
assert(emitOffsAdj == newOffsAdj);
#endif // DEBUG_EMIT
// We can't have over-estimated the adjustment, or we might have underestimated a jump distance.
noway_assert(emitOffsAdj <= newOffsAdj);
emitOffsAdj = newOffsAdj;
assert(emitOffsAdj >= 0);
ig->igOffs = emitCurCodeOffs(cp);
assert(IsCodeAligned(ig->igOffs));
#if EMIT_TRACK_STACK_DEPTH
/* Set the proper stack level if appropriate */
if (ig->igStkLvl != emitCurStackLvl)
{
/* We are pushing stuff implicitly at this label */
assert((unsigned)ig->igStkLvl > (unsigned)emitCurStackLvl);
emitStackPushN(cp, (ig->igStkLvl - (unsigned)emitCurStackLvl) / sizeof(int));
}
#endif
/* Update current GC information for IG's that do not extend the previous IG */
if (!(ig->igFlags & IGF_EXTEND))
{
/* Is there a new set of live GC ref variables? */
if (ig->igFlags & IGF_GC_VARS)
{
emitUpdateLiveGCvars(ig->igGCvars(), cp);
}
else if (!emitThisGCrefVset)
{
emitUpdateLiveGCvars(emitThisGCrefVars, cp);
}
/* Update the set of live GC ref registers */
{
regMaskTP GCregs = ig->igGCregs;
if (GCregs != emitThisGCrefRegs)
{
emitUpdateLiveGCregs(GCT_GCREF, GCregs, cp);
}
}
/* Is there a new set of live byref registers? */
if (ig->igFlags & IGF_BYREF_REGS)
{
unsigned byrefRegs = ig->igByrefRegs();
if (byrefRegs != emitThisByrefRegs)
{
emitUpdateLiveGCregs(GCT_BYREF, byrefRegs, cp);
}
}
#ifdef DEBUG
if (EMIT_GC_VERBOSE || emitComp->opts.disasmWithGC)
{
emitDispGCInfoDelta();
}
#endif // DEBUG
}
else
{
// These are not set for "overflow" groups
assert(!(ig->igFlags & IGF_GC_VARS));
assert(!(ig->igFlags & IGF_BYREF_REGS));
}
/* Issue each instruction in order */
emitCurIG = ig;
for (unsigned cnt = ig->igInsCnt; cnt > 0; cnt--)
{
#ifdef DEBUG
size_t curInstrAddr = (size_t)cp;
instrDesc* curInstrDesc = id;
if ((emitComp->opts.disAsm || emitComp->verbose) && (JitConfig.JitDisasmWithDebugInfo() != 0) &&
(id->idCodeSize() > 0))
{
UNATIVE_OFFSET curCodeOffs = emitCurCodeOffs(cp);
while (nextMapping != emitComp->genPreciseIPmappings.end())
{
UNATIVE_OFFSET mappingOffs = nextMapping->nativeLoc.CodeOffset(this);
if (mappingOffs > curCodeOffs)
{
// Still haven't reached instruction that next mapping belongs to.
break;
}
// We reached the mapping or went past it.
if (mappingOffs == curCodeOffs)
{
emitDispInsIndent();
printf("; ");
nextMapping->debugInfo.Dump(true);
printf("\n");
}
++nextMapping;
}
}
#endif
castto(id, BYTE*) += emitIssue1Instr(ig, id, &cp);
#ifdef DEBUG
// Print the alignment boundary
if ((emitComp->opts.disAsm || emitComp->verbose) && (emitComp->opts.disAddr || emitComp->opts.disAlignment))
{
size_t afterInstrAddr = (size_t)cp;
instruction curIns = curInstrDesc->idIns();
bool isJccAffectedIns = false;
#if defined(TARGET_XARCH)
// Determine if this instruction is part of a set that matches the Intel jcc erratum characteristic
// described here:
// https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf
// This is the case when a jump instruction crosses a 32-byte boundary, or ends on a 32-byte boundary.
// "Jump instruction" in this case includes conditional jump (jcc), macro-fused op-jcc (where 'op' is
// one of cmp, test, add, sub, and, inc, or dec), direct unconditional jump, indirect jump,
// direct/indirect call, and return.
size_t jccAlignBoundary = 32;
size_t jccAlignBoundaryMask = jccAlignBoundary - 1;
size_t jccLastBoundaryAddr = afterInstrAddr & ~jccAlignBoundaryMask;
if (curInstrAddr < jccLastBoundaryAddr)
{
isJccAffectedIns = IsJccInstruction(curIns) || IsJmpInstruction(curIns) || (curIns == INS_call) ||
(curIns == INS_ret);
// For op-Jcc there are two cases: (1) curIns is the jcc, in which case the above condition
// already covers us. (2) curIns is the `op` and the next instruction is the `jcc`. Note that
// we will never have a `jcc` as the first instruction of a group, so we don't need to worry
// about looking ahead to the next group after a an `op` of `op-Jcc`.
if (!isJccAffectedIns && (cnt > 1))
{
// The current `id` is valid, namely, there is another instruction in this group.
instruction nextIns = id->idIns();
if (((curIns == INS_cmp) || (curIns == INS_test) || (curIns == INS_add) ||
(curIns == INS_sub) || (curIns == INS_and) || (curIns == INS_inc) ||
(curIns == INS_dec)) &&
IsJccInstruction(nextIns))
{
isJccAffectedIns = true;
}
}
if (isJccAffectedIns)
{
unsigned bytesCrossedBoundary = (unsigned)(afterInstrAddr & jccAlignBoundaryMask);
printf("; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (%s: %d ; jcc erratum) %dB boundary "
"...............................\n",
codeGen->genInsDisplayName(curInstrDesc), bytesCrossedBoundary, jccAlignBoundary);
}
}
#elif defined(TARGET_LOONGARCH64)
isJccAffectedIns = true;
#endif // TARGET_LOONGARCH64
// Jcc affected instruction boundaries were printed above; handle other cases here.
if (!isJccAffectedIns)
{
size_t alignBoundaryMask = (size_t)emitComp->opts.compJitAlignLoopBoundary - 1;
size_t lastBoundaryAddr = afterInstrAddr & ~alignBoundaryMask;
// draw boundary if beforeAddr was before the lastBoundary.
if (curInstrAddr < lastBoundaryAddr)
{
// Indicate if instruction is at the alignment boundary or is split
unsigned bytesCrossedBoundary = (unsigned)(afterInstrAddr & alignBoundaryMask);
if (bytesCrossedBoundary != 0)
{
printf("; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (%s: %d)",
codeGen->genInsDisplayName(curInstrDesc), bytesCrossedBoundary);
}
else
{
printf("; ...............................");
}
printf(" %dB boundary ...............................\n",
emitComp->opts.compJitAlignLoopBoundary);
}
}
}
#endif // DEBUG
}
#ifdef DEBUG
if (emitComp->opts.disAsm || emitComp->verbose)
{
printf("\t\t\t\t\t\t;; size=%d bbWeight=%s PerfScore %.2f", ig->igSize, refCntWtd2str(ig->igWeight),
ig->igPerfScore);
}
*instrCount += ig->igInsCnt;
#endif // DEBUG
emitCurIG = nullptr;
assert(ig->igSize >= cp - bp);
// Is it the last ig in the hot part?
bool lastHotIG = (emitFirstColdIG != nullptr && ig->igNext == emitFirstColdIG);
if (lastHotIG)
{
unsigned actualHotCodeSize = emitCurCodeOffs(cp);
unsigned allocatedHotCodeSize = emitTotalHotCodeSize;
assert(actualHotCodeSize <= allocatedHotCodeSize);
if (actualHotCodeSize < allocatedHotCodeSize)
{
// The allocated chunk is bigger than used, fill in unused space in it.
unsigned unusedSize = allocatedHotCodeSize - emitCurCodeOffs(cp);
for (unsigned i = 0; i < unusedSize; ++i)
{
*cp++ = DEFAULT_CODE_BUFFER_INIT;
}
assert(allocatedHotCodeSize == emitCurCodeOffs(cp));
}
}
assert((ig->igSize >= cp - bp) || lastHotIG);
ig->igSize = (unsigned short)(cp - bp);
}
#if EMIT_TRACK_STACK_DEPTH
assert(emitCurStackLvl == 0);
#endif
/* Output any initialized data we may have */
if (emitConsDsc.dsdOffs != 0)
{
emitOutputDataSec(&emitConsDsc, consBlock);
}
/* Make sure all GC ref variables are marked as dead */
if (emitGCrFrameOffsCnt != 0)
{
unsigned vn;
int of;
varPtrDsc** dp;
for (vn = 0, of = emitGCrFrameOffsMin, dp = emitGCrFrameLiveTab; vn < emitGCrFrameOffsCnt;
vn++, of += TARGET_POINTER_SIZE, dp++)
{
if (*dp)
{
emitGCvarDeadSet(of, cp, vn);
}
}
}
/* No GC registers are live any more */
if (emitThisByrefRegs)
{
emitUpdateLiveGCregs(GCT_BYREF, RBM_NONE, cp);
}
if (emitThisGCrefRegs)
{
emitUpdateLiveGCregs(GCT_GCREF, RBM_NONE, cp);
}
/* Patch any forward jumps */
if (emitFwdJumps)
{
for (instrDescJmp* jmp = emitJumpList; jmp != nullptr; jmp = jmp->idjNext)
{
#ifdef TARGET_XARCH
assert(jmp->idInsFmt() == IF_LABEL || jmp->idInsFmt() == IF_RWR_LABEL || jmp->idInsFmt() == IF_SWR_LABEL);
#endif
insGroup* tgt = jmp->idAddr()->iiaIGlabel;
if (jmp->idjTemp.idjAddr == nullptr)
{
continue;
}
if (jmp->idjOffs != tgt->igOffs)
{
BYTE* adr = jmp->idjTemp.idjAddr;
int adj = jmp->idjOffs - tgt->igOffs;
#ifdef TARGET_ARM
// On Arm, the offset is encoded in unit of 2 bytes.
adj >>= 1;
#endif
#if DEBUG_EMIT
if ((jmp->idDebugOnlyInfo()->idNum == (unsigned)INTERESTING_JUMP_NUM) || (INTERESTING_JUMP_NUM == 0))
{
#ifdef TARGET_ARM
printf("[5] This output is broken for ARM, since it doesn't properly decode the jump offsets of "
"the instruction at adr\n");
#endif
if (INTERESTING_JUMP_NUM == 0)
{
printf("[5] Jump %u:\n", jmp->idDebugOnlyInfo()->idNum);
}
if (jmp->idjShort)
{
printf("[5] Jump is at %08X\n", (adr + 1 - emitCodeBlock));
printf("[5] Jump distance is %02X - %02X = %02X\n", *(BYTE*)adr, adj, *(BYTE*)adr - adj);
}
else
{
printf("[5] Jump is at %08X\n", (adr + 4 - emitCodeBlock));
printf("[5] Jump distance is %08X - %02X = %08X\n", *(int*)adr, adj, *(int*)adr - adj);
}
}
#endif // DEBUG_EMIT
if (jmp->idjShort)
{
// Patch Forward Short Jump
CLANG_FORMAT_COMMENT_ANCHOR;
#if defined(TARGET_XARCH)
*(BYTE*)(adr + writeableOffset) -= (BYTE)adj;
#elif defined(TARGET_ARM)
// The following works because the jump offset is in the low order bits of the instruction.
// Presumably we could also just call "emitOutputLJ(NULL, adr, jmp)", like for long jumps?
*(short int*)(adr + writeableOffset) -= (short)adj;
#elif defined(TARGET_ARM64)
assert(!jmp->idAddr()->iiaHasInstrCount());
emitOutputLJ(NULL, adr, jmp);
#elif defined(TARGET_LOONGARCH64)
// For LoongArch64 `emitFwdJumps` is always false.
unreached();
#else
#error Unsupported or unset target architecture
#endif
}
else
{
// Patch Forward non-Short Jump
CLANG_FORMAT_COMMENT_ANCHOR;
#if defined(TARGET_XARCH)
*(int*)(adr + writeableOffset) -= adj;
#elif defined(TARGET_ARMARCH)
assert(!jmp->idAddr()->iiaHasInstrCount());
emitOutputLJ(NULL, adr, jmp);
#elif defined(TARGET_LOONGARCH64)
// For LoongArch64 `emitFwdJumps` is always false.
unreached();
#else
#error Unsupported or unset target architecture
#endif
}
}
}
}
#ifdef DEBUG
if (emitComp->opts.disAsm)
{
printf("\n");
}
#endif
unsigned actualCodeSize = emitCurCodeOffs(cp);
#if defined(TARGET_ARM64)
assert(emitTotalCodeSize == actualCodeSize);
#else
assert(emitTotalCodeSize >= actualCodeSize);
#endif
#if EMITTER_STATS
totAllocdSize += emitTotalCodeSize;
totActualSize += actualCodeSize;
#endif
// Fill in eventual unused space, but do not report this space as used.
// If you add this padding during the emitIGlist loop, then it will
// emit offsets after the loop with wrong value (for example for GC ref variables).
unsigned unusedSize = emitTotalCodeSize - actualCodeSize;
JITDUMP("Allocated method code size = %4u , actual size = %4u, unused size = %4u\n", emitTotalCodeSize,
actualCodeSize, unusedSize);
BYTE* cpRW = cp + writeableOffset;
for (unsigned i = 0; i < unusedSize; ++i)
{
*cpRW++ = DEFAULT_CODE_BUFFER_INIT;
}
cp = cpRW - writeableOffset;
assert(emitTotalCodeSize == emitCurCodeOffs(cp));
// Total code size is sum of all IG->size and doesn't include padding in the last IG.
emitTotalCodeSize = actualCodeSize;
#ifdef DEBUG
// Make sure these didn't change during the "issuing" phase
assert(VarSetOps::MayBeUninit(emitPrevGCrefVars));
assert(emitPrevGCrefRegs == 0xBAADFEED);
assert(emitPrevByrefRegs == 0xBAADFEED);
assert(VarSetOps::MayBeUninit(emitInitGCrefVars));
assert(emitInitGCrefRegs == 0xBAADFEED);
assert(emitInitByrefRegs == 0xBAADFEED);
if (EMIT_INSTLIST_VERBOSE)
{
printf("\nLabels list after the end of codegen:\n\n");
emitDispIGlist(false);
}
emitCheckIGoffsets();
#endif // DEBUG
// Assign the real prolog size
*prologSize = emitCodeOffset(emitPrologIG, emitPrologEndPos);
/* Return the amount of code we've generated */
return actualCodeSize;
}
// See specification comment at the declaration.
void emitter::emitGenGCInfoIfFuncletRetTarget(insGroup* ig, BYTE* cp)
{
#if defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
// We only emit this GC information on targets where finally's are implemented via funclets,
// and the finally is invoked, during non-exceptional execution, via a branch with a predefined
// link register, rather than a "true call" for which we would already generate GC info. Currently,
// this means precisely ARM.
if (ig->igFlags & IGF_FINALLY_TARGET)
{
// We don't actually have a call instruction in this case, so we don't have
// a real size for that instruction. We'll use 1.
emitStackPop(cp, /*isCall*/ true, /*callInstrSize*/ 1, /*args*/ 0);
/* Do we need to record a call location for GC purposes? */
if (!emitFullGCinfo)
{
emitRecordGCcall(cp, /*callInstrSize*/ 1);
}
}
#endif // defined(FEATURE_EH_FUNCLETS) && defined(TARGET_ARM)
}
/*****************************************************************************
*
* We have an instruction in an insGroup and we need to know the
* instruction number for this instruction
*/
unsigned emitter::emitFindInsNum(insGroup* ig, instrDesc* idMatch)
{
instrDesc* id = (instrDesc*)ig->igData;
// Check if we are the first instruction in the group
if (id == idMatch)
{
return 0;
}
/* Walk the list of instructions until we find a match */
unsigned insNum = 0;
unsigned insRemaining = ig->igInsCnt;
while (insRemaining > 0)
{
castto(id, BYTE*) += emitSizeOfInsDsc(id);
insNum++;
insRemaining--;
if (id == idMatch)
{
return insNum;
}
}
assert(!"emitFindInsNum failed");
return -1;
}
/*****************************************************************************
*
* We've been asked for the code offset of an instruction but alas one or
* more instruction sizes in the block have been mis-predicted, so we have
* to find the true offset by looking for the instruction within the group.
*/
UNATIVE_OFFSET emitter::emitFindOffset(insGroup* ig, unsigned insNum)
{
instrDesc* id = (instrDesc*)ig->igData;
UNATIVE_OFFSET of = 0;
#ifdef DEBUG
/* Make sure we were passed reasonable arguments */
assert(ig && ig->igSelf == ig);
assert(ig->igInsCnt >= insNum);
#endif
/* Walk the instruction list until all are counted */
while (insNum > 0)
{
of += id->idCodeSize();
castto(id, BYTE*) += emitSizeOfInsDsc(id);
insNum--;
}
return of;
}
//---------------------------------------------------------------------------
// emitDataGenBeg:
// - Allocate space for a constant or block of the size and alignment requested
// Returns the offset in the data section to use
//
// Arguments:
// size - The size in bytes of the constant or block
// alignment - The requested alignment for the data
// dataType - The type of the constant int/float/etc
//
// Note: This method only allocate the space for the constant or block. It doesn't
// initialize the value. You call emitDataGenData to initialize the value.
//
UNATIVE_OFFSET emitter::emitDataGenBeg(unsigned size, unsigned alignment, var_types dataType)
{
unsigned secOffs;
dataSection* secDesc;
assert(emitDataSecCur == nullptr);
// The size must not be zero and must be a multiple of MIN_DATA_ALIGN
// Additionally, MIN_DATA_ALIGN is the minimum alignment that will
// actually be used. That is, if the user requests an alignment
// less than MIN_DATA_ALIGN, they will get something that is at least
// MIN_DATA_ALIGN. We allow smaller alignment to be specified since it is
// simpler to allow it than to check and block it.
//
assert((size != 0) && ((size % dataSection::MIN_DATA_ALIGN) == 0));
assert(isPow2(alignment) && (alignment <= dataSection::MAX_DATA_ALIGN));
/* Get hold of the current offset */
secOffs = emitConsDsc.dsdOffs;
if (((secOffs % alignment) != 0) && (alignment > dataSection::MIN_DATA_ALIGN))
{
// As per the above comment, the minimum alignment is actually (MIN_DATA_ALIGN)
// bytes so we don't need to make any adjustments if the requested
// alignment is less than MIN_DATA_ALIGN.
//
// The maximum requested alignment is tracked and the memory allocator
// will end up ensuring offset 0 is at an address matching that
// alignment. So if the requested alignment is greater than MIN_DATA_ALIGN,
// we need to pad the space out so the offset is a multiple of the requested.
//
uint8_t zeros[dataSection::MAX_DATA_ALIGN] = {}; // auto initialize to all zeros
unsigned zeroSize = alignment - (secOffs % alignment);
unsigned zeroAlign = dataSection::MIN_DATA_ALIGN;
var_types zeroType = TYP_INT;
emitBlkConst(&zeros, zeroSize, zeroAlign, zeroType);
secOffs = emitConsDsc.dsdOffs;
}
assert((secOffs % alignment) == 0);
emitConsDsc.alignment = max(emitConsDsc.alignment, alignment);
/* Advance the current offset */
emitConsDsc.dsdOffs += size;
/* Allocate a data section descriptor and add it to the list */
secDesc = emitDataSecCur = (dataSection*)emitGetMem(roundUp(sizeof(*secDesc) + size));
secDesc->dsSize = size;
secDesc->dsType = dataSection::data;
secDesc->dsDataType = dataType;
secDesc->dsNext = nullptr;
if (emitConsDsc.dsdLast)
{
emitConsDsc.dsdLast->dsNext = secDesc;
}
else
{
emitConsDsc.dsdList = secDesc;
}
emitConsDsc.dsdLast = secDesc;
return secOffs;
}
// Start generating a constant data section for the current function
// populated with BasicBlock references.
// You can choose the references to be either absolute pointers, or
// 4-byte relative addresses.
// Currently the relative references are relative to the start of the
// first block (this is somewhat arbitrary)
UNATIVE_OFFSET emitter::emitBBTableDataGenBeg(unsigned numEntries, bool relativeAddr)
{
unsigned secOffs;
dataSection* secDesc;
assert(emitDataSecCur == nullptr);
UNATIVE_OFFSET emittedSize;
if (relativeAddr)
{
emittedSize = numEntries * 4;
}
else
{
emittedSize = numEntries * TARGET_POINTER_SIZE;
}
/* Get hold of the current offset */
secOffs = emitConsDsc.dsdOffs;
/* Advance the current offset */
emitConsDsc.dsdOffs += emittedSize;
/* Allocate a data section descriptor and add it to the list */
secDesc = emitDataSecCur = (dataSection*)emitGetMem(roundUp(sizeof(*secDesc) + numEntries * sizeof(BasicBlock*)));
secDesc->dsSize = emittedSize;
secDesc->dsType = relativeAddr ? dataSection::blockRelative32 : dataSection::blockAbsoluteAddr;
secDesc->dsDataType = TYP_UNKNOWN;
secDesc->dsNext = nullptr;
if (emitConsDsc.dsdLast)
{
emitConsDsc.dsdLast->dsNext = secDesc;
}
else
{
emitConsDsc.dsdList = secDesc;
}
emitConsDsc.dsdLast = secDesc;
return secOffs;
}
/*****************************************************************************
*
* Emit the given block of bits into the current data section.
*/
void emitter::emitDataGenData(unsigned offs, const void* data, UNATIVE_OFFSET size)
{
assert(emitDataSecCur && (emitDataSecCur->dsSize >= offs + size));
assert(emitDataSecCur->dsType == dataSection::data);
memcpy(emitDataSecCur->dsCont + offs, data, size);
}
/*****************************************************************************
*
* Emit the address of the given basic block into the current data section.
*/
void emitter::emitDataGenData(unsigned index, BasicBlock* label)
{
assert(emitDataSecCur != nullptr);
assert(emitDataSecCur->dsType == dataSection::blockAbsoluteAddr ||
emitDataSecCur->dsType == dataSection::blockRelative32);
unsigned emittedElemSize = emitDataSecCur->dsType == dataSection::blockAbsoluteAddr ? TARGET_POINTER_SIZE : 4;
assert(emitDataSecCur->dsSize >= emittedElemSize * (index + 1));
((BasicBlock**)(emitDataSecCur->dsCont))[index] = label;
}
/*****************************************************************************
*
* We're done generating a data section.
*/
void emitter::emitDataGenEnd()
{
#ifdef DEBUG
assert(emitDataSecCur);
emitDataSecCur = nullptr;
#endif
}
//---------------------------------------------------------------------------
// emitDataGenFind:
// - Returns the offset of an existing constant in the data section
// or INVALID_UNATIVE_OFFSET if there was no matching constant
//
// Arguments:
// cnsAddr - A pointer to the value of the constant that we need
// cnsSize - The size in bytes of the constant
// alignment - The requested alignment for the data
// dataType - The type of the constant int/float/etc
//
UNATIVE_OFFSET emitter::emitDataGenFind(const void* cnsAddr, unsigned cnsSize, unsigned alignment, var_types dataType)
{
UNATIVE_OFFSET cnum = INVALID_UNATIVE_OFFSET;
unsigned cmpCount = 0;
unsigned curOffs = 0;
dataSection* secDesc = emitConsDsc.dsdList;
while (secDesc != nullptr)
{
// Search the existing secDesc entries
// We can match as smaller 'cnsSize' value at the start of a larger 'secDesc->dsSize' block
// We match the bit pattern, so the dataType can be different
// Only match constants when the dsType is 'data'
//
if ((secDesc->dsType == dataSection::data) && (secDesc->dsSize >= cnsSize) && ((curOffs % alignment) == 0))
{
if (memcmp(cnsAddr, secDesc->dsCont, cnsSize) == 0)
{
cnum = curOffs;
// We also might want to update the dsDataType
//
if ((secDesc->dsDataType != dataType) && (secDesc->dsSize == cnsSize))
{
// If the subsequent dataType is floating point then change the original dsDataType
//
if (varTypeIsFloating(dataType))
{
secDesc->dsDataType = dataType;
}
}
break;
}
}
curOffs += secDesc->dsSize;
secDesc = secDesc->dsNext;
if (++cmpCount > 64)
{
// If we don't find a match in the first 64, then we just add the new constant
// This prevents an O(n^2) search cost
break;
}
}
return cnum;
}
//---------------------------------------------------------------------------
// emitDataConst:
// - Returns the valid offset in the data section to use for the constant
// described by the arguments to this method
//
// Arguments:
// cnsAddr - A pointer to the value of the constant that we need
// cnsSize - The size in bytes of the constant
// alignment - The requested alignment for the data
// dataType - The type of the constant int/float/etc
//
//
// Notes: we call the method emitDataGenFind() to see if we already have
// a matching constant that can be reused.
//
UNATIVE_OFFSET emitter::emitDataConst(const void* cnsAddr, unsigned cnsSize, unsigned cnsAlign, var_types dataType)
{
UNATIVE_OFFSET cnum = emitDataGenFind(cnsAddr, cnsSize, cnsAlign, dataType);
if (cnum == INVALID_UNATIVE_OFFSET)
{
cnum = emitDataGenBeg(cnsSize, cnsAlign, dataType);
emitDataGenData(0, cnsAddr, cnsSize);
emitDataGenEnd();
}
return cnum;
}
//------------------------------------------------------------------------
// emitBlkConst: Create a data section constant of arbitrary size.
//
// Arguments:
// cnsAddr - pointer to the block of data to be placed in the data section
// cnsSize - total size of the block of data in bytes
// cnsAlign - alignment of the data in bytes
// elemType - The type of the elements in the constant
//
// Return Value:
// A field handle representing the data offset to access the constant.
//
CORINFO_FIELD_HANDLE emitter::emitBlkConst(const void* cnsAddr, unsigned cnsSize, unsigned cnsAlign, var_types elemType)
{
UNATIVE_OFFSET cnum = emitDataGenBeg(cnsSize, cnsAlign, elemType);
emitDataGenData(0, cnsAddr, cnsSize);
emitDataGenEnd();
return emitComp->eeFindJitDataOffs(cnum);
}
//------------------------------------------------------------------------
// emitFltOrDblConst: Create a float or double data section constant.
//
// Arguments:
// constValue - constant value
// attr - constant size
//
// Return Value:
// A field handle representing the data offset to access the constant.
//
// Notes:
// If attr is EA_4BYTE then the double value is converted to a float value.
// If attr is EA_8BYTE then 8 byte alignment is automatically requested.
//
CORINFO_FIELD_HANDLE emitter::emitFltOrDblConst(double constValue, emitAttr attr)
{
assert((attr == EA_4BYTE) || (attr == EA_8BYTE));
void* cnsAddr;
float f;
var_types dataType;
if (attr == EA_4BYTE)
{
f = forceCastToFloat(constValue);
cnsAddr = &f;
dataType = TYP_FLOAT;
}
else
{
cnsAddr = &constValue;
dataType = TYP_DOUBLE;
}
// Access to inline data is 'abstracted' by a special type of static member
// (produced by eeFindJitDataOffs) which the emitter recognizes as being a reference
// to constant data, not a real static field.
unsigned cnsSize = (attr == EA_4BYTE) ? sizeof(float) : sizeof(double);
unsigned cnsAlign = cnsSize;
#ifdef TARGET_XARCH
if (emitComp->compCodeOpt() == Compiler::SMALL_CODE)
{
// Some platforms don't require doubles to be aligned and so
// we can use a smaller alignment to help with smaller code
cnsAlign = dataSection::MIN_DATA_ALIGN;
}
#endif // TARGET_XARCH
UNATIVE_OFFSET cnum = emitDataConst(cnsAddr, cnsSize, cnsAlign, dataType);
return emitComp->eeFindJitDataOffs(cnum);
}
/*****************************************************************************
*
* Output the given data section at the specified address.
*/
void emitter::emitOutputDataSec(dataSecDsc* sec, BYTE* dst)
{
#ifdef DEBUG
if (EMITVERBOSE)
{
printf("\nEmitting data sections: %u total bytes\n", sec->dsdOffs);
}
if (emitComp->opts.disAsm)
{
emitDispDataSec(sec);
}
unsigned secNum = 0;
#endif
assert(dst);
assert(sec->dsdOffs);
assert(sec->dsdList);
/* Walk and emit the contents of all the data blocks */
dataSection* dsc;
size_t curOffs = 0;
for (dsc = sec->dsdList; dsc; dsc = dsc->dsNext)
{
size_t dscSize = dsc->dsSize;
BYTE* dstRW = dst + writeableOffset;
// absolute label table
if (dsc->dsType == dataSection::blockAbsoluteAddr)
{
JITDUMP(" section %u, size %u, block absolute addr\n", secNum++, dscSize);
assert(dscSize && dscSize % TARGET_POINTER_SIZE == 0);
size_t numElems = dscSize / TARGET_POINTER_SIZE;
target_size_t* bDstRW = (target_size_t*)dstRW;
for (unsigned i = 0; i < numElems; i++)
{
BasicBlock* block = ((BasicBlock**)dsc->dsCont)[i];
// Convert the BasicBlock* value to an IG address
insGroup* lab = (insGroup*)emitCodeGetCookie(block);
// Append the appropriate address to the destination
BYTE* target = emitOffsetToPtr(lab->igOffs);
#ifdef TARGET_ARM
target = (BYTE*)((size_t)target | 1); // Or in thumb bit
#endif
bDstRW[i] = (target_size_t)(size_t)target;
if (emitComp->opts.compReloc)
{
emitRecordRelocation(&(bDstRW[i]), target, IMAGE_REL_BASED_HIGHLOW);
}
JITDUMP(" " FMT_BB ": 0x%p\n", block->bbNum, bDstRW[i]);
}
}
// relative label table
else if (dsc->dsType == dataSection::blockRelative32)
{
JITDUMP(" section %u, size %u, block relative addr\n", secNum++, dscSize);
size_t numElems = dscSize / 4;
unsigned* uDstRW = (unsigned*)dstRW;
insGroup* labFirst = (insGroup*)emitCodeGetCookie(emitComp->fgFirstBB);
for (unsigned i = 0; i < numElems; i++)
{
BasicBlock* block = ((BasicBlock**)dsc->dsCont)[i];
// Convert the BasicBlock* value to an IG address
insGroup* lab = (insGroup*)emitCodeGetCookie(block);
assert(FitsIn<uint32_t>(lab->igOffs - labFirst->igOffs));
uDstRW[i] = lab->igOffs - labFirst->igOffs;
JITDUMP(" " FMT_BB ": 0x%x\n", block->bbNum, uDstRW[i]);
}
}
else
{
// Simple binary data: copy the bytes to the target
assert(dsc->dsType == dataSection::data);
memcpy(dstRW, dsc->dsCont, dscSize);
#ifdef DEBUG
if (EMITVERBOSE)
{
printf(" section %3u, size %2u, RWD%2u:\t", secNum++, dscSize, curOffs);
for (size_t i = 0; i < dscSize; i++)
{
printf("%02x ", dsc->dsCont[i]);
if ((((i + 1) % 16) == 0) && (i + 1 != dscSize))
{
printf("\n\t\t\t\t\t");
}
}
switch (dsc->dsDataType)
{
case TYP_FLOAT:
printf(" ; float %9.6g", (double)*reinterpret_cast<float*>(&dsc->dsCont));
break;
case TYP_DOUBLE:
printf(" ; double %12.9g", *reinterpret_cast<double*>(&dsc->dsCont));
break;
default:
break;
}
printf("\n");
}
#endif // DEBUG
}
curOffs += dscSize;
dst += dscSize;
}
}
#ifdef DEBUG
//------------------------------------------------------------------------
// emitDispDataSec: Dump a data section to stdout.
//
// Arguments:
// section - the data section description
//
// Notes:
// The output format attempts to mirror typical assembler syntax.
// Data section entries lack type information so float/double entries
// are displayed as if they are integers/longs.
//
void emitter::emitDispDataSec(dataSecDsc* section)
{
printf("\n");
unsigned offset = 0;
for (dataSection* data = section->dsdList; data != nullptr; data = data->dsNext)
{
const char* labelFormat = "%-7s";
char label[64];
sprintf_s(label, ArrLen(label), "RWD%02u", offset);
printf(labelFormat, label);
offset += data->dsSize;
if ((data->dsType == dataSection::blockRelative32) || (data->dsType == dataSection::blockAbsoluteAddr))
{
insGroup* igFirst = static_cast<insGroup*>(emitCodeGetCookie(emitComp->fgFirstBB));
bool isRelative = (data->dsType == dataSection::blockRelative32);
size_t blockCount = data->dsSize / (isRelative ? 4 : TARGET_POINTER_SIZE);
for (unsigned i = 0; i < blockCount; i++)
{
if (i > 0)
{
printf(labelFormat, "");
}
BasicBlock* block = reinterpret_cast<BasicBlock**>(data->dsCont)[i];
insGroup* ig = static_cast<insGroup*>(emitCodeGetCookie(block));
const char* blockLabel = emitLabelString(ig);
const char* firstLabel = emitLabelString(igFirst);
if (isRelative)
{
if (emitComp->opts.disDiffable)
{
printf("\tdd\t%s - %s\n", blockLabel, firstLabel);
}
else
{
printf("\tdd\t%08Xh", ig->igOffs - igFirst->igOffs);
}
}
else
{
#ifndef TARGET_64BIT
// We have a 32-BIT target
if (emitComp->opts.disDiffable)
{
printf("\tdd\t%s\n", blockLabel);
}
else
{
printf("\tdd\t%08Xh", (uint32_t)(size_t)emitOffsetToPtr(ig->igOffs));
}
#else // TARGET_64BIT
// We have a 64-BIT target
if (emitComp->opts.disDiffable)
{
printf("\tdq\t%s\n", blockLabel);
}
else
{
printf("\tdq\t%016llXh", reinterpret_cast<uint64_t>(emitOffsetToPtr(ig->igOffs)));
}
#endif // TARGET_64BIT
}
if (!emitComp->opts.disDiffable)
{
printf(" ; case %s\n", blockLabel);
}
}
}
else
{
assert(data->dsType == dataSection::data);
unsigned elemSize = genTypeSize(data->dsDataType);
if (elemSize == 0)
{
if ((data->dsSize % 8) == 0)
{
elemSize = 8;
}
else if ((data->dsSize % 4) == 0)
{
elemSize = 4;
}
else if ((data->dsSize % 2) == 0)
{
elemSize = 2;
}
else
{
elemSize = 1;
}
}
unsigned i = 0;
unsigned j;
while (i < data->dsSize)
{
switch (data->dsDataType)
{
case TYP_FLOAT:
assert(data->dsSize >= 4);
printf("\tdd\t%08llXh\t", *reinterpret_cast<uint32_t*>(&data->dsCont[i]));
printf("\t; %9.6g", *reinterpret_cast<float*>(&data->dsCont[i]));
i += 4;
break;
case TYP_DOUBLE:
assert(data->dsSize >= 8);
printf("\tdq\t%016llXh", *reinterpret_cast<uint64_t*>(&data->dsCont[i]));
printf("\t; %12.9g", *reinterpret_cast<double*>(&data->dsCont[i]));
i += 8;
break;
default:
switch (elemSize)
{
case 1:
printf("\tdb\t%02Xh", *reinterpret_cast<uint8_t*>(&data->dsCont[i]));
for (j = 1; j < 16; j++)
{
if (i + j >= data->dsSize)
break;
printf(", %02Xh", *reinterpret_cast<uint8_t*>(&data->dsCont[i + j]));
}
i += j;
break;
case 2:
assert((data->dsSize % 2) == 0);
printf("\tdw\t%04Xh", *reinterpret_cast<uint16_t*>(&data->dsCont[i]));
for (j = 2; j < 24; j += 2)
{
if (i + j >= data->dsSize)
break;
printf(", %04Xh", *reinterpret_cast<uint16_t*>(&data->dsCont[i + j]));
}
i += j;
break;
case 12:
case 4:
assert((data->dsSize % 4) == 0);
printf("\tdd\t%08Xh", *reinterpret_cast<uint32_t*>(&data->dsCont[i]));
for (j = 4; j < 24; j += 4)
{
if (i + j >= data->dsSize)
break;
printf(", %08Xh", *reinterpret_cast<uint32_t*>(&data->dsCont[i + j]));
}
i += j;
break;
case 32:
case 16:
case 8:
assert((data->dsSize % 8) == 0);
printf("\tdq\t%016llXh", *reinterpret_cast<uint64_t*>(&data->dsCont[i]));
for (j = 8; j < 32; j += 8)
{
if (i + j >= data->dsSize)
break;
printf(", %016llXh", *reinterpret_cast<uint64_t*>(&data->dsCont[i + j]));
}
i += j;
break;
default:
assert(!"unexpected elemSize");
break;
}
}
printf("\n");
}
}
}
}
#endif
/*****************************************************************************/
/*****************************************************************************
*
* Record the fact that the given variable now contains a live GC ref.
*/
void emitter::emitGCvarLiveSet(int offs, GCtype gcType, BYTE* addr, ssize_t disp)
{
assert(emitIssuing);
varPtrDsc* desc;
assert((abs(offs) % TARGET_POINTER_SIZE) == 0);
assert(needsGC(gcType));
/* Compute the index into the GC frame table if the caller didn't do it */
if (disp == -1)
{
disp = (offs - emitGCrFrameOffsMin) / TARGET_POINTER_SIZE;
}
assert((size_t)disp < emitGCrFrameOffsCnt);
/* Allocate a lifetime record */
desc = new (emitComp, CMK_GC) varPtrDsc;
desc->vpdBegOfs = emitCurCodeOffs(addr);
#ifdef DEBUG
desc->vpdEndOfs = 0xFACEDEAD;
#endif
desc->vpdVarNum = offs;
desc->vpdNext = nullptr;
#if !defined(JIT32_GCENCODER) || !defined(FEATURE_EH_FUNCLETS)
/* the lower 2 bits encode props about the stk ptr */
if (offs == emitSyncThisObjOffs)
{
desc->vpdVarNum |= this_OFFSET_FLAG;
}
#endif
if (gcType == GCT_BYREF)
{
desc->vpdVarNum |= byref_OFFSET_FLAG;
}
/* Append the new entry to the end of the list */
if (codeGen->gcInfo.gcVarPtrLast == nullptr)
{
assert(codeGen->gcInfo.gcVarPtrList == nullptr);
codeGen->gcInfo.gcVarPtrList = codeGen->gcInfo.gcVarPtrLast = desc;
}
else
{
assert(codeGen->gcInfo.gcVarPtrList != nullptr);
codeGen->gcInfo.gcVarPtrLast->vpdNext = desc;
codeGen->gcInfo.gcVarPtrLast = desc;
}
/* Record the variable descriptor in the table */
assert(emitGCrFrameLiveTab[disp] == nullptr);
emitGCrFrameLiveTab[disp] = desc;
/* The "global" live GC variable mask is no longer up-to-date */
emitThisGCrefVset = false;
}
/*****************************************************************************
*
* Record the fact that the given variable no longer contains a live GC ref.
*/
void emitter::emitGCvarDeadSet(int offs, BYTE* addr, ssize_t disp)
{
assert(emitIssuing);
varPtrDsc* desc;
assert(abs(offs) % sizeof(int) == 0);
/* Compute the index into the GC frame table if the caller didn't do it */
if (disp == -1)
{
disp = (offs - emitGCrFrameOffsMin) / TARGET_POINTER_SIZE;
}
assert((unsigned)disp < emitGCrFrameOffsCnt);
/* Get hold of the lifetime descriptor and clear the entry */
desc = emitGCrFrameLiveTab[disp];
emitGCrFrameLiveTab[disp] = nullptr;
assert(desc);
assert((desc->vpdVarNum & ~OFFSET_MASK) == (unsigned)offs);
/* Record the death code offset */
assert(desc->vpdEndOfs == 0xFACEDEAD);
desc->vpdEndOfs = emitCurCodeOffs(addr);
/* The "global" live GC variable mask is no longer up-to-date */
emitThisGCrefVset = false;
}
/*****************************************************************************
*
* Record a new set of live GC ref variables.
*/
void emitter::emitUpdateLiveGCvars(VARSET_VALARG_TP vars, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
/* Is the current set accurate and unchanged? */
if (emitThisGCrefVset && VarSetOps::Equal(emitComp, emitThisGCrefVars, vars))
{
return;
}
#ifdef DEBUG
if (EMIT_GC_VERBOSE || emitComp->opts.disasmWithGC)
{
VarSetOps::Assign(emitComp, debugThisGCrefVars, vars);
}
#endif
VarSetOps::Assign(emitComp, emitThisGCrefVars, vars);
/* Are there any GC ref variables on the stack? */
if (emitGCrFrameOffsCnt)
{
int* tab;
unsigned cnt = emitTrkVarCnt;
unsigned num;
/* Test all the tracked variable bits in the mask */
for (num = 0, tab = emitGCrFrameOffsTab; num < cnt; num++, tab++)
{
int val = *tab;
if (val != -1)
{
// byref_OFFSET_FLAG and this_OFFSET_FLAG are set
// in the table-offsets for byrefs and this-ptr
int offs = val & ~OFFSET_MASK;
// printf("var #%2u at %3d is now %s\n", num, offs, (vars & 1) ? "live" : "dead");
if (VarSetOps::IsMember(emitComp, vars, num))
{
GCtype gcType = (val & byref_OFFSET_FLAG) ? GCT_BYREF : GCT_GCREF;
emitGCvarLiveUpd(offs, INT_MAX, gcType, addr DEBUG_ARG(num));
}
else
{
emitGCvarDeadUpd(offs, addr DEBUG_ARG(num));
}
}
}
}
emitThisGCrefVset = true;
}
/*****************************************************************************
*
* Record a call location for GC purposes (we know that this is a method that
* will not be fully interruptible).
*/
void emitter::emitRecordGCcall(BYTE* codePos, unsigned char callInstrSize)
{
assert(emitIssuing);
assert(!emitFullGCinfo);
unsigned offs = emitCurCodeOffs(codePos);
callDsc* call;
#ifdef JIT32_GCENCODER
unsigned regs = (emitThisGCrefRegs | emitThisByrefRegs) & ~RBM_INTRET;
// The JIT32 GCInfo encoder allows us to (as the comment previously here said):
// "Bail if this is a totally boring call", but the GCInfoEncoder/Decoder interface
// requires a definition for every call site, so we skip these "early outs" when we're
// using the general encoder.
if (regs == 0)
{
#if EMIT_TRACK_STACK_DEPTH
if (emitCurStackLvl == 0)
return;
#endif
/* Nope, only interesting calls get recorded */
if (emitSimpleStkUsed)
{
if (!u1.emitSimpleStkMask)
return;
}
else
{
if (u2.emitGcArgTrackCnt == 0)
return;
}
}
#endif // JIT32_GCENCODER
#ifdef DEBUG
if (EMIT_GC_VERBOSE)
{
printf("; Call at %04X [stk=%u], GCvars=", offs - callInstrSize, emitCurStackLvl);
emitDispVarSet();
printf(", gcrefRegs=");
printRegMaskInt(emitThisGCrefRegs);
emitDispRegSet(emitThisGCrefRegs);
// printRegMaskInt(emitThisGCrefRegs & ~RBM_INTRET & RBM_CALLEE_SAVED); // only display callee-saved
// emitDispRegSet (emitThisGCrefRegs & ~RBM_INTRET & RBM_CALLEE_SAVED); // only display callee-saved
printf(", byrefRegs=");
printRegMaskInt(emitThisByrefRegs);
emitDispRegSet(emitThisByrefRegs);
// printRegMaskInt(emitThisByrefRegs & ~RBM_INTRET & RBM_CALLEE_SAVED); // only display callee-saved
// emitDispRegSet (emitThisByrefRegs & ~RBM_INTRET & RBM_CALLEE_SAVED); // only display callee-saved
printf("\n");
}
#endif
/* Allocate a 'call site' descriptor and start filling it in */
call = new (emitComp, CMK_GC) callDsc;
call->cdBlock = nullptr;
call->cdOffs = offs;
#ifndef JIT32_GCENCODER
call->cdCallInstrSize = callInstrSize;
#endif
call->cdNext = nullptr;
call->cdGCrefRegs = (regMaskSmall)emitThisGCrefRegs;
call->cdByrefRegs = (regMaskSmall)emitThisByrefRegs;
#if EMIT_TRACK_STACK_DEPTH
#ifndef UNIX_AMD64_ABI
noway_assert(FitsIn<USHORT>(emitCurStackLvl / ((unsigned)sizeof(unsigned))));
#endif // UNIX_AMD64_ABI
#endif
// Append the call descriptor to the list */
if (codeGen->gcInfo.gcCallDescLast == nullptr)
{
assert(codeGen->gcInfo.gcCallDescList == nullptr);
codeGen->gcInfo.gcCallDescList = codeGen->gcInfo.gcCallDescLast = call;
}
else
{
assert(codeGen->gcInfo.gcCallDescList != nullptr);
codeGen->gcInfo.gcCallDescLast->cdNext = call;
codeGen->gcInfo.gcCallDescLast = call;
}
/* Record the current "pending" argument list */
if (emitSimpleStkUsed)
{
/* The biggest call is less than MAX_SIMPLE_STK_DEPTH. So use
small format */
call->u1.cdArgMask = u1.emitSimpleStkMask;
call->u1.cdByrefArgMask = u1.emitSimpleByrefStkMask;
call->cdArgCnt = 0;
}
else
{
/* The current call has too many arguments, so we need to report the
offsets of each individual GC arg. */
call->cdArgCnt = u2.emitGcArgTrackCnt;
if (call->cdArgCnt == 0)
{
call->u1.cdArgMask = call->u1.cdByrefArgMask = 0;
return;
}
call->cdArgTable = new (emitComp, CMK_GC) unsigned[u2.emitGcArgTrackCnt];
unsigned gcArgs = 0;
unsigned stkLvl = emitCurStackLvl / sizeof(int);
for (unsigned i = 0; i < stkLvl; i++)
{
GCtype gcType = (GCtype)u2.emitArgTrackTab[stkLvl - i - 1];
if (needsGC(gcType))
{
call->cdArgTable[gcArgs] = i * TARGET_POINTER_SIZE;
if (gcType == GCT_BYREF)
{
call->cdArgTable[gcArgs] |= byref_OFFSET_FLAG;
}
gcArgs++;
}
}
assert(gcArgs == u2.emitGcArgTrackCnt);
}
}
/*****************************************************************************
*
* Record a new set of live GC ref registers.
*/
void emitter::emitUpdateLiveGCregs(GCtype gcType, regMaskTP regs, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
regMaskTP life;
regMaskTP dead;
regMaskTP chg;
assert(needsGC(gcType));
regMaskTP& emitThisXXrefRegs = (gcType == GCT_GCREF) ? emitThisGCrefRegs : emitThisByrefRegs;
regMaskTP& emitThisYYrefRegs = (gcType == GCT_GCREF) ? emitThisByrefRegs : emitThisGCrefRegs;
assert(emitThisXXrefRegs != regs);
if (emitFullGCinfo)
{
/* Figure out which GC registers are becoming live/dead at this point */
dead = (emitThisXXrefRegs & ~regs);
life = (~emitThisXXrefRegs & regs);
/* Can't simultaneously become live and dead at the same time */
assert((dead | life) != 0);
assert((dead & life) == 0);
/* Compute the 'changing state' mask */
chg = (dead | life);
do
{
regMaskTP bit = genFindLowestBit(chg);
regNumber reg = genRegNumFromMask(bit);
if (life & bit)
{
emitGCregLiveUpd(gcType, reg, addr);
}
else
{
emitGCregDeadUpd(reg, addr);
}
chg -= bit;
} while (chg);
assert(emitThisXXrefRegs == regs);
}
else
{
emitThisYYrefRegs &= ~regs; // Kill the regs from the other GC type (if live)
emitThisXXrefRegs = regs; // Mark them as live in the requested GC type
}
// The 2 GC reg masks can't be overlapping
assert((emitThisGCrefRegs & emitThisByrefRegs) == 0);
}
/*****************************************************************************
*
* Record the fact that the given register now contains a live GC ref.
*/
void emitter::emitGCregLiveSet(GCtype gcType, regMaskTP regMask, BYTE* addr, bool isThis)
{
assert(emitIssuing);
assert(needsGC(gcType));
regPtrDsc* regPtrNext;
assert(!isThis || emitComp->lvaKeepAliveAndReportThis());
// assert(emitFullyInt || isThis);
assert(emitFullGCinfo);
assert(((emitThisGCrefRegs | emitThisByrefRegs) & regMask) == 0);
/* Allocate a new regptr entry and fill it in */
regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = gcType;
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdArg = false;
regPtrNext->rpdCall = false;
regPtrNext->rpdIsThis = isThis;
regPtrNext->rpdCompiler.rpdAdd = (regMaskSmall)regMask;
regPtrNext->rpdCompiler.rpdDel = 0;
}
/*****************************************************************************
*
* Record the fact that the given register no longer contains a live GC ref.
*/
void emitter::emitGCregDeadSet(GCtype gcType, regMaskTP regMask, BYTE* addr)
{
assert(emitIssuing);
assert(needsGC(gcType));
regPtrDsc* regPtrNext;
// assert(emitFullyInt);
assert(emitFullGCinfo);
assert(((emitThisGCrefRegs | emitThisByrefRegs) & regMask) != 0);
/* Allocate a new regptr entry and fill it in */
regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = gcType;
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdCall = false;
regPtrNext->rpdIsThis = false;
regPtrNext->rpdArg = false;
regPtrNext->rpdCompiler.rpdAdd = 0;
regPtrNext->rpdCompiler.rpdDel = (regMaskSmall)regMask;
}
/*****************************************************************************
*
* Emit an 8-bit integer as code.
*/
unsigned char emitter::emitOutputByte(BYTE* dst, ssize_t val)
{
BYTE* dstRW = dst + writeableOffset;
*castto(dstRW, unsigned char*) = (unsigned char)val;
#ifdef DEBUG
#ifdef TARGET_AMD64
// if we're emitting code bytes, ensure that we've already emitted the rex prefix!
assert(((val & 0xFF00000000LL) == 0) || ((val & 0xFFFFFFFF00000000LL) == 0xFFFFFFFF00000000LL));
#endif // TARGET_AMD64
#endif
return sizeof(unsigned char);
}
/*****************************************************************************
*
* Emit a 16-bit integer as code.
*/
unsigned char emitter::emitOutputWord(BYTE* dst, ssize_t val)
{
BYTE* dstRW = dst + writeableOffset;
MISALIGNED_WR_I2(dstRW, (short)val);
#ifdef DEBUG
#ifdef TARGET_AMD64
// if we're emitting code bytes, ensure that we've already emitted the rex prefix!
assert(((val & 0xFF00000000LL) == 0) || ((val & 0xFFFFFFFF00000000LL) == 0xFFFFFFFF00000000LL));
#endif // TARGET_AMD64
#endif
return sizeof(short);
}
/*****************************************************************************
*
* Emit a 32-bit integer as code.
*/
unsigned char emitter::emitOutputLong(BYTE* dst, ssize_t val)
{
BYTE* dstRW = dst + writeableOffset;
MISALIGNED_WR_I4(dstRW, (int)val);
#ifdef DEBUG
#ifdef TARGET_AMD64
// if we're emitting code bytes, ensure that we've already emitted the rex prefix!
assert(((val & 0xFF00000000LL) == 0) || ((val & 0xFFFFFFFF00000000LL) == 0xFFFFFFFF00000000LL));
#endif // TARGET_AMD64
#endif
return sizeof(int);
}
/*****************************************************************************
*
* Emit a pointer-sized integer as code.
*/
unsigned char emitter::emitOutputSizeT(BYTE* dst, ssize_t val)
{
BYTE* dstRW = dst + writeableOffset;
#if !defined(TARGET_64BIT)
MISALIGNED_WR_I4(dstRW, (int)val);
#else
MISALIGNED_WR_ST(dstRW, val);
#endif
return TARGET_POINTER_SIZE;
}
//------------------------------------------------------------------------
// Wrappers to emitOutputByte, emitOutputWord, emitOutputLong, emitOutputSizeT
// that take unsigned __int64 or size_t type instead of ssize_t. Used on RyuJIT/x86.
//
// Arguments:
// dst - passed through
// val - passed through
//
// Return Value:
// Same as wrapped function.
//
#if !defined(HOST_64BIT)
#if defined(TARGET_X86)
unsigned char emitter::emitOutputByte(BYTE* dst, size_t val)
{
return emitOutputByte(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputWord(BYTE* dst, size_t val)
{
return emitOutputWord(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputLong(BYTE* dst, size_t val)
{
return emitOutputLong(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputSizeT(BYTE* dst, size_t val)
{
return emitOutputSizeT(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputByte(BYTE* dst, unsigned __int64 val)
{
return emitOutputByte(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputWord(BYTE* dst, unsigned __int64 val)
{
return emitOutputWord(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputLong(BYTE* dst, unsigned __int64 val)
{
return emitOutputLong(dst, (ssize_t)val);
}
unsigned char emitter::emitOutputSizeT(BYTE* dst, unsigned __int64 val)
{
return emitOutputSizeT(dst, (ssize_t)val);
}
#endif // defined(TARGET_X86)
#endif // !defined(HOST_64BIT)
/*****************************************************************************
*
* Given a block cookie and a code position, return the actual code offset;
* this can only be called at the end of code generation.
*/
UNATIVE_OFFSET emitter::emitCodeOffset(void* blockPtr, unsigned codePos)
{
insGroup* ig;
UNATIVE_OFFSET of;
unsigned no = emitGetInsNumFromCodePos(codePos);
/* Make sure we weren't passed some kind of a garbage thing */
ig = (insGroup*)blockPtr;
#ifdef DEBUG
assert(ig && ig->igSelf == ig);
#endif
/* The first and last offsets are always easy */
if (no == 0)
{
of = 0;
}
else if (no == ig->igInsCnt)
{
of = ig->igSize;
}
else if (ig->igFlags & IGF_UPD_ISZ)
{
/*
Some instruction sizes have changed, so we'll have to figure
out the instruction offset "the hard way".
*/
of = emitFindOffset(ig, no);
}
else
{
/* All instructions correctly predicted, the offset stays the same */
of = emitGetInsOfsFromCodePos(codePos);
// printf("[IG=%02u;ID=%03u;OF=%04X] <= %08X\n", ig->igNum, emitGetInsNumFromCodePos(codePos), of, codePos);
/* Make sure the offset estimate is accurate */
assert(of == emitFindOffset(ig, emitGetInsNumFromCodePos(codePos)));
}
return ig->igOffs + of;
}
/*****************************************************************************
*
* Record the fact that the given register now contains a live GC ref.
*/
void emitter::emitGCregLiveUpd(GCtype gcType, regNumber reg, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
assert(needsGC(gcType));
regMaskTP regMask = genRegMask(reg);
regMaskTP& emitThisXXrefRegs = (gcType == GCT_GCREF) ? emitThisGCrefRegs : emitThisByrefRegs;
regMaskTP& emitThisYYrefRegs = (gcType == GCT_GCREF) ? emitThisByrefRegs : emitThisGCrefRegs;
if ((emitThisXXrefRegs & regMask) == 0)
{
// If the register was holding the other GC type, that type should
// go dead now
if (emitThisYYrefRegs & regMask)
{
emitGCregDeadUpd(reg, addr);
}
// For synchronized methods, "this" is always alive and in the same register.
// However, if we generate any code after the epilog block (where "this"
// goes dead), "this" will come alive again. We need to notice that.
// Note that we only expect isThis to be true at an insGroup boundary.
bool isThis = (reg == emitSyncThisObjReg) ? true : false;
if (emitFullGCinfo)
{
emitGCregLiveSet(gcType, regMask, addr, isThis);
}
emitThisXXrefRegs |= regMask;
}
// The 2 GC reg masks can't be overlapping
assert((emitThisGCrefRegs & emitThisByrefRegs) == 0);
}
/*****************************************************************************
*
* Record the fact that the given set of registers no longer contain live GC refs.
*/
void emitter::emitGCregDeadUpdMask(regMaskTP regs, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
// First, handle the gcref regs going dead
regMaskTP gcrefRegs = emitThisGCrefRegs & regs;
// "this" can never go dead in synchronized methods, except in the epilog
// after the call to CORINFO_HELP_MON_EXIT.
assert(emitSyncThisObjReg == REG_NA || (genRegMask(emitSyncThisObjReg) & regs) == 0);
if (gcrefRegs)
{
assert((emitThisByrefRegs & gcrefRegs) == 0);
if (emitFullGCinfo)
{
emitGCregDeadSet(GCT_GCREF, gcrefRegs, addr);
}
emitThisGCrefRegs &= ~gcrefRegs;
}
// Second, handle the byref regs going dead
regMaskTP byrefRegs = emitThisByrefRegs & regs;
if (byrefRegs)
{
assert((emitThisGCrefRegs & byrefRegs) == 0);
if (emitFullGCinfo)
{
emitGCregDeadSet(GCT_BYREF, byrefRegs, addr);
}
emitThisByrefRegs &= ~byrefRegs;
}
}
/*****************************************************************************
*
* Record the fact that the given register no longer contains a live GC ref.
*/
void emitter::emitGCregDeadUpd(regNumber reg, BYTE* addr)
{
assert(emitIssuing);
// Don't track GC changes in epilogs
if (emitIGisInEpilog(emitCurIG))
{
return;
}
regMaskTP regMask = genRegMask(reg);
if ((emitThisGCrefRegs & regMask) != 0)
{
assert((emitThisByrefRegs & regMask) == 0);
if (emitFullGCinfo)
{
emitGCregDeadSet(GCT_GCREF, regMask, addr);
}
emitThisGCrefRegs &= ~regMask;
}
else if ((emitThisByrefRegs & regMask) != 0)
{
if (emitFullGCinfo)
{
emitGCregDeadSet(GCT_BYREF, regMask, addr);
}
emitThisByrefRegs &= ~regMask;
}
}
/*****************************************************************************
*
* Record the fact that the given variable now contains a live GC ref.
* varNum may be INT_MAX or negative (indicating a spill temp) only if
* offs is guaranteed to be the offset of a tracked GC ref. Else we
* need a valid value to check if the variable is tracked or not.
*/
void emitter::emitGCvarLiveUpd(int offs, int varNum, GCtype gcType, BYTE* addr DEBUG_ARG(unsigned actualVarNum))
{
assert(abs(offs) % sizeof(int) == 0);
assert(needsGC(gcType));
#if FEATURE_FIXED_OUT_ARGS
if ((unsigned)varNum == emitComp->lvaOutgoingArgSpaceVar)
{
if (emitFullGCinfo)
{
/* Append an "arg push" entry to track a GC written to the
outgoing argument space.
Allocate a new ptr arg entry and fill it in */
regPtrDsc* regPtrNext = gcInfo->gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = gcType;
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdArg = true;
regPtrNext->rpdCall = false;
noway_assert(FitsIn<unsigned short>(offs));
regPtrNext->rpdPtrArg = (unsigned short)offs;
regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_PUSH;
regPtrNext->rpdIsThis = false;
}
}
else
#endif // FEATURE_FIXED_OUT_ARGS
{
/* Is the frame offset within the "interesting" range? */
if (offs >= emitGCrFrameOffsMin && offs < emitGCrFrameOffsMax)
{
/* Normally all variables in this range must be tracked stack
pointers. However, for EnC, we relax this condition. So we
must check if this is not such a variable.
Note that varNum might be negative, indicating a spill temp.
*/
if (varNum != INT_MAX)
{
bool isTracked = false;
if (varNum >= 0)
{
// This is NOT a spill temp
const LclVarDsc* varDsc = emitComp->lvaGetDesc(varNum);
isTracked = emitComp->lvaIsGCTracked(varDsc);
}
if (!isTracked)
{
#if DOUBLE_ALIGN
assert(!emitContTrkPtrLcls ||
// EBP based variables in the double-aligned frames are indeed input arguments.
// and we don't require them to fall into the "interesting" range.
((emitComp->rpFrameType == FT_DOUBLE_ALIGN_FRAME) && (varNum >= 0) &&
(emitComp->lvaTable[varNum].lvFramePointerBased == 1)));
#else
assert(!emitContTrkPtrLcls);
#endif
return;
}
}
size_t disp;
/* Compute the index into the GC frame table */
disp = (offs - emitGCrFrameOffsMin) / TARGET_POINTER_SIZE;
assert(disp < emitGCrFrameOffsCnt);
/* If the variable is currently dead, mark it as live */
if (emitGCrFrameLiveTab[disp] == nullptr)
{
emitGCvarLiveSet(offs, gcType, addr, disp);
#ifdef DEBUG
if ((EMIT_GC_VERBOSE || emitComp->opts.disasmWithGC) && (actualVarNum < emitComp->lvaCount) &&
emitComp->lvaGetDesc(actualVarNum)->lvTracked)
{
VarSetOps::AddElemD(emitComp, debugThisGCrefVars, emitComp->lvaGetDesc(actualVarNum)->lvVarIndex);
}
#endif
}
}
}
}
/*****************************************************************************
*
* Record the fact that the given variable no longer contains a live GC ref.
*/
void emitter::emitGCvarDeadUpd(int offs, BYTE* addr DEBUG_ARG(unsigned varNum))
{
assert(emitIssuing);
assert(abs(offs) % sizeof(int) == 0);
/* Is the frame offset within the "interesting" range? */
if (offs >= emitGCrFrameOffsMin && offs < emitGCrFrameOffsMax)
{
size_t disp;
/* Compute the index into the GC frame table */
disp = (offs - emitGCrFrameOffsMin) / TARGET_POINTER_SIZE;
assert(disp < emitGCrFrameOffsCnt);
/* If the variable is currently live, mark it as dead */
if (emitGCrFrameLiveTab[disp] != nullptr)
{
assert(!emitComp->lvaKeepAliveAndReportThis() || (offs != emitSyncThisObjOffs));
emitGCvarDeadSet(offs, addr, disp);
#ifdef DEBUG
if ((EMIT_GC_VERBOSE || emitComp->opts.disasmWithGC) && (varNum < emitComp->lvaCount) &&
emitComp->lvaGetDesc(varNum)->lvTracked)
{
VarSetOps::RemoveElemD(emitComp, debugThisGCrefVars, emitComp->lvaGetDesc(varNum)->lvVarIndex);
}
#endif
}
}
}
/*****************************************************************************
*
* Allocate a new IG and link it in to the global list after the current IG
*/
insGroup* emitter::emitAllocAndLinkIG()
{
insGroup* ig = emitAllocIG();
assert(emitCurIG);
emitInsertIGAfter(emitCurIG, ig);
/* Propagate some IG flags from the current group to the new group */
ig->igFlags |= (emitCurIG->igFlags & IGF_PROPAGATE_MASK);
/* Set the new IG as the current IG */
emitCurIG = ig;
return ig;
}
/*****************************************************************************
*
* Allocate an instruction group descriptor and assign it the next index.
*/
insGroup* emitter::emitAllocIG()
{
insGroup* ig;
/* Allocate a group descriptor */
size_t sz = sizeof(insGroup);
ig = (insGroup*)emitGetMem(sz);
#ifdef DEBUG
ig->igSelf = ig;
#endif
#if EMITTER_STATS
emitTotalIGcnt += 1;
emitTotalIGsize += sz;
emitSizeMethod += sz;
#endif
/* Do basic initialization */
emitInitIG(ig);
return ig;
}
/*****************************************************************************
*
* Initialize an instruction group
*/
void emitter::emitInitIG(insGroup* ig)
{
/* Assign the next available index to the instruction group */
ig->igNum = emitNxtIGnum;
emitNxtIGnum++;
/* Record the (estimated) code offset of the group */
ig->igOffs = emitCurCodeOffset;
assert(IsCodeAligned(ig->igOffs));
/* Set the current function index */
ig->igFuncIdx = emitComp->compCurrFuncIdx;
ig->igFlags = 0;
#if defined(DEBUG) || defined(LATE_DISASM)
ig->igWeight = getCurrentBlockWeight();
ig->igPerfScore = 0.0;
#endif
/* Zero out some fields to avoid printing garbage in JitDumps. These
really only need to be set in DEBUG, but do it in all cases to make
sure we act the same in non-DEBUG builds.
*/
ig->igSize = 0;
ig->igGCregs = RBM_NONE;
ig->igInsCnt = 0;
#if FEATURE_LOOP_ALIGN
ig->igLoopBackEdge = nullptr;
#endif
#ifdef DEBUG
ig->lastGeneratedBlock = nullptr;
// Explicitly call init, since IGs don't actually have a constructor.
ig->igBlocks.jitstd::list<BasicBlock*>::init(emitComp->getAllocator(CMK_LoopOpt));
#endif
}
/*****************************************************************************
*
* Insert instruction group 'ig' after 'igInsertAfterIG'
*/
void emitter::emitInsertIGAfter(insGroup* insertAfterIG, insGroup* ig)
{
assert(emitIGlist);
assert(emitIGlast);
ig->igNext = insertAfterIG->igNext;
insertAfterIG->igNext = ig;
if (emitIGlast == insertAfterIG)
{
// If we are inserting at the end, then update the 'last' pointer
emitIGlast = ig;
}
}
/*****************************************************************************
*
* Save the current IG and start a new one.
*/
void emitter::emitNxtIG(bool extend)
{
/* Right now we don't allow multi-IG prologs */
assert(emitCurIG != emitPrologIG);
/* First save the current group */
emitSavIG(extend);
/* Update the GC live sets for the group's start
* Do it only if not an extension block */
if (!extend)
{
VarSetOps::Assign(emitComp, emitInitGCrefVars, emitThisGCrefVars);
emitInitGCrefRegs = emitThisGCrefRegs;
emitInitByrefRegs = emitThisByrefRegs;
}
/* Start generating the new group */
emitNewIG();
/* If this is an emitter added block, flag it */
if (extend)
{
emitCurIG->igFlags |= IGF_EXTEND;
#if EMITTER_STATS
emitTotalIGExtend++;
#endif // EMITTER_STATS
}
// We've created a new IG; no need to force another one.
emitForceNewIG = false;
#ifdef DEBUG
// We haven't written any code into the IG yet, so clear our record of the last block written to the IG.
emitCurIG->lastGeneratedBlock = nullptr;
#endif
}
/*****************************************************************************
*
* emitGetInsSC: Get the instruction's constant value.
*/
cnsval_ssize_t emitter::emitGetInsSC(instrDesc* id)
{
#ifdef TARGET_ARM // should it be TARGET_ARMARCH? Why do we need this? Note that on ARM64 we store scaled immediates
// for some formats
if (id->idIsLclVar())
{
int varNum = id->idAddr()->iiaLclVar.lvaVarNum();
regNumber baseReg;
int offs = id->idAddr()->iiaLclVar.lvaOffset();
#if defined(TARGET_ARM)
int adr =
emitComp->lvaFrameAddress(varNum, id->idIsLclFPBase(), &baseReg, offs, CodeGen::instIsFP(id->idIns()));
int dsp = adr + offs;
if ((id->idIns() == INS_sub) || (id->idIns() == INS_subw))
dsp = -dsp;
#elif defined(TARGET_ARM64)
// TODO-ARM64-Cleanup: this is currently unreachable. Do we need it?
bool FPbased;
int adr = emitComp->lvaFrameAddress(varNum, &FPbased);
int dsp = adr + offs;
if (id->idIns() == INS_sub)
dsp = -dsp;
#endif
return dsp;
}
else
#endif // TARGET_ARM
if (id->idIsLargeCns())
{
return ((instrDescCns*)id)->idcCnsVal;
}
else
{
return id->idSmallCns();
}
}
#ifdef TARGET_ARM
BYTE* emitter::emitGetInsRelocValue(instrDesc* id)
{
return ((instrDescReloc*)id)->idrRelocVal;
}
#endif // TARGET_ARM
/*****************************************************************************/
#if EMIT_TRACK_STACK_DEPTH
/*****************************************************************************
*
* Record a push of a single dword on the stack.
*/
void emitter::emitStackPush(BYTE* addr, GCtype gcType)
{
#ifdef DEBUG
assert(IsValidGCtype(gcType));
#endif
if (emitSimpleStkUsed)
{
assert(!emitFullGCinfo); // Simple stk not used for emitFullGCinfo
assert(emitCurStackLvl / sizeof(int) < MAX_SIMPLE_STK_DEPTH);
u1.emitSimpleStkMask <<= 1;
u1.emitSimpleStkMask |= (unsigned)needsGC(gcType);
u1.emitSimpleByrefStkMask <<= 1;
u1.emitSimpleByrefStkMask |= (gcType == GCT_BYREF);
assert((u1.emitSimpleStkMask & u1.emitSimpleByrefStkMask) == u1.emitSimpleByrefStkMask);
}
else
{
emitStackPushLargeStk(addr, gcType);
}
emitCurStackLvl += sizeof(int);
}
/*****************************************************************************
*
* Record a push of a bunch of non-GC dwords on the stack.
*/
void emitter::emitStackPushN(BYTE* addr, unsigned count)
{
assert(count);
if (emitSimpleStkUsed)
{
assert(!emitFullGCinfo); // Simple stk not used for emitFullGCinfo
u1.emitSimpleStkMask <<= count;
u1.emitSimpleByrefStkMask <<= count;
}
else
{
emitStackPushLargeStk(addr, GCT_NONE, count);
}
emitCurStackLvl += count * sizeof(int);
}
/*****************************************************************************
*
* Record a pop of the given number of dwords from the stack.
*/
void emitter::emitStackPop(BYTE* addr, bool isCall, unsigned char callInstrSize, unsigned count)
{
assert(emitCurStackLvl / sizeof(int) >= count);
assert(!isCall || callInstrSize > 0);
if (count)
{
if (emitSimpleStkUsed)
{
assert(!emitFullGCinfo); // Simple stk not used for emitFullGCinfo
unsigned cnt = count;
do
{
u1.emitSimpleStkMask >>= 1;
u1.emitSimpleByrefStkMask >>= 1;
} while (--cnt);
}
else
{
emitStackPopLargeStk(addr, isCall, callInstrSize, count);
}
emitCurStackLvl -= count * sizeof(int);
}
else
{
assert(isCall);
// For the general encoder we do the call below always when it's a call, to ensure that the call is
// recorded (when we're doing the ptr reg map for a non-fully-interruptible method).
if (emitFullGCinfo
#ifndef JIT32_GCENCODER
|| (emitComp->IsFullPtrRegMapRequired() && (!emitComp->GetInterruptible()) && isCall)
#endif // JIT32_GCENCODER
)
{
emitStackPopLargeStk(addr, isCall, callInstrSize, 0);
}
}
}
/*****************************************************************************
*
* Record a push of a single word on the stack for a full pointer map.
*/
void emitter::emitStackPushLargeStk(BYTE* addr, GCtype gcType, unsigned count)
{
S_UINT32 level(emitCurStackLvl / sizeof(int));
assert(IsValidGCtype(gcType));
assert(count);
assert(!emitSimpleStkUsed);
do
{
/* Push an entry for this argument on the tracking stack */
// printf("Pushed [%d] at lvl %2u [max=%u]\n", isGCref, emitArgTrackTop - emitArgTrackTab, emitMaxStackDepth);
assert(level.IsOverflow() || u2.emitArgTrackTop == u2.emitArgTrackTab + level.Value());
*u2.emitArgTrackTop++ = (BYTE)gcType;
assert(u2.emitArgTrackTop <= u2.emitArgTrackTab + emitMaxStackDepth);
if (emitFullArgInfo || needsGC(gcType))
{
if (emitFullGCinfo)
{
/* Append an "arg push" entry if this is a GC ref or
FPO method. Allocate a new ptr arg entry and fill it in */
regPtrDsc* regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = gcType;
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdArg = true;
regPtrNext->rpdCall = false;
if (level.IsOverflow() || !FitsIn<unsigned short>(level.Value()))
{
IMPL_LIMITATION("Too many/too big arguments to encode GC information");
}
regPtrNext->rpdPtrArg = (unsigned short)level.Value();
regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_PUSH;
regPtrNext->rpdIsThis = false;
}
/* This is an "interesting" argument push */
u2.emitGcArgTrackCnt++;
}
level += 1;
assert(!level.IsOverflow());
} while (--count);
}
/*****************************************************************************
*
* Record a pop of the given number of words from the stack for a full ptr
* map.
*/
void emitter::emitStackPopLargeStk(BYTE* addr, bool isCall, unsigned char callInstrSize, unsigned count)
{
assert(emitIssuing);
unsigned argStkCnt;
S_UINT16 argRecCnt(0); // arg count for ESP, ptr-arg count for EBP
unsigned gcrefRegs, byrefRegs;
#ifdef JIT32_GCENCODER
// For the general encoder, we always need to record calls, so we make this call
// even when emitSimpleStkUsed is true.
assert(!emitSimpleStkUsed);
#endif
/* Count how many pointer records correspond to this "pop" */
for (argStkCnt = count; argStkCnt; argStkCnt--)
{
assert(u2.emitArgTrackTop > u2.emitArgTrackTab);
GCtype gcType = (GCtype)(*--u2.emitArgTrackTop);
assert(IsValidGCtype(gcType));
// printf("Popped [%d] at lvl %u\n", GCtypeStr(gcType), emitArgTrackTop - emitArgTrackTab);
// This is an "interesting" argument
if (emitFullArgInfo || needsGC(gcType))
{
argRecCnt += 1;
}
}
assert(u2.emitArgTrackTop >= u2.emitArgTrackTab);
assert(u2.emitArgTrackTop == u2.emitArgTrackTab + emitCurStackLvl / sizeof(int) - count);
noway_assert(!argRecCnt.IsOverflow());
/* We're about to pop the corresponding arg records */
u2.emitGcArgTrackCnt -= argRecCnt.Value();
#ifdef JIT32_GCENCODER
// For the general encoder, we always have to record calls, so we don't take this early return.
if (!emitFullGCinfo)
return;
#endif
// Do we have any interesting (i.e., callee-saved) registers live here?
gcrefRegs = byrefRegs = 0;
// We make a bitmask whose bits correspond to callee-saved register indices (in the sequence
// of callee-saved registers only).
for (unsigned calleeSavedRegIdx = 0; calleeSavedRegIdx < CNT_CALLEE_SAVED; calleeSavedRegIdx++)
{
regMaskTP calleeSavedRbm = raRbmCalleeSaveOrder[calleeSavedRegIdx];
if (emitThisGCrefRegs & calleeSavedRbm)
{
gcrefRegs |= (1 << calleeSavedRegIdx);
}
if (emitThisByrefRegs & calleeSavedRbm)
{
byrefRegs |= (1 << calleeSavedRegIdx);
}
}
#ifdef JIT32_GCENCODER
// For the general encoder, we always have to record calls, so we don't take this early return. /* Are there any
// args to pop at this call site?
if (argRecCnt.Value() == 0)
{
/*
Or do we have a partially interruptible EBP-less frame, and any
of EDI,ESI,EBX,EBP are live, or is there an outer/pending call?
*/
CLANG_FORMAT_COMMENT_ANCHOR;
#if !FPO_INTERRUPTIBLE
if (emitFullyInt || (gcrefRegs == 0 && byrefRegs == 0 && u2.emitGcArgTrackCnt == 0))
#endif
return;
}
#endif // JIT32_GCENCODER
/* Only calls may pop more than one value */
// More detail:
// _cdecl calls accomplish this popping via a post-call-instruction SP adjustment.
// The "rpdCall" field below should be interpreted as "the instruction accomplishes
// call-related popping, even if it's not itself a call". Therefore, we don't just
// use the "isCall" input argument, which means that the instruction actually is a call --
// we use the OR of "isCall" or the "pops more than one value."
bool isCallRelatedPop = (argRecCnt.Value() > 1);
/* Allocate a new ptr arg entry and fill it in */
regPtrDsc* regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = GCT_GCREF; // Pops need a non-0 value (??)
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdCall = (isCall || isCallRelatedPop);
#ifndef JIT32_GCENCODER
if (regPtrNext->rpdCall)
{
assert(isCall || callInstrSize == 0);
regPtrNext->rpdCallInstrSize = callInstrSize;
}
#endif
regPtrNext->rpdCallGCrefRegs = gcrefRegs;
regPtrNext->rpdCallByrefRegs = byrefRegs;
regPtrNext->rpdArg = true;
regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_POP;
regPtrNext->rpdPtrArg = argRecCnt.Value();
}
/*****************************************************************************
* For caller-pop arguments, we report the arguments as pending arguments.
* However, any GC arguments are now dead, so we need to report them
* as non-GC.
*/
void emitter::emitStackKillArgs(BYTE* addr, unsigned count, unsigned char callInstrSize)
{
assert(count > 0);
if (emitSimpleStkUsed)
{
assert(!emitFullGCinfo); // Simple stk not used for emitFullGCInfo
/* We don't need to report this to the GC info, but we do need
to kill mark the ptrs on the stack as non-GC */
assert(emitCurStackLvl / sizeof(int) >= count);
for (unsigned lvl = 0; lvl < count; lvl++)
{
u1.emitSimpleStkMask &= ~(1 << lvl);
u1.emitSimpleByrefStkMask &= ~(1 << lvl);
}
}
else
{
BYTE* argTrackTop = u2.emitArgTrackTop;
S_UINT16 gcCnt(0);
for (unsigned i = 0; i < count; i++)
{
assert(argTrackTop > u2.emitArgTrackTab);
--argTrackTop;
GCtype gcType = (GCtype)(*argTrackTop);
assert(IsValidGCtype(gcType));
if (needsGC(gcType))
{
// printf("Killed %s at lvl %u\n", GCtypeStr(gcType), argTrackTop - emitArgTrackTab);
*argTrackTop = GCT_NONE;
gcCnt += 1;
}
}
noway_assert(!gcCnt.IsOverflow());
/* We're about to kill the corresponding (pointer) arg records */
if (!emitFullArgInfo)
{
u2.emitGcArgTrackCnt -= gcCnt.Value();
}
if (!emitFullGCinfo)
{
return;
}
/* Right after the call, the arguments are still sitting on the
stack, but they are effectively dead. For fully-interruptible
methods, we need to report that */
if (gcCnt.Value())
{
/* Allocate a new ptr arg entry and fill it in */
regPtrDsc* regPtrNext = codeGen->gcInfo.gcRegPtrAllocDsc();
regPtrNext->rpdGCtype = GCT_GCREF; // Kills need a non-0 value (??)
regPtrNext->rpdOffs = emitCurCodeOffs(addr);
regPtrNext->rpdArg = TRUE;
regPtrNext->rpdArgType = (unsigned short)GCInfo::rpdARG_KILL;
regPtrNext->rpdPtrArg = gcCnt.Value();
}
/* Now that ptr args have been marked as non-ptrs, we need to record
the call itself as one that has no arguments. */
emitStackPopLargeStk(addr, true, callInstrSize, 0);
}
}
/*****************************************************************************
* A helper for recording a relocation with the EE.
*/
#ifdef DEBUG
void emitter::emitRecordRelocationHelp(void* location, /* IN */
void* target, /* IN */
uint16_t fRelocType, /* IN */
const char* relocTypeName, /* IN */
int32_t addlDelta /* = 0 */) /* IN */
#else // !DEBUG
void emitter::emitRecordRelocation(void* location, /* IN */
void* target, /* IN */
uint16_t fRelocType, /* IN */
int32_t addlDelta /* = 0 */) /* IN */
#endif // !DEBUG
{
void* locationRW = (BYTE*)location + writeableOffset;
JITDUMP("recordRelocation: %p (rw: %p) => %p, type %u (%s), delta %d\n", dspPtr(location), dspPtr(locationRW),
dspPtr(target), fRelocType, relocTypeName, addlDelta);
// If we're an unmatched altjit, don't tell the VM anything. We still record the relocation for
// late disassembly; maybe we'll need it?
if (emitComp->info.compMatchedVM)
{
// slotNum is unused on all supported platforms.
emitCmpHandle->recordRelocation(location, locationRW, target, fRelocType, /* slotNum */ 0, addlDelta);
}
#if defined(LATE_DISASM)
codeGen->getDisAssembler().disRecordRelocation((size_t)location, (size_t)target);
#endif // defined(LATE_DISASM)
}
#ifdef TARGET_ARM
/*****************************************************************************
* A helper for handling a Thumb-Mov32 of position-independent (PC-relative) value
*
* This routine either records relocation for the location with the EE,
* or creates a virtual relocation entry to perform offset fixup during
* compilation without recording it with EE - depending on which of
* absolute/relocative relocations mode are used for code section.
*/
void emitter::emitHandlePCRelativeMov32(void* location, /* IN */
void* target) /* IN */
{
if (emitComp->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_RELATIVE_CODE_RELOCS))
{
emitRecordRelocation(location, target, IMAGE_REL_BASED_REL_THUMB_MOV32_PCREL);
}
else
{
emitRecordRelocation(location, target, IMAGE_REL_BASED_THUMB_MOV32);
}
}
#endif // TARGET_ARM
/*****************************************************************************
* A helper for recording a call site with the EE.
*/
void emitter::emitRecordCallSite(ULONG instrOffset, /* IN */
CORINFO_SIG_INFO* callSig, /* IN */
CORINFO_METHOD_HANDLE methodHandle) /* IN */
{
#if defined(DEBUG)
// Since CORINFO_SIG_INFO is a heavyweight structure, in most cases we can
// lazily obtain it here using the given method handle (we only save the sig
// info when we explicitly need it, i.e. for CALLI calls, vararg calls, and
// tail calls).
CORINFO_SIG_INFO sigInfo;
if (callSig == nullptr)
{
assert(methodHandle != nullptr);
if (Compiler::eeGetHelperNum(methodHandle) == CORINFO_HELP_UNDEF)
{
emitComp->eeGetMethodSig(methodHandle, &sigInfo);
callSig = &sigInfo;
}
}
emitCmpHandle->recordCallSite(instrOffset, callSig, methodHandle);
#endif // defined(DEBUG)
}
/*****************************************************************************/
#endif // EMIT_TRACK_STACK_DEPTH
/*****************************************************************************/
/*****************************************************************************/
#ifdef DEBUG
/*****************************************************************************
* Given a code offset, return a string representing a label for that offset.
* If the code offset is just after the end of the code of the function, the
* label will be "END". If the code offset doesn't correspond to any known
* offset, the label will be "UNKNOWN". The strings are returned from static
* buffers. This function rotates amongst four such static buffers (there are
* cases where this function is called four times to provide data for a single
* printf()).
*/
const char* emitter::emitOffsetToLabel(unsigned offs)
{
const size_t TEMP_BUFFER_LEN = 40;
static unsigned curBuf = 0;
static char buf[4][TEMP_BUFFER_LEN];
char* retbuf;
UNATIVE_OFFSET nextof = 0;
for (insGroup* ig = emitIGlist; ig != nullptr; ig = ig->igNext)
{
// There is an eventual unused space after the last actual hot block
// before the first allocated cold block.
assert((nextof == ig->igOffs) || (ig == emitFirstColdIG));
if (ig->igOffs == offs)
{
return emitLabelString(ig);
}
else if (ig->igOffs > offs)
{
// We went past the requested offset but didn't find it.
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "UNKNOWN");
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}
nextof = ig->igOffs + ig->igSize;
}
if (nextof == offs)
{
// It's a pseudo-label to the end.
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "END");
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}
else
{
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "UNKNOWN");
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
}
}
#endif // DEBUG
//------------------------------------------------------------------------
// emitGetGCRegsSavedOrModified: Returns the set of registers that keeps gcrefs and byrefs across the call.
//
// Notes: it returns union of two sets:
// 1) registers that could contain GC/byRefs before the call and call doesn't touch them;
// 2) registers that contain GC/byRefs before the call and call modifies them, but they still
// contain GC/byRefs.
//
// Arguments:
// methHnd - the method handler of the call.
//
// Return value:
// the saved set of registers.
//
regMaskTP emitter::emitGetGCRegsSavedOrModified(CORINFO_METHOD_HANDLE methHnd)
{
// Is it a helper with a special saved set?
bool isNoGCHelper = emitNoGChelper(methHnd);
if (isNoGCHelper)
{
CorInfoHelpFunc helpFunc = Compiler::eeGetHelperNum(methHnd);
// Get the set of registers that this call kills and remove it from the saved set.
regMaskTP savedSet = RBM_ALLINT & ~emitGetGCRegsKilledByNoGCCall(helpFunc);
#ifdef DEBUG
if (emitComp->verbose)
{
printf("NoGC Call: savedSet=");
printRegMaskInt(savedSet);
emitDispRegSet(savedSet);
printf("\n");
}
#endif
return savedSet;
}
else
{
// This is the saved set of registers after a normal call.
return RBM_CALLEE_SAVED;
}
}
//----------------------------------------------------------------------
// emitGetGCRegsKilledByNoGCCall: Gets a register mask that represents the set of registers that no longer
// contain GC or byref pointers, for "NO GC" helper calls. This is used by the emitter when determining
// what registers to remove from the current live GC/byref sets (and thus what to report as dead in the
// GC info). Note that for the CORINFO_HELP_ASSIGN_BYREF helper, in particular, the kill set reported by
// compHelperCallKillSet() doesn't match this kill set. compHelperCallKillSet() reports the dst/src
// address registers as killed for liveness purposes, since their values change. However, they still are
// valid byref pointers after the call, so the dst/src address registers are NOT reported as killed here.
//
// Note: This list may not be complete and defaults to the default RBM_CALLEE_TRASH_NOGC registers.
//
// Arguments:
// helper - The helper being inquired about
//
// Return Value:
// Mask of GC register kills
//
regMaskTP emitter::emitGetGCRegsKilledByNoGCCall(CorInfoHelpFunc helper)
{
assert(emitNoGChelper(helper));
regMaskTP result;
switch (helper)
{
case CORINFO_HELP_ASSIGN_BYREF:
#if defined(TARGET_X86)
// This helper only trashes ECX.
result = RBM_ECX;
break;
#elif defined(TARGET_AMD64)
// This uses and defs RDI and RSI.
result = RBM_CALLEE_TRASH_NOGC & ~(RBM_RDI | RBM_RSI);
break;
#elif defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
result = RBM_CALLEE_GCTRASH_WRITEBARRIER_BYREF;
break;
#else
assert(!"unknown arch");
#endif
#if !defined(TARGET_LOONGARCH64)
case CORINFO_HELP_PROF_FCN_ENTER:
result = RBM_PROFILER_ENTER_TRASH;
break;
case CORINFO_HELP_PROF_FCN_LEAVE:
#if defined(TARGET_ARM)
// profiler scratch remains gc live
result = RBM_PROFILER_LEAVE_TRASH & ~RBM_PROFILER_RET_SCRATCH;
#else
result = RBM_PROFILER_LEAVE_TRASH;
#endif
break;
case CORINFO_HELP_PROF_FCN_TAILCALL:
result = RBM_PROFILER_TAILCALL_TRASH;
break;
#endif // !defined(TARGET_LOONGARCH64)
#if defined(TARGET_ARMARCH) || defined(TARGET_LOONGARCH64)
case CORINFO_HELP_ASSIGN_REF:
case CORINFO_HELP_CHECKED_ASSIGN_REF:
result = RBM_CALLEE_GCTRASH_WRITEBARRIER;
break;
#endif // defined(TARGET_ARMARCH)
#if defined(TARGET_X86)
case CORINFO_HELP_INIT_PINVOKE_FRAME:
result = RBM_INIT_PINVOKE_FRAME_TRASH;
break;
#endif // defined(TARGET_X86)
case CORINFO_HELP_VALIDATE_INDIRECT_CALL:
result = RBM_VALIDATE_INDIRECT_CALL_TRASH;
break;
default:
result = RBM_CALLEE_TRASH_NOGC;
break;
}
// compHelperCallKillSet returns a superset of the registers which values are not guranteed to be the same
// after the call, if a register loses its GC or byref it has to be in the compHelperCallKillSet set as well.
assert((result & emitComp->compHelperCallKillSet(helper)) == result);
return result;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Console/tests/XunitAssemblyAttributes.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
// Console tests can conflict with each other due to accessing the reading and writing to the console at the same time.
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
// Console tests can conflict with each other due to accessing the reading and writing to the console at the same time.
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Private.Xml.Linq/tests/XDocument.Test.ModuleCore/testcase.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Microsoft.Test.ModuleCore
{
////////////////////////////////////////////////////////////////
// TestCases
//
////////////////////////////////////////////////////////////////
public abstract class TestCase : TestItem
{
//Data
//Constructor
public TestCase()
: this(null, null)
{
}
public TestCase(string name, string desc)
: base(name, desc, TestType.TestCase)
{
}
//Accessors
protected override TestAttribute CreateAttribute()
{
return new TestCaseAttribute();
}
protected virtual TestVariation CreateVariation(TestFunc func, string desc)
{
//Override if you have a specific variation class
return new TestVariation(func, desc);
}
public new virtual TestCaseAttribute Attribute
{
get { return (TestCaseAttribute)base.Attribute; }
set { base.Attribute = value; }
}
//Helpers
protected override void DetermineChildren()
{
//Delegate (add any nested testcases)
base.DetermineChildren();
//Sort
//Default sort is based upon IComparable of each item
Children.Sort();
}
public override TestResult Execute()
{
base.Execute();
TestModule module = GetModule();
if (module == null)
{
throw new Exception("No parent module");
}
TestItems children = Children;
if (children != null && children.Count > 0)
{
// this is not a leaf node, just invoke all the children's execute
foreach (object child in children)
{
if (child is TestCase)
{
TestCase t = child as TestCase;
t.Init();
t.Execute();
continue;
}
TestVariation var = child as TestVariation;
if (var != null)
{
const string indent = "\t";
try
{
CurVariation = var;
TestResult ret = var.Execute();
if (TestResult.Passed == ret)
{
module.PassCount++;
}
else if (TestResult.Failed == ret)
{
System.Console.WriteLine(indent + var.Desc);
System.Console.WriteLine(indent + " FAILED");
module.AddFailure(var.Desc);
}
else
{
System.Console.WriteLine(indent + var.Desc);
System.Console.WriteLine(indent + " SKIPPED");
module.SkipCount++;
}
}
catch (TestSkippedException tse)
{
if (!string.IsNullOrWhiteSpace(var.Desc))
{
System.Console.WriteLine(indent + var.Desc);
}
if (!string.IsNullOrWhiteSpace(tse.Message))
{
System.Console.WriteLine(indent + " SKIPPED" + ", Msg:" + tse.Message);
}
module.SkipCount++;
}
catch (Exception e)
{
System.Console.WriteLine(indent + var.Desc);
System.Console.WriteLine(e);
System.Console.WriteLine(indent + " FAILED");
module.AddFailure(var.Desc + Environment.NewLine + e.ToString());
}
}
}
}
return TestResult.Passed;
}
public TestVariation Variation
{
//Currently executing child
get { return base.CurrentChild as TestVariation; }
}
public TestVariation CurVariation
{
//Currently executing child
get { return base.CurrentChild as TestVariation; }
set { base.CurrentChild = value; }
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Microsoft.Test.ModuleCore
{
////////////////////////////////////////////////////////////////
// TestCases
//
////////////////////////////////////////////////////////////////
public abstract class TestCase : TestItem
{
//Data
//Constructor
public TestCase()
: this(null, null)
{
}
public TestCase(string name, string desc)
: base(name, desc, TestType.TestCase)
{
}
//Accessors
protected override TestAttribute CreateAttribute()
{
return new TestCaseAttribute();
}
protected virtual TestVariation CreateVariation(TestFunc func, string desc)
{
//Override if you have a specific variation class
return new TestVariation(func, desc);
}
public new virtual TestCaseAttribute Attribute
{
get { return (TestCaseAttribute)base.Attribute; }
set { base.Attribute = value; }
}
//Helpers
protected override void DetermineChildren()
{
//Delegate (add any nested testcases)
base.DetermineChildren();
//Sort
//Default sort is based upon IComparable of each item
Children.Sort();
}
public override TestResult Execute()
{
base.Execute();
TestModule module = GetModule();
if (module == null)
{
throw new Exception("No parent module");
}
TestItems children = Children;
if (children != null && children.Count > 0)
{
// this is not a leaf node, just invoke all the children's execute
foreach (object child in children)
{
if (child is TestCase)
{
TestCase t = child as TestCase;
t.Init();
t.Execute();
continue;
}
TestVariation var = child as TestVariation;
if (var != null)
{
const string indent = "\t";
try
{
CurVariation = var;
TestResult ret = var.Execute();
if (TestResult.Passed == ret)
{
module.PassCount++;
}
else if (TestResult.Failed == ret)
{
System.Console.WriteLine(indent + var.Desc);
System.Console.WriteLine(indent + " FAILED");
module.AddFailure(var.Desc);
}
else
{
System.Console.WriteLine(indent + var.Desc);
System.Console.WriteLine(indent + " SKIPPED");
module.SkipCount++;
}
}
catch (TestSkippedException tse)
{
if (!string.IsNullOrWhiteSpace(var.Desc))
{
System.Console.WriteLine(indent + var.Desc);
}
if (!string.IsNullOrWhiteSpace(tse.Message))
{
System.Console.WriteLine(indent + " SKIPPED" + ", Msg:" + tse.Message);
}
module.SkipCount++;
}
catch (Exception e)
{
System.Console.WriteLine(indent + var.Desc);
System.Console.WriteLine(e);
System.Console.WriteLine(indent + " FAILED");
module.AddFailure(var.Desc + Environment.NewLine + e.ToString());
}
}
}
}
return TestResult.Passed;
}
public TestVariation Variation
{
//Currently executing child
get { return base.CurrentChild as TestVariation; }
}
public TestVariation CurVariation
{
//Currently executing child
get { return base.CurrentChild as TestVariation; }
set { base.CurrentChild = value; }
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null019.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// <Area> Nullable - Box-Unbox </Area>
// <Title> Nullable type with unbox box expr </Title>
// <Description>
// checking type of IntE using is operator
// </Description>
// <RelatedBugs> </RelatedBugs>
//<Expects Status=success></Expects>
// <Code>
using System.Runtime.InteropServices;
using System;
internal class NullableTest
{
private static bool BoxUnboxToNQGen<T>(T o)
{
return ((object)o) == null;
}
private static bool BoxUnboxToQGen<T>(T? o) where T : struct
{
return ((T?)o) == null;
}
private static bool BoxUnboxToNQ(object o)
{
return o == null;
}
private static bool BoxUnboxToQ(object o)
{
return ((IntE?)o) == null;
}
private static int Main()
{
IntE? s = null;
if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s))
return ExitCode.Passed;
else
return ExitCode.Failed;
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// <Area> Nullable - Box-Unbox </Area>
// <Title> Nullable type with unbox box expr </Title>
// <Description>
// checking type of IntE using is operator
// </Description>
// <RelatedBugs> </RelatedBugs>
//<Expects Status=success></Expects>
// <Code>
using System.Runtime.InteropServices;
using System;
internal class NullableTest
{
private static bool BoxUnboxToNQGen<T>(T o)
{
return ((object)o) == null;
}
private static bool BoxUnboxToQGen<T>(T? o) where T : struct
{
return ((T?)o) == null;
}
private static bool BoxUnboxToNQ(object o)
{
return o == null;
}
private static bool BoxUnboxToQ(object o)
{
return ((IntE?)o) == null;
}
private static int Main()
{
IntE? s = null;
if (BoxUnboxToNQ(s) && BoxUnboxToQ(s) && BoxUnboxToNQGen(s) && BoxUnboxToQGen(s))
return ExitCode.Passed;
else
return ExitCode.Failed;
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/Loader/classloader/InterfaceFolding/Nested_I_Nested_J/TestCase1.il
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
.assembly extern mscorlib {}
.assembly extern xunit.core {}
.assembly TestCase1 {}
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit A`1<U>
implements class A`1/I`1<!U>
{
.class interface nested family abstract auto ansi I`1<T>
{
.method public hidebysig newslot abstract virtual instance string Foo() cil managed {}
.class interface nested public abstract auto ansi J
{
.method public hidebysig newslot abstract virtual instance string Bar1() cil managed {}
.method public hidebysig newslot abstract virtual instance string Bar2() cil managed {}
}
}
.method public hidebysig newslot virtual instance string Foo() cil managed
{
ldstr "A::Foo"
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed
{
ret
}
}
.class private auto ansi beforefieldinit B`2<V,W>
extends class A`1<!V>
implements class A`1/I`1<!W>, A`1/I`1/J
{
.method public hidebysig newslot virtual instance string Bar1() cil managed
{
.maxstack 8
ldstr "B::Bar1"
ret
}
.method public hidebysig newslot virtual instance string Bar2() cil managed
{
.maxstack 8
ldstr "B::Bar2"
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed
{
ret
}
}
.class private auto ansi beforefieldinit C extends class B`2<class C,class C>
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed
{
ret
}
}
.class public auto ansi beforefieldinit Test_TestCase1 extends [mscorlib]System.Object
{
.method public hidebysig static int32 Main() cil managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
newobj instance void C::.ctor()
callvirt instance string class C::Foo()
ldstr "A::Foo"
call bool [mscorlib]System.String::op_Inequality(string, string)
brtrue FAILURE
newobj instance void C::.ctor()
callvirt instance string class C::Bar1()
ldstr "B::Bar1"
call bool [mscorlib]System.String::op_Inequality(string,string)
brtrue FAILURE
newobj instance void C::.ctor()
callvirt instance string class C::Bar2()
ldstr "B::Bar2"
call bool [mscorlib]System.String::op_Inequality(string,string)
brtrue FAILURE
PASS:
ldstr "Pass"
call void [mscorlib]System.Console::WriteLine(string)
ldc.i4.s 100
ret
FAILURE:
ldstr "Failed!"
call void [mscorlib]System.Console::WriteLine(string)
ldc.i4.m1
ret
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
.assembly extern mscorlib {}
.assembly extern xunit.core {}
.assembly TestCase1 {}
// =============== CLASS MEMBERS DECLARATION ===================
.class private auto ansi beforefieldinit A`1<U>
implements class A`1/I`1<!U>
{
.class interface nested family abstract auto ansi I`1<T>
{
.method public hidebysig newslot abstract virtual instance string Foo() cil managed {}
.class interface nested public abstract auto ansi J
{
.method public hidebysig newslot abstract virtual instance string Bar1() cil managed {}
.method public hidebysig newslot abstract virtual instance string Bar2() cil managed {}
}
}
.method public hidebysig newslot virtual instance string Foo() cil managed
{
ldstr "A::Foo"
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed
{
ret
}
}
.class private auto ansi beforefieldinit B`2<V,W>
extends class A`1<!V>
implements class A`1/I`1<!W>, A`1/I`1/J
{
.method public hidebysig newslot virtual instance string Bar1() cil managed
{
.maxstack 8
ldstr "B::Bar1"
ret
}
.method public hidebysig newslot virtual instance string Bar2() cil managed
{
.maxstack 8
ldstr "B::Bar2"
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed
{
ret
}
}
.class private auto ansi beforefieldinit C extends class B`2<class C,class C>
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed
{
ret
}
}
.class public auto ansi beforefieldinit Test_TestCase1 extends [mscorlib]System.Object
{
.method public hidebysig static int32 Main() cil managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
newobj instance void C::.ctor()
callvirt instance string class C::Foo()
ldstr "A::Foo"
call bool [mscorlib]System.String::op_Inequality(string, string)
brtrue FAILURE
newobj instance void C::.ctor()
callvirt instance string class C::Bar1()
ldstr "B::Bar1"
call bool [mscorlib]System.String::op_Inequality(string,string)
brtrue FAILURE
newobj instance void C::.ctor()
callvirt instance string class C::Bar2()
ldstr "B::Bar2"
call bool [mscorlib]System.String::op_Inequality(string,string)
brtrue FAILURE
PASS:
ldstr "Pass"
call void [mscorlib]System.Console::WriteLine(string)
ldc.i4.s 100
ret
FAILURE:
ldstr "Failed!"
call void [mscorlib]System.Console::WriteLine(string)
ldc.i4.m1
ret
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/pal/src/safecrt/wcsncat_s.cpp
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/***
*wcsncat_s.c - append n chars of string to new string
*
*
*Purpose:
* defines wcsncat_s() - appends n characters of string onto
* end of other string
*
*******************************************************************************/
#define _SECURECRT_FILL_BUFFER 1
#define _SECURECRT_FILL_BUFFER_THRESHOLD ((size_t)8)
#include <string.h>
#include <errno.h>
#include <limits.h>
#include "internal_securecrt.h"
#include "mbusafecrt_internal.h"
#define _FUNC_PROLOGUE
#define _FUNC_NAME wcsncat_s
#define _CHAR char16_t
#define _DEST _Dst
#define _SIZE _SizeInWords
#define _SRC _Src
#define _COUNT _Count
#include "tcsncat_s.inl"
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/***
*wcsncat_s.c - append n chars of string to new string
*
*
*Purpose:
* defines wcsncat_s() - appends n characters of string onto
* end of other string
*
*******************************************************************************/
#define _SECURECRT_FILL_BUFFER 1
#define _SECURECRT_FILL_BUFFER_THRESHOLD ((size_t)8)
#include <string.h>
#include <errno.h>
#include <limits.h>
#include "internal_securecrt.h"
#include "mbusafecrt_internal.h"
#define _FUNC_PROLOGUE
#define _FUNC_NAME wcsncat_s
#define _CHAR char16_t
#define _DEST _Dst
#define _SIZE _SizeInWords
#define _SRC _Src
#define _COUNT _Count
#include "tcsncat_s.inl"
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/baseservices/threading/commitstackonlyasneeded/DefaultStackCommit.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
<!-- Test unsupported outside of windows -->
<CLRTestTargetUnsupported Condition="'$(TargetsWindows)' != 'true'">true</CLRTestTargetUnsupported>
</PropertyGroup>
<ItemGroup>
<Compile Include="DefaultStackCommit.cs" />
<Compile Include="StackCommitCommon.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
<!-- Test unsupported outside of windows -->
<CLRTestTargetUnsupported Condition="'$(TargetsWindows)' != 'true'">true</CLRTestTargetUnsupported>
</PropertyGroup>
<ItemGroup>
<Compile Include="DefaultStackCommit.cs" />
<Compile Include="StackCommitCommon.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/mono/mono/mini/debug-mini.c
|
/**
* \file
* Mini-specific debugging stuff.
*
* Author:
* Martin Baulig ([email protected])
*
* (C) 2003 Ximian, Inc.
*/
#include "mini.h"
#include "mini-runtime.h"
#include <mono/jit/jit.h>
#include "config.h"
#include <mono/metadata/verify.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/mono-debug.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/threads-types.h>
#include <mono/metadata/debug-internals.h>
#include <mono/utils/valgrind.h>
typedef struct {
guint32 index;
MonoMethodDesc *desc;
} MiniDebugBreakpointInfo;
typedef struct
{
MonoDebugMethodJitInfo *jit;
GArray *line_numbers;
guint32 has_line_numbers;
guint32 breakpoint_id;
} MiniDebugMethodInfo;
static void
record_line_number (MiniDebugMethodInfo *info, guint32 address, guint32 offset)
{
MonoDebugLineNumberEntry lne;
lne.native_offset = address;
lne.il_offset = offset;
g_array_append_val (info->line_numbers, lne);
}
void
mono_debug_init_method (MonoCompile *cfg, MonoBasicBlock *start_block, guint32 breakpoint_id)
{
MiniDebugMethodInfo *info;
if (!mono_debug_enabled ())
return;
info = g_new0 (MiniDebugMethodInfo, 1);
info->breakpoint_id = breakpoint_id;
cfg->debug_info = info;
}
void
mono_debug_open_method (MonoCompile *cfg)
{
MiniDebugMethodInfo *info;
MonoDebugMethodJitInfo *jit;
MonoMethodHeader *header;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (!info)
return;
mono_class_init_internal (cfg->method->klass);
header = cfg->header;
g_assert (header);
info->jit = jit = g_new0 (MonoDebugMethodJitInfo, 1);
info->line_numbers = g_array_new (FALSE, TRUE, sizeof (MonoDebugLineNumberEntry));
jit->num_locals = header->num_locals;
jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
}
static void
write_variable (MonoInst *inst, MonoDebugVarInfo *var)
{
var->type = inst->inst_vtype;
if (inst->opcode == OP_REGVAR)
var->index = inst->dreg | MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER;
else if (inst->flags & MONO_INST_IS_DEAD)
var->index = MONO_DEBUG_VAR_ADDRESS_MODE_DEAD;
else if (inst->opcode == OP_REGOFFSET) {
/* the debug interface needs fixing to allow 0(%base) address */
var->index = inst->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET;
var->offset = inst->inst_offset;
} else if (inst->opcode == OP_GSHAREDVT_ARG_REGOFFSET) {
var->index = inst->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR;
var->offset = inst->inst_offset;
} else if (inst->opcode == OP_GSHAREDVT_LOCAL) {
var->index = inst->inst_imm | MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL;
} else if (inst->opcode == OP_VTARG_ADDR) {
MonoInst *vtaddr;
vtaddr = inst->inst_left;
g_assert (vtaddr->opcode == OP_REGOFFSET);
var->offset = vtaddr->inst_offset;
var->index = vtaddr->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR;
} else {
g_assert_not_reached ();
}
}
/*
* mono_debug_add_vg_method:
*
* Register symbol information for the method with valgrind
*/
static void
mono_debug_add_vg_method (MonoMethod *method, MonoDebugMethodJitInfo *jit)
{
#ifdef VALGRIND_ADD_LINE_INFO
ERROR_DECL (error);
MonoMethodHeader *header;
MonoDebugMethodInfo *minfo;
int i;
char *filename = NULL;
guint32 address, line_number;
const char *full_name;
guint32 *addresses;
guint32 *lines;
if (!RUNNING_ON_VALGRIND)
return;
header = mono_method_get_header_checked (method, error);
mono_error_assert_ok (error); /* FIXME don't swallow the error */
full_name = mono_method_full_name (method, TRUE);
addresses = g_new0 (guint32, header->code_size + 1);
lines = g_new0 (guint32, header->code_size + 1);
/*
* Very simple code to convert the addr->offset mappings that mono has
* into [addr-addr] ->line number mappings.
*/
minfo = mono_debug_lookup_method (method);
if (minfo) {
/* Create offset->line number mapping */
for (i = 0; i < header->code_size; ++i) {
MonoDebugSourceLocation *location;
location = mono_debug_method_lookup_location (minfo, i);
if (!location)
continue;
lines [i] = location.row;
if (!filename)
filename = location.source_file;
mono_debug_free_source_location (location);
}
}
/* Create address->offset mapping */
for (i = 0; i < jit->num_line_numbers; ++i) {
MonoDebugLineNumberEntry *lne = jit->line_numbers [i];
g_assert (lne->offset <= header->code_size);
if ((addresses [lne->offset] == 0) || (lne->address < addresses [lne->offset]))
addresses [lne->offset] = lne->address;
}
/* Fill out missing addresses */
address = 0;
for (i = 0; i < header->code_size; ++i) {
if (addresses [i] == 0)
addresses [i] = address;
else
address = addresses [i];
}
address = 0;
line_number = 0;
i = 0;
while (i < header->code_size) {
if (lines [i] == line_number)
i ++;
else {
if (line_number > 0) {
//g_assert (addresses [i] - 1 >= address);
if (addresses [i] - 1 >= address) {
VALGRIND_ADD_LINE_INFO (jit->code_start + address, jit->code_start + addresses [i] - 1, filename, line_number);
//printf ("[%d-%d] -> %d.\n", address, addresses [i] - 1, line_number);
}
}
address = addresses [i];
line_number = lines [i];
}
}
if (line_number > 0) {
VALGRIND_ADD_LINE_INFO (jit->code_start + address, jit->code_start + jit->code_size - 1, filename, line_number);
//printf ("[%d-%d] -> %d.\n", address, jit->code_size - 1, line_number);
}
VALGRIND_ADD_SYMBOL (jit->code_start, jit->code_size, full_name);
g_free (addresses);
g_free (lines);
mono_metadata_free_mh (header);
#endif /* VALGRIND_ADD_LINE_INFO */
}
void
mono_debug_close_method (MonoCompile *cfg)
{
MiniDebugMethodInfo *info;
MonoDebugMethodJitInfo *jit;
MonoMethodHeader *header;
MonoMethodSignature *sig;
MonoMethod *method;
int i;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (!info || !info->jit) {
if (info)
g_free (info);
return;
}
method = cfg->method;
header = cfg->header;
sig = mono_method_signature_internal (method);
jit = info->jit;
jit->code_start = cfg->native_code;
jit->epilogue_begin = cfg->epilog_begin;
jit->code_size = cfg->code_len;
jit->has_var_info = mini_debug_options.mdb_optimizations || MONO_CFG_PROFILE_CALL_CONTEXT (cfg);
if (jit->epilogue_begin)
record_line_number (info, jit->epilogue_begin, header->code_size);
if (jit->has_var_info) {
jit->num_params = sig->param_count;
jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
for (i = 0; i < jit->num_locals; i++)
write_variable (cfg->locals [i], &jit->locals [i]);
if (sig->hasthis) {
jit->this_var = g_new0 (MonoDebugVarInfo, 1);
write_variable (cfg->args [0], jit->this_var);
}
for (i = 0; i < jit->num_params; i++)
write_variable (cfg->args [i + sig->hasthis], &jit->params [i]);
if (cfg->gsharedvt_info_var) {
jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
write_variable (cfg->gsharedvt_info_var, jit->gsharedvt_info_var);
write_variable (cfg->gsharedvt_locals_var, jit->gsharedvt_locals_var);
}
}
jit->num_line_numbers = info->line_numbers->len;
jit->line_numbers = g_new0 (MonoDebugLineNumberEntry, jit->num_line_numbers);
for (i = 0; i < jit->num_line_numbers; i++)
jit->line_numbers [i] = g_array_index (info->line_numbers, MonoDebugLineNumberEntry, i);
mono_debug_add_method (cfg->method_to_register, jit, NULL);
mono_debug_add_vg_method (method, jit);
mono_debug_free_method_jit_info (jit);
mono_debug_free_method (cfg);
}
void
mono_debug_free_method (MonoCompile *cfg)
{
MiniDebugMethodInfo *info;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (info) {
if (info->line_numbers)
g_array_free (info->line_numbers, TRUE);
g_free (info);
cfg->debug_info = NULL;
}
}
void
mono_debug_record_line_number (MonoCompile *cfg, MonoInst *ins, guint32 address)
{
MiniDebugMethodInfo *info;
MonoMethodHeader *header;
guint32 offset;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (!info || !info->jit || !ins->cil_code)
return;
header = cfg->header;
g_assert (header);
if ((ins->cil_code < header->code) ||
(ins->cil_code > header->code + header->code_size))
return;
offset = ins->cil_code - header->code;
if (!info->has_line_numbers) {
info->jit->prologue_end = address;
info->has_line_numbers = TRUE;
}
record_line_number (info, address, offset);
}
void
mono_debug_open_block (MonoCompile *cfg, MonoBasicBlock *bb, guint32 address)
{
MiniDebugMethodInfo *info;
MonoMethodHeader *header;
guint32 offset;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (!info || !info->jit || !bb->cil_code)
return;
header = cfg->header;
g_assert (header);
if ((bb->cil_code < header->code) ||
(bb->cil_code > header->code + header->code_size))
return;
offset = bb->cil_code - header->code;
if (!info->has_line_numbers) {
info->jit->prologue_end = address;
info->has_line_numbers = TRUE;
}
record_line_number (info, address, offset);
}
static void
encode_value (gint32 value, guint8 *buf, guint8 **endbuf)
{
guint8 *p = buf;
//printf ("ENCODE: %d 0x%x.\n", value, value);
/*
* Same encoding as the one used in the metadata, extended to handle values
* greater than 0x1fffffff.
*/
if ((value >= 0) && (value <= 127))
*p++ = value;
else if ((value >= 0) && (value <= 16383)) {
p [0] = 0x80 | (value >> 8);
p [1] = value & 0xff;
p += 2;
} else if ((value >= 0) && (value <= 0x1fffffff)) {
p [0] = (value >> 24) | 0xc0;
p [1] = (value >> 16) & 0xff;
p [2] = (value >> 8) & 0xff;
p [3] = value & 0xff;
p += 4;
}
else {
p [0] = 0xff;
p [1] = (value >> 24) & 0xff;
p [2] = (value >> 16) & 0xff;
p [3] = (value >> 8) & 0xff;
p [4] = value & 0xff;
p += 5;
}
if (endbuf)
*endbuf = p;
}
static gint32
decode_value (guint8 *ptr, guint8 **rptr)
{
guint8 b = *ptr;
gint32 len;
if ((b & 0x80) == 0){
len = b;
++ptr;
} else if ((b & 0x40) == 0){
len = ((b & 0x3f) << 8 | ptr [1]);
ptr += 2;
} else if (b != 0xff) {
len = ((b & 0x1f) << 24) |
(ptr [1] << 16) |
(ptr [2] << 8) |
ptr [3];
ptr += 4;
}
else {
len = (ptr [1] << 24) | (ptr [2] << 16) | (ptr [3] << 8) | ptr [4];
ptr += 5;
}
if (rptr)
*rptr = ptr;
//printf ("DECODE: %d.\n", len);
return len;
}
static void
serialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf)
{
guint32 flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
encode_value (var->index, p, &p);
switch (flags) {
case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR:
encode_value (var->offset, p, &p);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD:
break;
default:
g_assert_not_reached ();
}
*endbuf = p;
}
void
mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *buf_len)
{
MonoDebugMethodJitInfo *jit;
guint32 size, prev_offset, prev_native_offset;
guint8 *buf, *p;
int i;
/* Can't use cfg->debug_info as it is freed by close_method () */
jit = mono_debug_find_method (cfg->method, NULL);
if (!jit) {
*buf_len = 0;
return;
}
size = ((jit->num_params + jit->num_locals + 1) * 10) + (jit->num_line_numbers * 10) + 64;
p = buf = (guint8 *)g_malloc (size);
encode_value (jit->epilogue_begin, p, &p);
encode_value (jit->prologue_end, p, &p);
encode_value (jit->code_size, p, &p);
encode_value (jit->has_var_info, p, &p);
if (jit->has_var_info) {
encode_value (jit->num_locals, p, &p);
for (i = 0; i < jit->num_params; ++i)
serialize_variable (&jit->params [i], p, &p);
if (jit->this_var)
serialize_variable (jit->this_var, p, &p);
for (i = 0; i < jit->num_locals; i++)
serialize_variable (&jit->locals [i], p, &p);
if (jit->gsharedvt_info_var) {
encode_value (1, p, &p);
serialize_variable (jit->gsharedvt_info_var, p, &p);
serialize_variable (jit->gsharedvt_locals_var, p, &p);
} else {
encode_value (0, p, &p);
}
}
encode_value (jit->num_line_numbers, p, &p);
prev_offset = 0;
prev_native_offset = 0;
for (i = 0; i < jit->num_line_numbers; ++i) {
/* Sometimes, the offset values are not in increasing order */
MonoDebugLineNumberEntry *lne = &jit->line_numbers [i];
encode_value (lne->il_offset - prev_offset, p, &p);
encode_value (lne->native_offset - prev_native_offset, p, &p);
prev_offset = lne->il_offset;
prev_native_offset = lne->native_offset;
}
mono_debug_free_method_jit_info (jit);
g_assert (p - buf < size);
*out_buf = buf;
*buf_len = p - buf;
}
static void
deserialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf)
{
guint32 flags;
var->index = decode_value (p, &p);
flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
switch (flags) {
case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR:
var->offset = decode_value (p, &p);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD:
break;
default:
g_assert_not_reached ();
}
*endbuf = p;
}
static MonoDebugMethodJitInfo *
deserialize_debug_info (MonoMethod *method, guint8 *code_start, guint8 *buf, guint32 buf_len)
{
gint32 offset, native_offset, prev_offset, prev_native_offset;
MonoDebugMethodJitInfo *jit;
guint8 *p;
int i;
jit = g_new0 (MonoDebugMethodJitInfo, 1);
jit->code_start = code_start;
p = buf;
jit->epilogue_begin = decode_value (p, &p);
jit->prologue_end = decode_value (p, &p);
jit->code_size = decode_value (p, &p);
jit->has_var_info = decode_value (p, &p);
if (jit->has_var_info) {
jit->num_locals = decode_value (p, &p);
jit->num_params = mono_method_signature_internal (method)->param_count;
jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
for (i = 0; i < jit->num_params; ++i)
deserialize_variable (&jit->params [i], p, &p);
if (mono_method_signature_internal (method)->hasthis) {
jit->this_var = g_new0 (MonoDebugVarInfo, 1);
deserialize_variable (jit->this_var, p, &p);
}
for (i = 0; i < jit->num_locals; i++)
deserialize_variable (&jit->locals [i], p, &p);
if (decode_value (p, &p)) {
jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
deserialize_variable (jit->gsharedvt_info_var, p, &p);
deserialize_variable (jit->gsharedvt_locals_var, p, &p);
}
}
jit->num_line_numbers = decode_value (p, &p);
jit->line_numbers = g_new0 (MonoDebugLineNumberEntry, jit->num_line_numbers);
prev_offset = 0;
prev_native_offset = 0;
for (i = 0; i < jit->num_line_numbers; ++i) {
MonoDebugLineNumberEntry *lne = &jit->line_numbers [i];
offset = prev_offset + decode_value (p, &p);
native_offset = prev_native_offset + decode_value (p, &p);
lne->native_offset = native_offset;
lne->il_offset = offset;
prev_offset = offset;
prev_native_offset = native_offset;
}
return jit;
}
void
mono_debug_add_aot_method (MonoMethod *method, guint8 *code_start,
guint8 *debug_info, guint32 debug_info_len)
{
MonoDebugMethodJitInfo *jit;
if (!mono_debug_enabled ())
return;
if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
(method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
(method->flags & METHOD_ATTRIBUTE_ABSTRACT) ||
(method->wrapper_type != MONO_WRAPPER_NONE))
return;
if (debug_info_len == 0)
return;
jit = deserialize_debug_info (method, code_start, debug_info, debug_info_len);
mono_debug_add_method (method, jit, NULL);
mono_debug_add_vg_method (method, jit);
mono_debug_free_method_jit_info (jit);
}
static void
print_var_info (MonoDebugVarInfo *info, int idx, const char *name, const char *type)
{
switch (info->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS) {
case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
g_print ("%s %s (%d) in register %s\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)));
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
g_print ("%s %s (%d) in memory: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
g_print ("%s %s (%d) in indir memory: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
g_print ("%s %s (%d) gsharedvt local.\n", type, name, idx);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR:
g_print ("%s %s (%d) vt address: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS:
default:
g_assert_not_reached ();
}
}
/**
* mono_debug_print_locals:
*
* Prints to stdout the information about the local variables in
* a method (if \p only_arguments is false) or about the arguments.
* The information includes the storage info (where the variable
* lives, in a register or in memory).
* The method is found by looking up what method has been emitted at
* the instruction address \p ip.
* This is for use inside a debugger.
*/
void
mono_debug_print_vars (gpointer ip, gboolean only_arguments)
{
MonoJitInfo *ji = mini_jit_info_table_find (ip);
MonoDebugMethodJitInfo *jit;
int i;
if (!ji)
return;
jit = mono_debug_find_method (jinfo_get_method (ji), NULL);
if (!jit)
return;
if (only_arguments) {
char **names;
names = g_new (char *, jit->num_params);
mono_method_get_param_names (jinfo_get_method (ji), (const char **) names);
if (jit->this_var)
print_var_info (jit->this_var, 0, "this", "Arg");
for (i = 0; i < jit->num_params; ++i) {
print_var_info (&jit->params [i], i, names [i]? names [i]: "unknown name", "Arg");
}
g_free (names);
} else {
for (i = 0; i < jit->num_locals; ++i) {
print_var_info (&jit->locals [i], i, "", "Local");
}
}
mono_debug_free_method_jit_info (jit);
}
/*
* The old Debugger breakpoint interface.
*
* This interface is used to insert breakpoints on methods which are not yet JITed.
* The debugging code keeps a list of all such breakpoints and automatically inserts the
* breakpoint when the method is JITed.
*/
static GPtrArray *breakpoints;
static int
mono_debugger_insert_breakpoint_full (MonoMethodDesc *desc)
{
static int last_breakpoint_id = 0;
MiniDebugBreakpointInfo *info;
info = g_new0 (MiniDebugBreakpointInfo, 1);
info->desc = desc;
info->index = ++last_breakpoint_id;
if (!breakpoints)
breakpoints = g_ptr_array_new ();
g_ptr_array_add (breakpoints, info);
return info->index;
}
/*FIXME This is part of the public API by accident, remove it from there when possible. */
int
mono_debugger_insert_breakpoint (const gchar *method_name, gboolean include_namespace)
{
MonoMethodDesc *desc;
desc = mono_method_desc_new (method_name, include_namespace);
if (!desc)
return 0;
return mono_debugger_insert_breakpoint_full (desc);
}
/*FIXME This is part of the public API by accident, remove it from there when possible. */
int
mono_debugger_method_has_breakpoint (MonoMethod *method)
{
int i;
if (!breakpoints)
return 0;
for (i = 0; i < breakpoints->len; i++) {
MiniDebugBreakpointInfo *info = (MiniDebugBreakpointInfo *)g_ptr_array_index (breakpoints, i);
if (!mono_method_desc_full_match (info->desc, method))
continue;
return info->index;
}
return 0;
}
|
/**
* \file
* Mini-specific debugging stuff.
*
* Author:
* Martin Baulig ([email protected])
*
* (C) 2003 Ximian, Inc.
*/
#include "mini.h"
#include "mini-runtime.h"
#include <mono/jit/jit.h>
#include "config.h"
#include <mono/metadata/verify.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/mono-debug.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/threads-types.h>
#include <mono/metadata/debug-internals.h>
#include <mono/utils/valgrind.h>
typedef struct {
guint32 index;
MonoMethodDesc *desc;
} MiniDebugBreakpointInfo;
typedef struct
{
MonoDebugMethodJitInfo *jit;
GArray *line_numbers;
guint32 has_line_numbers;
guint32 breakpoint_id;
} MiniDebugMethodInfo;
static void
record_line_number (MiniDebugMethodInfo *info, guint32 address, guint32 offset)
{
MonoDebugLineNumberEntry lne;
lne.native_offset = address;
lne.il_offset = offset;
g_array_append_val (info->line_numbers, lne);
}
void
mono_debug_init_method (MonoCompile *cfg, MonoBasicBlock *start_block, guint32 breakpoint_id)
{
MiniDebugMethodInfo *info;
if (!mono_debug_enabled ())
return;
info = g_new0 (MiniDebugMethodInfo, 1);
info->breakpoint_id = breakpoint_id;
cfg->debug_info = info;
}
void
mono_debug_open_method (MonoCompile *cfg)
{
MiniDebugMethodInfo *info;
MonoDebugMethodJitInfo *jit;
MonoMethodHeader *header;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (!info)
return;
mono_class_init_internal (cfg->method->klass);
header = cfg->header;
g_assert (header);
info->jit = jit = g_new0 (MonoDebugMethodJitInfo, 1);
info->line_numbers = g_array_new (FALSE, TRUE, sizeof (MonoDebugLineNumberEntry));
jit->num_locals = header->num_locals;
jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
}
static void
write_variable (MonoInst *inst, MonoDebugVarInfo *var)
{
var->type = inst->inst_vtype;
if (inst->opcode == OP_REGVAR)
var->index = inst->dreg | MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER;
else if (inst->flags & MONO_INST_IS_DEAD)
var->index = MONO_DEBUG_VAR_ADDRESS_MODE_DEAD;
else if (inst->opcode == OP_REGOFFSET) {
/* the debug interface needs fixing to allow 0(%base) address */
var->index = inst->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET;
var->offset = inst->inst_offset;
} else if (inst->opcode == OP_GSHAREDVT_ARG_REGOFFSET) {
var->index = inst->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR;
var->offset = inst->inst_offset;
} else if (inst->opcode == OP_GSHAREDVT_LOCAL) {
var->index = inst->inst_imm | MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL;
} else if (inst->opcode == OP_VTARG_ADDR) {
MonoInst *vtaddr;
vtaddr = inst->inst_left;
g_assert (vtaddr->opcode == OP_REGOFFSET);
var->offset = vtaddr->inst_offset;
var->index = vtaddr->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR;
} else {
g_assert_not_reached ();
}
}
/*
* mono_debug_add_vg_method:
*
* Register symbol information for the method with valgrind
*/
static void
mono_debug_add_vg_method (MonoMethod *method, MonoDebugMethodJitInfo *jit)
{
#ifdef VALGRIND_ADD_LINE_INFO
ERROR_DECL (error);
MonoMethodHeader *header;
MonoDebugMethodInfo *minfo;
int i;
char *filename = NULL;
guint32 address, line_number;
const char *full_name;
guint32 *addresses;
guint32 *lines;
if (!RUNNING_ON_VALGRIND)
return;
header = mono_method_get_header_checked (method, error);
mono_error_assert_ok (error); /* FIXME don't swallow the error */
full_name = mono_method_full_name (method, TRUE);
addresses = g_new0 (guint32, header->code_size + 1);
lines = g_new0 (guint32, header->code_size + 1);
/*
* Very simple code to convert the addr->offset mappings that mono has
* into [addr-addr] ->line number mappings.
*/
minfo = mono_debug_lookup_method (method);
if (minfo) {
/* Create offset->line number mapping */
for (i = 0; i < header->code_size; ++i) {
MonoDebugSourceLocation *location;
location = mono_debug_method_lookup_location (minfo, i);
if (!location)
continue;
lines [i] = location.row;
if (!filename)
filename = location.source_file;
mono_debug_free_source_location (location);
}
}
/* Create address->offset mapping */
for (i = 0; i < jit->num_line_numbers; ++i) {
MonoDebugLineNumberEntry *lne = jit->line_numbers [i];
g_assert (lne->offset <= header->code_size);
if ((addresses [lne->offset] == 0) || (lne->address < addresses [lne->offset]))
addresses [lne->offset] = lne->address;
}
/* Fill out missing addresses */
address = 0;
for (i = 0; i < header->code_size; ++i) {
if (addresses [i] == 0)
addresses [i] = address;
else
address = addresses [i];
}
address = 0;
line_number = 0;
i = 0;
while (i < header->code_size) {
if (lines [i] == line_number)
i ++;
else {
if (line_number > 0) {
//g_assert (addresses [i] - 1 >= address);
if (addresses [i] - 1 >= address) {
VALGRIND_ADD_LINE_INFO (jit->code_start + address, jit->code_start + addresses [i] - 1, filename, line_number);
//printf ("[%d-%d] -> %d.\n", address, addresses [i] - 1, line_number);
}
}
address = addresses [i];
line_number = lines [i];
}
}
if (line_number > 0) {
VALGRIND_ADD_LINE_INFO (jit->code_start + address, jit->code_start + jit->code_size - 1, filename, line_number);
//printf ("[%d-%d] -> %d.\n", address, jit->code_size - 1, line_number);
}
VALGRIND_ADD_SYMBOL (jit->code_start, jit->code_size, full_name);
g_free (addresses);
g_free (lines);
mono_metadata_free_mh (header);
#endif /* VALGRIND_ADD_LINE_INFO */
}
void
mono_debug_close_method (MonoCompile *cfg)
{
MiniDebugMethodInfo *info;
MonoDebugMethodJitInfo *jit;
MonoMethodHeader *header;
MonoMethodSignature *sig;
MonoMethod *method;
int i;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (!info || !info->jit) {
if (info)
g_free (info);
return;
}
method = cfg->method;
header = cfg->header;
sig = mono_method_signature_internal (method);
jit = info->jit;
jit->code_start = cfg->native_code;
jit->epilogue_begin = cfg->epilog_begin;
jit->code_size = cfg->code_len;
jit->has_var_info = mini_debug_options.mdb_optimizations || MONO_CFG_PROFILE_CALL_CONTEXT (cfg);
if (jit->epilogue_begin)
record_line_number (info, jit->epilogue_begin, header->code_size);
if (jit->has_var_info) {
jit->num_params = sig->param_count;
jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
for (i = 0; i < jit->num_locals; i++)
write_variable (cfg->locals [i], &jit->locals [i]);
if (sig->hasthis) {
jit->this_var = g_new0 (MonoDebugVarInfo, 1);
write_variable (cfg->args [0], jit->this_var);
}
for (i = 0; i < jit->num_params; i++)
write_variable (cfg->args [i + sig->hasthis], &jit->params [i]);
if (cfg->gsharedvt_info_var) {
jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
write_variable (cfg->gsharedvt_info_var, jit->gsharedvt_info_var);
write_variable (cfg->gsharedvt_locals_var, jit->gsharedvt_locals_var);
}
}
jit->num_line_numbers = info->line_numbers->len;
jit->line_numbers = g_new0 (MonoDebugLineNumberEntry, jit->num_line_numbers);
for (i = 0; i < jit->num_line_numbers; i++)
jit->line_numbers [i] = g_array_index (info->line_numbers, MonoDebugLineNumberEntry, i);
mono_debug_add_method (cfg->method_to_register, jit, NULL);
mono_debug_add_vg_method (method, jit);
mono_debug_free_method_jit_info (jit);
mono_debug_free_method (cfg);
}
void
mono_debug_free_method (MonoCompile *cfg)
{
MiniDebugMethodInfo *info;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (info) {
if (info->line_numbers)
g_array_free (info->line_numbers, TRUE);
g_free (info);
cfg->debug_info = NULL;
}
}
void
mono_debug_record_line_number (MonoCompile *cfg, MonoInst *ins, guint32 address)
{
MiniDebugMethodInfo *info;
MonoMethodHeader *header;
guint32 offset;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (!info || !info->jit || !ins->cil_code)
return;
header = cfg->header;
g_assert (header);
if ((ins->cil_code < header->code) ||
(ins->cil_code > header->code + header->code_size))
return;
offset = ins->cil_code - header->code;
if (!info->has_line_numbers) {
info->jit->prologue_end = address;
info->has_line_numbers = TRUE;
}
record_line_number (info, address, offset);
}
void
mono_debug_open_block (MonoCompile *cfg, MonoBasicBlock *bb, guint32 address)
{
MiniDebugMethodInfo *info;
MonoMethodHeader *header;
guint32 offset;
info = (MiniDebugMethodInfo *) cfg->debug_info;
if (!info || !info->jit || !bb->cil_code)
return;
header = cfg->header;
g_assert (header);
if ((bb->cil_code < header->code) ||
(bb->cil_code > header->code + header->code_size))
return;
offset = bb->cil_code - header->code;
if (!info->has_line_numbers) {
info->jit->prologue_end = address;
info->has_line_numbers = TRUE;
}
record_line_number (info, address, offset);
}
static void
encode_value (gint32 value, guint8 *buf, guint8 **endbuf)
{
guint8 *p = buf;
//printf ("ENCODE: %d 0x%x.\n", value, value);
/*
* Same encoding as the one used in the metadata, extended to handle values
* greater than 0x1fffffff.
*/
if ((value >= 0) && (value <= 127))
*p++ = value;
else if ((value >= 0) && (value <= 16383)) {
p [0] = 0x80 | (value >> 8);
p [1] = value & 0xff;
p += 2;
} else if ((value >= 0) && (value <= 0x1fffffff)) {
p [0] = (value >> 24) | 0xc0;
p [1] = (value >> 16) & 0xff;
p [2] = (value >> 8) & 0xff;
p [3] = value & 0xff;
p += 4;
}
else {
p [0] = 0xff;
p [1] = (value >> 24) & 0xff;
p [2] = (value >> 16) & 0xff;
p [3] = (value >> 8) & 0xff;
p [4] = value & 0xff;
p += 5;
}
if (endbuf)
*endbuf = p;
}
static gint32
decode_value (guint8 *ptr, guint8 **rptr)
{
guint8 b = *ptr;
gint32 len;
if ((b & 0x80) == 0){
len = b;
++ptr;
} else if ((b & 0x40) == 0){
len = ((b & 0x3f) << 8 | ptr [1]);
ptr += 2;
} else if (b != 0xff) {
len = ((b & 0x1f) << 24) |
(ptr [1] << 16) |
(ptr [2] << 8) |
ptr [3];
ptr += 4;
}
else {
len = (ptr [1] << 24) | (ptr [2] << 16) | (ptr [3] << 8) | ptr [4];
ptr += 5;
}
if (rptr)
*rptr = ptr;
//printf ("DECODE: %d.\n", len);
return len;
}
static void
serialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf)
{
guint32 flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
encode_value (var->index, p, &p);
switch (flags) {
case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR:
encode_value (var->offset, p, &p);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD:
break;
default:
g_assert_not_reached ();
}
*endbuf = p;
}
void
mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *buf_len)
{
MonoDebugMethodJitInfo *jit;
guint32 size, prev_offset, prev_native_offset;
guint8 *buf, *p;
int i;
/* Can't use cfg->debug_info as it is freed by close_method () */
jit = mono_debug_find_method (cfg->method, NULL);
if (!jit) {
*buf_len = 0;
return;
}
size = ((jit->num_params + jit->num_locals + 1) * 10) + (jit->num_line_numbers * 10) + 64;
p = buf = (guint8 *)g_malloc (size);
encode_value (jit->epilogue_begin, p, &p);
encode_value (jit->prologue_end, p, &p);
encode_value (jit->code_size, p, &p);
encode_value (jit->has_var_info, p, &p);
if (jit->has_var_info) {
encode_value (jit->num_locals, p, &p);
for (i = 0; i < jit->num_params; ++i)
serialize_variable (&jit->params [i], p, &p);
if (jit->this_var)
serialize_variable (jit->this_var, p, &p);
for (i = 0; i < jit->num_locals; i++)
serialize_variable (&jit->locals [i], p, &p);
if (jit->gsharedvt_info_var) {
encode_value (1, p, &p);
serialize_variable (jit->gsharedvt_info_var, p, &p);
serialize_variable (jit->gsharedvt_locals_var, p, &p);
} else {
encode_value (0, p, &p);
}
}
encode_value (jit->num_line_numbers, p, &p);
prev_offset = 0;
prev_native_offset = 0;
for (i = 0; i < jit->num_line_numbers; ++i) {
/* Sometimes, the offset values are not in increasing order */
MonoDebugLineNumberEntry *lne = &jit->line_numbers [i];
encode_value (lne->il_offset - prev_offset, p, &p);
encode_value (lne->native_offset - prev_native_offset, p, &p);
prev_offset = lne->il_offset;
prev_native_offset = lne->native_offset;
}
mono_debug_free_method_jit_info (jit);
g_assert (p - buf < size);
*out_buf = buf;
*buf_len = p - buf;
}
static void
deserialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf)
{
guint32 flags;
var->index = decode_value (p, &p);
flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
switch (flags) {
case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR:
var->offset = decode_value (p, &p);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD:
break;
default:
g_assert_not_reached ();
}
*endbuf = p;
}
static MonoDebugMethodJitInfo *
deserialize_debug_info (MonoMethod *method, guint8 *code_start, guint8 *buf, guint32 buf_len)
{
gint32 offset, native_offset, prev_offset, prev_native_offset;
MonoDebugMethodJitInfo *jit;
guint8 *p;
int i;
jit = g_new0 (MonoDebugMethodJitInfo, 1);
jit->code_start = code_start;
p = buf;
jit->epilogue_begin = decode_value (p, &p);
jit->prologue_end = decode_value (p, &p);
jit->code_size = decode_value (p, &p);
jit->has_var_info = decode_value (p, &p);
if (jit->has_var_info) {
jit->num_locals = decode_value (p, &p);
jit->num_params = mono_method_signature_internal (method)->param_count;
jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
for (i = 0; i < jit->num_params; ++i)
deserialize_variable (&jit->params [i], p, &p);
if (mono_method_signature_internal (method)->hasthis) {
jit->this_var = g_new0 (MonoDebugVarInfo, 1);
deserialize_variable (jit->this_var, p, &p);
}
for (i = 0; i < jit->num_locals; i++)
deserialize_variable (&jit->locals [i], p, &p);
if (decode_value (p, &p)) {
jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
deserialize_variable (jit->gsharedvt_info_var, p, &p);
deserialize_variable (jit->gsharedvt_locals_var, p, &p);
}
}
jit->num_line_numbers = decode_value (p, &p);
jit->line_numbers = g_new0 (MonoDebugLineNumberEntry, jit->num_line_numbers);
prev_offset = 0;
prev_native_offset = 0;
for (i = 0; i < jit->num_line_numbers; ++i) {
MonoDebugLineNumberEntry *lne = &jit->line_numbers [i];
offset = prev_offset + decode_value (p, &p);
native_offset = prev_native_offset + decode_value (p, &p);
lne->native_offset = native_offset;
lne->il_offset = offset;
prev_offset = offset;
prev_native_offset = native_offset;
}
return jit;
}
void
mono_debug_add_aot_method (MonoMethod *method, guint8 *code_start,
guint8 *debug_info, guint32 debug_info_len)
{
MonoDebugMethodJitInfo *jit;
if (!mono_debug_enabled ())
return;
if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
(method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
(method->flags & METHOD_ATTRIBUTE_ABSTRACT) ||
(method->wrapper_type != MONO_WRAPPER_NONE))
return;
if (debug_info_len == 0)
return;
jit = deserialize_debug_info (method, code_start, debug_info, debug_info_len);
mono_debug_add_method (method, jit, NULL);
mono_debug_add_vg_method (method, jit);
mono_debug_free_method_jit_info (jit);
}
static void
print_var_info (MonoDebugVarInfo *info, int idx, const char *name, const char *type)
{
switch (info->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS) {
case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
g_print ("%s %s (%d) in register %s\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)));
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
g_print ("%s %s (%d) in memory: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
g_print ("%s %s (%d) in indir memory: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
g_print ("%s %s (%d) gsharedvt local.\n", type, name, idx);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_VTADDR:
g_print ("%s %s (%d) vt address: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset);
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS:
default:
g_assert_not_reached ();
}
}
/**
* mono_debug_print_locals:
*
* Prints to stdout the information about the local variables in
* a method (if \p only_arguments is false) or about the arguments.
* The information includes the storage info (where the variable
* lives, in a register or in memory).
* The method is found by looking up what method has been emitted at
* the instruction address \p ip.
* This is for use inside a debugger.
*/
void
mono_debug_print_vars (gpointer ip, gboolean only_arguments)
{
MonoJitInfo *ji = mini_jit_info_table_find (ip);
MonoDebugMethodJitInfo *jit;
int i;
if (!ji)
return;
jit = mono_debug_find_method (jinfo_get_method (ji), NULL);
if (!jit)
return;
if (only_arguments) {
char **names;
names = g_new (char *, jit->num_params);
mono_method_get_param_names (jinfo_get_method (ji), (const char **) names);
if (jit->this_var)
print_var_info (jit->this_var, 0, "this", "Arg");
for (i = 0; i < jit->num_params; ++i) {
print_var_info (&jit->params [i], i, names [i]? names [i]: "unknown name", "Arg");
}
g_free (names);
} else {
for (i = 0; i < jit->num_locals; ++i) {
print_var_info (&jit->locals [i], i, "", "Local");
}
}
mono_debug_free_method_jit_info (jit);
}
/*
* The old Debugger breakpoint interface.
*
* This interface is used to insert breakpoints on methods which are not yet JITed.
* The debugging code keeps a list of all such breakpoints and automatically inserts the
* breakpoint when the method is JITed.
*/
static GPtrArray *breakpoints;
static int
mono_debugger_insert_breakpoint_full (MonoMethodDesc *desc)
{
static int last_breakpoint_id = 0;
MiniDebugBreakpointInfo *info;
info = g_new0 (MiniDebugBreakpointInfo, 1);
info->desc = desc;
info->index = ++last_breakpoint_id;
if (!breakpoints)
breakpoints = g_ptr_array_new ();
g_ptr_array_add (breakpoints, info);
return info->index;
}
/*FIXME This is part of the public API by accident, remove it from there when possible. */
int
mono_debugger_insert_breakpoint (const gchar *method_name, gboolean include_namespace)
{
MonoMethodDesc *desc;
desc = mono_method_desc_new (method_name, include_namespace);
if (!desc)
return 0;
return mono_debugger_insert_breakpoint_full (desc);
}
/*FIXME This is part of the public API by accident, remove it from there when possible. */
int
mono_debugger_method_has_breakpoint (MonoMethod *method)
{
int i;
if (!breakpoints)
return 0;
for (i = 0; i < breakpoints->len; i++) {
MiniDebugBreakpointInfo *info = (MiniDebugBreakpointInfo *)g_ptr_array_index (breakpoints, i);
if (!mono_method_desc_full_match (info->desc, method))
continue;
return info->index;
}
return 0;
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/mono/mono/eglib/test/array.c
|
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "test.h"
/* example from glib documentation */
static RESULT
test_array_big (void)
{
GArray *garray;
gint i;
/* We create a new array to store gint values.
We don't want it zero-terminated or cleared to 0's. */
garray = g_array_new (FALSE, FALSE, sizeof (gint));
for (i = 0; i < 10000; i++)
g_array_append_val (garray, i);
for (i = 0; i < 10000; i++)
if (g_array_index (garray, gint, i) != i)
return FAILED ("array value didn't match");
g_array_free (garray, TRUE);
return NULL;
}
static RESULT
test_array_index (void)
{
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
int v;
v = 27;
g_array_append_val (array, v);
if (27 != g_array_index (array, int, 0))
return FAILED ("");
g_array_free (array, TRUE);
return NULL;
}
static RESULT
test_array_append_zero_terminated (void)
{
GArray *array = g_array_new (TRUE, FALSE, sizeof (int));
int v;
v = 27;
g_array_append_val (array, v);
if (27 != g_array_index (array, int, 0))
return FAILED ("g_array_append_val failed");
if (0 != g_array_index (array, int, 1))
return FAILED ("zero_terminated didn't append a zero element");
g_array_free (array, TRUE);
return NULL;
}
static RESULT
test_array_append (void)
{
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
int v;
if (0 != array->len)
return FAILED ("initial array length not zero");
v = 27;
g_array_append_val (array, v);
if (1 != array->len)
return FAILED ("array append failed");
g_array_free (array, TRUE);
return NULL;
}
static RESULT
test_array_insert_val (void)
{
GArray *array = g_array_new (FALSE, FALSE, sizeof (gpointer));
gpointer ptr0, ptr1, ptr2, ptr3;
g_array_insert_val (array, 0, array);
if (array != g_array_index (array, gpointer, 0))
return FAILED ("1 The value in the array is incorrect");
g_array_insert_val (array, 1, array);
if (array != g_array_index (array, gpointer, 1))
return FAILED ("2 The value in the array is incorrect");
g_array_insert_val (array, 2, array);
if (array != g_array_index (array, gpointer, 2))
return FAILED ("3 The value in the array is incorrect");
g_array_free (array, TRUE);
array = g_array_new (FALSE, FALSE, sizeof (gpointer));
ptr0 = array;
ptr1 = array + 1;
ptr2 = array + 2;
ptr3 = array + 3;
g_array_insert_val (array, 0, ptr0);
g_array_insert_val (array, 1, ptr1);
g_array_insert_val (array, 2, ptr2);
g_array_insert_val (array, 1, ptr3);
if (ptr0 != g_array_index (array, gpointer, 0))
return FAILED ("4 The value in the array is incorrect");
if (ptr3 != g_array_index (array, gpointer, 1))
return FAILED ("5 The value in the array is incorrect");
if (ptr1 != g_array_index (array, gpointer, 2))
return FAILED ("6 The value in the array is incorrect");
if (ptr2 != g_array_index (array, gpointer, 3))
return FAILED ("7 The value in the array is incorrect");
g_array_free (array, TRUE);
return NULL;
}
static RESULT
test_array_remove (void)
{
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
int v[] = {30, 29, 28, 27, 26, 25};
g_array_append_vals (array, v, 6);
if (6 != array->len)
return FAILED ("append_vals fail");
g_array_remove_index (array, 3);
if (5 != array->len)
return FAILED ("remove_index failed to update length");
if (26 != g_array_index (array, int, 3))
return FAILED ("remove_index failed to update the array");
g_array_free (array, TRUE);
return NULL;
}
static Test array_tests [] = {
{"big", test_array_big},
{"append", test_array_append},
{"insert_val", test_array_insert_val},
{"index", test_array_index},
{"remove", test_array_remove},
{"append_zero_term", test_array_append_zero_terminated},
{NULL, NULL}
};
DEFINE_TEST_GROUP_INIT(array_tests_init, array_tests)
|
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "test.h"
/* example from glib documentation */
static RESULT
test_array_big (void)
{
GArray *garray;
gint i;
/* We create a new array to store gint values.
We don't want it zero-terminated or cleared to 0's. */
garray = g_array_new (FALSE, FALSE, sizeof (gint));
for (i = 0; i < 10000; i++)
g_array_append_val (garray, i);
for (i = 0; i < 10000; i++)
if (g_array_index (garray, gint, i) != i)
return FAILED ("array value didn't match");
g_array_free (garray, TRUE);
return NULL;
}
static RESULT
test_array_index (void)
{
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
int v;
v = 27;
g_array_append_val (array, v);
if (27 != g_array_index (array, int, 0))
return FAILED ("");
g_array_free (array, TRUE);
return NULL;
}
static RESULT
test_array_append_zero_terminated (void)
{
GArray *array = g_array_new (TRUE, FALSE, sizeof (int));
int v;
v = 27;
g_array_append_val (array, v);
if (27 != g_array_index (array, int, 0))
return FAILED ("g_array_append_val failed");
if (0 != g_array_index (array, int, 1))
return FAILED ("zero_terminated didn't append a zero element");
g_array_free (array, TRUE);
return NULL;
}
static RESULT
test_array_append (void)
{
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
int v;
if (0 != array->len)
return FAILED ("initial array length not zero");
v = 27;
g_array_append_val (array, v);
if (1 != array->len)
return FAILED ("array append failed");
g_array_free (array, TRUE);
return NULL;
}
static RESULT
test_array_insert_val (void)
{
GArray *array = g_array_new (FALSE, FALSE, sizeof (gpointer));
gpointer ptr0, ptr1, ptr2, ptr3;
g_array_insert_val (array, 0, array);
if (array != g_array_index (array, gpointer, 0))
return FAILED ("1 The value in the array is incorrect");
g_array_insert_val (array, 1, array);
if (array != g_array_index (array, gpointer, 1))
return FAILED ("2 The value in the array is incorrect");
g_array_insert_val (array, 2, array);
if (array != g_array_index (array, gpointer, 2))
return FAILED ("3 The value in the array is incorrect");
g_array_free (array, TRUE);
array = g_array_new (FALSE, FALSE, sizeof (gpointer));
ptr0 = array;
ptr1 = array + 1;
ptr2 = array + 2;
ptr3 = array + 3;
g_array_insert_val (array, 0, ptr0);
g_array_insert_val (array, 1, ptr1);
g_array_insert_val (array, 2, ptr2);
g_array_insert_val (array, 1, ptr3);
if (ptr0 != g_array_index (array, gpointer, 0))
return FAILED ("4 The value in the array is incorrect");
if (ptr3 != g_array_index (array, gpointer, 1))
return FAILED ("5 The value in the array is incorrect");
if (ptr1 != g_array_index (array, gpointer, 2))
return FAILED ("6 The value in the array is incorrect");
if (ptr2 != g_array_index (array, gpointer, 3))
return FAILED ("7 The value in the array is incorrect");
g_array_free (array, TRUE);
return NULL;
}
static RESULT
test_array_remove (void)
{
GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
int v[] = {30, 29, 28, 27, 26, 25};
g_array_append_vals (array, v, 6);
if (6 != array->len)
return FAILED ("append_vals fail");
g_array_remove_index (array, 3);
if (5 != array->len)
return FAILED ("remove_index failed to update length");
if (26 != g_array_index (array, int, 3))
return FAILED ("remove_index failed to update the array");
g_array_free (array, TRUE);
return NULL;
}
static Test array_tests [] = {
{"big", test_array_big},
{"append", test_array_append},
{"insert_val", test_array_insert_val},
{"index", test_array_index},
{"remove", test_array_remove},
{"append_zero_term", test_array_append_zero_terminated},
{NULL, NULL}
};
DEFINE_TEST_GROUP_INIT(array_tests_init, array_tests)
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SessionEndedEventArgs.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Microsoft.Win32
{
/// <devdoc>
/// <para>Provides data for the <see cref='Microsoft.Win32.SystemEvents.SessionEnded'/> event.</para>
/// </devdoc>
public class SessionEndedEventArgs : EventArgs
{
private readonly SessionEndReasons _reason;
/// <devdoc>
/// <para>Initializes a new instance of the <see cref='Microsoft.Win32.SessionEndedEventArgs'/> class.</para>
/// </devdoc>
public SessionEndedEventArgs(SessionEndReasons reason)
{
_reason = reason;
}
/// <devdoc>
/// <para>Gets how the session ended.</para>
/// </devdoc>
public SessionEndReasons Reason
{
get
{
return _reason;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Microsoft.Win32
{
/// <devdoc>
/// <para>Provides data for the <see cref='Microsoft.Win32.SystemEvents.SessionEnded'/> event.</para>
/// </devdoc>
public class SessionEndedEventArgs : EventArgs
{
private readonly SessionEndReasons _reason;
/// <devdoc>
/// <para>Initializes a new instance of the <see cref='Microsoft.Win32.SessionEndedEventArgs'/> class.</para>
/// </devdoc>
public SessionEndedEventArgs(SessionEndReasons reason)
{
_reason = reason;
}
/// <devdoc>
/// <para>Gets how the session ended.</para>
/// </devdoc>
public SessionEndReasons Reason
{
get
{
return _reason;
}
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/Methodical/Boxing/boxunbox/tailcall_boxunbox_il_d.ilproj
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Include="tailcall.il" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Include="tailcall.il" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Formats.Cbor/ref/System.Formats.Cbor.netcoreapp.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Formats.Cbor
{
public partial class CborReader
{
public System.Half ReadHalf() { throw null; }
}
public partial class CborWriter
{
public void WriteHalf(System.Half value) { }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Formats.Cbor
{
public partial class CborReader
{
public System.Half ReadHalf() { throw null; }
}
public partial class CborWriter
{
public void WriteHalf(System.Half value) { }
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/HardwareIntrinsics/General/Vector64_1/Zero.UInt64.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace JIT.HardwareIntrinsics.General
{
public static partial class Program
{
private static void ZeroUInt64()
{
var test = new VectorZero__ZeroUInt64();
// Validates basic functionality works
test.RunBasicScenario();
// Validates calling via reflection works
test.RunReflectionScenario();
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class VectorZero__ZeroUInt64
{
private static readonly int LargestVectorSize = 8;
private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
public bool Succeeded { get; set; } = true;
public void RunBasicScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
Vector64<UInt64> result = Vector64<UInt64>.Zero;
ValidateResult(result);
}
public void RunReflectionScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
object result = typeof(Vector64<UInt64>)
.GetProperty(nameof(Vector64<UInt64>.Zero), new Type[] { })
.GetGetMethod()
.Invoke(null, new object[] { });
ValidateResult((Vector64<UInt64>)(result));
}
private void ValidateResult(Vector64<UInt64> result, [CallerMemberName] string method = "")
{
UInt64[] resultElements = new UInt64[ElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
ValidateResult(resultElements, method);
}
private void ValidateResult(UInt64[] resultElements, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < ElementCount; i++)
{
if (resultElements[i] != 0)
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"Vector64.Zero(UInt64): {method} failed:");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace JIT.HardwareIntrinsics.General
{
public static partial class Program
{
private static void ZeroUInt64()
{
var test = new VectorZero__ZeroUInt64();
// Validates basic functionality works
test.RunBasicScenario();
// Validates calling via reflection works
test.RunReflectionScenario();
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class VectorZero__ZeroUInt64
{
private static readonly int LargestVectorSize = 8;
private static readonly int ElementCount = Unsafe.SizeOf<Vector64<UInt64>>() / sizeof(UInt64);
public bool Succeeded { get; set; } = true;
public void RunBasicScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
Vector64<UInt64> result = Vector64<UInt64>.Zero;
ValidateResult(result);
}
public void RunReflectionScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
object result = typeof(Vector64<UInt64>)
.GetProperty(nameof(Vector64<UInt64>.Zero), new Type[] { })
.GetGetMethod()
.Invoke(null, new object[] { });
ValidateResult((Vector64<UInt64>)(result));
}
private void ValidateResult(Vector64<UInt64> result, [CallerMemberName] string method = "")
{
UInt64[] resultElements = new UInt64[ElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<UInt64, byte>(ref resultElements[0]), result);
ValidateResult(resultElements, method);
}
private void ValidateResult(UInt64[] resultElements, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < ElementCount; i++)
{
if (resultElements[i] != 0)
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"Vector64.Zero(UInt64): {method} failed:");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/HardwareIntrinsics/X86/Sse2.X64/Sse2.X64_r.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<DebugType>Embedded</DebugType>
<Optimize />
</PropertyGroup>
<ItemGroup>
<Compile Include="ConvertToInt64.Vector128Double.cs" />
<Compile Include="ConvertToInt64.Vector128Int64.cs" />
<Compile Include="ConvertToUInt64.Vector128UInt64.cs" />
<Compile Include="ConvertToInt64WithTruncation.Vector128Double.cs" />
<Compile Include="ConvertScalarToVector128Double.Double.cs" />
<Compile Include="ConvertScalarToVector128Int64.Int64.cs" />
<Compile Include="ConvertScalarToVector128UInt64.UInt64.cs" />
<Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
<Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" />
<Compile Include="..\Shared\ScalarSimdUnOpTest_DataTable.cs" />
<Compile Include="..\Shared\Program.cs" />
<Compile Include="Program.Sse2.X64.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<DebugType>Embedded</DebugType>
<Optimize />
</PropertyGroup>
<ItemGroup>
<Compile Include="ConvertToInt64.Vector128Double.cs" />
<Compile Include="ConvertToInt64.Vector128Int64.cs" />
<Compile Include="ConvertToUInt64.Vector128UInt64.cs" />
<Compile Include="ConvertToInt64WithTruncation.Vector128Double.cs" />
<Compile Include="ConvertScalarToVector128Double.Double.cs" />
<Compile Include="ConvertScalarToVector128Int64.Int64.cs" />
<Compile Include="ConvertScalarToVector128UInt64.UInt64.cs" />
<Compile Include="..\Shared\SimpleBinOpConvTest_DataTable.cs" />
<Compile Include="..\Shared\SimdScalarUnOpTest_DataTable.cs" />
<Compile Include="..\Shared\ScalarSimdUnOpTest_DataTable.cs" />
<Compile Include="..\Shared\Program.cs" />
<Compile Include="Program.Sse2.X64.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Composition.AttributedModel/src/System/Composition/OnImportsSatisfiedAttribute.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Composition
{
/// <summary>
/// When applied to a void, parameterless instance method on a part,
/// MEF will call that method when composition of the part has
/// completed. The method must be public or internal.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class OnImportsSatisfiedAttribute : Attribute
{
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Composition
{
/// <summary>
/// When applied to a void, parameterless instance method on a part,
/// MEF will call that method when composition of the part has
/// completed. The method must be public or internal.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class OnImportsSatisfiedAttribute : Attribute
{
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2KeepAlivePing.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Test.Common;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace System.Net.Http.Functional.Tests
{
[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(SocketsHttpHandler_Http2KeepAlivePing_Test), nameof(IsSupported))]
public sealed class SocketsHttpHandler_Http2KeepAlivePing_Test : HttpClientHandlerTestBase
{
public static readonly bool IsSupported = PlatformDetection.SupportsAlpn && PlatformDetection.IsNotBrowser;
protected override Version UseVersion => HttpVersion20.Value;
private int _pingCounter;
private Http2LoopbackConnection _connection;
private SemaphoreSlim _writeSemaphore = new SemaphoreSlim(1);
private Channel<Frame> _framesChannel = Channel.CreateUnbounded<Frame>();
private CancellationTokenSource _incomingFramesCts = new CancellationTokenSource();
private Task _incomingFramesTask;
private TaskCompletionSource _serverFinished = new TaskCompletionSource();
private int _sendPingResponse = 1;
private static Http2Options NoAutoPingResponseHttp2Options => new Http2Options() { EnableTransparentPingResponse = false };
private static readonly TimeSpan TestTimeout = TimeSpan.FromSeconds(60);
public SocketsHttpHandler_Http2KeepAlivePing_Test(ITestOutputHelper output) : base(output)
{
}
[OuterLoop("Runs long")]
[Fact]
public async Task KeepAlivePingDelay_Infinite_NoKeepAlivePingIsSent()
{
await Http2LoopbackServer.CreateClientAndServerAsync(async uri =>
{
SocketsHttpHandler handler = new SocketsHttpHandler()
{
KeepAlivePingTimeout = TimeSpan.FromSeconds(1),
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always,
KeepAlivePingDelay = Timeout.InfiniteTimeSpan
};
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
using HttpClient client = new HttpClient(handler);
client.DefaultRequestVersion = HttpVersion.Version20;
// Warmup request to create connection:
await client.GetStringAsync(uri);
// Actual request:
await client.GetStringAsync(uri);
// Let connection live until server finishes:
await _serverFinished.Task.WaitAsync(TestTimeout);
},
async server =>
{
await EstablishConnectionAsync(server);
// Warmup the connection.
int streamId1 = await ReadRequestHeaderAsync();
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId1));
Interlocked.Exchange(ref _pingCounter, 0); // reset the PING counter
// Request under the test scope.
int streamId2 = await ReadRequestHeaderAsync();
// Simulate inactive period:
await Task.Delay(5_000);
// We may have received one RTT PING in response to HEADERS, but should receive no KeepAlive PING
Assert.True(_pingCounter <= 1);
Interlocked.Exchange(ref _pingCounter, 0); // reset the counter
// Finish the response:
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId2));
// Simulate inactive period:
await Task.Delay(5_000);
// We may have received one RTT PING in response to HEADERS, but should receive no KeepAlive PING
Assert.True(_pingCounter <= 1);
await TerminateLoopbackConnectionAsync();
}).WaitAsync(TestTimeout);
}
[OuterLoop("Runs long")]
[Theory]
[InlineData(HttpKeepAlivePingPolicy.Always)]
[InlineData(HttpKeepAlivePingPolicy.WithActiveRequests)]
public async Task KeepAliveConfigured_KeepAlivePingsAreSentAccordingToPolicy(HttpKeepAlivePingPolicy policy)
{
await Http2LoopbackServer.CreateClientAndServerAsync(async uri =>
{
SocketsHttpHandler handler = new SocketsHttpHandler()
{
KeepAlivePingTimeout = TimeSpan.FromSeconds(10),
KeepAlivePingPolicy = policy,
KeepAlivePingDelay = TimeSpan.FromSeconds(1)
};
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
using HttpClient client = new HttpClient(handler);
client.DefaultRequestVersion = HttpVersion.Version20;
// Warmup request to create connection:
HttpResponseMessage response0 = await client.GetAsync(uri);
Assert.Equal(HttpStatusCode.OK, response0.StatusCode);
// Actual request:
HttpResponseMessage response1 = await client.GetAsync(uri);
Assert.Equal(HttpStatusCode.OK, response1.StatusCode);
// Let connection live until server finishes:
await _serverFinished.Task.WaitAsync(TestTimeout);
},
async server =>
{
await EstablishConnectionAsync(server);
// Warmup the connection.
int streamId1 = await ReadRequestHeaderAsync();
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId1));
// Request under the test scope.
int streamId2 = await ReadRequestHeaderAsync();
Interlocked.Exchange(ref _pingCounter, 0); // reset the PING counter
// Simulate inactive period:
await Task.Delay(5_000);
// We may receive one RTT PING in response to HEADERS.
// Upon that, we expect to receive at least 1 keep alive PING:
Assert.True(_pingCounter > 1);
// Finish the response:
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId2));
Interlocked.Exchange(ref _pingCounter, 0); // reset the PING counter
if (policy == HttpKeepAlivePingPolicy.Always)
{
// Simulate inactive period:
await Task.Delay(5_000);
// We may receive one RTT PING in response to HEADERS.
// Upon that, we expect to receive at least 1 keep alive PING:
Assert.True(_pingCounter > 1);
}
else
{
// We should receive no more KeepAlive PINGs
Assert.True(_pingCounter <= 1);
}
await TerminateLoopbackConnectionAsync();
List<Frame> unexpectedFrames = new List<Frame>();
while (_framesChannel.Reader.Count > 0)
{
Frame unexpectedFrame = await _framesChannel.Reader.ReadAsync();
unexpectedFrames.Add(unexpectedFrame);
}
Assert.False(unexpectedFrames.Any(), "Received unexpected frames: \n" + string.Join('\n', unexpectedFrames.Select(f => f.ToString()).ToArray()));
}, NoAutoPingResponseHttp2Options).WaitAsync(TestTimeout);
}
[OuterLoop("Runs long")]
[Fact]
public async Task KeepAliveConfigured_NoPingResponseDuringActiveStream_RequestShouldFail()
{
await Http2LoopbackServer.CreateClientAndServerAsync(async uri =>
{
SocketsHttpHandler handler = new SocketsHttpHandler()
{
KeepAlivePingTimeout = TimeSpan.FromSeconds(1.5),
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.WithActiveRequests,
KeepAlivePingDelay = TimeSpan.FromSeconds(1)
};
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
using HttpClient client = new HttpClient(handler);
client.DefaultRequestVersion = HttpVersion.Version20;
// Warmup request to create connection:
HttpResponseMessage response0 = await client.GetAsync(uri);
Assert.Equal(HttpStatusCode.OK, response0.StatusCode);
// Actual request:
await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(uri));
// Let connection live until server finishes:
await _serverFinished.Task;
},
async server =>
{
await EstablishConnectionAsync(server);
// Warmup the connection.
int streamId1 = await ReadRequestHeaderAsync();
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId1));
// Request under the test scope.
int streamId2 = await ReadRequestHeaderAsync();
DisablePingResponse();
// Simulate inactive period:
await Task.Delay(6_000);
// Finish the response:
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId2));
await TerminateLoopbackConnectionAsync();
}, NoAutoPingResponseHttp2Options).WaitAsync(TestTimeout);
}
[OuterLoop("Runs long")]
[Fact]
public async Task HttpKeepAlivePingPolicy_Always_NoPingResponseBetweenStreams_SecondRequestShouldFail()
{
await Http2LoopbackServer.CreateClientAndServerAsync(async uri =>
{
SocketsHttpHandler handler = new SocketsHttpHandler()
{
KeepAlivePingTimeout = TimeSpan.FromSeconds(1.5),
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always,
KeepAlivePingDelay = TimeSpan.FromSeconds(1)
};
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
using HttpClient client = new HttpClient(handler);
client.DefaultRequestVersion = HttpVersion.Version20;
// Warmup request to create connection:
HttpResponseMessage response0 = await client.GetAsync(uri);
Assert.Equal(HttpStatusCode.OK, response0.StatusCode);
// Second request should fail:
await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(uri));
// Let connection live until server finishes:
await _serverFinished.Task;
},
async server =>
{
await EstablishConnectionAsync(server);
// Warmup the connection.
int streamId1 = await ReadRequestHeaderAsync();
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId1));
DisablePingResponse();
// Simulate inactive period:
await Task.Delay(6_000);
// Request under the test scope.
int streamId2 = await ReadRequestHeaderAsync();
// Finish the response:
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId2));
await TerminateLoopbackConnectionAsync();
}, NoAutoPingResponseHttp2Options).WaitAsync(TestTimeout);
}
private async Task ProcessIncomingFramesAsync(CancellationToken cancellationToken)
{
try
{
while (!cancellationToken.IsCancellationRequested)
{
Frame frame = await _connection.ReadFrameAsync(cancellationToken);
if (frame is PingFrame pingFrame)
{
if (pingFrame.AckFlag)
{
_output?.WriteLine($"Received unexpected PING ACK ({pingFrame.Data})");
await _framesChannel.Writer.WriteAsync(frame, cancellationToken);
}
else
{
_output?.WriteLine($"Received PING ({pingFrame.Data})");
Interlocked.Increment(ref _pingCounter);
if (_sendPingResponse > 0)
{
await GuardConnetionWriteAsync(() => _connection.SendPingAckAsync(pingFrame.Data, cancellationToken), cancellationToken);
}
}
}
else if (frame is WindowUpdateFrame windowUpdateFrame)
{
_output?.WriteLine($"Received WINDOW_UPDATE");
}
else if (frame is not null)
{
//_output?.WriteLine($"Received {frame}");
await _framesChannel.Writer.WriteAsync(frame, cancellationToken);
}
}
}
catch (OperationCanceledException)
{
}
_output?.WriteLine("ProcessIncomingFramesAsync finished");
_connection.Dispose();
}
private void DisablePingResponse() => Interlocked.Exchange(ref _sendPingResponse, 0);
private async Task EstablishConnectionAsync(Http2LoopbackServer server)
{
_connection = await server.EstablishConnectionAsync();
_incomingFramesTask = ProcessIncomingFramesAsync(_incomingFramesCts.Token);
}
private async Task TerminateLoopbackConnectionAsync()
{
_serverFinished.SetResult();
_incomingFramesCts.Cancel();
await _incomingFramesTask;
}
private async Task GuardConnetionWriteAsync(Func<Task> action, CancellationToken cancellationToken = default)
{
await _writeSemaphore.WaitAsync(cancellationToken);
await action();
_writeSemaphore.Release();
}
private async Task<HeadersFrame> ReadRequestHeaderFrameAsync(bool expectEndOfStream = true, CancellationToken cancellationToken = default)
{
// Receive HEADERS frame for request.
Frame frame = await _framesChannel.Reader.ReadAsync(cancellationToken).ConfigureAwait(false);
if (frame == null)
{
throw new IOException("Failed to read Headers frame.");
}
Assert.Equal(FrameType.Headers, frame.Type);
Assert.Equal(FrameFlags.EndHeaders, frame.Flags & FrameFlags.EndHeaders);
if (expectEndOfStream)
{
Assert.Equal(FrameFlags.EndStream, frame.Flags & FrameFlags.EndStream);
}
return (HeadersFrame)frame;
}
private async Task<int> ReadRequestHeaderAsync(bool expectEndOfStream = true, CancellationToken cancellationToken = default)
{
HeadersFrame frame = await ReadRequestHeaderFrameAsync(expectEndOfStream, cancellationToken);
return frame.StreamId;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Test.Common;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace System.Net.Http.Functional.Tests
{
[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(SocketsHttpHandler_Http2KeepAlivePing_Test), nameof(IsSupported))]
public sealed class SocketsHttpHandler_Http2KeepAlivePing_Test : HttpClientHandlerTestBase
{
public static readonly bool IsSupported = PlatformDetection.SupportsAlpn && PlatformDetection.IsNotBrowser;
protected override Version UseVersion => HttpVersion20.Value;
private int _pingCounter;
private Http2LoopbackConnection _connection;
private SemaphoreSlim _writeSemaphore = new SemaphoreSlim(1);
private Channel<Frame> _framesChannel = Channel.CreateUnbounded<Frame>();
private CancellationTokenSource _incomingFramesCts = new CancellationTokenSource();
private Task _incomingFramesTask;
private TaskCompletionSource _serverFinished = new TaskCompletionSource();
private int _sendPingResponse = 1;
private static Http2Options NoAutoPingResponseHttp2Options => new Http2Options() { EnableTransparentPingResponse = false };
private static readonly TimeSpan TestTimeout = TimeSpan.FromSeconds(60);
public SocketsHttpHandler_Http2KeepAlivePing_Test(ITestOutputHelper output) : base(output)
{
}
[OuterLoop("Runs long")]
[Fact]
public async Task KeepAlivePingDelay_Infinite_NoKeepAlivePingIsSent()
{
await Http2LoopbackServer.CreateClientAndServerAsync(async uri =>
{
SocketsHttpHandler handler = new SocketsHttpHandler()
{
KeepAlivePingTimeout = TimeSpan.FromSeconds(1),
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always,
KeepAlivePingDelay = Timeout.InfiniteTimeSpan
};
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
using HttpClient client = new HttpClient(handler);
client.DefaultRequestVersion = HttpVersion.Version20;
// Warmup request to create connection:
await client.GetStringAsync(uri);
// Actual request:
await client.GetStringAsync(uri);
// Let connection live until server finishes:
await _serverFinished.Task.WaitAsync(TestTimeout);
},
async server =>
{
await EstablishConnectionAsync(server);
// Warmup the connection.
int streamId1 = await ReadRequestHeaderAsync();
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId1));
Interlocked.Exchange(ref _pingCounter, 0); // reset the PING counter
// Request under the test scope.
int streamId2 = await ReadRequestHeaderAsync();
// Simulate inactive period:
await Task.Delay(5_000);
// We may have received one RTT PING in response to HEADERS, but should receive no KeepAlive PING
Assert.True(_pingCounter <= 1);
Interlocked.Exchange(ref _pingCounter, 0); // reset the counter
// Finish the response:
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId2));
// Simulate inactive period:
await Task.Delay(5_000);
// We may have received one RTT PING in response to HEADERS, but should receive no KeepAlive PING
Assert.True(_pingCounter <= 1);
await TerminateLoopbackConnectionAsync();
}).WaitAsync(TestTimeout);
}
[OuterLoop("Runs long")]
[Theory]
[InlineData(HttpKeepAlivePingPolicy.Always)]
[InlineData(HttpKeepAlivePingPolicy.WithActiveRequests)]
public async Task KeepAliveConfigured_KeepAlivePingsAreSentAccordingToPolicy(HttpKeepAlivePingPolicy policy)
{
await Http2LoopbackServer.CreateClientAndServerAsync(async uri =>
{
SocketsHttpHandler handler = new SocketsHttpHandler()
{
KeepAlivePingTimeout = TimeSpan.FromSeconds(10),
KeepAlivePingPolicy = policy,
KeepAlivePingDelay = TimeSpan.FromSeconds(1)
};
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
using HttpClient client = new HttpClient(handler);
client.DefaultRequestVersion = HttpVersion.Version20;
// Warmup request to create connection:
HttpResponseMessage response0 = await client.GetAsync(uri);
Assert.Equal(HttpStatusCode.OK, response0.StatusCode);
// Actual request:
HttpResponseMessage response1 = await client.GetAsync(uri);
Assert.Equal(HttpStatusCode.OK, response1.StatusCode);
// Let connection live until server finishes:
await _serverFinished.Task.WaitAsync(TestTimeout);
},
async server =>
{
await EstablishConnectionAsync(server);
// Warmup the connection.
int streamId1 = await ReadRequestHeaderAsync();
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId1));
// Request under the test scope.
int streamId2 = await ReadRequestHeaderAsync();
Interlocked.Exchange(ref _pingCounter, 0); // reset the PING counter
// Simulate inactive period:
await Task.Delay(5_000);
// We may receive one RTT PING in response to HEADERS.
// Upon that, we expect to receive at least 1 keep alive PING:
Assert.True(_pingCounter > 1);
// Finish the response:
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId2));
Interlocked.Exchange(ref _pingCounter, 0); // reset the PING counter
if (policy == HttpKeepAlivePingPolicy.Always)
{
// Simulate inactive period:
await Task.Delay(5_000);
// We may receive one RTT PING in response to HEADERS.
// Upon that, we expect to receive at least 1 keep alive PING:
Assert.True(_pingCounter > 1);
}
else
{
// We should receive no more KeepAlive PINGs
Assert.True(_pingCounter <= 1);
}
await TerminateLoopbackConnectionAsync();
List<Frame> unexpectedFrames = new List<Frame>();
while (_framesChannel.Reader.Count > 0)
{
Frame unexpectedFrame = await _framesChannel.Reader.ReadAsync();
unexpectedFrames.Add(unexpectedFrame);
}
Assert.False(unexpectedFrames.Any(), "Received unexpected frames: \n" + string.Join('\n', unexpectedFrames.Select(f => f.ToString()).ToArray()));
}, NoAutoPingResponseHttp2Options).WaitAsync(TestTimeout);
}
[OuterLoop("Runs long")]
[Fact]
public async Task KeepAliveConfigured_NoPingResponseDuringActiveStream_RequestShouldFail()
{
await Http2LoopbackServer.CreateClientAndServerAsync(async uri =>
{
SocketsHttpHandler handler = new SocketsHttpHandler()
{
KeepAlivePingTimeout = TimeSpan.FromSeconds(1.5),
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.WithActiveRequests,
KeepAlivePingDelay = TimeSpan.FromSeconds(1)
};
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
using HttpClient client = new HttpClient(handler);
client.DefaultRequestVersion = HttpVersion.Version20;
// Warmup request to create connection:
HttpResponseMessage response0 = await client.GetAsync(uri);
Assert.Equal(HttpStatusCode.OK, response0.StatusCode);
// Actual request:
await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(uri));
// Let connection live until server finishes:
await _serverFinished.Task;
},
async server =>
{
await EstablishConnectionAsync(server);
// Warmup the connection.
int streamId1 = await ReadRequestHeaderAsync();
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId1));
// Request under the test scope.
int streamId2 = await ReadRequestHeaderAsync();
DisablePingResponse();
// Simulate inactive period:
await Task.Delay(6_000);
// Finish the response:
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId2));
await TerminateLoopbackConnectionAsync();
}, NoAutoPingResponseHttp2Options).WaitAsync(TestTimeout);
}
[OuterLoop("Runs long")]
[Fact]
public async Task HttpKeepAlivePingPolicy_Always_NoPingResponseBetweenStreams_SecondRequestShouldFail()
{
await Http2LoopbackServer.CreateClientAndServerAsync(async uri =>
{
SocketsHttpHandler handler = new SocketsHttpHandler()
{
KeepAlivePingTimeout = TimeSpan.FromSeconds(1.5),
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always,
KeepAlivePingDelay = TimeSpan.FromSeconds(1)
};
handler.SslOptions.RemoteCertificateValidationCallback = delegate { return true; };
using HttpClient client = new HttpClient(handler);
client.DefaultRequestVersion = HttpVersion.Version20;
// Warmup request to create connection:
HttpResponseMessage response0 = await client.GetAsync(uri);
Assert.Equal(HttpStatusCode.OK, response0.StatusCode);
// Second request should fail:
await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(uri));
// Let connection live until server finishes:
await _serverFinished.Task;
},
async server =>
{
await EstablishConnectionAsync(server);
// Warmup the connection.
int streamId1 = await ReadRequestHeaderAsync();
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId1));
DisablePingResponse();
// Simulate inactive period:
await Task.Delay(6_000);
// Request under the test scope.
int streamId2 = await ReadRequestHeaderAsync();
// Finish the response:
await GuardConnetionWriteAsync(() => _connection.SendDefaultResponseAsync(streamId2));
await TerminateLoopbackConnectionAsync();
}, NoAutoPingResponseHttp2Options).WaitAsync(TestTimeout);
}
private async Task ProcessIncomingFramesAsync(CancellationToken cancellationToken)
{
try
{
while (!cancellationToken.IsCancellationRequested)
{
Frame frame = await _connection.ReadFrameAsync(cancellationToken);
if (frame is PingFrame pingFrame)
{
if (pingFrame.AckFlag)
{
_output?.WriteLine($"Received unexpected PING ACK ({pingFrame.Data})");
await _framesChannel.Writer.WriteAsync(frame, cancellationToken);
}
else
{
_output?.WriteLine($"Received PING ({pingFrame.Data})");
Interlocked.Increment(ref _pingCounter);
if (_sendPingResponse > 0)
{
await GuardConnetionWriteAsync(() => _connection.SendPingAckAsync(pingFrame.Data, cancellationToken), cancellationToken);
}
}
}
else if (frame is WindowUpdateFrame windowUpdateFrame)
{
_output?.WriteLine($"Received WINDOW_UPDATE");
}
else if (frame is not null)
{
//_output?.WriteLine($"Received {frame}");
await _framesChannel.Writer.WriteAsync(frame, cancellationToken);
}
}
}
catch (OperationCanceledException)
{
}
_output?.WriteLine("ProcessIncomingFramesAsync finished");
_connection.Dispose();
}
private void DisablePingResponse() => Interlocked.Exchange(ref _sendPingResponse, 0);
private async Task EstablishConnectionAsync(Http2LoopbackServer server)
{
_connection = await server.EstablishConnectionAsync();
_incomingFramesTask = ProcessIncomingFramesAsync(_incomingFramesCts.Token);
}
private async Task TerminateLoopbackConnectionAsync()
{
_serverFinished.SetResult();
_incomingFramesCts.Cancel();
await _incomingFramesTask;
}
private async Task GuardConnetionWriteAsync(Func<Task> action, CancellationToken cancellationToken = default)
{
await _writeSemaphore.WaitAsync(cancellationToken);
await action();
_writeSemaphore.Release();
}
private async Task<HeadersFrame> ReadRequestHeaderFrameAsync(bool expectEndOfStream = true, CancellationToken cancellationToken = default)
{
// Receive HEADERS frame for request.
Frame frame = await _framesChannel.Reader.ReadAsync(cancellationToken).ConfigureAwait(false);
if (frame == null)
{
throw new IOException("Failed to read Headers frame.");
}
Assert.Equal(FrameType.Headers, frame.Type);
Assert.Equal(FrameFlags.EndHeaders, frame.Flags & FrameFlags.EndHeaders);
if (expectEndOfStream)
{
Assert.Equal(FrameFlags.EndStream, frame.Flags & FrameFlags.EndStream);
}
return (HeadersFrame)frame;
}
private async Task<int> ReadRequestHeaderAsync(bool expectEndOfStream = true, CancellationToken cancellationToken = default)
{
HeadersFrame frame = await ReadRequestHeaderFrameAsync(expectEndOfStream, cancellationToken);
return frame.StreamId;
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/Methodical/tailcall/compat_enum_il_d.ilproj
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<DebugType>Full</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Include="compat_enum.il" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<DebugType>Full</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Include="compat_enum.il" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Formats.Asn1/tests/Reader/ReadLength.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Reflection;
using Test.Cryptography;
using Xunit;
namespace System.Formats.Asn1.Tests.Reader
{
public sealed class ReadLength
{
private delegate Asn1Tag ReadTagAndLengthDelegate(
ReadOnlySpan<byte> source,
AsnEncodingRules ruleSet,
out int? parsedLength,
out int bytesRead);
private static ReadTagAndLengthDelegate ReadTagAndLength = (ReadTagAndLengthDelegate)
typeof(AsnDecoder).GetMethod("ReadTagAndLength", BindingFlags.Static | BindingFlags.NonPublic)
.CreateDelegate(typeof(ReadTagAndLengthDelegate));
[Theory]
[InlineData(4, 0, "0400")]
[InlineData(1, 1, "0101")]
[InlineData(4, 127, "047F")]
[InlineData(4, 128, "048180")]
[InlineData(4, 255, "0481FF")]
[InlineData(2, 256, "02820100")]
[InlineData(4, int.MaxValue, "04847FFFFFFF")]
public static void MinimalPrimitiveLength(int tagValue, int length, string inputHex)
{
byte[] inputBytes = inputHex.HexToByteArray();
foreach (AsnEncodingRules rules in Enum.GetValues(typeof(AsnEncodingRules)))
{
Asn1Tag tag = ReadTagAndLength(inputBytes, rules, out int? parsedLength, out int bytesRead);
Assert.Equal(inputBytes.Length, bytesRead);
Assert.False(tag.IsConstructed, "tag.IsConstructed");
Assert.Equal(tagValue, tag.TagValue);
Assert.Equal(length, parsedLength.Value);
}
}
[Theory]
[InlineData(-1)]
[InlineData(3)]
public static void ReadWithUnknownRuleSet(int invalidRuleSetValue)
{
byte[] data = { 0x05, 0x00 };
Assert.Throws<ArgumentOutOfRangeException>(
() => new AsnReader(data, (AsnEncodingRules)invalidRuleSetValue));
}
[Theory]
[InlineData("")]
[InlineData("05")]
[InlineData("0481")]
[InlineData("048201")]
[InlineData("04830102")]
[InlineData("0484010203")]
public static void ReadWithInsufficientData(string inputHex)
{
byte[] inputData = inputHex.HexToByteArray();
Assert.Throws<AsnContentException>(
() => ReadTagAndLength(inputData, AsnEncodingRules.DER, out _, out _));
}
[Theory]
[InlineData("DER indefinite constructed", AsnEncodingRules.DER, "3080" + "0500" + "0000")]
[InlineData("0xFF-BER", AsnEncodingRules.BER, "04FF")]
[InlineData("0xFF-CER", AsnEncodingRules.CER, "04FF")]
[InlineData("0xFF-DER", AsnEncodingRules.DER, "04FF")]
[InlineData("CER definite constructed", AsnEncodingRules.CER, "30820500")]
[InlineData("BER indefinite primitive", AsnEncodingRules.BER, "0480" + "0000")]
[InlineData("CER indefinite primitive", AsnEncodingRules.CER, "0480" + "0000")]
[InlineData("DER indefinite primitive", AsnEncodingRules.DER, "0480" + "0000")]
[InlineData("DER non-minimal 0", AsnEncodingRules.DER, "048100")]
[InlineData("DER non-minimal 7F", AsnEncodingRules.DER, "04817F")]
[InlineData("DER non-minimal 80", AsnEncodingRules.DER, "04820080")]
[InlineData("CER non-minimal 0", AsnEncodingRules.CER, "048100")]
[InlineData("CER non-minimal 7F", AsnEncodingRules.CER, "04817F")]
[InlineData("CER non-minimal 80", AsnEncodingRules.CER, "04820080")]
[InlineData("BER too large", AsnEncodingRules.BER, "048480000000")]
[InlineData("CER too large", AsnEncodingRules.CER, "048480000000")]
[InlineData("DER too large", AsnEncodingRules.DER, "048480000000")]
[InlineData("BER padded too large", AsnEncodingRules.BER, "0486000080000000")]
[InlineData("BER uint.MaxValue", AsnEncodingRules.BER, "0484FFFFFFFF")]
[InlineData("CER uint.MaxValue", AsnEncodingRules.CER, "0484FFFFFFFF")]
[InlineData("DER uint.MaxValue", AsnEncodingRules.DER, "0484FFFFFFFF")]
[InlineData("BER padded uint.MaxValue", AsnEncodingRules.BER, "048800000000FFFFFFFF")]
[InlineData("BER 5 byte spread", AsnEncodingRules.BER, "04850100000000")]
[InlineData("CER 5 byte spread", AsnEncodingRules.CER, "04850100000000")]
[InlineData("DER 5 byte spread", AsnEncodingRules.DER, "04850100000000")]
[InlineData("BER padded 5 byte spread", AsnEncodingRules.BER, "0486000100000000")]
public static void InvalidLengths(
string description,
AsnEncodingRules rules,
string inputHex)
{
_ = description;
byte[] inputData = inputHex.HexToByteArray();
AsnReader reader = new AsnReader(inputData, rules);
Assert.Throws<AsnContentException>(
() => ReadTagAndLength(inputData, rules, out _, out _));
}
[Theory]
[InlineData(AsnEncodingRules.BER)]
[InlineData(AsnEncodingRules.CER)]
public static void IndefiniteLength(AsnEncodingRules ruleSet)
{
// SEQUENCE (indefinite)
// NULL
// End-of-Contents
byte[] data = { 0x30, 0x80, 0x05, 0x00, 0x00, 0x00 };
AsnReader reader = new AsnReader(data, ruleSet);
Asn1Tag tag = ReadTagAndLength(
data,
ruleSet,
out int? length,
out int bytesRead);
Assert.Equal(2, bytesRead);
Assert.False(length.HasValue, "length.HasValue");
Assert.Equal((int)UniversalTagNumber.Sequence, tag.TagValue);
Assert.True(tag.IsConstructed, "tag.IsConstructed");
}
[Theory]
[InlineData(0, "0483000000")]
[InlineData(1, "048A00000000000000000001")]
[InlineData(128, "049000000000000000000000000000000080")]
public static void BerNonMinimalLength(int expectedLength, string inputHex)
{
byte[] inputData = inputHex.HexToByteArray();
AsnReader reader = new AsnReader(inputData, AsnEncodingRules.BER);
Asn1Tag tag = ReadTagAndLength(
inputData,
AsnEncodingRules.BER,
out int? length,
out int bytesRead);
Assert.Equal(inputData.Length, bytesRead);
Assert.Equal(expectedLength, length.Value);
// ReadTagAndLength doesn't move the _data span forward.
Assert.True(reader.HasData, "reader.HasData");
}
[Theory]
[InlineData(AsnEncodingRules.BER, 4, 0, 5, "0483000000" + "0500")]
[InlineData(AsnEncodingRules.DER, 1, 1, 2, "0101" + "FF")]
[InlineData(AsnEncodingRules.CER, 0x10, null, 2, "3080" + "0500" + "0000")]
public static void ReadWithDataRemaining(
AsnEncodingRules ruleSet,
int tagValue,
int? expectedLength,
int expectedBytesRead,
string inputHex)
{
byte[] inputData = inputHex.HexToByteArray();
Asn1Tag tag = ReadTagAndLength(
inputData,
ruleSet,
out int? length,
out int bytesRead);
Assert.Equal(expectedBytesRead, bytesRead);
Assert.Equal(tagValue, tag.TagValue);
Assert.Equal(expectedLength, length);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Reflection;
using Test.Cryptography;
using Xunit;
namespace System.Formats.Asn1.Tests.Reader
{
public sealed class ReadLength
{
private delegate Asn1Tag ReadTagAndLengthDelegate(
ReadOnlySpan<byte> source,
AsnEncodingRules ruleSet,
out int? parsedLength,
out int bytesRead);
private static ReadTagAndLengthDelegate ReadTagAndLength = (ReadTagAndLengthDelegate)
typeof(AsnDecoder).GetMethod("ReadTagAndLength", BindingFlags.Static | BindingFlags.NonPublic)
.CreateDelegate(typeof(ReadTagAndLengthDelegate));
[Theory]
[InlineData(4, 0, "0400")]
[InlineData(1, 1, "0101")]
[InlineData(4, 127, "047F")]
[InlineData(4, 128, "048180")]
[InlineData(4, 255, "0481FF")]
[InlineData(2, 256, "02820100")]
[InlineData(4, int.MaxValue, "04847FFFFFFF")]
public static void MinimalPrimitiveLength(int tagValue, int length, string inputHex)
{
byte[] inputBytes = inputHex.HexToByteArray();
foreach (AsnEncodingRules rules in Enum.GetValues(typeof(AsnEncodingRules)))
{
Asn1Tag tag = ReadTagAndLength(inputBytes, rules, out int? parsedLength, out int bytesRead);
Assert.Equal(inputBytes.Length, bytesRead);
Assert.False(tag.IsConstructed, "tag.IsConstructed");
Assert.Equal(tagValue, tag.TagValue);
Assert.Equal(length, parsedLength.Value);
}
}
[Theory]
[InlineData(-1)]
[InlineData(3)]
public static void ReadWithUnknownRuleSet(int invalidRuleSetValue)
{
byte[] data = { 0x05, 0x00 };
Assert.Throws<ArgumentOutOfRangeException>(
() => new AsnReader(data, (AsnEncodingRules)invalidRuleSetValue));
}
[Theory]
[InlineData("")]
[InlineData("05")]
[InlineData("0481")]
[InlineData("048201")]
[InlineData("04830102")]
[InlineData("0484010203")]
public static void ReadWithInsufficientData(string inputHex)
{
byte[] inputData = inputHex.HexToByteArray();
Assert.Throws<AsnContentException>(
() => ReadTagAndLength(inputData, AsnEncodingRules.DER, out _, out _));
}
[Theory]
[InlineData("DER indefinite constructed", AsnEncodingRules.DER, "3080" + "0500" + "0000")]
[InlineData("0xFF-BER", AsnEncodingRules.BER, "04FF")]
[InlineData("0xFF-CER", AsnEncodingRules.CER, "04FF")]
[InlineData("0xFF-DER", AsnEncodingRules.DER, "04FF")]
[InlineData("CER definite constructed", AsnEncodingRules.CER, "30820500")]
[InlineData("BER indefinite primitive", AsnEncodingRules.BER, "0480" + "0000")]
[InlineData("CER indefinite primitive", AsnEncodingRules.CER, "0480" + "0000")]
[InlineData("DER indefinite primitive", AsnEncodingRules.DER, "0480" + "0000")]
[InlineData("DER non-minimal 0", AsnEncodingRules.DER, "048100")]
[InlineData("DER non-minimal 7F", AsnEncodingRules.DER, "04817F")]
[InlineData("DER non-minimal 80", AsnEncodingRules.DER, "04820080")]
[InlineData("CER non-minimal 0", AsnEncodingRules.CER, "048100")]
[InlineData("CER non-minimal 7F", AsnEncodingRules.CER, "04817F")]
[InlineData("CER non-minimal 80", AsnEncodingRules.CER, "04820080")]
[InlineData("BER too large", AsnEncodingRules.BER, "048480000000")]
[InlineData("CER too large", AsnEncodingRules.CER, "048480000000")]
[InlineData("DER too large", AsnEncodingRules.DER, "048480000000")]
[InlineData("BER padded too large", AsnEncodingRules.BER, "0486000080000000")]
[InlineData("BER uint.MaxValue", AsnEncodingRules.BER, "0484FFFFFFFF")]
[InlineData("CER uint.MaxValue", AsnEncodingRules.CER, "0484FFFFFFFF")]
[InlineData("DER uint.MaxValue", AsnEncodingRules.DER, "0484FFFFFFFF")]
[InlineData("BER padded uint.MaxValue", AsnEncodingRules.BER, "048800000000FFFFFFFF")]
[InlineData("BER 5 byte spread", AsnEncodingRules.BER, "04850100000000")]
[InlineData("CER 5 byte spread", AsnEncodingRules.CER, "04850100000000")]
[InlineData("DER 5 byte spread", AsnEncodingRules.DER, "04850100000000")]
[InlineData("BER padded 5 byte spread", AsnEncodingRules.BER, "0486000100000000")]
public static void InvalidLengths(
string description,
AsnEncodingRules rules,
string inputHex)
{
_ = description;
byte[] inputData = inputHex.HexToByteArray();
AsnReader reader = new AsnReader(inputData, rules);
Assert.Throws<AsnContentException>(
() => ReadTagAndLength(inputData, rules, out _, out _));
}
[Theory]
[InlineData(AsnEncodingRules.BER)]
[InlineData(AsnEncodingRules.CER)]
public static void IndefiniteLength(AsnEncodingRules ruleSet)
{
// SEQUENCE (indefinite)
// NULL
// End-of-Contents
byte[] data = { 0x30, 0x80, 0x05, 0x00, 0x00, 0x00 };
AsnReader reader = new AsnReader(data, ruleSet);
Asn1Tag tag = ReadTagAndLength(
data,
ruleSet,
out int? length,
out int bytesRead);
Assert.Equal(2, bytesRead);
Assert.False(length.HasValue, "length.HasValue");
Assert.Equal((int)UniversalTagNumber.Sequence, tag.TagValue);
Assert.True(tag.IsConstructed, "tag.IsConstructed");
}
[Theory]
[InlineData(0, "0483000000")]
[InlineData(1, "048A00000000000000000001")]
[InlineData(128, "049000000000000000000000000000000080")]
public static void BerNonMinimalLength(int expectedLength, string inputHex)
{
byte[] inputData = inputHex.HexToByteArray();
AsnReader reader = new AsnReader(inputData, AsnEncodingRules.BER);
Asn1Tag tag = ReadTagAndLength(
inputData,
AsnEncodingRules.BER,
out int? length,
out int bytesRead);
Assert.Equal(inputData.Length, bytesRead);
Assert.Equal(expectedLength, length.Value);
// ReadTagAndLength doesn't move the _data span forward.
Assert.True(reader.HasData, "reader.HasData");
}
[Theory]
[InlineData(AsnEncodingRules.BER, 4, 0, 5, "0483000000" + "0500")]
[InlineData(AsnEncodingRules.DER, 1, 1, 2, "0101" + "FF")]
[InlineData(AsnEncodingRules.CER, 0x10, null, 2, "3080" + "0500" + "0000")]
public static void ReadWithDataRemaining(
AsnEncodingRules ruleSet,
int tagValue,
int? expectedLength,
int expectedBytesRead,
string inputHex)
{
byte[] inputData = inputHex.HexToByteArray();
Asn1Tag tag = ReadTagAndLength(
inputData,
ruleSet,
out int? length,
out int bytesRead);
Assert.Equal(expectedBytesRead, bytesRead);
Assert.Equal(tagValue, tag.TagValue);
Assert.Equal(expectedLength, length);
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/MaxAcross.Vector128.Int32.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void MaxAcross_Vector128_Int32()
{
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_Int32();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleUnaryOpTest__MaxAcross_Vector128_Int32
{
private struct DataTable
{
private byte[] inArray1;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Int32[] inArray1, Int32[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector128<Int32> _fld1;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
return testStruct;
}
public void RunStructFldScenario(SimpleUnaryOpTest__MaxAcross_Vector128_Int32 testClass)
{
var result = AdvSimd.Arm64.MaxAcross(_fld1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleUnaryOpTest__MaxAcross_Vector128_Int32 testClass)
{
fixed (Vector128<Int32>* pFld1 = &_fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(pFld1))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Vector128<Int32> _clsVar1;
private Vector128<Int32> _fld1;
private DataTable _dataTable;
static SimpleUnaryOpTest__MaxAcross_Vector128_Int32()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__MaxAcross_Vector128_Int32()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
_dataTable = new DataTable(_data1, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.MaxAcross(
Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.MaxAcross), new Type[] { typeof(Vector128<Int32>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.MaxAcross), new Type[] { typeof(Vector128<Int32>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.MaxAcross(
_clsVar1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector128<Int32>* pClsVar1 = &_clsVar1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(pClsVar1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr);
var result = AdvSimd.Arm64.MaxAcross(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr));
var result = AdvSimd.Arm64.MaxAcross(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_Int32();
var result = AdvSimd.Arm64.MaxAcross(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_Int32();
fixed (Vector128<Int32>* pFld1 = &test._fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(pFld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.MaxAcross(_fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector128<Int32>* pFld1 = &_fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(pFld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.MaxAcross(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(&test._fld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector128<Int32> op1, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.MaxAcross(firstOp) != result[0])
{
succeeded = false;
}
else
{
for (int i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.MaxAcross)}<Int32>(Vector128<Int32>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void MaxAcross_Vector128_Int32()
{
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_Int32();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleUnaryOpTest__MaxAcross_Vector128_Int32
{
private struct DataTable
{
private byte[] inArray1;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Int32[] inArray1, Int32[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector128<Int32> _fld1;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
return testStruct;
}
public void RunStructFldScenario(SimpleUnaryOpTest__MaxAcross_Vector128_Int32 testClass)
{
var result = AdvSimd.Arm64.MaxAcross(_fld1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleUnaryOpTest__MaxAcross_Vector128_Int32 testClass)
{
fixed (Vector128<Int32>* pFld1 = &_fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(pFld1))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Vector128<Int32> _clsVar1;
private Vector128<Int32> _fld1;
private DataTable _dataTable;
static SimpleUnaryOpTest__MaxAcross_Vector128_Int32()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
}
public SimpleUnaryOpTest__MaxAcross_Vector128_Int32()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
_dataTable = new DataTable(_data1, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.MaxAcross(
Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.MaxAcross), new Type[] { typeof(Vector128<Int32>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.MaxAcross), new Type[] { typeof(Vector128<Int32>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.MaxAcross(
_clsVar1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector128<Int32>* pClsVar1 = &_clsVar1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(pClsVar1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr);
var result = AdvSimd.Arm64.MaxAcross(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector128((Int32*)(_dataTable.inArray1Ptr));
var result = AdvSimd.Arm64.MaxAcross(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_Int32();
var result = AdvSimd.Arm64.MaxAcross(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_Int32();
fixed (Vector128<Int32>* pFld1 = &test._fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(pFld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.MaxAcross(_fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector128<Int32>* pFld1 = &_fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(pFld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.MaxAcross(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((Int32*)(&test._fld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector128<Int32> op1, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.MaxAcross(firstOp) != result[0])
{
succeeded = false;
}
else
{
for (int i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.MaxAcross)}<Int32>(Vector128<Int32>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/Directed/cmov/Int_Or_Op_cs_r.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>False</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="Int_Or_Op.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>False</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="Int_Or_Op.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/IDuplexPipe.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.IO.Pipelines
{
/// <summary>Defines a class that provides a duplex pipe from which data can be read from and written to.</summary>
public interface IDuplexPipe
{
/// <summary>Gets the <see cref="System.IO.Pipelines.PipeReader" /> half of the duplex pipe.</summary>
PipeReader Input { get; }
/// <summary>Gets the <see cref="System.IO.Pipelines.PipeWriter" /> half of the duplex pipe.</summary>
PipeWriter Output { get; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.IO.Pipelines
{
/// <summary>Defines a class that provides a duplex pipe from which data can be read from and written to.</summary>
public interface IDuplexPipe
{
/// <summary>Gets the <see cref="System.IO.Pipelines.PipeReader" /> half of the duplex pipe.</summary>
PipeReader Input { get; }
/// <summary>Gets the <see cref="System.IO.Pipelines.PipeWriter" /> half of the duplex pipe.</summary>
PipeWriter Output { get; }
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/native/corehost/fxr/standalone/hostfxr_unixexports.src
|
; Licensed to the .NET Foundation under one or more agreements.
; The .NET Foundation licenses this file to you under the MIT license.
hostfxr_main_bundle_startupinfo
hostfxr_main_startupinfo
hostfxr_main
hostfxr_resolve_sdk
hostfxr_resolve_sdk2
hostfxr_get_available_sdks
hostfxr_get_dotnet_environment_info
hostfxr_get_native_search_directories
hostfxr_set_error_writer
hostfxr_initialize_for_dotnet_command_line
hostfxr_initialize_for_runtime_config
hostfxr_run_app
hostfxr_get_runtime_delegate
hostfxr_get_runtime_property_value
hostfxr_set_runtime_property_value
hostfxr_get_runtime_properties
hostfxr_close
|
; Licensed to the .NET Foundation under one or more agreements.
; The .NET Foundation licenses this file to you under the MIT license.
hostfxr_main_bundle_startupinfo
hostfxr_main_startupinfo
hostfxr_main
hostfxr_resolve_sdk
hostfxr_resolve_sdk2
hostfxr_get_available_sdks
hostfxr_get_dotnet_environment_info
hostfxr_get_native_search_directories
hostfxr_set_error_writer
hostfxr_initialize_for_dotnet_command_line
hostfxr_initialize_for_runtime_config
hostfxr_run_app
hostfxr_get_runtime_delegate
hostfxr_get_runtime_property_value
hostfxr_set_runtime_property_value
hostfxr_get_runtime_properties
hostfxr_close
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/Loader/classloader/generics/Layout/General/struct01_auto.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="struct01_auto.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="struct01_auto.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/System.Console/src/System/ConsoleCancelEventArgs.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System
{
public delegate void ConsoleCancelEventHandler(object? sender, ConsoleCancelEventArgs e);
public sealed class ConsoleCancelEventArgs : EventArgs
{
private readonly ConsoleSpecialKey _type;
internal ConsoleCancelEventArgs(ConsoleSpecialKey type)
{
_type = type;
}
// Whether to cancel the break event. By setting this to true, the
// Control-C will not kill the process.
public bool Cancel
{
get; set;
}
public ConsoleSpecialKey SpecialKey
{
get { return _type; }
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System
{
public delegate void ConsoleCancelEventHandler(object? sender, ConsoleCancelEventArgs e);
public sealed class ConsoleCancelEventArgs : EventArgs
{
private readonly ConsoleSpecialKey _type;
internal ConsoleCancelEventArgs(ConsoleSpecialKey type)
{
_type = type;
}
// Whether to cancel the break event. By setting this to true, the
// Control-C will not kill the process.
public bool Cancel
{
get; set;
}
public ConsoleSpecialKey SpecialKey
{
get { return _type; }
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M11-Beta1/b33888/b33888.ilproj
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>PdbOnly</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).il" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>PdbOnly</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).il" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/Methodical/refany/native_do.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="native.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="native.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/tests/JIT/HardwareIntrinsics/X86/Fma_Vector256/MultiplyAdd.Double.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
namespace JIT.HardwareIntrinsics.X86
{
public static partial class Program
{
private static void MultiplyAddDouble()
{
var test = new SimpleTernaryOpTest__MultiplyAddDouble();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (Avx.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
// Validates basic functionality works, using LoadAligned
test.RunBasicScenario_LoadAligned();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (Avx.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
// Validates calling via reflection works, using LoadAligned
test.RunReflectionScenario_LoadAligned();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (Avx.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (Avx.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
// Validates passing a local works, using LoadAligned
test.RunLclVarScenario_LoadAligned();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (Avx.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (Avx.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (Avx.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (Avx.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleTernaryOpTest__MultiplyAddDouble
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] inArray3;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle inHandle3;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Double[] inArray1, Double[] inArray2, Double[] inArray3, Double[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Double>();
int sizeOfinArray3 = inArray3.Length * Unsafe.SizeOf<Double>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>();
if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfinArray3 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.inArray3 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.inHandle3 = GCHandle.Alloc(this.inArray3, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Double, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray3Ptr), ref Unsafe.As<Double, byte>(ref inArray3[0]), (uint)sizeOfinArray3);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray3Ptr => Align((byte*)(inHandle3.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
inHandle3.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector256<Double> _fld1;
public Vector256<Double> _fld2;
public Vector256<Double> _fld3;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
return testStruct;
}
public void RunStructFldScenario(SimpleTernaryOpTest__MultiplyAddDouble testClass)
{
var result = Fma.MultiplyAdd(_fld1, _fld2, _fld3);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleTernaryOpTest__MultiplyAddDouble testClass)
{
fixed (Vector256<Double>* pFld1 = &_fld1)
fixed (Vector256<Double>* pFld2 = &_fld2)
fixed (Vector256<Double>* pFld3 = &_fld3)
{
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(pFld1)),
Avx.LoadVector256((Double*)(pFld2)),
Avx.LoadVector256((Double*)(pFld3))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 32;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
private static Double[] _data3 = new Double[Op3ElementCount];
private static Vector256<Double> _clsVar1;
private static Vector256<Double> _clsVar2;
private static Vector256<Double> _clsVar3;
private Vector256<Double> _fld1;
private Vector256<Double> _fld2;
private Vector256<Double> _fld3;
private DataTable _dataTable;
static SimpleTernaryOpTest__MultiplyAddDouble()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleTernaryOpTest__MultiplyAddDouble()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); }
_dataTable = new DataTable(_data1, _data2, _data3, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Fma.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = Fma.MultiplyAdd(
Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr),
Unsafe.Read<Vector256<Double>>(_dataTable.inArray3Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr)),
Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr)),
Avx.LoadVector256((Double*)(_dataTable.inArray3Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_LoadAligned()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
var result = Fma.MultiplyAdd(
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr)),
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr)),
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray3Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(Fma).GetMethod(nameof(Fma.MultiplyAdd), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>), typeof(Vector256<Double>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr),
Unsafe.Read<Vector256<Double>>(_dataTable.inArray3Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(Fma).GetMethod(nameof(Fma.MultiplyAdd), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>), typeof(Vector256<Double>) })
.Invoke(null, new object[] {
Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr)),
Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr)),
Avx.LoadVector256((Double*)(_dataTable.inArray3Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_LoadAligned()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
var result = typeof(Fma).GetMethod(nameof(Fma.MultiplyAdd), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>), typeof(Vector256<Double>) })
.Invoke(null, new object[] {
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr)),
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr)),
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray3Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = Fma.MultiplyAdd(
_clsVar1,
_clsVar2,
_clsVar3
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector256<Double>* pClsVar1 = &_clsVar1)
fixed (Vector256<Double>* pClsVar2 = &_clsVar2)
fixed (Vector256<Double>* pClsVar3 = &_clsVar3)
{
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(pClsVar1)),
Avx.LoadVector256((Double*)(pClsVar2)),
Avx.LoadVector256((Double*)(pClsVar3))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr);
var op3 = Unsafe.Read<Vector256<Double>>(_dataTable.inArray3Ptr);
var result = Fma.MultiplyAdd(op1, op2, op3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, op3, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr));
var op2 = Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr));
var op3 = Avx.LoadVector256((Double*)(_dataTable.inArray3Ptr));
var result = Fma.MultiplyAdd(op1, op2, op3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, op3, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_LoadAligned()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var op1 = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr));
var op2 = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr));
var op3 = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray3Ptr));
var result = Fma.MultiplyAdd(op1, op2, op3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, op3, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleTernaryOpTest__MultiplyAddDouble();
var result = Fma.MultiplyAdd(test._fld1, test._fld2, test._fld3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleTernaryOpTest__MultiplyAddDouble();
fixed (Vector256<Double>* pFld1 = &test._fld1)
fixed (Vector256<Double>* pFld2 = &test._fld2)
fixed (Vector256<Double>* pFld3 = &test._fld3)
{
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(pFld1)),
Avx.LoadVector256((Double*)(pFld2)),
Avx.LoadVector256((Double*)(pFld3))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = Fma.MultiplyAdd(_fld1, _fld2, _fld3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector256<Double>* pFld1 = &_fld1)
fixed (Vector256<Double>* pFld2 = &_fld2)
fixed (Vector256<Double>* pFld3 = &_fld3)
{
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(pFld1)),
Avx.LoadVector256((Double*)(pFld2)),
Avx.LoadVector256((Double*)(pFld3))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = Fma.MultiplyAdd(test._fld1, test._fld2, test._fld3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(&test._fld1)),
Avx.LoadVector256((Double*)(&test._fld2)),
Avx.LoadVector256((Double*)(&test._fld3))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector256<Double> op1, Vector256<Double> op2, Vector256<Double> op3, void* result, [CallerMemberName] string method = "")
{
Double[] inArray1 = new Double[Op1ElementCount];
Double[] inArray2 = new Double[Op2ElementCount];
Double[] inArray3 = new Double[Op3ElementCount];
Double[] outArray = new Double[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), op2);
Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), op3);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* op3, void* result, [CallerMemberName] string method = "")
{
Double[] inArray1 = new Double[Op1ElementCount];
Double[] inArray2 = new Double[Op2ElementCount];
Double[] inArray3 = new Double[Op3ElementCount];
Double[] outArray = new Double[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector256<Double>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector256<Double>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector256<Double>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
private void ValidateResult(Double[] firstOp, Double[] secondOp, Double[] thirdOp, Double[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (BitConverter.DoubleToInt64Bits(Math.Round((firstOp[0] * secondOp[0]) + thirdOp[0], 9)) != BitConverter.DoubleToInt64Bits(Math.Round(result[0], 9)))
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (BitConverter.DoubleToInt64Bits(Math.Round((firstOp[i] * secondOp[i]) + thirdOp[i], 9)) != BitConverter.DoubleToInt64Bits(Math.Round(result[i], 9)))
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(Fma)}.{nameof(Fma.MultiplyAdd)}<Double>(Vector256<Double>, Vector256<Double>, Vector256<Double>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($"secondOp: ({string.Join(", ", secondOp)})");
TestLibrary.TestFramework.LogInformation($" thirdOp: ({string.Join(", ", thirdOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
namespace JIT.HardwareIntrinsics.X86
{
public static partial class Program
{
private static void MultiplyAddDouble()
{
var test = new SimpleTernaryOpTest__MultiplyAddDouble();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (Avx.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
// Validates basic functionality works, using LoadAligned
test.RunBasicScenario_LoadAligned();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (Avx.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
// Validates calling via reflection works, using LoadAligned
test.RunReflectionScenario_LoadAligned();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (Avx.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (Avx.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
// Validates passing a local works, using LoadAligned
test.RunLclVarScenario_LoadAligned();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (Avx.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (Avx.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (Avx.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (Avx.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleTernaryOpTest__MultiplyAddDouble
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] inArray3;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle inHandle3;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Double[] inArray1, Double[] inArray2, Double[] inArray3, Double[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Double>();
int sizeOfinArray3 = inArray3.Length * Unsafe.SizeOf<Double>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>();
if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfinArray3 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.inArray3 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.inHandle3 = GCHandle.Alloc(this.inArray3, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Double, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray3Ptr), ref Unsafe.As<Double, byte>(ref inArray3[0]), (uint)sizeOfinArray3);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray3Ptr => Align((byte*)(inHandle3.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
inHandle3.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector256<Double> _fld1;
public Vector256<Double> _fld2;
public Vector256<Double> _fld3;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref testStruct._fld3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
return testStruct;
}
public void RunStructFldScenario(SimpleTernaryOpTest__MultiplyAddDouble testClass)
{
var result = Fma.MultiplyAdd(_fld1, _fld2, _fld3);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleTernaryOpTest__MultiplyAddDouble testClass)
{
fixed (Vector256<Double>* pFld1 = &_fld1)
fixed (Vector256<Double>* pFld2 = &_fld2)
fixed (Vector256<Double>* pFld3 = &_fld3)
{
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(pFld1)),
Avx.LoadVector256((Double*)(pFld2)),
Avx.LoadVector256((Double*)(pFld3))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 32;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Double>>() / sizeof(Double);
private static Double[] _data1 = new Double[Op1ElementCount];
private static Double[] _data2 = new Double[Op2ElementCount];
private static Double[] _data3 = new Double[Op3ElementCount];
private static Vector256<Double> _clsVar1;
private static Vector256<Double> _clsVar2;
private static Vector256<Double> _clsVar3;
private Vector256<Double> _fld1;
private Vector256<Double> _fld2;
private Vector256<Double> _fld3;
private DataTable _dataTable;
static SimpleTernaryOpTest__MultiplyAddDouble()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _clsVar3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
}
public SimpleTernaryOpTest__MultiplyAddDouble()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Double>, byte>(ref _fld3), ref Unsafe.As<Double, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector256<Double>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); }
for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetDouble(); }
_dataTable = new DataTable(_data1, _data2, _data3, new Double[RetElementCount], LargestVectorSize);
}
public bool IsSupported => Fma.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = Fma.MultiplyAdd(
Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr),
Unsafe.Read<Vector256<Double>>(_dataTable.inArray3Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr)),
Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr)),
Avx.LoadVector256((Double*)(_dataTable.inArray3Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_LoadAligned()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned));
var result = Fma.MultiplyAdd(
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr)),
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr)),
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray3Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(Fma).GetMethod(nameof(Fma.MultiplyAdd), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>), typeof(Vector256<Double>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr),
Unsafe.Read<Vector256<Double>>(_dataTable.inArray3Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(Fma).GetMethod(nameof(Fma.MultiplyAdd), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>), typeof(Vector256<Double>) })
.Invoke(null, new object[] {
Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr)),
Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr)),
Avx.LoadVector256((Double*)(_dataTable.inArray3Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_LoadAligned()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned));
var result = typeof(Fma).GetMethod(nameof(Fma.MultiplyAdd), new Type[] { typeof(Vector256<Double>), typeof(Vector256<Double>), typeof(Vector256<Double>) })
.Invoke(null, new object[] {
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr)),
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr)),
Avx.LoadAlignedVector256((Double*)(_dataTable.inArray3Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Double>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = Fma.MultiplyAdd(
_clsVar1,
_clsVar2,
_clsVar3
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector256<Double>* pClsVar1 = &_clsVar1)
fixed (Vector256<Double>* pClsVar2 = &_clsVar2)
fixed (Vector256<Double>* pClsVar3 = &_clsVar3)
{
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(pClsVar1)),
Avx.LoadVector256((Double*)(pClsVar2)),
Avx.LoadVector256((Double*)(pClsVar3))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector256<Double>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector256<Double>>(_dataTable.inArray2Ptr);
var op3 = Unsafe.Read<Vector256<Double>>(_dataTable.inArray3Ptr);
var result = Fma.MultiplyAdd(op1, op2, op3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, op3, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = Avx.LoadVector256((Double*)(_dataTable.inArray1Ptr));
var op2 = Avx.LoadVector256((Double*)(_dataTable.inArray2Ptr));
var op3 = Avx.LoadVector256((Double*)(_dataTable.inArray3Ptr));
var result = Fma.MultiplyAdd(op1, op2, op3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, op3, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_LoadAligned()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned));
var op1 = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray1Ptr));
var op2 = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray2Ptr));
var op3 = Avx.LoadAlignedVector256((Double*)(_dataTable.inArray3Ptr));
var result = Fma.MultiplyAdd(op1, op2, op3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, op3, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleTernaryOpTest__MultiplyAddDouble();
var result = Fma.MultiplyAdd(test._fld1, test._fld2, test._fld3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleTernaryOpTest__MultiplyAddDouble();
fixed (Vector256<Double>* pFld1 = &test._fld1)
fixed (Vector256<Double>* pFld2 = &test._fld2)
fixed (Vector256<Double>* pFld3 = &test._fld3)
{
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(pFld1)),
Avx.LoadVector256((Double*)(pFld2)),
Avx.LoadVector256((Double*)(pFld3))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = Fma.MultiplyAdd(_fld1, _fld2, _fld3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector256<Double>* pFld1 = &_fld1)
fixed (Vector256<Double>* pFld2 = &_fld2)
fixed (Vector256<Double>* pFld3 = &_fld3)
{
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(pFld1)),
Avx.LoadVector256((Double*)(pFld2)),
Avx.LoadVector256((Double*)(pFld3))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = Fma.MultiplyAdd(test._fld1, test._fld2, test._fld3);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = Fma.MultiplyAdd(
Avx.LoadVector256((Double*)(&test._fld1)),
Avx.LoadVector256((Double*)(&test._fld2)),
Avx.LoadVector256((Double*)(&test._fld3))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector256<Double> op1, Vector256<Double> op2, Vector256<Double> op3, void* result, [CallerMemberName] string method = "")
{
Double[] inArray1 = new Double[Op1ElementCount];
Double[] inArray2 = new Double[Op2ElementCount];
Double[] inArray3 = new Double[Op3ElementCount];
Double[] outArray = new Double[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), op2);
Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), op3);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* op3, void* result, [CallerMemberName] string method = "")
{
Double[] inArray1 = new Double[Op1ElementCount];
Double[] inArray2 = new Double[Op2ElementCount];
Double[] inArray3 = new Double[Op3ElementCount];
Double[] outArray = new Double[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector256<Double>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector256<Double>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector256<Double>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Double>>());
ValidateResult(inArray1, inArray2, inArray3, outArray, method);
}
private void ValidateResult(Double[] firstOp, Double[] secondOp, Double[] thirdOp, Double[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (BitConverter.DoubleToInt64Bits(Math.Round((firstOp[0] * secondOp[0]) + thirdOp[0], 9)) != BitConverter.DoubleToInt64Bits(Math.Round(result[0], 9)))
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (BitConverter.DoubleToInt64Bits(Math.Round((firstOp[i] * secondOp[i]) + thirdOp[i], 9)) != BitConverter.DoubleToInt64Bits(Math.Round(result[i], 9)))
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(Fma)}.{nameof(Fma.MultiplyAdd)}<Double>(Vector256<Double>, Vector256<Double>, Vector256<Double>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($"secondOp: ({string.Join(", ", secondOp)})");
TestLibrary.TestFramework.LogInformation($" thirdOp: ({string.Join(", ", thirdOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/PropertyPolicies.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.Reflection.Runtime.TypeInfos;
namespace System.Reflection.Runtime.BindingFlagSupport
{
//==========================================================================================================================
// Policies for properties.
//==========================================================================================================================
internal sealed class PropertyPolicies : MemberPolicies<PropertyInfo>
{
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern",
Justification = "Reflection implementation")]
public sealed override IEnumerable<PropertyInfo> GetDeclaredMembers(TypeInfo typeInfo)
{
return typeInfo.DeclaredProperties;
}
public sealed override IEnumerable<PropertyInfo> CoreGetDeclaredMembers(RuntimeTypeInfo type, NameFilter optionalNameFilter, RuntimeTypeInfo reflectedType)
{
return type.CoreGetDeclaredProperties(optionalNameFilter, reflectedType);
}
public sealed override bool AlwaysTreatAsDeclaredOnly => false;
public sealed override void GetMemberAttributes(PropertyInfo member, out MethodAttributes visibility, out bool isStatic, out bool isVirtual, out bool isNewSlot)
{
MethodInfo accessorMethod = GetAccessorMethod(member);
if (accessorMethod == null)
{
// If we got here, this is a inherited PropertyInfo that only had private accessors and is now refusing to give them out
// because that's what the rules of inherited PropertyInfo's are. Such a PropertyInfo is also considered private and will never be
// given out of a Type.GetProperty() call. So all we have to do is set its visibility to Private and it will get filtered out.
// Other values need to be set to satisify C# but they are meaningless.
visibility = MethodAttributes.Private;
isStatic = false;
isVirtual = false;
isNewSlot = true;
return;
}
MethodAttributes methodAttributes = accessorMethod.Attributes;
visibility = methodAttributes & MethodAttributes.MemberAccessMask;
isStatic = (0 != (methodAttributes & MethodAttributes.Static));
isVirtual = (0 != (methodAttributes & MethodAttributes.Virtual));
isNewSlot = (0 != (methodAttributes & MethodAttributes.NewSlot));
}
public sealed override bool ImplicitlyOverrides(PropertyInfo baseMember, PropertyInfo derivedMember)
{
MethodInfo baseAccessor = GetAccessorMethod(baseMember);
MethodInfo derivedAccessor = GetAccessorMethod(derivedMember);
return MemberPolicies<MethodInfo>.Default.ImplicitlyOverrides(baseAccessor, derivedAccessor);
}
//
// Desktop compat: Properties hide properties in base types if they share the same vtable slot, or
// have the same name, return type, signature and hasThis value.
//
public sealed override bool IsSuppressedByMoreDerivedMember(PropertyInfo member, PropertyInfo[] priorMembers, int startIndex, int endIndex)
{
MethodInfo baseAccessor = GetAccessorMethod(member);
for (int i = startIndex; i < endIndex; i++)
{
PropertyInfo prior = priorMembers[i];
MethodInfo derivedAccessor = GetAccessorMethod(prior);
if (!AreNamesAndSignaturesEqual(baseAccessor, derivedAccessor))
continue;
if (derivedAccessor.IsStatic != baseAccessor.IsStatic)
continue;
if (!(prior.PropertyType.Equals(member.PropertyType)))
continue;
return true;
}
return false;
}
public sealed override bool OkToIgnoreAmbiguity(PropertyInfo m1, PropertyInfo m2)
{
return false;
}
private static MethodInfo GetAccessorMethod(PropertyInfo property)
{
MethodInfo accessor = property.GetMethod;
if (accessor == null)
{
accessor = property.SetMethod;
}
return accessor;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.Reflection.Runtime.TypeInfos;
namespace System.Reflection.Runtime.BindingFlagSupport
{
//==========================================================================================================================
// Policies for properties.
//==========================================================================================================================
internal sealed class PropertyPolicies : MemberPolicies<PropertyInfo>
{
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern",
Justification = "Reflection implementation")]
public sealed override IEnumerable<PropertyInfo> GetDeclaredMembers(TypeInfo typeInfo)
{
return typeInfo.DeclaredProperties;
}
public sealed override IEnumerable<PropertyInfo> CoreGetDeclaredMembers(RuntimeTypeInfo type, NameFilter optionalNameFilter, RuntimeTypeInfo reflectedType)
{
return type.CoreGetDeclaredProperties(optionalNameFilter, reflectedType);
}
public sealed override bool AlwaysTreatAsDeclaredOnly => false;
public sealed override void GetMemberAttributes(PropertyInfo member, out MethodAttributes visibility, out bool isStatic, out bool isVirtual, out bool isNewSlot)
{
MethodInfo accessorMethod = GetAccessorMethod(member);
if (accessorMethod == null)
{
// If we got here, this is a inherited PropertyInfo that only had private accessors and is now refusing to give them out
// because that's what the rules of inherited PropertyInfo's are. Such a PropertyInfo is also considered private and will never be
// given out of a Type.GetProperty() call. So all we have to do is set its visibility to Private and it will get filtered out.
// Other values need to be set to satisify C# but they are meaningless.
visibility = MethodAttributes.Private;
isStatic = false;
isVirtual = false;
isNewSlot = true;
return;
}
MethodAttributes methodAttributes = accessorMethod.Attributes;
visibility = methodAttributes & MethodAttributes.MemberAccessMask;
isStatic = (0 != (methodAttributes & MethodAttributes.Static));
isVirtual = (0 != (methodAttributes & MethodAttributes.Virtual));
isNewSlot = (0 != (methodAttributes & MethodAttributes.NewSlot));
}
public sealed override bool ImplicitlyOverrides(PropertyInfo baseMember, PropertyInfo derivedMember)
{
MethodInfo baseAccessor = GetAccessorMethod(baseMember);
MethodInfo derivedAccessor = GetAccessorMethod(derivedMember);
return MemberPolicies<MethodInfo>.Default.ImplicitlyOverrides(baseAccessor, derivedAccessor);
}
//
// Desktop compat: Properties hide properties in base types if they share the same vtable slot, or
// have the same name, return type, signature and hasThis value.
//
public sealed override bool IsSuppressedByMoreDerivedMember(PropertyInfo member, PropertyInfo[] priorMembers, int startIndex, int endIndex)
{
MethodInfo baseAccessor = GetAccessorMethod(member);
for (int i = startIndex; i < endIndex; i++)
{
PropertyInfo prior = priorMembers[i];
MethodInfo derivedAccessor = GetAccessorMethod(prior);
if (!AreNamesAndSignaturesEqual(baseAccessor, derivedAccessor))
continue;
if (derivedAccessor.IsStatic != baseAccessor.IsStatic)
continue;
if (!(prior.PropertyType.Equals(member.PropertyType)))
continue;
return true;
}
return false;
}
public sealed override bool OkToIgnoreAmbiguity(PropertyInfo m1, PropertyInfo m2)
{
return false;
}
private static MethodInfo GetAccessorMethod(PropertyInfo property)
{
MethodInfo accessor = property.GetMethod;
if (accessor == null)
{
accessor = property.SetMethod;
}
return accessor;
}
}
}
| -1 |
dotnet/runtime
| 66,407 |
ARM64 - Optimizing a % b operations part 2
|
Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
TIHan
| 2022-03-09T20:33:02Z | 2022-04-13T20:01:26Z |
3b6a539c7219383ec6181a112465f904fe9e2edb
|
a81f4bc9d53dedefe03f49da53ed198abbf9c467
|
ARM64 - Optimizing a % b operations part 2. Addressing part of this issue: https://github.com/dotnet/runtime/issues/34937
**Description**
There are various ways to optimize `%` for integers on ARM64.
`a % b` can be transformed into a specific sequence of instructions for ARM64 if the operation is signed and `b` is a constant with the power of 2.
**Acceptance Criteria**
- [x] Merge https://github.com/dotnet/runtime/pull/65535
- [x] Add Tests
ARM64 diffs based on tests
```diff
- asr w1, w0, #31
- and w1, w1, #15
- add w1, w1, w0
- asr w1, w1, #4
- lsl w1, w1, #4
- sub w0, w0, w1
- ;; bbWeight=1 PerfScore 4.50
+ and w1, w0, #15
+ negs w0, w0
+ and w0, w0, #15
+ csneg w0, w1, w0, mi
+ ;; bbWeight=1 PerfScore 2.00
```
|
./src/libraries/Microsoft.Extensions.DependencyModel/src/FileWrapper.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
namespace Microsoft.Extensions.DependencyModel
{
internal sealed class FileWrapper: IFile
{
public bool Exists([NotNullWhen(true)] string? path)
{
return File.Exists(path);
}
public string ReadAllText(string path)
{
return File.ReadAllText(path);
}
public Stream OpenRead(string path)
{
return File.OpenRead(path);
}
public Stream OpenFile(
string path,
FileMode fileMode,
FileAccess fileAccess,
FileShare fileShare,
int bufferSize,
FileOptions fileOptions)
{
return new FileStream(path, fileMode, fileAccess, fileShare, bufferSize, fileOptions);
}
public void CreateEmptyFile(string path)
{
try
{
FileStream emptyFile = File.Create(path);
if (emptyFile != null)
{
emptyFile.Dispose();
}
}
catch { }
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
namespace Microsoft.Extensions.DependencyModel
{
internal sealed class FileWrapper: IFile
{
public bool Exists([NotNullWhen(true)] string? path)
{
return File.Exists(path);
}
public string ReadAllText(string path)
{
return File.ReadAllText(path);
}
public Stream OpenRead(string path)
{
return File.OpenRead(path);
}
public Stream OpenFile(
string path,
FileMode fileMode,
FileAccess fileAccess,
FileShare fileShare,
int bufferSize,
FileOptions fileOptions)
{
return new FileStream(path, fileMode, fileAccess, fileShare, bufferSize, fileOptions);
}
public void CreateEmptyFile(string path)
{
try
{
FileStream emptyFile = File.Create(path);
if (emptyFile != null)
{
emptyFile.Dispose();
}
}
catch { }
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using X86 = System.Runtime.Intrinsics.X86;
namespace System
{
public partial struct Decimal
{
// Low level accessors used by a DecCalc and formatting
internal uint High => _hi32;
internal uint Low => (uint)_lo64;
internal uint Mid => (uint)(_lo64 >> 32);
internal bool IsNegative => _flags < 0;
internal int Scale => (byte)(_flags >> ScaleShift);
private ulong Low64 => _lo64;
private static ref DecCalc AsMutable(ref decimal d) => ref Unsafe.As<decimal, DecCalc>(ref d);
#region APIs need by number formatting.
internal static uint DecDivMod1E9(ref decimal value)
{
return DecCalc.DecDivMod1E9(ref AsMutable(ref value));
}
#endregion
/// <summary>
/// Class that contains all the mathematical calculations for decimal. Most of which have been ported from oleaut32.
/// </summary>
[StructLayout(LayoutKind.Explicit)]
private struct DecCalc
{
// NOTE: Do not change the offsets of these fields. This structure must have the same layout as Decimal.
[FieldOffset(0)]
private uint uflags;
[FieldOffset(4)]
private uint uhi;
#if BIGENDIAN
[FieldOffset(8)]
private uint umid;
[FieldOffset(12)]
private uint ulo;
#else
[FieldOffset(8)]
private uint ulo;
[FieldOffset(12)]
private uint umid;
#endif
/// <summary>
/// The low and mid fields combined
/// </summary>
[FieldOffset(8)]
private ulong ulomid;
private uint High
{
get => uhi;
set => uhi = value;
}
private uint Low
{
get => ulo;
set => ulo = value;
}
private uint Mid
{
get => umid;
set => umid = value;
}
private bool IsNegative => (int)uflags < 0;
private int Scale => (byte)(uflags >> ScaleShift);
private ulong Low64
{
get => ulomid;
set => ulomid = value;
}
private const uint SignMask = 0x80000000;
private const uint ScaleMask = 0x00FF0000;
private const int DEC_SCALE_MAX = 28;
private const uint TenToPowerNine = 1000000000;
private const ulong TenToPowerEighteen = 1000000000000000000;
// The maximum power of 10 that a 32 bit integer can store
private const int MaxInt32Scale = 9;
// The maximum power of 10 that a 64 bit integer can store
private const int MaxInt64Scale = 19;
// Fast access for 10^n where n is 0-9
private static readonly uint[] s_powers10 = new uint[] {
1,
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000
};
// Fast access for 10^n where n is 1-19
private static readonly ulong[] s_ulongPowers10 = new ulong[] {
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000,
10000000000,
100000000000,
1000000000000,
10000000000000,
100000000000000,
1000000000000000,
10000000000000000,
100000000000000000,
1000000000000000000,
10000000000000000000,
};
private static readonly double[] s_doublePowers10 = new double[] {
1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29,
1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39,
1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49,
1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59,
1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69,
1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79,
1e80
};
#region Decimal Math Helpers
private static unsafe uint GetExponent(float f)
{
// Based on pulling out the exp from this single struct layout
// typedef struct {
// ULONG mant:23;
// ULONG exp:8;
// ULONG sign:1;
// } SNGSTRUCT;
return (byte)(*(uint*)&f >> 23);
}
private static unsafe uint GetExponent(double d)
{
// Based on pulling out the exp from this double struct layout
// typedef struct {
// DWORDLONG mant:52;
// DWORDLONG signexp:12;
// } DBLSTRUCT;
return (uint)(*(ulong*)&d >> 52) & 0x7FFu;
}
private static ulong UInt32x32To64(uint a, uint b)
{
return (ulong)a * (ulong)b;
}
private static void UInt64x64To128(ulong a, ulong b, ref DecCalc result)
{
ulong low = UInt32x32To64((uint)a, (uint)b); // lo partial prod
ulong mid = UInt32x32To64((uint)a, (uint)(b >> 32)); // mid 1 partial prod
ulong high = UInt32x32To64((uint)(a >> 32), (uint)(b >> 32));
high += mid >> 32;
low += mid <<= 32;
if (low < mid) // test for carry
high++;
mid = UInt32x32To64((uint)(a >> 32), (uint)b);
high += mid >> 32;
low += mid <<= 32;
if (low < mid) // test for carry
high++;
if (high > uint.MaxValue)
Number.ThrowOverflowException(TypeCode.Decimal);
result.Low64 = low;
result.High = (uint)high;
}
/// <summary>
/// Do full divide, yielding 96-bit result and 32-bit remainder.
/// </summary>
/// <param name="bufNum">96-bit dividend as array of uints, least-sig first</param>
/// <param name="den">32-bit divisor</param>
/// <returns>Returns remainder. Quotient overwrites dividend.</returns>
private static uint Div96By32(ref Buf12 bufNum, uint den)
{
// TODO: https://github.com/dotnet/runtime/issues/5213
ulong tmp, div;
if (bufNum.U2 != 0)
{
tmp = bufNum.High64;
div = tmp / den;
bufNum.High64 = div;
tmp = ((tmp - (uint)div * den) << 32) | bufNum.U0;
if (tmp == 0)
return 0;
uint div32 = (uint)(tmp / den);
bufNum.U0 = div32;
return (uint)tmp - div32 * den;
}
tmp = bufNum.Low64;
if (tmp == 0)
return 0;
div = tmp / den;
bufNum.Low64 = div;
return (uint)(tmp - div * den);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool Div96ByConst(ref ulong high64, ref uint low, uint pow)
{
#if TARGET_64BIT
ulong div64 = high64 / pow;
uint div = (uint)((((high64 - div64 * pow) << 32) + low) / pow);
if (low == div * pow)
{
high64 = div64;
low = div;
return true;
}
#else
// 32-bit RyuJIT doesn't convert 64-bit division by constant into multiplication by reciprocal. Do half-width divisions instead.
Debug.Assert(pow <= ushort.MaxValue);
uint num, mid32, low16, div;
if (high64 <= uint.MaxValue)
{
num = (uint)high64;
mid32 = num / pow;
num = (num - mid32 * pow) << 16;
num += low >> 16;
low16 = num / pow;
num = (num - low16 * pow) << 16;
num += (ushort)low;
div = num / pow;
if (num == div * pow)
{
high64 = mid32;
low = (low16 << 16) + div;
return true;
}
}
else
{
num = (uint)(high64 >> 32);
uint high32 = num / pow;
num = (num - high32 * pow) << 16;
num += (uint)high64 >> 16;
mid32 = num / pow;
num = (num - mid32 * pow) << 16;
num += (ushort)high64;
div = num / pow;
num = (num - div * pow) << 16;
mid32 = div + (mid32 << 16);
num += low >> 16;
low16 = num / pow;
num = (num - low16 * pow) << 16;
num += (ushort)low;
div = num / pow;
if (num == div * pow)
{
high64 = ((ulong)high32 << 32) | mid32;
low = (low16 << 16) + div;
return true;
}
}
#endif
return false;
}
/// <summary>
/// Normalize (unscale) the number by trying to divide out 10^8, 10^4, 10^2, and 10^1.
/// If a division by one of these powers returns a zero remainder, then we keep the quotient.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void Unscale(ref uint low, ref ulong high64, ref int scale)
{
// Since 10 = 2 * 5, there must be a factor of 2 for every power of 10 we can extract.
// We use this as a quick test on whether to try a given power.
#if TARGET_64BIT
while ((byte)low == 0 && scale >= 8 && Div96ByConst(ref high64, ref low, 100000000))
scale -= 8;
if ((low & 0xF) == 0 && scale >= 4 && Div96ByConst(ref high64, ref low, 10000))
scale -= 4;
#else
while ((low & 0xF) == 0 && scale >= 4 && Div96ByConst(ref high64, ref low, 10000))
scale -= 4;
#endif
if ((low & 3) == 0 && scale >= 2 && Div96ByConst(ref high64, ref low, 100))
scale -= 2;
if ((low & 1) == 0 && scale >= 1 && Div96ByConst(ref high64, ref low, 10))
scale--;
}
/// <summary>
/// Do partial divide, yielding 32-bit result and 64-bit remainder.
/// Divisor must be larger than upper 64 bits of dividend.
/// </summary>
/// <param name="bufNum">96-bit dividend as array of uints, least-sig first</param>
/// <param name="den">64-bit divisor</param>
/// <returns>Returns quotient. Remainder overwrites lower 64-bits of dividend.</returns>
private static uint Div96By64(ref Buf12 bufNum, ulong den)
{
Debug.Assert(den > bufNum.High64);
uint quo;
ulong num;
uint num2 = bufNum.U2;
if (num2 == 0)
{
num = bufNum.Low64;
if (num < den)
// Result is zero. Entire dividend is remainder.
return 0;
// TODO: https://github.com/dotnet/runtime/issues/5213
quo = (uint)(num / den);
num -= quo * den; // remainder
bufNum.Low64 = num;
return quo;
}
uint denHigh32 = (uint)(den >> 32);
if (num2 >= denHigh32)
{
// Divide would overflow. Assume a quotient of 2^32, and set
// up remainder accordingly.
//
num = bufNum.Low64;
num -= den << 32;
quo = 0;
// Remainder went negative. Add divisor back in until it's positive,
// a max of 2 times.
//
do
{
quo--;
num += den;
} while (num >= den);
bufNum.Low64 = num;
return quo;
}
// Hardware divide won't overflow
//
ulong num64 = bufNum.High64;
if (num64 < denHigh32)
// Result is zero. Entire dividend is remainder.
//
return 0;
// TODO: https://github.com/dotnet/runtime/issues/5213
quo = (uint)(num64 / denHigh32);
num = bufNum.U0 | ((num64 - quo * denHigh32) << 32); // remainder
// Compute full remainder, rem = dividend - (quo * divisor).
//
ulong prod = UInt32x32To64(quo, (uint)den); // quo * lo divisor
num -= prod;
if (num > ~prod)
{
// Remainder went negative. Add divisor back in until it's positive,
// a max of 2 times.
//
do
{
quo--;
num += den;
} while (num >= den);
}
bufNum.Low64 = num;
return quo;
}
/// <summary>
/// Do partial divide, yielding 32-bit result and 96-bit remainder.
/// Top divisor uint must be larger than top dividend uint. This is
/// assured in the initial call because the divisor is normalized
/// and the dividend can't be. In subsequent calls, the remainder
/// is multiplied by 10^9 (max), so it can be no more than 1/4 of
/// the divisor which is effectively multiplied by 2^32 (4 * 10^9).
/// </summary>
/// <param name="bufNum">128-bit dividend as array of uints, least-sig first</param>
/// <param name="bufDen">96-bit divisor</param>
/// <returns>Returns quotient. Remainder overwrites lower 96-bits of dividend.</returns>
private static uint Div128By96(ref Buf16 bufNum, ref Buf12 bufDen)
{
Debug.Assert(bufDen.U2 > bufNum.U3);
ulong dividend = bufNum.High64;
uint den = bufDen.U2;
if (dividend < den)
// Result is zero. Entire dividend is remainder.
//
return 0;
// TODO: https://github.com/dotnet/runtime/issues/5213
uint quo = (uint)(dividend / den);
uint remainder = (uint)dividend - quo * den;
// Compute full remainder, rem = dividend - (quo * divisor).
//
ulong prod1 = UInt32x32To64(quo, bufDen.U0); // quo * lo divisor
ulong prod2 = UInt32x32To64(quo, bufDen.U1); // quo * mid divisor
prod2 += prod1 >> 32;
prod1 = (uint)prod1 | (prod2 << 32);
prod2 >>= 32;
ulong num = bufNum.Low64;
num -= prod1;
remainder -= (uint)prod2;
// Propagate carries
//
if (num > ~prod1)
{
remainder--;
if (remainder < ~(uint)prod2)
goto PosRem;
}
else if (remainder <= ~(uint)prod2)
goto PosRem;
{
// Remainder went negative. Add divisor back in until it's positive,
// a max of 2 times.
//
prod1 = bufDen.Low64;
while (true)
{
quo--;
num += prod1;
remainder += den;
if (num < prod1)
{
// Detected carry. Check for carry out of top
// before adding it in.
//
if (remainder++ < den)
break;
}
if (remainder < den)
break; // detected carry
}
}
PosRem:
bufNum.Low64 = num;
bufNum.U2 = remainder;
return quo;
}
/// <summary>
/// Multiply the two numbers. The low 96 bits of the result overwrite
/// the input. The last 32 bits of the product are the return value.
/// </summary>
/// <param name="bufNum">96-bit number as array of uints, least-sig first</param>
/// <param name="power">Scale factor to multiply by</param>
/// <returns>Returns highest 32 bits of product</returns>
private static uint IncreaseScale(ref Buf12 bufNum, uint power)
{
ulong tmp = UInt32x32To64(bufNum.U0, power);
bufNum.U0 = (uint)tmp;
tmp >>= 32;
tmp += UInt32x32To64(bufNum.U1, power);
bufNum.U1 = (uint)tmp;
tmp >>= 32;
tmp += UInt32x32To64(bufNum.U2, power);
bufNum.U2 = (uint)tmp;
return (uint)(tmp >> 32);
}
private static void IncreaseScale64(ref Buf12 bufNum, uint power)
{
ulong tmp = UInt32x32To64(bufNum.U0, power);
bufNum.U0 = (uint)tmp;
tmp >>= 32;
tmp += UInt32x32To64(bufNum.U1, power);
bufNum.High64 = tmp;
}
/// <summary>
/// See if we need to scale the result to fit it in 96 bits.
/// Perform needed scaling. Adjust scale factor accordingly.
/// </summary>
/// <param name="bufRes">Array of uints with value, least-significant first</param>
/// <param name="hiRes">Index of last non-zero value in bufRes</param>
/// <param name="scale">Scale factor for this value, range 0 - 2 * DEC_SCALE_MAX</param>
/// <returns>Returns new scale factor. bufRes updated in place, always 3 uints.</returns>
private static unsafe int ScaleResult(Buf24* bufRes, uint hiRes, int scale)
{
Debug.Assert(hiRes < Buf24.Length);
uint* result = (uint*)bufRes;
// See if we need to scale the result. The combined scale must
// be <= DEC_SCALE_MAX and the upper 96 bits must be zero.
//
// Start by figuring a lower bound on the scaling needed to make
// the upper 96 bits zero. hiRes is the index into result[]
// of the highest non-zero uint.
//
int newScale = 0;
if (hiRes > 2)
{
newScale = (int)hiRes * 32 - 64 - 1;
newScale -= BitOperations.LeadingZeroCount(result[hiRes]);
// Multiply bit position by log10(2) to figure it's power of 10.
// We scale the log by 256. log(2) = .30103, * 256 = 77. Doing this
// with a multiply saves a 96-byte lookup table. The power returned
// is <= the power of the number, so we must add one power of 10
// to make it's integer part zero after dividing by 256.
//
// Note: the result of this multiplication by an approximation of
// log10(2) have been exhaustively checked to verify it gives the
// correct result. (There were only 95 to check...)
//
newScale = ((newScale * 77) >> 8) + 1;
// newScale = min scale factor to make high 96 bits zero, 0 - 29.
// This reduces the scale factor of the result. If it exceeds the
// current scale of the result, we'll overflow.
//
if (newScale > scale)
goto ThrowOverflow;
}
// Make sure we scale by enough to bring the current scale factor
// into valid range.
//
if (newScale < scale - DEC_SCALE_MAX)
newScale = scale - DEC_SCALE_MAX;
if (newScale != 0)
{
// Scale by the power of 10 given by newScale. Note that this is
// NOT guaranteed to bring the number within 96 bits -- it could
// be 1 power of 10 short.
//
scale -= newScale;
uint sticky = 0;
uint quotient, remainder = 0;
while (true)
{
sticky |= remainder; // record remainder as sticky bit
uint power;
// Scaling loop specialized for each power of 10 because division by constant is an order of magnitude faster (especially for 64-bit division that's actually done by 128bit DIV on x64)
switch (newScale)
{
case 1:
power = DivByConst(result, hiRes, out quotient, out remainder, 10);
break;
case 2:
power = DivByConst(result, hiRes, out quotient, out remainder, 100);
break;
case 3:
power = DivByConst(result, hiRes, out quotient, out remainder, 1000);
break;
case 4:
power = DivByConst(result, hiRes, out quotient, out remainder, 10000);
break;
#if TARGET_64BIT
case 5:
power = DivByConst(result, hiRes, out quotient, out remainder, 100000);
break;
case 6:
power = DivByConst(result, hiRes, out quotient, out remainder, 1000000);
break;
case 7:
power = DivByConst(result, hiRes, out quotient, out remainder, 10000000);
break;
case 8:
power = DivByConst(result, hiRes, out quotient, out remainder, 100000000);
break;
default:
power = DivByConst(result, hiRes, out quotient, out remainder, TenToPowerNine);
break;
#else
default:
goto case 4;
#endif
}
result[hiRes] = quotient;
// If first quotient was 0, update hiRes.
//
if (quotient == 0 && hiRes != 0)
hiRes--;
#if TARGET_64BIT
newScale -= MaxInt32Scale;
#else
newScale -= 4;
#endif
if (newScale > 0)
continue; // scale some more
// If we scaled enough, hiRes would be 2 or less. If not,
// divide by 10 more.
//
if (hiRes > 2)
{
if (scale == 0)
goto ThrowOverflow;
newScale = 1;
scale--;
continue; // scale by 10
}
// Round final result. See if remainder >= 1/2 of divisor.
// If remainder == 1/2 divisor, round up if odd or sticky bit set.
//
power >>= 1; // power of 10 always even
if (power <= remainder && (power < remainder || ((result[0] & 1) | sticky) != 0) && ++result[0] == 0)
{
uint cur = 0;
do
{
Debug.Assert(cur + 1 < Buf24.Length);
}
while (++result[++cur] == 0);
if (cur > 2)
{
// The rounding caused us to carry beyond 96 bits.
// Scale by 10 more.
//
if (scale == 0)
goto ThrowOverflow;
hiRes = cur;
sticky = 0; // no sticky bit
remainder = 0; // or remainder
newScale = 1;
scale--;
continue; // scale by 10
}
}
break;
} // while (true)
}
return scale;
ThrowOverflow:
Number.ThrowOverflowException(TypeCode.Decimal);
return 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe uint DivByConst(uint* result, uint hiRes, out uint quotient, out uint remainder, uint power)
{
uint high = result[hiRes];
remainder = high - (quotient = high / power) * power;
for (uint i = hiRes - 1; (int)i >= 0; i--)
{
#if TARGET_64BIT
ulong num = result[i] + ((ulong)remainder << 32);
remainder = (uint)num - (result[i] = (uint)(num / power)) * power;
#else
// 32-bit RyuJIT doesn't convert 64-bit division by constant into multiplication by reciprocal. Do half-width divisions instead.
Debug.Assert(power <= ushort.MaxValue);
#if BIGENDIAN
const int low16 = 2, high16 = 0;
#else
const int low16 = 0, high16 = 2;
#endif
// byte* is used here because Roslyn doesn't do constant propagation for pointer arithmetic
uint num = *(ushort*)((byte*)result + i * 4 + high16) + (remainder << 16);
uint div = num / power;
remainder = num - div * power;
*(ushort*)((byte*)result + i * 4 + high16) = (ushort)div;
num = *(ushort*)((byte*)result + i * 4 + low16) + (remainder << 16);
div = num / power;
remainder = num - div * power;
*(ushort*)((byte*)result + i * 4 + low16) = (ushort)div;
#endif
}
return power;
}
/// <summary>
/// Adjust the quotient to deal with an overflow.
/// We need to divide by 10, feed in the high bit to undo the overflow and then round as required.
/// </summary>
private static int OverflowUnscale(ref Buf12 bufQuo, int scale, bool sticky)
{
if (--scale < 0)
Number.ThrowOverflowException(TypeCode.Decimal);
Debug.Assert(bufQuo.U2 == 0);
// We have overflown, so load the high bit with a one.
const ulong highbit = 1UL << 32;
bufQuo.U2 = (uint)(highbit / 10);
ulong tmp = ((highbit % 10) << 32) + bufQuo.U1;
uint div = (uint)(tmp / 10);
bufQuo.U1 = div;
tmp = ((tmp - div * 10) << 32) + bufQuo.U0;
div = (uint)(tmp / 10);
bufQuo.U0 = div;
uint remainder = (uint)(tmp - div * 10);
// The remainder is the last digit that does not fit, so we can use it to work out if we need to round up
if (remainder > 5 || remainder == 5 && (sticky || (bufQuo.U0 & 1) != 0))
Add32To96(ref bufQuo, 1);
return scale;
}
/// <summary>
/// Determine the max power of 10, <= 9, that the quotient can be scaled
/// up by and still fit in 96 bits.
/// </summary>
/// <param name="bufQuo">96-bit quotient</param>
/// <param name="scale ">Scale factor of quotient, range -DEC_SCALE_MAX to DEC_SCALE_MAX-1</param>
/// <returns>power of 10 to scale by</returns>
private static int SearchScale(ref Buf12 bufQuo, int scale)
{
const uint OVFL_MAX_9_HI = 4;
const uint OVFL_MAX_8_HI = 42;
const uint OVFL_MAX_7_HI = 429;
const uint OVFL_MAX_6_HI = 4294;
const uint OVFL_MAX_5_HI = 42949;
const uint OVFL_MAX_4_HI = 429496;
const uint OVFL_MAX_3_HI = 4294967;
const uint OVFL_MAX_2_HI = 42949672;
const uint OVFL_MAX_1_HI = 429496729;
const ulong OVFL_MAX_9_MIDLO = 5441186219426131129;
uint resHi = bufQuo.U2;
ulong resMidLo = bufQuo.Low64;
int curScale = 0;
// Quick check to stop us from trying to scale any more.
//
if (resHi > OVFL_MAX_1_HI)
{
goto HaveScale;
}
PowerOvfl[] powerOvfl = PowerOvflValues;
if (scale > DEC_SCALE_MAX - 9)
{
// We can't scale by 10^9 without exceeding the max scale factor.
// See if we can scale to the max. If not, we'll fall into
// standard search for scale factor.
//
curScale = DEC_SCALE_MAX - scale;
if (resHi < powerOvfl[curScale - 1].Hi)
goto HaveScale;
}
else if (resHi < OVFL_MAX_9_HI || resHi == OVFL_MAX_9_HI && resMidLo <= OVFL_MAX_9_MIDLO)
return 9;
// Search for a power to scale by < 9. Do a binary search.
//
if (resHi > OVFL_MAX_5_HI)
{
if (resHi > OVFL_MAX_3_HI)
{
curScale = 2;
if (resHi > OVFL_MAX_2_HI)
curScale--;
}
else
{
curScale = 4;
if (resHi > OVFL_MAX_4_HI)
curScale--;
}
}
else
{
if (resHi > OVFL_MAX_7_HI)
{
curScale = 6;
if (resHi > OVFL_MAX_6_HI)
curScale--;
}
else
{
curScale = 8;
if (resHi > OVFL_MAX_8_HI)
curScale--;
}
}
// In all cases, we already found we could not use the power one larger.
// So if we can use this power, it is the biggest, and we're done. If
// we can't use this power, the one below it is correct for all cases
// unless it's 10^1 -- we might have to go to 10^0 (no scaling).
//
if (resHi == powerOvfl[curScale - 1].Hi && resMidLo > powerOvfl[curScale - 1].MidLo)
curScale--;
HaveScale:
// curScale = largest power of 10 we can scale by without overflow,
// curScale < 9. See if this is enough to make scale factor
// positive if it isn't already.
//
if (curScale + scale < 0)
Number.ThrowOverflowException(TypeCode.Decimal);
return curScale;
}
/// <summary>
/// Add a 32-bit uint to an array of 3 uints representing a 96-bit integer.
/// </summary>
/// <returns>Returns false if there is an overflow</returns>
private static bool Add32To96(ref Buf12 bufNum, uint value)
{
if ((bufNum.Low64 += value) < value)
{
if (++bufNum.U2 == 0)
return false;
}
return true;
}
/// <summary>
/// Adds or subtracts two decimal values.
/// On return, d1 contains the result of the operation and d2 is trashed.
/// </summary>
/// <param name="d1">First decimal to add or subtract.</param>
/// <param name="d2">Second decimal to add or subtract.</param>
/// <param name="sign">True means subtract and false means add.</param>
internal static unsafe void DecAddSub(ref DecCalc d1, ref DecCalc d2, bool sign)
{
ulong low64 = d1.Low64;
uint high = d1.High, flags = d1.uflags, d2flags = d2.uflags;
uint xorflags = d2flags ^ flags;
sign ^= (xorflags & SignMask) != 0;
if ((xorflags & ScaleMask) == 0)
{
// Scale factors are equal, no alignment necessary.
//
goto AlignedAdd;
}
else
{
// Scale factors are not equal. Assume that a larger scale
// factor (more decimal places) is likely to mean that number
// is smaller. Start by guessing that the right operand has
// the larger scale factor. The result will have the larger
// scale factor.
//
uint d1flags = flags;
flags = d2flags & ScaleMask | flags & SignMask; // scale factor of "smaller", but sign of "larger"
int scale = (int)(flags - d1flags) >> ScaleShift;
if (scale < 0)
{
// Guessed scale factor wrong. Swap operands.
//
scale = -scale;
flags = d1flags;
if (sign)
flags ^= SignMask;
low64 = d2.Low64;
high = d2.High;
d2 = d1;
}
uint power;
ulong tmp64, tmpLow;
// d1 will need to be multiplied by 10^scale so
// it will have the same scale as d2. We could be
// extending it to up to 192 bits of precision.
// Scan for zeros in the upper words.
//
if (high == 0)
{
if (low64 <= uint.MaxValue)
{
if ((uint)low64 == 0)
{
// Left arg is zero, return right.
//
uint signFlags = flags & SignMask;
if (sign)
signFlags ^= SignMask;
d1 = d2;
d1.uflags = d2.uflags & ScaleMask | signFlags;
return;
}
do
{
if (scale <= MaxInt32Scale)
{
low64 = UInt32x32To64((uint)low64, s_powers10[scale]);
goto AlignedAdd;
}
scale -= MaxInt32Scale;
low64 = UInt32x32To64((uint)low64, TenToPowerNine);
} while (low64 <= uint.MaxValue);
}
do
{
power = TenToPowerNine;
if (scale < MaxInt32Scale)
power = s_powers10[scale];
tmpLow = UInt32x32To64((uint)low64, power);
tmp64 = UInt32x32To64((uint)(low64 >> 32), power) + (tmpLow >> 32);
low64 = (uint)tmpLow + (tmp64 << 32);
high = (uint)(tmp64 >> 32);
if ((scale -= MaxInt32Scale) <= 0)
goto AlignedAdd;
} while (high == 0);
}
while (true)
{
// Scaling won't make it larger than 4 uints
//
power = TenToPowerNine;
if (scale < MaxInt32Scale)
power = s_powers10[scale];
tmpLow = UInt32x32To64((uint)low64, power);
tmp64 = UInt32x32To64((uint)(low64 >> 32), power) + (tmpLow >> 32);
low64 = (uint)tmpLow + (tmp64 << 32);
tmp64 >>= 32;
tmp64 += UInt32x32To64(high, power);
scale -= MaxInt32Scale;
if (tmp64 > uint.MaxValue)
break;
high = (uint)tmp64;
// Result fits in 96 bits. Use standard aligned add.
if (scale <= 0)
goto AlignedAdd;
}
// Have to scale by a bunch. Move the number to a buffer where it has room to grow as it's scaled.
//
Unsafe.SkipInit(out Buf24 bufNum);
bufNum.Low64 = low64;
bufNum.Mid64 = tmp64;
uint hiProd = 3;
// Scaling loop, up to 10^9 at a time. hiProd stays updated with index of highest non-zero uint.
//
for (; scale > 0; scale -= MaxInt32Scale)
{
power = TenToPowerNine;
if (scale < MaxInt32Scale)
power = s_powers10[scale];
tmp64 = 0;
uint* rgulNum = (uint*)&bufNum;
for (uint cur = 0; ;)
{
Debug.Assert(cur < Buf24.Length);
tmp64 += UInt32x32To64(rgulNum[cur], power);
rgulNum[cur] = (uint)tmp64;
cur++;
tmp64 >>= 32;
if (cur > hiProd)
break;
}
if ((uint)tmp64 != 0)
{
// We're extending the result by another uint.
Debug.Assert(hiProd + 1 < Buf24.Length);
rgulNum[++hiProd] = (uint)tmp64;
}
}
// Scaling complete, do the add. Could be subtract if signs differ.
//
tmp64 = bufNum.Low64;
low64 = d2.Low64;
uint tmpHigh = bufNum.U2;
high = d2.High;
if (sign)
{
// Signs differ, subtract.
//
low64 = tmp64 - low64;
high = tmpHigh - high;
// Propagate carry
//
if (low64 > tmp64)
{
high--;
if (high < tmpHigh)
goto NoCarry;
}
else if (high <= tmpHigh)
goto NoCarry;
// Carry the subtraction into the higher bits.
//
uint* number = (uint*)&bufNum;
uint cur = 3;
do
{
Debug.Assert(cur < Buf24.Length);
} while (number[cur++]-- == 0);
Debug.Assert(hiProd < Buf24.Length);
if (number[hiProd] == 0 && --hiProd <= 2)
goto ReturnResult;
}
else
{
// Signs the same, add.
//
low64 += tmp64;
high += tmpHigh;
// Propagate carry
//
if (low64 < tmp64)
{
high++;
if (high > tmpHigh)
goto NoCarry;
}
else if (high >= tmpHigh)
goto NoCarry;
uint* number = (uint*)&bufNum;
for (uint cur = 3; ++number[cur++] == 0;)
{
Debug.Assert(cur < Buf24.Length);
if (hiProd < cur)
{
number[cur] = 1;
hiProd = cur;
break;
}
}
}
NoCarry:
bufNum.Low64 = low64;
bufNum.U2 = high;
scale = ScaleResult(&bufNum, hiProd, (byte)(flags >> ScaleShift));
flags = (flags & ~ScaleMask) | ((uint)scale << ScaleShift);
low64 = bufNum.Low64;
high = bufNum.U2;
goto ReturnResult;
}
SignFlip:
{
// Got negative result. Flip its sign.
flags ^= SignMask;
high = ~high;
low64 = (ulong)-(long)low64;
if (low64 == 0)
high++;
goto ReturnResult;
}
AlignedScale:
{
// The addition carried above 96 bits.
// Divide the value by 10, dropping the scale factor.
//
if ((flags & ScaleMask) == 0)
Number.ThrowOverflowException(TypeCode.Decimal);
flags -= 1 << ScaleShift;
const uint den = 10;
ulong num = high + (1UL << 32);
high = (uint)(num / den);
num = ((num - high * den) << 32) + (low64 >> 32);
uint div = (uint)(num / den);
num = ((num - div * den) << 32) + (uint)low64;
low64 = div;
low64 <<= 32;
div = (uint)(num / den);
low64 += div;
div = (uint)num - div * den;
// See if we need to round up.
//
if (div >= 5 && (div > 5 || (low64 & 1) != 0))
{
if (++low64 == 0)
high++;
}
goto ReturnResult;
}
AlignedAdd:
{
ulong d1Low64 = low64;
uint d1High = high;
if (sign)
{
// Signs differ - subtract
//
low64 = d1Low64 - d2.Low64;
high = d1High - d2.High;
// Propagate carry
//
if (low64 > d1Low64)
{
high--;
if (high >= d1High)
goto SignFlip;
}
else if (high > d1High)
goto SignFlip;
}
else
{
// Signs are the same - add
//
low64 = d1Low64 + d2.Low64;
high = d1High + d2.High;
// Propagate carry
//
if (low64 < d1Low64)
{
high++;
if (high <= d1High)
goto AlignedScale;
}
else if (high < d1High)
goto AlignedScale;
}
goto ReturnResult;
}
ReturnResult:
d1.uflags = flags;
d1.High = high;
d1.Low64 = low64;
return;
}
#endregion
/// <summary>
/// Convert Decimal to Currency (similar to OleAut32 api.)
/// </summary>
internal static long VarCyFromDec(ref DecCalc pdecIn)
{
long value;
int scale = pdecIn.Scale - 4;
// Need to scale to get 4 decimal places. -4 <= scale <= 24.
//
if (scale < 0)
{
if (pdecIn.High != 0)
goto ThrowOverflow;
uint pwr = s_powers10[-scale];
ulong high = UInt32x32To64(pwr, pdecIn.Mid);
if (high > uint.MaxValue)
goto ThrowOverflow;
ulong low = UInt32x32To64(pwr, pdecIn.Low);
low += high <<= 32;
if (low < high)
goto ThrowOverflow;
value = (long)low;
}
else
{
if (scale != 0)
InternalRound(ref pdecIn, (uint)scale, MidpointRounding.ToEven);
if (pdecIn.High != 0)
goto ThrowOverflow;
value = (long)pdecIn.Low64;
}
if (value < 0 && (value != long.MinValue || !pdecIn.IsNegative))
goto ThrowOverflow;
if (pdecIn.IsNegative)
value = -value;
return value;
ThrowOverflow:
throw new OverflowException(SR.Overflow_Currency);
}
/// <summary>
/// Decimal Compare updated to return values similar to ICompareTo
/// </summary>
internal static int VarDecCmp(in decimal d1, in decimal d2)
{
if ((d2.Low64 | d2.High) == 0)
{
if ((d1.Low64 | d1.High) == 0)
return 0;
return (d1._flags >> 31) | 1;
}
if ((d1.Low64 | d1.High) == 0)
return -((d2._flags >> 31) | 1);
int sign = (d1._flags >> 31) - (d2._flags >> 31);
if (sign != 0)
return sign;
return VarDecCmpSub(in d1, in d2);
}
private static int VarDecCmpSub(in decimal d1, in decimal d2)
{
int flags = d2._flags;
int sign = (flags >> 31) | 1;
int scale = flags - d1._flags;
ulong low64 = d1.Low64;
uint high = d1.High;
ulong d2Low64 = d2.Low64;
uint d2High = d2.High;
if (scale != 0)
{
scale >>= ScaleShift;
// Scale factors are not equal. Assume that a larger scale factor (more decimal places) is likely to mean that number is smaller.
// Start by guessing that the right operand has the larger scale factor.
if (scale < 0)
{
// Guessed scale factor wrong. Swap operands.
scale = -scale;
sign = -sign;
ulong tmp64 = low64;
low64 = d2Low64;
d2Low64 = tmp64;
uint tmp = high;
high = d2High;
d2High = tmp;
}
// d1 will need to be multiplied by 10^scale so it will have the same scale as d2.
// Scaling loop, up to 10^9 at a time.
do
{
uint power = scale >= MaxInt32Scale ? TenToPowerNine : s_powers10[scale];
ulong tmpLow = UInt32x32To64((uint)low64, power);
ulong tmp = UInt32x32To64((uint)(low64 >> 32), power) + (tmpLow >> 32);
low64 = (uint)tmpLow + (tmp << 32);
tmp >>= 32;
tmp += UInt32x32To64(high, power);
// If the scaled value has more than 96 significant bits then it's greater than d2
if (tmp > uint.MaxValue)
return sign;
high = (uint)tmp;
} while ((scale -= MaxInt32Scale) > 0);
}
uint cmpHigh = high - d2High;
if (cmpHigh != 0)
{
// check for overflow
if (cmpHigh > high)
sign = -sign;
return sign;
}
ulong cmpLow64 = low64 - d2Low64;
if (cmpLow64 == 0)
sign = 0;
// check for overflow
else if (cmpLow64 > low64)
sign = -sign;
return sign;
}
/// <summary>
/// Decimal Multiply
/// </summary>
internal static unsafe void VarDecMul(ref DecCalc d1, ref DecCalc d2)
{
int scale = (byte)(d1.uflags + d2.uflags >> ScaleShift);
ulong tmp;
uint hiProd;
Unsafe.SkipInit(out Buf24 bufProd);
if ((d1.High | d1.Mid) == 0)
{
if ((d2.High | d2.Mid) == 0)
{
// Upper 64 bits are zero.
//
ulong low64 = UInt32x32To64(d1.Low, d2.Low);
if (scale > DEC_SCALE_MAX)
{
// Result scale is too big. Divide result by power of 10 to reduce it.
// If the amount to divide by is > 19 the result is guaranteed
// less than 1/2. [max value in 64 bits = 1.84E19]
//
if (scale > DEC_SCALE_MAX + MaxInt64Scale)
goto ReturnZero;
scale -= DEC_SCALE_MAX + 1;
ulong power = s_ulongPowers10[scale];
// TODO: https://github.com/dotnet/runtime/issues/5213
tmp = low64 / power;
ulong remainder = low64 - tmp * power;
low64 = tmp;
// Round result. See if remainder >= 1/2 of divisor.
// Divisor is a power of 10, so it is always even.
//
power >>= 1;
if (remainder >= power && (remainder > power || ((uint)low64 & 1) > 0))
low64++;
scale = DEC_SCALE_MAX;
}
d1.Low64 = low64;
d1.uflags = ((d2.uflags ^ d1.uflags) & SignMask) | ((uint)scale << ScaleShift);
return;
}
else
{
// Left value is 32-bit, result fits in 4 uints
tmp = UInt32x32To64(d1.Low, d2.Low);
bufProd.U0 = (uint)tmp;
tmp = UInt32x32To64(d1.Low, d2.Mid) + (tmp >> 32);
bufProd.U1 = (uint)tmp;
tmp >>= 32;
if (d2.High != 0)
{
tmp += UInt32x32To64(d1.Low, d2.High);
if (tmp > uint.MaxValue)
{
bufProd.Mid64 = tmp;
hiProd = 3;
goto SkipScan;
}
}
bufProd.U2 = (uint)tmp;
hiProd = 2;
}
}
else if ((d2.High | d2.Mid) == 0)
{
// Right value is 32-bit, result fits in 4 uints
tmp = UInt32x32To64(d2.Low, d1.Low);
bufProd.U0 = (uint)tmp;
tmp = UInt32x32To64(d2.Low, d1.Mid) + (tmp >> 32);
bufProd.U1 = (uint)tmp;
tmp >>= 32;
if (d1.High != 0)
{
tmp += UInt32x32To64(d2.Low, d1.High);
if (tmp > uint.MaxValue)
{
bufProd.Mid64 = tmp;
hiProd = 3;
goto SkipScan;
}
}
bufProd.U2 = (uint)tmp;
hiProd = 2;
}
else
{
// Both operands have bits set in the upper 64 bits.
//
// Compute and accumulate the 9 partial products into a
// 192-bit (24-byte) result.
//
// [l-h][l-m][l-l] left high, middle, low
// x [r-h][r-m][r-l] right high, middle, low
// ------------------------------
//
// [0-h][0-l] l-l * r-l
// [1ah][1al] l-l * r-m
// [1bh][1bl] l-m * r-l
// [2ah][2al] l-m * r-m
// [2bh][2bl] l-l * r-h
// [2ch][2cl] l-h * r-l
// [3ah][3al] l-m * r-h
// [3bh][3bl] l-h * r-m
// [4-h][4-l] l-h * r-h
// ------------------------------
// [p-5][p-4][p-3][p-2][p-1][p-0] prod[] array
//
tmp = UInt32x32To64(d1.Low, d2.Low);
bufProd.U0 = (uint)tmp;
ulong tmp2 = UInt32x32To64(d1.Low, d2.Mid) + (tmp >> 32);
tmp = UInt32x32To64(d1.Mid, d2.Low);
tmp += tmp2; // this could generate carry
bufProd.U1 = (uint)tmp;
if (tmp < tmp2) // detect carry
tmp2 = (tmp >> 32) | (1UL << 32);
else
tmp2 = tmp >> 32;
tmp = UInt32x32To64(d1.Mid, d2.Mid) + tmp2;
if ((d1.High | d2.High) > 0)
{
// Highest 32 bits is non-zero. Calculate 5 more partial products.
//
tmp2 = UInt32x32To64(d1.Low, d2.High);
tmp += tmp2; // this could generate carry
uint tmp3 = 0;
if (tmp < tmp2) // detect carry
tmp3 = 1;
tmp2 = UInt32x32To64(d1.High, d2.Low);
tmp += tmp2; // this could generate carry
bufProd.U2 = (uint)tmp;
if (tmp < tmp2) // detect carry
tmp3++;
tmp2 = ((ulong)tmp3 << 32) | (tmp >> 32);
tmp = UInt32x32To64(d1.Mid, d2.High);
tmp += tmp2; // this could generate carry
tmp3 = 0;
if (tmp < tmp2) // detect carry
tmp3 = 1;
tmp2 = UInt32x32To64(d1.High, d2.Mid);
tmp += tmp2; // this could generate carry
bufProd.U3 = (uint)tmp;
if (tmp < tmp2) // detect carry
tmp3++;
tmp = ((ulong)tmp3 << 32) | (tmp >> 32);
bufProd.High64 = UInt32x32To64(d1.High, d2.High) + tmp;
hiProd = 5;
}
else
{
bufProd.Mid64 = tmp;
hiProd = 3;
}
}
// Check for leading zero uints on the product
//
uint* product = (uint*)&bufProd;
while (product[(int)hiProd] == 0)
{
if (hiProd == 0)
goto ReturnZero;
hiProd--;
}
SkipScan:
if (hiProd > 2 || scale > DEC_SCALE_MAX)
{
scale = ScaleResult(&bufProd, hiProd, scale);
}
d1.Low64 = bufProd.Low64;
d1.High = bufProd.U2;
d1.uflags = ((d2.uflags ^ d1.uflags) & SignMask) | ((uint)scale << ScaleShift);
return;
ReturnZero:
d1 = default;
}
/// <summary>
/// Convert float to Decimal
/// </summary>
internal static void VarDecFromR4(float input, out DecCalc result)
{
result = default;
// The most we can scale by is 10^28, which is just slightly more
// than 2^93. So a float with an exponent of -94 could just
// barely reach 0.5, but smaller exponents will always round to zero.
//
const uint SNGBIAS = 126;
int exp = (int)(GetExponent(input) - SNGBIAS);
if (exp < -94)
return; // result should be zeroed out
if (exp > 96)
Number.ThrowOverflowException(TypeCode.Decimal);
uint flags = 0;
if (input < 0)
{
input = -input;
flags = SignMask;
}
// Round the input to a 7-digit integer. The R4 format has
// only 7 digits of precision, and we want to keep garbage digits
// out of the Decimal were making.
//
// Calculate max power of 10 input value could have by multiplying
// the exponent by log10(2). Using scaled integer multiplcation,
// log10(2) * 2 ^ 16 = .30103 * 65536 = 19728.3.
//
double dbl = input;
int power = 6 - ((exp * 19728) >> 16);
// power is between -22 and 35
if (power >= 0)
{
// We have less than 7 digits, scale input up.
//
if (power > DEC_SCALE_MAX)
power = DEC_SCALE_MAX;
dbl *= s_doublePowers10[power];
}
else
{
if (power != -1 || dbl >= 1E7)
dbl /= s_doublePowers10[-power];
else
power = 0; // didn't scale it
}
Debug.Assert(dbl < 1E7);
if (dbl < 1E6 && power < DEC_SCALE_MAX)
{
dbl *= 10;
power++;
Debug.Assert(dbl >= 1E6);
}
// Round to integer
//
uint mant;
// with SSE4.1 support ROUNDSD can be used
if (X86.Sse41.IsSupported)
mant = (uint)(int)Math.Round(dbl);
else
{
mant = (uint)(int)dbl;
dbl -= (int)mant; // difference between input & integer
if (dbl > 0.5 || dbl == 0.5 && (mant & 1) != 0)
mant++;
}
if (mant == 0)
return; // result should be zeroed out
if (power < 0)
{
// Add -power factors of 10, -power <= (29 - 7) = 22.
//
power = -power;
if (power < 10)
{
result.Low64 = UInt32x32To64(mant, s_powers10[power]);
}
else
{
// Have a big power of 10.
//
if (power > 18)
{
ulong low64 = UInt32x32To64(mant, s_powers10[power - 18]);
UInt64x64To128(low64, TenToPowerEighteen, ref result);
}
else
{
ulong low64 = UInt32x32To64(mant, s_powers10[power - 9]);
ulong hi64 = UInt32x32To64(TenToPowerNine, (uint)(low64 >> 32));
low64 = UInt32x32To64(TenToPowerNine, (uint)low64);
result.Low = (uint)low64;
hi64 += low64 >> 32;
result.Mid = (uint)hi64;
hi64 >>= 32;
result.High = (uint)hi64;
}
}
}
else
{
// Factor out powers of 10 to reduce the scale, if possible.
// The maximum number we could factor out would be 6. This
// comes from the fact we have a 7-digit number, and the
// MSD must be non-zero -- but the lower 6 digits could be
// zero. Note also the scale factor is never negative, so
// we can't scale by any more than the power we used to
// get the integer.
//
int lmax = power;
if (lmax > 6)
lmax = 6;
if ((mant & 0xF) == 0 && lmax >= 4)
{
const uint den = 10000;
uint div = mant / den;
if (mant == div * den)
{
mant = div;
power -= 4;
lmax -= 4;
}
}
if ((mant & 3) == 0 && lmax >= 2)
{
const uint den = 100;
uint div = mant / den;
if (mant == div * den)
{
mant = div;
power -= 2;
lmax -= 2;
}
}
if ((mant & 1) == 0 && lmax >= 1)
{
const uint den = 10;
uint div = mant / den;
if (mant == div * den)
{
mant = div;
power--;
}
}
flags |= (uint)power << ScaleShift;
result.Low = mant;
}
result.uflags = flags;
}
/// <summary>
/// Convert double to Decimal
/// </summary>
internal static void VarDecFromR8(double input, out DecCalc result)
{
result = default;
// The most we can scale by is 10^28, which is just slightly more
// than 2^93. So a float with an exponent of -94 could just
// barely reach 0.5, but smaller exponents will always round to zero.
//
const uint DBLBIAS = 1022;
int exp = (int)(GetExponent(input) - DBLBIAS);
if (exp < -94)
return; // result should be zeroed out
if (exp > 96)
Number.ThrowOverflowException(TypeCode.Decimal);
uint flags = 0;
if (input < 0)
{
input = -input;
flags = SignMask;
}
// Round the input to a 15-digit integer. The R8 format has
// only 15 digits of precision, and we want to keep garbage digits
// out of the Decimal were making.
//
// Calculate max power of 10 input value could have by multiplying
// the exponent by log10(2). Using scaled integer multiplcation,
// log10(2) * 2 ^ 16 = .30103 * 65536 = 19728.3.
//
double dbl = input;
int power = 14 - ((exp * 19728) >> 16);
// power is between -14 and 43
if (power >= 0)
{
// We have less than 15 digits, scale input up.
//
if (power > DEC_SCALE_MAX)
power = DEC_SCALE_MAX;
dbl *= s_doublePowers10[power];
}
else
{
if (power != -1 || dbl >= 1E15)
dbl /= s_doublePowers10[-power];
else
power = 0; // didn't scale it
}
Debug.Assert(dbl < 1E15);
if (dbl < 1E14 && power < DEC_SCALE_MAX)
{
dbl *= 10;
power++;
Debug.Assert(dbl >= 1E14);
}
// Round to int64
//
ulong mant;
// with SSE4.1 support ROUNDSD can be used
if (X86.Sse41.IsSupported)
mant = (ulong)(long)Math.Round(dbl);
else
{
mant = (ulong)(long)dbl;
dbl -= (long)mant; // difference between input & integer
if (dbl > 0.5 || dbl == 0.5 && (mant & 1) != 0)
mant++;
}
if (mant == 0)
return; // result should be zeroed out
if (power < 0)
{
// Add -power factors of 10, -power <= (29 - 15) = 14.
//
power = -power;
if (power < 10)
{
uint pow10 = s_powers10[power];
ulong low64 = UInt32x32To64((uint)mant, pow10);
ulong hi64 = UInt32x32To64((uint)(mant >> 32), pow10);
result.Low = (uint)low64;
hi64 += low64 >> 32;
result.Mid = (uint)hi64;
hi64 >>= 32;
result.High = (uint)hi64;
}
else
{
// Have a big power of 10.
//
Debug.Assert(power <= 14);
UInt64x64To128(mant, s_ulongPowers10[power - 1], ref result);
}
}
else
{
// Factor out powers of 10 to reduce the scale, if possible.
// The maximum number we could factor out would be 14. This
// comes from the fact we have a 15-digit number, and the
// MSD must be non-zero -- but the lower 14 digits could be
// zero. Note also the scale factor is never negative, so
// we can't scale by any more than the power we used to
// get the integer.
//
int lmax = power;
if (lmax > 14)
lmax = 14;
if ((byte)mant == 0 && lmax >= 8)
{
const uint den = 100000000;
ulong div = mant / den;
if ((uint)mant == (uint)(div * den))
{
mant = div;
power -= 8;
lmax -= 8;
}
}
if (((uint)mant & 0xF) == 0 && lmax >= 4)
{
const uint den = 10000;
ulong div = mant / den;
if ((uint)mant == (uint)(div * den))
{
mant = div;
power -= 4;
lmax -= 4;
}
}
if (((uint)mant & 3) == 0 && lmax >= 2)
{
const uint den = 100;
ulong div = mant / den;
if ((uint)mant == (uint)(div * den))
{
mant = div;
power -= 2;
lmax -= 2;
}
}
if (((uint)mant & 1) == 0 && lmax >= 1)
{
const uint den = 10;
ulong div = mant / den;
if ((uint)mant == (uint)(div * den))
{
mant = div;
power--;
}
}
flags |= (uint)power << ScaleShift;
result.Low64 = mant;
}
result.uflags = flags;
}
/// <summary>
/// Convert Decimal to float
/// </summary>
internal static float VarR4FromDec(in decimal value)
{
return (float)VarR8FromDec(in value);
}
/// <summary>
/// Convert Decimal to double
/// </summary>
internal static double VarR8FromDec(in decimal value)
{
// Value taken via reverse engineering the double that corresponds to 2^64. (oleaut32 has ds2to64 = DEFDS(0, 0, DBLBIAS + 65, 0))
const double ds2to64 = 1.8446744073709552e+019;
double dbl = ((double)value.Low64 +
(double)value.High * ds2to64) / s_doublePowers10[value.Scale];
if (value.IsNegative)
dbl = -dbl;
return dbl;
}
internal static int GetHashCode(in decimal d)
{
if ((d.Low64 | d.High) == 0)
return 0;
uint flags = (uint)d._flags;
if ((flags & ScaleMask) == 0 || (d.Low & 1) != 0)
return (int)(flags ^ d.High ^ d.Mid ^ d.Low);
int scale = (byte)(flags >> ScaleShift);
uint low = d.Low;
ulong high64 = ((ulong)d.High << 32) | d.Mid;
Unscale(ref low, ref high64, ref scale);
flags = (flags & ~ScaleMask) | (uint)scale << ScaleShift;
return (int)(flags ^ (uint)(high64 >> 32) ^ (uint)high64 ^ low);
}
/// <summary>
/// Divides two decimal values.
/// On return, d1 contains the result of the operation.
/// </summary>
internal static unsafe void VarDecDiv(ref DecCalc d1, ref DecCalc d2)
{
Unsafe.SkipInit(out Buf12 bufQuo);
uint power;
int curScale;
int scale = (sbyte)(d1.uflags - d2.uflags >> ScaleShift);
bool unscale = false;
uint tmp;
if ((d2.High | d2.Mid) == 0)
{
// Divisor is only 32 bits. Easy divide.
//
uint den = d2.Low;
if (den == 0)
throw new DivideByZeroException();
bufQuo.Low64 = d1.Low64;
bufQuo.U2 = d1.High;
uint remainder = Div96By32(ref bufQuo, den);
while (true)
{
if (remainder == 0)
{
if (scale < 0)
{
curScale = Math.Min(9, -scale);
goto HaveScale;
}
break;
}
// We need to unscale if and only if we have a non-zero remainder
unscale = true;
// We have computed a quotient based on the natural scale
// ( <dividend scale> - <divisor scale> ). We have a non-zero
// remainder, so now we should increase the scale if possible to
// include more quotient bits.
//
// If it doesn't cause overflow, we'll loop scaling by 10^9 and
// computing more quotient bits as long as the remainder stays
// non-zero. If scaling by that much would cause overflow, we'll
// drop out of the loop and scale by as much as we can.
//
// Scaling by 10^9 will overflow if bufQuo[2].bufQuo[1] >= 2^32 / 10^9
// = 4.294 967 296. So the upper limit is bufQuo[2] == 4 and
// bufQuo[1] == 0.294 967 296 * 2^32 = 1,266,874,889.7+. Since
// quotient bits in bufQuo[0] could be all 1's, then 1,266,874,888
// is the largest value in bufQuo[1] (when bufQuo[2] == 4) that is
// assured not to overflow.
//
if (scale == DEC_SCALE_MAX || (curScale = SearchScale(ref bufQuo, scale)) == 0)
{
// No more scaling to be done, but remainder is non-zero.
// Round quotient.
//
tmp = remainder << 1;
if (tmp < remainder || tmp >= den && (tmp > den || (bufQuo.U0 & 1) != 0))
goto RoundUp;
break;
}
HaveScale:
power = s_powers10[curScale];
scale += curScale;
if (IncreaseScale(ref bufQuo, power) != 0)
goto ThrowOverflow;
ulong num = UInt32x32To64(remainder, power);
// TODO: https://github.com/dotnet/runtime/issues/5213
uint div = (uint)(num / den);
remainder = (uint)num - div * den;
if (!Add32To96(ref bufQuo, div))
{
scale = OverflowUnscale(ref bufQuo, scale, remainder != 0);
break;
}
} // while (true)
}
else
{
// Divisor has bits set in the upper 64 bits.
//
// Divisor must be fully normalized (shifted so bit 31 of the most
// significant uint is 1). Locate the MSB so we know how much to
// normalize by. The dividend will be shifted by the same amount so
// the quotient is not changed.
//
tmp = d2.High;
if (tmp == 0)
tmp = d2.Mid;
curScale = BitOperations.LeadingZeroCount(tmp);
// Shift both dividend and divisor left by curScale.
//
Unsafe.SkipInit(out Buf16 bufRem);
bufRem.Low64 = d1.Low64 << curScale;
bufRem.High64 = (d1.Mid + ((ulong)d1.High << 32)) >> (32 - curScale);
ulong divisor = d2.Low64 << curScale;
if (d2.High == 0)
{
// Have a 64-bit divisor in sdlDivisor. The remainder
// (currently 96 bits spread over 4 uints) will be < divisor.
//
bufQuo.U2 = 0;
bufQuo.U1 = Div96By64(ref *(Buf12*)&bufRem.U1, divisor);
bufQuo.U0 = Div96By64(ref *(Buf12*)&bufRem, divisor);
while (true)
{
if (bufRem.Low64 == 0)
{
if (scale < 0)
{
curScale = Math.Min(9, -scale);
goto HaveScale64;
}
break;
}
// We need to unscale if and only if we have a non-zero remainder
unscale = true;
// Remainder is non-zero. Scale up quotient and remainder by
// powers of 10 so we can compute more significant bits.
//
if (scale == DEC_SCALE_MAX || (curScale = SearchScale(ref bufQuo, scale)) == 0)
{
// No more scaling to be done, but remainder is non-zero.
// Round quotient.
//
ulong tmp64 = bufRem.Low64;
if ((long)tmp64 < 0 || (tmp64 <<= 1) > divisor ||
(tmp64 == divisor && (bufQuo.U0 & 1) != 0))
goto RoundUp;
break;
}
HaveScale64:
power = s_powers10[curScale];
scale += curScale;
if (IncreaseScale(ref bufQuo, power) != 0)
goto ThrowOverflow;
IncreaseScale64(ref *(Buf12*)&bufRem, power);
tmp = Div96By64(ref *(Buf12*)&bufRem, divisor);
if (!Add32To96(ref bufQuo, tmp))
{
scale = OverflowUnscale(ref bufQuo, scale, bufRem.Low64 != 0);
break;
}
} // while (true)
}
else
{
// Have a 96-bit divisor in bufDivisor.
//
// Start by finishing the shift left by curScale.
//
Unsafe.SkipInit(out Buf12 bufDivisor);
bufDivisor.Low64 = divisor;
bufDivisor.U2 = (uint)((d2.Mid + ((ulong)d2.High << 32)) >> (32 - curScale));
// The remainder (currently 96 bits spread over 4 uints) will be < divisor.
//
bufQuo.Low64 = Div128By96(ref bufRem, ref bufDivisor);
bufQuo.U2 = 0;
while (true)
{
if ((bufRem.Low64 | bufRem.U2) == 0)
{
if (scale < 0)
{
curScale = Math.Min(9, -scale);
goto HaveScale96;
}
break;
}
// We need to unscale if and only if we have a non-zero remainder
unscale = true;
// Remainder is non-zero. Scale up quotient and remainder by
// powers of 10 so we can compute more significant bits.
//
if (scale == DEC_SCALE_MAX || (curScale = SearchScale(ref bufQuo, scale)) == 0)
{
// No more scaling to be done, but remainder is non-zero.
// Round quotient.
//
if ((int)bufRem.U2 < 0)
{
goto RoundUp;
}
tmp = bufRem.U1 >> 31;
bufRem.Low64 <<= 1;
bufRem.U2 = (bufRem.U2 << 1) + tmp;
if (bufRem.U2 > bufDivisor.U2 || bufRem.U2 == bufDivisor.U2 &&
(bufRem.Low64 > bufDivisor.Low64 || bufRem.Low64 == bufDivisor.Low64 &&
(bufQuo.U0 & 1) != 0))
goto RoundUp;
break;
}
HaveScale96:
power = s_powers10[curScale];
scale += curScale;
if (IncreaseScale(ref bufQuo, power) != 0)
goto ThrowOverflow;
bufRem.U3 = IncreaseScale(ref *(Buf12*)&bufRem, power);
tmp = Div128By96(ref bufRem, ref bufDivisor);
if (!Add32To96(ref bufQuo, tmp))
{
scale = OverflowUnscale(ref bufQuo, scale, (bufRem.Low64 | bufRem.High64) != 0);
break;
}
} // while (true)
}
}
Unscale:
if (unscale)
{
uint low = bufQuo.U0;
ulong high64 = bufQuo.High64;
Unscale(ref low, ref high64, ref scale);
d1.Low = low;
d1.Mid = (uint)high64;
d1.High = (uint)(high64 >> 32);
}
else
{
d1.Low64 = bufQuo.Low64;
d1.High = bufQuo.U2;
}
d1.uflags = ((d1.uflags ^ d2.uflags) & SignMask) | ((uint)scale << ScaleShift);
return;
RoundUp:
{
if (++bufQuo.Low64 == 0 && ++bufQuo.U2 == 0)
{
scale = OverflowUnscale(ref bufQuo, scale, true);
}
goto Unscale;
}
ThrowOverflow:
Number.ThrowOverflowException(TypeCode.Decimal);
}
/// <summary>
/// Computes the remainder between two decimals.
/// On return, d1 contains the result of the operation and d2 is trashed.
/// </summary>
internal static void VarDecMod(ref DecCalc d1, ref DecCalc d2)
{
if ((d2.ulo | d2.umid | d2.uhi) == 0)
throw new DivideByZeroException();
if ((d1.ulo | d1.umid | d1.uhi) == 0)
return;
// In the operation x % y the sign of y does not matter. Result will have the sign of x.
d2.uflags = (d2.uflags & ~SignMask) | (d1.uflags & SignMask);
int cmp = VarDecCmpSub(in Unsafe.As<DecCalc, decimal>(ref d1), in Unsafe.As<DecCalc, decimal>(ref d2));
if (cmp == 0)
{
d1.ulo = 0;
d1.umid = 0;
d1.uhi = 0;
if (d2.uflags > d1.uflags)
d1.uflags = d2.uflags;
return;
}
if ((cmp ^ (int)(d1.uflags & SignMask)) < 0)
return;
// The divisor is smaller than the dividend and both are non-zero. Calculate the integer remainder using the larger scaling factor.
int scale = (sbyte)(d1.uflags - d2.uflags >> ScaleShift);
if (scale > 0)
{
// Divisor scale can always be increased to dividend scale for remainder calculation.
do
{
uint power = scale >= MaxInt32Scale ? TenToPowerNine : s_powers10[scale];
ulong tmp = UInt32x32To64(d2.Low, power);
d2.Low = (uint)tmp;
tmp >>= 32;
tmp += (d2.Mid + ((ulong)d2.High << 32)) * power;
d2.Mid = (uint)tmp;
d2.High = (uint)(tmp >> 32);
} while ((scale -= MaxInt32Scale) > 0);
scale = 0;
}
do
{
if (scale < 0)
{
d1.uflags = d2.uflags;
// Try to scale up dividend to match divisor.
Unsafe.SkipInit(out Buf12 bufQuo);
bufQuo.Low64 = d1.Low64;
bufQuo.U2 = d1.High;
do
{
int iCurScale = SearchScale(ref bufQuo, DEC_SCALE_MAX + scale);
if (iCurScale == 0)
break;
uint power = iCurScale >= MaxInt32Scale ? TenToPowerNine : s_powers10[iCurScale];
scale += iCurScale;
ulong tmp = UInt32x32To64(bufQuo.U0, power);
bufQuo.U0 = (uint)tmp;
tmp >>= 32;
bufQuo.High64 = tmp + bufQuo.High64 * power;
if (power != TenToPowerNine)
break;
}
while (scale < 0);
d1.Low64 = bufQuo.Low64;
d1.High = bufQuo.U2;
}
if (d1.High == 0)
{
Debug.Assert(d2.High == 0);
Debug.Assert(scale == 0);
d1.Low64 %= d2.Low64;
return;
}
else if ((d2.High | d2.Mid) == 0)
{
uint den = d2.Low;
ulong tmp = ((ulong)d1.High << 32) | d1.Mid;
tmp = ((tmp % den) << 32) | d1.Low;
d1.Low64 = tmp % den;
d1.High = 0;
}
else
{
VarDecModFull(ref d1, ref d2, scale);
return;
}
} while (scale < 0);
}
private static unsafe void VarDecModFull(ref DecCalc d1, ref DecCalc d2, int scale)
{
// Divisor has bits set in the upper 64 bits.
//
// Divisor must be fully normalized (shifted so bit 31 of the most significant uint is 1).
// Locate the MSB so we know how much to normalize by.
// The dividend will be shifted by the same amount so the quotient is not changed.
//
uint tmp = d2.High;
if (tmp == 0)
tmp = d2.Mid;
int shift = BitOperations.LeadingZeroCount(tmp);
Unsafe.SkipInit(out Buf28 b);
b.Buf24.Low64 = d1.Low64 << shift;
b.Buf24.Mid64 = (d1.Mid + ((ulong)d1.High << 32)) >> (32 - shift);
// The dividend might need to be scaled up to 221 significant bits.
// Maximum scaling is required when the divisor is 2^64 with scale 28 and is left shifted 31 bits
// and the dividend is decimal.MaxValue: (2^96 - 1) * 10^28 << 31 = 221 bits.
uint high = 3;
while (scale < 0)
{
uint power = scale <= -MaxInt32Scale ? TenToPowerNine : s_powers10[-scale];
uint* buf = (uint*)&b;
ulong tmp64 = UInt32x32To64(b.Buf24.U0, power);
b.Buf24.U0 = (uint)tmp64;
for (int i = 1; i <= high; i++)
{
tmp64 >>= 32;
tmp64 += UInt32x32To64(buf[i], power);
buf[i] = (uint)tmp64;
}
// The high bit of the dividend must not be set.
if (tmp64 > int.MaxValue)
{
Debug.Assert(high + 1 < Buf28.Length);
buf[++high] = (uint)(tmp64 >> 32);
}
scale += MaxInt32Scale;
}
if (d2.High == 0)
{
ulong divisor = d2.Low64 << shift;
switch (high)
{
case 6:
Div96By64(ref *(Buf12*)&b.Buf24.U4, divisor);
goto case 5;
case 5:
Div96By64(ref *(Buf12*)&b.Buf24.U3, divisor);
goto case 4;
case 4:
Div96By64(ref *(Buf12*)&b.Buf24.U2, divisor);
break;
}
Div96By64(ref *(Buf12*)&b.Buf24.U1, divisor);
Div96By64(ref *(Buf12*)&b, divisor);
d1.Low64 = b.Buf24.Low64 >> shift;
d1.High = 0;
}
else
{
Unsafe.SkipInit(out Buf12 bufDivisor);
bufDivisor.Low64 = d2.Low64 << shift;
bufDivisor.U2 = (uint)((d2.Mid + ((ulong)d2.High << 32)) >> (32 - shift));
switch (high)
{
case 6:
Div128By96(ref *(Buf16*)&b.Buf24.U3, ref bufDivisor);
goto case 5;
case 5:
Div128By96(ref *(Buf16*)&b.Buf24.U2, ref bufDivisor);
goto case 4;
case 4:
Div128By96(ref *(Buf16*)&b.Buf24.U1, ref bufDivisor);
break;
}
Div128By96(ref *(Buf16*)&b, ref bufDivisor);
d1.Low64 = (b.Buf24.Low64 >> shift) + ((ulong)b.Buf24.U2 << (32 - shift) << 32);
d1.High = b.Buf24.U2 >> shift;
}
}
// Does an in-place round by the specified scale
internal static void InternalRound(ref DecCalc d, uint scale, MidpointRounding mode)
{
// the scale becomes the desired decimal count
d.uflags -= scale << ScaleShift;
uint remainder, sticky = 0, power;
// First divide the value by constant 10^9 up to three times
while (scale >= MaxInt32Scale)
{
scale -= MaxInt32Scale;
const uint divisor = TenToPowerNine;
uint n = d.uhi;
if (n == 0)
{
ulong tmp = d.Low64;
ulong div = tmp / divisor;
d.Low64 = div;
remainder = (uint)(tmp - div * divisor);
}
else
{
uint q;
d.uhi = q = n / divisor;
remainder = n - q * divisor;
n = d.umid;
if ((n | remainder) != 0)
{
d.umid = q = (uint)((((ulong)remainder << 32) | n) / divisor);
remainder = n - q * divisor;
}
n = d.ulo;
if ((n | remainder) != 0)
{
d.ulo = q = (uint)((((ulong)remainder << 32) | n) / divisor);
remainder = n - q * divisor;
}
}
power = divisor;
if (scale == 0)
goto checkRemainder;
sticky |= remainder;
}
{
power = s_powers10[scale];
// TODO: https://github.com/dotnet/runtime/issues/5213
uint n = d.uhi;
if (n == 0)
{
ulong tmp = d.Low64;
if (tmp == 0)
{
if (mode <= MidpointRounding.ToZero)
goto done;
remainder = 0;
goto checkRemainder;
}
ulong div = tmp / power;
d.Low64 = div;
remainder = (uint)(tmp - div * power);
}
else
{
uint q;
d.uhi = q = n / power;
remainder = n - q * power;
n = d.umid;
if ((n | remainder) != 0)
{
d.umid = q = (uint)((((ulong)remainder << 32) | n) / power);
remainder = n - q * power;
}
n = d.ulo;
if ((n | remainder) != 0)
{
d.ulo = q = (uint)((((ulong)remainder << 32) | n) / power);
remainder = n - q * power;
}
}
}
checkRemainder:
if (mode == MidpointRounding.ToZero)
goto done;
else if (mode == MidpointRounding.ToEven)
{
// To do IEEE rounding, we add LSB of result to sticky bits so either causes round up if remainder * 2 == last divisor.
remainder <<= 1;
if ((sticky | d.ulo & 1) != 0)
remainder++;
if (power >= remainder)
goto done;
}
else if (mode == MidpointRounding.AwayFromZero)
{
// Round away from zero at the mid point.
remainder <<= 1;
if (power > remainder)
goto done;
}
else if (mode == MidpointRounding.ToNegativeInfinity)
{
// Round toward -infinity if we have chopped off a non-zero amount from a negative value.
if ((remainder | sticky) == 0 || !d.IsNegative)
goto done;
}
else
{
Debug.Assert(mode == MidpointRounding.ToPositiveInfinity);
// Round toward infinity if we have chopped off a non-zero amount from a positive value.
if ((remainder | sticky) == 0 || d.IsNegative)
goto done;
}
if (++d.Low64 == 0)
d.uhi++;
done:
return;
}
internal static uint DecDivMod1E9(ref DecCalc value)
{
ulong high64 = ((ulong)value.uhi << 32) + value.umid;
ulong div64 = high64 / TenToPowerNine;
value.uhi = (uint)(div64 >> 32);
value.umid = (uint)div64;
ulong num = ((high64 - (uint)div64 * TenToPowerNine) << 32) + value.ulo;
uint div = (uint)(num / TenToPowerNine);
value.ulo = div;
return (uint)num - div * TenToPowerNine;
}
private struct PowerOvfl
{
public readonly uint Hi;
public readonly ulong MidLo;
public PowerOvfl(uint hi, uint mid, uint lo)
{
Hi = hi;
MidLo = ((ulong)mid << 32) + lo;
}
}
private static readonly PowerOvfl[] PowerOvflValues = new[]
{
// This is a table of the largest values that can be in the upper two
// uints of a 96-bit number that will not overflow when multiplied
// by a given power. For the upper word, this is a table of
// 2^32 / 10^n for 1 <= n <= 8. For the lower word, this is the
// remaining fraction part * 2^32. 2^32 = 4294967296.
//
new PowerOvfl(429496729, 2576980377, 2576980377), // 10^1 remainder 0.6
new PowerOvfl(42949672, 4123168604, 687194767), // 10^2 remainder 0.16
new PowerOvfl(4294967, 1271310319, 2645699854), // 10^3 remainder 0.616
new PowerOvfl(429496, 3133608139, 694066715), // 10^4 remainder 0.1616
new PowerOvfl(42949, 2890341191, 2216890319), // 10^5 remainder 0.51616
new PowerOvfl(4294, 4154504685, 2369172679), // 10^6 remainder 0.551616
new PowerOvfl(429, 2133437386, 4102387834), // 10^7 remainder 0.9551616
new PowerOvfl(42, 4078814305, 410238783), // 10^8 remainder 0.09991616
};
[StructLayout(LayoutKind.Explicit)]
private struct Buf12
{
[FieldOffset(0 * 4)]
public uint U0;
[FieldOffset(1 * 4)]
public uint U1;
[FieldOffset(2 * 4)]
public uint U2;
[FieldOffset(0)]
private ulong ulo64LE;
[FieldOffset(4)]
private ulong uhigh64LE;
public ulong Low64
{
#if BIGENDIAN
get => ((ulong)U1 << 32) | U0;
set { U1 = (uint)(value >> 32); U0 = (uint)value; }
#else
get => ulo64LE;
set => ulo64LE = value;
#endif
}
/// <summary>
/// U1-U2 combined (overlaps with Low64)
/// </summary>
public ulong High64
{
#if BIGENDIAN
get => ((ulong)U2 << 32) | U1;
set { U2 = (uint)(value >> 32); U1 = (uint)value; }
#else
get => uhigh64LE;
set => uhigh64LE = value;
#endif
}
}
[StructLayout(LayoutKind.Explicit)]
private struct Buf16
{
[FieldOffset(0 * 4)]
public uint U0;
[FieldOffset(1 * 4)]
public uint U1;
[FieldOffset(2 * 4)]
public uint U2;
[FieldOffset(3 * 4)]
public uint U3;
[FieldOffset(0 * 8)]
private ulong ulo64LE;
[FieldOffset(1 * 8)]
private ulong uhigh64LE;
public ulong Low64
{
#if BIGENDIAN
get => ((ulong)U1 << 32) | U0;
set { U1 = (uint)(value >> 32); U0 = (uint)value; }
#else
get => ulo64LE;
set => ulo64LE = value;
#endif
}
public ulong High64
{
#if BIGENDIAN
get => ((ulong)U3 << 32) | U2;
set { U3 = (uint)(value >> 32); U2 = (uint)value; }
#else
get => uhigh64LE;
set => uhigh64LE = value;
#endif
}
}
[StructLayout(LayoutKind.Explicit)]
private struct Buf24
{
[FieldOffset(0 * 4)]
public uint U0;
[FieldOffset(1 * 4)]
public uint U1;
[FieldOffset(2 * 4)]
public uint U2;
[FieldOffset(3 * 4)]
public uint U3;
[FieldOffset(4 * 4)]
public uint U4;
[FieldOffset(5 * 4)]
public uint U5;
[FieldOffset(0 * 8)]
private ulong ulo64LE;
[FieldOffset(1 * 8)]
private ulong umid64LE;
[FieldOffset(2 * 8)]
private ulong uhigh64LE;
public ulong Low64
{
#if BIGENDIAN
get => ((ulong)U1 << 32) | U0;
set { U1 = (uint)(value >> 32); U0 = (uint)value; }
#else
get => ulo64LE;
set => ulo64LE = value;
#endif
}
public ulong Mid64
{
#if BIGENDIAN
get => ((ulong)U3 << 32) | U2;
set { U3 = (uint)(value >> 32); U2 = (uint)value; }
#else
get => umid64LE;
set => umid64LE = value;
#endif
}
public ulong High64
{
#if BIGENDIAN
get => ((ulong)U5 << 32) | U4;
set { U5 = (uint)(value >> 32); U4 = (uint)value; }
#else
get => uhigh64LE;
set => uhigh64LE = value;
#endif
}
public const int Length = 6;
}
private struct Buf28
{
public Buf24 Buf24;
public uint U6;
public const int Length = 7;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using X86 = System.Runtime.Intrinsics.X86;
namespace System
{
public partial struct Decimal
{
// Low level accessors used by a DecCalc and formatting
internal uint High => _hi32;
internal uint Low => (uint)_lo64;
internal uint Mid => (uint)(_lo64 >> 32);
internal bool IsNegative => _flags < 0;
private ulong Low64 => _lo64;
private static ref DecCalc AsMutable(ref decimal d) => ref Unsafe.As<decimal, DecCalc>(ref d);
#region APIs need by number formatting.
internal static uint DecDivMod1E9(ref decimal value)
{
return DecCalc.DecDivMod1E9(ref AsMutable(ref value));
}
#endregion
/// <summary>
/// Class that contains all the mathematical calculations for decimal. Most of which have been ported from oleaut32.
/// </summary>
[StructLayout(LayoutKind.Explicit)]
private struct DecCalc
{
// NOTE: Do not change the offsets of these fields. This structure must have the same layout as Decimal.
[FieldOffset(0)]
private uint uflags;
[FieldOffset(4)]
private uint uhi;
#if BIGENDIAN
[FieldOffset(8)]
private uint umid;
[FieldOffset(12)]
private uint ulo;
#else
[FieldOffset(8)]
private uint ulo;
[FieldOffset(12)]
private uint umid;
#endif
/// <summary>
/// The low and mid fields combined
/// </summary>
[FieldOffset(8)]
private ulong ulomid;
private uint High
{
get => uhi;
set => uhi = value;
}
private uint Low
{
get => ulo;
set => ulo = value;
}
private uint Mid
{
get => umid;
set => umid = value;
}
private bool IsNegative => (int)uflags < 0;
private int Scale => (byte)(uflags >> ScaleShift);
private ulong Low64
{
get => ulomid;
set => ulomid = value;
}
private const uint SignMask = 0x80000000;
private const uint ScaleMask = 0x00FF0000;
private const int DEC_SCALE_MAX = 28;
private const uint TenToPowerNine = 1000000000;
private const ulong TenToPowerEighteen = 1000000000000000000;
// The maximum power of 10 that a 32 bit integer can store
private const int MaxInt32Scale = 9;
// The maximum power of 10 that a 64 bit integer can store
private const int MaxInt64Scale = 19;
// Fast access for 10^n where n is 0-9
private static readonly uint[] s_powers10 = new uint[] {
1,
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000
};
// Fast access for 10^n where n is 1-19
private static readonly ulong[] s_ulongPowers10 = new ulong[] {
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000,
10000000000,
100000000000,
1000000000000,
10000000000000,
100000000000000,
1000000000000000,
10000000000000000,
100000000000000000,
1000000000000000000,
10000000000000000000,
};
private static readonly double[] s_doublePowers10 = new double[] {
1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9,
1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
1e20, 1e21, 1e22, 1e23, 1e24, 1e25, 1e26, 1e27, 1e28, 1e29,
1e30, 1e31, 1e32, 1e33, 1e34, 1e35, 1e36, 1e37, 1e38, 1e39,
1e40, 1e41, 1e42, 1e43, 1e44, 1e45, 1e46, 1e47, 1e48, 1e49,
1e50, 1e51, 1e52, 1e53, 1e54, 1e55, 1e56, 1e57, 1e58, 1e59,
1e60, 1e61, 1e62, 1e63, 1e64, 1e65, 1e66, 1e67, 1e68, 1e69,
1e70, 1e71, 1e72, 1e73, 1e74, 1e75, 1e76, 1e77, 1e78, 1e79,
1e80
};
#region Decimal Math Helpers
private static unsafe uint GetExponent(float f)
{
// Based on pulling out the exp from this single struct layout
// typedef struct {
// ULONG mant:23;
// ULONG exp:8;
// ULONG sign:1;
// } SNGSTRUCT;
return (byte)(*(uint*)&f >> 23);
}
private static unsafe uint GetExponent(double d)
{
// Based on pulling out the exp from this double struct layout
// typedef struct {
// DWORDLONG mant:52;
// DWORDLONG signexp:12;
// } DBLSTRUCT;
return (uint)(*(ulong*)&d >> 52) & 0x7FFu;
}
private static ulong UInt32x32To64(uint a, uint b)
{
return (ulong)a * (ulong)b;
}
private static void UInt64x64To128(ulong a, ulong b, ref DecCalc result)
{
ulong low = UInt32x32To64((uint)a, (uint)b); // lo partial prod
ulong mid = UInt32x32To64((uint)a, (uint)(b >> 32)); // mid 1 partial prod
ulong high = UInt32x32To64((uint)(a >> 32), (uint)(b >> 32));
high += mid >> 32;
low += mid <<= 32;
if (low < mid) // test for carry
high++;
mid = UInt32x32To64((uint)(a >> 32), (uint)b);
high += mid >> 32;
low += mid <<= 32;
if (low < mid) // test for carry
high++;
if (high > uint.MaxValue)
Number.ThrowOverflowException(TypeCode.Decimal);
result.Low64 = low;
result.High = (uint)high;
}
/// <summary>
/// Do full divide, yielding 96-bit result and 32-bit remainder.
/// </summary>
/// <param name="bufNum">96-bit dividend as array of uints, least-sig first</param>
/// <param name="den">32-bit divisor</param>
/// <returns>Returns remainder. Quotient overwrites dividend.</returns>
private static uint Div96By32(ref Buf12 bufNum, uint den)
{
// TODO: https://github.com/dotnet/runtime/issues/5213
ulong tmp, div;
if (bufNum.U2 != 0)
{
tmp = bufNum.High64;
div = tmp / den;
bufNum.High64 = div;
tmp = ((tmp - (uint)div * den) << 32) | bufNum.U0;
if (tmp == 0)
return 0;
uint div32 = (uint)(tmp / den);
bufNum.U0 = div32;
return (uint)tmp - div32 * den;
}
tmp = bufNum.Low64;
if (tmp == 0)
return 0;
div = tmp / den;
bufNum.Low64 = div;
return (uint)(tmp - div * den);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool Div96ByConst(ref ulong high64, ref uint low, uint pow)
{
#if TARGET_64BIT
ulong div64 = high64 / pow;
uint div = (uint)((((high64 - div64 * pow) << 32) + low) / pow);
if (low == div * pow)
{
high64 = div64;
low = div;
return true;
}
#else
// 32-bit RyuJIT doesn't convert 64-bit division by constant into multiplication by reciprocal. Do half-width divisions instead.
Debug.Assert(pow <= ushort.MaxValue);
uint num, mid32, low16, div;
if (high64 <= uint.MaxValue)
{
num = (uint)high64;
mid32 = num / pow;
num = (num - mid32 * pow) << 16;
num += low >> 16;
low16 = num / pow;
num = (num - low16 * pow) << 16;
num += (ushort)low;
div = num / pow;
if (num == div * pow)
{
high64 = mid32;
low = (low16 << 16) + div;
return true;
}
}
else
{
num = (uint)(high64 >> 32);
uint high32 = num / pow;
num = (num - high32 * pow) << 16;
num += (uint)high64 >> 16;
mid32 = num / pow;
num = (num - mid32 * pow) << 16;
num += (ushort)high64;
div = num / pow;
num = (num - div * pow) << 16;
mid32 = div + (mid32 << 16);
num += low >> 16;
low16 = num / pow;
num = (num - low16 * pow) << 16;
num += (ushort)low;
div = num / pow;
if (num == div * pow)
{
high64 = ((ulong)high32 << 32) | mid32;
low = (low16 << 16) + div;
return true;
}
}
#endif
return false;
}
/// <summary>
/// Normalize (unscale) the number by trying to divide out 10^8, 10^4, 10^2, and 10^1.
/// If a division by one of these powers returns a zero remainder, then we keep the quotient.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void Unscale(ref uint low, ref ulong high64, ref int scale)
{
// Since 10 = 2 * 5, there must be a factor of 2 for every power of 10 we can extract.
// We use this as a quick test on whether to try a given power.
#if TARGET_64BIT
while ((byte)low == 0 && scale >= 8 && Div96ByConst(ref high64, ref low, 100000000))
scale -= 8;
if ((low & 0xF) == 0 && scale >= 4 && Div96ByConst(ref high64, ref low, 10000))
scale -= 4;
#else
while ((low & 0xF) == 0 && scale >= 4 && Div96ByConst(ref high64, ref low, 10000))
scale -= 4;
#endif
if ((low & 3) == 0 && scale >= 2 && Div96ByConst(ref high64, ref low, 100))
scale -= 2;
if ((low & 1) == 0 && scale >= 1 && Div96ByConst(ref high64, ref low, 10))
scale--;
}
/// <summary>
/// Do partial divide, yielding 32-bit result and 64-bit remainder.
/// Divisor must be larger than upper 64 bits of dividend.
/// </summary>
/// <param name="bufNum">96-bit dividend as array of uints, least-sig first</param>
/// <param name="den">64-bit divisor</param>
/// <returns>Returns quotient. Remainder overwrites lower 64-bits of dividend.</returns>
private static uint Div96By64(ref Buf12 bufNum, ulong den)
{
Debug.Assert(den > bufNum.High64);
uint quo;
ulong num;
uint num2 = bufNum.U2;
if (num2 == 0)
{
num = bufNum.Low64;
if (num < den)
// Result is zero. Entire dividend is remainder.
return 0;
// TODO: https://github.com/dotnet/runtime/issues/5213
quo = (uint)(num / den);
num -= quo * den; // remainder
bufNum.Low64 = num;
return quo;
}
uint denHigh32 = (uint)(den >> 32);
if (num2 >= denHigh32)
{
// Divide would overflow. Assume a quotient of 2^32, and set
// up remainder accordingly.
//
num = bufNum.Low64;
num -= den << 32;
quo = 0;
// Remainder went negative. Add divisor back in until it's positive,
// a max of 2 times.
//
do
{
quo--;
num += den;
} while (num >= den);
bufNum.Low64 = num;
return quo;
}
// Hardware divide won't overflow
//
ulong num64 = bufNum.High64;
if (num64 < denHigh32)
// Result is zero. Entire dividend is remainder.
//
return 0;
// TODO: https://github.com/dotnet/runtime/issues/5213
quo = (uint)(num64 / denHigh32);
num = bufNum.U0 | ((num64 - quo * denHigh32) << 32); // remainder
// Compute full remainder, rem = dividend - (quo * divisor).
//
ulong prod = UInt32x32To64(quo, (uint)den); // quo * lo divisor
num -= prod;
if (num > ~prod)
{
// Remainder went negative. Add divisor back in until it's positive,
// a max of 2 times.
//
do
{
quo--;
num += den;
} while (num >= den);
}
bufNum.Low64 = num;
return quo;
}
/// <summary>
/// Do partial divide, yielding 32-bit result and 96-bit remainder.
/// Top divisor uint must be larger than top dividend uint. This is
/// assured in the initial call because the divisor is normalized
/// and the dividend can't be. In subsequent calls, the remainder
/// is multiplied by 10^9 (max), so it can be no more than 1/4 of
/// the divisor which is effectively multiplied by 2^32 (4 * 10^9).
/// </summary>
/// <param name="bufNum">128-bit dividend as array of uints, least-sig first</param>
/// <param name="bufDen">96-bit divisor</param>
/// <returns>Returns quotient. Remainder overwrites lower 96-bits of dividend.</returns>
private static uint Div128By96(ref Buf16 bufNum, ref Buf12 bufDen)
{
Debug.Assert(bufDen.U2 > bufNum.U3);
ulong dividend = bufNum.High64;
uint den = bufDen.U2;
if (dividend < den)
// Result is zero. Entire dividend is remainder.
//
return 0;
// TODO: https://github.com/dotnet/runtime/issues/5213
uint quo = (uint)(dividend / den);
uint remainder = (uint)dividend - quo * den;
// Compute full remainder, rem = dividend - (quo * divisor).
//
ulong prod1 = UInt32x32To64(quo, bufDen.U0); // quo * lo divisor
ulong prod2 = UInt32x32To64(quo, bufDen.U1); // quo * mid divisor
prod2 += prod1 >> 32;
prod1 = (uint)prod1 | (prod2 << 32);
prod2 >>= 32;
ulong num = bufNum.Low64;
num -= prod1;
remainder -= (uint)prod2;
// Propagate carries
//
if (num > ~prod1)
{
remainder--;
if (remainder < ~(uint)prod2)
goto PosRem;
}
else if (remainder <= ~(uint)prod2)
goto PosRem;
{
// Remainder went negative. Add divisor back in until it's positive,
// a max of 2 times.
//
prod1 = bufDen.Low64;
while (true)
{
quo--;
num += prod1;
remainder += den;
if (num < prod1)
{
// Detected carry. Check for carry out of top
// before adding it in.
//
if (remainder++ < den)
break;
}
if (remainder < den)
break; // detected carry
}
}
PosRem:
bufNum.Low64 = num;
bufNum.U2 = remainder;
return quo;
}
/// <summary>
/// Multiply the two numbers. The low 96 bits of the result overwrite
/// the input. The last 32 bits of the product are the return value.
/// </summary>
/// <param name="bufNum">96-bit number as array of uints, least-sig first</param>
/// <param name="power">Scale factor to multiply by</param>
/// <returns>Returns highest 32 bits of product</returns>
private static uint IncreaseScale(ref Buf12 bufNum, uint power)
{
ulong tmp = UInt32x32To64(bufNum.U0, power);
bufNum.U0 = (uint)tmp;
tmp >>= 32;
tmp += UInt32x32To64(bufNum.U1, power);
bufNum.U1 = (uint)tmp;
tmp >>= 32;
tmp += UInt32x32To64(bufNum.U2, power);
bufNum.U2 = (uint)tmp;
return (uint)(tmp >> 32);
}
private static void IncreaseScale64(ref Buf12 bufNum, uint power)
{
ulong tmp = UInt32x32To64(bufNum.U0, power);
bufNum.U0 = (uint)tmp;
tmp >>= 32;
tmp += UInt32x32To64(bufNum.U1, power);
bufNum.High64 = tmp;
}
/// <summary>
/// See if we need to scale the result to fit it in 96 bits.
/// Perform needed scaling. Adjust scale factor accordingly.
/// </summary>
/// <param name="bufRes">Array of uints with value, least-significant first</param>
/// <param name="hiRes">Index of last non-zero value in bufRes</param>
/// <param name="scale">Scale factor for this value, range 0 - 2 * DEC_SCALE_MAX</param>
/// <returns>Returns new scale factor. bufRes updated in place, always 3 uints.</returns>
private static unsafe int ScaleResult(Buf24* bufRes, uint hiRes, int scale)
{
Debug.Assert(hiRes < Buf24.Length);
uint* result = (uint*)bufRes;
// See if we need to scale the result. The combined scale must
// be <= DEC_SCALE_MAX and the upper 96 bits must be zero.
//
// Start by figuring a lower bound on the scaling needed to make
// the upper 96 bits zero. hiRes is the index into result[]
// of the highest non-zero uint.
//
int newScale = 0;
if (hiRes > 2)
{
newScale = (int)hiRes * 32 - 64 - 1;
newScale -= BitOperations.LeadingZeroCount(result[hiRes]);
// Multiply bit position by log10(2) to figure it's power of 10.
// We scale the log by 256. log(2) = .30103, * 256 = 77. Doing this
// with a multiply saves a 96-byte lookup table. The power returned
// is <= the power of the number, so we must add one power of 10
// to make it's integer part zero after dividing by 256.
//
// Note: the result of this multiplication by an approximation of
// log10(2) have been exhaustively checked to verify it gives the
// correct result. (There were only 95 to check...)
//
newScale = ((newScale * 77) >> 8) + 1;
// newScale = min scale factor to make high 96 bits zero, 0 - 29.
// This reduces the scale factor of the result. If it exceeds the
// current scale of the result, we'll overflow.
//
if (newScale > scale)
goto ThrowOverflow;
}
// Make sure we scale by enough to bring the current scale factor
// into valid range.
//
if (newScale < scale - DEC_SCALE_MAX)
newScale = scale - DEC_SCALE_MAX;
if (newScale != 0)
{
// Scale by the power of 10 given by newScale. Note that this is
// NOT guaranteed to bring the number within 96 bits -- it could
// be 1 power of 10 short.
//
scale -= newScale;
uint sticky = 0;
uint quotient, remainder = 0;
while (true)
{
sticky |= remainder; // record remainder as sticky bit
uint power;
// Scaling loop specialized for each power of 10 because division by constant is an order of magnitude faster (especially for 64-bit division that's actually done by 128bit DIV on x64)
switch (newScale)
{
case 1:
power = DivByConst(result, hiRes, out quotient, out remainder, 10);
break;
case 2:
power = DivByConst(result, hiRes, out quotient, out remainder, 100);
break;
case 3:
power = DivByConst(result, hiRes, out quotient, out remainder, 1000);
break;
case 4:
power = DivByConst(result, hiRes, out quotient, out remainder, 10000);
break;
#if TARGET_64BIT
case 5:
power = DivByConst(result, hiRes, out quotient, out remainder, 100000);
break;
case 6:
power = DivByConst(result, hiRes, out quotient, out remainder, 1000000);
break;
case 7:
power = DivByConst(result, hiRes, out quotient, out remainder, 10000000);
break;
case 8:
power = DivByConst(result, hiRes, out quotient, out remainder, 100000000);
break;
default:
power = DivByConst(result, hiRes, out quotient, out remainder, TenToPowerNine);
break;
#else
default:
goto case 4;
#endif
}
result[hiRes] = quotient;
// If first quotient was 0, update hiRes.
//
if (quotient == 0 && hiRes != 0)
hiRes--;
#if TARGET_64BIT
newScale -= MaxInt32Scale;
#else
newScale -= 4;
#endif
if (newScale > 0)
continue; // scale some more
// If we scaled enough, hiRes would be 2 or less. If not,
// divide by 10 more.
//
if (hiRes > 2)
{
if (scale == 0)
goto ThrowOverflow;
newScale = 1;
scale--;
continue; // scale by 10
}
// Round final result. See if remainder >= 1/2 of divisor.
// If remainder == 1/2 divisor, round up if odd or sticky bit set.
//
power >>= 1; // power of 10 always even
if (power <= remainder && (power < remainder || ((result[0] & 1) | sticky) != 0) && ++result[0] == 0)
{
uint cur = 0;
do
{
Debug.Assert(cur + 1 < Buf24.Length);
}
while (++result[++cur] == 0);
if (cur > 2)
{
// The rounding caused us to carry beyond 96 bits.
// Scale by 10 more.
//
if (scale == 0)
goto ThrowOverflow;
hiRes = cur;
sticky = 0; // no sticky bit
remainder = 0; // or remainder
newScale = 1;
scale--;
continue; // scale by 10
}
}
break;
} // while (true)
}
return scale;
ThrowOverflow:
Number.ThrowOverflowException(TypeCode.Decimal);
return 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe uint DivByConst(uint* result, uint hiRes, out uint quotient, out uint remainder, uint power)
{
uint high = result[hiRes];
remainder = high - (quotient = high / power) * power;
for (uint i = hiRes - 1; (int)i >= 0; i--)
{
#if TARGET_64BIT
ulong num = result[i] + ((ulong)remainder << 32);
remainder = (uint)num - (result[i] = (uint)(num / power)) * power;
#else
// 32-bit RyuJIT doesn't convert 64-bit division by constant into multiplication by reciprocal. Do half-width divisions instead.
Debug.Assert(power <= ushort.MaxValue);
#if BIGENDIAN
const int low16 = 2, high16 = 0;
#else
const int low16 = 0, high16 = 2;
#endif
// byte* is used here because Roslyn doesn't do constant propagation for pointer arithmetic
uint num = *(ushort*)((byte*)result + i * 4 + high16) + (remainder << 16);
uint div = num / power;
remainder = num - div * power;
*(ushort*)((byte*)result + i * 4 + high16) = (ushort)div;
num = *(ushort*)((byte*)result + i * 4 + low16) + (remainder << 16);
div = num / power;
remainder = num - div * power;
*(ushort*)((byte*)result + i * 4 + low16) = (ushort)div;
#endif
}
return power;
}
/// <summary>
/// Adjust the quotient to deal with an overflow.
/// We need to divide by 10, feed in the high bit to undo the overflow and then round as required.
/// </summary>
private static int OverflowUnscale(ref Buf12 bufQuo, int scale, bool sticky)
{
if (--scale < 0)
Number.ThrowOverflowException(TypeCode.Decimal);
Debug.Assert(bufQuo.U2 == 0);
// We have overflown, so load the high bit with a one.
const ulong highbit = 1UL << 32;
bufQuo.U2 = (uint)(highbit / 10);
ulong tmp = ((highbit % 10) << 32) + bufQuo.U1;
uint div = (uint)(tmp / 10);
bufQuo.U1 = div;
tmp = ((tmp - div * 10) << 32) + bufQuo.U0;
div = (uint)(tmp / 10);
bufQuo.U0 = div;
uint remainder = (uint)(tmp - div * 10);
// The remainder is the last digit that does not fit, so we can use it to work out if we need to round up
if (remainder > 5 || remainder == 5 && (sticky || (bufQuo.U0 & 1) != 0))
Add32To96(ref bufQuo, 1);
return scale;
}
/// <summary>
/// Determine the max power of 10, <= 9, that the quotient can be scaled
/// up by and still fit in 96 bits.
/// </summary>
/// <param name="bufQuo">96-bit quotient</param>
/// <param name="scale ">Scale factor of quotient, range -DEC_SCALE_MAX to DEC_SCALE_MAX-1</param>
/// <returns>power of 10 to scale by</returns>
private static int SearchScale(ref Buf12 bufQuo, int scale)
{
const uint OVFL_MAX_9_HI = 4;
const uint OVFL_MAX_8_HI = 42;
const uint OVFL_MAX_7_HI = 429;
const uint OVFL_MAX_6_HI = 4294;
const uint OVFL_MAX_5_HI = 42949;
const uint OVFL_MAX_4_HI = 429496;
const uint OVFL_MAX_3_HI = 4294967;
const uint OVFL_MAX_2_HI = 42949672;
const uint OVFL_MAX_1_HI = 429496729;
const ulong OVFL_MAX_9_MIDLO = 5441186219426131129;
uint resHi = bufQuo.U2;
ulong resMidLo = bufQuo.Low64;
int curScale = 0;
// Quick check to stop us from trying to scale any more.
//
if (resHi > OVFL_MAX_1_HI)
{
goto HaveScale;
}
PowerOvfl[] powerOvfl = PowerOvflValues;
if (scale > DEC_SCALE_MAX - 9)
{
// We can't scale by 10^9 without exceeding the max scale factor.
// See if we can scale to the max. If not, we'll fall into
// standard search for scale factor.
//
curScale = DEC_SCALE_MAX - scale;
if (resHi < powerOvfl[curScale - 1].Hi)
goto HaveScale;
}
else if (resHi < OVFL_MAX_9_HI || resHi == OVFL_MAX_9_HI && resMidLo <= OVFL_MAX_9_MIDLO)
return 9;
// Search for a power to scale by < 9. Do a binary search.
//
if (resHi > OVFL_MAX_5_HI)
{
if (resHi > OVFL_MAX_3_HI)
{
curScale = 2;
if (resHi > OVFL_MAX_2_HI)
curScale--;
}
else
{
curScale = 4;
if (resHi > OVFL_MAX_4_HI)
curScale--;
}
}
else
{
if (resHi > OVFL_MAX_7_HI)
{
curScale = 6;
if (resHi > OVFL_MAX_6_HI)
curScale--;
}
else
{
curScale = 8;
if (resHi > OVFL_MAX_8_HI)
curScale--;
}
}
// In all cases, we already found we could not use the power one larger.
// So if we can use this power, it is the biggest, and we're done. If
// we can't use this power, the one below it is correct for all cases
// unless it's 10^1 -- we might have to go to 10^0 (no scaling).
//
if (resHi == powerOvfl[curScale - 1].Hi && resMidLo > powerOvfl[curScale - 1].MidLo)
curScale--;
HaveScale:
// curScale = largest power of 10 we can scale by without overflow,
// curScale < 9. See if this is enough to make scale factor
// positive if it isn't already.
//
if (curScale + scale < 0)
Number.ThrowOverflowException(TypeCode.Decimal);
return curScale;
}
/// <summary>
/// Add a 32-bit uint to an array of 3 uints representing a 96-bit integer.
/// </summary>
/// <returns>Returns false if there is an overflow</returns>
private static bool Add32To96(ref Buf12 bufNum, uint value)
{
if ((bufNum.Low64 += value) < value)
{
if (++bufNum.U2 == 0)
return false;
}
return true;
}
/// <summary>
/// Adds or subtracts two decimal values.
/// On return, d1 contains the result of the operation and d2 is trashed.
/// </summary>
/// <param name="d1">First decimal to add or subtract.</param>
/// <param name="d2">Second decimal to add or subtract.</param>
/// <param name="sign">True means subtract and false means add.</param>
internal static unsafe void DecAddSub(ref DecCalc d1, ref DecCalc d2, bool sign)
{
ulong low64 = d1.Low64;
uint high = d1.High, flags = d1.uflags, d2flags = d2.uflags;
uint xorflags = d2flags ^ flags;
sign ^= (xorflags & SignMask) != 0;
if ((xorflags & ScaleMask) == 0)
{
// Scale factors are equal, no alignment necessary.
//
goto AlignedAdd;
}
else
{
// Scale factors are not equal. Assume that a larger scale
// factor (more decimal places) is likely to mean that number
// is smaller. Start by guessing that the right operand has
// the larger scale factor. The result will have the larger
// scale factor.
//
uint d1flags = flags;
flags = d2flags & ScaleMask | flags & SignMask; // scale factor of "smaller", but sign of "larger"
int scale = (int)(flags - d1flags) >> ScaleShift;
if (scale < 0)
{
// Guessed scale factor wrong. Swap operands.
//
scale = -scale;
flags = d1flags;
if (sign)
flags ^= SignMask;
low64 = d2.Low64;
high = d2.High;
d2 = d1;
}
uint power;
ulong tmp64, tmpLow;
// d1 will need to be multiplied by 10^scale so
// it will have the same scale as d2. We could be
// extending it to up to 192 bits of precision.
// Scan for zeros in the upper words.
//
if (high == 0)
{
if (low64 <= uint.MaxValue)
{
if ((uint)low64 == 0)
{
// Left arg is zero, return right.
//
uint signFlags = flags & SignMask;
if (sign)
signFlags ^= SignMask;
d1 = d2;
d1.uflags = d2.uflags & ScaleMask | signFlags;
return;
}
do
{
if (scale <= MaxInt32Scale)
{
low64 = UInt32x32To64((uint)low64, s_powers10[scale]);
goto AlignedAdd;
}
scale -= MaxInt32Scale;
low64 = UInt32x32To64((uint)low64, TenToPowerNine);
} while (low64 <= uint.MaxValue);
}
do
{
power = TenToPowerNine;
if (scale < MaxInt32Scale)
power = s_powers10[scale];
tmpLow = UInt32x32To64((uint)low64, power);
tmp64 = UInt32x32To64((uint)(low64 >> 32), power) + (tmpLow >> 32);
low64 = (uint)tmpLow + (tmp64 << 32);
high = (uint)(tmp64 >> 32);
if ((scale -= MaxInt32Scale) <= 0)
goto AlignedAdd;
} while (high == 0);
}
while (true)
{
// Scaling won't make it larger than 4 uints
//
power = TenToPowerNine;
if (scale < MaxInt32Scale)
power = s_powers10[scale];
tmpLow = UInt32x32To64((uint)low64, power);
tmp64 = UInt32x32To64((uint)(low64 >> 32), power) + (tmpLow >> 32);
low64 = (uint)tmpLow + (tmp64 << 32);
tmp64 >>= 32;
tmp64 += UInt32x32To64(high, power);
scale -= MaxInt32Scale;
if (tmp64 > uint.MaxValue)
break;
high = (uint)tmp64;
// Result fits in 96 bits. Use standard aligned add.
if (scale <= 0)
goto AlignedAdd;
}
// Have to scale by a bunch. Move the number to a buffer where it has room to grow as it's scaled.
//
Unsafe.SkipInit(out Buf24 bufNum);
bufNum.Low64 = low64;
bufNum.Mid64 = tmp64;
uint hiProd = 3;
// Scaling loop, up to 10^9 at a time. hiProd stays updated with index of highest non-zero uint.
//
for (; scale > 0; scale -= MaxInt32Scale)
{
power = TenToPowerNine;
if (scale < MaxInt32Scale)
power = s_powers10[scale];
tmp64 = 0;
uint* rgulNum = (uint*)&bufNum;
for (uint cur = 0; ;)
{
Debug.Assert(cur < Buf24.Length);
tmp64 += UInt32x32To64(rgulNum[cur], power);
rgulNum[cur] = (uint)tmp64;
cur++;
tmp64 >>= 32;
if (cur > hiProd)
break;
}
if ((uint)tmp64 != 0)
{
// We're extending the result by another uint.
Debug.Assert(hiProd + 1 < Buf24.Length);
rgulNum[++hiProd] = (uint)tmp64;
}
}
// Scaling complete, do the add. Could be subtract if signs differ.
//
tmp64 = bufNum.Low64;
low64 = d2.Low64;
uint tmpHigh = bufNum.U2;
high = d2.High;
if (sign)
{
// Signs differ, subtract.
//
low64 = tmp64 - low64;
high = tmpHigh - high;
// Propagate carry
//
if (low64 > tmp64)
{
high--;
if (high < tmpHigh)
goto NoCarry;
}
else if (high <= tmpHigh)
goto NoCarry;
// Carry the subtraction into the higher bits.
//
uint* number = (uint*)&bufNum;
uint cur = 3;
do
{
Debug.Assert(cur < Buf24.Length);
} while (number[cur++]-- == 0);
Debug.Assert(hiProd < Buf24.Length);
if (number[hiProd] == 0 && --hiProd <= 2)
goto ReturnResult;
}
else
{
// Signs the same, add.
//
low64 += tmp64;
high += tmpHigh;
// Propagate carry
//
if (low64 < tmp64)
{
high++;
if (high > tmpHigh)
goto NoCarry;
}
else if (high >= tmpHigh)
goto NoCarry;
uint* number = (uint*)&bufNum;
for (uint cur = 3; ++number[cur++] == 0;)
{
Debug.Assert(cur < Buf24.Length);
if (hiProd < cur)
{
number[cur] = 1;
hiProd = cur;
break;
}
}
}
NoCarry:
bufNum.Low64 = low64;
bufNum.U2 = high;
scale = ScaleResult(&bufNum, hiProd, (byte)(flags >> ScaleShift));
flags = (flags & ~ScaleMask) | ((uint)scale << ScaleShift);
low64 = bufNum.Low64;
high = bufNum.U2;
goto ReturnResult;
}
SignFlip:
{
// Got negative result. Flip its sign.
flags ^= SignMask;
high = ~high;
low64 = (ulong)-(long)low64;
if (low64 == 0)
high++;
goto ReturnResult;
}
AlignedScale:
{
// The addition carried above 96 bits.
// Divide the value by 10, dropping the scale factor.
//
if ((flags & ScaleMask) == 0)
Number.ThrowOverflowException(TypeCode.Decimal);
flags -= 1 << ScaleShift;
const uint den = 10;
ulong num = high + (1UL << 32);
high = (uint)(num / den);
num = ((num - high * den) << 32) + (low64 >> 32);
uint div = (uint)(num / den);
num = ((num - div * den) << 32) + (uint)low64;
low64 = div;
low64 <<= 32;
div = (uint)(num / den);
low64 += div;
div = (uint)num - div * den;
// See if we need to round up.
//
if (div >= 5 && (div > 5 || (low64 & 1) != 0))
{
if (++low64 == 0)
high++;
}
goto ReturnResult;
}
AlignedAdd:
{
ulong d1Low64 = low64;
uint d1High = high;
if (sign)
{
// Signs differ - subtract
//
low64 = d1Low64 - d2.Low64;
high = d1High - d2.High;
// Propagate carry
//
if (low64 > d1Low64)
{
high--;
if (high >= d1High)
goto SignFlip;
}
else if (high > d1High)
goto SignFlip;
}
else
{
// Signs are the same - add
//
low64 = d1Low64 + d2.Low64;
high = d1High + d2.High;
// Propagate carry
//
if (low64 < d1Low64)
{
high++;
if (high <= d1High)
goto AlignedScale;
}
else if (high < d1High)
goto AlignedScale;
}
goto ReturnResult;
}
ReturnResult:
d1.uflags = flags;
d1.High = high;
d1.Low64 = low64;
return;
}
#endregion
/// <summary>
/// Convert Decimal to Currency (similar to OleAut32 api.)
/// </summary>
internal static long VarCyFromDec(ref DecCalc pdecIn)
{
long value;
int scale = pdecIn.Scale - 4;
// Need to scale to get 4 decimal places. -4 <= scale <= 24.
//
if (scale < 0)
{
if (pdecIn.High != 0)
goto ThrowOverflow;
uint pwr = s_powers10[-scale];
ulong high = UInt32x32To64(pwr, pdecIn.Mid);
if (high > uint.MaxValue)
goto ThrowOverflow;
ulong low = UInt32x32To64(pwr, pdecIn.Low);
low += high <<= 32;
if (low < high)
goto ThrowOverflow;
value = (long)low;
}
else
{
if (scale != 0)
InternalRound(ref pdecIn, (uint)scale, MidpointRounding.ToEven);
if (pdecIn.High != 0)
goto ThrowOverflow;
value = (long)pdecIn.Low64;
}
if (value < 0 && (value != long.MinValue || !pdecIn.IsNegative))
goto ThrowOverflow;
if (pdecIn.IsNegative)
value = -value;
return value;
ThrowOverflow:
throw new OverflowException(SR.Overflow_Currency);
}
/// <summary>
/// Decimal Compare updated to return values similar to ICompareTo
/// </summary>
internal static int VarDecCmp(in decimal d1, in decimal d2)
{
if ((d2.Low64 | d2.High) == 0)
{
if ((d1.Low64 | d1.High) == 0)
return 0;
return (d1._flags >> 31) | 1;
}
if ((d1.Low64 | d1.High) == 0)
return -((d2._flags >> 31) | 1);
int sign = (d1._flags >> 31) - (d2._flags >> 31);
if (sign != 0)
return sign;
return VarDecCmpSub(in d1, in d2);
}
private static int VarDecCmpSub(in decimal d1, in decimal d2)
{
int flags = d2._flags;
int sign = (flags >> 31) | 1;
int scale = flags - d1._flags;
ulong low64 = d1.Low64;
uint high = d1.High;
ulong d2Low64 = d2.Low64;
uint d2High = d2.High;
if (scale != 0)
{
scale >>= ScaleShift;
// Scale factors are not equal. Assume that a larger scale factor (more decimal places) is likely to mean that number is smaller.
// Start by guessing that the right operand has the larger scale factor.
if (scale < 0)
{
// Guessed scale factor wrong. Swap operands.
scale = -scale;
sign = -sign;
ulong tmp64 = low64;
low64 = d2Low64;
d2Low64 = tmp64;
uint tmp = high;
high = d2High;
d2High = tmp;
}
// d1 will need to be multiplied by 10^scale so it will have the same scale as d2.
// Scaling loop, up to 10^9 at a time.
do
{
uint power = scale >= MaxInt32Scale ? TenToPowerNine : s_powers10[scale];
ulong tmpLow = UInt32x32To64((uint)low64, power);
ulong tmp = UInt32x32To64((uint)(low64 >> 32), power) + (tmpLow >> 32);
low64 = (uint)tmpLow + (tmp << 32);
tmp >>= 32;
tmp += UInt32x32To64(high, power);
// If the scaled value has more than 96 significant bits then it's greater than d2
if (tmp > uint.MaxValue)
return sign;
high = (uint)tmp;
} while ((scale -= MaxInt32Scale) > 0);
}
uint cmpHigh = high - d2High;
if (cmpHigh != 0)
{
// check for overflow
if (cmpHigh > high)
sign = -sign;
return sign;
}
ulong cmpLow64 = low64 - d2Low64;
if (cmpLow64 == 0)
sign = 0;
// check for overflow
else if (cmpLow64 > low64)
sign = -sign;
return sign;
}
/// <summary>
/// Decimal Multiply
/// </summary>
internal static unsafe void VarDecMul(ref DecCalc d1, ref DecCalc d2)
{
int scale = (byte)(d1.uflags + d2.uflags >> ScaleShift);
ulong tmp;
uint hiProd;
Unsafe.SkipInit(out Buf24 bufProd);
if ((d1.High | d1.Mid) == 0)
{
if ((d2.High | d2.Mid) == 0)
{
// Upper 64 bits are zero.
//
ulong low64 = UInt32x32To64(d1.Low, d2.Low);
if (scale > DEC_SCALE_MAX)
{
// Result scale is too big. Divide result by power of 10 to reduce it.
// If the amount to divide by is > 19 the result is guaranteed
// less than 1/2. [max value in 64 bits = 1.84E19]
//
if (scale > DEC_SCALE_MAX + MaxInt64Scale)
goto ReturnZero;
scale -= DEC_SCALE_MAX + 1;
ulong power = s_ulongPowers10[scale];
// TODO: https://github.com/dotnet/runtime/issues/5213
tmp = low64 / power;
ulong remainder = low64 - tmp * power;
low64 = tmp;
// Round result. See if remainder >= 1/2 of divisor.
// Divisor is a power of 10, so it is always even.
//
power >>= 1;
if (remainder >= power && (remainder > power || ((uint)low64 & 1) > 0))
low64++;
scale = DEC_SCALE_MAX;
}
d1.Low64 = low64;
d1.uflags = ((d2.uflags ^ d1.uflags) & SignMask) | ((uint)scale << ScaleShift);
return;
}
else
{
// Left value is 32-bit, result fits in 4 uints
tmp = UInt32x32To64(d1.Low, d2.Low);
bufProd.U0 = (uint)tmp;
tmp = UInt32x32To64(d1.Low, d2.Mid) + (tmp >> 32);
bufProd.U1 = (uint)tmp;
tmp >>= 32;
if (d2.High != 0)
{
tmp += UInt32x32To64(d1.Low, d2.High);
if (tmp > uint.MaxValue)
{
bufProd.Mid64 = tmp;
hiProd = 3;
goto SkipScan;
}
}
bufProd.U2 = (uint)tmp;
hiProd = 2;
}
}
else if ((d2.High | d2.Mid) == 0)
{
// Right value is 32-bit, result fits in 4 uints
tmp = UInt32x32To64(d2.Low, d1.Low);
bufProd.U0 = (uint)tmp;
tmp = UInt32x32To64(d2.Low, d1.Mid) + (tmp >> 32);
bufProd.U1 = (uint)tmp;
tmp >>= 32;
if (d1.High != 0)
{
tmp += UInt32x32To64(d2.Low, d1.High);
if (tmp > uint.MaxValue)
{
bufProd.Mid64 = tmp;
hiProd = 3;
goto SkipScan;
}
}
bufProd.U2 = (uint)tmp;
hiProd = 2;
}
else
{
// Both operands have bits set in the upper 64 bits.
//
// Compute and accumulate the 9 partial products into a
// 192-bit (24-byte) result.
//
// [l-h][l-m][l-l] left high, middle, low
// x [r-h][r-m][r-l] right high, middle, low
// ------------------------------
//
// [0-h][0-l] l-l * r-l
// [1ah][1al] l-l * r-m
// [1bh][1bl] l-m * r-l
// [2ah][2al] l-m * r-m
// [2bh][2bl] l-l * r-h
// [2ch][2cl] l-h * r-l
// [3ah][3al] l-m * r-h
// [3bh][3bl] l-h * r-m
// [4-h][4-l] l-h * r-h
// ------------------------------
// [p-5][p-4][p-3][p-2][p-1][p-0] prod[] array
//
tmp = UInt32x32To64(d1.Low, d2.Low);
bufProd.U0 = (uint)tmp;
ulong tmp2 = UInt32x32To64(d1.Low, d2.Mid) + (tmp >> 32);
tmp = UInt32x32To64(d1.Mid, d2.Low);
tmp += tmp2; // this could generate carry
bufProd.U1 = (uint)tmp;
if (tmp < tmp2) // detect carry
tmp2 = (tmp >> 32) | (1UL << 32);
else
tmp2 = tmp >> 32;
tmp = UInt32x32To64(d1.Mid, d2.Mid) + tmp2;
if ((d1.High | d2.High) > 0)
{
// Highest 32 bits is non-zero. Calculate 5 more partial products.
//
tmp2 = UInt32x32To64(d1.Low, d2.High);
tmp += tmp2; // this could generate carry
uint tmp3 = 0;
if (tmp < tmp2) // detect carry
tmp3 = 1;
tmp2 = UInt32x32To64(d1.High, d2.Low);
tmp += tmp2; // this could generate carry
bufProd.U2 = (uint)tmp;
if (tmp < tmp2) // detect carry
tmp3++;
tmp2 = ((ulong)tmp3 << 32) | (tmp >> 32);
tmp = UInt32x32To64(d1.Mid, d2.High);
tmp += tmp2; // this could generate carry
tmp3 = 0;
if (tmp < tmp2) // detect carry
tmp3 = 1;
tmp2 = UInt32x32To64(d1.High, d2.Mid);
tmp += tmp2; // this could generate carry
bufProd.U3 = (uint)tmp;
if (tmp < tmp2) // detect carry
tmp3++;
tmp = ((ulong)tmp3 << 32) | (tmp >> 32);
bufProd.High64 = UInt32x32To64(d1.High, d2.High) + tmp;
hiProd = 5;
}
else
{
bufProd.Mid64 = tmp;
hiProd = 3;
}
}
// Check for leading zero uints on the product
//
uint* product = (uint*)&bufProd;
while (product[(int)hiProd] == 0)
{
if (hiProd == 0)
goto ReturnZero;
hiProd--;
}
SkipScan:
if (hiProd > 2 || scale > DEC_SCALE_MAX)
{
scale = ScaleResult(&bufProd, hiProd, scale);
}
d1.Low64 = bufProd.Low64;
d1.High = bufProd.U2;
d1.uflags = ((d2.uflags ^ d1.uflags) & SignMask) | ((uint)scale << ScaleShift);
return;
ReturnZero:
d1 = default;
}
/// <summary>
/// Convert float to Decimal
/// </summary>
internal static void VarDecFromR4(float input, out DecCalc result)
{
result = default;
// The most we can scale by is 10^28, which is just slightly more
// than 2^93. So a float with an exponent of -94 could just
// barely reach 0.5, but smaller exponents will always round to zero.
//
const uint SNGBIAS = 126;
int exp = (int)(GetExponent(input) - SNGBIAS);
if (exp < -94)
return; // result should be zeroed out
if (exp > 96)
Number.ThrowOverflowException(TypeCode.Decimal);
uint flags = 0;
if (input < 0)
{
input = -input;
flags = SignMask;
}
// Round the input to a 7-digit integer. The R4 format has
// only 7 digits of precision, and we want to keep garbage digits
// out of the Decimal were making.
//
// Calculate max power of 10 input value could have by multiplying
// the exponent by log10(2). Using scaled integer multiplcation,
// log10(2) * 2 ^ 16 = .30103 * 65536 = 19728.3.
//
double dbl = input;
int power = 6 - ((exp * 19728) >> 16);
// power is between -22 and 35
if (power >= 0)
{
// We have less than 7 digits, scale input up.
//
if (power > DEC_SCALE_MAX)
power = DEC_SCALE_MAX;
dbl *= s_doublePowers10[power];
}
else
{
if (power != -1 || dbl >= 1E7)
dbl /= s_doublePowers10[-power];
else
power = 0; // didn't scale it
}
Debug.Assert(dbl < 1E7);
if (dbl < 1E6 && power < DEC_SCALE_MAX)
{
dbl *= 10;
power++;
Debug.Assert(dbl >= 1E6);
}
// Round to integer
//
uint mant;
// with SSE4.1 support ROUNDSD can be used
if (X86.Sse41.IsSupported)
mant = (uint)(int)Math.Round(dbl);
else
{
mant = (uint)(int)dbl;
dbl -= (int)mant; // difference between input & integer
if (dbl > 0.5 || dbl == 0.5 && (mant & 1) != 0)
mant++;
}
if (mant == 0)
return; // result should be zeroed out
if (power < 0)
{
// Add -power factors of 10, -power <= (29 - 7) = 22.
//
power = -power;
if (power < 10)
{
result.Low64 = UInt32x32To64(mant, s_powers10[power]);
}
else
{
// Have a big power of 10.
//
if (power > 18)
{
ulong low64 = UInt32x32To64(mant, s_powers10[power - 18]);
UInt64x64To128(low64, TenToPowerEighteen, ref result);
}
else
{
ulong low64 = UInt32x32To64(mant, s_powers10[power - 9]);
ulong hi64 = UInt32x32To64(TenToPowerNine, (uint)(low64 >> 32));
low64 = UInt32x32To64(TenToPowerNine, (uint)low64);
result.Low = (uint)low64;
hi64 += low64 >> 32;
result.Mid = (uint)hi64;
hi64 >>= 32;
result.High = (uint)hi64;
}
}
}
else
{
// Factor out powers of 10 to reduce the scale, if possible.
// The maximum number we could factor out would be 6. This
// comes from the fact we have a 7-digit number, and the
// MSD must be non-zero -- but the lower 6 digits could be
// zero. Note also the scale factor is never negative, so
// we can't scale by any more than the power we used to
// get the integer.
//
int lmax = power;
if (lmax > 6)
lmax = 6;
if ((mant & 0xF) == 0 && lmax >= 4)
{
const uint den = 10000;
uint div = mant / den;
if (mant == div * den)
{
mant = div;
power -= 4;
lmax -= 4;
}
}
if ((mant & 3) == 0 && lmax >= 2)
{
const uint den = 100;
uint div = mant / den;
if (mant == div * den)
{
mant = div;
power -= 2;
lmax -= 2;
}
}
if ((mant & 1) == 0 && lmax >= 1)
{
const uint den = 10;
uint div = mant / den;
if (mant == div * den)
{
mant = div;
power--;
}
}
flags |= (uint)power << ScaleShift;
result.Low = mant;
}
result.uflags = flags;
}
/// <summary>
/// Convert double to Decimal
/// </summary>
internal static void VarDecFromR8(double input, out DecCalc result)
{
result = default;
// The most we can scale by is 10^28, which is just slightly more
// than 2^93. So a float with an exponent of -94 could just
// barely reach 0.5, but smaller exponents will always round to zero.
//
const uint DBLBIAS = 1022;
int exp = (int)(GetExponent(input) - DBLBIAS);
if (exp < -94)
return; // result should be zeroed out
if (exp > 96)
Number.ThrowOverflowException(TypeCode.Decimal);
uint flags = 0;
if (input < 0)
{
input = -input;
flags = SignMask;
}
// Round the input to a 15-digit integer. The R8 format has
// only 15 digits of precision, and we want to keep garbage digits
// out of the Decimal were making.
//
// Calculate max power of 10 input value could have by multiplying
// the exponent by log10(2). Using scaled integer multiplcation,
// log10(2) * 2 ^ 16 = .30103 * 65536 = 19728.3.
//
double dbl = input;
int power = 14 - ((exp * 19728) >> 16);
// power is between -14 and 43
if (power >= 0)
{
// We have less than 15 digits, scale input up.
//
if (power > DEC_SCALE_MAX)
power = DEC_SCALE_MAX;
dbl *= s_doublePowers10[power];
}
else
{
if (power != -1 || dbl >= 1E15)
dbl /= s_doublePowers10[-power];
else
power = 0; // didn't scale it
}
Debug.Assert(dbl < 1E15);
if (dbl < 1E14 && power < DEC_SCALE_MAX)
{
dbl *= 10;
power++;
Debug.Assert(dbl >= 1E14);
}
// Round to int64
//
ulong mant;
// with SSE4.1 support ROUNDSD can be used
if (X86.Sse41.IsSupported)
mant = (ulong)(long)Math.Round(dbl);
else
{
mant = (ulong)(long)dbl;
dbl -= (long)mant; // difference between input & integer
if (dbl > 0.5 || dbl == 0.5 && (mant & 1) != 0)
mant++;
}
if (mant == 0)
return; // result should be zeroed out
if (power < 0)
{
// Add -power factors of 10, -power <= (29 - 15) = 14.
//
power = -power;
if (power < 10)
{
uint pow10 = s_powers10[power];
ulong low64 = UInt32x32To64((uint)mant, pow10);
ulong hi64 = UInt32x32To64((uint)(mant >> 32), pow10);
result.Low = (uint)low64;
hi64 += low64 >> 32;
result.Mid = (uint)hi64;
hi64 >>= 32;
result.High = (uint)hi64;
}
else
{
// Have a big power of 10.
//
Debug.Assert(power <= 14);
UInt64x64To128(mant, s_ulongPowers10[power - 1], ref result);
}
}
else
{
// Factor out powers of 10 to reduce the scale, if possible.
// The maximum number we could factor out would be 14. This
// comes from the fact we have a 15-digit number, and the
// MSD must be non-zero -- but the lower 14 digits could be
// zero. Note also the scale factor is never negative, so
// we can't scale by any more than the power we used to
// get the integer.
//
int lmax = power;
if (lmax > 14)
lmax = 14;
if ((byte)mant == 0 && lmax >= 8)
{
const uint den = 100000000;
ulong div = mant / den;
if ((uint)mant == (uint)(div * den))
{
mant = div;
power -= 8;
lmax -= 8;
}
}
if (((uint)mant & 0xF) == 0 && lmax >= 4)
{
const uint den = 10000;
ulong div = mant / den;
if ((uint)mant == (uint)(div * den))
{
mant = div;
power -= 4;
lmax -= 4;
}
}
if (((uint)mant & 3) == 0 && lmax >= 2)
{
const uint den = 100;
ulong div = mant / den;
if ((uint)mant == (uint)(div * den))
{
mant = div;
power -= 2;
lmax -= 2;
}
}
if (((uint)mant & 1) == 0 && lmax >= 1)
{
const uint den = 10;
ulong div = mant / den;
if ((uint)mant == (uint)(div * den))
{
mant = div;
power--;
}
}
flags |= (uint)power << ScaleShift;
result.Low64 = mant;
}
result.uflags = flags;
}
/// <summary>
/// Convert Decimal to float
/// </summary>
internal static float VarR4FromDec(in decimal value)
{
return (float)VarR8FromDec(in value);
}
/// <summary>
/// Convert Decimal to double
/// </summary>
internal static double VarR8FromDec(in decimal value)
{
// Value taken via reverse engineering the double that corresponds to 2^64. (oleaut32 has ds2to64 = DEFDS(0, 0, DBLBIAS + 65, 0))
const double ds2to64 = 1.8446744073709552e+019;
double dbl = ((double)value.Low64 +
(double)value.High * ds2to64) / s_doublePowers10[value.Scale];
if (value.IsNegative)
dbl = -dbl;
return dbl;
}
internal static int GetHashCode(in decimal d)
{
if ((d.Low64 | d.High) == 0)
return 0;
uint flags = (uint)d._flags;
if ((flags & ScaleMask) == 0 || (d.Low & 1) != 0)
return (int)(flags ^ d.High ^ d.Mid ^ d.Low);
int scale = (byte)(flags >> ScaleShift);
uint low = d.Low;
ulong high64 = ((ulong)d.High << 32) | d.Mid;
Unscale(ref low, ref high64, ref scale);
flags = (flags & ~ScaleMask) | (uint)scale << ScaleShift;
return (int)(flags ^ (uint)(high64 >> 32) ^ (uint)high64 ^ low);
}
/// <summary>
/// Divides two decimal values.
/// On return, d1 contains the result of the operation.
/// </summary>
internal static unsafe void VarDecDiv(ref DecCalc d1, ref DecCalc d2)
{
Unsafe.SkipInit(out Buf12 bufQuo);
uint power;
int curScale;
int scale = (sbyte)(d1.uflags - d2.uflags >> ScaleShift);
bool unscale = false;
uint tmp;
if ((d2.High | d2.Mid) == 0)
{
// Divisor is only 32 bits. Easy divide.
//
uint den = d2.Low;
if (den == 0)
throw new DivideByZeroException();
bufQuo.Low64 = d1.Low64;
bufQuo.U2 = d1.High;
uint remainder = Div96By32(ref bufQuo, den);
while (true)
{
if (remainder == 0)
{
if (scale < 0)
{
curScale = Math.Min(9, -scale);
goto HaveScale;
}
break;
}
// We need to unscale if and only if we have a non-zero remainder
unscale = true;
// We have computed a quotient based on the natural scale
// ( <dividend scale> - <divisor scale> ). We have a non-zero
// remainder, so now we should increase the scale if possible to
// include more quotient bits.
//
// If it doesn't cause overflow, we'll loop scaling by 10^9 and
// computing more quotient bits as long as the remainder stays
// non-zero. If scaling by that much would cause overflow, we'll
// drop out of the loop and scale by as much as we can.
//
// Scaling by 10^9 will overflow if bufQuo[2].bufQuo[1] >= 2^32 / 10^9
// = 4.294 967 296. So the upper limit is bufQuo[2] == 4 and
// bufQuo[1] == 0.294 967 296 * 2^32 = 1,266,874,889.7+. Since
// quotient bits in bufQuo[0] could be all 1's, then 1,266,874,888
// is the largest value in bufQuo[1] (when bufQuo[2] == 4) that is
// assured not to overflow.
//
if (scale == DEC_SCALE_MAX || (curScale = SearchScale(ref bufQuo, scale)) == 0)
{
// No more scaling to be done, but remainder is non-zero.
// Round quotient.
//
tmp = remainder << 1;
if (tmp < remainder || tmp >= den && (tmp > den || (bufQuo.U0 & 1) != 0))
goto RoundUp;
break;
}
HaveScale:
power = s_powers10[curScale];
scale += curScale;
if (IncreaseScale(ref bufQuo, power) != 0)
goto ThrowOverflow;
ulong num = UInt32x32To64(remainder, power);
// TODO: https://github.com/dotnet/runtime/issues/5213
uint div = (uint)(num / den);
remainder = (uint)num - div * den;
if (!Add32To96(ref bufQuo, div))
{
scale = OverflowUnscale(ref bufQuo, scale, remainder != 0);
break;
}
} // while (true)
}
else
{
// Divisor has bits set in the upper 64 bits.
//
// Divisor must be fully normalized (shifted so bit 31 of the most
// significant uint is 1). Locate the MSB so we know how much to
// normalize by. The dividend will be shifted by the same amount so
// the quotient is not changed.
//
tmp = d2.High;
if (tmp == 0)
tmp = d2.Mid;
curScale = BitOperations.LeadingZeroCount(tmp);
// Shift both dividend and divisor left by curScale.
//
Unsafe.SkipInit(out Buf16 bufRem);
bufRem.Low64 = d1.Low64 << curScale;
bufRem.High64 = (d1.Mid + ((ulong)d1.High << 32)) >> (32 - curScale);
ulong divisor = d2.Low64 << curScale;
if (d2.High == 0)
{
// Have a 64-bit divisor in sdlDivisor. The remainder
// (currently 96 bits spread over 4 uints) will be < divisor.
//
bufQuo.U2 = 0;
bufQuo.U1 = Div96By64(ref *(Buf12*)&bufRem.U1, divisor);
bufQuo.U0 = Div96By64(ref *(Buf12*)&bufRem, divisor);
while (true)
{
if (bufRem.Low64 == 0)
{
if (scale < 0)
{
curScale = Math.Min(9, -scale);
goto HaveScale64;
}
break;
}
// We need to unscale if and only if we have a non-zero remainder
unscale = true;
// Remainder is non-zero. Scale up quotient and remainder by
// powers of 10 so we can compute more significant bits.
//
if (scale == DEC_SCALE_MAX || (curScale = SearchScale(ref bufQuo, scale)) == 0)
{
// No more scaling to be done, but remainder is non-zero.
// Round quotient.
//
ulong tmp64 = bufRem.Low64;
if ((long)tmp64 < 0 || (tmp64 <<= 1) > divisor ||
(tmp64 == divisor && (bufQuo.U0 & 1) != 0))
goto RoundUp;
break;
}
HaveScale64:
power = s_powers10[curScale];
scale += curScale;
if (IncreaseScale(ref bufQuo, power) != 0)
goto ThrowOverflow;
IncreaseScale64(ref *(Buf12*)&bufRem, power);
tmp = Div96By64(ref *(Buf12*)&bufRem, divisor);
if (!Add32To96(ref bufQuo, tmp))
{
scale = OverflowUnscale(ref bufQuo, scale, bufRem.Low64 != 0);
break;
}
} // while (true)
}
else
{
// Have a 96-bit divisor in bufDivisor.
//
// Start by finishing the shift left by curScale.
//
Unsafe.SkipInit(out Buf12 bufDivisor);
bufDivisor.Low64 = divisor;
bufDivisor.U2 = (uint)((d2.Mid + ((ulong)d2.High << 32)) >> (32 - curScale));
// The remainder (currently 96 bits spread over 4 uints) will be < divisor.
//
bufQuo.Low64 = Div128By96(ref bufRem, ref bufDivisor);
bufQuo.U2 = 0;
while (true)
{
if ((bufRem.Low64 | bufRem.U2) == 0)
{
if (scale < 0)
{
curScale = Math.Min(9, -scale);
goto HaveScale96;
}
break;
}
// We need to unscale if and only if we have a non-zero remainder
unscale = true;
// Remainder is non-zero. Scale up quotient and remainder by
// powers of 10 so we can compute more significant bits.
//
if (scale == DEC_SCALE_MAX || (curScale = SearchScale(ref bufQuo, scale)) == 0)
{
// No more scaling to be done, but remainder is non-zero.
// Round quotient.
//
if ((int)bufRem.U2 < 0)
{
goto RoundUp;
}
tmp = bufRem.U1 >> 31;
bufRem.Low64 <<= 1;
bufRem.U2 = (bufRem.U2 << 1) + tmp;
if (bufRem.U2 > bufDivisor.U2 || bufRem.U2 == bufDivisor.U2 &&
(bufRem.Low64 > bufDivisor.Low64 || bufRem.Low64 == bufDivisor.Low64 &&
(bufQuo.U0 & 1) != 0))
goto RoundUp;
break;
}
HaveScale96:
power = s_powers10[curScale];
scale += curScale;
if (IncreaseScale(ref bufQuo, power) != 0)
goto ThrowOverflow;
bufRem.U3 = IncreaseScale(ref *(Buf12*)&bufRem, power);
tmp = Div128By96(ref bufRem, ref bufDivisor);
if (!Add32To96(ref bufQuo, tmp))
{
scale = OverflowUnscale(ref bufQuo, scale, (bufRem.Low64 | bufRem.High64) != 0);
break;
}
} // while (true)
}
}
Unscale:
if (unscale)
{
uint low = bufQuo.U0;
ulong high64 = bufQuo.High64;
Unscale(ref low, ref high64, ref scale);
d1.Low = low;
d1.Mid = (uint)high64;
d1.High = (uint)(high64 >> 32);
}
else
{
d1.Low64 = bufQuo.Low64;
d1.High = bufQuo.U2;
}
d1.uflags = ((d1.uflags ^ d2.uflags) & SignMask) | ((uint)scale << ScaleShift);
return;
RoundUp:
{
if (++bufQuo.Low64 == 0 && ++bufQuo.U2 == 0)
{
scale = OverflowUnscale(ref bufQuo, scale, true);
}
goto Unscale;
}
ThrowOverflow:
Number.ThrowOverflowException(TypeCode.Decimal);
}
/// <summary>
/// Computes the remainder between two decimals.
/// On return, d1 contains the result of the operation and d2 is trashed.
/// </summary>
internal static void VarDecMod(ref DecCalc d1, ref DecCalc d2)
{
if ((d2.ulo | d2.umid | d2.uhi) == 0)
throw new DivideByZeroException();
if ((d1.ulo | d1.umid | d1.uhi) == 0)
return;
// In the operation x % y the sign of y does not matter. Result will have the sign of x.
d2.uflags = (d2.uflags & ~SignMask) | (d1.uflags & SignMask);
int cmp = VarDecCmpSub(in Unsafe.As<DecCalc, decimal>(ref d1), in Unsafe.As<DecCalc, decimal>(ref d2));
if (cmp == 0)
{
d1.ulo = 0;
d1.umid = 0;
d1.uhi = 0;
if (d2.uflags > d1.uflags)
d1.uflags = d2.uflags;
return;
}
if ((cmp ^ (int)(d1.uflags & SignMask)) < 0)
return;
// The divisor is smaller than the dividend and both are non-zero. Calculate the integer remainder using the larger scaling factor.
int scale = (sbyte)(d1.uflags - d2.uflags >> ScaleShift);
if (scale > 0)
{
// Divisor scale can always be increased to dividend scale for remainder calculation.
do
{
uint power = scale >= MaxInt32Scale ? TenToPowerNine : s_powers10[scale];
ulong tmp = UInt32x32To64(d2.Low, power);
d2.Low = (uint)tmp;
tmp >>= 32;
tmp += (d2.Mid + ((ulong)d2.High << 32)) * power;
d2.Mid = (uint)tmp;
d2.High = (uint)(tmp >> 32);
} while ((scale -= MaxInt32Scale) > 0);
scale = 0;
}
do
{
if (scale < 0)
{
d1.uflags = d2.uflags;
// Try to scale up dividend to match divisor.
Unsafe.SkipInit(out Buf12 bufQuo);
bufQuo.Low64 = d1.Low64;
bufQuo.U2 = d1.High;
do
{
int iCurScale = SearchScale(ref bufQuo, DEC_SCALE_MAX + scale);
if (iCurScale == 0)
break;
uint power = iCurScale >= MaxInt32Scale ? TenToPowerNine : s_powers10[iCurScale];
scale += iCurScale;
ulong tmp = UInt32x32To64(bufQuo.U0, power);
bufQuo.U0 = (uint)tmp;
tmp >>= 32;
bufQuo.High64 = tmp + bufQuo.High64 * power;
if (power != TenToPowerNine)
break;
}
while (scale < 0);
d1.Low64 = bufQuo.Low64;
d1.High = bufQuo.U2;
}
if (d1.High == 0)
{
Debug.Assert(d2.High == 0);
Debug.Assert(scale == 0);
d1.Low64 %= d2.Low64;
return;
}
else if ((d2.High | d2.Mid) == 0)
{
uint den = d2.Low;
ulong tmp = ((ulong)d1.High << 32) | d1.Mid;
tmp = ((tmp % den) << 32) | d1.Low;
d1.Low64 = tmp % den;
d1.High = 0;
}
else
{
VarDecModFull(ref d1, ref d2, scale);
return;
}
} while (scale < 0);
}
private static unsafe void VarDecModFull(ref DecCalc d1, ref DecCalc d2, int scale)
{
// Divisor has bits set in the upper 64 bits.
//
// Divisor must be fully normalized (shifted so bit 31 of the most significant uint is 1).
// Locate the MSB so we know how much to normalize by.
// The dividend will be shifted by the same amount so the quotient is not changed.
//
uint tmp = d2.High;
if (tmp == 0)
tmp = d2.Mid;
int shift = BitOperations.LeadingZeroCount(tmp);
Unsafe.SkipInit(out Buf28 b);
b.Buf24.Low64 = d1.Low64 << shift;
b.Buf24.Mid64 = (d1.Mid + ((ulong)d1.High << 32)) >> (32 - shift);
// The dividend might need to be scaled up to 221 significant bits.
// Maximum scaling is required when the divisor is 2^64 with scale 28 and is left shifted 31 bits
// and the dividend is decimal.MaxValue: (2^96 - 1) * 10^28 << 31 = 221 bits.
uint high = 3;
while (scale < 0)
{
uint power = scale <= -MaxInt32Scale ? TenToPowerNine : s_powers10[-scale];
uint* buf = (uint*)&b;
ulong tmp64 = UInt32x32To64(b.Buf24.U0, power);
b.Buf24.U0 = (uint)tmp64;
for (int i = 1; i <= high; i++)
{
tmp64 >>= 32;
tmp64 += UInt32x32To64(buf[i], power);
buf[i] = (uint)tmp64;
}
// The high bit of the dividend must not be set.
if (tmp64 > int.MaxValue)
{
Debug.Assert(high + 1 < Buf28.Length);
buf[++high] = (uint)(tmp64 >> 32);
}
scale += MaxInt32Scale;
}
if (d2.High == 0)
{
ulong divisor = d2.Low64 << shift;
switch (high)
{
case 6:
Div96By64(ref *(Buf12*)&b.Buf24.U4, divisor);
goto case 5;
case 5:
Div96By64(ref *(Buf12*)&b.Buf24.U3, divisor);
goto case 4;
case 4:
Div96By64(ref *(Buf12*)&b.Buf24.U2, divisor);
break;
}
Div96By64(ref *(Buf12*)&b.Buf24.U1, divisor);
Div96By64(ref *(Buf12*)&b, divisor);
d1.Low64 = b.Buf24.Low64 >> shift;
d1.High = 0;
}
else
{
Unsafe.SkipInit(out Buf12 bufDivisor);
bufDivisor.Low64 = d2.Low64 << shift;
bufDivisor.U2 = (uint)((d2.Mid + ((ulong)d2.High << 32)) >> (32 - shift));
switch (high)
{
case 6:
Div128By96(ref *(Buf16*)&b.Buf24.U3, ref bufDivisor);
goto case 5;
case 5:
Div128By96(ref *(Buf16*)&b.Buf24.U2, ref bufDivisor);
goto case 4;
case 4:
Div128By96(ref *(Buf16*)&b.Buf24.U1, ref bufDivisor);
break;
}
Div128By96(ref *(Buf16*)&b, ref bufDivisor);
d1.Low64 = (b.Buf24.Low64 >> shift) + ((ulong)b.Buf24.U2 << (32 - shift) << 32);
d1.High = b.Buf24.U2 >> shift;
}
}
// Does an in-place round by the specified scale
internal static void InternalRound(ref DecCalc d, uint scale, MidpointRounding mode)
{
// the scale becomes the desired decimal count
d.uflags -= scale << ScaleShift;
uint remainder, sticky = 0, power;
// First divide the value by constant 10^9 up to three times
while (scale >= MaxInt32Scale)
{
scale -= MaxInt32Scale;
const uint divisor = TenToPowerNine;
uint n = d.uhi;
if (n == 0)
{
ulong tmp = d.Low64;
ulong div = tmp / divisor;
d.Low64 = div;
remainder = (uint)(tmp - div * divisor);
}
else
{
uint q;
d.uhi = q = n / divisor;
remainder = n - q * divisor;
n = d.umid;
if ((n | remainder) != 0)
{
d.umid = q = (uint)((((ulong)remainder << 32) | n) / divisor);
remainder = n - q * divisor;
}
n = d.ulo;
if ((n | remainder) != 0)
{
d.ulo = q = (uint)((((ulong)remainder << 32) | n) / divisor);
remainder = n - q * divisor;
}
}
power = divisor;
if (scale == 0)
goto checkRemainder;
sticky |= remainder;
}
{
power = s_powers10[scale];
// TODO: https://github.com/dotnet/runtime/issues/5213
uint n = d.uhi;
if (n == 0)
{
ulong tmp = d.Low64;
if (tmp == 0)
{
if (mode <= MidpointRounding.ToZero)
goto done;
remainder = 0;
goto checkRemainder;
}
ulong div = tmp / power;
d.Low64 = div;
remainder = (uint)(tmp - div * power);
}
else
{
uint q;
d.uhi = q = n / power;
remainder = n - q * power;
n = d.umid;
if ((n | remainder) != 0)
{
d.umid = q = (uint)((((ulong)remainder << 32) | n) / power);
remainder = n - q * power;
}
n = d.ulo;
if ((n | remainder) != 0)
{
d.ulo = q = (uint)((((ulong)remainder << 32) | n) / power);
remainder = n - q * power;
}
}
}
checkRemainder:
if (mode == MidpointRounding.ToZero)
goto done;
else if (mode == MidpointRounding.ToEven)
{
// To do IEEE rounding, we add LSB of result to sticky bits so either causes round up if remainder * 2 == last divisor.
remainder <<= 1;
if ((sticky | d.ulo & 1) != 0)
remainder++;
if (power >= remainder)
goto done;
}
else if (mode == MidpointRounding.AwayFromZero)
{
// Round away from zero at the mid point.
remainder <<= 1;
if (power > remainder)
goto done;
}
else if (mode == MidpointRounding.ToNegativeInfinity)
{
// Round toward -infinity if we have chopped off a non-zero amount from a negative value.
if ((remainder | sticky) == 0 || !d.IsNegative)
goto done;
}
else
{
Debug.Assert(mode == MidpointRounding.ToPositiveInfinity);
// Round toward infinity if we have chopped off a non-zero amount from a positive value.
if ((remainder | sticky) == 0 || d.IsNegative)
goto done;
}
if (++d.Low64 == 0)
d.uhi++;
done:
return;
}
internal static uint DecDivMod1E9(ref DecCalc value)
{
ulong high64 = ((ulong)value.uhi << 32) + value.umid;
ulong div64 = high64 / TenToPowerNine;
value.uhi = (uint)(div64 >> 32);
value.umid = (uint)div64;
ulong num = ((high64 - (uint)div64 * TenToPowerNine) << 32) + value.ulo;
uint div = (uint)(num / TenToPowerNine);
value.ulo = div;
return (uint)num - div * TenToPowerNine;
}
private struct PowerOvfl
{
public readonly uint Hi;
public readonly ulong MidLo;
public PowerOvfl(uint hi, uint mid, uint lo)
{
Hi = hi;
MidLo = ((ulong)mid << 32) + lo;
}
}
private static readonly PowerOvfl[] PowerOvflValues = new[]
{
// This is a table of the largest values that can be in the upper two
// uints of a 96-bit number that will not overflow when multiplied
// by a given power. For the upper word, this is a table of
// 2^32 / 10^n for 1 <= n <= 8. For the lower word, this is the
// remaining fraction part * 2^32. 2^32 = 4294967296.
//
new PowerOvfl(429496729, 2576980377, 2576980377), // 10^1 remainder 0.6
new PowerOvfl(42949672, 4123168604, 687194767), // 10^2 remainder 0.16
new PowerOvfl(4294967, 1271310319, 2645699854), // 10^3 remainder 0.616
new PowerOvfl(429496, 3133608139, 694066715), // 10^4 remainder 0.1616
new PowerOvfl(42949, 2890341191, 2216890319), // 10^5 remainder 0.51616
new PowerOvfl(4294, 4154504685, 2369172679), // 10^6 remainder 0.551616
new PowerOvfl(429, 2133437386, 4102387834), // 10^7 remainder 0.9551616
new PowerOvfl(42, 4078814305, 410238783), // 10^8 remainder 0.09991616
};
[StructLayout(LayoutKind.Explicit)]
private struct Buf12
{
[FieldOffset(0 * 4)]
public uint U0;
[FieldOffset(1 * 4)]
public uint U1;
[FieldOffset(2 * 4)]
public uint U2;
[FieldOffset(0)]
private ulong ulo64LE;
[FieldOffset(4)]
private ulong uhigh64LE;
public ulong Low64
{
#if BIGENDIAN
get => ((ulong)U1 << 32) | U0;
set { U1 = (uint)(value >> 32); U0 = (uint)value; }
#else
get => ulo64LE;
set => ulo64LE = value;
#endif
}
/// <summary>
/// U1-U2 combined (overlaps with Low64)
/// </summary>
public ulong High64
{
#if BIGENDIAN
get => ((ulong)U2 << 32) | U1;
set { U2 = (uint)(value >> 32); U1 = (uint)value; }
#else
get => uhigh64LE;
set => uhigh64LE = value;
#endif
}
}
[StructLayout(LayoutKind.Explicit)]
private struct Buf16
{
[FieldOffset(0 * 4)]
public uint U0;
[FieldOffset(1 * 4)]
public uint U1;
[FieldOffset(2 * 4)]
public uint U2;
[FieldOffset(3 * 4)]
public uint U3;
[FieldOffset(0 * 8)]
private ulong ulo64LE;
[FieldOffset(1 * 8)]
private ulong uhigh64LE;
public ulong Low64
{
#if BIGENDIAN
get => ((ulong)U1 << 32) | U0;
set { U1 = (uint)(value >> 32); U0 = (uint)value; }
#else
get => ulo64LE;
set => ulo64LE = value;
#endif
}
public ulong High64
{
#if BIGENDIAN
get => ((ulong)U3 << 32) | U2;
set { U3 = (uint)(value >> 32); U2 = (uint)value; }
#else
get => uhigh64LE;
set => uhigh64LE = value;
#endif
}
}
[StructLayout(LayoutKind.Explicit)]
private struct Buf24
{
[FieldOffset(0 * 4)]
public uint U0;
[FieldOffset(1 * 4)]
public uint U1;
[FieldOffset(2 * 4)]
public uint U2;
[FieldOffset(3 * 4)]
public uint U3;
[FieldOffset(4 * 4)]
public uint U4;
[FieldOffset(5 * 4)]
public uint U5;
[FieldOffset(0 * 8)]
private ulong ulo64LE;
[FieldOffset(1 * 8)]
private ulong umid64LE;
[FieldOffset(2 * 8)]
private ulong uhigh64LE;
public ulong Low64
{
#if BIGENDIAN
get => ((ulong)U1 << 32) | U0;
set { U1 = (uint)(value >> 32); U0 = (uint)value; }
#else
get => ulo64LE;
set => ulo64LE = value;
#endif
}
public ulong Mid64
{
#if BIGENDIAN
get => ((ulong)U3 << 32) | U2;
set { U3 = (uint)(value >> 32); U2 = (uint)value; }
#else
get => umid64LE;
set => umid64LE = value;
#endif
}
public ulong High64
{
#if BIGENDIAN
get => ((ulong)U5 << 32) | U4;
set { U5 = (uint)(value >> 32); U4 = (uint)value; }
#else
get => uhigh64LE;
set => uhigh64LE = value;
#endif
}
public const int Length = 6;
}
private struct Buf28
{
public Buf24 Buf24;
public uint U6;
public const int Length = 7;
}
}
}
}
| 1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Private.CoreLib/src/System/Decimal.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Buffers.Binary;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
namespace System
{
// Implements the Decimal data type. The Decimal data type can
// represent values ranging from -79,228,162,514,264,337,593,543,950,335 to
// 79,228,162,514,264,337,593,543,950,335 with 28 significant digits. The
// Decimal data type is ideally suited to financial calculations that
// require a large number of significant digits and no round-off errors.
//
// The finite set of values of type Decimal are of the form m
// / 10e, where m is an integer such that
// -296 <; m <; 296, and e is an integer
// between 0 and 28 inclusive.
//
// Contrary to the float and double data types, decimal
// fractional numbers such as 0.1 can be represented exactly in the
// Decimal representation. In the float and double
// representations, such numbers are often infinite fractions, making those
// representations more prone to round-off errors.
//
// The Decimal class implements widening conversions from the
// ubyte, char, short, int, and long types
// to Decimal. These widening conversions never lose any information
// and never throw exceptions. The Decimal class also implements
// narrowing conversions from Decimal to ubyte, char,
// short, int, and long. These narrowing conversions round
// the Decimal value towards zero to the nearest integer, and then
// converts that integer to the destination type. An OverflowException
// is thrown if the result is not within the range of the destination type.
//
// The Decimal class provides a widening conversion from
// Currency to Decimal. This widening conversion never loses any
// information and never throws exceptions. The Currency class provides
// a narrowing conversion from Decimal to Currency. This
// narrowing conversion rounds the Decimal to four decimals and then
// converts that number to a Currency. An OverflowException
// is thrown if the result is not within the range of the Currency type.
//
// The Decimal class provides narrowing conversions to and from the
// float and double types. A conversion from Decimal to
// float or double may lose precision, but will not lose
// information about the overall magnitude of the numeric value, and will never
// throw an exception. A conversion from float or double to
// Decimal throws an OverflowException if the value is not within
// the range of the Decimal type.
[StructLayout(LayoutKind.Sequential)]
[Serializable]
[System.Runtime.Versioning.NonVersionable] // This only applies to field layout
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public readonly partial struct Decimal : ISpanFormattable, IComparable, IConvertible, IComparable<decimal>, IEquatable<decimal>, ISerializable, IDeserializationCallback
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001, CA2252 // SA1001: Comma positioning; CA2252: Preview Features
, IMinMaxValue<decimal>,
ISignedNumber<decimal>
#pragma warning restore SA1001, CA2252
#endif // FEATURE_GENERIC_MATH
{
// Sign mask for the flags field. A value of zero in this bit indicates a
// positive Decimal value, and a value of one in this bit indicates a
// negative Decimal value.
//
// Look at OleAut's DECIMAL_NEG constant to check for negative values
// in native code.
private const int SignMask = unchecked((int)0x80000000);
// Scale mask for the flags field. This byte in the flags field contains
// the power of 10 to divide the Decimal value by. The scale byte must
// contain a value between 0 and 28 inclusive.
private const int ScaleMask = 0x00FF0000;
// Number of bits scale is shifted by.
private const int ScaleShift = 16;
// Constant representing the Decimal value 0.
public const decimal Zero = 0m;
// Constant representing the Decimal value 1.
public const decimal One = 1m;
// Constant representing the Decimal value -1.
public const decimal MinusOne = -1m;
// Constant representing the largest possible Decimal value. The value of
// this constant is 79,228,162,514,264,337,593,543,950,335.
public const decimal MaxValue = 79228162514264337593543950335m;
// Constant representing the smallest possible Decimal value. The value of
// this constant is -79,228,162,514,264,337,593,543,950,335.
public const decimal MinValue = -79228162514264337593543950335m;
// The lo, mid, hi, and flags fields contain the representation of the
// Decimal value. The lo, mid, and hi fields contain the 96-bit integer
// part of the Decimal. Bits 0-15 (the lower word) of the flags field are
// unused and must be zero; bits 16-23 contain must contain a value between
// 0 and 28, indicating the power of 10 to divide the 96-bit integer part
// by to produce the Decimal value; bits 24-30 are unused and must be zero;
// and finally bit 31 indicates the sign of the Decimal value, 0 meaning
// positive and 1 meaning negative.
//
// NOTE: Do not change the order and types of these fields. The layout has to
// match Win32 DECIMAL type.
private readonly int _flags;
private readonly uint _hi32;
private readonly ulong _lo64;
// Constructs a Decimal from an integer value.
//
public Decimal(int value)
{
if (value >= 0)
{
_flags = 0;
}
else
{
_flags = SignMask;
value = -value;
}
_lo64 = (uint)value;
_hi32 = 0;
}
// Constructs a Decimal from an unsigned integer value.
//
[CLSCompliant(false)]
public Decimal(uint value)
{
_flags = 0;
_lo64 = value;
_hi32 = 0;
}
// Constructs a Decimal from a long value.
//
public Decimal(long value)
{
if (value >= 0)
{
_flags = 0;
}
else
{
_flags = SignMask;
value = -value;
}
_lo64 = (ulong)value;
_hi32 = 0;
}
// Constructs a Decimal from an unsigned long value.
//
[CLSCompliant(false)]
public Decimal(ulong value)
{
_flags = 0;
_lo64 = value;
_hi32 = 0;
}
// Constructs a Decimal from a float value.
//
public Decimal(float value)
{
DecCalc.VarDecFromR4(value, out AsMutable(ref this));
}
// Constructs a Decimal from a double value.
//
public Decimal(double value)
{
DecCalc.VarDecFromR8(value, out AsMutable(ref this));
}
private Decimal(SerializationInfo info!!, StreamingContext context)
{
_flags = info.GetInt32("flags");
_hi32 = (uint)info.GetInt32("hi");
_lo64 = (uint)info.GetInt32("lo") + ((ulong)info.GetInt32("mid") << 32);
}
void ISerializable.GetObjectData(SerializationInfo info!!, StreamingContext context)
{
// Serialize both the old and the new format
info.AddValue("flags", _flags);
info.AddValue("hi", (int)High);
info.AddValue("lo", (int)Low);
info.AddValue("mid", (int)Mid);
}
//
// Decimal <==> Currency conversion.
//
// A Currency represents a positive or negative decimal value with 4 digits past the decimal point. The actual Int64 representation used by these methods
// is the currency value multiplied by 10,000. For example, a currency value of $12.99 would be represented by the Int64 value 129,900.
//
public static decimal FromOACurrency(long cy)
{
ulong absoluteCy; // has to be ulong to accommodate the case where cy == long.MinValue.
bool isNegative = false;
if (cy < 0)
{
isNegative = true;
absoluteCy = (ulong)(-cy);
}
else
{
absoluteCy = (ulong)cy;
}
// In most cases, FromOACurrency() produces a Decimal with Scale set to 4. Unless, that is, some of the trailing digits past the decimal point are zero,
// in which case, for compatibility with .Net, we reduce the Scale by the number of zeros. While the result is still numerically equivalent, the scale does
// affect the ToString() value. In particular, it prevents a converted currency value of $12.95 from printing uglily as "12.9500".
int scale = 4;
if (absoluteCy != 0) // For compatibility, a currency of 0 emits the Decimal "0.0000" (scale set to 4).
{
while (scale != 0 && ((absoluteCy % 10) == 0))
{
scale--;
absoluteCy /= 10;
}
}
return new decimal((int)absoluteCy, (int)(absoluteCy >> 32), 0, isNegative, (byte)scale);
}
public static long ToOACurrency(decimal value)
{
return DecCalc.VarCyFromDec(ref AsMutable(ref value));
}
private static bool IsValid(int flags) => (flags & ~(SignMask | ScaleMask)) == 0 && ((uint)(flags & ScaleMask) <= (28 << ScaleShift));
// Constructs a Decimal from an integer array containing a binary
// representation. The bits argument must be a non-null integer
// array with four elements. bits[0], bits[1], and
// bits[2] contain the low, middle, and high 32 bits of the 96-bit
// integer part of the Decimal. bits[3] contains the scale factor
// and sign of the Decimal: bits 0-15 (the lower word) are unused and must
// be zero; bits 16-23 must contain a value between 0 and 28, indicating
// the power of 10 to divide the 96-bit integer part by to produce the
// Decimal value; bits 24-30 are unused and must be zero; and finally bit
// 31 indicates the sign of the Decimal value, 0 meaning positive and 1
// meaning negative.
//
// Note that there are several possible binary representations for the
// same numeric value. For example, the value 1 can be represented as {1,
// 0, 0, 0} (integer value 1 with a scale factor of 0) and equally well as
// {1000, 0, 0, 0x30000} (integer value 1000 with a scale factor of 3).
// The possible binary representations of a particular value are all
// equally valid, and all are numerically equivalent.
//
public Decimal(int[] bits!!) :
this((ReadOnlySpan<int>)bits)
{
}
/// <summary>
/// Initializes a new instance of <see cref="decimal"/> to a decimal value represented in binary and contained in the specified span.
/// </summary>
/// <param name="bits">A span of four <see cref="int"/>s containing a binary representation of a decimal value.</param>
/// <exception cref="ArgumentException">The length of <paramref name="bits"/> is not 4, or the representation of the decimal value in <paramref name="bits"/> is not valid.</exception>
public Decimal(ReadOnlySpan<int> bits)
{
if (bits.Length == 4)
{
int f = bits[3];
if (IsValid(f))
{
_lo64 = (uint)bits[0] + ((ulong)(uint)bits[1] << 32);
_hi32 = (uint)bits[2];
_flags = f;
return;
}
}
throw new ArgumentException(SR.Arg_DecBitCtor);
}
// Constructs a Decimal from its constituent parts.
//
public Decimal(int lo, int mid, int hi, bool isNegative, byte scale)
{
if (scale > 28)
throw new ArgumentOutOfRangeException(nameof(scale), SR.ArgumentOutOfRange_DecimalScale);
_lo64 = (uint)lo + ((ulong)(uint)mid << 32);
_hi32 = (uint)hi;
_flags = ((int)scale) << 16;
if (isNegative)
_flags |= SignMask;
}
void IDeserializationCallback.OnDeserialization(object? sender)
{
// OnDeserialization is called after each instance of this class is deserialized.
// This callback method performs decimal validation after being deserialized.
if (!IsValid(_flags))
throw new SerializationException(SR.Overflow_Decimal);
}
// Constructs a Decimal from its constituent parts.
private Decimal(int lo, int mid, int hi, int flags)
{
if (IsValid(flags))
{
_lo64 = (uint)lo + ((ulong)(uint)mid << 32);
_hi32 = (uint)hi;
_flags = flags;
return;
}
throw new ArgumentException(SR.Arg_DecBitCtor);
}
private Decimal(in decimal d, int flags)
{
this = d;
_flags = flags;
}
// Returns the absolute value of the given Decimal. If d is
// positive, the result is d. If d is negative, the result
// is -d.
//
internal static decimal Abs(in decimal d)
{
return new decimal(in d, d._flags & ~SignMask);
}
// Adds two Decimal values.
//
public static decimal Add(decimal d1, decimal d2)
{
DecCalc.DecAddSub(ref AsMutable(ref d1), ref AsMutable(ref d2), false);
return d1;
}
// Rounds a Decimal to an integer value. The Decimal argument is rounded
// towards positive infinity.
public static decimal Ceiling(decimal d)
{
int flags = d._flags;
if ((flags & ScaleMask) != 0)
DecCalc.InternalRound(ref AsMutable(ref d), (byte)(flags >> ScaleShift), MidpointRounding.ToPositiveInfinity);
return d;
}
// Compares two Decimal values, returning an integer that indicates their
// relationship.
//
public static int Compare(decimal d1, decimal d2)
{
return DecCalc.VarDecCmp(in d1, in d2);
}
// Compares this object to another object, returning an integer that
// indicates the relationship.
// Returns a value less than zero if this object
// null is considered to be less than any instance.
// If object is not of type Decimal, this method throws an ArgumentException.
//
public int CompareTo(object? value)
{
if (value == null)
return 1;
if (!(value is decimal))
throw new ArgumentException(SR.Arg_MustBeDecimal);
decimal other = (decimal)value;
return DecCalc.VarDecCmp(in this, in other);
}
public int CompareTo(decimal value)
{
return DecCalc.VarDecCmp(in this, in value);
}
// Divides two Decimal values.
//
public static decimal Divide(decimal d1, decimal d2)
{
DecCalc.VarDecDiv(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
// Checks if this Decimal is equal to a given object. Returns true
// if the given object is a boxed Decimal and its value is equal to the
// value of this Decimal. Returns false otherwise.
//
public override bool Equals([NotNullWhen(true)] object? value) =>
value is decimal other &&
DecCalc.VarDecCmp(in this, in other) == 0;
public bool Equals(decimal value) =>
DecCalc.VarDecCmp(in this, in value) == 0;
// Returns the hash code for this Decimal.
//
public override int GetHashCode() => DecCalc.GetHashCode(in this);
// Compares two Decimal values for equality. Returns true if the two
// Decimal values are equal, or false if they are not equal.
//
public static bool Equals(decimal d1, decimal d2)
{
return DecCalc.VarDecCmp(in d1, in d2) == 0;
}
// Rounds a Decimal to an integer value. The Decimal argument is rounded
// towards negative infinity.
//
public static decimal Floor(decimal d)
{
int flags = d._flags;
if ((flags & ScaleMask) != 0)
DecCalc.InternalRound(ref AsMutable(ref d), (byte)(flags >> ScaleShift), MidpointRounding.ToNegativeInfinity);
return d;
}
// Converts this Decimal to a string. The resulting string consists of an
// optional minus sign ("-") followed to a sequence of digits ("0" - "9"),
// optionally followed by a decimal point (".") and another sequence of
// digits.
//
public override string ToString()
{
return Number.FormatDecimal(this, null, NumberFormatInfo.CurrentInfo);
}
public string ToString(string? format)
{
return Number.FormatDecimal(this, format, NumberFormatInfo.CurrentInfo);
}
public string ToString(IFormatProvider? provider)
{
return Number.FormatDecimal(this, null, NumberFormatInfo.GetInstance(provider));
}
public string ToString(string? format, IFormatProvider? provider)
{
return Number.FormatDecimal(this, format, NumberFormatInfo.GetInstance(provider));
}
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
{
return Number.TryFormatDecimal(this, format, NumberFormatInfo.GetInstance(provider), destination, out charsWritten);
}
// Converts a string to a Decimal. The string must consist of an optional
// minus sign ("-") followed by a sequence of digits ("0" - "9"). The
// sequence of digits may optionally contain a single decimal point (".")
// character. Leading and trailing whitespace characters are allowed.
// Parse also allows a currency symbol, a trailing negative sign, and
// parentheses in the number.
//
public static decimal Parse(string s)
{
if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
return Number.ParseDecimal(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo);
}
public static decimal Parse(string s, NumberStyles style)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
return Number.ParseDecimal(s, style, NumberFormatInfo.CurrentInfo);
}
public static decimal Parse(string s, IFormatProvider? provider)
{
if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
return Number.ParseDecimal(s, NumberStyles.Number, NumberFormatInfo.GetInstance(provider));
}
public static decimal Parse(string s, NumberStyles style, IFormatProvider? provider)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
return Number.ParseDecimal(s, style, NumberFormatInfo.GetInstance(provider));
}
public static decimal Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Number, IFormatProvider? provider = null)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
return Number.ParseDecimal(s, style, NumberFormatInfo.GetInstance(provider));
}
public static bool TryParse([NotNullWhen(true)] string? s, out decimal result)
{
if (s == null)
{
result = 0;
return false;
}
return Number.TryParseDecimal(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo, out result) == Number.ParsingStatus.OK;
}
public static bool TryParse(ReadOnlySpan<char> s, out decimal result)
{
return Number.TryParseDecimal(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo, out result) == Number.ParsingStatus.OK;
}
public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out decimal result)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
if (s == null)
{
result = 0;
return false;
}
return Number.TryParseDecimal(s, style, NumberFormatInfo.GetInstance(provider), out result) == Number.ParsingStatus.OK;
}
public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out decimal result)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
return Number.TryParseDecimal(s, style, NumberFormatInfo.GetInstance(provider), out result) == Number.ParsingStatus.OK;
}
// Returns a binary representation of a Decimal. The return value is an
// integer array with four elements. Elements 0, 1, and 2 contain the low,
// middle, and high 32 bits of the 96-bit integer part of the Decimal.
// Element 3 contains the scale factor and sign of the Decimal: bits 0-15
// (the lower word) are unused; bits 16-23 contain a value between 0 and
// 28, indicating the power of 10 to divide the 96-bit integer part by to
// produce the Decimal value; bits 24-30 are unused; and finally bit 31
// indicates the sign of the Decimal value, 0 meaning positive and 1
// meaning negative.
//
public static int[] GetBits(decimal d)
{
return new int[] { (int)d.Low, (int)d.Mid, (int)d.High, d._flags };
}
/// <summary>
/// Converts the value of a specified instance of <see cref="decimal"/> to its equivalent binary representation.
/// </summary>
/// <param name="d">The value to convert.</param>
/// <param name="destination">The span into which to store the four-integer binary representation.</param>
/// <returns>Four, the number of integers in the binary representation.</returns>
/// <exception cref="ArgumentException">The destination span was not long enough to store the binary representation.</exception>
public static int GetBits(decimal d, Span<int> destination)
{
if ((uint)destination.Length <= 3)
{
ThrowHelper.ThrowArgumentException_DestinationTooShort();
}
destination[0] = (int)d.Low;
destination[1] = (int)d.Mid;
destination[2] = (int)d.High;
destination[3] = d._flags;
return 4;
}
/// <summary>
/// Tries to convert the value of a specified instance of <see cref="decimal"/> to its equivalent binary representation.
/// </summary>
/// <param name="d">The value to convert.</param>
/// <param name="destination">The span into which to store the binary representation.</param>
/// <param name="valuesWritten">The number of integers written to the destination.</param>
/// <returns>true if the decimal's binary representation was written to the destination; false if the destination wasn't long enough.</returns>
public static bool TryGetBits(decimal d, Span<int> destination, out int valuesWritten)
{
if ((uint)destination.Length <= 3)
{
valuesWritten = 0;
return false;
}
destination[0] = (int)d.Low;
destination[1] = (int)d.Mid;
destination[2] = (int)d.High;
destination[3] = d._flags;
valuesWritten = 4;
return true;
}
internal static void GetBytes(in decimal d, Span<byte> buffer)
{
Debug.Assert(buffer.Length >= 16, "buffer.Length >= 16");
BinaryPrimitives.WriteInt32LittleEndian(buffer, (int)d.Low);
BinaryPrimitives.WriteInt32LittleEndian(buffer.Slice(4), (int)d.Mid);
BinaryPrimitives.WriteInt32LittleEndian(buffer.Slice(8), (int)d.High);
BinaryPrimitives.WriteInt32LittleEndian(buffer.Slice(12), d._flags);
}
internal static decimal ToDecimal(ReadOnlySpan<byte> span)
{
Debug.Assert(span.Length >= 16, "span.Length >= 16");
int lo = BinaryPrimitives.ReadInt32LittleEndian(span);
int mid = BinaryPrimitives.ReadInt32LittleEndian(span.Slice(4));
int hi = BinaryPrimitives.ReadInt32LittleEndian(span.Slice(8));
int flags = BinaryPrimitives.ReadInt32LittleEndian(span.Slice(12));
return new decimal(lo, mid, hi, flags);
}
// Returns the larger of two Decimal values.
//
internal static ref readonly decimal Max(in decimal d1, in decimal d2)
{
return ref DecCalc.VarDecCmp(in d1, in d2) >= 0 ? ref d1 : ref d2;
}
// Returns the smaller of two Decimal values.
//
internal static ref readonly decimal Min(in decimal d1, in decimal d2)
{
return ref DecCalc.VarDecCmp(in d1, in d2) < 0 ? ref d1 : ref d2;
}
public static decimal Remainder(decimal d1, decimal d2)
{
DecCalc.VarDecMod(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
// Multiplies two Decimal values.
//
public static decimal Multiply(decimal d1, decimal d2)
{
DecCalc.VarDecMul(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
// Returns the negated value of the given Decimal. If d is non-zero,
// the result is -d. If d is zero, the result is zero.
//
public static decimal Negate(decimal d)
{
return new decimal(in d, d._flags ^ SignMask);
}
// Rounds a Decimal value to a given number of decimal places. The value
// given by d is rounded to the number of decimal places given by
// decimals. The decimals argument must be an integer between
// 0 and 28 inclusive.
//
// By default a mid-point value is rounded to the nearest even number. If the mode is
// passed in, it can also round away from zero.
public static decimal Round(decimal d) => Round(ref d, 0, MidpointRounding.ToEven);
public static decimal Round(decimal d, int decimals) => Round(ref d, decimals, MidpointRounding.ToEven);
public static decimal Round(decimal d, MidpointRounding mode) => Round(ref d, 0, mode);
public static decimal Round(decimal d, int decimals, MidpointRounding mode) => Round(ref d, decimals, mode);
private static decimal Round(ref decimal d, int decimals, MidpointRounding mode)
{
if ((uint)decimals > 28)
throw new ArgumentOutOfRangeException(nameof(decimals), SR.ArgumentOutOfRange_DecimalRound);
if ((uint)mode > (uint)MidpointRounding.ToPositiveInfinity)
throw new ArgumentException(SR.Format(SR.Argument_InvalidEnumValue, mode, nameof(MidpointRounding)), nameof(mode));
int scale = d.Scale - decimals;
if (scale > 0)
DecCalc.InternalRound(ref AsMutable(ref d), (uint)scale, mode);
return d;
}
internal static int Sign(in decimal d) => (d.Low64 | d.High) == 0 ? 0 : (d._flags >> 31) | 1;
// Subtracts two Decimal values.
//
public static decimal Subtract(decimal d1, decimal d2)
{
DecCalc.DecAddSub(ref AsMutable(ref d1), ref AsMutable(ref d2), true);
return d1;
}
// Converts a Decimal to an unsigned byte. The Decimal value is rounded
// towards zero to the nearest integer value, and the result of this
// operation is returned as a byte.
//
public static byte ToByte(decimal value)
{
uint temp;
try
{
temp = ToUInt32(value);
}
catch (OverflowException)
{
Number.ThrowOverflowException(TypeCode.Byte);
throw;
}
if (temp != (byte)temp) Number.ThrowOverflowException(TypeCode.Byte);
return (byte)temp;
}
// Converts a Decimal to a signed byte. The Decimal value is rounded
// towards zero to the nearest integer value, and the result of this
// operation is returned as a byte.
//
[CLSCompliant(false)]
public static sbyte ToSByte(decimal value)
{
int temp;
try
{
temp = ToInt32(value);
}
catch (OverflowException)
{
Number.ThrowOverflowException(TypeCode.SByte);
throw;
}
if (temp != (sbyte)temp) Number.ThrowOverflowException(TypeCode.SByte);
return (sbyte)temp;
}
// Converts a Decimal to a short. The Decimal value is
// rounded towards zero to the nearest integer value, and the result of
// this operation is returned as a short.
//
public static short ToInt16(decimal value)
{
int temp;
try
{
temp = ToInt32(value);
}
catch (OverflowException)
{
Number.ThrowOverflowException(TypeCode.Int16);
throw;
}
if (temp != (short)temp) Number.ThrowOverflowException(TypeCode.Int16);
return (short)temp;
}
// Converts a Decimal to a double. Since a double has fewer significant
// digits than a Decimal, this operation may produce round-off errors.
//
public static double ToDouble(decimal d)
{
return DecCalc.VarR8FromDec(in d);
}
// Converts a Decimal to an integer. The Decimal value is rounded towards
// zero to the nearest integer value, and the result of this operation is
// returned as an integer.
//
public static int ToInt32(decimal d)
{
Truncate(ref d);
if ((d.High | d.Mid) == 0)
{
int i = (int)d.Low;
if (!d.IsNegative)
{
if (i >= 0) return i;
}
else
{
i = -i;
if (i <= 0) return i;
}
}
throw new OverflowException(SR.Overflow_Int32);
}
// Converts a Decimal to a long. The Decimal value is rounded towards zero
// to the nearest integer value, and the result of this operation is
// returned as a long.
//
public static long ToInt64(decimal d)
{
Truncate(ref d);
if (d.High == 0)
{
long l = (long)d.Low64;
if (!d.IsNegative)
{
if (l >= 0) return l;
}
else
{
l = -l;
if (l <= 0) return l;
}
}
throw new OverflowException(SR.Overflow_Int64);
}
// Converts a Decimal to an ushort. The Decimal
// value is rounded towards zero to the nearest integer value, and the
// result of this operation is returned as an ushort.
//
[CLSCompliant(false)]
public static ushort ToUInt16(decimal value)
{
uint temp;
try
{
temp = ToUInt32(value);
}
catch (OverflowException)
{
Number.ThrowOverflowException(TypeCode.UInt16);
throw;
}
if (temp != (ushort)temp) Number.ThrowOverflowException(TypeCode.UInt16);
return (ushort)temp;
}
// Converts a Decimal to an unsigned integer. The Decimal
// value is rounded towards zero to the nearest integer value, and the
// result of this operation is returned as an unsigned integer.
//
[CLSCompliant(false)]
public static uint ToUInt32(decimal d)
{
Truncate(ref d);
if ((d.High| d.Mid) == 0)
{
uint i = d.Low;
if (!d.IsNegative || i == 0)
return i;
}
throw new OverflowException(SR.Overflow_UInt32);
}
// Converts a Decimal to an unsigned long. The Decimal
// value is rounded towards zero to the nearest integer value, and the
// result of this operation is returned as a long.
//
[CLSCompliant(false)]
public static ulong ToUInt64(decimal d)
{
Truncate(ref d);
if (d.High == 0)
{
ulong l = d.Low64;
if (!d.IsNegative || l == 0)
return l;
}
throw new OverflowException(SR.Overflow_UInt64);
}
// Converts a Decimal to a float. Since a float has fewer significant
// digits than a Decimal, this operation may produce round-off errors.
//
public static float ToSingle(decimal d)
{
return DecCalc.VarR4FromDec(in d);
}
// Truncates a Decimal to an integer value. The Decimal argument is rounded
// towards zero to the nearest integer value, corresponding to removing all
// digits after the decimal point.
//
public static decimal Truncate(decimal d)
{
Truncate(ref d);
return d;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void Truncate(ref decimal d)
{
int flags = d._flags;
if ((flags & ScaleMask) != 0)
DecCalc.InternalRound(ref AsMutable(ref d), (byte)(flags >> ScaleShift), MidpointRounding.ToZero);
}
public static implicit operator decimal(byte value) => new decimal((uint)value);
[CLSCompliant(false)]
public static implicit operator decimal(sbyte value) => new decimal(value);
public static implicit operator decimal(short value) => new decimal(value);
[CLSCompliant(false)]
public static implicit operator decimal(ushort value) => new decimal((uint)value);
public static implicit operator decimal(char value) => new decimal((uint)value);
public static implicit operator decimal(int value) => new decimal(value);
[CLSCompliant(false)]
public static implicit operator decimal(uint value) => new decimal(value);
public static implicit operator decimal(long value) => new decimal(value);
[CLSCompliant(false)]
public static implicit operator decimal(ulong value) => new decimal(value);
public static explicit operator decimal(float value) => new decimal(value);
public static explicit operator decimal(double value) => new decimal(value);
public static explicit operator byte(decimal value) => ToByte(value);
[CLSCompliant(false)]
public static explicit operator sbyte(decimal value) => ToSByte(value);
public static explicit operator char(decimal value)
{
ushort temp;
try
{
temp = ToUInt16(value);
}
catch (OverflowException e)
{
throw new OverflowException(SR.Overflow_Char, e);
}
return (char)temp;
}
public static explicit operator short(decimal value) => ToInt16(value);
[CLSCompliant(false)]
public static explicit operator ushort(decimal value) => ToUInt16(value);
public static explicit operator int(decimal value) => ToInt32(value);
[CLSCompliant(false)]
public static explicit operator uint(decimal value) => ToUInt32(value);
public static explicit operator long(decimal value) => ToInt64(value);
[CLSCompliant(false)]
public static explicit operator ulong(decimal value) => ToUInt64(value);
public static explicit operator float(decimal value) => DecCalc.VarR4FromDec(in value);
public static explicit operator double(decimal value) => DecCalc.VarR8FromDec(in value);
public static decimal operator +(decimal d) => d;
public static decimal operator -(decimal d) => new decimal(in d, d._flags ^ SignMask);
public static decimal operator ++(decimal d) => Add(d, One);
public static decimal operator --(decimal d) => Subtract(d, One);
public static decimal operator +(decimal d1, decimal d2)
{
DecCalc.DecAddSub(ref AsMutable(ref d1), ref AsMutable(ref d2), false);
return d1;
}
public static decimal operator -(decimal d1, decimal d2)
{
DecCalc.DecAddSub(ref AsMutable(ref d1), ref AsMutable(ref d2), true);
return d1;
}
public static decimal operator *(decimal d1, decimal d2)
{
DecCalc.VarDecMul(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
public static decimal operator /(decimal d1, decimal d2)
{
DecCalc.VarDecDiv(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
public static decimal operator %(decimal d1, decimal d2)
{
DecCalc.VarDecMod(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
public static bool operator ==(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) == 0;
public static bool operator !=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) != 0;
public static bool operator <(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) < 0;
public static bool operator <=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) <= 0;
public static bool operator >(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) > 0;
public static bool operator >=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) >= 0;
//
// IConvertible implementation
//
public TypeCode GetTypeCode()
{
return TypeCode.Decimal;
}
bool IConvertible.ToBoolean(IFormatProvider? provider)
{
return Convert.ToBoolean(this);
}
char IConvertible.ToChar(IFormatProvider? provider)
{
throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "Char"));
}
sbyte IConvertible.ToSByte(IFormatProvider? provider)
{
return Convert.ToSByte(this);
}
byte IConvertible.ToByte(IFormatProvider? provider)
{
return Convert.ToByte(this);
}
short IConvertible.ToInt16(IFormatProvider? provider)
{
return Convert.ToInt16(this);
}
ushort IConvertible.ToUInt16(IFormatProvider? provider)
{
return Convert.ToUInt16(this);
}
int IConvertible.ToInt32(IFormatProvider? provider)
{
return Convert.ToInt32(this);
}
uint IConvertible.ToUInt32(IFormatProvider? provider)
{
return Convert.ToUInt32(this);
}
long IConvertible.ToInt64(IFormatProvider? provider)
{
return Convert.ToInt64(this);
}
ulong IConvertible.ToUInt64(IFormatProvider? provider)
{
return Convert.ToUInt64(this);
}
float IConvertible.ToSingle(IFormatProvider? provider)
{
return DecCalc.VarR4FromDec(in this);
}
double IConvertible.ToDouble(IFormatProvider? provider)
{
return DecCalc.VarR8FromDec(in this);
}
decimal IConvertible.ToDecimal(IFormatProvider? provider)
{
return this;
}
DateTime IConvertible.ToDateTime(IFormatProvider? provider)
{
throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "DateTime"));
}
object IConvertible.ToType(Type type, IFormatProvider? provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
}
#if FEATURE_GENERIC_MATH
//
// IAdditionOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IAdditionOperators<decimal, decimal, decimal>.operator +(decimal left, decimal right)
=> checked(left + right);
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IAdditionOperators<decimal, decimal, decimal>.operator +(decimal left, decimal right)
// => checked(left + right);
//
// IAdditiveIdentity
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IAdditiveIdentity<decimal, decimal>.AdditiveIdentity => 0.0m;
//
// IComparisonOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IComparisonOperators<decimal, decimal>.operator <(decimal left, decimal right)
=> left < right;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IComparisonOperators<decimal, decimal>.operator <=(decimal left, decimal right)
=> left <= right;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IComparisonOperators<decimal, decimal>.operator >(decimal left, decimal right)
=> left > right;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IComparisonOperators<decimal, decimal>.operator >=(decimal left, decimal right)
=> left >= right;
//
// IDecrementOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IDecrementOperators<decimal>.operator --(decimal value)
=> --value;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IDecrementOperators<decimal>.operator --(decimal value)
// => checked(--value);
//
// IDivisionOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IDivisionOperators<decimal, decimal, decimal>.operator /(decimal left, decimal right)
=> left / right;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IDivisionOperators<decimal, decimal, decimal>.operator /(decimal left, decimal right)
// => checked(left / right);
//
// IEqualityOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IEqualityOperators<decimal, decimal>.operator ==(decimal left, decimal right)
=> left == right;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IEqualityOperators<decimal, decimal>.operator !=(decimal left, decimal right)
=> left != right;
//
// IIncrementOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IIncrementOperators<decimal>.operator ++(decimal value)
=> ++value;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IIncrementOperators<decimal>.operator ++(decimal value)
// => checked(++value);
//
// IMinMaxValue
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IMinMaxValue<decimal>.MinValue => MinValue;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IMinMaxValue<decimal>.MaxValue => MaxValue;
//
// IModulusOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IModulusOperators<decimal, decimal, decimal>.operator %(decimal left, decimal right)
=> left % right;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IModulusOperators<decimal, decimal, decimal>.operator %(decimal left, decimal right)
// => checked(left % right);
//
// IMultiplicativeIdentity
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IMultiplicativeIdentity<decimal, decimal>.MultiplicativeIdentity => 1.0m;
//
// IMultiplyOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IMultiplyOperators<decimal, decimal, decimal>.operator *(decimal left, decimal right)
=> left * right;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IMultiplyOperators<decimal, decimal, decimal>.operator *(decimal left, decimal right)
// => checked(left * right);
//
// INumber
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.One => 1.0m;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Zero => 0.0m;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Abs(decimal value)
=> Math.Abs(value);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static decimal INumber<decimal>.Create<TOther>(TOther value)
{
if (typeof(TOther) == typeof(byte))
{
return (byte)(object)value;
}
else if (typeof(TOther) == typeof(char))
{
return (char)(object)value;
}
else if (typeof(TOther) == typeof(decimal))
{
return (decimal)(object)value;
}
else if (typeof(TOther) == typeof(double))
{
return (decimal)(double)(object)value;
}
else if (typeof(TOther) == typeof(short))
{
return (short)(object)value;
}
else if (typeof(TOther) == typeof(int))
{
return (int)(object)value;
}
else if (typeof(TOther) == typeof(long))
{
return (long)(object)value;
}
else if (typeof(TOther) == typeof(nint))
{
return (nint)(object)value;
}
else if (typeof(TOther) == typeof(sbyte))
{
return (sbyte)(object)value;
}
else if (typeof(TOther) == typeof(float))
{
return (decimal)(float)(object)value;
}
else if (typeof(TOther) == typeof(ushort))
{
return (ushort)(object)value;
}
else if (typeof(TOther) == typeof(uint))
{
return (uint)(object)value;
}
else if (typeof(TOther) == typeof(ulong))
{
return (ulong)(object)value;
}
else if (typeof(TOther) == typeof(nuint))
{
return (nuint)(object)value;
}
else
{
ThrowHelper.ThrowNotSupportedException();
return default;
}
}
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static decimal INumber<decimal>.CreateSaturating<TOther>(TOther value)
{
if (typeof(TOther) == typeof(byte))
{
return (byte)(object)value;
}
else if (typeof(TOther) == typeof(char))
{
return (char)(object)value;
}
else if (typeof(TOther) == typeof(decimal))
{
return (decimal)(object)value;
}
else if (typeof(TOther) == typeof(double))
{
return (decimal)(double)(object)value;
}
else if (typeof(TOther) == typeof(short))
{
return (short)(object)value;
}
else if (typeof(TOther) == typeof(int))
{
return (int)(object)value;
}
else if (typeof(TOther) == typeof(long))
{
return (long)(object)value;
}
else if (typeof(TOther) == typeof(nint))
{
return (nint)(object)value;
}
else if (typeof(TOther) == typeof(sbyte))
{
return (sbyte)(object)value;
}
else if (typeof(TOther) == typeof(float))
{
return (decimal)(float)(object)value;
}
else if (typeof(TOther) == typeof(ushort))
{
return (ushort)(object)value;
}
else if (typeof(TOther) == typeof(uint))
{
return (uint)(object)value;
}
else if (typeof(TOther) == typeof(ulong))
{
return (ulong)(object)value;
}
else if (typeof(TOther) == typeof(nuint))
{
return (nuint)(object)value;
}
else
{
ThrowHelper.ThrowNotSupportedException();
return default;
}
}
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static decimal INumber<decimal>.CreateTruncating<TOther>(TOther value)
{
if (typeof(TOther) == typeof(byte))
{
return (byte)(object)value;
}
else if (typeof(TOther) == typeof(char))
{
return (char)(object)value;
}
else if (typeof(TOther) == typeof(decimal))
{
return (decimal)(object)value;
}
else if (typeof(TOther) == typeof(double))
{
return (decimal)(double)(object)value;
}
else if (typeof(TOther) == typeof(short))
{
return (short)(object)value;
}
else if (typeof(TOther) == typeof(int))
{
return (int)(object)value;
}
else if (typeof(TOther) == typeof(long))
{
return (long)(object)value;
}
else if (typeof(TOther) == typeof(nint))
{
return (nint)(object)value;
}
else if (typeof(TOther) == typeof(sbyte))
{
return (sbyte)(object)value;
}
else if (typeof(TOther) == typeof(float))
{
return (decimal)(float)(object)value;
}
else if (typeof(TOther) == typeof(ushort))
{
return (ushort)(object)value;
}
else if (typeof(TOther) == typeof(uint))
{
return (uint)(object)value;
}
else if (typeof(TOther) == typeof(ulong))
{
return (ulong)(object)value;
}
else if (typeof(TOther) == typeof(nuint))
{
return (nuint)(object)value;
}
else
{
ThrowHelper.ThrowNotSupportedException();
return default;
}
}
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Clamp(decimal value, decimal min, decimal max)
=> Math.Clamp(value, min, max);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static (decimal Quotient, decimal Remainder) INumber<decimal>.DivRem(decimal left, decimal right)
=> (left / right, left % right);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Max(decimal x, decimal y)
=> Math.Max(x, y);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Min(decimal x, decimal y)
=> Math.Min(x, y);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Parse(string s, NumberStyles style, IFormatProvider? provider)
=> Parse(s, style, provider);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider)
=> Parse(s, style, provider);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Sign(decimal value)
=> Math.Sign(value);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static bool INumber<decimal>.TryCreate<TOther>(TOther value, out decimal result)
{
if (typeof(TOther) == typeof(byte))
{
result = (byte)(object)value;
return true;
}
else if (typeof(TOther) == typeof(char))
{
result = (char)(object)value;
return true;
}
else if (typeof(TOther) == typeof(decimal))
{
result = (decimal)(object)value;
return true;
}
else if (typeof(TOther) == typeof(double))
{
result = (decimal)(double)(object)value;
return true;
}
else if (typeof(TOther) == typeof(short))
{
result = (short)(object)value;
return true;
}
else if (typeof(TOther) == typeof(int))
{
result = (int)(object)value;
return true;
}
else if (typeof(TOther) == typeof(long))
{
result = (long)(object)value;
return true;
}
else if (typeof(TOther) == typeof(nint))
{
result = (nint)(object)value;
return true;
}
else if (typeof(TOther) == typeof(sbyte))
{
result = (sbyte)(object)value;
return true;
}
else if (typeof(TOther) == typeof(float))
{
result = (decimal)(float)(object)value;
return true;
}
else if (typeof(TOther) == typeof(ushort))
{
result = (ushort)(object)value;
return true;
}
else if (typeof(TOther) == typeof(uint))
{
result = (uint)(object)value;
return true;
}
else if (typeof(TOther) == typeof(ulong))
{
result = (ulong)(object)value;
return true;
}
else if (typeof(TOther) == typeof(nuint))
{
result = (nuint)(object)value;
return true;
}
else
{
ThrowHelper.ThrowNotSupportedException();
result = default;
return false;
}
}
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool INumber<decimal>.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out decimal result)
=> TryParse(s, style, provider, out result);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool INumber<decimal>.TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out decimal result)
=> TryParse(s, style, provider, out result);
//
// IParseable
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IParseable<decimal>.Parse(string s, IFormatProvider? provider)
=> Parse(s, provider);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IParseable<decimal>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out decimal result)
=> TryParse(s, NumberStyles.Number, provider, out result);
//
// ISignedNumber
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal ISignedNumber<decimal>.NegativeOne => -1;
//
// ISpanParseable
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal ISpanParseable<decimal>.Parse(ReadOnlySpan<char> s, IFormatProvider? provider)
=> Parse(s, NumberStyles.Number, provider);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool ISpanParseable<decimal>.TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out decimal result)
=> TryParse(s, NumberStyles.Number, provider, out result);
//
// ISubtractionOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal ISubtractionOperators<decimal, decimal, decimal>.operator -(decimal left, decimal right)
=> left - right;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal ISubtractionOperators<decimal, decimal, decimal>.operator -(decimal left, decimal right)
// => checked(left - right);
//
// IUnaryNegationOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IUnaryNegationOperators<decimal, decimal>.operator -(decimal value)
=> -value;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IUnaryNegationOperators<decimal, decimal>.operator -(decimal value)
// => checked(-value);
//
// IUnaryPlusOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IUnaryPlusOperators<decimal, decimal>.operator +(decimal value)
=> +value;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IUnaryPlusOperators<decimal, decimal>.operator +(decimal value)
// => checked(+value);
#endif // FEATURE_GENERIC_MATH
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Buffers.Binary;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
namespace System
{
// Implements the Decimal data type. The Decimal data type can
// represent values ranging from -79,228,162,514,264,337,593,543,950,335 to
// 79,228,162,514,264,337,593,543,950,335 with 28 significant digits. The
// Decimal data type is ideally suited to financial calculations that
// require a large number of significant digits and no round-off errors.
//
// The finite set of values of type Decimal are of the form m
// / 10e, where m is an integer such that
// -296 <; m <; 296, and e is an integer
// between 0 and 28 inclusive.
//
// Contrary to the float and double data types, decimal
// fractional numbers such as 0.1 can be represented exactly in the
// Decimal representation. In the float and double
// representations, such numbers are often infinite fractions, making those
// representations more prone to round-off errors.
//
// The Decimal class implements widening conversions from the
// ubyte, char, short, int, and long types
// to Decimal. These widening conversions never lose any information
// and never throw exceptions. The Decimal class also implements
// narrowing conversions from Decimal to ubyte, char,
// short, int, and long. These narrowing conversions round
// the Decimal value towards zero to the nearest integer, and then
// converts that integer to the destination type. An OverflowException
// is thrown if the result is not within the range of the destination type.
//
// The Decimal class provides a widening conversion from
// Currency to Decimal. This widening conversion never loses any
// information and never throws exceptions. The Currency class provides
// a narrowing conversion from Decimal to Currency. This
// narrowing conversion rounds the Decimal to four decimals and then
// converts that number to a Currency. An OverflowException
// is thrown if the result is not within the range of the Currency type.
//
// The Decimal class provides narrowing conversions to and from the
// float and double types. A conversion from Decimal to
// float or double may lose precision, but will not lose
// information about the overall magnitude of the numeric value, and will never
// throw an exception. A conversion from float or double to
// Decimal throws an OverflowException if the value is not within
// the range of the Decimal type.
[StructLayout(LayoutKind.Sequential)]
[Serializable]
[System.Runtime.Versioning.NonVersionable] // This only applies to field layout
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public readonly partial struct Decimal : ISpanFormattable, IComparable, IConvertible, IComparable<decimal>, IEquatable<decimal>, ISerializable, IDeserializationCallback
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001, CA2252 // SA1001: Comma positioning; CA2252: Preview Features
, IMinMaxValue<decimal>,
ISignedNumber<decimal>
#pragma warning restore SA1001, CA2252
#endif // FEATURE_GENERIC_MATH
{
// Sign mask for the flags field. A value of zero in this bit indicates a
// positive Decimal value, and a value of one in this bit indicates a
// negative Decimal value.
//
// Look at OleAut's DECIMAL_NEG constant to check for negative values
// in native code.
private const int SignMask = unchecked((int)0x80000000);
// Scale mask for the flags field. This byte in the flags field contains
// the power of 10 to divide the Decimal value by. The scale byte must
// contain a value between 0 and 28 inclusive.
private const int ScaleMask = 0x00FF0000;
// Number of bits scale is shifted by.
private const int ScaleShift = 16;
// Constant representing the Decimal value 0.
public const decimal Zero = 0m;
// Constant representing the Decimal value 1.
public const decimal One = 1m;
// Constant representing the Decimal value -1.
public const decimal MinusOne = -1m;
// Constant representing the largest possible Decimal value. The value of
// this constant is 79,228,162,514,264,337,593,543,950,335.
public const decimal MaxValue = 79228162514264337593543950335m;
// Constant representing the smallest possible Decimal value. The value of
// this constant is -79,228,162,514,264,337,593,543,950,335.
public const decimal MinValue = -79228162514264337593543950335m;
// The lo, mid, hi, and flags fields contain the representation of the
// Decimal value. The lo, mid, and hi fields contain the 96-bit integer
// part of the Decimal. Bits 0-15 (the lower word) of the flags field are
// unused and must be zero; bits 16-23 contain must contain a value between
// 0 and 28, indicating the power of 10 to divide the 96-bit integer part
// by to produce the Decimal value; bits 24-30 are unused and must be zero;
// and finally bit 31 indicates the sign of the Decimal value, 0 meaning
// positive and 1 meaning negative.
//
// NOTE: Do not change the order and types of these fields. The layout has to
// match Win32 DECIMAL type.
private readonly int _flags;
private readonly uint _hi32;
private readonly ulong _lo64;
// Constructs a Decimal from an integer value.
//
public Decimal(int value)
{
if (value >= 0)
{
_flags = 0;
}
else
{
_flags = SignMask;
value = -value;
}
_lo64 = (uint)value;
_hi32 = 0;
}
// Constructs a Decimal from an unsigned integer value.
//
[CLSCompliant(false)]
public Decimal(uint value)
{
_flags = 0;
_lo64 = value;
_hi32 = 0;
}
// Constructs a Decimal from a long value.
//
public Decimal(long value)
{
if (value >= 0)
{
_flags = 0;
}
else
{
_flags = SignMask;
value = -value;
}
_lo64 = (ulong)value;
_hi32 = 0;
}
// Constructs a Decimal from an unsigned long value.
//
[CLSCompliant(false)]
public Decimal(ulong value)
{
_flags = 0;
_lo64 = value;
_hi32 = 0;
}
// Constructs a Decimal from a float value.
//
public Decimal(float value)
{
DecCalc.VarDecFromR4(value, out AsMutable(ref this));
}
// Constructs a Decimal from a double value.
//
public Decimal(double value)
{
DecCalc.VarDecFromR8(value, out AsMutable(ref this));
}
private Decimal(SerializationInfo info!!, StreamingContext context)
{
_flags = info.GetInt32("flags");
_hi32 = (uint)info.GetInt32("hi");
_lo64 = (uint)info.GetInt32("lo") + ((ulong)info.GetInt32("mid") << 32);
}
void ISerializable.GetObjectData(SerializationInfo info!!, StreamingContext context)
{
// Serialize both the old and the new format
info.AddValue("flags", _flags);
info.AddValue("hi", (int)High);
info.AddValue("lo", (int)Low);
info.AddValue("mid", (int)Mid);
}
//
// Decimal <==> Currency conversion.
//
// A Currency represents a positive or negative decimal value with 4 digits past the decimal point. The actual Int64 representation used by these methods
// is the currency value multiplied by 10,000. For example, a currency value of $12.99 would be represented by the Int64 value 129,900.
//
public static decimal FromOACurrency(long cy)
{
ulong absoluteCy; // has to be ulong to accommodate the case where cy == long.MinValue.
bool isNegative = false;
if (cy < 0)
{
isNegative = true;
absoluteCy = (ulong)(-cy);
}
else
{
absoluteCy = (ulong)cy;
}
// In most cases, FromOACurrency() produces a Decimal with Scale set to 4. Unless, that is, some of the trailing digits past the decimal point are zero,
// in which case, for compatibility with .Net, we reduce the Scale by the number of zeros. While the result is still numerically equivalent, the scale does
// affect the ToString() value. In particular, it prevents a converted currency value of $12.95 from printing uglily as "12.9500".
int scale = 4;
if (absoluteCy != 0) // For compatibility, a currency of 0 emits the Decimal "0.0000" (scale set to 4).
{
while (scale != 0 && ((absoluteCy % 10) == 0))
{
scale--;
absoluteCy /= 10;
}
}
return new decimal((int)absoluteCy, (int)(absoluteCy >> 32), 0, isNegative, (byte)scale);
}
public static long ToOACurrency(decimal value)
{
return DecCalc.VarCyFromDec(ref AsMutable(ref value));
}
private static bool IsValid(int flags) => (flags & ~(SignMask | ScaleMask)) == 0 && ((uint)(flags & ScaleMask) <= (28 << ScaleShift));
// Constructs a Decimal from an integer array containing a binary
// representation. The bits argument must be a non-null integer
// array with four elements. bits[0], bits[1], and
// bits[2] contain the low, middle, and high 32 bits of the 96-bit
// integer part of the Decimal. bits[3] contains the scale factor
// and sign of the Decimal: bits 0-15 (the lower word) are unused and must
// be zero; bits 16-23 must contain a value between 0 and 28, indicating
// the power of 10 to divide the 96-bit integer part by to produce the
// Decimal value; bits 24-30 are unused and must be zero; and finally bit
// 31 indicates the sign of the Decimal value, 0 meaning positive and 1
// meaning negative.
//
// Note that there are several possible binary representations for the
// same numeric value. For example, the value 1 can be represented as {1,
// 0, 0, 0} (integer value 1 with a scale factor of 0) and equally well as
// {1000, 0, 0, 0x30000} (integer value 1000 with a scale factor of 3).
// The possible binary representations of a particular value are all
// equally valid, and all are numerically equivalent.
//
public Decimal(int[] bits!!) :
this((ReadOnlySpan<int>)bits)
{
}
/// <summary>
/// Initializes a new instance of <see cref="decimal"/> to a decimal value represented in binary and contained in the specified span.
/// </summary>
/// <param name="bits">A span of four <see cref="int"/>s containing a binary representation of a decimal value.</param>
/// <exception cref="ArgumentException">The length of <paramref name="bits"/> is not 4, or the representation of the decimal value in <paramref name="bits"/> is not valid.</exception>
public Decimal(ReadOnlySpan<int> bits)
{
if (bits.Length == 4)
{
int f = bits[3];
if (IsValid(f))
{
_lo64 = (uint)bits[0] + ((ulong)(uint)bits[1] << 32);
_hi32 = (uint)bits[2];
_flags = f;
return;
}
}
throw new ArgumentException(SR.Arg_DecBitCtor);
}
// Constructs a Decimal from its constituent parts.
//
public Decimal(int lo, int mid, int hi, bool isNegative, byte scale)
{
if (scale > 28)
throw new ArgumentOutOfRangeException(nameof(scale), SR.ArgumentOutOfRange_DecimalScale);
_lo64 = (uint)lo + ((ulong)(uint)mid << 32);
_hi32 = (uint)hi;
_flags = ((int)scale) << 16;
if (isNegative)
_flags |= SignMask;
}
void IDeserializationCallback.OnDeserialization(object? sender)
{
// OnDeserialization is called after each instance of this class is deserialized.
// This callback method performs decimal validation after being deserialized.
if (!IsValid(_flags))
throw new SerializationException(SR.Overflow_Decimal);
}
// Constructs a Decimal from its constituent parts.
private Decimal(int lo, int mid, int hi, int flags)
{
if (IsValid(flags))
{
_lo64 = (uint)lo + ((ulong)(uint)mid << 32);
_hi32 = (uint)hi;
_flags = flags;
return;
}
throw new ArgumentException(SR.Arg_DecBitCtor);
}
private Decimal(in decimal d, int flags)
{
this = d;
_flags = flags;
}
/// <summary>
/// Gets the scaling factor of the decimal, which is a number from 0 to 28 that represents the number of decimal digits.
/// </summary>
public byte Scale => (byte)(_flags >> ScaleShift);
// Returns the absolute value of the given Decimal. If d is
// positive, the result is d. If d is negative, the result
// is -d.
//
internal static decimal Abs(in decimal d)
{
return new decimal(in d, d._flags & ~SignMask);
}
// Adds two Decimal values.
//
public static decimal Add(decimal d1, decimal d2)
{
DecCalc.DecAddSub(ref AsMutable(ref d1), ref AsMutable(ref d2), false);
return d1;
}
// Rounds a Decimal to an integer value. The Decimal argument is rounded
// towards positive infinity.
public static decimal Ceiling(decimal d)
{
int flags = d._flags;
if ((flags & ScaleMask) != 0)
DecCalc.InternalRound(ref AsMutable(ref d), (byte)(flags >> ScaleShift), MidpointRounding.ToPositiveInfinity);
return d;
}
// Compares two Decimal values, returning an integer that indicates their
// relationship.
//
public static int Compare(decimal d1, decimal d2)
{
return DecCalc.VarDecCmp(in d1, in d2);
}
// Compares this object to another object, returning an integer that
// indicates the relationship.
// Returns a value less than zero if this object
// null is considered to be less than any instance.
// If object is not of type Decimal, this method throws an ArgumentException.
//
public int CompareTo(object? value)
{
if (value == null)
return 1;
if (!(value is decimal))
throw new ArgumentException(SR.Arg_MustBeDecimal);
decimal other = (decimal)value;
return DecCalc.VarDecCmp(in this, in other);
}
public int CompareTo(decimal value)
{
return DecCalc.VarDecCmp(in this, in value);
}
// Divides two Decimal values.
//
public static decimal Divide(decimal d1, decimal d2)
{
DecCalc.VarDecDiv(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
// Checks if this Decimal is equal to a given object. Returns true
// if the given object is a boxed Decimal and its value is equal to the
// value of this Decimal. Returns false otherwise.
//
public override bool Equals([NotNullWhen(true)] object? value) =>
value is decimal other &&
DecCalc.VarDecCmp(in this, in other) == 0;
public bool Equals(decimal value) =>
DecCalc.VarDecCmp(in this, in value) == 0;
// Returns the hash code for this Decimal.
//
public override int GetHashCode() => DecCalc.GetHashCode(in this);
// Compares two Decimal values for equality. Returns true if the two
// Decimal values are equal, or false if they are not equal.
//
public static bool Equals(decimal d1, decimal d2)
{
return DecCalc.VarDecCmp(in d1, in d2) == 0;
}
// Rounds a Decimal to an integer value. The Decimal argument is rounded
// towards negative infinity.
//
public static decimal Floor(decimal d)
{
int flags = d._flags;
if ((flags & ScaleMask) != 0)
DecCalc.InternalRound(ref AsMutable(ref d), (byte)(flags >> ScaleShift), MidpointRounding.ToNegativeInfinity);
return d;
}
// Converts this Decimal to a string. The resulting string consists of an
// optional minus sign ("-") followed to a sequence of digits ("0" - "9"),
// optionally followed by a decimal point (".") and another sequence of
// digits.
//
public override string ToString()
{
return Number.FormatDecimal(this, null, NumberFormatInfo.CurrentInfo);
}
public string ToString(string? format)
{
return Number.FormatDecimal(this, format, NumberFormatInfo.CurrentInfo);
}
public string ToString(IFormatProvider? provider)
{
return Number.FormatDecimal(this, null, NumberFormatInfo.GetInstance(provider));
}
public string ToString(string? format, IFormatProvider? provider)
{
return Number.FormatDecimal(this, format, NumberFormatInfo.GetInstance(provider));
}
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
{
return Number.TryFormatDecimal(this, format, NumberFormatInfo.GetInstance(provider), destination, out charsWritten);
}
// Converts a string to a Decimal. The string must consist of an optional
// minus sign ("-") followed by a sequence of digits ("0" - "9"). The
// sequence of digits may optionally contain a single decimal point (".")
// character. Leading and trailing whitespace characters are allowed.
// Parse also allows a currency symbol, a trailing negative sign, and
// parentheses in the number.
//
public static decimal Parse(string s)
{
if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
return Number.ParseDecimal(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo);
}
public static decimal Parse(string s, NumberStyles style)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
return Number.ParseDecimal(s, style, NumberFormatInfo.CurrentInfo);
}
public static decimal Parse(string s, IFormatProvider? provider)
{
if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
return Number.ParseDecimal(s, NumberStyles.Number, NumberFormatInfo.GetInstance(provider));
}
public static decimal Parse(string s, NumberStyles style, IFormatProvider? provider)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
if (s == null) ThrowHelper.ThrowArgumentNullException(ExceptionArgument.s);
return Number.ParseDecimal(s, style, NumberFormatInfo.GetInstance(provider));
}
public static decimal Parse(ReadOnlySpan<char> s, NumberStyles style = NumberStyles.Number, IFormatProvider? provider = null)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
return Number.ParseDecimal(s, style, NumberFormatInfo.GetInstance(provider));
}
public static bool TryParse([NotNullWhen(true)] string? s, out decimal result)
{
if (s == null)
{
result = 0;
return false;
}
return Number.TryParseDecimal(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo, out result) == Number.ParsingStatus.OK;
}
public static bool TryParse(ReadOnlySpan<char> s, out decimal result)
{
return Number.TryParseDecimal(s, NumberStyles.Number, NumberFormatInfo.CurrentInfo, out result) == Number.ParsingStatus.OK;
}
public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out decimal result)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
if (s == null)
{
result = 0;
return false;
}
return Number.TryParseDecimal(s, style, NumberFormatInfo.GetInstance(provider), out result) == Number.ParsingStatus.OK;
}
public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out decimal result)
{
NumberFormatInfo.ValidateParseStyleFloatingPoint(style);
return Number.TryParseDecimal(s, style, NumberFormatInfo.GetInstance(provider), out result) == Number.ParsingStatus.OK;
}
// Returns a binary representation of a Decimal. The return value is an
// integer array with four elements. Elements 0, 1, and 2 contain the low,
// middle, and high 32 bits of the 96-bit integer part of the Decimal.
// Element 3 contains the scale factor and sign of the Decimal: bits 0-15
// (the lower word) are unused; bits 16-23 contain a value between 0 and
// 28, indicating the power of 10 to divide the 96-bit integer part by to
// produce the Decimal value; bits 24-30 are unused; and finally bit 31
// indicates the sign of the Decimal value, 0 meaning positive and 1
// meaning negative.
//
public static int[] GetBits(decimal d)
{
return new int[] { (int)d.Low, (int)d.Mid, (int)d.High, d._flags };
}
/// <summary>
/// Converts the value of a specified instance of <see cref="decimal"/> to its equivalent binary representation.
/// </summary>
/// <param name="d">The value to convert.</param>
/// <param name="destination">The span into which to store the four-integer binary representation.</param>
/// <returns>Four, the number of integers in the binary representation.</returns>
/// <exception cref="ArgumentException">The destination span was not long enough to store the binary representation.</exception>
public static int GetBits(decimal d, Span<int> destination)
{
if ((uint)destination.Length <= 3)
{
ThrowHelper.ThrowArgumentException_DestinationTooShort();
}
destination[0] = (int)d.Low;
destination[1] = (int)d.Mid;
destination[2] = (int)d.High;
destination[3] = d._flags;
return 4;
}
/// <summary>
/// Tries to convert the value of a specified instance of <see cref="decimal"/> to its equivalent binary representation.
/// </summary>
/// <param name="d">The value to convert.</param>
/// <param name="destination">The span into which to store the binary representation.</param>
/// <param name="valuesWritten">The number of integers written to the destination.</param>
/// <returns>true if the decimal's binary representation was written to the destination; false if the destination wasn't long enough.</returns>
public static bool TryGetBits(decimal d, Span<int> destination, out int valuesWritten)
{
if ((uint)destination.Length <= 3)
{
valuesWritten = 0;
return false;
}
destination[0] = (int)d.Low;
destination[1] = (int)d.Mid;
destination[2] = (int)d.High;
destination[3] = d._flags;
valuesWritten = 4;
return true;
}
internal static void GetBytes(in decimal d, Span<byte> buffer)
{
Debug.Assert(buffer.Length >= 16, "buffer.Length >= 16");
BinaryPrimitives.WriteInt32LittleEndian(buffer, (int)d.Low);
BinaryPrimitives.WriteInt32LittleEndian(buffer.Slice(4), (int)d.Mid);
BinaryPrimitives.WriteInt32LittleEndian(buffer.Slice(8), (int)d.High);
BinaryPrimitives.WriteInt32LittleEndian(buffer.Slice(12), d._flags);
}
internal static decimal ToDecimal(ReadOnlySpan<byte> span)
{
Debug.Assert(span.Length >= 16, "span.Length >= 16");
int lo = BinaryPrimitives.ReadInt32LittleEndian(span);
int mid = BinaryPrimitives.ReadInt32LittleEndian(span.Slice(4));
int hi = BinaryPrimitives.ReadInt32LittleEndian(span.Slice(8));
int flags = BinaryPrimitives.ReadInt32LittleEndian(span.Slice(12));
return new decimal(lo, mid, hi, flags);
}
// Returns the larger of two Decimal values.
//
internal static ref readonly decimal Max(in decimal d1, in decimal d2)
{
return ref DecCalc.VarDecCmp(in d1, in d2) >= 0 ? ref d1 : ref d2;
}
// Returns the smaller of two Decimal values.
//
internal static ref readonly decimal Min(in decimal d1, in decimal d2)
{
return ref DecCalc.VarDecCmp(in d1, in d2) < 0 ? ref d1 : ref d2;
}
public static decimal Remainder(decimal d1, decimal d2)
{
DecCalc.VarDecMod(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
// Multiplies two Decimal values.
//
public static decimal Multiply(decimal d1, decimal d2)
{
DecCalc.VarDecMul(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
// Returns the negated value of the given Decimal. If d is non-zero,
// the result is -d. If d is zero, the result is zero.
//
public static decimal Negate(decimal d)
{
return new decimal(in d, d._flags ^ SignMask);
}
// Rounds a Decimal value to a given number of decimal places. The value
// given by d is rounded to the number of decimal places given by
// decimals. The decimals argument must be an integer between
// 0 and 28 inclusive.
//
// By default a mid-point value is rounded to the nearest even number. If the mode is
// passed in, it can also round away from zero.
public static decimal Round(decimal d) => Round(ref d, 0, MidpointRounding.ToEven);
public static decimal Round(decimal d, int decimals) => Round(ref d, decimals, MidpointRounding.ToEven);
public static decimal Round(decimal d, MidpointRounding mode) => Round(ref d, 0, mode);
public static decimal Round(decimal d, int decimals, MidpointRounding mode) => Round(ref d, decimals, mode);
private static decimal Round(ref decimal d, int decimals, MidpointRounding mode)
{
if ((uint)decimals > 28)
throw new ArgumentOutOfRangeException(nameof(decimals), SR.ArgumentOutOfRange_DecimalRound);
if ((uint)mode > (uint)MidpointRounding.ToPositiveInfinity)
throw new ArgumentException(SR.Format(SR.Argument_InvalidEnumValue, mode, nameof(MidpointRounding)), nameof(mode));
int scale = d.Scale - decimals;
if (scale > 0)
DecCalc.InternalRound(ref AsMutable(ref d), (uint)scale, mode);
return d;
}
internal static int Sign(in decimal d) => (d.Low64 | d.High) == 0 ? 0 : (d._flags >> 31) | 1;
// Subtracts two Decimal values.
//
public static decimal Subtract(decimal d1, decimal d2)
{
DecCalc.DecAddSub(ref AsMutable(ref d1), ref AsMutable(ref d2), true);
return d1;
}
// Converts a Decimal to an unsigned byte. The Decimal value is rounded
// towards zero to the nearest integer value, and the result of this
// operation is returned as a byte.
//
public static byte ToByte(decimal value)
{
uint temp;
try
{
temp = ToUInt32(value);
}
catch (OverflowException)
{
Number.ThrowOverflowException(TypeCode.Byte);
throw;
}
if (temp != (byte)temp) Number.ThrowOverflowException(TypeCode.Byte);
return (byte)temp;
}
// Converts a Decimal to a signed byte. The Decimal value is rounded
// towards zero to the nearest integer value, and the result of this
// operation is returned as a byte.
//
[CLSCompliant(false)]
public static sbyte ToSByte(decimal value)
{
int temp;
try
{
temp = ToInt32(value);
}
catch (OverflowException)
{
Number.ThrowOverflowException(TypeCode.SByte);
throw;
}
if (temp != (sbyte)temp) Number.ThrowOverflowException(TypeCode.SByte);
return (sbyte)temp;
}
// Converts a Decimal to a short. The Decimal value is
// rounded towards zero to the nearest integer value, and the result of
// this operation is returned as a short.
//
public static short ToInt16(decimal value)
{
int temp;
try
{
temp = ToInt32(value);
}
catch (OverflowException)
{
Number.ThrowOverflowException(TypeCode.Int16);
throw;
}
if (temp != (short)temp) Number.ThrowOverflowException(TypeCode.Int16);
return (short)temp;
}
// Converts a Decimal to a double. Since a double has fewer significant
// digits than a Decimal, this operation may produce round-off errors.
//
public static double ToDouble(decimal d)
{
return DecCalc.VarR8FromDec(in d);
}
// Converts a Decimal to an integer. The Decimal value is rounded towards
// zero to the nearest integer value, and the result of this operation is
// returned as an integer.
//
public static int ToInt32(decimal d)
{
Truncate(ref d);
if ((d.High | d.Mid) == 0)
{
int i = (int)d.Low;
if (!d.IsNegative)
{
if (i >= 0) return i;
}
else
{
i = -i;
if (i <= 0) return i;
}
}
throw new OverflowException(SR.Overflow_Int32);
}
// Converts a Decimal to a long. The Decimal value is rounded towards zero
// to the nearest integer value, and the result of this operation is
// returned as a long.
//
public static long ToInt64(decimal d)
{
Truncate(ref d);
if (d.High == 0)
{
long l = (long)d.Low64;
if (!d.IsNegative)
{
if (l >= 0) return l;
}
else
{
l = -l;
if (l <= 0) return l;
}
}
throw new OverflowException(SR.Overflow_Int64);
}
// Converts a Decimal to an ushort. The Decimal
// value is rounded towards zero to the nearest integer value, and the
// result of this operation is returned as an ushort.
//
[CLSCompliant(false)]
public static ushort ToUInt16(decimal value)
{
uint temp;
try
{
temp = ToUInt32(value);
}
catch (OverflowException)
{
Number.ThrowOverflowException(TypeCode.UInt16);
throw;
}
if (temp != (ushort)temp) Number.ThrowOverflowException(TypeCode.UInt16);
return (ushort)temp;
}
// Converts a Decimal to an unsigned integer. The Decimal
// value is rounded towards zero to the nearest integer value, and the
// result of this operation is returned as an unsigned integer.
//
[CLSCompliant(false)]
public static uint ToUInt32(decimal d)
{
Truncate(ref d);
if ((d.High| d.Mid) == 0)
{
uint i = d.Low;
if (!d.IsNegative || i == 0)
return i;
}
throw new OverflowException(SR.Overflow_UInt32);
}
// Converts a Decimal to an unsigned long. The Decimal
// value is rounded towards zero to the nearest integer value, and the
// result of this operation is returned as a long.
//
[CLSCompliant(false)]
public static ulong ToUInt64(decimal d)
{
Truncate(ref d);
if (d.High == 0)
{
ulong l = d.Low64;
if (!d.IsNegative || l == 0)
return l;
}
throw new OverflowException(SR.Overflow_UInt64);
}
// Converts a Decimal to a float. Since a float has fewer significant
// digits than a Decimal, this operation may produce round-off errors.
//
public static float ToSingle(decimal d)
{
return DecCalc.VarR4FromDec(in d);
}
// Truncates a Decimal to an integer value. The Decimal argument is rounded
// towards zero to the nearest integer value, corresponding to removing all
// digits after the decimal point.
//
public static decimal Truncate(decimal d)
{
Truncate(ref d);
return d;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void Truncate(ref decimal d)
{
int flags = d._flags;
if ((flags & ScaleMask) != 0)
DecCalc.InternalRound(ref AsMutable(ref d), (byte)(flags >> ScaleShift), MidpointRounding.ToZero);
}
public static implicit operator decimal(byte value) => new decimal((uint)value);
[CLSCompliant(false)]
public static implicit operator decimal(sbyte value) => new decimal(value);
public static implicit operator decimal(short value) => new decimal(value);
[CLSCompliant(false)]
public static implicit operator decimal(ushort value) => new decimal((uint)value);
public static implicit operator decimal(char value) => new decimal((uint)value);
public static implicit operator decimal(int value) => new decimal(value);
[CLSCompliant(false)]
public static implicit operator decimal(uint value) => new decimal(value);
public static implicit operator decimal(long value) => new decimal(value);
[CLSCompliant(false)]
public static implicit operator decimal(ulong value) => new decimal(value);
public static explicit operator decimal(float value) => new decimal(value);
public static explicit operator decimal(double value) => new decimal(value);
public static explicit operator byte(decimal value) => ToByte(value);
[CLSCompliant(false)]
public static explicit operator sbyte(decimal value) => ToSByte(value);
public static explicit operator char(decimal value)
{
ushort temp;
try
{
temp = ToUInt16(value);
}
catch (OverflowException e)
{
throw new OverflowException(SR.Overflow_Char, e);
}
return (char)temp;
}
public static explicit operator short(decimal value) => ToInt16(value);
[CLSCompliant(false)]
public static explicit operator ushort(decimal value) => ToUInt16(value);
public static explicit operator int(decimal value) => ToInt32(value);
[CLSCompliant(false)]
public static explicit operator uint(decimal value) => ToUInt32(value);
public static explicit operator long(decimal value) => ToInt64(value);
[CLSCompliant(false)]
public static explicit operator ulong(decimal value) => ToUInt64(value);
public static explicit operator float(decimal value) => DecCalc.VarR4FromDec(in value);
public static explicit operator double(decimal value) => DecCalc.VarR8FromDec(in value);
public static decimal operator +(decimal d) => d;
public static decimal operator -(decimal d) => new decimal(in d, d._flags ^ SignMask);
public static decimal operator ++(decimal d) => Add(d, One);
public static decimal operator --(decimal d) => Subtract(d, One);
public static decimal operator +(decimal d1, decimal d2)
{
DecCalc.DecAddSub(ref AsMutable(ref d1), ref AsMutable(ref d2), false);
return d1;
}
public static decimal operator -(decimal d1, decimal d2)
{
DecCalc.DecAddSub(ref AsMutable(ref d1), ref AsMutable(ref d2), true);
return d1;
}
public static decimal operator *(decimal d1, decimal d2)
{
DecCalc.VarDecMul(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
public static decimal operator /(decimal d1, decimal d2)
{
DecCalc.VarDecDiv(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
public static decimal operator %(decimal d1, decimal d2)
{
DecCalc.VarDecMod(ref AsMutable(ref d1), ref AsMutable(ref d2));
return d1;
}
public static bool operator ==(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) == 0;
public static bool operator !=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) != 0;
public static bool operator <(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) < 0;
public static bool operator <=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) <= 0;
public static bool operator >(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) > 0;
public static bool operator >=(decimal d1, decimal d2) => DecCalc.VarDecCmp(in d1, in d2) >= 0;
//
// IConvertible implementation
//
public TypeCode GetTypeCode()
{
return TypeCode.Decimal;
}
bool IConvertible.ToBoolean(IFormatProvider? provider)
{
return Convert.ToBoolean(this);
}
char IConvertible.ToChar(IFormatProvider? provider)
{
throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "Char"));
}
sbyte IConvertible.ToSByte(IFormatProvider? provider)
{
return Convert.ToSByte(this);
}
byte IConvertible.ToByte(IFormatProvider? provider)
{
return Convert.ToByte(this);
}
short IConvertible.ToInt16(IFormatProvider? provider)
{
return Convert.ToInt16(this);
}
ushort IConvertible.ToUInt16(IFormatProvider? provider)
{
return Convert.ToUInt16(this);
}
int IConvertible.ToInt32(IFormatProvider? provider)
{
return Convert.ToInt32(this);
}
uint IConvertible.ToUInt32(IFormatProvider? provider)
{
return Convert.ToUInt32(this);
}
long IConvertible.ToInt64(IFormatProvider? provider)
{
return Convert.ToInt64(this);
}
ulong IConvertible.ToUInt64(IFormatProvider? provider)
{
return Convert.ToUInt64(this);
}
float IConvertible.ToSingle(IFormatProvider? provider)
{
return DecCalc.VarR4FromDec(in this);
}
double IConvertible.ToDouble(IFormatProvider? provider)
{
return DecCalc.VarR8FromDec(in this);
}
decimal IConvertible.ToDecimal(IFormatProvider? provider)
{
return this;
}
DateTime IConvertible.ToDateTime(IFormatProvider? provider)
{
throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "DateTime"));
}
object IConvertible.ToType(Type type, IFormatProvider? provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
}
#if FEATURE_GENERIC_MATH
//
// IAdditionOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IAdditionOperators<decimal, decimal, decimal>.operator +(decimal left, decimal right)
=> checked(left + right);
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IAdditionOperators<decimal, decimal, decimal>.operator +(decimal left, decimal right)
// => checked(left + right);
//
// IAdditiveIdentity
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IAdditiveIdentity<decimal, decimal>.AdditiveIdentity => 0.0m;
//
// IComparisonOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IComparisonOperators<decimal, decimal>.operator <(decimal left, decimal right)
=> left < right;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IComparisonOperators<decimal, decimal>.operator <=(decimal left, decimal right)
=> left <= right;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IComparisonOperators<decimal, decimal>.operator >(decimal left, decimal right)
=> left > right;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IComparisonOperators<decimal, decimal>.operator >=(decimal left, decimal right)
=> left >= right;
//
// IDecrementOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IDecrementOperators<decimal>.operator --(decimal value)
=> --value;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IDecrementOperators<decimal>.operator --(decimal value)
// => checked(--value);
//
// IDivisionOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IDivisionOperators<decimal, decimal, decimal>.operator /(decimal left, decimal right)
=> left / right;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IDivisionOperators<decimal, decimal, decimal>.operator /(decimal left, decimal right)
// => checked(left / right);
//
// IEqualityOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IEqualityOperators<decimal, decimal>.operator ==(decimal left, decimal right)
=> left == right;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IEqualityOperators<decimal, decimal>.operator !=(decimal left, decimal right)
=> left != right;
//
// IIncrementOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IIncrementOperators<decimal>.operator ++(decimal value)
=> ++value;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IIncrementOperators<decimal>.operator ++(decimal value)
// => checked(++value);
//
// IMinMaxValue
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IMinMaxValue<decimal>.MinValue => MinValue;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IMinMaxValue<decimal>.MaxValue => MaxValue;
//
// IModulusOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IModulusOperators<decimal, decimal, decimal>.operator %(decimal left, decimal right)
=> left % right;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IModulusOperators<decimal, decimal, decimal>.operator %(decimal left, decimal right)
// => checked(left % right);
//
// IMultiplicativeIdentity
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IMultiplicativeIdentity<decimal, decimal>.MultiplicativeIdentity => 1.0m;
//
// IMultiplyOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IMultiplyOperators<decimal, decimal, decimal>.operator *(decimal left, decimal right)
=> left * right;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IMultiplyOperators<decimal, decimal, decimal>.operator *(decimal left, decimal right)
// => checked(left * right);
//
// INumber
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.One => 1.0m;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Zero => 0.0m;
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Abs(decimal value)
=> Math.Abs(value);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static decimal INumber<decimal>.Create<TOther>(TOther value)
{
if (typeof(TOther) == typeof(byte))
{
return (byte)(object)value;
}
else if (typeof(TOther) == typeof(char))
{
return (char)(object)value;
}
else if (typeof(TOther) == typeof(decimal))
{
return (decimal)(object)value;
}
else if (typeof(TOther) == typeof(double))
{
return (decimal)(double)(object)value;
}
else if (typeof(TOther) == typeof(short))
{
return (short)(object)value;
}
else if (typeof(TOther) == typeof(int))
{
return (int)(object)value;
}
else if (typeof(TOther) == typeof(long))
{
return (long)(object)value;
}
else if (typeof(TOther) == typeof(nint))
{
return (nint)(object)value;
}
else if (typeof(TOther) == typeof(sbyte))
{
return (sbyte)(object)value;
}
else if (typeof(TOther) == typeof(float))
{
return (decimal)(float)(object)value;
}
else if (typeof(TOther) == typeof(ushort))
{
return (ushort)(object)value;
}
else if (typeof(TOther) == typeof(uint))
{
return (uint)(object)value;
}
else if (typeof(TOther) == typeof(ulong))
{
return (ulong)(object)value;
}
else if (typeof(TOther) == typeof(nuint))
{
return (nuint)(object)value;
}
else
{
ThrowHelper.ThrowNotSupportedException();
return default;
}
}
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static decimal INumber<decimal>.CreateSaturating<TOther>(TOther value)
{
if (typeof(TOther) == typeof(byte))
{
return (byte)(object)value;
}
else if (typeof(TOther) == typeof(char))
{
return (char)(object)value;
}
else if (typeof(TOther) == typeof(decimal))
{
return (decimal)(object)value;
}
else if (typeof(TOther) == typeof(double))
{
return (decimal)(double)(object)value;
}
else if (typeof(TOther) == typeof(short))
{
return (short)(object)value;
}
else if (typeof(TOther) == typeof(int))
{
return (int)(object)value;
}
else if (typeof(TOther) == typeof(long))
{
return (long)(object)value;
}
else if (typeof(TOther) == typeof(nint))
{
return (nint)(object)value;
}
else if (typeof(TOther) == typeof(sbyte))
{
return (sbyte)(object)value;
}
else if (typeof(TOther) == typeof(float))
{
return (decimal)(float)(object)value;
}
else if (typeof(TOther) == typeof(ushort))
{
return (ushort)(object)value;
}
else if (typeof(TOther) == typeof(uint))
{
return (uint)(object)value;
}
else if (typeof(TOther) == typeof(ulong))
{
return (ulong)(object)value;
}
else if (typeof(TOther) == typeof(nuint))
{
return (nuint)(object)value;
}
else
{
ThrowHelper.ThrowNotSupportedException();
return default;
}
}
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static decimal INumber<decimal>.CreateTruncating<TOther>(TOther value)
{
if (typeof(TOther) == typeof(byte))
{
return (byte)(object)value;
}
else if (typeof(TOther) == typeof(char))
{
return (char)(object)value;
}
else if (typeof(TOther) == typeof(decimal))
{
return (decimal)(object)value;
}
else if (typeof(TOther) == typeof(double))
{
return (decimal)(double)(object)value;
}
else if (typeof(TOther) == typeof(short))
{
return (short)(object)value;
}
else if (typeof(TOther) == typeof(int))
{
return (int)(object)value;
}
else if (typeof(TOther) == typeof(long))
{
return (long)(object)value;
}
else if (typeof(TOther) == typeof(nint))
{
return (nint)(object)value;
}
else if (typeof(TOther) == typeof(sbyte))
{
return (sbyte)(object)value;
}
else if (typeof(TOther) == typeof(float))
{
return (decimal)(float)(object)value;
}
else if (typeof(TOther) == typeof(ushort))
{
return (ushort)(object)value;
}
else if (typeof(TOther) == typeof(uint))
{
return (uint)(object)value;
}
else if (typeof(TOther) == typeof(ulong))
{
return (ulong)(object)value;
}
else if (typeof(TOther) == typeof(nuint))
{
return (nuint)(object)value;
}
else
{
ThrowHelper.ThrowNotSupportedException();
return default;
}
}
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Clamp(decimal value, decimal min, decimal max)
=> Math.Clamp(value, min, max);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static (decimal Quotient, decimal Remainder) INumber<decimal>.DivRem(decimal left, decimal right)
=> (left / right, left % right);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Max(decimal x, decimal y)
=> Math.Max(x, y);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Min(decimal x, decimal y)
=> Math.Min(x, y);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Parse(string s, NumberStyles style, IFormatProvider? provider)
=> Parse(s, style, provider);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider)
=> Parse(s, style, provider);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal INumber<decimal>.Sign(decimal value)
=> Math.Sign(value);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static bool INumber<decimal>.TryCreate<TOther>(TOther value, out decimal result)
{
if (typeof(TOther) == typeof(byte))
{
result = (byte)(object)value;
return true;
}
else if (typeof(TOther) == typeof(char))
{
result = (char)(object)value;
return true;
}
else if (typeof(TOther) == typeof(decimal))
{
result = (decimal)(object)value;
return true;
}
else if (typeof(TOther) == typeof(double))
{
result = (decimal)(double)(object)value;
return true;
}
else if (typeof(TOther) == typeof(short))
{
result = (short)(object)value;
return true;
}
else if (typeof(TOther) == typeof(int))
{
result = (int)(object)value;
return true;
}
else if (typeof(TOther) == typeof(long))
{
result = (long)(object)value;
return true;
}
else if (typeof(TOther) == typeof(nint))
{
result = (nint)(object)value;
return true;
}
else if (typeof(TOther) == typeof(sbyte))
{
result = (sbyte)(object)value;
return true;
}
else if (typeof(TOther) == typeof(float))
{
result = (decimal)(float)(object)value;
return true;
}
else if (typeof(TOther) == typeof(ushort))
{
result = (ushort)(object)value;
return true;
}
else if (typeof(TOther) == typeof(uint))
{
result = (uint)(object)value;
return true;
}
else if (typeof(TOther) == typeof(ulong))
{
result = (ulong)(object)value;
return true;
}
else if (typeof(TOther) == typeof(nuint))
{
result = (nuint)(object)value;
return true;
}
else
{
ThrowHelper.ThrowNotSupportedException();
result = default;
return false;
}
}
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool INumber<decimal>.TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out decimal result)
=> TryParse(s, style, provider, out result);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool INumber<decimal>.TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out decimal result)
=> TryParse(s, style, provider, out result);
//
// IParseable
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IParseable<decimal>.Parse(string s, IFormatProvider? provider)
=> Parse(s, provider);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool IParseable<decimal>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out decimal result)
=> TryParse(s, NumberStyles.Number, provider, out result);
//
// ISignedNumber
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal ISignedNumber<decimal>.NegativeOne => -1;
//
// ISpanParseable
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal ISpanParseable<decimal>.Parse(ReadOnlySpan<char> s, IFormatProvider? provider)
=> Parse(s, NumberStyles.Number, provider);
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static bool ISpanParseable<decimal>.TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out decimal result)
=> TryParse(s, NumberStyles.Number, provider, out result);
//
// ISubtractionOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal ISubtractionOperators<decimal, decimal, decimal>.operator -(decimal left, decimal right)
=> left - right;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal ISubtractionOperators<decimal, decimal, decimal>.operator -(decimal left, decimal right)
// => checked(left - right);
//
// IUnaryNegationOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IUnaryNegationOperators<decimal, decimal>.operator -(decimal value)
=> -value;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IUnaryNegationOperators<decimal, decimal>.operator -(decimal value)
// => checked(-value);
//
// IUnaryPlusOperators
//
[RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
static decimal IUnaryPlusOperators<decimal, decimal>.operator +(decimal value)
=> +value;
// [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)]
// static checked decimal IUnaryPlusOperators<decimal, decimal>.operator +(decimal value)
// => checked(+value);
#endif // FEATURE_GENERIC_MATH
}
}
| 1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Runtime/ref/System.Runtime.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace Microsoft.Win32.SafeHandles
{
public abstract partial class CriticalHandleMinusOneIsInvalid : System.Runtime.InteropServices.CriticalHandle
{
protected CriticalHandleMinusOneIsInvalid() : base (default(System.IntPtr)) { }
public override bool IsInvalid { get { throw null; } }
}
public abstract partial class CriticalHandleZeroOrMinusOneIsInvalid : System.Runtime.InteropServices.CriticalHandle
{
protected CriticalHandleZeroOrMinusOneIsInvalid() : base (default(System.IntPtr)) { }
public override bool IsInvalid { get { throw null; } }
}
public sealed partial class SafeFileHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
public SafeFileHandle() : base (default(bool)) { }
public SafeFileHandle(System.IntPtr preexistingHandle, bool ownsHandle) : base (default(bool)) { }
public override bool IsInvalid { get { throw null; } }
public bool IsAsync { get { throw null; } }
protected override bool ReleaseHandle() { throw null; }
}
public abstract partial class SafeHandleMinusOneIsInvalid : System.Runtime.InteropServices.SafeHandle
{
protected SafeHandleMinusOneIsInvalid(bool ownsHandle) : base (default(System.IntPtr), default(bool)) { }
public override bool IsInvalid { get { throw null; } }
}
public abstract partial class SafeHandleZeroOrMinusOneIsInvalid : System.Runtime.InteropServices.SafeHandle
{
protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base (default(System.IntPtr), default(bool)) { }
public override bool IsInvalid { get { throw null; } }
}
public sealed partial class SafeWaitHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
public SafeWaitHandle() : base (default(bool)) { }
public SafeWaitHandle(System.IntPtr existingHandle, bool ownsHandle) : base (default(bool)) { }
protected override bool ReleaseHandle() { throw null; }
}
}
namespace System
{
public partial class AccessViolationException : System.SystemException
{
public AccessViolationException() { }
protected AccessViolationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public AccessViolationException(string? message) { }
public AccessViolationException(string? message, System.Exception? innerException) { }
}
public delegate void Action();
public delegate void Action<in T>(T obj);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, in T16>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16);
public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
public delegate void Action<in T1, in T2, in T3>(T1 arg1, T2 arg2, T3 arg3);
public delegate void Action<in T1, in T2, in T3, in T4>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
public delegate void Action<in T1, in T2, in T3, in T4, in T5>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
public static partial class Activator
{
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName, object?[]? activationAttributes) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] System.Type type) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, bool nonPublic) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, params object?[]? args) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, object?[]? args, object?[]? activationAttributes) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName, object?[]? activationAttributes) { throw null; }
public static T CreateInstance<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T>() { throw null; }
}
public partial class AggregateException : System.Exception
{
public AggregateException() { }
public AggregateException(System.Collections.Generic.IEnumerable<System.Exception> innerExceptions) { }
public AggregateException(params System.Exception[] innerExceptions) { }
protected AggregateException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public AggregateException(string? message) { }
public AggregateException(string? message, System.Collections.Generic.IEnumerable<System.Exception> innerExceptions) { }
public AggregateException(string? message, System.Exception innerException) { }
public AggregateException(string? message, params System.Exception[] innerExceptions) { }
public System.Collections.ObjectModel.ReadOnlyCollection<System.Exception> InnerExceptions { get { throw null; } }
public override string Message { get { throw null; } }
public System.AggregateException Flatten() { throw null; }
public override System.Exception GetBaseException() { throw null; }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public void Handle(System.Func<System.Exception, bool> predicate) { }
public override string ToString() { throw null; }
}
public static partial class AppContext
{
public static string BaseDirectory { get { throw null; } }
public static string? TargetFrameworkName { get { throw null; } }
public static object? GetData(string name) { throw null; }
public static void SetData(string name, object? data) { }
public static void SetSwitch(string switchName, bool isEnabled) { }
public static bool TryGetSwitch(string switchName, out bool isEnabled) { throw null; }
}
public sealed partial class AppDomain : System.MarshalByRefObject
{
internal AppDomain() { }
public string BaseDirectory { get { throw null; } }
public static System.AppDomain CurrentDomain { get { throw null; } }
public string? DynamicDirectory { get { throw null; } }
public string FriendlyName { get { throw null; } }
public int Id { get { throw null; } }
public bool IsFullyTrusted { get { throw null; } }
public bool IsHomogenous { get { throw null; } }
public static bool MonitoringIsEnabled { get { throw null; } set { } }
public long MonitoringSurvivedMemorySize { get { throw null; } }
public static long MonitoringSurvivedProcessMemorySize { get { throw null; } }
public long MonitoringTotalAllocatedMemorySize { get { throw null; } }
public System.TimeSpan MonitoringTotalProcessorTime { get { throw null; } }
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Security.PermissionSet PermissionSet { get { throw null; } }
public string? RelativeSearchPath { get { throw null; } }
public System.AppDomainSetup SetupInformation { get { throw null; } }
public bool ShadowCopyFiles { get { throw null; } }
public event System.AssemblyLoadEventHandler? AssemblyLoad { add { } remove { } }
public event System.ResolveEventHandler? AssemblyResolve { add { } remove { } }
public event System.EventHandler? DomainUnload { add { } remove { } }
public event System.EventHandler<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>? FirstChanceException { add { } remove { } }
public event System.EventHandler? ProcessExit { add { } remove { } }
public event System.ResolveEventHandler? ReflectionOnlyAssemblyResolve { add { } remove { } }
public event System.ResolveEventHandler? ResourceResolve { add { } remove { } }
public event System.ResolveEventHandler? TypeResolve { add { } remove { } }
public event System.UnhandledExceptionEventHandler? UnhandledException { add { } remove { } }
[System.ObsoleteAttribute("AppDomain.AppendPrivatePath has been deprecated and is not supported.")]
public void AppendPrivatePath(string? path) { }
public string ApplyPolicy(string assemblyName) { throw null; }
[System.ObsoleteAttribute("AppDomain.ClearPrivatePath has been deprecated and is not supported.")]
public void ClearPrivatePath() { }
[System.ObsoleteAttribute("AppDomain.ClearShadowCopyPath has been deprecated and is not supported.")]
public void ClearShadowCopyPath() { }
[System.ObsoleteAttribute("Creating and unloading AppDomains is not supported and throws an exception.", DiagnosticId = "SYSLIB0024", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static System.AppDomain CreateDomain(string friendlyName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceAndUnwrap(string assemblyName, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceAndUnwrap(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceAndUnwrap(string assemblyName, string typeName, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public int ExecuteAssembly(string assemblyFile) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public int ExecuteAssembly(string assemblyFile, string?[]? args) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public int ExecuteAssembly(string assemblyFile, string?[]? args, byte[]? hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm) { throw null; }
public int ExecuteAssemblyByName(System.Reflection.AssemblyName assemblyName, params string?[]? args) { throw null; }
public int ExecuteAssemblyByName(string assemblyName) { throw null; }
public int ExecuteAssemblyByName(string assemblyName, params string?[]? args) { throw null; }
public System.Reflection.Assembly[] GetAssemblies() { throw null; }
[System.ObsoleteAttribute("AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread instead.")]
public static int GetCurrentThreadId() { throw null; }
public object? GetData(string name) { throw null; }
public bool? IsCompatibilitySwitchSet(string value) { throw null; }
public bool IsDefaultAppDomain() { throw null; }
public bool IsFinalizingForUnload() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public System.Reflection.Assembly Load(byte[] rawAssembly) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public System.Reflection.Assembly Load(byte[] rawAssembly, byte[]? rawSymbolStore) { throw null; }
public System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyRef) { throw null; }
public System.Reflection.Assembly Load(string assemblyString) { throw null; }
public System.Reflection.Assembly[] ReflectionOnlyGetAssemblies() { throw null; }
[System.ObsoleteAttribute("AppDomain.SetCachePath has been deprecated and is not supported.")]
public void SetCachePath(string? path) { }
public void SetData(string name, object? data) { }
[System.ObsoleteAttribute("AppDomain.SetDynamicBase has been deprecated and is not supported.")]
public void SetDynamicBase(string? path) { }
public void SetPrincipalPolicy(System.Security.Principal.PrincipalPolicy policy) { }
[System.ObsoleteAttribute("AppDomain.SetShadowCopyFiles has been deprecated and is not supported.")]
public void SetShadowCopyFiles() { }
[System.ObsoleteAttribute("AppDomain.SetShadowCopyPath has been deprecated and is not supported.")]
public void SetShadowCopyPath(string? path) { }
public void SetThreadPrincipal(System.Security.Principal.IPrincipal principal) { }
public override string ToString() { throw null; }
[System.ObsoleteAttribute("Creating and unloading AppDomains is not supported and throws an exception.", DiagnosticId = "SYSLIB0024", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void Unload(System.AppDomain domain) { }
}
public sealed partial class AppDomainSetup
{
internal AppDomainSetup() { }
public string? ApplicationBase { get { throw null; } }
public string? TargetFrameworkName { get { throw null; } }
}
public partial class AppDomainUnloadedException : System.SystemException
{
public AppDomainUnloadedException() { }
protected AppDomainUnloadedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public AppDomainUnloadedException(string? message) { }
public AppDomainUnloadedException(string? message, System.Exception? innerException) { }
}
public partial class ApplicationException : System.Exception
{
public ApplicationException() { }
protected ApplicationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ApplicationException(string? message) { }
public ApplicationException(string? message, System.Exception? innerException) { }
}
public sealed partial class ApplicationId
{
public ApplicationId(byte[] publicKeyToken, string name, System.Version version, string? processorArchitecture, string? culture) { }
public string? Culture { get { throw null; } }
public string Name { get { throw null; } }
public string? ProcessorArchitecture { get { throw null; } }
public byte[] PublicKeyToken { get { throw null; } }
public System.Version Version { get { throw null; } }
public System.ApplicationId Copy() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public ref partial struct ArgIterator
{
private int _dummyPrimitive;
public ArgIterator(System.RuntimeArgumentHandle arglist) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe ArgIterator(System.RuntimeArgumentHandle arglist, void* ptr) { throw null; }
public void End() { }
public override bool Equals(object? o) { throw null; }
public override int GetHashCode() { throw null; }
[System.CLSCompliantAttribute(false)]
public System.TypedReference GetNextArg() { throw null; }
[System.CLSCompliantAttribute(false)]
public System.TypedReference GetNextArg(System.RuntimeTypeHandle rth) { throw null; }
public System.RuntimeTypeHandle GetNextArgType() { throw null; }
public int GetRemainingCount() { throw null; }
}
public partial class ArgumentException : System.SystemException
{
public ArgumentException() { }
protected ArgumentException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArgumentException(string? message) { }
public ArgumentException(string? message, System.Exception? innerException) { }
public ArgumentException(string? message, string? paramName) { }
public ArgumentException(string? message, string? paramName, System.Exception? innerException) { }
public override string Message { get { throw null; } }
public virtual string? ParamName { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static void ThrowIfNullOrEmpty([System.Diagnostics.CodeAnalysis.NotNullAttribute] string? argument, [System.Runtime.CompilerServices.CallerArgumentExpression("argument")] string? paramName = null) { throw null; }
}
public partial class ArgumentNullException : System.ArgumentException
{
public ArgumentNullException() { }
protected ArgumentNullException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArgumentNullException(string? paramName) { }
public ArgumentNullException(string? message, System.Exception? innerException) { }
public ArgumentNullException(string? paramName, string? message) { }
public static void ThrowIfNull([System.Diagnostics.CodeAnalysis.NotNullAttribute] object? argument, [System.Runtime.CompilerServices.CallerArgumentExpressionAttribute("argument")] string? paramName = null) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void ThrowIfNull([System.Diagnostics.CodeAnalysis.NotNullAttribute] void* argument, [System.Runtime.CompilerServices.CallerArgumentExpressionAttribute("argument")] string? paramName = null) { throw null; }
}
public partial class ArgumentOutOfRangeException : System.ArgumentException
{
public ArgumentOutOfRangeException() { }
protected ArgumentOutOfRangeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArgumentOutOfRangeException(string? paramName) { }
public ArgumentOutOfRangeException(string? message, System.Exception? innerException) { }
public ArgumentOutOfRangeException(string? paramName, object? actualValue, string? message) { }
public ArgumentOutOfRangeException(string? paramName, string? message) { }
public virtual object? ActualValue { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class ArithmeticException : System.SystemException
{
public ArithmeticException() { }
protected ArithmeticException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArithmeticException(string? message) { }
public ArithmeticException(string? message, System.Exception? innerException) { }
}
public abstract partial class Array : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.ICloneable
{
internal Array() { }
public bool IsFixedSize { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public bool IsSynchronized { get { throw null; } }
public int Length { get { throw null; } }
public long LongLength { get { throw null; } }
public static int MaxLength { get { throw null; } }
public int Rank { get { throw null; } }
public object SyncRoot { get { throw null; } }
int System.Collections.ICollection.Count { get { throw null; } }
object? System.Collections.IList.this[int index] { get { throw null; } set { } }
public static System.Collections.ObjectModel.ReadOnlyCollection<T> AsReadOnly<T>(T[] array) { throw null; }
public static int BinarySearch(System.Array array, int index, int length, object? value) { throw null; }
public static int BinarySearch(System.Array array, int index, int length, object? value, System.Collections.IComparer? comparer) { throw null; }
public static int BinarySearch(System.Array array, object? value) { throw null; }
public static int BinarySearch(System.Array array, object? value, System.Collections.IComparer? comparer) { throw null; }
public static int BinarySearch<T>(T[] array, int index, int length, T value) { throw null; }
public static int BinarySearch<T>(T[] array, int index, int length, T value, System.Collections.Generic.IComparer<T>? comparer) { throw null; }
public static int BinarySearch<T>(T[] array, T value) { throw null; }
public static int BinarySearch<T>(T[] array, T value, System.Collections.Generic.IComparer<T>? comparer) { throw null; }
public static void Clear(System.Array array) { }
public static void Clear(System.Array array, int index, int length) { }
public object Clone() { throw null; }
public static void ConstrainedCopy(System.Array sourceArray, int sourceIndex, System.Array destinationArray, int destinationIndex, int length) { }
public static TOutput[] ConvertAll<TInput, TOutput>(TInput[] array, System.Converter<TInput, TOutput> converter) { throw null; }
public static void Copy(System.Array sourceArray, System.Array destinationArray, int length) { }
public static void Copy(System.Array sourceArray, System.Array destinationArray, long length) { }
public static void Copy(System.Array sourceArray, int sourceIndex, System.Array destinationArray, int destinationIndex, int length) { }
public static void Copy(System.Array sourceArray, long sourceIndex, System.Array destinationArray, long destinationIndex, long length) { }
public void CopyTo(System.Array array, int index) { }
public void CopyTo(System.Array array, long index) { }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public static System.Array CreateInstance(System.Type elementType, int length) { throw null; }
public static System.Array CreateInstance(System.Type elementType, int length1, int length2) { throw null; }
public static System.Array CreateInstance(System.Type elementType, int length1, int length2, int length3) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public static System.Array CreateInstance(System.Type elementType, params int[] lengths) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public static System.Array CreateInstance(System.Type elementType, int[] lengths, int[] lowerBounds) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public static System.Array CreateInstance(System.Type elementType, params long[] lengths) { throw null; }
public static T[] Empty<T>() { throw null; }
public static bool Exists<T>(T[] array, System.Predicate<T> match) { throw null; }
public static void Fill<T>(T[] array, T value) { }
public static void Fill<T>(T[] array, T value, int startIndex, int count) { }
public static T[] FindAll<T>(T[] array, System.Predicate<T> match) { throw null; }
public static int FindIndex<T>(T[] array, int startIndex, int count, System.Predicate<T> match) { throw null; }
public static int FindIndex<T>(T[] array, int startIndex, System.Predicate<T> match) { throw null; }
public static int FindIndex<T>(T[] array, System.Predicate<T> match) { throw null; }
public static int FindLastIndex<T>(T[] array, int startIndex, int count, System.Predicate<T> match) { throw null; }
public static int FindLastIndex<T>(T[] array, int startIndex, System.Predicate<T> match) { throw null; }
public static int FindLastIndex<T>(T[] array, System.Predicate<T> match) { throw null; }
public static T? FindLast<T>(T[] array, System.Predicate<T> match) { throw null; }
public static T? Find<T>(T[] array, System.Predicate<T> match) { throw null; }
public static void ForEach<T>(T[] array, System.Action<T> action) { }
public System.Collections.IEnumerator GetEnumerator() { throw null; }
public int GetLength(int dimension) { throw null; }
public long GetLongLength(int dimension) { throw null; }
public int GetLowerBound(int dimension) { throw null; }
public int GetUpperBound(int dimension) { throw null; }
public object? GetValue(int index) { throw null; }
public object? GetValue(int index1, int index2) { throw null; }
public object? GetValue(int index1, int index2, int index3) { throw null; }
public object? GetValue(params int[] indices) { throw null; }
public object? GetValue(long index) { throw null; }
public object? GetValue(long index1, long index2) { throw null; }
public object? GetValue(long index1, long index2, long index3) { throw null; }
public object? GetValue(params long[] indices) { throw null; }
public static int IndexOf(System.Array array, object? value) { throw null; }
public static int IndexOf(System.Array array, object? value, int startIndex) { throw null; }
public static int IndexOf(System.Array array, object? value, int startIndex, int count) { throw null; }
public static int IndexOf<T>(T[] array, T value) { throw null; }
public static int IndexOf<T>(T[] array, T value, int startIndex) { throw null; }
public static int IndexOf<T>(T[] array, T value, int startIndex, int count) { throw null; }
public void Initialize() { }
public static int LastIndexOf(System.Array array, object? value) { throw null; }
public static int LastIndexOf(System.Array array, object? value, int startIndex) { throw null; }
public static int LastIndexOf(System.Array array, object? value, int startIndex, int count) { throw null; }
public static int LastIndexOf<T>(T[] array, T value) { throw null; }
public static int LastIndexOf<T>(T[] array, T value, int startIndex) { throw null; }
public static int LastIndexOf<T>(T[] array, T value, int startIndex, int count) { throw null; }
public static void Resize<T>([System.Diagnostics.CodeAnalysis.NotNullAttribute] ref T[]? array, int newSize) { throw null; }
public static void Reverse(System.Array array) { }
public static void Reverse(System.Array array, int index, int length) { }
public static void Reverse<T>(T[] array) { }
public static void Reverse<T>(T[] array, int index, int length) { }
public void SetValue(object? value, int index) { }
public void SetValue(object? value, int index1, int index2) { }
public void SetValue(object? value, int index1, int index2, int index3) { }
public void SetValue(object? value, params int[] indices) { }
public void SetValue(object? value, long index) { }
public void SetValue(object? value, long index1, long index2) { }
public void SetValue(object? value, long index1, long index2, long index3) { }
public void SetValue(object? value, params long[] indices) { }
public static void Sort(System.Array array) { }
public static void Sort(System.Array keys, System.Array? items) { }
public static void Sort(System.Array keys, System.Array? items, System.Collections.IComparer? comparer) { }
public static void Sort(System.Array keys, System.Array? items, int index, int length) { }
public static void Sort(System.Array keys, System.Array? items, int index, int length, System.Collections.IComparer? comparer) { }
public static void Sort(System.Array array, System.Collections.IComparer? comparer) { }
public static void Sort(System.Array array, int index, int length) { }
public static void Sort(System.Array array, int index, int length, System.Collections.IComparer? comparer) { }
public static void Sort<T>(T[] array) { }
public static void Sort<T>(T[] array, System.Collections.Generic.IComparer<T>? comparer) { }
public static void Sort<T>(T[] array, System.Comparison<T> comparison) { }
public static void Sort<T>(T[] array, int index, int length) { }
public static void Sort<T>(T[] array, int index, int length, System.Collections.Generic.IComparer<T>? comparer) { }
public static void Sort<TKey, TValue>(TKey[] keys, TValue[]? items) { }
public static void Sort<TKey, TValue>(TKey[] keys, TValue[]? items, System.Collections.Generic.IComparer<TKey>? comparer) { }
public static void Sort<TKey, TValue>(TKey[] keys, TValue[]? items, int index, int length) { }
public static void Sort<TKey, TValue>(TKey[] keys, TValue[]? items, int index, int length, System.Collections.Generic.IComparer<TKey>? comparer) { }
int System.Collections.IList.Add(object? value) { throw null; }
void System.Collections.IList.Clear() { }
bool System.Collections.IList.Contains(object? value) { throw null; }
int System.Collections.IList.IndexOf(object? value) { throw null; }
void System.Collections.IList.Insert(int index, object? value) { }
void System.Collections.IList.Remove(object? value) { }
void System.Collections.IList.RemoveAt(int index) { }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
public static bool TrueForAll<T>(T[] array, System.Predicate<T> match) { throw null; }
}
public readonly partial struct ArraySegment<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.IEnumerable
{
private readonly T[] _array;
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ArraySegment(T[] array) { throw null; }
public ArraySegment(T[] array, int offset, int count) { throw null; }
public T[]? Array { get { throw null; } }
public int Count { get { throw null; } }
public static System.ArraySegment<T> Empty { get { throw null; } }
public T this[int index] { get { throw null; } set { } }
public int Offset { get { throw null; } }
bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
T System.Collections.Generic.IList<T>.this[int index] { get { throw null; } set { } }
T System.Collections.Generic.IReadOnlyList<T>.this[int index] { get { throw null; } }
public void CopyTo(System.ArraySegment<T> destination) { }
public void CopyTo(T[] destination) { }
public void CopyTo(T[] destination, int destinationIndex) { }
public bool Equals(System.ArraySegment<T> obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public System.ArraySegment<T>.Enumerator GetEnumerator() { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.ArraySegment<T> a, System.ArraySegment<T> b) { throw null; }
public static implicit operator System.ArraySegment<T> (T[] array) { throw null; }
public static bool operator !=(System.ArraySegment<T> a, System.ArraySegment<T> b) { throw null; }
public System.ArraySegment<T> Slice(int index) { throw null; }
public System.ArraySegment<T> Slice(int index, int count) { throw null; }
void System.Collections.Generic.ICollection<T>.Add(T item) { }
void System.Collections.Generic.ICollection<T>.Clear() { }
bool System.Collections.Generic.ICollection<T>.Contains(T item) { throw null; }
bool System.Collections.Generic.ICollection<T>.Remove(T item) { throw null; }
System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerable<T>.GetEnumerator() { throw null; }
int System.Collections.Generic.IList<T>.IndexOf(T item) { throw null; }
void System.Collections.Generic.IList<T>.Insert(int index, T item) { }
void System.Collections.Generic.IList<T>.RemoveAt(int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public T[] ToArray() { throw null; }
public partial struct Enumerator : System.Collections.Generic.IEnumerator<T>, System.Collections.IEnumerator, System.IDisposable
{
private readonly T[] _array;
private object _dummy;
private int _dummyPrimitive;
public T Current { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
public void Dispose() { }
public bool MoveNext() { throw null; }
void System.Collections.IEnumerator.Reset() { }
}
}
public partial class ArrayTypeMismatchException : System.SystemException
{
public ArrayTypeMismatchException() { }
protected ArrayTypeMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArrayTypeMismatchException(string? message) { }
public ArrayTypeMismatchException(string? message, System.Exception? innerException) { }
}
public partial class AssemblyLoadEventArgs : System.EventArgs
{
public AssemblyLoadEventArgs(System.Reflection.Assembly loadedAssembly) { }
public System.Reflection.Assembly LoadedAssembly { get { throw null; } }
}
public delegate void AssemblyLoadEventHandler(object? sender, System.AssemblyLoadEventArgs args);
public delegate void AsyncCallback(System.IAsyncResult ar);
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=true, AllowMultiple=false)]
public abstract partial class Attribute
{
protected Attribute() { }
public virtual object TypeId { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.Module element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, System.Type attributeType) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public override int GetHashCode() { throw null; }
public virtual bool IsDefaultAttribute() { throw null; }
public static bool IsDefined(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static bool IsDefined(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
public static bool IsDefined(System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static bool IsDefined(System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static bool IsDefined(System.Reflection.Module element, System.Type attributeType) { throw null; }
public static bool IsDefined(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
public static bool IsDefined(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static bool IsDefined(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public virtual bool Match(object? obj) { throw null; }
}
[System.FlagsAttribute]
public enum AttributeTargets
{
Assembly = 1,
Module = 2,
Class = 4,
Struct = 8,
Enum = 16,
Constructor = 32,
Method = 64,
Property = 128,
Field = 256,
Event = 512,
Interface = 1024,
Parameter = 2048,
Delegate = 4096,
ReturnValue = 8192,
GenericParameter = 16384,
All = 32767,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class, Inherited=true)]
public sealed partial class AttributeUsageAttribute : System.Attribute
{
public AttributeUsageAttribute(System.AttributeTargets validOn) { }
public bool AllowMultiple { get { throw null; } set { } }
public bool Inherited { get { throw null; } set { } }
public System.AttributeTargets ValidOn { get { throw null; } }
}
public partial class BadImageFormatException : System.SystemException
{
public BadImageFormatException() { }
protected BadImageFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public BadImageFormatException(string? message) { }
public BadImageFormatException(string? message, System.Exception? inner) { }
public BadImageFormatException(string? message, string? fileName) { }
public BadImageFormatException(string? message, string? fileName, System.Exception? inner) { }
public string? FileName { get { throw null; } }
public string? FusionLog { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum Base64FormattingOptions
{
None = 0,
InsertLineBreaks = 1,
}
public static partial class BitConverter
{
public static readonly bool IsLittleEndian;
public static long DoubleToInt64Bits(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong DoubleToUInt64Bits(double value) { throw null; }
public static byte[] GetBytes(bool value) { throw null; }
public static byte[] GetBytes(char value) { throw null; }
public static byte[] GetBytes(double value) { throw null; }
public static byte[] GetBytes(System.Half value) { throw null; }
public static byte[] GetBytes(short value) { throw null; }
public static byte[] GetBytes(int value) { throw null; }
public static byte[] GetBytes(long value) { throw null; }
public static byte[] GetBytes(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte[] GetBytes(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte[] GetBytes(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte[] GetBytes(ulong value) { throw null; }
public static short HalfToInt16Bits(System.Half value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort HalfToUInt16Bits(System.Half value) { throw null; }
public static System.Half Int16BitsToHalf(short value) { throw null; }
public static float Int32BitsToSingle(int value) { throw null; }
public static double Int64BitsToDouble(long value) { throw null; }
public static int SingleToInt32Bits(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint SingleToUInt32Bits(float value) { throw null; }
public static bool ToBoolean(byte[] value, int startIndex) { throw null; }
public static bool ToBoolean(System.ReadOnlySpan<byte> value) { throw null; }
public static char ToChar(byte[] value, int startIndex) { throw null; }
public static char ToChar(System.ReadOnlySpan<byte> value) { throw null; }
public static double ToDouble(byte[] value, int startIndex) { throw null; }
public static double ToDouble(System.ReadOnlySpan<byte> value) { throw null; }
public static System.Half ToHalf(byte[] value, int startIndex) { throw null; }
public static System.Half ToHalf(System.ReadOnlySpan<byte> value) { throw null; }
public static short ToInt16(byte[] value, int startIndex) { throw null; }
public static short ToInt16(System.ReadOnlySpan<byte> value) { throw null; }
public static int ToInt32(byte[] value, int startIndex) { throw null; }
public static int ToInt32(System.ReadOnlySpan<byte> value) { throw null; }
public static long ToInt64(byte[] value, int startIndex) { throw null; }
public static long ToInt64(System.ReadOnlySpan<byte> value) { throw null; }
public static float ToSingle(byte[] value, int startIndex) { throw null; }
public static float ToSingle(System.ReadOnlySpan<byte> value) { throw null; }
public static string ToString(byte[] value) { throw null; }
public static string ToString(byte[] value, int startIndex) { throw null; }
public static string ToString(byte[] value, int startIndex, int length) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(byte[] value, int startIndex) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(System.ReadOnlySpan<byte> value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(byte[] value, int startIndex) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(System.ReadOnlySpan<byte> value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(byte[] value, int startIndex) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(System.ReadOnlySpan<byte> value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, bool value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, char value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, double value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, System.Half value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, short value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, int value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, long value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool TryWriteBytes(System.Span<byte> destination, ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool TryWriteBytes(System.Span<byte> destination, uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool TryWriteBytes(System.Span<byte> destination, ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.Half UInt16BitsToHalf(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float UInt32BitsToSingle(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double UInt64BitsToDouble(ulong value) { throw null; }
}
public readonly partial struct Boolean : System.IComparable, System.IComparable<bool>, System.IConvertible, System.IEquatable<bool>
{
private readonly bool _dummyPrimitive;
public static readonly string FalseString;
public static readonly string TrueString;
public int CompareTo(System.Boolean value) { throw null; }
public int CompareTo(object? obj) { throw null; }
public System.Boolean Equals(System.Boolean obj) { throw null; }
public override System.Boolean Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Boolean Parse(System.ReadOnlySpan<char> value) { throw null; }
public static System.Boolean Parse(string value) { throw null; }
System.Boolean System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public System.Boolean TryFormat(System.Span<char> destination, out int charsWritten) { throw null; }
public static System.Boolean TryParse(System.ReadOnlySpan<char> value, out System.Boolean result) { throw null; }
public static System.Boolean TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value, out System.Boolean result) { throw null; }
}
public static partial class Buffer
{
public static void BlockCopy(System.Array src, int srcOffset, System.Array dst, int dstOffset, int count) { }
public static int ByteLength(System.Array array) { throw null; }
public static byte GetByte(System.Array array, int index) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy) { }
public static void SetByte(System.Array array, int index, byte value) { }
}
public readonly partial struct Byte : System.IComparable, System.IComparable<byte>, System.IConvertible, System.IEquatable<byte>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<byte>,
System.IMinMaxValue<byte>,
System.IUnsignedNumber<byte>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly byte _dummyPrimitive;
public const byte MaxValue = (byte)255;
public const byte MinValue = (byte)0;
public int CompareTo(System.Byte value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Byte obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Byte Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.Byte Parse(string s) { throw null; }
public static System.Byte Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Byte Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Byte Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
System.Byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Byte result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Byte result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Byte result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Byte result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IAdditiveIdentity<byte, byte>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IMinMaxValue<byte>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IMinMaxValue<byte>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IMultiplicativeIdentity<byte, byte>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IAdditionOperators<byte, byte, byte>.operator +(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.LeadingZeroCount(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.PopCount(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.RotateLeft(byte value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.RotateRight(byte value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.TrailingZeroCount(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<byte>.IsPow2(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryNumber<byte>.Log2(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBitwiseOperators<byte, byte, byte>.operator &(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBitwiseOperators<byte, byte, byte>.operator |(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBitwiseOperators<byte, byte, byte>.operator ^(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBitwiseOperators<byte, byte, byte>.operator ~(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<byte, byte>.operator <(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<byte, byte>.operator <=(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<byte, byte>.operator >(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<byte, byte>.operator >=(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IDecrementOperators<byte>.operator --(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IDivisionOperators<byte, byte, byte>.operator /(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<byte, byte>.operator ==(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<byte, byte>.operator !=(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IIncrementOperators<byte>.operator ++(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IModulusOperators<byte, byte, byte>.operator %(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IMultiplyOperators<byte, byte, byte>.operator *(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Abs(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Clamp(byte value, byte min, byte max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (byte Quotient, byte Remainder) INumber<byte>.DivRem(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Max(byte x, byte y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Min(byte x, byte y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Sign(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<byte>.TryCreate<TOther>(TOther value, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<byte>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<byte>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IParseable<byte>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<byte>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IShiftOperators<byte, byte>.operator <<(byte value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IShiftOperators<byte, byte>.operator >>(byte value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte ISpanParseable<byte>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<byte>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte ISubtractionOperators<byte, byte, byte>.operator -(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IUnaryNegationOperators<byte, byte>.operator -(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IUnaryPlusOperators<byte, byte>.operator +(byte value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial class CannotUnloadAppDomainException : System.SystemException
{
public CannotUnloadAppDomainException() { }
protected CannotUnloadAppDomainException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public CannotUnloadAppDomainException(string? message) { }
public CannotUnloadAppDomainException(string? message, System.Exception? innerException) { }
}
public readonly partial struct Char : System.IComparable, System.IComparable<char>, System.IConvertible, System.IEquatable<char>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<char>,
System.IMinMaxValue<char>,
System.IUnsignedNumber<char>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly char _dummyPrimitive;
public const char MaxValue = '\uFFFF';
public const char MinValue = '\0';
public int CompareTo(System.Char value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static string ConvertFromUtf32(int utf32) { throw null; }
public static int ConvertToUtf32(System.Char highSurrogate, System.Char lowSurrogate) { throw null; }
public static int ConvertToUtf32(string s, int index) { throw null; }
public bool Equals(System.Char obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static double GetNumericValue(System.Char c) { throw null; }
public static double GetNumericValue(string s, int index) { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(System.Char c) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(string s, int index) { throw null; }
public static bool IsAscii(System.Char c) { throw null; }
public static bool IsControl(System.Char c) { throw null; }
public static bool IsControl(string s, int index) { throw null; }
public static bool IsDigit(System.Char c) { throw null; }
public static bool IsDigit(string s, int index) { throw null; }
public static bool IsHighSurrogate(System.Char c) { throw null; }
public static bool IsHighSurrogate(string s, int index) { throw null; }
public static bool IsLetter(System.Char c) { throw null; }
public static bool IsLetter(string s, int index) { throw null; }
public static bool IsLetterOrDigit(System.Char c) { throw null; }
public static bool IsLetterOrDigit(string s, int index) { throw null; }
public static bool IsLower(System.Char c) { throw null; }
public static bool IsLower(string s, int index) { throw null; }
public static bool IsLowSurrogate(System.Char c) { throw null; }
public static bool IsLowSurrogate(string s, int index) { throw null; }
public static bool IsNumber(System.Char c) { throw null; }
public static bool IsNumber(string s, int index) { throw null; }
public static bool IsPunctuation(System.Char c) { throw null; }
public static bool IsPunctuation(string s, int index) { throw null; }
public static bool IsSeparator(System.Char c) { throw null; }
public static bool IsSeparator(string s, int index) { throw null; }
public static bool IsSurrogate(System.Char c) { throw null; }
public static bool IsSurrogate(string s, int index) { throw null; }
public static bool IsSurrogatePair(System.Char highSurrogate, System.Char lowSurrogate) { throw null; }
public static bool IsSurrogatePair(string s, int index) { throw null; }
public static bool IsSymbol(System.Char c) { throw null; }
public static bool IsSymbol(string s, int index) { throw null; }
public static bool IsUpper(System.Char c) { throw null; }
public static bool IsUpper(string s, int index) { throw null; }
public static bool IsWhiteSpace(System.Char c) { throw null; }
public static bool IsWhiteSpace(string s, int index) { throw null; }
public static System.Char Parse(string s) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
System.Char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public static System.Char ToLower(System.Char c) { throw null; }
public static System.Char ToLower(System.Char c, System.Globalization.CultureInfo culture) { throw null; }
public static System.Char ToLowerInvariant(System.Char c) { throw null; }
public override string ToString() { throw null; }
public static string ToString(System.Char c) { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public static System.Char ToUpper(System.Char c) { throw null; }
public static System.Char ToUpper(System.Char c, System.Globalization.CultureInfo culture) { throw null; }
public static System.Char ToUpperInvariant(System.Char c) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Char result) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
string System.IFormattable.ToString(string? format, IFormatProvider? formatProvider) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IAdditiveIdentity<char, char>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IMinMaxValue<char>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IMinMaxValue<char>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IMultiplicativeIdentity<char, char>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IAdditionOperators<char, char, char>.operator +(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.LeadingZeroCount(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.PopCount(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.RotateLeft(char value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.RotateRight(char value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.TrailingZeroCount(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<char>.IsPow2(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryNumber<char>.Log2(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBitwiseOperators<char, char, char>.operator &(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBitwiseOperators<char, char, char>.operator |(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBitwiseOperators<char, char, char>.operator ^(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBitwiseOperators<char, char, char>.operator ~(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<char, char>.operator <(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<char, char>.operator <=(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<char, char>.operator >(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<char, char>.operator >=(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IDecrementOperators<char>.operator --(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IDivisionOperators<char, char, char>.operator /(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<char, char>.operator ==(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<char, char>.operator !=(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IIncrementOperators<char>.operator ++(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IModulusOperators<char, char, char>.operator %(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IMultiplyOperators<char, char, char>.operator *(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Abs(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Clamp(char value, char min, char max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (char Quotient, char Remainder) INumber<char>.DivRem(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Max(char x, char y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Min(char x, char y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Sign(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<char>.TryCreate<TOther>(TOther value, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<char>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<char>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IParseable<char>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<char>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IShiftOperators<char, char>.operator <<(char value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview"), System.Runtime.CompilerServices.SpecialNameAttribute]
static char IShiftOperators<char, char>.operator >>(char value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char ISpanParseable<char>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<char>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char ISubtractionOperators<char, char, char>.operator -(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IUnaryNegationOperators<char, char>.operator -(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IUnaryPlusOperators<char, char>.operator +(char value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public sealed partial class CharEnumerator : System.Collections.Generic.IEnumerator<char>, System.Collections.IEnumerator, System.ICloneable, System.IDisposable
{
internal CharEnumerator() { }
public char Current { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
public object Clone() { throw null; }
public void Dispose() { }
public bool MoveNext() { throw null; }
public void Reset() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=true, AllowMultiple=false)]
public sealed partial class CLSCompliantAttribute : System.Attribute
{
public CLSCompliantAttribute(bool isCompliant) { }
public bool IsCompliant { get { throw null; } }
}
public delegate int Comparison<in T>(T x, T y);
public abstract partial class ContextBoundObject : System.MarshalByRefObject
{
protected ContextBoundObject() { }
}
public partial class ContextMarshalException : System.SystemException
{
public ContextMarshalException() { }
protected ContextMarshalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ContextMarshalException(string? message) { }
public ContextMarshalException(string? message, System.Exception? inner) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public partial class ContextStaticAttribute : System.Attribute
{
public ContextStaticAttribute() { }
}
public static partial class Convert
{
public static readonly object DBNull;
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static object? ChangeType(object? value, System.Type conversionType) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static object? ChangeType(object? value, System.Type conversionType, System.IFormatProvider? provider) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static object? ChangeType(object? value, System.TypeCode typeCode) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static object? ChangeType(object? value, System.TypeCode typeCode, System.IFormatProvider? provider) { throw null; }
public static byte[] FromBase64CharArray(char[] inArray, int offset, int length) { throw null; }
public static byte[] FromBase64String(string s) { throw null; }
public static byte[] FromHexString(System.ReadOnlySpan<char> chars) { throw null; }
public static byte[] FromHexString(string s) { throw null; }
public static System.TypeCode GetTypeCode(object? value) { throw null; }
public static bool IsDBNull([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut) { throw null; }
public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut, System.Base64FormattingOptions options) { throw null; }
public static string ToBase64String(byte[] inArray) { throw null; }
public static string ToBase64String(byte[] inArray, System.Base64FormattingOptions options) { throw null; }
public static string ToBase64String(byte[] inArray, int offset, int length) { throw null; }
public static string ToBase64String(byte[] inArray, int offset, int length, System.Base64FormattingOptions options) { throw null; }
public static string ToBase64String(System.ReadOnlySpan<byte> bytes, System.Base64FormattingOptions options = System.Base64FormattingOptions.None) { throw null; }
public static bool ToBoolean(bool value) { throw null; }
public static bool ToBoolean(byte value) { throw null; }
public static bool ToBoolean(char value) { throw null; }
public static bool ToBoolean(System.DateTime value) { throw null; }
public static bool ToBoolean(decimal value) { throw null; }
public static bool ToBoolean(double value) { throw null; }
public static bool ToBoolean(short value) { throw null; }
public static bool ToBoolean(int value) { throw null; }
public static bool ToBoolean(long value) { throw null; }
public static bool ToBoolean([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static bool ToBoolean([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool ToBoolean(sbyte value) { throw null; }
public static bool ToBoolean(float value) { throw null; }
public static bool ToBoolean([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value) { throw null; }
public static bool ToBoolean([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool ToBoolean(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool ToBoolean(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool ToBoolean(ulong value) { throw null; }
public static byte ToByte(bool value) { throw null; }
public static byte ToByte(byte value) { throw null; }
public static byte ToByte(char value) { throw null; }
public static byte ToByte(System.DateTime value) { throw null; }
public static byte ToByte(decimal value) { throw null; }
public static byte ToByte(double value) { throw null; }
public static byte ToByte(short value) { throw null; }
public static byte ToByte(int value) { throw null; }
public static byte ToByte(long value) { throw null; }
public static byte ToByte(object? value) { throw null; }
public static byte ToByte(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte ToByte(sbyte value) { throw null; }
public static byte ToByte(float value) { throw null; }
public static byte ToByte(string? value) { throw null; }
public static byte ToByte(string? value, System.IFormatProvider? provider) { throw null; }
public static byte ToByte(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte ToByte(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte ToByte(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte ToByte(ulong value) { throw null; }
public static char ToChar(bool value) { throw null; }
public static char ToChar(byte value) { throw null; }
public static char ToChar(char value) { throw null; }
public static char ToChar(System.DateTime value) { throw null; }
public static char ToChar(decimal value) { throw null; }
public static char ToChar(double value) { throw null; }
public static char ToChar(short value) { throw null; }
public static char ToChar(int value) { throw null; }
public static char ToChar(long value) { throw null; }
public static char ToChar(object? value) { throw null; }
public static char ToChar(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static char ToChar(sbyte value) { throw null; }
public static char ToChar(float value) { throw null; }
public static char ToChar(string value) { throw null; }
public static char ToChar(string value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static char ToChar(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static char ToChar(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static char ToChar(ulong value) { throw null; }
public static System.DateTime ToDateTime(bool value) { throw null; }
public static System.DateTime ToDateTime(byte value) { throw null; }
public static System.DateTime ToDateTime(char value) { throw null; }
public static System.DateTime ToDateTime(System.DateTime value) { throw null; }
public static System.DateTime ToDateTime(decimal value) { throw null; }
public static System.DateTime ToDateTime(double value) { throw null; }
public static System.DateTime ToDateTime(short value) { throw null; }
public static System.DateTime ToDateTime(int value) { throw null; }
public static System.DateTime ToDateTime(long value) { throw null; }
public static System.DateTime ToDateTime(object? value) { throw null; }
public static System.DateTime ToDateTime(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.DateTime ToDateTime(sbyte value) { throw null; }
public static System.DateTime ToDateTime(float value) { throw null; }
public static System.DateTime ToDateTime(string? value) { throw null; }
public static System.DateTime ToDateTime(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.DateTime ToDateTime(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.DateTime ToDateTime(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.DateTime ToDateTime(ulong value) { throw null; }
public static decimal ToDecimal(bool value) { throw null; }
public static decimal ToDecimal(byte value) { throw null; }
public static decimal ToDecimal(char value) { throw null; }
public static decimal ToDecimal(System.DateTime value) { throw null; }
public static decimal ToDecimal(decimal value) { throw null; }
public static decimal ToDecimal(double value) { throw null; }
public static decimal ToDecimal(short value) { throw null; }
public static decimal ToDecimal(int value) { throw null; }
public static decimal ToDecimal(long value) { throw null; }
public static decimal ToDecimal(object? value) { throw null; }
public static decimal ToDecimal(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static decimal ToDecimal(sbyte value) { throw null; }
public static decimal ToDecimal(float value) { throw null; }
public static decimal ToDecimal(string? value) { throw null; }
public static decimal ToDecimal(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static decimal ToDecimal(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static decimal ToDecimal(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static decimal ToDecimal(ulong value) { throw null; }
public static double ToDouble(bool value) { throw null; }
public static double ToDouble(byte value) { throw null; }
public static double ToDouble(char value) { throw null; }
public static double ToDouble(System.DateTime value) { throw null; }
public static double ToDouble(decimal value) { throw null; }
public static double ToDouble(double value) { throw null; }
public static double ToDouble(short value) { throw null; }
public static double ToDouble(int value) { throw null; }
public static double ToDouble(long value) { throw null; }
public static double ToDouble(object? value) { throw null; }
public static double ToDouble(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double ToDouble(sbyte value) { throw null; }
public static double ToDouble(float value) { throw null; }
public static double ToDouble(string? value) { throw null; }
public static double ToDouble(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double ToDouble(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double ToDouble(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double ToDouble(ulong value) { throw null; }
public static string ToHexString(byte[] inArray) { throw null; }
public static string ToHexString(byte[] inArray, int offset, int length) { throw null; }
public static string ToHexString(System.ReadOnlySpan<byte> bytes) { throw null; }
public static short ToInt16(bool value) { throw null; }
public static short ToInt16(byte value) { throw null; }
public static short ToInt16(char value) { throw null; }
public static short ToInt16(System.DateTime value) { throw null; }
public static short ToInt16(decimal value) { throw null; }
public static short ToInt16(double value) { throw null; }
public static short ToInt16(short value) { throw null; }
public static short ToInt16(int value) { throw null; }
public static short ToInt16(long value) { throw null; }
public static short ToInt16(object? value) { throw null; }
public static short ToInt16(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static short ToInt16(sbyte value) { throw null; }
public static short ToInt16(float value) { throw null; }
public static short ToInt16(string? value) { throw null; }
public static short ToInt16(string? value, System.IFormatProvider? provider) { throw null; }
public static short ToInt16(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static short ToInt16(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static short ToInt16(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static short ToInt16(ulong value) { throw null; }
public static int ToInt32(bool value) { throw null; }
public static int ToInt32(byte value) { throw null; }
public static int ToInt32(char value) { throw null; }
public static int ToInt32(System.DateTime value) { throw null; }
public static int ToInt32(decimal value) { throw null; }
public static int ToInt32(double value) { throw null; }
public static int ToInt32(short value) { throw null; }
public static int ToInt32(int value) { throw null; }
public static int ToInt32(long value) { throw null; }
public static int ToInt32(object? value) { throw null; }
public static int ToInt32(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int ToInt32(sbyte value) { throw null; }
public static int ToInt32(float value) { throw null; }
public static int ToInt32(string? value) { throw null; }
public static int ToInt32(string? value, System.IFormatProvider? provider) { throw null; }
public static int ToInt32(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int ToInt32(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int ToInt32(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int ToInt32(ulong value) { throw null; }
public static long ToInt64(bool value) { throw null; }
public static long ToInt64(byte value) { throw null; }
public static long ToInt64(char value) { throw null; }
public static long ToInt64(System.DateTime value) { throw null; }
public static long ToInt64(decimal value) { throw null; }
public static long ToInt64(double value) { throw null; }
public static long ToInt64(short value) { throw null; }
public static long ToInt64(int value) { throw null; }
public static long ToInt64(long value) { throw null; }
public static long ToInt64(object? value) { throw null; }
public static long ToInt64(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static long ToInt64(sbyte value) { throw null; }
public static long ToInt64(float value) { throw null; }
public static long ToInt64(string? value) { throw null; }
public static long ToInt64(string? value, System.IFormatProvider? provider) { throw null; }
public static long ToInt64(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static long ToInt64(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static long ToInt64(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static long ToInt64(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(bool value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(byte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(System.DateTime value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(short value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(string? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(string value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(ulong value) { throw null; }
public static float ToSingle(bool value) { throw null; }
public static float ToSingle(byte value) { throw null; }
public static float ToSingle(char value) { throw null; }
public static float ToSingle(System.DateTime value) { throw null; }
public static float ToSingle(decimal value) { throw null; }
public static float ToSingle(double value) { throw null; }
public static float ToSingle(short value) { throw null; }
public static float ToSingle(int value) { throw null; }
public static float ToSingle(long value) { throw null; }
public static float ToSingle(object? value) { throw null; }
public static float ToSingle(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float ToSingle(sbyte value) { throw null; }
public static float ToSingle(float value) { throw null; }
public static float ToSingle(string? value) { throw null; }
public static float ToSingle(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float ToSingle(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float ToSingle(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float ToSingle(ulong value) { throw null; }
public static string ToString(bool value) { throw null; }
public static string ToString(bool value, System.IFormatProvider? provider) { throw null; }
public static string ToString(byte value) { throw null; }
public static string ToString(byte value, System.IFormatProvider? provider) { throw null; }
public static string ToString(byte value, int toBase) { throw null; }
public static string ToString(char value) { throw null; }
public static string ToString(char value, System.IFormatProvider? provider) { throw null; }
public static string ToString(System.DateTime value) { throw null; }
public static string ToString(System.DateTime value, System.IFormatProvider? provider) { throw null; }
public static string ToString(decimal value) { throw null; }
public static string ToString(decimal value, System.IFormatProvider? provider) { throw null; }
public static string ToString(double value) { throw null; }
public static string ToString(double value, System.IFormatProvider? provider) { throw null; }
public static string ToString(short value) { throw null; }
public static string ToString(short value, System.IFormatProvider? provider) { throw null; }
public static string ToString(short value, int toBase) { throw null; }
public static string ToString(int value) { throw null; }
public static string ToString(int value, System.IFormatProvider? provider) { throw null; }
public static string ToString(int value, int toBase) { throw null; }
public static string ToString(long value) { throw null; }
public static string ToString(long value, System.IFormatProvider? provider) { throw null; }
public static string ToString(long value, int toBase) { throw null; }
public static string? ToString(object? value) { throw null; }
public static string? ToString(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(sbyte value, System.IFormatProvider? provider) { throw null; }
public static string ToString(float value) { throw null; }
public static string ToString(float value, System.IFormatProvider? provider) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? ToString(string? value) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? ToString(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(ushort value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(uint value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(ulong value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(bool value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(byte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(System.DateTime value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(short value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(string? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(bool value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(byte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(System.DateTime value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(short value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(string? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(bool value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(byte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(System.DateTime value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(short value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(string? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(ulong value) { throw null; }
public static bool TryFromBase64Chars(System.ReadOnlySpan<char> chars, System.Span<byte> bytes, out int bytesWritten) { throw null; }
public static bool TryFromBase64String(string s, System.Span<byte> bytes, out int bytesWritten) { throw null; }
public static bool TryToBase64Chars(System.ReadOnlySpan<byte> bytes, System.Span<char> chars, out int charsWritten, System.Base64FormattingOptions options = System.Base64FormattingOptions.None) { throw null; }
}
public delegate TOutput Converter<in TInput, out TOutput>(TInput input);
public readonly partial struct DateOnly : System.IComparable, System.IComparable<System.DateOnly>, System.IEquatable<System.DateOnly>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IComparisonOperators<DateOnly, DateOnly>,
System.IMinMaxValue<DateOnly>,
System.ISpanParseable<DateOnly>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
public static DateOnly MinValue { get { throw null; } }
public static DateOnly MaxValue { get { throw null; } }
public DateOnly(int year, int month, int day) { throw null; }
public DateOnly(int year, int month, int day, System.Globalization.Calendar calendar) { throw null; }
public static DateOnly FromDayNumber(int dayNumber) { throw null; }
public int Year { get { throw null; } }
public int Month { get { throw null; } }
public int Day { get { throw null; } }
public System.DayOfWeek DayOfWeek { get { throw null; } }
public int DayOfYear { get { throw null; } }
public int DayNumber { get { throw null; } }
public System.DateOnly AddDays(int value) { throw null; }
public System.DateOnly AddMonths(int value) { throw null; }
public System.DateOnly AddYears(int value) { throw null; }
public static bool operator ==(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator >(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator >=(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator !=(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator <(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator <=(System.DateOnly left, System.DateOnly right) { throw null; }
public System.DateTime ToDateTime(System.TimeOnly time) { throw null; }
public System.DateTime ToDateTime(System.TimeOnly time, System.DateTimeKind kind) { throw null; }
public static System.DateOnly FromDateTime(System.DateTime dateTime) { throw null; }
public int CompareTo(System.DateOnly value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.DateOnly value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.DateOnly Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly ParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, System.IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly ParseExact(System.ReadOnlySpan<char> s, string[] formats) { throw null; }
public static System.DateOnly ParseExact(System.ReadOnlySpan<char> s, string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly Parse(string s) { throw null; }
public static System.DateOnly Parse(string s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly ParseExact(string s, string format) { throw null; }
public static System.DateOnly ParseExact(string s, string format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly ParseExact(string s, string[] formats) { throw null; }
public static System.DateOnly ParseExact(string s, string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.DateOnly result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, out System.DateOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.DateOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.DateOnly result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, out System.DateOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.DateOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public string ToLongDateString() { throw null; }
public string ToShortDateString() { throw null; }
public override string ToString() { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateOnly IMinMaxValue<System.DateOnly>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateOnly IMinMaxValue<System.DateOnly>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateOnly, System.DateOnly>.operator <(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateOnly, System.DateOnly>.operator <=(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateOnly, System.DateOnly>.operator >(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateOnly, System.DateOnly>.operator >=(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateOnly, System.DateOnly>.operator ==(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateOnly, System.DateOnly>.operator !=(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateOnly IParseable<System.DateOnly>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.DateOnly>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateOnly result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateOnly ISpanParseable<System.DateOnly>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.DateOnly>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.DateOnly result) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct DateTime : System.IComparable, System.IComparable<System.DateTime>, System.IConvertible, System.IEquatable<System.DateTime>, System.ISpanFormattable, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IAdditionOperators<System.DateTime, System.TimeSpan, System.DateTime>,
System.IAdditiveIdentity<System.DateTime, System.TimeSpan>,
System.IComparisonOperators<System.DateTime, System.DateTime>,
System.IMinMaxValue<System.DateTime>,
System.ISpanParseable<System.DateTime>,
System.ISubtractionOperators<System.DateTime, System.TimeSpan, System.DateTime>,
System.ISubtractionOperators<System.DateTime, System.DateTime, System.TimeSpan>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.DateTime MaxValue;
public static readonly System.DateTime MinValue;
public static readonly System.DateTime UnixEpoch;
public DateTime(int year, int month, int day) { throw null; }
public DateTime(int year, int month, int day, System.Globalization.Calendar calendar) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, System.DateTimeKind kind) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, System.Globalization.Calendar calendar) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.DateTimeKind kind) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, System.DateTimeKind kind) { throw null; }
public DateTime(long ticks) { throw null; }
public DateTime(long ticks, System.DateTimeKind kind) { throw null; }
public System.DateTime Date { get { throw null; } }
public int Day { get { throw null; } }
public System.DayOfWeek DayOfWeek { get { throw null; } }
public int DayOfYear { get { throw null; } }
public int Hour { get { throw null; } }
public System.DateTimeKind Kind { get { throw null; } }
public int Millisecond { get { throw null; } }
public int Minute { get { throw null; } }
public int Month { get { throw null; } }
public static System.DateTime Now { get { throw null; } }
public int Second { get { throw null; } }
public long Ticks { get { throw null; } }
public System.TimeSpan TimeOfDay { get { throw null; } }
public static System.DateTime Today { get { throw null; } }
public static System.DateTime UtcNow { get { throw null; } }
public int Year { get { throw null; } }
public System.DateTime Add(System.TimeSpan value) { throw null; }
public System.DateTime AddDays(double value) { throw null; }
public System.DateTime AddHours(double value) { throw null; }
public System.DateTime AddMilliseconds(double value) { throw null; }
public System.DateTime AddMinutes(double value) { throw null; }
public System.DateTime AddMonths(int months) { throw null; }
public System.DateTime AddSeconds(double value) { throw null; }
public System.DateTime AddTicks(long value) { throw null; }
public System.DateTime AddYears(int value) { throw null; }
public static int Compare(System.DateTime t1, System.DateTime t2) { throw null; }
public int CompareTo(System.DateTime value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static int DaysInMonth(int year, int month) { throw null; }
public bool Equals(System.DateTime value) { throw null; }
public static bool Equals(System.DateTime t1, System.DateTime t2) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.DateTime FromBinary(long dateData) { throw null; }
public static System.DateTime FromFileTime(long fileTime) { throw null; }
public static System.DateTime FromFileTimeUtc(long fileTime) { throw null; }
public static System.DateTime FromOADate(double d) { throw null; }
public string[] GetDateTimeFormats() { throw null; }
public string[] GetDateTimeFormats(char format) { throw null; }
public string[] GetDateTimeFormats(char format, System.IFormatProvider? provider) { throw null; }
public string[] GetDateTimeFormats(System.IFormatProvider? provider) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public bool IsDaylightSavingTime() { throw null; }
public static bool IsLeapYear(int year) { throw null; }
public static System.DateTime operator +(System.DateTime d, System.TimeSpan t) { throw null; }
public static bool operator ==(System.DateTime d1, System.DateTime d2) { throw null; }
public static bool operator >(System.DateTime t1, System.DateTime t2) { throw null; }
public static bool operator >=(System.DateTime t1, System.DateTime t2) { throw null; }
public static bool operator !=(System.DateTime d1, System.DateTime d2) { throw null; }
public static bool operator <(System.DateTime t1, System.DateTime t2) { throw null; }
public static bool operator <=(System.DateTime t1, System.DateTime t2) { throw null; }
public static System.TimeSpan operator -(System.DateTime d1, System.DateTime d2) { throw null; }
public static System.DateTime operator -(System.DateTime d, System.TimeSpan t) { throw null; }
public static System.DateTime Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider = null, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTime Parse(string s) { throw null; }
public static System.DateTime Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.DateTime Parse(string s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles styles) { throw null; }
public static System.DateTime ParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTime ParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTime ParseExact(string s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string format, System.IFormatProvider? provider) { throw null; }
public static System.DateTime ParseExact(string s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style) { throw null; }
public static System.DateTime ParseExact(string s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style) { throw null; }
public static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeKind kind) { throw null; }
public System.TimeSpan Subtract(System.DateTime value) { throw null; }
public System.DateTime Subtract(System.TimeSpan value) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public long ToBinary() { throw null; }
public long ToFileTime() { throw null; }
public long ToFileTimeUtc() { throw null; }
public System.DateTime ToLocalTime() { throw null; }
public string ToLongDateString() { throw null; }
public string ToLongTimeString() { throw null; }
public double ToOADate() { throw null; }
public string ToShortDateString() { throw null; }
public string ToShortTimeString() { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format) { throw null; }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format, System.IFormatProvider? provider) { throw null; }
public System.DateTime ToUniversalTime() { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.DateTime result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles styles, out System.DateTime result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.DateTime result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles styles, out System.DateTime result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IAdditiveIdentity<System.DateTime, System.TimeSpan>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime IMinMaxValue<System.DateTime>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime IMinMaxValue<System.DateTime>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime IAdditionOperators<System.DateTime, System.TimeSpan, System.DateTime>.operator +(System.DateTime left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTime, System.DateTime>.operator <(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTime, System.DateTime>.operator <=(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTime, System.DateTime>.operator >(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTime, System.DateTime>.operator >=(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateTime, System.DateTime>.operator ==(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateTime, System.DateTime>.operator !=(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime IParseable<System.DateTime>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.DateTime>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateTime result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime ISpanParseable<System.DateTime>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.DateTime>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.DateTime result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime ISubtractionOperators<System.DateTime, System.TimeSpan, System.DateTime>.operator -(System.DateTime left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISubtractionOperators<System.DateTime, System.DateTime, System.TimeSpan>.operator -(System.DateTime left, System.DateTime right) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public enum DateTimeKind
{
Unspecified = 0,
Utc = 1,
Local = 2,
}
public readonly partial struct DateTimeOffset : System.IComparable, System.IComparable<System.DateTimeOffset>, System.IEquatable<System.DateTimeOffset>, System.ISpanFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IAdditionOperators<System.DateTimeOffset, System.TimeSpan, System.DateTimeOffset>,
System.IAdditiveIdentity<System.DateTimeOffset, System.TimeSpan>,
System.IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>,
System.IMinMaxValue<System.DateTimeOffset>, System.ISpanParseable<System.DateTimeOffset>,
System.ISubtractionOperators<System.DateTimeOffset, System.TimeSpan, System.DateTimeOffset>,
System.ISubtractionOperators<System.DateTimeOffset, System.DateTimeOffset, System.TimeSpan>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.DateTimeOffset MaxValue;
public static readonly System.DateTimeOffset MinValue;
public static readonly System.DateTimeOffset UnixEpoch;
public DateTimeOffset(System.DateTime dateTime) { throw null; }
public DateTimeOffset(System.DateTime dateTime, System.TimeSpan offset) { throw null; }
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, System.TimeSpan offset) { throw null; }
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, System.TimeSpan offset) { throw null; }
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, System.TimeSpan offset) { throw null; }
public DateTimeOffset(long ticks, System.TimeSpan offset) { throw null; }
public System.DateTime Date { get { throw null; } }
public System.DateTime DateTime { get { throw null; } }
public int Day { get { throw null; } }
public System.DayOfWeek DayOfWeek { get { throw null; } }
public int DayOfYear { get { throw null; } }
public int Hour { get { throw null; } }
public System.DateTime LocalDateTime { get { throw null; } }
public int Millisecond { get { throw null; } }
public int Minute { get { throw null; } }
public int Month { get { throw null; } }
public static System.DateTimeOffset Now { get { throw null; } }
public System.TimeSpan Offset { get { throw null; } }
public int Second { get { throw null; } }
public long Ticks { get { throw null; } }
public System.TimeSpan TimeOfDay { get { throw null; } }
public System.DateTime UtcDateTime { get { throw null; } }
public static System.DateTimeOffset UtcNow { get { throw null; } }
public long UtcTicks { get { throw null; } }
public int Year { get { throw null; } }
public System.DateTimeOffset Add(System.TimeSpan timeSpan) { throw null; }
public System.DateTimeOffset AddDays(double days) { throw null; }
public System.DateTimeOffset AddHours(double hours) { throw null; }
public System.DateTimeOffset AddMilliseconds(double milliseconds) { throw null; }
public System.DateTimeOffset AddMinutes(double minutes) { throw null; }
public System.DateTimeOffset AddMonths(int months) { throw null; }
public System.DateTimeOffset AddSeconds(double seconds) { throw null; }
public System.DateTimeOffset AddTicks(long ticks) { throw null; }
public System.DateTimeOffset AddYears(int years) { throw null; }
public static int Compare(System.DateTimeOffset first, System.DateTimeOffset second) { throw null; }
public int CompareTo(System.DateTimeOffset other) { throw null; }
public bool Equals(System.DateTimeOffset other) { throw null; }
public static bool Equals(System.DateTimeOffset first, System.DateTimeOffset second) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool EqualsExact(System.DateTimeOffset other) { throw null; }
public static System.DateTimeOffset FromFileTime(long fileTime) { throw null; }
public static System.DateTimeOffset FromUnixTimeMilliseconds(long milliseconds) { throw null; }
public static System.DateTimeOffset FromUnixTimeSeconds(long seconds) { throw null; }
public override int GetHashCode() { throw null; }
public static System.DateTimeOffset operator +(System.DateTimeOffset dateTimeOffset, System.TimeSpan timeSpan) { throw null; }
public static bool operator ==(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static bool operator >(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static bool operator >=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static implicit operator System.DateTimeOffset (System.DateTime dateTime) { throw null; }
public static bool operator !=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static bool operator <(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static bool operator <=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static System.TimeSpan operator -(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static System.DateTimeOffset operator -(System.DateTimeOffset dateTimeOffset, System.TimeSpan timeSpan) { throw null; }
public static System.DateTimeOffset Parse(System.ReadOnlySpan<char> input, System.IFormatProvider? formatProvider = null, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTimeOffset Parse(string input) { throw null; }
public static System.DateTimeOffset Parse(string input, System.IFormatProvider? formatProvider) { throw null; }
public static System.DateTimeOffset Parse(string input, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
public static System.DateTimeOffset ParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTimeOffset ParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string[] formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTimeOffset ParseExact(string input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string format, System.IFormatProvider? formatProvider) { throw null; }
public static System.DateTimeOffset ParseExact(string input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string format, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
public static System.DateTimeOffset ParseExact(string input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string[] formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
public System.TimeSpan Subtract(System.DateTimeOffset value) { throw null; }
public System.DateTimeOffset Subtract(System.TimeSpan value) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public long ToFileTime() { throw null; }
public System.DateTimeOffset ToLocalTime() { throw null; }
public System.DateTimeOffset ToOffset(System.TimeSpan offset) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? formatProvider) { throw null; }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format) { throw null; }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format, System.IFormatProvider? formatProvider) { throw null; }
public System.DateTimeOffset ToUniversalTime() { throw null; }
public long ToUnixTimeMilliseconds() { throw null; }
public long ToUnixTimeSeconds() { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? formatProvider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, out System.DateTimeOffset result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, out System.DateTimeOffset result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IAdditiveIdentity<System.DateTimeOffset, System.TimeSpan>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset IMinMaxValue<System.DateTimeOffset>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset IMinMaxValue<System.DateTimeOffset>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset IAdditionOperators<System.DateTimeOffset, System.TimeSpan, System.DateTimeOffset>.operator +(System.DateTimeOffset left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>.operator <(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>.operator <=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>.operator >(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>.operator >=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateTimeOffset, System.DateTimeOffset>.operator ==(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateTimeOffset, System.DateTimeOffset>.operator !=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset IParseable<System.DateTimeOffset>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.DateTimeOffset>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateTimeOffset result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset ISpanParseable<System.DateTimeOffset>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.DateTimeOffset>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.DateTimeOffset result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset ISubtractionOperators<System.DateTimeOffset, System.TimeSpan, System.DateTimeOffset>.operator -(System.DateTimeOffset left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISubtractionOperators<System.DateTimeOffset, System.DateTimeOffset, System.TimeSpan>.operator -(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public enum DayOfWeek
{
Sunday = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
}
public sealed partial class DBNull : System.IConvertible, System.Runtime.Serialization.ISerializable
{
internal DBNull() { }
public static readonly System.DBNull Value;
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public System.TypeCode GetTypeCode() { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
}
public readonly partial struct Decimal : System.IComparable, System.IComparable<decimal>, System.IConvertible, System.IEquatable<decimal>, System.ISpanFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IMinMaxValue<decimal>,
System.ISignedNumber<decimal>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)4294967295, (uint)4294967295, (uint)4294967295)]
public static readonly decimal MaxValue;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)0, (uint)0, (uint)1)]
public static readonly decimal MinusOne;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)4294967295, (uint)4294967295, (uint)4294967295)]
public static readonly decimal MinValue;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)1)]
public static readonly decimal One;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)0)]
public static readonly decimal Zero;
public Decimal(double value) { throw null; }
public Decimal(int value) { throw null; }
public Decimal(int lo, int mid, int hi, bool isNegative, byte scale) { throw null; }
public Decimal(int[] bits) { throw null; }
public Decimal(long value) { throw null; }
public Decimal(System.ReadOnlySpan<int> bits) { throw null; }
public Decimal(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public Decimal(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public Decimal(ulong value) { throw null; }
public static System.Decimal Add(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal Ceiling(System.Decimal d) { throw null; }
public static int Compare(System.Decimal d1, System.Decimal d2) { throw null; }
public int CompareTo(System.Decimal value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static System.Decimal Divide(System.Decimal d1, System.Decimal d2) { throw null; }
public bool Equals(System.Decimal value) { throw null; }
public static bool Equals(System.Decimal d1, System.Decimal d2) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.Decimal Floor(System.Decimal d) { throw null; }
public static System.Decimal FromOACurrency(long cy) { throw null; }
public static int[] GetBits(System.Decimal d) { throw null; }
public static int GetBits(System.Decimal d, System.Span<int> destination) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Decimal Multiply(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal Negate(System.Decimal d) { throw null; }
public static System.Decimal operator +(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator --(System.Decimal d) { throw null; }
public static System.Decimal operator /(System.Decimal d1, System.Decimal d2) { throw null; }
public static bool operator ==(System.Decimal d1, System.Decimal d2) { throw null; }
public static explicit operator byte (System.Decimal value) { throw null; }
public static explicit operator char (System.Decimal value) { throw null; }
public static explicit operator double (System.Decimal value) { throw null; }
public static explicit operator short (System.Decimal value) { throw null; }
public static explicit operator int (System.Decimal value) { throw null; }
public static explicit operator long (System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator sbyte (System.Decimal value) { throw null; }
public static explicit operator float (System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator ushort (System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator uint (System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator ulong (System.Decimal value) { throw null; }
public static explicit operator System.Decimal (double value) { throw null; }
public static explicit operator System.Decimal (float value) { throw null; }
public static bool operator >(System.Decimal d1, System.Decimal d2) { throw null; }
public static bool operator >=(System.Decimal d1, System.Decimal d2) { throw null; }
public static implicit operator System.Decimal (byte value) { throw null; }
public static implicit operator System.Decimal (char value) { throw null; }
public static implicit operator System.Decimal (short value) { throw null; }
public static implicit operator System.Decimal (int value) { throw null; }
public static implicit operator System.Decimal (long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Decimal (sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Decimal (ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Decimal (uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Decimal (ulong value) { throw null; }
public static System.Decimal operator ++(System.Decimal d) { throw null; }
public static bool operator !=(System.Decimal d1, System.Decimal d2) { throw null; }
public static bool operator <(System.Decimal d1, System.Decimal d2) { throw null; }
public static bool operator <=(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator %(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator *(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator -(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator -(System.Decimal d) { throw null; }
public static System.Decimal operator +(System.Decimal d) { throw null; }
public static System.Decimal Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Number, System.IFormatProvider? provider = null) { throw null; }
public static System.Decimal Parse(string s) { throw null; }
public static System.Decimal Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Decimal Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Decimal Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.Decimal Remainder(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal Round(System.Decimal d) { throw null; }
public static System.Decimal Round(System.Decimal d, int decimals) { throw null; }
public static System.Decimal Round(System.Decimal d, int decimals, System.MidpointRounding mode) { throw null; }
public static System.Decimal Round(System.Decimal d, System.MidpointRounding mode) { throw null; }
public static System.Decimal Subtract(System.Decimal d1, System.Decimal d2) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
System.Decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static byte ToByte(System.Decimal value) { throw null; }
public static double ToDouble(System.Decimal d) { throw null; }
public static short ToInt16(System.Decimal value) { throw null; }
public static int ToInt32(System.Decimal d) { throw null; }
public static long ToInt64(System.Decimal d) { throw null; }
public static long ToOACurrency(System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(System.Decimal value) { throw null; }
public static float ToSingle(System.Decimal d) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(System.Decimal d) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(System.Decimal d) { throw null; }
public static System.Decimal Truncate(System.Decimal d) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryGetBits(System.Decimal d, System.Span<int> destination, out int valuesWritten) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Decimal result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Decimal result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Decimal result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Decimal result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IAdditiveIdentity<decimal, decimal>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IMinMaxValue<decimal>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IMinMaxValue<decimal>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IMultiplicativeIdentity<decimal, decimal>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IAdditionOperators<decimal, decimal, decimal>.operator +(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<decimal, decimal>.operator <(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<decimal, decimal>.operator <=(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<decimal, decimal>.operator >(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<decimal, decimal>.operator >=(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IDecrementOperators<decimal>.operator --(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IDivisionOperators<decimal, decimal, decimal>.operator /(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<decimal, decimal>.operator ==(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<decimal, decimal>.operator !=(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IIncrementOperators<decimal>.operator ++(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IModulusOperators<decimal, decimal, decimal>.operator %(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IMultiplyOperators<decimal, decimal, decimal>.operator *(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Abs(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Clamp(decimal value, decimal min, decimal max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (decimal Quotient, decimal Remainder) INumber<decimal>.DivRem(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Max(decimal x, decimal y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Min(decimal x, decimal y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Sign(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<decimal>.TryCreate<TOther>(TOther value, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<decimal>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<decimal>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IParseable<decimal>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<decimal>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal ISignedNumber<decimal>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal ISpanParseable<decimal>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<decimal>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal ISubtractionOperators<decimal, decimal, decimal>.operator -(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IUnaryNegationOperators<decimal, decimal>.operator -(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IUnaryPlusOperators<decimal, decimal>.operator +(decimal value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public abstract partial class Delegate : System.ICloneable, System.Runtime.Serialization.ISerializable
{
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
protected Delegate(object target, string method) { }
protected Delegate([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method) { }
public System.Reflection.MethodInfo Method { get { throw null; } }
public object? Target { get { throw null; } }
public virtual object Clone() { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("a")]
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("b")]
public static System.Delegate? Combine(System.Delegate? a, System.Delegate? b) { throw null; }
public static System.Delegate? Combine(params System.Delegate?[]? delegates) { throw null; }
protected virtual System.Delegate CombineImpl(System.Delegate? d) { throw null; }
public static System.Delegate CreateDelegate(System.Type type, object? firstArgument, System.Reflection.MethodInfo method) { throw null; }
public static System.Delegate? CreateDelegate(System.Type type, object? firstArgument, System.Reflection.MethodInfo method, bool throwOnBindFailure) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
public static System.Delegate CreateDelegate(System.Type type, object target, string method) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
public static System.Delegate CreateDelegate(System.Type type, object target, string method, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
public static System.Delegate? CreateDelegate(System.Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure) { throw null; }
public static System.Delegate CreateDelegate(System.Type type, System.Reflection.MethodInfo method) { throw null; }
public static System.Delegate? CreateDelegate(System.Type type, System.Reflection.MethodInfo method, bool throwOnBindFailure) { throw null; }
public static System.Delegate CreateDelegate(System.Type type, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method) { throw null; }
public static System.Delegate CreateDelegate(System.Type type, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method, bool ignoreCase) { throw null; }
public static System.Delegate? CreateDelegate(System.Type type, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method, bool ignoreCase, bool throwOnBindFailure) { throw null; }
public object? DynamicInvoke(params object?[]? args) { throw null; }
protected virtual object? DynamicInvokeImpl(object?[]? args) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public virtual System.Delegate[] GetInvocationList() { throw null; }
protected virtual System.Reflection.MethodInfo GetMethodImpl() { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(System.Delegate? d1, System.Delegate? d2) { throw null; }
public static bool operator !=(System.Delegate? d1, System.Delegate? d2) { throw null; }
public static System.Delegate? Remove(System.Delegate? source, System.Delegate? value) { throw null; }
public static System.Delegate? RemoveAll(System.Delegate? source, System.Delegate? value) { throw null; }
protected virtual System.Delegate? RemoveImpl(System.Delegate d) { throw null; }
}
public partial class DivideByZeroException : System.ArithmeticException
{
public DivideByZeroException() { }
protected DivideByZeroException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public DivideByZeroException(string? message) { }
public DivideByZeroException(string? message, System.Exception? innerException) { }
}
public readonly partial struct Double : System.IComparable, System.IComparable<double>, System.IConvertible, System.IEquatable<double>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryFloatingPoint<double>,
System.IMinMaxValue<double>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly double _dummyPrimitive;
public const double Epsilon = 5E-324;
public const double MaxValue = 1.7976931348623157E+308;
public const double MinValue = -1.7976931348623157E+308;
public const double NaN = 0.0 / 0.0;
public const double NegativeInfinity = -1.0 / 0.0;
public const double PositiveInfinity = 1.0 / 0.0;
public int CompareTo(System.Double value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Double obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static bool IsFinite(System.Double d) { throw null; }
public static bool IsInfinity(System.Double d) { throw null; }
public static bool IsNaN(System.Double d) { throw null; }
public static bool IsNegative(System.Double d) { throw null; }
public static bool IsNegativeInfinity(System.Double d) { throw null; }
public static bool IsNormal(System.Double d) { throw null; }
public static bool IsPositiveInfinity(System.Double d) { throw null; }
public static bool IsSubnormal(System.Double d) { throw null; }
public static bool operator ==(System.Double left, System.Double right) { throw null; }
public static bool operator >(System.Double left, System.Double right) { throw null; }
public static bool operator >=(System.Double left, System.Double right) { throw null; }
public static bool operator !=(System.Double left, System.Double right) { throw null; }
public static bool operator <(System.Double left, System.Double right) { throw null; }
public static bool operator <=(System.Double left, System.Double right) { throw null; }
public static System.Double Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Double Parse(string s) { throw null; }
public static System.Double Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Double Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Double Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
System.Double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Double result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Double result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Double result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Double result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IAdditiveIdentity<double, double>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.E { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Epsilon { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.NaN { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.NegativeInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.NegativeZero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Pi { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.PositiveInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Tau { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMinMaxValue<double>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMinMaxValue<double>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMultiplicativeIdentity<double, double>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IAdditionOperators<double, double, double>.operator +(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<double>.IsPow2(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBinaryNumber<double>.Log2(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBitwiseOperators<double, double, double>.operator &(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBitwiseOperators<double, double, double>.operator |(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBitwiseOperators<double, double, double>.operator ^(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBitwiseOperators<double, double, double>.operator ~(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<double, double>.operator <(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<double, double>.operator <=(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<double, double>.operator >(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<double, double>.operator >=(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IDecrementOperators<double>.operator --(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IDivisionOperators<double, double, double>.operator /(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<double, double>.operator ==(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<double, double>.operator !=(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Acos(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Acosh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Asin(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Asinh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Atan(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Atan2(double y, double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Atanh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.BitIncrement(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.BitDecrement(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Cbrt(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Ceiling(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.CopySign(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Cos(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Cosh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Exp(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Floor(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.FusedMultiplyAdd(double left, double right, double addend) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.IEEERemainder(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static TInteger IFloatingPoint<double>.ILogB<TInteger>(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Log(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Log(double x, double newBase) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Log2(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Log10(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.MaxMagnitude(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.MinMagnitude(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Pow(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Round(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Round<TInteger>(double x, TInteger digits) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Round(double x, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Round<TInteger>(double x, TInteger digits, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.ScaleB<TInteger>(double x, TInteger n) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Sin(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Sinh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Sqrt(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Tan(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Tanh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Truncate(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsFinite(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsInfinity(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsNaN(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsNegative(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsNegativeInfinity(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsNormal(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsPositiveInfinity(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsSubnormal(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IIncrementOperators<double>.operator ++(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IModulusOperators<double, double, double>.operator %(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMultiplyOperators<double, double, double>.operator *(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Abs(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Clamp(double value, double min, double max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (double Quotient, double Remainder) INumber<double>.DivRem(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Max(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Min(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Sign(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<double>.TryCreate<TOther>(TOther value, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<double>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<double>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IParseable<double>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<double>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double ISignedNumber<double>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double ISpanParseable<double>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<double>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double ISubtractionOperators<double, double, double>.operator -(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IUnaryNegationOperators<double, double>.operator -(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IUnaryPlusOperators<double, double>.operator +(double value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial class DuplicateWaitObjectException : System.ArgumentException
{
public DuplicateWaitObjectException() { }
protected DuplicateWaitObjectException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public DuplicateWaitObjectException(string? parameterName) { }
public DuplicateWaitObjectException(string? message, System.Exception? innerException) { }
public DuplicateWaitObjectException(string? parameterName, string? message) { }
}
public partial class EntryPointNotFoundException : System.TypeLoadException
{
public EntryPointNotFoundException() { }
protected EntryPointNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public EntryPointNotFoundException(string? message) { }
public EntryPointNotFoundException(string? message, System.Exception? inner) { }
}
public abstract partial class Enum : System.ValueType, System.IComparable, System.IConvertible, System.IFormattable
{
protected Enum() { }
public int CompareTo(object? target) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public static string Format(System.Type enumType, object value, string format) { throw null; }
public override int GetHashCode() { throw null; }
public static string? GetName(System.Type enumType, object value) { throw null; }
public static string? GetName<TEnum>(TEnum value) where TEnum : struct, System.Enum { throw null; }
public static string[] GetNames(System.Type enumType) { throw null; }
public static string[] GetNames<TEnum>() where TEnum: struct, System.Enum { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Type GetUnderlyingType(System.Type enumType) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("It might not be possible to create an array of the enum type at runtime. Use the GetValues<TEnum> overload instead.")]
public static System.Array GetValues(System.Type enumType) { throw null; }
public static TEnum[] GetValues<TEnum>() where TEnum : struct, System.Enum { throw null; }
public bool HasFlag(System.Enum flag) { throw null; }
public static bool IsDefined(System.Type enumType, object value) { throw null; }
public static bool IsDefined<TEnum>(TEnum value) where TEnum : struct, System.Enum { throw null; }
public static object Parse(System.Type enumType, System.ReadOnlySpan<char> value) { throw null; }
public static object Parse(System.Type enumType, System.ReadOnlySpan<char> value, bool ignoreCase) { throw null; }
public static object Parse(System.Type enumType, string value) { throw null; }
public static object Parse(System.Type enumType, string value, bool ignoreCase) { throw null; }
public static TEnum Parse<TEnum>(System.ReadOnlySpan<char> value) where TEnum : struct { throw null; }
public static TEnum Parse<TEnum>(System.ReadOnlySpan<char> value, bool ignoreCase) where TEnum : struct { throw null; }
public static TEnum Parse<TEnum>(string value) where TEnum : struct { throw null; }
public static TEnum Parse<TEnum>(string value, bool ignoreCase) where TEnum : struct { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public static object ToObject(System.Type enumType, byte value) { throw null; }
public static object ToObject(System.Type enumType, short value) { throw null; }
public static object ToObject(System.Type enumType, int value) { throw null; }
public static object ToObject(System.Type enumType, long value) { throw null; }
public static object ToObject(System.Type enumType, object value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static object ToObject(System.Type enumType, sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static object ToObject(System.Type enumType, ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static object ToObject(System.Type enumType, uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static object ToObject(System.Type enumType, ulong value) { throw null; }
public override string ToString() { throw null; }
[System.ObsoleteAttribute("The provider argument is not used. Use ToString() instead.")]
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
[System.ObsoleteAttribute("The provider argument is not used. Use ToString(String) instead.")]
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public static bool TryParse(System.Type enumType, System.ReadOnlySpan<char> value, bool ignoreCase, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse(System.Type enumType, System.ReadOnlySpan<char> value, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse(System.Type enumType, string? value, bool ignoreCase, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse(System.Type enumType, string? value, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse<TEnum>(System.ReadOnlySpan<char> value, bool ignoreCase, out TEnum result) where TEnum : struct { throw null; }
public static bool TryParse<TEnum>(System.ReadOnlySpan<char> value, out TEnum result) where TEnum : struct { throw null; }
public static bool TryParse<TEnum>([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value, bool ignoreCase, out TEnum result) where TEnum : struct { throw null; }
public static bool TryParse<TEnum>([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value, out TEnum result) where TEnum : struct { throw null; }
}
public static partial class Environment
{
public static string CommandLine { get { throw null; } }
public static string CurrentDirectory { get { throw null; } set { } }
public static int CurrentManagedThreadId { get { throw null; } }
public static int ExitCode { get { throw null; } set { } }
public static bool HasShutdownStarted { get { throw null; } }
public static bool Is64BitOperatingSystem { get { throw null; } }
public static bool Is64BitProcess { get { throw null; } }
public static string MachineName { get { throw null; } }
public static string NewLine { get { throw null; } }
public static System.OperatingSystem OSVersion { get { throw null; } }
public static int ProcessId { get { throw null; } }
public static int ProcessorCount { get { throw null; } }
public static string? ProcessPath { get { throw null; } }
public static string StackTrace { get { throw null; } }
public static string SystemDirectory { get { throw null; } }
public static int SystemPageSize { get { throw null; } }
public static int TickCount { get { throw null; } }
public static long TickCount64 { get { throw null; } }
public static string UserDomainName { get { throw null; } }
public static bool UserInteractive { get { throw null; } }
public static string UserName { get { throw null; } }
public static System.Version Version { get { throw null; } }
public static long WorkingSet { get { throw null; } }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public static void Exit(int exitCode) { throw null; }
public static string ExpandEnvironmentVariables(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public static void FailFast(string? message) { throw null; }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public static void FailFast(string? message, System.Exception? exception) { throw null; }
public static string[] GetCommandLineArgs() { throw null; }
public static string? GetEnvironmentVariable(string variable) { throw null; }
public static string? GetEnvironmentVariable(string variable, System.EnvironmentVariableTarget target) { throw null; }
public static System.Collections.IDictionary GetEnvironmentVariables() { throw null; }
public static System.Collections.IDictionary GetEnvironmentVariables(System.EnvironmentVariableTarget target) { throw null; }
public static string GetFolderPath(System.Environment.SpecialFolder folder) { throw null; }
public static string GetFolderPath(System.Environment.SpecialFolder folder, System.Environment.SpecialFolderOption option) { throw null; }
public static string[] GetLogicalDrives() { throw null; }
public static void SetEnvironmentVariable(string variable, string? value) { }
public static void SetEnvironmentVariable(string variable, string? value, System.EnvironmentVariableTarget target) { }
public enum SpecialFolder
{
Desktop = 0,
Programs = 2,
MyDocuments = 5,
Personal = 5,
Favorites = 6,
Startup = 7,
Recent = 8,
SendTo = 9,
StartMenu = 11,
MyMusic = 13,
MyVideos = 14,
DesktopDirectory = 16,
MyComputer = 17,
NetworkShortcuts = 19,
Fonts = 20,
Templates = 21,
CommonStartMenu = 22,
CommonPrograms = 23,
CommonStartup = 24,
CommonDesktopDirectory = 25,
ApplicationData = 26,
PrinterShortcuts = 27,
LocalApplicationData = 28,
InternetCache = 32,
Cookies = 33,
History = 34,
CommonApplicationData = 35,
Windows = 36,
System = 37,
ProgramFiles = 38,
MyPictures = 39,
UserProfile = 40,
SystemX86 = 41,
ProgramFilesX86 = 42,
CommonProgramFiles = 43,
CommonProgramFilesX86 = 44,
CommonTemplates = 45,
CommonDocuments = 46,
CommonAdminTools = 47,
AdminTools = 48,
CommonMusic = 53,
CommonPictures = 54,
CommonVideos = 55,
Resources = 56,
LocalizedResources = 57,
CommonOemLinks = 58,
CDBurning = 59,
}
public enum SpecialFolderOption
{
None = 0,
DoNotVerify = 16384,
Create = 32768,
}
}
public enum EnvironmentVariableTarget
{
Process = 0,
User = 1,
Machine = 2,
}
public partial class EventArgs
{
public static readonly System.EventArgs Empty;
public EventArgs() { }
}
public delegate void EventHandler(object? sender, System.EventArgs e);
public delegate void EventHandler<TEventArgs>(object? sender, TEventArgs e);
public partial class Exception : System.Runtime.Serialization.ISerializable
{
public Exception() { }
protected Exception(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public Exception(string? message) { }
public Exception(string? message, System.Exception? innerException) { }
public virtual System.Collections.IDictionary Data { get { throw null; } }
public virtual string? HelpLink { get { throw null; } set { } }
public int HResult { get { throw null; } set { } }
public System.Exception? InnerException { get { throw null; } }
public virtual string Message { get { throw null; } }
public virtual string? Source { get { throw null; } set { } }
public virtual string? StackTrace { get { throw null; } }
public System.Reflection.MethodBase? TargetSite { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Metadata for the method might be incomplete or removed")] get { throw null; } }
[System.ObsoleteAttribute("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId = "SYSLIB0011", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
protected event System.EventHandler<System.Runtime.Serialization.SafeSerializationEventArgs>? SerializeObjectState { add { } remove { } }
public virtual System.Exception GetBaseException() { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public new System.Type GetType() { throw null; }
public override string ToString() { throw null; }
}
[System.ObsoleteAttribute("ExecutionEngineException previously indicated an unspecified fatal error in the runtime. The runtime no longer raises this exception so this type is obsolete.")]
public sealed partial class ExecutionEngineException : System.SystemException
{
public ExecutionEngineException() { }
public ExecutionEngineException(string? message) { }
public ExecutionEngineException(string? message, System.Exception? innerException) { }
}
public partial class FieldAccessException : System.MemberAccessException
{
public FieldAccessException() { }
protected FieldAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public FieldAccessException(string? message) { }
public FieldAccessException(string? message, System.Exception? inner) { }
}
public partial class FileStyleUriParser : System.UriParser
{
public FileStyleUriParser() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Enum, Inherited=false)]
public partial class FlagsAttribute : System.Attribute
{
public FlagsAttribute() { }
}
public partial class FormatException : System.SystemException
{
public FormatException() { }
protected FormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public FormatException(string? message) { }
public FormatException(string? message, System.Exception? innerException) { }
}
public abstract partial class FormattableString : System.IFormattable
{
protected FormattableString() { }
public abstract int ArgumentCount { get; }
public abstract string Format { get; }
public static string CurrentCulture(System.FormattableString formattable) { throw null; }
public abstract object? GetArgument(int index);
public abstract object?[] GetArguments();
public static string Invariant(System.FormattableString formattable) { throw null; }
string System.IFormattable.ToString(string? ignored, System.IFormatProvider? formatProvider) { throw null; }
public override string ToString() { throw null; }
public abstract string ToString(System.IFormatProvider? formatProvider);
}
public partial class FtpStyleUriParser : System.UriParser
{
public FtpStyleUriParser() { }
}
public delegate TResult Func<out TResult>();
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, in T16, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16);
public delegate TResult Func<in T, out TResult>(T arg);
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
public delegate TResult Func<in T1, in T2, in T3, in T4, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
public static partial class GC
{
public static int MaxGeneration { get { throw null; } }
public static void AddMemoryPressure(long bytesAllocated) { }
public static T[] AllocateArray<T>(int length, bool pinned = false) { throw null; }
public static T[] AllocateUninitializedArray<T>(int length, bool pinned = false) { throw null; }
public static void CancelFullGCNotification() { }
public static void Collect() { }
public static void Collect(int generation) { }
public static void Collect(int generation, System.GCCollectionMode mode) { }
public static void Collect(int generation, System.GCCollectionMode mode, bool blocking) { }
public static void Collect(int generation, System.GCCollectionMode mode, bool blocking, bool compacting) { }
public static int CollectionCount(int generation) { throw null; }
public static void EndNoGCRegion() { }
public static long GetAllocatedBytesForCurrentThread() { throw null; }
public static System.GCMemoryInfo GetGCMemoryInfo() { throw null; }
public static System.GCMemoryInfo GetGCMemoryInfo(System.GCKind kind) { throw null; }
public static int GetGeneration(object obj) { throw null; }
public static int GetGeneration(System.WeakReference wo) { throw null; }
public static long GetTotalAllocatedBytes(bool precise = false) { throw null; }
public static long GetTotalMemory(bool forceFullCollection) { throw null; }
public static void KeepAlive(object? obj) { }
public static void RegisterForFullGCNotification(int maxGenerationThreshold, int largeObjectHeapThreshold) { }
public static void RemoveMemoryPressure(long bytesAllocated) { }
public static void ReRegisterForFinalize(object obj) { }
public static void SuppressFinalize(object obj) { }
public static bool TryStartNoGCRegion(long totalSize) { throw null; }
public static bool TryStartNoGCRegion(long totalSize, bool disallowFullBlockingGC) { throw null; }
public static bool TryStartNoGCRegion(long totalSize, long lohSize) { throw null; }
public static bool TryStartNoGCRegion(long totalSize, long lohSize, bool disallowFullBlockingGC) { throw null; }
public static System.GCNotificationStatus WaitForFullGCApproach() { throw null; }
public static System.GCNotificationStatus WaitForFullGCApproach(int millisecondsTimeout) { throw null; }
public static System.GCNotificationStatus WaitForFullGCComplete() { throw null; }
public static System.GCNotificationStatus WaitForFullGCComplete(int millisecondsTimeout) { throw null; }
public static void WaitForPendingFinalizers() { }
}
public enum GCCollectionMode
{
Default = 0,
Forced = 1,
Optimized = 2,
}
public readonly partial struct GCGenerationInfo
{
private readonly int _dummyPrimitive;
public long FragmentationAfterBytes { get { throw null; } }
public long FragmentationBeforeBytes { get { throw null; } }
public long SizeAfterBytes { get { throw null; } }
public long SizeBeforeBytes { get { throw null; } }
}
public enum GCKind
{
Any = 0,
Ephemeral = 1,
FullBlocking = 2,
Background = 3,
}
public readonly partial struct GCMemoryInfo
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool Compacted { get { throw null; } }
public bool Concurrent { get { throw null; } }
public long FinalizationPendingCount { get { throw null; } }
public long FragmentedBytes { get { throw null; } }
public int Generation { get { throw null; } }
public System.ReadOnlySpan<System.GCGenerationInfo> GenerationInfo { get { throw null; } }
public long HeapSizeBytes { get { throw null; } }
public long HighMemoryLoadThresholdBytes { get { throw null; } }
public long Index { get { throw null; } }
public long MemoryLoadBytes { get { throw null; } }
public System.ReadOnlySpan<System.TimeSpan> PauseDurations { get { throw null; } }
public double PauseTimePercentage { get { throw null; } }
public long PinnedObjectsCount { get { throw null; } }
public long PromotedBytes { get { throw null; } }
public long TotalAvailableMemoryBytes { get { throw null; } }
public long TotalCommittedBytes { get { throw null; } }
}
public enum GCNotificationStatus
{
Succeeded = 0,
Failed = 1,
Canceled = 2,
Timeout = 3,
NotApplicable = 4,
}
public partial class GenericUriParser : System.UriParser
{
public GenericUriParser(System.GenericUriParserOptions options) { }
}
[System.FlagsAttribute]
public enum GenericUriParserOptions
{
Default = 0,
GenericAuthority = 1,
AllowEmptyAuthority = 2,
NoUserInfo = 4,
NoPort = 8,
NoQuery = 16,
NoFragment = 32,
DontConvertPathBackslashes = 64,
DontCompressPath = 128,
DontUnescapePathDotsAndSlashes = 256,
Idn = 512,
IriParsing = 1024,
}
public partial class GopherStyleUriParser : System.UriParser
{
public GopherStyleUriParser() { }
}
public readonly partial struct Guid : System.IComparable, System.IComparable<System.Guid>, System.IEquatable<System.Guid>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IComparisonOperators<System.Guid, System.Guid>,
System.ISpanParseable<System.Guid>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.Guid Empty;
public Guid(byte[] b) { throw null; }
public Guid(int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { throw null; }
public Guid(int a, short b, short c, byte[] d) { throw null; }
public Guid(System.ReadOnlySpan<byte> b) { throw null; }
public Guid(string g) { throw null; }
[System.CLSCompliantAttribute(false)]
public Guid(uint a, ushort b, ushort c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { throw null; }
public int CompareTo(System.Guid value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Guid g) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Guid NewGuid() { throw null; }
public static bool operator ==(System.Guid a, System.Guid b) { throw null; }
public static bool operator !=(System.Guid a, System.Guid b) { throw null; }
public static System.Guid Parse(System.ReadOnlySpan<char> input) { throw null; }
public static System.Guid Parse(string input) { throw null; }
public static System.Guid ParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format) { throw null; }
public static System.Guid ParseExact(string input, string format) { throw null; }
public byte[] ToByteArray() { throw null; }
public override string ToString() { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>)) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, out System.Guid result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, out System.Guid result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format, out System.Guid result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, out System.Guid result) { throw null; }
public bool TryWriteBytes(System.Span<byte> destination) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Guid, System.Guid>.operator <(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Guid, System.Guid>.operator <=(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Guid, System.Guid>.operator >(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Guid, System.Guid>.operator >=(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.Guid, System.Guid>.operator ==(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.Guid, System.Guid>.operator !=(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Guid IParseable<System.Guid>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.Guid>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Guid result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Guid ISpanParseable<System.Guid>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.Guid>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.Guid result) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct Half : System.IComparable, System.IComparable<System.Half>, System.IEquatable<System.Half>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryFloatingPoint<System.Half>,
System.IMinMaxValue<System.Half>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static System.Half Epsilon { get { throw null; } }
public static System.Half MaxValue { get { throw null; } }
public static System.Half MinValue { get { throw null; } }
public static System.Half NaN { get { throw null; } }
public static System.Half NegativeInfinity { get { throw null; } }
public static System.Half PositiveInfinity { get { throw null; } }
public int CompareTo(System.Half other) { throw null; }
public int CompareTo(object? obj) { throw null; }
public bool Equals(System.Half other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool IsFinite(System.Half value) { throw null; }
public static bool IsInfinity(System.Half value) { throw null; }
public static bool IsNaN(System.Half value) { throw null; }
public static bool IsNegative(System.Half value) { throw null; }
public static bool IsNegativeInfinity(System.Half value) { throw null; }
public static bool IsNormal(System.Half value) { throw null; }
public static bool IsPositiveInfinity(System.Half value) { throw null; }
public static bool IsSubnormal(System.Half value) { throw null; }
public static bool operator ==(System.Half left, System.Half right) { throw null; }
public static explicit operator System.Half (double value) { throw null; }
public static explicit operator double (System.Half value) { throw null; }
public static explicit operator float (System.Half value) { throw null; }
public static explicit operator System.Half (float value) { throw null; }
public static bool operator >(System.Half left, System.Half right) { throw null; }
public static bool operator >=(System.Half left, System.Half right) { throw null; }
public static bool operator !=(System.Half left, System.Half right) { throw null; }
public static bool operator <(System.Half left, System.Half right) { throw null; }
public static bool operator <=(System.Half left, System.Half right) { throw null; }
public static System.Half Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Half Parse(string s) { throw null; }
public static System.Half Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Half Parse(string s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Half Parse(string s, System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Half result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Half result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IAdditiveIdentity<System.Half, System.Half>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.E { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Epsilon { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.NaN { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.NegativeInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.NegativeZero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Pi { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.PositiveInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Tau { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IMinMaxValue<System.Half>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IMinMaxValue<System.Half>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IMultiplicativeIdentity<System.Half, System.Half>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IAdditionOperators<System.Half, System.Half, System.Half>.operator +(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<System.Half>.IsPow2(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBinaryNumber<System.Half>.Log2(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBitwiseOperators<System.Half, System.Half, System.Half>.operator &(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBitwiseOperators<System.Half, System.Half, System.Half>.operator |(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBitwiseOperators<System.Half, System.Half, System.Half>.operator ^(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBitwiseOperators<System.Half, System.Half, System.Half>.operator ~(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Half, System.Half>.operator <(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Half, System.Half>.operator <=(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Half, System.Half>.operator >(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Half, System.Half>.operator >=(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IDecrementOperators<System.Half>.operator --(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IDivisionOperators<System.Half, System.Half, System.Half>.operator /(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.Half, System.Half>.operator ==(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.Half, System.Half>.operator !=(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Acos(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Acosh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Asin(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Asinh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Atan(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Atan2(System.Half y, System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Atanh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.BitIncrement(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.BitDecrement(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Cbrt(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Ceiling(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.CopySign(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Cos(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Cosh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Exp(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Floor(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.FusedMultiplyAdd(System.Half left, System.Half right, System.Half addend) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.IEEERemainder(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static TInteger IFloatingPoint<System.Half>.ILogB<TInteger>(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Log(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Log(System.Half x, System.Half newBase) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Log2(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Log10(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.MaxMagnitude(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.MinMagnitude(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Pow(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Round(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Round<TInteger>(System.Half x, TInteger digits) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Round(System.Half x, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Round<TInteger>(System.Half x, TInteger digits, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.ScaleB<TInteger>(System.Half x, TInteger n) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Sin(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Sinh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Sqrt(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Tan(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Tanh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Truncate(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsFinite(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsInfinity(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsNaN(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsNegative(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsNegativeInfinity(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsNormal(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsPositiveInfinity(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsSubnormal(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IIncrementOperators<System.Half>.operator ++(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IModulusOperators<System.Half, System.Half, System.Half>.operator %(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IMultiplyOperators<System.Half, System.Half, System.Half>.operator *(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Abs(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Clamp(System.Half value, System.Half min, System.Half max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (System.Half Quotient, System.Half Remainder) INumber<System.Half>.DivRem(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Max(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Min(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Sign(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<System.Half>.TryCreate<TOther>(TOther value, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<System.Half>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<System.Half>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IParseable<System.Half>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.Half>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half ISignedNumber<System.Half>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half ISpanParseable<System.Half>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.Half>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half ISubtractionOperators<System.Half, System.Half, System.Half>.operator -(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IUnaryNegationOperators<System.Half, System.Half>.operator -(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IUnaryPlusOperators<System.Half, System.Half>.operator +(System.Half value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial struct HashCode
{
private int _dummyPrimitive;
public void AddBytes(System.ReadOnlySpan<byte> value) { }
public void Add<T>(T value) { }
public void Add<T>(T value, System.Collections.Generic.IEqualityComparer<T>? comparer) { }
public static int Combine<T1>(T1 value1) { throw null; }
public static int Combine<T1, T2>(T1 value1, T2 value2) { throw null; }
public static int Combine<T1, T2, T3>(T1 value1, T2 value2, T3 value3) { throw null; }
public static int Combine<T1, T2, T3, T4>(T1 value1, T2 value2, T3 value3, T4 value4) { throw null; }
public static int Combine<T1, T2, T3, T4, T5>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5) { throw null; }
public static int Combine<T1, T2, T3, T4, T5, T6>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6) { throw null; }
public static int Combine<T1, T2, T3, T4, T5, T6, T7>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7) { throw null; }
public static int Combine<T1, T2, T3, T4, T5, T6, T7, T8>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("HashCode is a mutable struct and should not be compared with other HashCodes.", true)]
public override bool Equals(object? obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("HashCode is a mutable struct and should not be compared with other HashCodes. Use ToHashCode to retrieve the computed hash code.", true)]
public override int GetHashCode() { throw null; }
public int ToHashCode() { throw null; }
}
public partial class HttpStyleUriParser : System.UriParser
{
public HttpStyleUriParser() { }
}
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IAdditionOperators<TSelf, TOther, TResult>
where TSelf : System.IAdditionOperators<TSelf, TOther, TResult>
{
static abstract TResult operator +(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IAdditiveIdentity<TSelf, TResult>
where TSelf : System.IAdditiveIdentity<TSelf, TResult>
{
static abstract TResult AdditiveIdentity { get; }
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IBinaryFloatingPoint<TSelf> : System.IBinaryNumber<TSelf>, System.IFloatingPoint<TSelf>
where TSelf : IBinaryFloatingPoint<TSelf>
{
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IBinaryInteger<TSelf> : System.IBinaryNumber<TSelf>, System.IShiftOperators<TSelf, TSelf>
where TSelf : IBinaryInteger<TSelf>
{
static abstract TSelf LeadingZeroCount(TSelf value);
static abstract TSelf PopCount(TSelf value);
static abstract TSelf RotateLeft(TSelf value, int rotateAmount);
static abstract TSelf RotateRight(TSelf value, int rotateAmount);
static abstract TSelf TrailingZeroCount(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IBinaryNumber<TSelf> : System.IBitwiseOperators<TSelf, TSelf, TSelf>, System.INumber<TSelf>
where TSelf : IBinaryNumber<TSelf>
{
static abstract bool IsPow2(TSelf value);
static abstract TSelf Log2(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IBitwiseOperators<TSelf, TOther, TResult>
where TSelf : System.IBitwiseOperators<TSelf, TOther, TResult>
{
static abstract TResult operator &(TSelf left, TOther right);
static abstract TResult operator |(TSelf left, TOther right);
static abstract TResult operator ^(TSelf left, TOther right);
static abstract TResult operator ~(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IComparisonOperators<TSelf, TOther> : System.IComparable, System.IComparable<TOther>, System.IEqualityOperators<TSelf, TOther>
where TSelf : IComparisonOperators<TSelf, TOther>
{
static abstract bool operator <(TSelf left, TOther right);
static abstract bool operator <=(TSelf left, TOther right);
static abstract bool operator >(TSelf left, TOther right);
static abstract bool operator >=(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IDecrementOperators<TSelf>
where TSelf : System.IDecrementOperators<TSelf>
{
static abstract TSelf operator --(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IDivisionOperators<TSelf, TOther, TResult>
where TSelf : System.IDivisionOperators<TSelf, TOther, TResult>
{
static abstract TResult operator /(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IEqualityOperators<TSelf, TOther> : IEquatable<TOther>
where TSelf : System.IEqualityOperators<TSelf, TOther>
{
static abstract bool operator ==(TSelf left, TOther right);
static abstract bool operator !=(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IFloatingPoint<TSelf> : System.ISignedNumber<TSelf>
where TSelf : System.IFloatingPoint<TSelf>
{
static abstract TSelf E { get; }
static abstract TSelf Epsilon { get; }
static abstract TSelf NaN { get; }
static abstract TSelf NegativeInfinity { get; }
static abstract TSelf NegativeZero { get; }
static abstract TSelf Pi { get; }
static abstract TSelf PositiveInfinity { get; }
static abstract TSelf Tau { get; }
static abstract TSelf Acos(TSelf x);
static abstract TSelf Acosh(TSelf x);
static abstract TSelf Asin(TSelf x);
static abstract TSelf Asinh(TSelf x);
static abstract TSelf Atan(TSelf x);
static abstract TSelf Atan2(TSelf y, TSelf x);
static abstract TSelf Atanh(TSelf x);
static abstract TSelf BitIncrement(TSelf x);
static abstract TSelf BitDecrement(TSelf x);
static abstract TSelf Cbrt(TSelf x);
static abstract TSelf Ceiling(TSelf x);
static abstract TSelf CopySign(TSelf x, TSelf y);
static abstract TSelf Cos(TSelf x);
static abstract TSelf Cosh(TSelf x);
static abstract TSelf Exp(TSelf x);
static abstract TSelf Floor(TSelf x);
static abstract TSelf FusedMultiplyAdd(TSelf left, TSelf right, TSelf addend);
static abstract TSelf IEEERemainder(TSelf left, TSelf right);
static abstract TInteger ILogB<TInteger>(TSelf x) where TInteger : IBinaryInteger<TInteger>;
static abstract bool IsFinite(TSelf value);
static abstract bool IsInfinity(TSelf value);
static abstract bool IsNaN(TSelf value);
static abstract bool IsNegative(TSelf value);
static abstract bool IsNegativeInfinity(TSelf value);
static abstract bool IsNormal(TSelf value);
static abstract bool IsPositiveInfinity(TSelf value);
static abstract bool IsSubnormal(TSelf value);
static abstract TSelf Log(TSelf x);
static abstract TSelf Log(TSelf x, TSelf newBase);
static abstract TSelf Log2(TSelf x);
static abstract TSelf Log10(TSelf x);
static abstract TSelf MaxMagnitude(TSelf x, TSelf y);
static abstract TSelf MinMagnitude(TSelf x, TSelf y);
static abstract TSelf Pow(TSelf x, TSelf y);
static abstract TSelf Round(TSelf x);
static abstract TSelf Round<TInteger>(TSelf x, TInteger digits) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf Round(TSelf x, MidpointRounding mode);
static abstract TSelf Round<TInteger>(TSelf x, TInteger digits, MidpointRounding mode) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf ScaleB<TInteger>(TSelf x, TInteger n) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf Sin(TSelf x);
static abstract TSelf Sinh(TSelf x);
static abstract TSelf Sqrt(TSelf x);
static abstract TSelf Tan(TSelf x);
static abstract TSelf Tanh(TSelf x);
static abstract TSelf Truncate(TSelf x);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IIncrementOperators<TSelf>
where TSelf : System.IIncrementOperators<TSelf>
{
static abstract TSelf operator ++(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IMinMaxValue<TSelf>
where TSelf : System.IMinMaxValue<TSelf>
{
static abstract TSelf MinValue { get; }
static abstract TSelf MaxValue { get; }
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IModulusOperators<TSelf, TOther, TResult>
where TSelf : System.IModulusOperators<TSelf, TOther, TResult>
{
static abstract TResult operator %(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IMultiplicativeIdentity<TSelf, TResult>
where TSelf : System.IMultiplicativeIdentity<TSelf, TResult>
{
static abstract TResult MultiplicativeIdentity { get; }
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IMultiplyOperators<TSelf, TOther, TResult>
where TSelf : System.IMultiplyOperators<TSelf, TOther, TResult>
{
static abstract TResult operator *(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface INumber<TSelf> : System.IAdditionOperators<TSelf, TSelf, TSelf>, System.IAdditiveIdentity<TSelf, TSelf>, System.IComparable, System.IComparable<TSelf>, System.IComparisonOperators<TSelf, TSelf>, System.IDecrementOperators<TSelf>, System.IDivisionOperators<TSelf, TSelf, TSelf>, System.IEquatable<TSelf>, System.IEqualityOperators<TSelf, TSelf>, System.IFormattable, System.IIncrementOperators<TSelf>, System.IModulusOperators<TSelf, TSelf, TSelf>, System.IMultiplicativeIdentity<TSelf, TSelf>, System.IMultiplyOperators<TSelf, TSelf, TSelf>, System.IParseable<TSelf>, System.ISpanFormattable, System.ISpanParseable<TSelf>, System.ISubtractionOperators<TSelf, TSelf, TSelf>, System.IUnaryNegationOperators<TSelf, TSelf>, System.IUnaryPlusOperators<TSelf, TSelf>
where TSelf : System.INumber<TSelf>
{
static abstract TSelf One { get; }
static abstract TSelf Zero { get; }
static abstract TSelf Abs(TSelf value);
static abstract TSelf Clamp(TSelf value, TSelf min, TSelf max);
static abstract TSelf Create<TOther>(TOther value) where TOther : INumber<TOther>;
static abstract TSelf CreateSaturating<TOther>(TOther value) where TOther : INumber<TOther>;
static abstract TSelf CreateTruncating<TOther>(TOther value) where TOther : INumber<TOther>;
static abstract (TSelf Quotient, TSelf Remainder) DivRem(TSelf left, TSelf right);
static abstract TSelf Max(TSelf x, TSelf y);
static abstract TSelf Min(TSelf x, TSelf y);
static abstract TSelf Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider);
static abstract TSelf Parse(ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider);
static abstract TSelf Sign(TSelf value);
static abstract bool TryCreate<TOther>(TOther value, out TSelf result) where TOther : INumber<TOther>;
static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out TSelf result);
static abstract bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IParseable<TSelf>
where TSelf : System.IParseable<TSelf>
{
static abstract TSelf Parse(string s, System.IFormatProvider? provider);
static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out TSelf result);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IShiftOperators<TSelf, TResult>
where TSelf : System.IShiftOperators<TSelf, TResult>
{
static abstract TResult operator <<(TSelf value, int shiftAmount);
static abstract TResult operator >>(TSelf value, int shiftAmount);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface ISignedNumber<TSelf> : System.INumber<TSelf>, System.IUnaryNegationOperators<TSelf, TSelf>
where TSelf : System.ISignedNumber<TSelf>
{
static abstract TSelf NegativeOne { get; }
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface ISpanParseable<TSelf> : System.IParseable<TSelf>
where TSelf : System.ISpanParseable<TSelf>
{
static abstract TSelf Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider);
static abstract bool TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out TSelf result);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface ISubtractionOperators<TSelf, TOther, TResult>
where TSelf : System.ISubtractionOperators<TSelf, TOther, TResult>
{
static abstract TResult operator -(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IUnaryNegationOperators<TSelf, TResult>
where TSelf : System.IUnaryNegationOperators<TSelf, TResult>
{
static abstract TResult operator -(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IUnaryPlusOperators<TSelf, TResult>
where TSelf : System.IUnaryPlusOperators<TSelf, TResult>
{
static abstract TResult operator +(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IUnsignedNumber<TSelf> : System.INumber<TSelf>
where TSelf : IUnsignedNumber<TSelf>
{
}
#endif // FEATURE_GENERIC_MATH
public partial interface IAsyncDisposable
{
System.Threading.Tasks.ValueTask DisposeAsync();
}
public partial interface IAsyncResult
{
object? AsyncState { get; }
System.Threading.WaitHandle AsyncWaitHandle { get; }
bool CompletedSynchronously { get; }
bool IsCompleted { get; }
}
public partial interface ICloneable
{
object Clone();
}
public partial interface IComparable
{
int CompareTo(object? obj);
}
public partial interface IComparable<in T>
{
int CompareTo(T? other);
}
[System.CLSCompliantAttribute(false)]
public partial interface IConvertible
{
System.TypeCode GetTypeCode();
bool ToBoolean(System.IFormatProvider? provider);
byte ToByte(System.IFormatProvider? provider);
char ToChar(System.IFormatProvider? provider);
System.DateTime ToDateTime(System.IFormatProvider? provider);
decimal ToDecimal(System.IFormatProvider? provider);
double ToDouble(System.IFormatProvider? provider);
short ToInt16(System.IFormatProvider? provider);
int ToInt32(System.IFormatProvider? provider);
long ToInt64(System.IFormatProvider? provider);
sbyte ToSByte(System.IFormatProvider? provider);
float ToSingle(System.IFormatProvider? provider);
string ToString(System.IFormatProvider? provider);
object ToType(System.Type conversionType, System.IFormatProvider? provider);
ushort ToUInt16(System.IFormatProvider? provider);
uint ToUInt32(System.IFormatProvider? provider);
ulong ToUInt64(System.IFormatProvider? provider);
}
public partial interface ICustomFormatter
{
string Format(string? format, object? arg, System.IFormatProvider? formatProvider);
}
public partial interface IDisposable
{
void Dispose();
}
public partial interface IEquatable<T>
{
bool Equals(T? other);
}
public partial interface IFormatProvider
{
object? GetFormat(System.Type? formatType);
}
public partial interface IFormattable
{
string ToString(string? format, System.IFormatProvider? formatProvider);
}
public readonly partial struct Index : System.IEquatable<System.Index>
{
private readonly int _dummyPrimitive;
public Index(int value, bool fromEnd = false) { throw null; }
public static System.Index End { get { throw null; } }
public bool IsFromEnd { get { throw null; } }
public static System.Index Start { get { throw null; } }
public int Value { get { throw null; } }
public bool Equals(System.Index other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.Index FromEnd(int value) { throw null; }
public static System.Index FromStart(int value) { throw null; }
public override int GetHashCode() { throw null; }
public int GetOffset(int length) { throw null; }
public static implicit operator System.Index (int value) { throw null; }
public override string ToString() { throw null; }
}
public sealed partial class IndexOutOfRangeException : System.SystemException
{
public IndexOutOfRangeException() { }
public IndexOutOfRangeException(string? message) { }
public IndexOutOfRangeException(string? message, System.Exception? innerException) { }
}
public sealed partial class InsufficientExecutionStackException : System.SystemException
{
public InsufficientExecutionStackException() { }
public InsufficientExecutionStackException(string? message) { }
public InsufficientExecutionStackException(string? message, System.Exception? innerException) { }
}
public sealed partial class InsufficientMemoryException : System.OutOfMemoryException
{
public InsufficientMemoryException() { }
public InsufficientMemoryException(string? message) { }
public InsufficientMemoryException(string? message, System.Exception? innerException) { }
}
public readonly partial struct Int16 : System.IComparable, System.IComparable<short>, System.IConvertible, System.IEquatable<short>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<short>,
System.IMinMaxValue<short>,
System.ISignedNumber<short>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly short _dummyPrimitive;
public const short MaxValue = (short)32767;
public const short MinValue = (short)-32768;
public int CompareTo(System.Int16 value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Int16 obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Int16 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.Int16 Parse(string s) { throw null; }
public static System.Int16 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Int16 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Int16 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
System.Int16 System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int16 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Int16 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int16 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int16 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IAdditiveIdentity<short, short>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IMinMaxValue<short>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IMinMaxValue<short>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IMultiplicativeIdentity<short, short>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IAdditionOperators<short, short, short>.operator +(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.LeadingZeroCount(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.PopCount(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.RotateLeft(short value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.RotateRight(short value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.TrailingZeroCount(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<short>.IsPow2(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryNumber<short>.Log2(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBitwiseOperators<short, short, short>.operator &(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBitwiseOperators<short, short, short>.operator |(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBitwiseOperators<short, short, short>.operator ^(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBitwiseOperators<short, short, short>.operator ~(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<short, short>.operator <(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<short, short>.operator <=(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<short, short>.operator >(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<short, short>.operator >=(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IDecrementOperators<short>.operator --(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IDivisionOperators<short, short, short>.operator /(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<short, short>.operator ==(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<short, short>.operator !=(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IIncrementOperators<short>.operator ++(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IModulusOperators<short, short, short>.operator %(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IMultiplyOperators<short, short, short>.operator *(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Abs(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Clamp(short value, short min, short max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (short Quotient, short Remainder) INumber<short>.DivRem(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Max(short x, short y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Min(short x, short y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Sign(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<short>.TryCreate<TOther>(TOther value, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<short>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<short>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IParseable<short>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<short>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IShiftOperators<short, short>.operator <<(short value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IShiftOperators<short, short>.operator >>(short value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short ISignedNumber<short>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short ISpanParseable<short>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<short>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short ISubtractionOperators<short, short, short>.operator -(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IUnaryNegationOperators<short, short>.operator -(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IUnaryPlusOperators<short, short>.operator +(short value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct Int32 : System.IComparable, System.IComparable<int>, System.IConvertible, System.IEquatable<int>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<int>,
System.IMinMaxValue<int>,
System.ISignedNumber<int>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public const int MaxValue = 2147483647;
public const int MinValue = -2147483648;
public System.Int32 CompareTo(System.Int32 value) { throw null; }
public System.Int32 CompareTo(object? value) { throw null; }
public bool Equals(System.Int32 obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override System.Int32 GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Int32 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.Int32 Parse(string s) { throw null; }
public static System.Int32 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Int32 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Int32 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
System.Int32 System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out System.Int32 charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int32 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Int32 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int32 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int32 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IAdditiveIdentity<int, int>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IMinMaxValue<int>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IMinMaxValue<int>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IMultiplicativeIdentity<int, int>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IAdditionOperators<int, int, int>.operator +(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.LeadingZeroCount(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.PopCount(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.RotateLeft(int value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.RotateRight(int value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.TrailingZeroCount(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<int>.IsPow2(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryNumber<int>.Log2(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBitwiseOperators<int, int, int>.operator &(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBitwiseOperators<int, int, int>.operator |(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBitwiseOperators<int, int, int>.operator ^(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBitwiseOperators<int, int, int>.operator ~(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<int, int>.operator <(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<int, int>.operator <=(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<int, int>.operator >(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<int, int>.operator >=(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IDecrementOperators<int>.operator --(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IDivisionOperators<int, int, int>.operator /(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<int, int>.operator ==(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<int, int>.operator !=(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IIncrementOperators<int>.operator ++(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IModulusOperators<int, int, int>.operator %(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IMultiplyOperators<int, int, int>.operator *(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Abs(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Clamp(int value, int min, int max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (int Quotient, int Remainder) INumber<int>.DivRem(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Max(int x, int y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Min(int x, int y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Sign(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<int>.TryCreate<TOther>(TOther value, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<int>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<int>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IParseable<int>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<int>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IShiftOperators<int, int>.operator <<(int value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IShiftOperators<int, int>.operator >>(int value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int ISignedNumber<int>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int ISpanParseable<int>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<int>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int ISubtractionOperators<int, int, int>.operator -(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IUnaryNegationOperators<int, int>.operator -(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IUnaryPlusOperators<int, int>.operator +(int value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct Int64 : System.IComparable, System.IComparable<long>, System.IConvertible, System.IEquatable<long>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<long>,
System.IMinMaxValue<long>,
System.ISignedNumber<long>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly long _dummyPrimitive;
public const long MaxValue = (long)9223372036854775807;
public const long MinValue = (long)-9223372036854775808;
public int CompareTo(System.Int64 value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Int64 obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Int64 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.Int64 Parse(string s) { throw null; }
public static System.Int64 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Int64 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Int64 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
System.Int64 System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int64 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Int64 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int64 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int64 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IAdditiveIdentity<long, long>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IMinMaxValue<long>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IMinMaxValue<long>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IMultiplicativeIdentity<long, long>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IAdditionOperators<long, long, long>.operator +(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.LeadingZeroCount(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.PopCount(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.RotateLeft(long value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.RotateRight(long value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.TrailingZeroCount(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<long>.IsPow2(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryNumber<long>.Log2(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBitwiseOperators<long, long, long>.operator &(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBitwiseOperators<long, long, long>.operator |(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBitwiseOperators<long, long, long>.operator ^(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBitwiseOperators<long, long, long>.operator ~(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<long, long>.operator <(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<long, long>.operator <=(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<long, long>.operator >(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<long, long>.operator >=(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IDecrementOperators<long>.operator --(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IDivisionOperators<long, long, long>.operator /(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<long, long>.operator ==(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<long, long>.operator !=(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IIncrementOperators<long>.operator ++(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IModulusOperators<long, long, long>.operator %(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IMultiplyOperators<long, long, long>.operator *(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Abs(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Clamp(long value, long min, long max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (long Quotient, long Remainder) INumber<long>.DivRem(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Max(long x, long y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Min(long x, long y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Sign(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<long>.TryCreate<TOther>(TOther value, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<long>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<long>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IParseable<long>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<long>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IShiftOperators<long, long>.operator <<(long value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IShiftOperators<long, long>.operator >>(long value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long ISignedNumber<long>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long ISpanParseable<long>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<long>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long ISubtractionOperators<long, long, long>.operator -(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IUnaryNegationOperators<long, long>.operator -(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IUnaryPlusOperators<long, long>.operator +(long value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct IntPtr : System.IComparable, System.IComparable<nint>, System.IEquatable<nint>, System.ISpanFormattable, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<nint>,
System.IMinMaxValue<nint>,
System.ISignedNumber<nint>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.IntPtr Zero;
public IntPtr(int value) { throw null; }
public IntPtr(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe IntPtr(void* value) { throw null; }
public static System.IntPtr MaxValue { get { throw null; } }
public static System.IntPtr MinValue { get { throw null; } }
public static int Size { get { throw null; } }
public static System.IntPtr Add(System.IntPtr pointer, int offset) { throw null; }
public int CompareTo(System.IntPtr value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.IntPtr other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static System.IntPtr operator +(System.IntPtr pointer, int offset) { throw null; }
public static bool operator ==(System.IntPtr value1, System.IntPtr value2) { throw null; }
public static explicit operator System.IntPtr (int value) { throw null; }
public static explicit operator System.IntPtr (long value) { throw null; }
public static explicit operator int (System.IntPtr value) { throw null; }
public static explicit operator long (System.IntPtr value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static explicit operator void* (System.IntPtr value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static explicit operator System.IntPtr (void* value) { throw null; }
public static bool operator !=(System.IntPtr value1, System.IntPtr value2) { throw null; }
public static System.IntPtr operator -(System.IntPtr pointer, int offset) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static System.IntPtr Parse(string s) { throw null; }
public static System.IntPtr Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.IntPtr Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.IntPtr Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.IntPtr Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.IntPtr Subtract(System.IntPtr pointer, int offset) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public int ToInt32() { throw null; }
public long ToInt64() { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe void* ToPointer() { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.IntPtr result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.IntPtr result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.IntPtr result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.IntPtr result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IAdditiveIdentity<nint, nint>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IMinMaxValue<nint>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IMinMaxValue<nint>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IMultiplicativeIdentity<nint, nint>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IAdditionOperators<nint, nint, nint>.operator +(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.LeadingZeroCount(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.PopCount(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.RotateLeft(nint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.RotateRight(nint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.TrailingZeroCount(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<nint>.IsPow2(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryNumber<nint>.Log2(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBitwiseOperators<nint, nint, nint>.operator &(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBitwiseOperators<nint, nint, nint>.operator |(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBitwiseOperators<nint, nint, nint>.operator ^(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBitwiseOperators<nint, nint, nint>.operator ~(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nint, nint>.operator <(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nint, nint>.operator <=(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nint, nint>.operator >(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nint, nint>.operator >=(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IDecrementOperators<nint>.operator --(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IDivisionOperators<nint, nint, nint>.operator /(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<nint, nint>.operator ==(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<nint, nint>.operator !=(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IIncrementOperators<nint>.operator ++(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IModulusOperators<nint, nint, nint>.operator %(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IMultiplyOperators<nint, nint, nint>.operator *(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Abs(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Clamp(nint value, nint min, nint max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (nint Quotient, nint Remainder) INumber<nint>.DivRem(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Max(nint x, nint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Min(nint x, nint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Sign(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nint>.TryCreate<TOther>(TOther value, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nint>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IParseable<nint>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<nint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IShiftOperators<nint, nint>.operator <<(nint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IShiftOperators<nint, nint>.operator >>(nint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint ISignedNumber<nint>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint ISpanParseable<nint>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<nint>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint ISubtractionOperators<nint, nint, nint>.operator -(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IUnaryNegationOperators<nint, nint>.operator -(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IUnaryPlusOperators<nint, nint>.operator +(nint value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial class InvalidCastException : System.SystemException
{
public InvalidCastException() { }
protected InvalidCastException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidCastException(string? message) { }
public InvalidCastException(string? message, System.Exception? innerException) { }
public InvalidCastException(string? message, int errorCode) { }
}
public partial class InvalidOperationException : System.SystemException
{
public InvalidOperationException() { }
protected InvalidOperationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidOperationException(string? message) { }
public InvalidOperationException(string? message, System.Exception? innerException) { }
}
public sealed partial class InvalidProgramException : System.SystemException
{
public InvalidProgramException() { }
public InvalidProgramException(string? message) { }
public InvalidProgramException(string? message, System.Exception? inner) { }
}
public partial class InvalidTimeZoneException : System.Exception
{
public InvalidTimeZoneException() { }
protected InvalidTimeZoneException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidTimeZoneException(string? message) { }
public InvalidTimeZoneException(string? message, System.Exception? innerException) { }
}
public partial interface IObservable<out T>
{
System.IDisposable Subscribe(System.IObserver<T> observer);
}
public partial interface IObserver<in T>
{
void OnCompleted();
void OnError(System.Exception error);
void OnNext(T value);
}
public partial interface IProgress<in T>
{
void Report(T value);
}
public partial interface ISpanFormattable : System.IFormattable
{
bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider);
}
public partial class Lazy<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T>
{
public Lazy() { }
public Lazy(bool isThreadSafe) { }
public Lazy(System.Func<T> valueFactory) { }
public Lazy(System.Func<T> valueFactory, bool isThreadSafe) { }
public Lazy(System.Func<T> valueFactory, System.Threading.LazyThreadSafetyMode mode) { }
public Lazy(System.Threading.LazyThreadSafetyMode mode) { }
public Lazy(T value) { }
public bool IsValueCreated { get { throw null; } }
public T Value { get { throw null; } }
public override string? ToString() { throw null; }
}
public partial class Lazy<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T, TMetadata> : System.Lazy<T>
{
public Lazy(System.Func<T> valueFactory, TMetadata metadata) { }
public Lazy(System.Func<T> valueFactory, TMetadata metadata, bool isThreadSafe) { }
public Lazy(System.Func<T> valueFactory, TMetadata metadata, System.Threading.LazyThreadSafetyMode mode) { }
public Lazy(TMetadata metadata) { }
public Lazy(TMetadata metadata, bool isThreadSafe) { }
public Lazy(TMetadata metadata, System.Threading.LazyThreadSafetyMode mode) { }
public TMetadata Metadata { get { throw null; } }
}
public partial class LdapStyleUriParser : System.UriParser
{
public LdapStyleUriParser() { }
}
public enum LoaderOptimization
{
NotSpecified = 0,
SingleDomain = 1,
MultiDomain = 2,
[System.ObsoleteAttribute("LoaderOptimization.DomainMask has been deprecated and is not supported.")]
DomainMask = 3,
MultiDomainHost = 3,
[System.ObsoleteAttribute("LoaderOptimization.DisallowBindings has been deprecated and is not supported.")]
DisallowBindings = 4,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method)]
public sealed partial class LoaderOptimizationAttribute : System.Attribute
{
public LoaderOptimizationAttribute(byte value) { }
public LoaderOptimizationAttribute(System.LoaderOptimization value) { }
public System.LoaderOptimization Value { get { throw null; } }
}
public abstract partial class MarshalByRefObject
{
protected MarshalByRefObject() { }
[System.ObsoleteAttribute("This Remoting API is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0010", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public object GetLifetimeService() { throw null; }
[System.ObsoleteAttribute("This Remoting API is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0010", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public virtual object InitializeLifetimeService() { throw null; }
protected System.MarshalByRefObject MemberwiseClone(bool cloneIdentity) { throw null; }
}
public static partial class Math
{
public const double E = 2.718281828459045;
public const double PI = 3.141592653589793;
public const double Tau = 6.283185307179586;
public static decimal Abs(decimal value) { throw null; }
public static double Abs(double value) { throw null; }
public static short Abs(short value) { throw null; }
public static int Abs(int value) { throw null; }
public static long Abs(long value) { throw null; }
public static nint Abs(nint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte Abs(sbyte value) { throw null; }
public static float Abs(float value) { throw null; }
public static double Acos(double d) { throw null; }
public static double Acosh(double d) { throw null; }
public static double Asin(double d) { throw null; }
public static double Asinh(double d) { throw null; }
public static double Atan(double d) { throw null; }
public static double Atan2(double y, double x) { throw null; }
public static double Atanh(double d) { throw null; }
public static long BigMul(int a, int b) { throw null; }
public static long BigMul(long a, long b, out long low) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong BigMul(ulong a, ulong b, out ulong low) { throw null; }
public static double BitDecrement(double x) { throw null; }
public static double BitIncrement(double x) { throw null; }
public static double Cbrt(double d) { throw null; }
public static decimal Ceiling(decimal d) { throw null; }
public static double Ceiling(double a) { throw null; }
public static byte Clamp(byte value, byte min, byte max) { throw null; }
public static decimal Clamp(decimal value, decimal min, decimal max) { throw null; }
public static double Clamp(double value, double min, double max) { throw null; }
public static short Clamp(short value, short min, short max) { throw null; }
public static int Clamp(int value, int min, int max) { throw null; }
public static long Clamp(long value, long min, long max) { throw null; }
public static nint Clamp(nint value, nint min, nint max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte Clamp(sbyte value, sbyte min, sbyte max) { throw null; }
public static float Clamp(float value, float min, float max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort Clamp(ushort value, ushort min, ushort max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint Clamp(uint value, uint min, uint max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong Clamp(ulong value, ulong min, ulong max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint Clamp(nuint value, nuint min, nuint max) { throw null; }
public static double CopySign(double x, double y) { throw null; }
public static double Cos(double d) { throw null; }
public static double Cosh(double value) { throw null; }
public static int DivRem(int a, int b, out int result) { throw null; }
public static long DivRem(long a, long b, out long result) { throw null; }
public static (byte Quotient, byte Remainder) DivRem(byte left, byte right) { throw null; }
public static (short Quotient, short Remainder) DivRem(short left, short right) { throw null; }
public static (int Quotient, int Remainder) DivRem(int left, int right) { throw null; }
public static (long Quotient, long Remainder) DivRem(long left, long right) { throw null; }
public static (nint Quotient, nint Remainder) DivRem(nint left, nint right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (sbyte Quotient, sbyte Remainder) DivRem(sbyte left, sbyte right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (ushort Quotient, ushort Remainder) DivRem(ushort left, ushort right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (uint Quotient, uint Remainder) DivRem(uint left, uint right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (ulong Quotient, ulong Remainder) DivRem(ulong left, ulong right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (nuint Quotient, nuint Remainder) DivRem(nuint left, nuint right) { throw null; }
public static double Exp(double d) { throw null; }
public static decimal Floor(decimal d) { throw null; }
public static double Floor(double d) { throw null; }
public static double FusedMultiplyAdd(double x, double y, double z) { throw null; }
public static double IEEERemainder(double x, double y) { throw null; }
public static int ILogB(double x) { throw null; }
public static double Log(double d) { throw null; }
public static double Log(double a, double newBase) { throw null; }
public static double Log10(double d) { throw null; }
public static double Log2(double x) { throw null; }
public static byte Max(byte val1, byte val2) { throw null; }
public static decimal Max(decimal val1, decimal val2) { throw null; }
public static double Max(double val1, double val2) { throw null; }
public static short Max(short val1, short val2) { throw null; }
public static int Max(int val1, int val2) { throw null; }
public static long Max(long val1, long val2) { throw null; }
public static nint Max(nint val1, nint val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte Max(sbyte val1, sbyte val2) { throw null; }
public static float Max(float val1, float val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort Max(ushort val1, ushort val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint Max(uint val1, uint val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong Max(ulong val1, ulong val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint Max(nuint val1, nuint val2) { throw null; }
public static double MaxMagnitude(double x, double y) { throw null; }
public static byte Min(byte val1, byte val2) { throw null; }
public static decimal Min(decimal val1, decimal val2) { throw null; }
public static double Min(double val1, double val2) { throw null; }
public static short Min(short val1, short val2) { throw null; }
public static int Min(int val1, int val2) { throw null; }
public static long Min(long val1, long val2) { throw null; }
public static nint Min(nint val1, nint val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte Min(sbyte val1, sbyte val2) { throw null; }
public static float Min(float val1, float val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort Min(ushort val1, ushort val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint Min(uint val1, uint val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong Min(ulong val1, ulong val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint Min(nuint val1, nuint val2) { throw null; }
public static double MinMagnitude(double x, double y) { throw null; }
public static double Pow(double x, double y) { throw null; }
public static double ReciprocalEstimate(double d) { throw null; }
public static double ReciprocalSqrtEstimate(double d) { throw null; }
public static decimal Round(decimal d) { throw null; }
public static decimal Round(decimal d, int decimals) { throw null; }
public static decimal Round(decimal d, int decimals, System.MidpointRounding mode) { throw null; }
public static decimal Round(decimal d, System.MidpointRounding mode) { throw null; }
public static double Round(double a) { throw null; }
public static double Round(double value, int digits) { throw null; }
public static double Round(double value, int digits, System.MidpointRounding mode) { throw null; }
public static double Round(double value, System.MidpointRounding mode) { throw null; }
public static double ScaleB(double x, int n) { throw null; }
public static int Sign(decimal value) { throw null; }
public static int Sign(double value) { throw null; }
public static int Sign(short value) { throw null; }
public static int Sign(int value) { throw null; }
public static int Sign(long value) { throw null; }
public static int Sign(nint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int Sign(sbyte value) { throw null; }
public static int Sign(float value) { throw null; }
public static double Sin(double a) { throw null; }
public static (double Sin, double Cos) SinCos(double x) { throw null; }
public static double Sinh(double value) { throw null; }
public static double Sqrt(double d) { throw null; }
public static double Tan(double a) { throw null; }
public static double Tanh(double value) { throw null; }
public static decimal Truncate(decimal d) { throw null; }
public static double Truncate(double d) { throw null; }
}
public static partial class MathF
{
public const float E = 2.7182817f;
public const float PI = 3.1415927f;
public const float Tau = 6.2831855f;
public static float Abs(float x) { throw null; }
public static float Acos(float x) { throw null; }
public static float Acosh(float x) { throw null; }
public static float Asin(float x) { throw null; }
public static float Asinh(float x) { throw null; }
public static float Atan(float x) { throw null; }
public static float Atan2(float y, float x) { throw null; }
public static float Atanh(float x) { throw null; }
public static float BitDecrement(float x) { throw null; }
public static float BitIncrement(float x) { throw null; }
public static float Cbrt(float x) { throw null; }
public static float Ceiling(float x) { throw null; }
public static float CopySign(float x, float y) { throw null; }
public static float Cos(float x) { throw null; }
public static float Cosh(float x) { throw null; }
public static float Exp(float x) { throw null; }
public static float Floor(float x) { throw null; }
public static float FusedMultiplyAdd(float x, float y, float z) { throw null; }
public static float IEEERemainder(float x, float y) { throw null; }
public static int ILogB(float x) { throw null; }
public static float Log(float x) { throw null; }
public static float Log(float x, float y) { throw null; }
public static float Log10(float x) { throw null; }
public static float Log2(float x) { throw null; }
public static float Max(float x, float y) { throw null; }
public static float MaxMagnitude(float x, float y) { throw null; }
public static float Min(float x, float y) { throw null; }
public static float MinMagnitude(float x, float y) { throw null; }
public static float Pow(float x, float y) { throw null; }
public static float ReciprocalEstimate(float x) { throw null; }
public static float ReciprocalSqrtEstimate(float x) { throw null; }
public static float Round(float x) { throw null; }
public static float Round(float x, int digits) { throw null; }
public static float Round(float x, int digits, System.MidpointRounding mode) { throw null; }
public static float Round(float x, System.MidpointRounding mode) { throw null; }
public static float ScaleB(float x, int n) { throw null; }
public static int Sign(float x) { throw null; }
public static float Sin(float x) { throw null; }
public static (float Sin, float Cos) SinCos(float x) { throw null; }
public static float Sinh(float x) { throw null; }
public static float Sqrt(float x) { throw null; }
public static float Tan(float x) { throw null; }
public static float Tanh(float x) { throw null; }
public static float Truncate(float x) { throw null; }
}
public partial class MemberAccessException : System.SystemException
{
public MemberAccessException() { }
protected MemberAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MemberAccessException(string? message) { }
public MemberAccessException(string? message, System.Exception? inner) { }
}
public readonly partial struct Memory<T> : System.IEquatable<System.Memory<T>>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public Memory(T[]? array) { throw null; }
public Memory(T[]? array, int start, int length) { throw null; }
public static System.Memory<T> Empty { get { throw null; } }
public bool IsEmpty { get { throw null; } }
public int Length { get { throw null; } }
public System.Span<T> Span { get { throw null; } }
public void CopyTo(System.Memory<T> destination) { }
public bool Equals(System.Memory<T> other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static implicit operator System.Memory<T> (System.ArraySegment<T> segment) { throw null; }
public static implicit operator System.ReadOnlyMemory<T> (System.Memory<T> memory) { throw null; }
public static implicit operator System.Memory<T> (T[]? array) { throw null; }
public System.Buffers.MemoryHandle Pin() { throw null; }
public System.Memory<T> Slice(int start) { throw null; }
public System.Memory<T> Slice(int start, int length) { throw null; }
public T[] ToArray() { throw null; }
public override string ToString() { throw null; }
public bool TryCopyTo(System.Memory<T> destination) { throw null; }
}
public partial class MethodAccessException : System.MemberAccessException
{
public MethodAccessException() { }
protected MethodAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MethodAccessException(string? message) { }
public MethodAccessException(string? message, System.Exception? inner) { }
}
public enum MidpointRounding
{
ToEven = 0,
AwayFromZero = 1,
ToZero = 2,
ToNegativeInfinity = 3,
ToPositiveInfinity = 4,
}
public partial class MissingFieldException : System.MissingMemberException, System.Runtime.Serialization.ISerializable
{
public MissingFieldException() { }
protected MissingFieldException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingFieldException(string? message) { }
public MissingFieldException(string? message, System.Exception? inner) { }
public MissingFieldException(string? className, string? fieldName) { }
public override string Message { get { throw null; } }
}
public partial class MissingMemberException : System.MemberAccessException, System.Runtime.Serialization.ISerializable
{
protected string? ClassName;
protected string? MemberName;
protected byte[]? Signature;
public MissingMemberException() { }
protected MissingMemberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingMemberException(string? message) { }
public MissingMemberException(string? message, System.Exception? inner) { }
public MissingMemberException(string? className, string? memberName) { }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class MissingMethodException : System.MissingMemberException
{
public MissingMethodException() { }
protected MissingMethodException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingMethodException(string? message) { }
public MissingMethodException(string? message, System.Exception? inner) { }
public MissingMethodException(string? className, string? methodName) { }
public override string Message { get { throw null; } }
}
public partial struct ModuleHandle : System.IEquatable<System.ModuleHandle>
{
private object _dummy;
private int _dummyPrimitive;
public static readonly System.ModuleHandle EmptyHandle;
public int MDStreamVersion { get { throw null; } }
public bool Equals(System.ModuleHandle handle) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeFieldHandle GetRuntimeFieldHandleFromMetadataToken(int fieldToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeMethodHandle GetRuntimeMethodHandleFromMetadataToken(int methodToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeTypeHandle GetRuntimeTypeHandleFromMetadataToken(int typeToken) { throw null; }
public static bool operator ==(System.ModuleHandle left, System.ModuleHandle right) { throw null; }
public static bool operator !=(System.ModuleHandle left, System.ModuleHandle right) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeFieldHandle ResolveFieldHandle(int fieldToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeFieldHandle ResolveFieldHandle(int fieldToken, System.RuntimeTypeHandle[]? typeInstantiationContext, System.RuntimeTypeHandle[]? methodInstantiationContext) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeMethodHandle ResolveMethodHandle(int methodToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeMethodHandle ResolveMethodHandle(int methodToken, System.RuntimeTypeHandle[]? typeInstantiationContext, System.RuntimeTypeHandle[]? methodInstantiationContext) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeTypeHandle ResolveTypeHandle(int typeToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeTypeHandle ResolveTypeHandle(int typeToken, System.RuntimeTypeHandle[]? typeInstantiationContext, System.RuntimeTypeHandle[]? methodInstantiationContext) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method)]
public sealed partial class MTAThreadAttribute : System.Attribute
{
public MTAThreadAttribute() { }
}
public abstract partial class MulticastDelegate : System.Delegate
{
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
protected MulticastDelegate(object target, string method) : base (default(object), default(string)) { }
protected MulticastDelegate([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method) : base (default(object), default(string)) { }
protected sealed override System.Delegate CombineImpl(System.Delegate? follow) { throw null; }
public sealed override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public sealed override int GetHashCode() { throw null; }
public sealed override System.Delegate[] GetInvocationList() { throw null; }
protected override System.Reflection.MethodInfo GetMethodImpl() { throw null; }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(System.MulticastDelegate? d1, System.MulticastDelegate? d2) { throw null; }
public static bool operator !=(System.MulticastDelegate? d1, System.MulticastDelegate? d2) { throw null; }
protected sealed override System.Delegate? RemoveImpl(System.Delegate value) { throw null; }
}
public sealed partial class MulticastNotSupportedException : System.SystemException
{
public MulticastNotSupportedException() { }
public MulticastNotSupportedException(string? message) { }
public MulticastNotSupportedException(string? message, System.Exception? inner) { }
}
public partial class NetPipeStyleUriParser : System.UriParser
{
public NetPipeStyleUriParser() { }
}
public partial class NetTcpStyleUriParser : System.UriParser
{
public NetTcpStyleUriParser() { }
}
public partial class NewsStyleUriParser : System.UriParser
{
public NewsStyleUriParser() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public sealed partial class NonSerializedAttribute : System.Attribute
{
public NonSerializedAttribute() { }
}
public partial class NotFiniteNumberException : System.ArithmeticException
{
public NotFiniteNumberException() { }
public NotFiniteNumberException(double offendingNumber) { }
protected NotFiniteNumberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public NotFiniteNumberException(string? message) { }
public NotFiniteNumberException(string? message, double offendingNumber) { }
public NotFiniteNumberException(string? message, double offendingNumber, System.Exception? innerException) { }
public NotFiniteNumberException(string? message, System.Exception? innerException) { }
public double OffendingNumber { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class NotImplementedException : System.SystemException
{
public NotImplementedException() { }
protected NotImplementedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public NotImplementedException(string? message) { }
public NotImplementedException(string? message, System.Exception? inner) { }
}
public partial class NotSupportedException : System.SystemException
{
public NotSupportedException() { }
protected NotSupportedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public NotSupportedException(string? message) { }
public NotSupportedException(string? message, System.Exception? innerException) { }
}
public static partial class Nullable
{
public static int Compare<T>(T? n1, T? n2) where T : struct { throw null; }
public static bool Equals<T>(T? n1, T? n2) where T : struct { throw null; }
public static System.Type? GetUnderlyingType(System.Type nullableType) { throw null; }
public static ref readonly T GetValueRefOrDefaultRef<T>(in T? nullable) where T : struct { throw null; }
}
public partial struct Nullable<T> where T : struct
{
private T value;
private int _dummyPrimitive;
public Nullable(T value) { throw null; }
public readonly bool HasValue { get { throw null; } }
public readonly T Value { get { throw null; } }
public override bool Equals(object? other) { throw null; }
public override int GetHashCode() { throw null; }
public readonly T GetValueOrDefault() { throw null; }
public readonly T GetValueOrDefault(T defaultValue) { throw null; }
public static explicit operator T (T? value) { throw null; }
public static implicit operator T? (T value) { throw null; }
public override string? ToString() { throw null; }
}
public partial class NullReferenceException : System.SystemException
{
public NullReferenceException() { }
protected NullReferenceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public NullReferenceException(string? message) { }
public NullReferenceException(string? message, System.Exception? innerException) { }
}
public partial class Object
{
public Object() { }
public virtual bool Equals(System.Object? obj) { throw null; }
public static bool Equals(System.Object? objA, System.Object? objB) { throw null; }
~Object() { }
public virtual int GetHashCode() { throw null; }
public System.Type GetType() { throw null; }
protected System.Object MemberwiseClone() { throw null; }
public static bool ReferenceEquals(System.Object? objA, System.Object? objB) { throw null; }
public virtual string? ToString() { throw null; }
}
public partial class ObjectDisposedException : System.InvalidOperationException
{
protected ObjectDisposedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ObjectDisposedException(string? objectName) { }
public ObjectDisposedException(string? message, System.Exception? innerException) { }
public ObjectDisposedException(string? objectName, string? message) { }
public override string Message { get { throw null; } }
public string ObjectName { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static void ThrowIf([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(true)] bool condition, object instance) => throw null;
public static void ThrowIf([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(true)] bool condition, System.Type type) => throw null;
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class ObsoleteAttribute : System.Attribute
{
public ObsoleteAttribute() { }
public ObsoleteAttribute(string? message) { }
public ObsoleteAttribute(string? message, bool error) { }
public string? DiagnosticId { get { throw null; } set { } }
public bool IsError { get { throw null; } }
public string? Message { get { throw null; } }
public string? UrlFormat { get { throw null; } set { } }
}
public sealed partial class OperatingSystem : System.ICloneable, System.Runtime.Serialization.ISerializable
{
public OperatingSystem(System.PlatformID platform, System.Version version) { }
public System.PlatformID Platform { get { throw null; } }
public string ServicePack { get { throw null; } }
public System.Version Version { get { throw null; } }
public string VersionString { get { throw null; } }
public object Clone() { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool IsAndroid() { throw null; }
public static bool IsAndroidVersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0) { throw null; }
public static bool IsBrowser() { throw null; }
public static bool IsFreeBSD() { throw null; }
public static bool IsFreeBSDVersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformGuardAttribute("maccatalyst")]
public static bool IsIOS() { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformGuardAttribute("maccatalyst")]
public static bool IsIOSVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsLinux() { throw null; }
public static bool IsMacCatalyst() { throw null; }
public static bool IsMacCatalystVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsMacOS() { throw null; }
public static bool IsMacOSVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsOSPlatform(string platform) { throw null; }
public static bool IsOSPlatformVersionAtLeast(string platform, int major, int minor = 0, int build = 0, int revision = 0) { throw null; }
public static bool IsTvOS() { throw null; }
public static bool IsTvOSVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsWatchOS() { throw null; }
public static bool IsWatchOSVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsWindows() { throw null; }
public static bool IsWindowsVersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0) { throw null; }
public override string ToString() { throw null; }
}
public partial class OperationCanceledException : System.SystemException
{
public OperationCanceledException() { }
protected OperationCanceledException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public OperationCanceledException(string? message) { }
public OperationCanceledException(string? message, System.Exception? innerException) { }
public OperationCanceledException(string? message, System.Exception? innerException, System.Threading.CancellationToken token) { }
public OperationCanceledException(string? message, System.Threading.CancellationToken token) { }
public OperationCanceledException(System.Threading.CancellationToken token) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } }
}
public partial class OutOfMemoryException : System.SystemException
{
public OutOfMemoryException() { }
protected OutOfMemoryException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public OutOfMemoryException(string? message) { }
public OutOfMemoryException(string? message, System.Exception? innerException) { }
}
public partial class OverflowException : System.ArithmeticException
{
public OverflowException() { }
protected OverflowException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public OverflowException(string? message) { }
public OverflowException(string? message, System.Exception? innerException) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=true, AllowMultiple=false)]
public sealed partial class ParamArrayAttribute : System.Attribute
{
public ParamArrayAttribute() { }
}
public enum PlatformID
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
Win32S = 0,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
Win32Windows = 1,
Win32NT = 2,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
WinCE = 3,
Unix = 4,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
Xbox = 5,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
MacOSX = 6,
Other = 7,
}
public partial class PlatformNotSupportedException : System.NotSupportedException
{
public PlatformNotSupportedException() { }
protected PlatformNotSupportedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public PlatformNotSupportedException(string? message) { }
public PlatformNotSupportedException(string? message, System.Exception? inner) { }
}
public delegate bool Predicate<in T>(T obj);
public partial class Progress<T> : System.IProgress<T>
{
public Progress() { }
public Progress(System.Action<T> handler) { }
public event System.EventHandler<T>? ProgressChanged { add { } remove { } }
protected virtual void OnReport(T value) { }
void System.IProgress<T>.Report(T value) { }
}
public partial class Random
{
public Random() { }
public Random(int Seed) { }
public static System.Random Shared { get { throw null; } }
public virtual int Next() { throw null; }
public virtual int Next(int maxValue) { throw null; }
public virtual int Next(int minValue, int maxValue) { throw null; }
public virtual void NextBytes(byte[] buffer) { }
public virtual void NextBytes(System.Span<byte> buffer) { }
public virtual double NextDouble() { throw null; }
public virtual long NextInt64() { throw null; }
public virtual long NextInt64(long maxValue) { throw null; }
public virtual long NextInt64(long minValue, long maxValue) { throw null; }
public virtual float NextSingle() { throw null; }
protected virtual double Sample() { throw null; }
}
public readonly partial struct Range : System.IEquatable<System.Range>
{
private readonly int _dummyPrimitive;
public Range(System.Index start, System.Index end) { throw null; }
public static System.Range All { get { throw null; } }
public System.Index End { get { throw null; } }
public System.Index Start { get { throw null; } }
public static System.Range EndAt(System.Index end) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public bool Equals(System.Range other) { throw null; }
public override int GetHashCode() { throw null; }
public (int Offset, int Length) GetOffsetAndLength(int length) { throw null; }
public static System.Range StartAt(System.Index start) { throw null; }
public override string ToString() { throw null; }
}
public partial class RankException : System.SystemException
{
public RankException() { }
protected RankException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public RankException(string? message) { }
public RankException(string? message, System.Exception? innerException) { }
}
public readonly partial struct ReadOnlyMemory<T> : System.IEquatable<System.ReadOnlyMemory<T>>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ReadOnlyMemory(T[]? array) { throw null; }
public ReadOnlyMemory(T[]? array, int start, int length) { throw null; }
public static System.ReadOnlyMemory<T> Empty { get { throw null; } }
public bool IsEmpty { get { throw null; } }
public int Length { get { throw null; } }
public System.ReadOnlySpan<T> Span { get { throw null; } }
public void CopyTo(System.Memory<T> destination) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.ReadOnlyMemory<T> other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static implicit operator System.ReadOnlyMemory<T> (System.ArraySegment<T> segment) { throw null; }
public static implicit operator System.ReadOnlyMemory<T> (T[]? array) { throw null; }
public System.Buffers.MemoryHandle Pin() { throw null; }
public System.ReadOnlyMemory<T> Slice(int start) { throw null; }
public System.ReadOnlyMemory<T> Slice(int start, int length) { throw null; }
public T[] ToArray() { throw null; }
public override string ToString() { throw null; }
public bool TryCopyTo(System.Memory<T> destination) { throw null; }
}
public readonly ref partial struct ReadOnlySpan<T>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
[System.CLSCompliantAttribute(false)]
public unsafe ReadOnlySpan(void* pointer, int length) { throw null; }
public ReadOnlySpan(T[]? array) { throw null; }
public ReadOnlySpan(T[]? array, int start, int length) { throw null; }
public static System.ReadOnlySpan<T> Empty { get { throw null; } }
public bool IsEmpty { get { throw null; } }
public ref readonly T this[int index] { get { throw null; } }
public int Length { get { throw null; } }
public void CopyTo(System.Span<T> destination) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Equals() on ReadOnlySpan will always throw an exception. Use the equality operator instead.")]
public override bool Equals(object? obj) { throw null; }
public System.ReadOnlySpan<T>.Enumerator GetEnumerator() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("GetHashCode() on ReadOnlySpan will always throw an exception.")]
public override int GetHashCode() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public ref readonly T GetPinnableReference() { throw null; }
public static bool operator ==(System.ReadOnlySpan<T> left, System.ReadOnlySpan<T> right) { throw null; }
public static implicit operator System.ReadOnlySpan<T> (System.ArraySegment<T> segment) { throw null; }
public static implicit operator System.ReadOnlySpan<T> (T[]? array) { throw null; }
public static bool operator !=(System.ReadOnlySpan<T> left, System.ReadOnlySpan<T> right) { throw null; }
public System.ReadOnlySpan<T> Slice(int start) { throw null; }
public System.ReadOnlySpan<T> Slice(int start, int length) { throw null; }
public T[] ToArray() { throw null; }
public override string ToString() { throw null; }
public bool TryCopyTo(System.Span<T> destination) { throw null; }
public ref partial struct Enumerator
{
private object _dummy;
private int _dummyPrimitive;
public ref readonly T Current { get { throw null; } }
public bool MoveNext() { throw null; }
}
}
public partial class ResolveEventArgs : System.EventArgs
{
public ResolveEventArgs(string name) { }
public ResolveEventArgs(string name, System.Reflection.Assembly? requestingAssembly) { }
public string Name { get { throw null; } }
public System.Reflection.Assembly? RequestingAssembly { get { throw null; } }
}
public delegate System.Reflection.Assembly? ResolveEventHandler(object? sender, System.ResolveEventArgs args);
public ref partial struct RuntimeArgumentHandle
{
private int _dummyPrimitive;
}
public partial struct RuntimeFieldHandle : System.IEquatable<System.RuntimeFieldHandle>, System.Runtime.Serialization.ISerializable
{
private object _dummy;
private int _dummyPrimitive;
public System.IntPtr Value { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public bool Equals(System.RuntimeFieldHandle handle) { throw null; }
public override int GetHashCode() { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(System.RuntimeFieldHandle left, System.RuntimeFieldHandle right) { throw null; }
public static bool operator !=(System.RuntimeFieldHandle left, System.RuntimeFieldHandle right) { throw null; }
}
public partial struct RuntimeMethodHandle : System.IEquatable<System.RuntimeMethodHandle>, System.Runtime.Serialization.ISerializable
{
private object _dummy;
private int _dummyPrimitive;
public System.IntPtr Value { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public bool Equals(System.RuntimeMethodHandle handle) { throw null; }
public System.IntPtr GetFunctionPointer() { throw null; }
public override int GetHashCode() { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(System.RuntimeMethodHandle left, System.RuntimeMethodHandle right) { throw null; }
public static bool operator !=(System.RuntimeMethodHandle left, System.RuntimeMethodHandle right) { throw null; }
}
public partial struct RuntimeTypeHandle : System.IEquatable<System.RuntimeTypeHandle>, System.Runtime.Serialization.ISerializable
{
private object _dummy;
private int _dummyPrimitive;
public System.IntPtr Value { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public bool Equals(System.RuntimeTypeHandle handle) { throw null; }
public override int GetHashCode() { throw null; }
public System.ModuleHandle GetModuleHandle() { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(object? left, System.RuntimeTypeHandle right) { throw null; }
public static bool operator ==(System.RuntimeTypeHandle left, object? right) { throw null; }
public static bool operator !=(object? left, System.RuntimeTypeHandle right) { throw null; }
public static bool operator !=(System.RuntimeTypeHandle left, object? right) { throw null; }
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct SByte : System.IComparable, System.IComparable<sbyte>, System.IConvertible, System.IEquatable<sbyte>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<sbyte>,
System.IMinMaxValue<sbyte>,
System.ISignedNumber<sbyte>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly sbyte _dummyPrimitive;
public const sbyte MaxValue = (sbyte)127;
public const sbyte MinValue = (sbyte)-128;
public int CompareTo(object? obj) { throw null; }
public int CompareTo(System.SByte value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.SByte obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.SByte Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.SByte Parse(string s) { throw null; }
public static System.SByte Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.SByte Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.SByte Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
System.SByte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.SByte result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.SByte result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.SByte result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.SByte result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IAdditiveIdentity<sbyte, sbyte>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IMinMaxValue<sbyte>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IMinMaxValue<sbyte>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IMultiplicativeIdentity<sbyte, sbyte>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IAdditionOperators<sbyte, sbyte, sbyte>.operator +(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.LeadingZeroCount(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.PopCount(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.RotateLeft(sbyte value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.RotateRight(sbyte value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.TrailingZeroCount(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<sbyte>.IsPow2(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryNumber<sbyte>.Log2(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBitwiseOperators<sbyte, sbyte, sbyte>.operator &(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBitwiseOperators<sbyte, sbyte, sbyte>.operator |(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBitwiseOperators<sbyte, sbyte, sbyte>.operator ^(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBitwiseOperators<sbyte, sbyte, sbyte>.operator ~(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<sbyte, sbyte>.operator <(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<sbyte, sbyte>.operator <=(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<sbyte, sbyte>.operator >(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<sbyte, sbyte>.operator >=(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IDecrementOperators<sbyte>.operator --(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IDivisionOperators<sbyte, sbyte, sbyte>.operator /(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<sbyte, sbyte>.operator ==(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<sbyte, sbyte>.operator !=(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IIncrementOperators<sbyte>.operator ++(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IModulusOperators<sbyte, sbyte, sbyte>.operator %(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IMultiplyOperators<sbyte, sbyte, sbyte>.operator *(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Abs(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Clamp(sbyte value, sbyte min, sbyte max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (sbyte Quotient, sbyte Remainder) INumber<sbyte>.DivRem(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Max(sbyte x, sbyte y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Min(sbyte x, sbyte y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Sign(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<sbyte>.TryCreate<TOther>(TOther value, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<sbyte>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<sbyte>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IParseable<sbyte>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<sbyte>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IShiftOperators<sbyte, sbyte>.operator <<(sbyte value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IShiftOperators<sbyte, sbyte>.operator >>(sbyte value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte ISignedNumber<sbyte>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte ISpanParseable<sbyte>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<sbyte>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte ISubtractionOperators<sbyte, sbyte, sbyte>.operator -(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IUnaryNegationOperators<sbyte, sbyte>.operator -(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IUnaryPlusOperators<sbyte, sbyte>.operator +(sbyte value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class SerializableAttribute : System.Attribute
{
public SerializableAttribute() { }
}
public readonly partial struct Single : System.IComparable, System.IComparable<float>, System.IConvertible, System.IEquatable<float>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryFloatingPoint<float>,
System.IMinMaxValue<float>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly float _dummyPrimitive;
public const float Epsilon = 1E-45f;
public const float MaxValue = 3.4028235E+38f;
public const float MinValue = -3.4028235E+38f;
public const float NaN = 0.0f / 0.0f;
public const float NegativeInfinity = -1.0f / 0.0f;
public const float PositiveInfinity = 1.0f / 0.0f;
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.Single value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Single obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static bool IsFinite(System.Single f) { throw null; }
public static bool IsInfinity(System.Single f) { throw null; }
public static bool IsNaN(System.Single f) { throw null; }
public static bool IsNegative(System.Single f) { throw null; }
public static bool IsNegativeInfinity(System.Single f) { throw null; }
public static bool IsNormal(System.Single f) { throw null; }
public static bool IsPositiveInfinity(System.Single f) { throw null; }
public static bool IsSubnormal(System.Single f) { throw null; }
public static bool operator ==(System.Single left, System.Single right) { throw null; }
public static bool operator >(System.Single left, System.Single right) { throw null; }
public static bool operator >=(System.Single left, System.Single right) { throw null; }
public static bool operator !=(System.Single left, System.Single right) { throw null; }
public static bool operator <(System.Single left, System.Single right) { throw null; }
public static bool operator <=(System.Single left, System.Single right) { throw null; }
public static System.Single Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Single Parse(string s) { throw null; }
public static System.Single Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Single Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Single Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
System.Single System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Single result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Single result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Single result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Single result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IAdditiveIdentity<float, float>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.E { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Epsilon { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.NaN { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.NegativeInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.NegativeZero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Pi { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.PositiveInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Tau { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IMinMaxValue<float>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IMinMaxValue<float>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IMultiplicativeIdentity<float, float>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IAdditionOperators<float, float, float>.operator +(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<float>.IsPow2(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBinaryNumber<float>.Log2(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBitwiseOperators<float, float, float>.operator &(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBitwiseOperators<float, float, float>.operator |(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBitwiseOperators<float, float, float>.operator ^(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBitwiseOperators<float, float, float>.operator ~(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<float, float>.operator <(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<float, float>.operator <=(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<float, float>.operator >(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<float, float>.operator >=(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IDecrementOperators<float>.operator --(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IDivisionOperators<float, float, float>.operator /(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<float, float>.operator ==(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<float, float>.operator !=(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Acos(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Acosh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Asin(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Asinh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Atan(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Atan2(float y, float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Atanh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.BitIncrement(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.BitDecrement(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Cbrt(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Ceiling(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.CopySign(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Cos(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Cosh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Exp(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Floor(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.FusedMultiplyAdd(float left, float right, float addend) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.IEEERemainder(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static TInteger IFloatingPoint<float>.ILogB<TInteger>(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Log(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Log(float x, float newBase) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Log2(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Log10(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.MaxMagnitude(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.MinMagnitude(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Pow(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Round(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Round<TInteger>(float x, TInteger digits) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Round(float x, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Round<TInteger>(float x, TInteger digits, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.ScaleB<TInteger>(float x, TInteger n) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Sin(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Sinh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Sqrt(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Tan(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Tanh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Truncate(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsFinite(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsInfinity(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsNaN(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsNegative(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsNegativeInfinity(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsNormal(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsPositiveInfinity(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsSubnormal(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IIncrementOperators<float>.operator ++(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IModulusOperators<float, float, float>.operator %(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IMultiplyOperators<float, float, float>.operator *(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Abs(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Clamp(float value, float min, float max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (float Quotient, float Remainder) INumber<float>.DivRem(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Max(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Min(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Sign(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<float>.TryCreate<TOther>(TOther value, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<float>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<float>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IParseable<float>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<float>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float ISignedNumber<float>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float ISpanParseable<float>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<float>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float ISubtractionOperators<float, float, float>.operator -(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IUnaryNegationOperators<float, float>.operator -(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IUnaryPlusOperators<float, float>.operator +(float value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly ref partial struct Span<T>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
[System.CLSCompliantAttribute(false)]
public unsafe Span(void* pointer, int length) { throw null; }
public Span(T[]? array) { throw null; }
public Span(T[]? array, int start, int length) { throw null; }
public static System.Span<T> Empty { get { throw null; } }
public bool IsEmpty { get { throw null; } }
public ref T this[int index] { get { throw null; } }
public int Length { get { throw null; } }
public void Clear() { }
public void CopyTo(System.Span<T> destination) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Equals() on Span will always throw an exception. Use the equality operator instead.")]
public override bool Equals(object? obj) { throw null; }
public void Fill(T value) { }
public System.Span<T>.Enumerator GetEnumerator() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("GetHashCode() on Span will always throw an exception.")]
public override int GetHashCode() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public ref T GetPinnableReference() { throw null; }
public static bool operator ==(System.Span<T> left, System.Span<T> right) { throw null; }
public static implicit operator System.Span<T> (System.ArraySegment<T> segment) { throw null; }
public static implicit operator System.ReadOnlySpan<T> (System.Span<T> span) { throw null; }
public static implicit operator System.Span<T> (T[]? array) { throw null; }
public static bool operator !=(System.Span<T> left, System.Span<T> right) { throw null; }
public System.Span<T> Slice(int start) { throw null; }
public System.Span<T> Slice(int start, int length) { throw null; }
public T[] ToArray() { throw null; }
public override string ToString() { throw null; }
public bool TryCopyTo(System.Span<T> destination) { throw null; }
public ref partial struct Enumerator
{
private object _dummy;
private int _dummyPrimitive;
public ref T Current { get { throw null; } }
public bool MoveNext() { throw null; }
}
}
public sealed partial class StackOverflowException : System.SystemException
{
public StackOverflowException() { }
public StackOverflowException(string? message) { }
public StackOverflowException(string? message, System.Exception? innerException) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method)]
public sealed partial class STAThreadAttribute : System.Attribute
{
public STAThreadAttribute() { }
}
public sealed partial class String : System.Collections.Generic.IEnumerable<char>, System.Collections.IEnumerable, System.ICloneable, System.IComparable, System.IComparable<string?>, System.IConvertible, System.IEquatable<string?>
{
public static readonly string Empty;
[System.CLSCompliantAttribute(false)]
public unsafe String(char* value) { }
[System.CLSCompliantAttribute(false)]
public unsafe String(char* value, int startIndex, int length) { }
public String(char c, int count) { }
public String(char[]? value) { }
public String(char[] value, int startIndex, int length) { }
public String(System.ReadOnlySpan<char> value) { }
[System.CLSCompliantAttribute(false)]
public unsafe String(sbyte* value) { }
[System.CLSCompliantAttribute(false)]
public unsafe String(sbyte* value, int startIndex, int length) { }
[System.CLSCompliantAttribute(false)]
public unsafe String(sbyte* value, int startIndex, int length, System.Text.Encoding enc) { }
[System.Runtime.CompilerServices.IndexerName("Chars")]
public char this[int index] { get { throw null; } }
public int Length { get { throw null; } }
public object Clone() { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length) { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length, bool ignoreCase) { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length, System.Globalization.CultureInfo? culture, System.Globalization.CompareOptions options) { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length, System.StringComparison comparisonType) { throw null; }
public static int Compare(System.String? strA, System.String? strB) { throw null; }
public static int Compare(System.String? strA, System.String? strB, bool ignoreCase) { throw null; }
public static int Compare(System.String? strA, System.String? strB, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public static int Compare(System.String? strA, System.String? strB, System.Globalization.CultureInfo? culture, System.Globalization.CompareOptions options) { throw null; }
public static int Compare(System.String? strA, System.String? strB, System.StringComparison comparisonType) { throw null; }
public static int CompareOrdinal(System.String? strA, int indexA, System.String? strB, int indexB, int length) { throw null; }
public static int CompareOrdinal(System.String? strA, System.String? strB) { throw null; }
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.String? strB) { throw null; }
public static System.String Concat(System.Collections.Generic.IEnumerable<string?> values) { throw null; }
public static System.String Concat(object? arg0) { throw null; }
public static System.String Concat(object? arg0, object? arg1) { throw null; }
public static System.String Concat(object? arg0, object? arg1, object? arg2) { throw null; }
public static System.String Concat(params object?[] args) { throw null; }
public static System.String Concat(System.ReadOnlySpan<char> str0, System.ReadOnlySpan<char> str1) { throw null; }
public static System.String Concat(System.ReadOnlySpan<char> str0, System.ReadOnlySpan<char> str1, System.ReadOnlySpan<char> str2) { throw null; }
public static System.String Concat(System.ReadOnlySpan<char> str0, System.ReadOnlySpan<char> str1, System.ReadOnlySpan<char> str2, System.ReadOnlySpan<char> str3) { throw null; }
public static System.String Concat(System.String? str0, System.String? str1) { throw null; }
public static System.String Concat(System.String? str0, System.String? str1, System.String? str2) { throw null; }
public static System.String Concat(System.String? str0, System.String? str1, System.String? str2, System.String? str3) { throw null; }
public static System.String Concat(params string?[] values) { throw null; }
public static System.String Concat<T>(System.Collections.Generic.IEnumerable<T> values) { throw null; }
public bool Contains(char value) { throw null; }
public bool Contains(char value, System.StringComparison comparisonType) { throw null; }
public bool Contains(System.String value) { throw null; }
public bool Contains(System.String value, System.StringComparison comparisonType) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This API should not be used to create mutable strings. See https://go.microsoft.com/fwlink/?linkid=2084035 for alternatives.")]
public static System.String Copy(System.String str) { throw null; }
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { }
public void CopyTo(System.Span<char> destination) { }
public static System.String Create(System.IFormatProvider? provider, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("provider")] ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler handler) { throw null; }
public static System.String Create(System.IFormatProvider? provider, System.Span<char> initialBuffer, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute(new string[]{ "provider", "initialBuffer"})] ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler handler) { throw null; }
public static System.String Create<TState>(int length, TState state, System.Buffers.SpanAction<char, TState> action) { throw null; }
public bool EndsWith(char value) { throw null; }
public bool EndsWith(System.String value) { throw null; }
public bool EndsWith(System.String value, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public bool EndsWith(System.String value, System.StringComparison comparisonType) { throw null; }
public System.Text.StringRuneEnumerator EnumerateRunes() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.String? value) { throw null; }
public static bool Equals(System.String? a, System.String? b) { throw null; }
public static bool Equals(System.String? a, System.String? b, System.StringComparison comparisonType) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.String? value, System.StringComparison comparisonType) { throw null; }
public static System.String Format(System.IFormatProvider? provider, System.String format, object? arg0) { throw null; }
public static System.String Format(System.IFormatProvider? provider, System.String format, object? arg0, object? arg1) { throw null; }
public static System.String Format(System.IFormatProvider? provider, System.String format, object? arg0, object? arg1, object? arg2) { throw null; }
public static System.String Format(System.IFormatProvider? provider, System.String format, params object?[] args) { throw null; }
public static System.String Format(System.String format, object? arg0) { throw null; }
public static System.String Format(System.String format, object? arg0, object? arg1) { throw null; }
public static System.String Format(System.String format, object? arg0, object? arg1, object? arg2) { throw null; }
public static System.String Format(System.String format, params object?[] args) { throw null; }
public System.CharEnumerator GetEnumerator() { throw null; }
public override int GetHashCode() { throw null; }
public static int GetHashCode(System.ReadOnlySpan<char> value) { throw null; }
public static int GetHashCode(System.ReadOnlySpan<char> value, System.StringComparison comparisonType) { throw null; }
public int GetHashCode(System.StringComparison comparisonType) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public ref readonly char GetPinnableReference() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public int IndexOf(char value) { throw null; }
public int IndexOf(char value, int startIndex) { throw null; }
public int IndexOf(char value, int startIndex, int count) { throw null; }
public int IndexOf(char value, System.StringComparison comparisonType) { throw null; }
public int IndexOf(System.String value) { throw null; }
public int IndexOf(System.String value, int startIndex) { throw null; }
public int IndexOf(System.String value, int startIndex, int count) { throw null; }
public int IndexOf(System.String value, int startIndex, int count, System.StringComparison comparisonType) { throw null; }
public int IndexOf(System.String value, int startIndex, System.StringComparison comparisonType) { throw null; }
public int IndexOf(System.String value, System.StringComparison comparisonType) { throw null; }
public int IndexOfAny(char[] anyOf) { throw null; }
public int IndexOfAny(char[] anyOf, int startIndex) { throw null; }
public int IndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
public System.String Insert(int startIndex, System.String value) { throw null; }
public static System.String Intern(System.String str) { throw null; }
public static System.String? IsInterned(System.String str) { throw null; }
public bool IsNormalized() { throw null; }
public bool IsNormalized(System.Text.NormalizationForm normalizationForm) { throw null; }
public static bool IsNullOrEmpty([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(false)] System.String? value) { throw null; }
public static bool IsNullOrWhiteSpace([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(false)] System.String? value) { throw null; }
public static System.String Join(char separator, params object?[] values) { throw null; }
public static System.String Join(char separator, params string?[] value) { throw null; }
public static System.String Join(char separator, string?[] value, int startIndex, int count) { throw null; }
public static System.String Join(System.String? separator, System.Collections.Generic.IEnumerable<string?> values) { throw null; }
public static System.String Join(System.String? separator, params object?[] values) { throw null; }
public static System.String Join(System.String? separator, params string?[] value) { throw null; }
public static System.String Join(System.String? separator, string?[] value, int startIndex, int count) { throw null; }
public static System.String Join<T>(char separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
public static System.String Join<T>(System.String? separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
public int LastIndexOf(char value) { throw null; }
public int LastIndexOf(char value, int startIndex) { throw null; }
public int LastIndexOf(char value, int startIndex, int count) { throw null; }
public int LastIndexOf(System.String value) { throw null; }
public int LastIndexOf(System.String value, int startIndex) { throw null; }
public int LastIndexOf(System.String value, int startIndex, int count) { throw null; }
public int LastIndexOf(System.String value, int startIndex, int count, System.StringComparison comparisonType) { throw null; }
public int LastIndexOf(System.String value, int startIndex, System.StringComparison comparisonType) { throw null; }
public int LastIndexOf(System.String value, System.StringComparison comparisonType) { throw null; }
public int LastIndexOfAny(char[] anyOf) { throw null; }
public int LastIndexOfAny(char[] anyOf, int startIndex) { throw null; }
public int LastIndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
public System.String Normalize() { throw null; }
public System.String Normalize(System.Text.NormalizationForm normalizationForm) { throw null; }
public static bool operator ==(System.String? a, System.String? b) { throw null; }
public static implicit operator System.ReadOnlySpan<char> (System.String? value) { throw null; }
public static bool operator !=(System.String? a, System.String? b) { throw null; }
public System.String PadLeft(int totalWidth) { throw null; }
public System.String PadLeft(int totalWidth, char paddingChar) { throw null; }
public System.String PadRight(int totalWidth) { throw null; }
public System.String PadRight(int totalWidth, char paddingChar) { throw null; }
public System.String Remove(int startIndex) { throw null; }
public System.String Remove(int startIndex, int count) { throw null; }
public System.String Replace(char oldChar, char newChar) { throw null; }
public System.String Replace(System.String oldValue, System.String? newValue) { throw null; }
public System.String Replace(System.String oldValue, System.String? newValue, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public System.String Replace(System.String oldValue, System.String? newValue, System.StringComparison comparisonType) { throw null; }
public System.String ReplaceLineEndings() { throw null; }
public System.String ReplaceLineEndings(System.String replacementText) { throw null; }
public string[] Split(char separator, int count, System.StringSplitOptions options = System.StringSplitOptions.None) { throw null; }
public string[] Split(char separator, System.StringSplitOptions options = System.StringSplitOptions.None) { throw null; }
public string[] Split(params char[]? separator) { throw null; }
public string[] Split(char[]? separator, int count) { throw null; }
public string[] Split(char[]? separator, int count, System.StringSplitOptions options) { throw null; }
public string[] Split(char[]? separator, System.StringSplitOptions options) { throw null; }
public string[] Split(System.String? separator, int count, System.StringSplitOptions options = System.StringSplitOptions.None) { throw null; }
public string[] Split(System.String? separator, System.StringSplitOptions options = System.StringSplitOptions.None) { throw null; }
public string[] Split(string[]? separator, int count, System.StringSplitOptions options) { throw null; }
public string[] Split(string[]? separator, System.StringSplitOptions options) { throw null; }
public bool StartsWith(char value) { throw null; }
public bool StartsWith(System.String value) { throw null; }
public bool StartsWith(System.String value, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public bool StartsWith(System.String value, System.StringComparison comparisonType) { throw null; }
public System.String Substring(int startIndex) { throw null; }
public System.String Substring(int startIndex, int length) { throw null; }
System.Collections.Generic.IEnumerator<char> System.Collections.Generic.IEnumerable<char>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public char[] ToCharArray() { throw null; }
public char[] ToCharArray(int startIndex, int length) { throw null; }
public System.String ToLower() { throw null; }
public System.String ToLower(System.Globalization.CultureInfo? culture) { throw null; }
public System.String ToLowerInvariant() { throw null; }
public override System.String ToString() { throw null; }
public System.String ToString(System.IFormatProvider? provider) { throw null; }
public System.String ToUpper() { throw null; }
public System.String ToUpper(System.Globalization.CultureInfo? culture) { throw null; }
public System.String ToUpperInvariant() { throw null; }
public System.String Trim() { throw null; }
public System.String Trim(char trimChar) { throw null; }
public System.String Trim(params char[]? trimChars) { throw null; }
public System.String TrimEnd() { throw null; }
public System.String TrimEnd(char trimChar) { throw null; }
public System.String TrimEnd(params char[]? trimChars) { throw null; }
public System.String TrimStart() { throw null; }
public System.String TrimStart(char trimChar) { throw null; }
public System.String TrimStart(params char[]? trimChars) { throw null; }
public bool TryCopyTo(System.Span<char> destination) { throw null; }
}
public abstract partial class StringComparer : System.Collections.Generic.IComparer<string?>, System.Collections.Generic.IEqualityComparer<string?>, System.Collections.IComparer, System.Collections.IEqualityComparer
{
protected StringComparer() { }
public static System.StringComparer CurrentCulture { get { throw null; } }
public static System.StringComparer CurrentCultureIgnoreCase { get { throw null; } }
public static System.StringComparer InvariantCulture { get { throw null; } }
public static System.StringComparer InvariantCultureIgnoreCase { get { throw null; } }
public static System.StringComparer Ordinal { get { throw null; } }
public static System.StringComparer OrdinalIgnoreCase { get { throw null; } }
public int Compare(object? x, object? y) { throw null; }
public abstract int Compare(string? x, string? y);
public static System.StringComparer Create(System.Globalization.CultureInfo culture, bool ignoreCase) { throw null; }
public static System.StringComparer Create(System.Globalization.CultureInfo culture, System.Globalization.CompareOptions options) { throw null; }
public new bool Equals(object? x, object? y) { throw null; }
public abstract bool Equals(string? x, string? y);
public static System.StringComparer FromComparison(System.StringComparison comparisonType) { throw null; }
public int GetHashCode(object obj) { throw null; }
public abstract int GetHashCode(string obj);
public static bool IsWellKnownCultureAwareComparer(System.Collections.Generic.IEqualityComparer<string?>? comparer, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Globalization.CompareInfo? compareInfo, out System.Globalization.CompareOptions compareOptions) { throw null; }
public static bool IsWellKnownOrdinalComparer(System.Collections.Generic.IEqualityComparer<string?>? comparer, out bool ignoreCase) { throw null; }
}
public enum StringComparison
{
CurrentCulture = 0,
CurrentCultureIgnoreCase = 1,
InvariantCulture = 2,
InvariantCultureIgnoreCase = 3,
Ordinal = 4,
OrdinalIgnoreCase = 5,
}
public static partial class StringNormalizationExtensions
{
public static bool IsNormalized(this string strInput) { throw null; }
public static bool IsNormalized(this string strInput, System.Text.NormalizationForm normalizationForm) { throw null; }
public static string Normalize(this string strInput) { throw null; }
public static string Normalize(this string strInput, System.Text.NormalizationForm normalizationForm) { throw null; }
}
[System.FlagsAttribute]
public enum StringSplitOptions
{
None = 0,
RemoveEmptyEntries = 1,
TrimEntries = 2,
}
public partial class SystemException : System.Exception
{
public SystemException() { }
protected SystemException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public SystemException(string? message) { }
public SystemException(string? message, System.Exception? innerException) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public partial class ThreadStaticAttribute : System.Attribute
{
public ThreadStaticAttribute() { }
}
public readonly partial struct TimeOnly : System.IComparable, System.IComparable<System.TimeOnly>, System.IEquatable<System.TimeOnly>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IComparisonOperators<System.TimeOnly, System.TimeOnly>,
System.IMinMaxValue<System.TimeOnly>,
System.ISpanParseable<System.TimeOnly>,
System.ISubtractionOperators<System.TimeOnly, System.TimeOnly, System.TimeSpan>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
public static System.TimeOnly MinValue { get { throw null; } }
public static System.TimeOnly MaxValue { get { throw null; } }
public TimeOnly(int hour, int minute) { throw null; }
public TimeOnly(int hour, int minute, int second) { throw null; }
public TimeOnly(int hour, int minute, int second, int millisecond) { throw null; }
public TimeOnly(long ticks) { throw null; }
public int Hour { get { throw null; } }
public int Minute { get { throw null; } }
public int Second { get { throw null; } }
public int Millisecond { get { throw null; } }
public long Ticks { get { throw null; } }
public System.TimeOnly Add(System.TimeSpan value) { throw null; }
public System.TimeOnly Add(System.TimeSpan value, out int wrappedDays) { throw null; }
public System.TimeOnly AddHours(double value) { throw null; }
public System.TimeOnly AddHours(double value, out int wrappedDays) { throw null; }
public System.TimeOnly AddMinutes(double value) { throw null; }
public System.TimeOnly AddMinutes(double value, out int wrappedDays) { throw null; }
public bool IsBetween(System.TimeOnly start, System.TimeOnly end) { throw null; }
public static bool operator ==(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator >(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator >=(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator !=(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator <(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator <=(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static System.TimeSpan operator -(System.TimeOnly t1, System.TimeOnly t2) { throw null; }
public static System.TimeOnly FromTimeSpan(System.TimeSpan timeSpan) { throw null; }
public static System.TimeOnly FromDateTime(System.DateTime dateTime) { throw null; }
public System.TimeSpan ToTimeSpan() { throw null; }
public int CompareTo(System.TimeOnly value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.TimeOnly value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.TimeOnly Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly ParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, System.IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly ParseExact(System.ReadOnlySpan<char> s, string[] formats) { throw null; }
public static System.TimeOnly ParseExact(System.ReadOnlySpan<char> s, string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly Parse(string s) { throw null; }
public static System.TimeOnly Parse(string s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly ParseExact(string s, string format) { throw null; }
public static System.TimeOnly ParseExact(string s, string format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly ParseExact(string s, string[] formats) { throw null; }
public static System.TimeOnly ParseExact(string s, string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.TimeOnly result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, out System.TimeOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.TimeOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.TimeOnly result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, out System.TimeOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.TimeOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public string ToLongTimeString() { throw null; }
public string ToShortTimeString() { throw null; }
public override string ToString() { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeOnly, System.TimeOnly>.operator <(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeOnly, System.TimeOnly>.operator <=(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeOnly, System.TimeOnly>.operator >(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeOnly, System.TimeOnly>.operator >=(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.TimeOnly, System.TimeOnly>.operator ==(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.TimeOnly, System.TimeOnly>.operator !=(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeOnly IParseable<System.TimeOnly>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.TimeOnly>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.TimeOnly result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeOnly ISpanParseable<System.TimeOnly>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.TimeOnly>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.TimeOnly result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISubtractionOperators<System.TimeOnly, System.TimeOnly, System.TimeSpan>.operator -(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeOnly IMinMaxValue<System.TimeOnly>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeOnly IMinMaxValue<System.TimeOnly>.MaxValue { get { throw null; } }
#endif // FEATURE_GENERIC_MATH
}
public partial class TimeoutException : System.SystemException
{
public TimeoutException() { }
protected TimeoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TimeoutException(string? message) { }
public TimeoutException(string? message, System.Exception? innerException) { }
}
public readonly partial struct TimeSpan : System.IComparable, System.IComparable<System.TimeSpan>, System.IEquatable<System.TimeSpan>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IAdditionOperators<System.TimeSpan, System.TimeSpan, System.TimeSpan>,
System.IAdditiveIdentity<System.TimeSpan, System.TimeSpan>,
System.IComparisonOperators<System.TimeSpan, System.TimeSpan>,
System.IDivisionOperators<System.TimeSpan, double, System.TimeSpan>,
System.IDivisionOperators<System.TimeSpan, System.TimeSpan, double>,
System.IMinMaxValue<System.TimeSpan>,
System.IMultiplyOperators<System.TimeSpan, double, System.TimeSpan>,
System.IMultiplicativeIdentity<System.TimeSpan, double>,
System.ISpanParseable<System.TimeSpan>,
System.ISubtractionOperators<System.TimeSpan, System.TimeSpan, System.TimeSpan>,
System.IUnaryNegationOperators<System.TimeSpan, System.TimeSpan>,
System.IUnaryPlusOperators<System.TimeSpan, System.TimeSpan>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.TimeSpan MaxValue;
public static readonly System.TimeSpan MinValue;
public const long TicksPerDay = (long)864000000000;
public const long TicksPerHour = (long)36000000000;
public const long TicksPerMillisecond = (long)10000;
public const long TicksPerMinute = (long)600000000;
public const long TicksPerSecond = (long)10000000;
public static readonly System.TimeSpan Zero;
public TimeSpan(int hours, int minutes, int seconds) { throw null; }
public TimeSpan(int days, int hours, int minutes, int seconds) { throw null; }
public TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds) { throw null; }
public TimeSpan(long ticks) { throw null; }
public int Days { get { throw null; } }
public int Hours { get { throw null; } }
public int Milliseconds { get { throw null; } }
public int Minutes { get { throw null; } }
public int Seconds { get { throw null; } }
public long Ticks { get { throw null; } }
public double TotalDays { get { throw null; } }
public double TotalHours { get { throw null; } }
public double TotalMilliseconds { get { throw null; } }
public double TotalMinutes { get { throw null; } }
public double TotalSeconds { get { throw null; } }
public System.TimeSpan Add(System.TimeSpan ts) { throw null; }
public static int Compare(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.TimeSpan value) { throw null; }
public System.TimeSpan Divide(double divisor) { throw null; }
public double Divide(System.TimeSpan ts) { throw null; }
public System.TimeSpan Duration() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public bool Equals(System.TimeSpan obj) { throw null; }
public static bool Equals(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static System.TimeSpan FromDays(double value) { throw null; }
public static System.TimeSpan FromHours(double value) { throw null; }
public static System.TimeSpan FromMilliseconds(double value) { throw null; }
public static System.TimeSpan FromMinutes(double value) { throw null; }
public static System.TimeSpan FromSeconds(double value) { throw null; }
public static System.TimeSpan FromTicks(long value) { throw null; }
public override int GetHashCode() { throw null; }
public System.TimeSpan Multiply(double factor) { throw null; }
public System.TimeSpan Negate() { throw null; }
public static System.TimeSpan operator +(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static System.TimeSpan operator /(System.TimeSpan timeSpan, double divisor) { throw null; }
public static double operator /(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator ==(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator >(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator >=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator !=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator <(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator <=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static System.TimeSpan operator *(double factor, System.TimeSpan timeSpan) { throw null; }
public static System.TimeSpan operator *(System.TimeSpan timeSpan, double factor) { throw null; }
public static System.TimeSpan operator -(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static System.TimeSpan operator -(System.TimeSpan t) { throw null; }
public static System.TimeSpan operator +(System.TimeSpan t) { throw null; }
public static System.TimeSpan Parse(System.ReadOnlySpan<char> input, System.IFormatProvider? formatProvider = null) { throw null; }
public static System.TimeSpan Parse(string s) { throw null; }
public static System.TimeSpan Parse(string input, System.IFormatProvider? formatProvider) { throw null; }
public static System.TimeSpan ParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles = System.Globalization.TimeSpanStyles.None) { throw null; }
public static System.TimeSpan ParseExact(System.ReadOnlySpan<char> input, string[] formats, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles = System.Globalization.TimeSpanStyles.None) { throw null; }
public static System.TimeSpan ParseExact(string input, string format, System.IFormatProvider? formatProvider) { throw null; }
public static System.TimeSpan ParseExact(string input, string format, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles) { throw null; }
public static System.TimeSpan ParseExact(string input, string[] formats, System.IFormatProvider? formatProvider) { throw null; }
public static System.TimeSpan ParseExact(string input, string[] formats, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles) { throw null; }
public System.TimeSpan Subtract(System.TimeSpan ts) { throw null; }
public override string ToString() { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? formatProvider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? formatProvider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.TimeSpan result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.TimeSpan result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IAdditiveIdentity<System.TimeSpan, System.TimeSpan>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IMinMaxValue<System.TimeSpan>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IMinMaxValue<System.TimeSpan>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMultiplicativeIdentity<System.TimeSpan, double>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IAdditionOperators<System.TimeSpan, System.TimeSpan, System.TimeSpan>.operator +(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeSpan, System.TimeSpan>.operator <(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeSpan, System.TimeSpan>.operator <=(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeSpan, System.TimeSpan>.operator >(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeSpan, System.TimeSpan>.operator >=(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IDivisionOperators<System.TimeSpan, double, System.TimeSpan>.operator /(System.TimeSpan left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IDivisionOperators<System.TimeSpan, System.TimeSpan, double>.operator /(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.TimeSpan, System.TimeSpan>.operator ==(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.TimeSpan, System.TimeSpan>.operator !=(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IMultiplyOperators<System.TimeSpan, double, System.TimeSpan>.operator *(System.TimeSpan left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IParseable<System.TimeSpan>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.TimeSpan>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.TimeSpan result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISpanParseable<System.TimeSpan>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.TimeSpan>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.TimeSpan result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISubtractionOperators<System.TimeSpan, System.TimeSpan, System.TimeSpan>.operator -(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IUnaryNegationOperators<System.TimeSpan, System.TimeSpan>.operator -(System.TimeSpan value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IUnaryPlusOperators<System.TimeSpan, System.TimeSpan>.operator +(System.TimeSpan value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.ObsoleteAttribute("System.TimeZone has been deprecated. Investigate the use of System.TimeZoneInfo instead.")]
public abstract partial class TimeZone
{
protected TimeZone() { }
public static System.TimeZone CurrentTimeZone { get { throw null; } }
public abstract string DaylightName { get; }
public abstract string StandardName { get; }
public abstract System.Globalization.DaylightTime GetDaylightChanges(int year);
public abstract System.TimeSpan GetUtcOffset(System.DateTime time);
public virtual bool IsDaylightSavingTime(System.DateTime time) { throw null; }
public static bool IsDaylightSavingTime(System.DateTime time, System.Globalization.DaylightTime daylightTimes) { throw null; }
public virtual System.DateTime ToLocalTime(System.DateTime time) { throw null; }
public virtual System.DateTime ToUniversalTime(System.DateTime time) { throw null; }
}
public sealed partial class TimeZoneInfo : System.IEquatable<System.TimeZoneInfo?>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
internal TimeZoneInfo() { }
public System.TimeSpan BaseUtcOffset { get { throw null; } }
public string DaylightName { get { throw null; } }
public string DisplayName { get { throw null; } }
public bool HasIanaId { get { throw null; } }
public string Id { get { throw null; } }
public static System.TimeZoneInfo Local { get { throw null; } }
public string StandardName { get { throw null; } }
public bool SupportsDaylightSavingTime { get { throw null; } }
public static System.TimeZoneInfo Utc { get { throw null; } }
public static void ClearCachedData() { }
public static System.DateTime ConvertTime(System.DateTime dateTime, System.TimeZoneInfo destinationTimeZone) { throw null; }
public static System.DateTime ConvertTime(System.DateTime dateTime, System.TimeZoneInfo sourceTimeZone, System.TimeZoneInfo destinationTimeZone) { throw null; }
public static System.DateTimeOffset ConvertTime(System.DateTimeOffset dateTimeOffset, System.TimeZoneInfo destinationTimeZone) { throw null; }
public static System.DateTime ConvertTimeBySystemTimeZoneId(System.DateTime dateTime, string destinationTimeZoneId) { throw null; }
public static System.DateTime ConvertTimeBySystemTimeZoneId(System.DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId) { throw null; }
public static System.DateTimeOffset ConvertTimeBySystemTimeZoneId(System.DateTimeOffset dateTimeOffset, string destinationTimeZoneId) { throw null; }
public static System.DateTime ConvertTimeFromUtc(System.DateTime dateTime, System.TimeZoneInfo destinationTimeZone) { throw null; }
public static System.DateTime ConvertTimeToUtc(System.DateTime dateTime) { throw null; }
public static System.DateTime ConvertTimeToUtc(System.DateTime dateTime, System.TimeZoneInfo sourceTimeZone) { throw null; }
public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string? displayName, string? standardDisplayName) { throw null; }
public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string? displayName, string? standardDisplayName, string? daylightDisplayName, System.TimeZoneInfo.AdjustmentRule[]? adjustmentRules) { throw null; }
public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string? displayName, string? standardDisplayName, string? daylightDisplayName, System.TimeZoneInfo.AdjustmentRule[]? adjustmentRules, bool disableDaylightSavingTime) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.TimeZoneInfo? other) { throw null; }
public static System.TimeZoneInfo FindSystemTimeZoneById(string id) { throw null; }
public static System.TimeZoneInfo FromSerializedString(string source) { throw null; }
public System.TimeZoneInfo.AdjustmentRule[] GetAdjustmentRules() { throw null; }
public System.TimeSpan[] GetAmbiguousTimeOffsets(System.DateTime dateTime) { throw null; }
public System.TimeSpan[] GetAmbiguousTimeOffsets(System.DateTimeOffset dateTimeOffset) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Collections.ObjectModel.ReadOnlyCollection<System.TimeZoneInfo> GetSystemTimeZones() { throw null; }
public System.TimeSpan GetUtcOffset(System.DateTime dateTime) { throw null; }
public System.TimeSpan GetUtcOffset(System.DateTimeOffset dateTimeOffset) { throw null; }
public bool HasSameRules(System.TimeZoneInfo other) { throw null; }
public bool IsAmbiguousTime(System.DateTime dateTime) { throw null; }
public bool IsAmbiguousTime(System.DateTimeOffset dateTimeOffset) { throw null; }
public bool IsDaylightSavingTime(System.DateTime dateTime) { throw null; }
public bool IsDaylightSavingTime(System.DateTimeOffset dateTimeOffset) { throw null; }
public bool IsInvalidTime(System.DateTime dateTime) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public string ToSerializedString() { throw null; }
public override string ToString() { throw null; }
public static bool TryConvertIanaIdToWindowsId(string ianaId, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? windowsId) { throw null; }
public static bool TryConvertWindowsIdToIanaId(string windowsId, string? region, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? ianaId) { throw null; }
public static bool TryConvertWindowsIdToIanaId(string windowsId, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? ianaId) { throw null; }
public sealed partial class AdjustmentRule : System.IEquatable<System.TimeZoneInfo.AdjustmentRule?>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
internal AdjustmentRule() { }
public System.TimeSpan BaseUtcOffsetDelta { get { throw null; } }
public System.DateTime DateEnd { get { throw null; } }
public System.DateTime DateStart { get { throw null; } }
public System.TimeSpan DaylightDelta { get { throw null; } }
public System.TimeZoneInfo.TransitionTime DaylightTransitionEnd { get { throw null; } }
public System.TimeZoneInfo.TransitionTime DaylightTransitionStart { get { throw null; } }
public static System.TimeZoneInfo.AdjustmentRule CreateAdjustmentRule(System.DateTime dateStart, System.DateTime dateEnd, System.TimeSpan daylightDelta, System.TimeZoneInfo.TransitionTime daylightTransitionStart, System.TimeZoneInfo.TransitionTime daylightTransitionEnd) { throw null; }
public static System.TimeZoneInfo.AdjustmentRule CreateAdjustmentRule(System.DateTime dateStart, System.DateTime dateEnd, System.TimeSpan daylightDelta, System.TimeZoneInfo.TransitionTime daylightTransitionStart, System.TimeZoneInfo.TransitionTime daylightTransitionEnd, System.TimeSpan baseUtcOffsetDelta) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.TimeZoneInfo.AdjustmentRule? other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public readonly partial struct TransitionTime : System.IEquatable<System.TimeZoneInfo.TransitionTime>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
private readonly int _dummyPrimitive;
public int Day { get { throw null; } }
public System.DayOfWeek DayOfWeek { get { throw null; } }
public bool IsFixedDateRule { get { throw null; } }
public int Month { get { throw null; } }
public System.DateTime TimeOfDay { get { throw null; } }
public int Week { get { throw null; } }
public static System.TimeZoneInfo.TransitionTime CreateFixedDateRule(System.DateTime timeOfDay, int month, int day) { throw null; }
public static System.TimeZoneInfo.TransitionTime CreateFloatingDateRule(System.DateTime timeOfDay, int month, int week, System.DayOfWeek dayOfWeek) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.TimeZoneInfo.TransitionTime other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.TimeZoneInfo.TransitionTime t1, System.TimeZoneInfo.TransitionTime t2) { throw null; }
public static bool operator !=(System.TimeZoneInfo.TransitionTime t1, System.TimeZoneInfo.TransitionTime t2) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
}
public partial class TimeZoneNotFoundException : System.Exception
{
public TimeZoneNotFoundException() { }
protected TimeZoneNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TimeZoneNotFoundException(string? message) { }
public TimeZoneNotFoundException(string? message, System.Exception? innerException) { }
}
public static partial class Tuple
{
public static System.Tuple<T1> Create<T1>(T1 item1) { throw null; }
public static System.Tuple<T1, T2> Create<T1, T2>(T1 item1, T2 item2) { throw null; }
public static System.Tuple<T1, T2, T3> Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3) { throw null; }
public static System.Tuple<T1, T2, T3, T4> Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5> Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6> Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7> Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) { throw null; }
}
public static partial class TupleExtensions
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1>(this System.Tuple<T1> value, out T1 item1) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2>(this System.Tuple<T1, T2> value, out T1 item1, out T2 item2) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19, out T20 item20) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20, T21>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19, out T20 item20, out T21 item21) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3>(this System.Tuple<T1, T2, T3> value, out T1 item1, out T2 item2, out T3 item3) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4>(this System.Tuple<T1, T2, T3, T4> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5>(this System.Tuple<T1, T2, T3, T4, T5> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6>(this System.Tuple<T1, T2, T3, T4, T5, T6> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9) { throw null; }
public static System.Tuple<T1> ToTuple<T1>(this System.ValueTuple<T1> value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) value) { throw null; }
public static System.Tuple<T1, T2> ToTuple<T1, T2>(this (T1, T2) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20, T21>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) value) { throw null; }
public static System.Tuple<T1, T2, T3> ToTuple<T1, T2, T3>(this (T1, T2, T3) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4> ToTuple<T1, T2, T3, T4>(this (T1, T2, T3, T4) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5> ToTuple<T1, T2, T3, T4, T5>(this (T1, T2, T3, T4, T5) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6> ToTuple<T1, T2, T3, T4, T5, T6>(this (T1, T2, T3, T4, T5, T6) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7> ToTuple<T1, T2, T3, T4, T5, T6, T7>(this (T1, T2, T3, T4, T5, T6, T7) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8>(this (T1, T2, T3, T4, T5, T6, T7, T8) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9) value) { throw null; }
public static System.ValueTuple<T1> ToValueTuple<T1>(this System.Tuple<T1> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19>>> value) { throw null; }
public static (T1, T2) ToValueTuple<T1, T2>(this System.Tuple<T1, T2> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20, T21>>> value) { throw null; }
public static (T1, T2, T3) ToValueTuple<T1, T2, T3>(this System.Tuple<T1, T2, T3> value) { throw null; }
public static (T1, T2, T3, T4) ToValueTuple<T1, T2, T3, T4>(this System.Tuple<T1, T2, T3, T4> value) { throw null; }
public static (T1, T2, T3, T4, T5) ToValueTuple<T1, T2, T3, T4, T5>(this System.Tuple<T1, T2, T3, T4, T5> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6) ToValueTuple<T1, T2, T3, T4, T5, T6>(this System.Tuple<T1, T2, T3, T4, T5, T6> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7) ToValueTuple<T1, T2, T3, T4, T5, T6, T7>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9>> value) { throw null; }
}
public partial class Tuple<T1> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1) { }
public T1 Item1 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4, T5> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
public T5 Item5 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4, T5, T6> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
public T5 Item5 { get { throw null; } }
public T6 Item6 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4, T5, T6, T7> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
public T5 Item5 { get { throw null; } }
public T6 Item6 { get { throw null; } }
public T7 Item7 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple where TRest : notnull
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
public T5 Item5 { get { throw null; } }
public T6 Item6 { get { throw null; } }
public T7 Item7 { get { throw null; } }
public TRest Rest { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public abstract partial class Type : System.Reflection.MemberInfo, System.Reflection.IReflect
{
public static readonly char Delimiter;
public static readonly System.Type[] EmptyTypes;
public static readonly System.Reflection.MemberFilter FilterAttribute;
public static readonly System.Reflection.MemberFilter FilterName;
public static readonly System.Reflection.MemberFilter FilterNameIgnoreCase;
public static readonly object Missing;
protected Type() { }
public abstract System.Reflection.Assembly Assembly { get; }
public abstract string? AssemblyQualifiedName { get; }
public System.Reflection.TypeAttributes Attributes { get { throw null; } }
public abstract System.Type? BaseType { get; }
public virtual bool ContainsGenericParameters { get { throw null; } }
public virtual System.Reflection.MethodBase? DeclaringMethod { get { throw null; } }
public override System.Type? DeclaringType { get { throw null; } }
public static System.Reflection.Binder DefaultBinder { get { throw null; } }
public abstract string? FullName { get; }
public virtual System.Reflection.GenericParameterAttributes GenericParameterAttributes { get { throw null; } }
public virtual int GenericParameterPosition { get { throw null; } }
public virtual System.Type[] GenericTypeArguments { get { throw null; } }
public abstract System.Guid GUID { get; }
public bool HasElementType { get { throw null; } }
public bool IsAbstract { get { throw null; } }
public bool IsAnsiClass { get { throw null; } }
public bool IsArray { get { throw null; } }
public bool IsAutoClass { get { throw null; } }
public bool IsAutoLayout { get { throw null; } }
public bool IsByRef { get { throw null; } }
public virtual bool IsByRefLike { get { throw null; } }
public bool IsClass { get { throw null; } }
public bool IsCOMObject { get { throw null; } }
public virtual bool IsConstructedGenericType { get { throw null; } }
public bool IsContextful { get { throw null; } }
public virtual bool IsEnum { get { throw null; } }
public bool IsExplicitLayout { get { throw null; } }
public virtual bool IsGenericMethodParameter { get { throw null; } }
public virtual bool IsGenericParameter { get { throw null; } }
public virtual bool IsGenericType { get { throw null; } }
public virtual bool IsGenericTypeDefinition { get { throw null; } }
public virtual bool IsGenericTypeParameter { get { throw null; } }
public bool IsImport { get { throw null; } }
public bool IsInterface { get { throw null; } }
public bool IsLayoutSequential { get { throw null; } }
public bool IsMarshalByRef { get { throw null; } }
public bool IsNested { get { throw null; } }
public bool IsNestedAssembly { get { throw null; } }
public bool IsNestedFamANDAssem { get { throw null; } }
public bool IsNestedFamily { get { throw null; } }
public bool IsNestedFamORAssem { get { throw null; } }
public bool IsNestedPrivate { get { throw null; } }
public bool IsNestedPublic { get { throw null; } }
public bool IsNotPublic { get { throw null; } }
public bool IsPointer { get { throw null; } }
public bool IsPrimitive { get { throw null; } }
public bool IsPublic { get { throw null; } }
public bool IsSealed { get { throw null; } }
public virtual bool IsSecurityCritical { get { throw null; } }
public virtual bool IsSecuritySafeCritical { get { throw null; } }
public virtual bool IsSecurityTransparent { get { throw null; } }
public virtual bool IsSerializable { get { throw null; } }
public virtual bool IsSignatureType { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public virtual bool IsSZArray { get { throw null; } }
public virtual bool IsTypeDefinition { get { throw null; } }
public bool IsUnicodeClass { get { throw null; } }
public bool IsValueType { get { throw null; } }
public virtual bool IsVariableBoundArray { get { throw null; } }
public bool IsVisible { get { throw null; } }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public abstract new System.Reflection.Module Module { get; }
public abstract string? Namespace { get; }
public override System.Type? ReflectedType { get { throw null; } }
public virtual System.Runtime.InteropServices.StructLayoutAttribute? StructLayoutAttribute { get { throw null; } }
public virtual System.RuntimeTypeHandle TypeHandle { get { throw null; } }
public System.Reflection.ConstructorInfo? TypeInitializer { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] get { throw null; } }
public abstract System.Type UnderlyingSystemType { get; }
public override bool Equals(object? o) { throw null; }
public virtual bool Equals(System.Type? o) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public virtual System.Type[] FindInterfaces(System.Reflection.TypeFilter filter, object? filterCriteria) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public virtual System.Reflection.MemberInfo[] FindMembers(System.Reflection.MemberTypes memberType, System.Reflection.BindingFlags bindingAttr, System.Reflection.MemberFilter? filter, object? filterCriteria) { throw null; }
public virtual int GetArrayRank() { throw null; }
protected abstract System.Reflection.TypeAttributes GetAttributeFlagsImpl();
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo? GetConstructor(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo? GetConstructor(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo? GetConstructor(System.Reflection.BindingFlags bindingAttr, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo? GetConstructor(System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
protected abstract System.Reflection.ConstructorInfo? GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo[] GetConstructors() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public abstract System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public virtual System.Reflection.MemberInfo[] GetDefaultMembers() { throw null; }
public abstract System.Type? GetElementType();
public virtual string? GetEnumName(object value) { throw null; }
public virtual string[] GetEnumNames() { throw null; }
public virtual System.Type GetEnumUnderlyingType() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("It might not be possible to create an array of the enum type at runtime. Use Enum.GetValues<TEnum> instead.")]
public virtual System.Array GetEnumValues() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public System.Reflection.EventInfo? GetEvent(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public abstract System.Reflection.EventInfo? GetEvent(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public virtual System.Reflection.EventInfo[] GetEvents() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public abstract System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public System.Reflection.FieldInfo? GetField(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public abstract System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public System.Reflection.FieldInfo[] GetFields() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public abstract System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr);
public virtual System.Type[] GetGenericArguments() { throw null; }
public virtual System.Type[] GetGenericParameterConstraints() { throw null; }
public virtual System.Type GetGenericTypeDefinition() { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
[return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public System.Type? GetInterface(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
[return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public abstract System.Type? GetInterface(string name, bool ignoreCase);
public virtual System.Reflection.InterfaceMapping GetInterfaceMap([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type interfaceType) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public abstract System.Type[] GetInterfaces();
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.MemberInfo[] GetMember(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public virtual System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public virtual System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.MemberInfo[] GetMembers() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public abstract System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr);
public virtual System.Reflection.MemberInfo GetMemberWithSameMetadataDefinitionAs(System.Reflection.MemberInfo member) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, int genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, int genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, int genericParameterCount, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, int genericParameterCount, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
protected virtual System.Reflection.MethodInfo? GetMethodImpl(string name, int genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
protected abstract System.Reflection.MethodInfo? GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo[] GetMethods() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public abstract System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public System.Type? GetNestedType(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public abstract System.Type? GetNestedType(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public System.Type[] GetNestedTypes() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public abstract System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo[] GetProperties() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public abstract System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Type? returnType) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Type? returnType, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Type? returnType, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
protected abstract System.Reflection.PropertyInfo? GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers);
public new System.Type GetType() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, bool throwOnError) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, bool throwOnError, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver, bool throwOnError) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver, bool throwOnError, bool ignoreCase) { throw null; }
public static System.Type[] GetTypeArray(object[] args) { throw null; }
public static System.TypeCode GetTypeCode(System.Type? type) { throw null; }
protected virtual System.TypeCode GetTypeCodeImpl() { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, bool throwOnError) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, string? server) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, string? server, bool throwOnError) { throw null; }
public static System.Type? GetTypeFromHandle(System.RuntimeTypeHandle handle) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, bool throwOnError) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, string? server) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, string? server, bool throwOnError) { throw null; }
public static System.RuntimeTypeHandle GetTypeHandle(object o) { throw null; }
protected abstract bool HasElementTypeImpl();
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args, System.Globalization.CultureInfo? culture) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public abstract object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args, System.Reflection.ParameterModifier[]? modifiers, System.Globalization.CultureInfo? culture, string[]? namedParameters);
protected abstract bool IsArrayImpl();
public virtual bool IsAssignableFrom([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Type? c) { throw null; }
public bool IsAssignableTo([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Type? targetType) { throw null; }
protected abstract bool IsByRefImpl();
protected abstract bool IsCOMObjectImpl();
protected virtual bool IsContextfulImpl() { throw null; }
public virtual bool IsEnumDefined(object value) { throw null; }
public virtual bool IsEquivalentTo([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Type? other) { throw null; }
public virtual bool IsInstanceOfType([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; }
protected virtual bool IsMarshalByRefImpl() { throw null; }
protected abstract bool IsPointerImpl();
protected abstract bool IsPrimitiveImpl();
public virtual bool IsSubclassOf(System.Type c) { throw null; }
protected virtual bool IsValueTypeImpl() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public virtual System.Type MakeArrayType() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public virtual System.Type MakeArrayType(int rank) { throw null; }
public virtual System.Type MakeByRefType() { throw null; }
public static System.Type MakeGenericMethodParameter(int position) { throw null; }
public static System.Type MakeGenericSignatureType(System.Type genericTypeDefinition, params System.Type[] typeArguments) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The native code for this instantiation might not be available at runtime.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]
public virtual System.Type MakeGenericType(params System.Type[] typeArguments) { throw null; }
public virtual System.Type MakePointerType() { throw null; }
public static bool operator ==(System.Type? left, System.Type? right) { throw null; }
public static bool operator !=(System.Type? left, System.Type? right) { throw null; }
[System.ObsoleteAttribute("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static System.Type? ReflectionOnlyGetType(string typeName, bool throwIfNotFound, bool ignoreCase) { throw null; }
public override string ToString() { throw null; }
}
public partial class TypeAccessException : System.TypeLoadException
{
public TypeAccessException() { }
protected TypeAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TypeAccessException(string? message) { }
public TypeAccessException(string? message, System.Exception? inner) { }
}
public enum TypeCode
{
Empty = 0,
Object = 1,
DBNull = 2,
Boolean = 3,
Char = 4,
SByte = 5,
Byte = 6,
Int16 = 7,
UInt16 = 8,
Int32 = 9,
UInt32 = 10,
Int64 = 11,
UInt64 = 12,
Single = 13,
Double = 14,
Decimal = 15,
DateTime = 16,
String = 18,
}
[System.CLSCompliantAttribute(false)]
public ref partial struct TypedReference
{
private object _dummy;
private int _dummyPrimitive;
public override bool Equals(object? o) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Type GetTargetType(System.TypedReference value) { throw null; }
public static System.TypedReference MakeTypedReference(object target, System.Reflection.FieldInfo[] flds) { throw null; }
public static void SetTypedReference(System.TypedReference target, object? value) { }
public static System.RuntimeTypeHandle TargetTypeToken(System.TypedReference value) { throw null; }
public static object ToObject(System.TypedReference value) { throw null; }
}
public sealed partial class TypeInitializationException : System.SystemException
{
public TypeInitializationException(string? fullTypeName, System.Exception? innerException) { }
public string TypeName { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class TypeLoadException : System.SystemException, System.Runtime.Serialization.ISerializable
{
public TypeLoadException() { }
protected TypeLoadException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TypeLoadException(string? message) { }
public TypeLoadException(string? message, System.Exception? inner) { }
public override string Message { get { throw null; } }
public string TypeName { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class TypeUnloadedException : System.SystemException
{
public TypeUnloadedException() { }
protected TypeUnloadedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TypeUnloadedException(string? message) { }
public TypeUnloadedException(string? message, System.Exception? innerException) { }
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct UInt16 : System.IComparable, System.IComparable<ushort>, System.IConvertible, System.IEquatable<ushort>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<ushort>,
System.IMinMaxValue<ushort>,
System.IUnsignedNumber<ushort>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly ushort _dummyPrimitive;
public const ushort MaxValue = (ushort)65535;
public const ushort MinValue = (ushort)0;
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.UInt16 value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.UInt16 obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.UInt16 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.UInt16 Parse(string s) { throw null; }
public static System.UInt16 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.UInt16 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.UInt16 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
System.UInt16 System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt16 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.UInt16 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt16 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt16 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IAdditiveIdentity<ushort, ushort>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IMinMaxValue<ushort>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IMinMaxValue<ushort>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IMultiplicativeIdentity<ushort, ushort>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IAdditionOperators<ushort, ushort, ushort>.operator +(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.LeadingZeroCount(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.PopCount(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.RotateLeft(ushort value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.RotateRight(ushort value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.TrailingZeroCount(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<ushort>.IsPow2(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryNumber<ushort>.Log2(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBitwiseOperators<ushort, ushort, ushort>.operator &(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBitwiseOperators<ushort, ushort, ushort>.operator |(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBitwiseOperators<ushort, ushort, ushort>.operator ^(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBitwiseOperators<ushort, ushort, ushort>.operator ~(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ushort, ushort>.operator <(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ushort, ushort>.operator <=(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ushort, ushort>.operator >(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ushort, ushort>.operator >=(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IDecrementOperators<ushort>.operator --(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IDivisionOperators<ushort, ushort, ushort>.operator /(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<ushort, ushort>.operator ==(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<ushort, ushort>.operator !=(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IIncrementOperators<ushort>.operator ++(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IModulusOperators<ushort, ushort, ushort>.operator %(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IMultiplyOperators<ushort, ushort, ushort>.operator *(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Abs(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Clamp(ushort value, ushort min, ushort max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (ushort Quotient, ushort Remainder) INumber<ushort>.DivRem(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Max(ushort x, ushort y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Min(ushort x, ushort y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Sign(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ushort>.TryCreate<TOther>(TOther value, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ushort>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ushort>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IParseable<ushort>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<ushort>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IShiftOperators<ushort, ushort>.operator <<(ushort value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IShiftOperators<ushort, ushort>.operator >>(ushort value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort ISpanParseable<ushort>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<ushort>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort ISubtractionOperators<ushort, ushort, ushort>.operator -(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IUnaryNegationOperators<ushort, ushort>.operator -(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IUnaryPlusOperators<ushort, ushort>.operator +(ushort value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct UInt32 : System.IComparable, System.IComparable<uint>, System.IConvertible, System.IEquatable<uint>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<uint>,
System.IMinMaxValue<uint>,
System.IUnsignedNumber<uint>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly uint _dummyPrimitive;
public const uint MaxValue = (uint)4294967295;
public const uint MinValue = (uint)0;
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.UInt32 value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.UInt32 obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.UInt32 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.UInt32 Parse(string s) { throw null; }
public static System.UInt32 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.UInt32 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.UInt32 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
System.UInt32 System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt32 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.UInt32 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt32 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt32 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IAdditiveIdentity<uint, uint>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IMinMaxValue<uint>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IMinMaxValue<uint>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IMultiplicativeIdentity<uint, uint>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IAdditionOperators<uint, uint, uint>.operator +(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.LeadingZeroCount(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.PopCount(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.RotateLeft(uint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.RotateRight(uint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.TrailingZeroCount(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<uint>.IsPow2(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryNumber<uint>.Log2(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBitwiseOperators<uint, uint, uint>.operator &(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBitwiseOperators<uint, uint, uint>.operator |(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBitwiseOperators<uint, uint, uint>.operator ^(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBitwiseOperators<uint, uint, uint>.operator ~(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<uint, uint>.operator <(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<uint, uint>.operator <=(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<uint, uint>.operator >(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<uint, uint>.operator >=(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IDecrementOperators<uint>.operator --(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IDivisionOperators<uint, uint, uint>.operator /(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<uint, uint>.operator ==(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<uint, uint>.operator !=(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IIncrementOperators<uint>.operator ++(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IModulusOperators<uint, uint, uint>.operator %(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IMultiplyOperators<uint, uint, uint>.operator *(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Abs(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Clamp(uint value, uint min, uint max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (uint Quotient, uint Remainder) INumber<uint>.DivRem(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Max(uint x, uint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Min(uint x, uint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Sign(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<uint>.TryCreate<TOther>(TOther value, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<uint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<uint>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IParseable<uint>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<uint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IShiftOperators<uint, uint>.operator <<(uint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IShiftOperators<uint, uint>.operator >>(uint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint ISpanParseable<uint>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<uint>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint ISubtractionOperators<uint, uint, uint>.operator -(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IUnaryNegationOperators<uint, uint>.operator -(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IUnaryPlusOperators<uint, uint>.operator +(uint value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct UInt64 : System.IComparable, System.IComparable<ulong>, System.IConvertible, System.IEquatable<ulong>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<ulong>,
System.IMinMaxValue<ulong>,
System.IUnsignedNumber<ulong>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly ulong _dummyPrimitive;
public const ulong MaxValue = (ulong)18446744073709551615;
public const ulong MinValue = (ulong)0;
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.UInt64 value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.UInt64 obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.UInt64 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.UInt64 Parse(string s) { throw null; }
public static System.UInt64 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.UInt64 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.UInt64 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
System.UInt64 System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt64 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.UInt64 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt64 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt64 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IAdditiveIdentity<ulong, ulong>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IMinMaxValue<ulong>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IMinMaxValue<ulong>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IMultiplicativeIdentity<ulong, ulong>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IAdditionOperators<ulong, ulong, ulong>.operator +(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.LeadingZeroCount(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.PopCount(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.RotateLeft(ulong value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.RotateRight(ulong value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.TrailingZeroCount(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<ulong>.IsPow2(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryNumber<ulong>.Log2(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBitwiseOperators<ulong, ulong, ulong>.operator &(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBitwiseOperators<ulong, ulong, ulong>.operator |(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBitwiseOperators<ulong, ulong, ulong>.operator ^(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBitwiseOperators<ulong, ulong, ulong>.operator ~(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ulong, ulong>.operator <(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ulong, ulong>.operator <=(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ulong, ulong>.operator >(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ulong, ulong>.operator >=(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IDecrementOperators<ulong>.operator --(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IDivisionOperators<ulong, ulong, ulong>.operator /(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<ulong, ulong>.operator ==(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<ulong, ulong>.operator !=(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IIncrementOperators<ulong>.operator ++(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IModulusOperators<ulong, ulong, ulong>.operator %(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IMultiplyOperators<ulong, ulong, ulong>.operator *(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Abs(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Clamp(ulong value, ulong min, ulong max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (ulong Quotient, ulong Remainder) INumber<ulong>.DivRem(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Max(ulong x, ulong y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Min(ulong x, ulong y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Sign(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ulong>.TryCreate<TOther>(TOther value, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ulong>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ulong>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IParseable<ulong>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<ulong>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IShiftOperators<ulong, ulong>.operator <<(ulong value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IShiftOperators<ulong, ulong>.operator >>(ulong value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong ISpanParseable<ulong>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<ulong>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong ISubtractionOperators<ulong, ulong, ulong>.operator -(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IUnaryNegationOperators<ulong, ulong>.operator -(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IUnaryPlusOperators<ulong, ulong>.operator +(ulong value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct UIntPtr : System.IComparable, System.IComparable<nuint>, System.IEquatable<nuint>, System.ISpanFormattable, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<nuint>,
System.IMinMaxValue<nuint>,
System.IUnsignedNumber<nuint>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.UIntPtr Zero;
public UIntPtr(uint value) { throw null; }
public UIntPtr(ulong value) { throw null; }
public unsafe UIntPtr(void* value) { throw null; }
public static System.UIntPtr MaxValue { get { throw null; } }
public static System.UIntPtr MinValue { get { throw null; } }
public static int Size { get { throw null; } }
public static System.UIntPtr Add(System.UIntPtr pointer, int offset) { throw null; }
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.UIntPtr value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.UIntPtr other) { throw null; }
public override int GetHashCode() { throw null; }
public static System.UIntPtr operator +(System.UIntPtr pointer, int offset) { throw null; }
public static bool operator ==(System.UIntPtr value1, System.UIntPtr value2) { throw null; }
public static explicit operator System.UIntPtr (uint value) { throw null; }
public static explicit operator System.UIntPtr (ulong value) { throw null; }
public static explicit operator uint (System.UIntPtr value) { throw null; }
public static explicit operator ulong (System.UIntPtr value) { throw null; }
public unsafe static explicit operator void* (System.UIntPtr value) { throw null; }
public unsafe static explicit operator System.UIntPtr (void* value) { throw null; }
public static bool operator !=(System.UIntPtr value1, System.UIntPtr value2) { throw null; }
public static System.UIntPtr operator -(System.UIntPtr pointer, int offset) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static System.UIntPtr Parse(string s) { throw null; }
public static System.UIntPtr Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.UIntPtr Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.UIntPtr Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.UIntPtr Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.UIntPtr Subtract(System.UIntPtr pointer, int offset) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public unsafe void* ToPointer() { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public uint ToUInt32() { throw null; }
public ulong ToUInt64() { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UIntPtr result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UIntPtr result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.UIntPtr result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UIntPtr result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IAdditiveIdentity<nuint, nuint>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IMinMaxValue<nuint>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IMinMaxValue<nuint>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IMultiplicativeIdentity<nuint, nuint>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IAdditionOperators<nuint, nuint, nuint>.operator +(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.LeadingZeroCount(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.PopCount(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.RotateLeft(nuint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.RotateRight(nuint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.TrailingZeroCount(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<nuint>.IsPow2(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryNumber<nuint>.Log2(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBitwiseOperators<nuint, nuint, nuint>.operator &(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBitwiseOperators<nuint, nuint, nuint>.operator |(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBitwiseOperators<nuint, nuint, nuint>.operator ^(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBitwiseOperators<nuint, nuint, nuint>.operator ~(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nuint, nuint>.operator <(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nuint, nuint>.operator <=(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nuint, nuint>.operator >(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nuint, nuint>.operator >=(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IDecrementOperators<nuint>.operator --(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IDivisionOperators<nuint, nuint, nuint>.operator /(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<nuint, nuint>.operator ==(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<nuint, nuint>.operator !=(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IIncrementOperators<nuint>.operator ++(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IModulusOperators<nuint, nuint, nuint>.operator %(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IMultiplyOperators<nuint, nuint, nuint>.operator *(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Abs(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Clamp(nuint value, nuint min, nuint max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (nuint Quotient, nuint Remainder) INumber<nuint>.DivRem(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Max(nuint x, nuint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Min(nuint x, nuint y) { throw null; }[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Sign(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nuint>.TryCreate<TOther>(TOther value, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nuint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nuint>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IParseable<nuint>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<nuint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IShiftOperators<nuint, nuint>.operator <<(nuint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IShiftOperators<nuint, nuint>.operator >>(nuint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint ISpanParseable<nuint>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<nuint>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint ISubtractionOperators<nuint, nuint, nuint>.operator -(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IUnaryNegationOperators<nuint, nuint>.operator -(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IUnaryPlusOperators<nuint, nuint>.operator +(nuint value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial class UnauthorizedAccessException : System.SystemException
{
public UnauthorizedAccessException() { }
protected UnauthorizedAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public UnauthorizedAccessException(string? message) { }
public UnauthorizedAccessException(string? message, System.Exception? inner) { }
}
public partial class UnhandledExceptionEventArgs : System.EventArgs
{
public UnhandledExceptionEventArgs(object exception, bool isTerminating) { }
public object ExceptionObject { get { throw null; } }
public bool IsTerminating { get { throw null; } }
}
public delegate void UnhandledExceptionEventHandler(object sender, System.UnhandledExceptionEventArgs e);
public partial class Uri : System.Runtime.Serialization.ISerializable
{
public static readonly string SchemeDelimiter;
public static readonly string UriSchemeFile;
public static readonly string UriSchemeFtp;
public static readonly string UriSchemeFtps;
public static readonly string UriSchemeGopher;
public static readonly string UriSchemeHttp;
public static readonly string UriSchemeHttps;
public static readonly string UriSchemeMailto;
public static readonly string UriSchemeNetPipe;
public static readonly string UriSchemeNetTcp;
public static readonly string UriSchemeNews;
public static readonly string UriSchemeNntp;
public static readonly string UriSchemeSftp;
public static readonly string UriSchemeSsh;
public static readonly string UriSchemeTelnet;
public static readonly string UriSchemeWs;
public static readonly string UriSchemeWss;
protected Uri(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
public Uri(string uriString) { }
[System.ObsoleteAttribute("This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(string) instead.")]
public Uri(string uriString, bool dontEscape) { }
public Uri(string uriString, in System.UriCreationOptions creationOptions) { }
public Uri(string uriString, System.UriKind uriKind) { }
public Uri(System.Uri baseUri, string? relativeUri) { }
[System.ObsoleteAttribute("This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(Uri, string) instead.")]
public Uri(System.Uri baseUri, string? relativeUri, bool dontEscape) { }
public Uri(System.Uri baseUri, System.Uri relativeUri) { }
public string AbsolutePath { get { throw null; } }
public string AbsoluteUri { get { throw null; } }
public string Authority { get { throw null; } }
public string DnsSafeHost { get { throw null; } }
public string Fragment { get { throw null; } }
public string Host { get { throw null; } }
public System.UriHostNameType HostNameType { get { throw null; } }
public string IdnHost { get { throw null; } }
public bool IsAbsoluteUri { get { throw null; } }
public bool IsDefaultPort { get { throw null; } }
public bool IsFile { get { throw null; } }
public bool IsLoopback { get { throw null; } }
public bool IsUnc { get { throw null; } }
public string LocalPath { get { throw null; } }
public string OriginalString { get { throw null; } }
public string PathAndQuery { get { throw null; } }
public int Port { get { throw null; } }
public string Query { get { throw null; } }
public string Scheme { get { throw null; } }
public string[] Segments { get { throw null; } }
public bool UserEscaped { get { throw null; } }
public string UserInfo { get { throw null; } }
[System.ObsoleteAttribute("Uri.Canonicalize has been deprecated and is not supported.")]
protected virtual void Canonicalize() { }
public static System.UriHostNameType CheckHostName(string? name) { throw null; }
public static bool CheckSchemeName([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? schemeName) { throw null; }
[System.ObsoleteAttribute("Uri.CheckSecurity has been deprecated and is not supported.")]
protected virtual void CheckSecurity() { }
public static int Compare(System.Uri? uri1, System.Uri? uri2, System.UriComponents partsToCompare, System.UriFormat compareFormat, System.StringComparison comparisonType) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? comparand) { throw null; }
[System.ObsoleteAttribute("Uri.Escape has been deprecated and is not supported.")]
protected virtual void Escape() { }
public static string EscapeDataString(string stringToEscape) { throw null; }
[System.ObsoleteAttribute("Uri.EscapeString has been deprecated. Use GetComponents() or Uri.EscapeDataString to escape a Uri component or a string.")]
protected static string EscapeString(string? str) { throw null; }
[System.ObsoleteAttribute("Uri.EscapeUriString can corrupt the Uri string in some cases. Consider using Uri.EscapeDataString for query string components instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static string EscapeUriString(string stringToEscape) { throw null; }
public static int FromHex(char digit) { throw null; }
public string GetComponents(System.UriComponents components, System.UriFormat format) { throw null; }
public override int GetHashCode() { throw null; }
public string GetLeftPart(System.UriPartial part) { throw null; }
protected void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
public static string HexEscape(char character) { throw null; }
public static char HexUnescape(string pattern, ref int index) { throw null; }
[System.ObsoleteAttribute("Uri.IsBadFileSystemCharacter has been deprecated and is not supported.")]
protected virtual bool IsBadFileSystemCharacter(char character) { throw null; }
public bool IsBaseOf(System.Uri uri) { throw null; }
[System.ObsoleteAttribute("Uri.IsExcludedCharacter has been deprecated and is not supported.")]
protected static bool IsExcludedCharacter(char character) { throw null; }
public static bool IsHexDigit(char character) { throw null; }
public static bool IsHexEncoding(string pattern, int index) { throw null; }
[System.ObsoleteAttribute("Uri.IsReservedCharacter has been deprecated and is not supported.")]
protected virtual bool IsReservedCharacter(char character) { throw null; }
public bool IsWellFormedOriginalString() { throw null; }
public static bool IsWellFormedUriString([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? uriString, System.UriKind uriKind) { throw null; }
[System.ObsoleteAttribute("Uri.MakeRelative has been deprecated. Use MakeRelativeUri(Uri uri) instead.")]
public string MakeRelative(System.Uri toUri) { throw null; }
public System.Uri MakeRelativeUri(System.Uri uri) { throw null; }
public static bool operator ==(System.Uri? uri1, System.Uri? uri2) { throw null; }
public static bool operator !=(System.Uri? uri1, System.Uri? uri2) { throw null; }
[System.ObsoleteAttribute("Uri.Parse has been deprecated and is not supported.")]
protected virtual void Parse() { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
public override string ToString() { throw null; }
public static bool TryCreate([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? uriString, in System.UriCreationOptions creationOptions, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; }
public static bool TryCreate([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? uriString, System.UriKind uriKind, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; }
public static bool TryCreate(System.Uri? baseUri, string? relativeUri, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; }
public static bool TryCreate(System.Uri? baseUri, System.Uri? relativeUri, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; }
[System.ObsoleteAttribute("Uri.Unescape has been deprecated. Use GetComponents() or Uri.UnescapeDataString() to unescape a Uri component or a string.")]
protected virtual string Unescape(string path) { throw null; }
public static string UnescapeDataString(string stringToUnescape) { throw null; }
}
public partial class UriBuilder
{
public UriBuilder() { }
public UriBuilder(string uri) { }
public UriBuilder(string? schemeName, string? hostName) { }
public UriBuilder(string? scheme, string? host, int portNumber) { }
public UriBuilder(string? scheme, string? host, int port, string? pathValue) { }
public UriBuilder(string? scheme, string? host, int port, string? path, string? extraValue) { }
public UriBuilder(System.Uri uri) { }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Fragment { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Host { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Password { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Path { get { throw null; } set { } }
public int Port { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Query { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Scheme { get { throw null; } set { } }
public System.Uri Uri { get { throw null; } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string UserName { get { throw null; } set { } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? rparam) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum UriComponents
{
SerializationInfoString = -2147483648,
Scheme = 1,
UserInfo = 2,
Host = 4,
Port = 8,
SchemeAndServer = 13,
Path = 16,
Query = 32,
PathAndQuery = 48,
HttpRequestUrl = 61,
Fragment = 64,
AbsoluteUri = 127,
StrongPort = 128,
HostAndPort = 132,
StrongAuthority = 134,
NormalizedHost = 256,
KeepDelimiter = 1073741824,
}
public partial struct UriCreationOptions
{
private int _dummyPrimitive;
public bool DangerousDisablePathAndQueryCanonicalization { readonly get { throw null; } set { } }
}
public enum UriFormat
{
UriEscaped = 1,
Unescaped = 2,
SafeUnescaped = 3,
}
public partial class UriFormatException : System.FormatException, System.Runtime.Serialization.ISerializable
{
public UriFormatException() { }
protected UriFormatException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
public UriFormatException(string? textString) { }
public UriFormatException(string? textString, System.Exception? e) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
}
public enum UriHostNameType
{
Unknown = 0,
Basic = 1,
Dns = 2,
IPv4 = 3,
IPv6 = 4,
}
public enum UriKind
{
RelativeOrAbsolute = 0,
Absolute = 1,
Relative = 2,
}
public abstract partial class UriParser
{
protected UriParser() { }
protected virtual string GetComponents(System.Uri uri, System.UriComponents components, System.UriFormat format) { throw null; }
protected virtual void InitializeAndValidate(System.Uri uri, out System.UriFormatException? parsingError) { throw null; }
protected virtual bool IsBaseOf(System.Uri baseUri, System.Uri relativeUri) { throw null; }
public static bool IsKnownScheme(string schemeName) { throw null; }
protected virtual bool IsWellFormedOriginalString(System.Uri uri) { throw null; }
protected virtual System.UriParser OnNewUri() { throw null; }
protected virtual void OnRegister(string schemeName, int defaultPort) { }
public static void Register(System.UriParser uriParser, string schemeName, int defaultPort) { }
protected virtual string? Resolve(System.Uri baseUri, System.Uri? relativeUri, out System.UriFormatException? parsingError) { throw null; }
}
public enum UriPartial
{
Scheme = 0,
Authority = 1,
Path = 2,
Query = 3,
}
public partial struct ValueTuple : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<System.ValueTuple>, System.IEquatable<System.ValueTuple>, System.Runtime.CompilerServices.ITuple
{
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo(System.ValueTuple other) { throw null; }
public static System.ValueTuple Create() { throw null; }
public static System.ValueTuple<T1> Create<T1>(T1 item1) { throw null; }
public static (T1, T2) Create<T1, T2>(T1 item1, T2 item2) { throw null; }
public static (T1, T2, T3) Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3) { throw null; }
public static (T1, T2, T3, T4) Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4) { throw null; }
public static (T1, T2, T3, T4, T5) Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { throw null; }
public static (T1, T2, T3, T4, T5, T6) Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7) Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8) Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.ValueTuple other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<System.ValueTuple<T1>>, System.IEquatable<System.ValueTuple<T1>>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public ValueTuple(T1 item1) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo(System.ValueTuple<T1> other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.ValueTuple<T1> other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2)>, System.IEquatable<(T1, T2)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public ValueTuple(T1 item1, T2 item2) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3)>, System.IEquatable<(T1, T2, T3)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public ValueTuple(T1 item1, T2 item2, T3 item3) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3, T4)>, System.IEquatable<(T1, T2, T3, T4)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3, T4) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3, T4) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4, T5> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3, T4, T5)>, System.IEquatable<(T1, T2, T3, T4, T5)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3, T4, T5) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3, T4, T5) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4, T5, T6> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3, T4, T5, T6)>, System.IEquatable<(T1, T2, T3, T4, T5, T6)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3, T4, T5, T6) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3, T4, T5, T6) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4, T5, T6, T7> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3, T4, T5, T6, T7)>, System.IEquatable<(T1, T2, T3, T4, T5, T6, T7)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public T7 Item7;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3, T4, T5, T6, T7) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3, T4, T5, T6, T7) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, System.IEquatable<System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, System.Runtime.CompilerServices.ITuple where TRest : struct
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public T7 Item7;
public TRest Rest;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo(System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public abstract partial class ValueType
{
protected ValueType() { }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override string? ToString() { throw null; }
}
public sealed partial class Version : System.ICloneable, System.IComparable, System.IComparable<System.Version?>, System.IEquatable<System.Version?>, System.IFormattable, System.ISpanFormattable
{
public Version() { }
public Version(int major, int minor) { }
public Version(int major, int minor, int build) { }
public Version(int major, int minor, int build, int revision) { }
public Version(string version) { }
public int Build { get { throw null; } }
public int Major { get { throw null; } }
public short MajorRevision { get { throw null; } }
public int Minor { get { throw null; } }
public short MinorRevision { get { throw null; } }
public int Revision { get { throw null; } }
public object Clone() { throw null; }
public int CompareTo(object? version) { throw null; }
public int CompareTo(System.Version? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Version? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator >(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator >=(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator !=(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator <(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator <=(System.Version? v1, System.Version? v2) { throw null; }
public static System.Version Parse(System.ReadOnlySpan<char> input) { throw null; }
public static System.Version Parse(string input) { throw null; }
string System.IFormattable.ToString(string? format, System.IFormatProvider? formatProvider) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(int fieldCount) { throw null; }
public bool TryFormat(System.Span<char> destination, int fieldCount, out int charsWritten) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Version? result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Version? result) { throw null; }
}
public partial struct Void
{
}
public partial class WeakReference : System.Runtime.Serialization.ISerializable
{
public WeakReference(object? target) { }
public WeakReference(object? target, bool trackResurrection) { }
protected WeakReference(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public virtual bool IsAlive { get { throw null; } }
public virtual object? Target { get { throw null; } set { } }
public virtual bool TrackResurrection { get { throw null; } }
~WeakReference() { }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public sealed partial class WeakReference<T> : System.Runtime.Serialization.ISerializable where T : class?
{
public WeakReference(T target) { }
public WeakReference(T target, bool trackResurrection) { }
~WeakReference() { }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public void SetTarget(T target) { }
public bool TryGetTarget([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false), System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out T target) { throw null; }
}
}
namespace System.Buffers
{
public abstract partial class ArrayPool<T>
{
protected ArrayPool() { }
public static System.Buffers.ArrayPool<T> Shared { get { throw null; } }
public static System.Buffers.ArrayPool<T> Create() { throw null; }
public static System.Buffers.ArrayPool<T> Create(int maxArrayLength, int maxArraysPerBucket) { throw null; }
public abstract T[] Rent(int minimumLength);
public abstract void Return(T[] array, bool clearArray = false);
}
public partial interface IMemoryOwner<T> : System.IDisposable
{
System.Memory<T> Memory { get; }
}
public partial interface IPinnable
{
System.Buffers.MemoryHandle Pin(int elementIndex);
void Unpin();
}
public partial struct MemoryHandle : System.IDisposable
{
private object _dummy;
private int _dummyPrimitive;
[System.CLSCompliantAttribute(false)]
public unsafe MemoryHandle(void* pointer, System.Runtime.InteropServices.GCHandle handle = default(System.Runtime.InteropServices.GCHandle), System.Buffers.IPinnable? pinnable = null) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe void* Pointer { get { throw null; } }
public void Dispose() { }
}
public abstract partial class MemoryManager<T> : System.Buffers.IMemoryOwner<T>, System.Buffers.IPinnable, System.IDisposable
{
protected MemoryManager() { }
public virtual System.Memory<T> Memory { get { throw null; } }
protected System.Memory<T> CreateMemory(int length) { throw null; }
protected System.Memory<T> CreateMemory(int start, int length) { throw null; }
protected abstract void Dispose(bool disposing);
public abstract System.Span<T> GetSpan();
public abstract System.Buffers.MemoryHandle Pin(int elementIndex = 0);
void System.IDisposable.Dispose() { }
protected internal virtual bool TryGetArray(out System.ArraySegment<T> segment) { throw null; }
public abstract void Unpin();
}
public enum OperationStatus
{
Done = 0,
DestinationTooSmall = 1,
NeedMoreData = 2,
InvalidData = 3,
}
public delegate void ReadOnlySpanAction<T, in TArg>(System.ReadOnlySpan<T> span, TArg arg);
public delegate void SpanAction<T, in TArg>(System.Span<T> span, TArg arg);
}
namespace System.CodeDom.Compiler
{
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=false, AllowMultiple=false)]
public sealed partial class GeneratedCodeAttribute : System.Attribute
{
public GeneratedCodeAttribute(string? tool, string? version) { }
public string? Tool { get { throw null; } }
public string? Version { get { throw null; } }
}
public partial class IndentedTextWriter : System.IO.TextWriter
{
public const string DefaultTabString = " ";
public IndentedTextWriter(System.IO.TextWriter writer) { }
public IndentedTextWriter(System.IO.TextWriter writer, string tabString) { }
public override System.Text.Encoding Encoding { get { throw null; } }
public int Indent { get { throw null; } set { } }
public System.IO.TextWriter InnerWriter { get { throw null; } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public override string NewLine { get { throw null; } set { } }
public override void Close() { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync() { throw null; }
protected virtual void OutputTabs() { }
protected virtual System.Threading.Tasks.Task OutputTabsAsync() { throw null; }
public override void Write(bool value) { }
public override void Write(char value) { }
public override void Write(char[]? buffer) { }
public override void Write(char[] buffer, int index, int count) { }
public override void Write(double value) { }
public override void Write(int value) { }
public override void Write(long value) { }
public override void Write(object? value) { }
public override void Write(float value) { }
public override void Write(string? s) { }
public override void Write(string format, object? arg0) { }
public override void Write(string format, object? arg0, object? arg1) { }
public override void Write(string format, params object?[] arg) { }
public override System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(string? value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteLine() { }
public override void WriteLine(bool value) { }
public override void WriteLine(char value) { }
public override void WriteLine(char[]? buffer) { }
public override void WriteLine(char[] buffer, int index, int count) { }
public override void WriteLine(double value) { }
public override void WriteLine(int value) { }
public override void WriteLine(long value) { }
public override void WriteLine(object? value) { }
public override void WriteLine(float value) { }
public override void WriteLine(string? s) { }
public override void WriteLine(string format, object? arg0) { }
public override void WriteLine(string format, object? arg0, object? arg1) { }
public override void WriteLine(string format, params object?[] arg) { }
[System.CLSCompliantAttribute(false)]
public override void WriteLine(uint value) { }
public override System.Threading.Tasks.Task WriteLineAsync() { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(string? value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public void WriteLineNoTabs(string? s) { }
public System.Threading.Tasks.Task WriteLineNoTabsAsync(string? s) { throw null; }
}
}
namespace System.Collections
{
public partial class ArrayList : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable
{
public ArrayList() { }
public ArrayList(System.Collections.ICollection c) { }
public ArrayList(int capacity) { }
public virtual int Capacity { get { throw null; } set { } }
public virtual int Count { get { throw null; } }
public virtual bool IsFixedSize { get { throw null; } }
public virtual bool IsReadOnly { get { throw null; } }
public virtual bool IsSynchronized { get { throw null; } }
public virtual object? this[int index] { get { throw null; } set { } }
public virtual object SyncRoot { get { throw null; } }
public static System.Collections.ArrayList Adapter(System.Collections.IList list) { throw null; }
public virtual int Add(object? value) { throw null; }
public virtual void AddRange(System.Collections.ICollection c) { }
public virtual int BinarySearch(int index, int count, object? value, System.Collections.IComparer? comparer) { throw null; }
public virtual int BinarySearch(object? value) { throw null; }
public virtual int BinarySearch(object? value, System.Collections.IComparer? comparer) { throw null; }
public virtual void Clear() { }
public virtual object Clone() { throw null; }
public virtual bool Contains(object? item) { throw null; }
public virtual void CopyTo(System.Array array) { }
public virtual void CopyTo(System.Array array, int arrayIndex) { }
public virtual void CopyTo(int index, System.Array array, int arrayIndex, int count) { }
public static System.Collections.ArrayList FixedSize(System.Collections.ArrayList list) { throw null; }
public static System.Collections.IList FixedSize(System.Collections.IList list) { throw null; }
public virtual System.Collections.IEnumerator GetEnumerator() { throw null; }
public virtual System.Collections.IEnumerator GetEnumerator(int index, int count) { throw null; }
public virtual System.Collections.ArrayList GetRange(int index, int count) { throw null; }
public virtual int IndexOf(object? value) { throw null; }
public virtual int IndexOf(object? value, int startIndex) { throw null; }
public virtual int IndexOf(object? value, int startIndex, int count) { throw null; }
public virtual void Insert(int index, object? value) { }
public virtual void InsertRange(int index, System.Collections.ICollection c) { }
public virtual int LastIndexOf(object? value) { throw null; }
public virtual int LastIndexOf(object? value, int startIndex) { throw null; }
public virtual int LastIndexOf(object? value, int startIndex, int count) { throw null; }
public static System.Collections.ArrayList ReadOnly(System.Collections.ArrayList list) { throw null; }
public static System.Collections.IList ReadOnly(System.Collections.IList list) { throw null; }
public virtual void Remove(object? obj) { }
public virtual void RemoveAt(int index) { }
public virtual void RemoveRange(int index, int count) { }
public static System.Collections.ArrayList Repeat(object? value, int count) { throw null; }
public virtual void Reverse() { }
public virtual void Reverse(int index, int count) { }
public virtual void SetRange(int index, System.Collections.ICollection c) { }
public virtual void Sort() { }
public virtual void Sort(System.Collections.IComparer? comparer) { }
public virtual void Sort(int index, int count, System.Collections.IComparer? comparer) { }
public static System.Collections.ArrayList Synchronized(System.Collections.ArrayList list) { throw null; }
public static System.Collections.IList Synchronized(System.Collections.IList list) { throw null; }
public virtual object?[] ToArray() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public virtual System.Array ToArray(System.Type type) { throw null; }
public virtual void TrimToSize() { }
}
public sealed partial class Comparer : System.Collections.IComparer, System.Runtime.Serialization.ISerializable
{
public static readonly System.Collections.Comparer Default;
public static readonly System.Collections.Comparer DefaultInvariant;
public Comparer(System.Globalization.CultureInfo culture) { }
public int Compare(object? a, object? b) { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial struct DictionaryEntry
{
private object _dummy;
private int _dummyPrimitive;
public DictionaryEntry(object key, object? value) { throw null; }
public object Key { get { throw null; } set { } }
public object? Value { get { throw null; } set { } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public void Deconstruct(out object key, out object? value) { throw null; }
}
public partial class Hashtable : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable, System.ICloneable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
public Hashtable() { }
public Hashtable(System.Collections.IDictionary d) { }
public Hashtable(System.Collections.IDictionary d, System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(IDictionary, IEqualityComparer) instead.")]
public Hashtable(System.Collections.IDictionary d, System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
public Hashtable(System.Collections.IDictionary d, float loadFactor) { }
public Hashtable(System.Collections.IDictionary d, float loadFactor, System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(IDictionary, float, IEqualityComparer) instead.")]
public Hashtable(System.Collections.IDictionary d, float loadFactor, System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
public Hashtable(System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(IEqualityComparer) instead.")]
public Hashtable(System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
public Hashtable(int capacity) { }
public Hashtable(int capacity, System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(int, IEqualityComparer) instead.")]
public Hashtable(int capacity, System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
public Hashtable(int capacity, float loadFactor) { }
public Hashtable(int capacity, float loadFactor, System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(int, float, IEqualityComparer) instead.")]
public Hashtable(int capacity, float loadFactor, System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
protected Hashtable(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
[System.ObsoleteAttribute("Hashtable.comparer has been deprecated. Use the KeyComparer properties instead.")]
protected System.Collections.IComparer? comparer { get { throw null; } set { } }
public virtual int Count { get { throw null; } }
protected System.Collections.IEqualityComparer? EqualityComparer { get { throw null; } }
[System.ObsoleteAttribute("Hashtable.hcp has been deprecated. Use the EqualityComparer property instead.")]
protected System.Collections.IHashCodeProvider? hcp { get { throw null; } set { } }
public virtual bool IsFixedSize { get { throw null; } }
public virtual bool IsReadOnly { get { throw null; } }
public virtual bool IsSynchronized { get { throw null; } }
public virtual object? this[object key] { get { throw null; } set { } }
public virtual System.Collections.ICollection Keys { get { throw null; } }
public virtual object SyncRoot { get { throw null; } }
public virtual System.Collections.ICollection Values { get { throw null; } }
public virtual void Add(object key, object? value) { }
public virtual void Clear() { }
public virtual object Clone() { throw null; }
public virtual bool Contains(object key) { throw null; }
public virtual bool ContainsKey(object key) { throw null; }
public virtual bool ContainsValue(object? value) { throw null; }
public virtual void CopyTo(System.Array array, int arrayIndex) { }
public virtual System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
protected virtual int GetHash(object key) { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
protected virtual bool KeyEquals(object? item, object key) { throw null; }
public virtual void OnDeserialization(object? sender) { }
public virtual void Remove(object key) { }
public static System.Collections.Hashtable Synchronized(System.Collections.Hashtable table) { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial interface ICollection : System.Collections.IEnumerable
{
int Count { get; }
bool IsSynchronized { get; }
object SyncRoot { get; }
void CopyTo(System.Array array, int index);
}
public partial interface IComparer
{
int Compare(object? x, object? y);
}
public partial interface IDictionary : System.Collections.ICollection, System.Collections.IEnumerable
{
bool IsFixedSize { get; }
bool IsReadOnly { get; }
object? this[object key] { get; set; }
System.Collections.ICollection Keys { get; }
System.Collections.ICollection Values { get; }
void Add(object key, object? value);
void Clear();
bool Contains(object key);
new System.Collections.IDictionaryEnumerator GetEnumerator();
void Remove(object key);
}
public partial interface IDictionaryEnumerator : System.Collections.IEnumerator
{
System.Collections.DictionaryEntry Entry { get; }
object Key { get; }
object? Value { get; }
}
public partial interface IEnumerable
{
System.Collections.IEnumerator GetEnumerator();
}
public partial interface IEnumerator
{
#nullable disable // explicitly leaving Current as "oblivious" to avoid spurious warnings in foreach over non-generic enumerables
object Current { get; }
#nullable restore
bool MoveNext();
void Reset();
}
public partial interface IEqualityComparer
{
bool Equals(object? x, object? y);
int GetHashCode(object obj);
}
[System.ObsoleteAttribute("IHashCodeProvider has been deprecated. Use IEqualityComparer instead.")]
public partial interface IHashCodeProvider
{
int GetHashCode(object obj);
}
public partial interface IList : System.Collections.ICollection, System.Collections.IEnumerable
{
bool IsFixedSize { get; }
bool IsReadOnly { get; }
object? this[int index] { get; set; }
int Add(object? value);
void Clear();
bool Contains(object? value);
int IndexOf(object? value);
void Insert(int index, object? value);
void Remove(object? value);
void RemoveAt(int index);
}
public partial interface IStructuralComparable
{
int CompareTo(object? other, System.Collections.IComparer comparer);
}
public partial interface IStructuralEquatable
{
bool Equals(object? other, System.Collections.IEqualityComparer comparer);
int GetHashCode(System.Collections.IEqualityComparer comparer);
}
}
namespace System.Collections.Generic
{
public partial interface IAsyncEnumerable<out T>
{
System.Collections.Generic.IAsyncEnumerator<T> GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
}
public partial interface IAsyncEnumerator<out T> : System.IAsyncDisposable
{
T Current { get; }
System.Threading.Tasks.ValueTask<bool> MoveNextAsync();
}
public partial interface ICollection<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
{
int Count { get; }
bool IsReadOnly { get; }
void Add(T item);
void Clear();
bool Contains(T item);
void CopyTo(T[] array, int arrayIndex);
bool Remove(T item);
}
public partial interface IComparer<in T>
{
int Compare(T? x, T? y);
}
public partial interface IDictionary<TKey, TValue> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerable
{
TValue this[TKey key] { get; set; }
System.Collections.Generic.ICollection<TKey> Keys { get; }
System.Collections.Generic.ICollection<TValue> Values { get; }
void Add(TKey key, TValue value);
bool ContainsKey(TKey key);
bool Remove(TKey key);
bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value);
}
public partial interface IEnumerable<out T> : System.Collections.IEnumerable
{
new System.Collections.Generic.IEnumerator<T> GetEnumerator();
}
public partial interface IEnumerator<out T> : System.Collections.IEnumerator, System.IDisposable
{
new T Current { get; }
}
public partial interface IEqualityComparer<in T>
{
bool Equals(T? x, T? y);
int GetHashCode([System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T obj);
}
public partial interface IList<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
{
T this[int index] { get; set; }
int IndexOf(T item);
void Insert(int index, T item);
void RemoveAt(int index);
}
public partial interface IReadOnlyCollection<out T> : System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
{
int Count { get; }
}
public partial interface IReadOnlyDictionary<TKey, TValue> : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerable
{
TValue this[TKey key] { get; }
System.Collections.Generic.IEnumerable<TKey> Keys { get; }
System.Collections.Generic.IEnumerable<TValue> Values { get; }
bool ContainsKey(TKey key);
bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value);
}
public partial interface IReadOnlyList<out T> : System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.IEnumerable
{
T this[int index] { get; }
}
public partial interface IReadOnlySet<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.IEnumerable
{
bool Contains(T item);
bool IsProperSubsetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other);
bool Overlaps(System.Collections.Generic.IEnumerable<T> other);
bool SetEquals(System.Collections.Generic.IEnumerable<T> other);
}
public partial interface ISet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
{
new bool Add(T item);
void ExceptWith(System.Collections.Generic.IEnumerable<T> other);
void IntersectWith(System.Collections.Generic.IEnumerable<T> other);
bool IsProperSubsetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other);
bool Overlaps(System.Collections.Generic.IEnumerable<T> other);
bool SetEquals(System.Collections.Generic.IEnumerable<T> other);
void SymmetricExceptWith(System.Collections.Generic.IEnumerable<T> other);
void UnionWith(System.Collections.Generic.IEnumerable<T> other);
}
public partial class KeyNotFoundException : System.SystemException
{
public KeyNotFoundException() { }
protected KeyNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public KeyNotFoundException(string? message) { }
public KeyNotFoundException(string? message, System.Exception? innerException) { }
}
public static partial class KeyValuePair
{
public static System.Collections.Generic.KeyValuePair<TKey, TValue> Create<TKey, TValue>(TKey key, TValue value) { throw null; }
}
public readonly partial struct KeyValuePair<TKey, TValue>
{
private readonly TKey key;
private readonly TValue value;
private readonly int _dummyPrimitive;
public KeyValuePair(TKey key, TValue value) { throw null; }
public TKey Key { get { throw null; } }
public TValue Value { get { throw null; } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public void Deconstruct(out TKey key, out TValue value) { throw null; }
public override string ToString() { throw null; }
}
}
namespace System.Collections.ObjectModel
{
public partial class Collection<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
{
public Collection() { }
public Collection(System.Collections.Generic.IList<T> list) { }
public int Count { get { throw null; } }
public T this[int index] { get { throw null; } set { } }
protected System.Collections.Generic.IList<T> Items { get { throw null; } }
bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
bool System.Collections.IList.IsFixedSize { get { throw null; } }
bool System.Collections.IList.IsReadOnly { get { throw null; } }
object? System.Collections.IList.this[int index] { get { throw null; } set { } }
public void Add(T item) { }
public void Clear() { }
protected virtual void ClearItems() { }
public bool Contains(T item) { throw null; }
public void CopyTo(T[] array, int index) { }
public System.Collections.Generic.IEnumerator<T> GetEnumerator() { throw null; }
public int IndexOf(T item) { throw null; }
public void Insert(int index, T item) { }
protected virtual void InsertItem(int index, T item) { }
public bool Remove(T item) { throw null; }
public void RemoveAt(int index) { }
protected virtual void RemoveItem(int index) { }
protected virtual void SetItem(int index, T item) { }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
int System.Collections.IList.Add(object? value) { throw null; }
bool System.Collections.IList.Contains(object? value) { throw null; }
int System.Collections.IList.IndexOf(object? value) { throw null; }
void System.Collections.IList.Insert(int index, object? value) { }
void System.Collections.IList.Remove(object? value) { }
}
public partial class ReadOnlyCollection<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
{
public ReadOnlyCollection(System.Collections.Generic.IList<T> list) { }
public int Count { get { throw null; } }
public T this[int index] { get { throw null; } }
protected System.Collections.Generic.IList<T> Items { get { throw null; } }
bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
T System.Collections.Generic.IList<T>.this[int index] { get { throw null; } set { } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
bool System.Collections.IList.IsFixedSize { get { throw null; } }
bool System.Collections.IList.IsReadOnly { get { throw null; } }
object? System.Collections.IList.this[int index] { get { throw null; } set { } }
public bool Contains(T value) { throw null; }
public void CopyTo(T[] array, int index) { }
public System.Collections.Generic.IEnumerator<T> GetEnumerator() { throw null; }
public int IndexOf(T value) { throw null; }
void System.Collections.Generic.ICollection<T>.Add(T value) { }
void System.Collections.Generic.ICollection<T>.Clear() { }
bool System.Collections.Generic.ICollection<T>.Remove(T value) { throw null; }
void System.Collections.Generic.IList<T>.Insert(int index, T value) { }
void System.Collections.Generic.IList<T>.RemoveAt(int index) { }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
int System.Collections.IList.Add(object? value) { throw null; }
void System.Collections.IList.Clear() { }
bool System.Collections.IList.Contains(object? value) { throw null; }
int System.Collections.IList.IndexOf(object? value) { throw null; }
void System.Collections.IList.Insert(int index, object? value) { }
void System.Collections.IList.Remove(object? value) { }
void System.Collections.IList.RemoveAt(int index) { }
}
public partial class ReadOnlyDictionary<TKey, TValue> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IDictionary<TKey, TValue>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>, System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable where TKey : notnull
{
public ReadOnlyDictionary(System.Collections.Generic.IDictionary<TKey, TValue> dictionary) { }
public int Count { get { throw null; } }
protected System.Collections.Generic.IDictionary<TKey, TValue> Dictionary { get { throw null; } }
public TValue this[TKey key] { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>.KeyCollection Keys { get { throw null; } }
bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.IsReadOnly { get { throw null; } }
TValue System.Collections.Generic.IDictionary<TKey, TValue>.this[TKey key] { get { throw null; } set { } }
System.Collections.Generic.ICollection<TKey> System.Collections.Generic.IDictionary<TKey, TValue>.Keys { get { throw null; } }
System.Collections.Generic.ICollection<TValue> System.Collections.Generic.IDictionary<TKey, TValue>.Values { get { throw null; } }
System.Collections.Generic.IEnumerable<TKey> System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>.Keys { get { throw null; } }
System.Collections.Generic.IEnumerable<TValue> System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>.Values { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
bool System.Collections.IDictionary.IsFixedSize { get { throw null; } }
bool System.Collections.IDictionary.IsReadOnly { get { throw null; } }
object? System.Collections.IDictionary.this[object key] { get { throw null; } set { } }
System.Collections.ICollection System.Collections.IDictionary.Keys { get { throw null; } }
System.Collections.ICollection System.Collections.IDictionary.Values { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>.ValueCollection Values { get { throw null; } }
public bool ContainsKey(TKey key) { throw null; }
public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> GetEnumerator() { throw null; }
void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Add(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { }
void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Clear() { }
bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Contains(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { throw null; }
void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.CopyTo(System.Collections.Generic.KeyValuePair<TKey, TValue>[] array, int arrayIndex) { }
bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Remove(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { throw null; }
void System.Collections.Generic.IDictionary<TKey, TValue>.Add(TKey key, TValue value) { }
bool System.Collections.Generic.IDictionary<TKey, TValue>.Remove(TKey key) { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
void System.Collections.IDictionary.Add(object key, object? value) { }
void System.Collections.IDictionary.Clear() { }
bool System.Collections.IDictionary.Contains(object key) { throw null; }
System.Collections.IDictionaryEnumerator System.Collections.IDictionary.GetEnumerator() { throw null; }
void System.Collections.IDictionary.Remove(object key) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; }
public sealed partial class KeyCollection : System.Collections.Generic.ICollection<TKey>, System.Collections.Generic.IEnumerable<TKey>, System.Collections.Generic.IReadOnlyCollection<TKey>, System.Collections.ICollection, System.Collections.IEnumerable
{
internal KeyCollection() { }
public int Count { get { throw null; } }
bool System.Collections.Generic.ICollection<TKey>.IsReadOnly { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
public void CopyTo(TKey[] array, int arrayIndex) { }
public System.Collections.Generic.IEnumerator<TKey> GetEnumerator() { throw null; }
void System.Collections.Generic.ICollection<TKey>.Add(TKey item) { }
void System.Collections.Generic.ICollection<TKey>.Clear() { }
bool System.Collections.Generic.ICollection<TKey>.Contains(TKey item) { throw null; }
bool System.Collections.Generic.ICollection<TKey>.Remove(TKey item) { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public sealed partial class ValueCollection : System.Collections.Generic.ICollection<TValue>, System.Collections.Generic.IEnumerable<TValue>, System.Collections.Generic.IReadOnlyCollection<TValue>, System.Collections.ICollection, System.Collections.IEnumerable
{
internal ValueCollection() { }
public int Count { get { throw null; } }
bool System.Collections.Generic.ICollection<TValue>.IsReadOnly { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
public void CopyTo(TValue[] array, int arrayIndex) { }
public System.Collections.Generic.IEnumerator<TValue> GetEnumerator() { throw null; }
void System.Collections.Generic.ICollection<TValue>.Add(TValue item) { }
void System.Collections.Generic.ICollection<TValue>.Clear() { }
bool System.Collections.Generic.ICollection<TValue>.Contains(TValue item) { throw null; }
bool System.Collections.Generic.ICollection<TValue>.Remove(TValue item) { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
}
}
namespace System.ComponentModel
{
[System.AttributeUsageAttribute(System.AttributeTargets.All)]
public partial class DefaultValueAttribute : System.Attribute
{
public DefaultValueAttribute(bool value) { }
public DefaultValueAttribute(byte value) { }
public DefaultValueAttribute(char value) { }
public DefaultValueAttribute(double value) { }
public DefaultValueAttribute(short value) { }
public DefaultValueAttribute(int value) { }
public DefaultValueAttribute(long value) { }
public DefaultValueAttribute(object? value) { }
[System.CLSCompliantAttribute(false)]
public DefaultValueAttribute(sbyte value) { }
public DefaultValueAttribute(float value) { }
public DefaultValueAttribute(string? value) { }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
public DefaultValueAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, string? value) { }
[System.CLSCompliantAttribute(false)]
public DefaultValueAttribute(ushort value) { }
[System.CLSCompliantAttribute(false)]
public DefaultValueAttribute(uint value) { }
[System.CLSCompliantAttribute(false)]
public DefaultValueAttribute(ulong value) { }
public virtual object? Value { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
protected void SetValue(object? value) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct)]
public sealed partial class EditorBrowsableAttribute : System.Attribute
{
public EditorBrowsableAttribute() { }
public EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState state) { }
public System.ComponentModel.EditorBrowsableState State { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public enum EditorBrowsableState
{
Always = 0,
Never = 1,
Advanced = 2,
}
}
namespace System.Configuration.Assemblies
{
public enum AssemblyHashAlgorithm
{
None = 0,
MD5 = 32771,
SHA1 = 32772,
SHA256 = 32780,
SHA384 = 32781,
SHA512 = 32782,
}
public enum AssemblyVersionCompatibility
{
SameMachine = 1,
SameProcess = 2,
SameDomain = 3,
}
}
namespace System.Diagnostics
{
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
public sealed partial class ConditionalAttribute : System.Attribute
{
public ConditionalAttribute(string conditionString) { }
public string ConditionString { get { throw null; } }
}
public static partial class Debug
{
public static bool AutoFlush { get { throw null; } set { } }
public static int IndentLevel { get { throw null; } set { } }
public static int IndentSize { get { throw null; } set { } }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.AssertInterpolatedStringHandler message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.AssertInterpolatedStringHandler message, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.AssertInterpolatedStringHandler detailMessage) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, string? message, string? detailMessage) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, string? message, string detailMessageFormat, params object?[] args) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Close() { }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Fail(string? message) => throw null;
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Fail(string? message, string? detailMessage) => throw null;
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Flush() { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Indent() { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Print(string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Print(string format, params object?[] args) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Unindent() { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Write(object? value) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Write(object? value, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Write(string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Write(string? message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.WriteIfInterpolatedStringHandler message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.WriteIfInterpolatedStringHandler message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, object? value) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, object? value, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, string? message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(object? value) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(object? value, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(string format, params object?[] args) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(string? message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.WriteIfInterpolatedStringHandler message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.WriteIfInterpolatedStringHandler message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, object? value) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, object? value, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, string? message, string? category) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute]
public partial struct AssertInterpolatedStringHandler
{
private object _dummy;
private int _dummyPrimitive;
public AssertInterpolatedStringHandler(int literalLength, int formattedCount, bool condition, out bool shouldAppend) { throw null; }
public void AppendFormatted(object? value, int alignment = 0, string? format = null) { }
public void AppendFormatted(System.ReadOnlySpan<char> value) { }
public void AppendFormatted(System.ReadOnlySpan<char> value, int alignment = 0, string? format = null) { }
public void AppendFormatted(string? value) { }
public void AppendFormatted(string? value, int alignment = 0, string? format = null) { }
public void AppendFormatted<T>(T value) { }
public void AppendFormatted<T>(T value, int alignment) { }
public void AppendFormatted<T>(T value, int alignment, string? format) { }
public void AppendFormatted<T>(T value, string? format) { }
public void AppendLiteral(string value) { }
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute]
public partial struct WriteIfInterpolatedStringHandler
{
private object _dummy;
private int _dummyPrimitive;
public WriteIfInterpolatedStringHandler(int literalLength, int formattedCount, bool condition, out bool shouldAppend) { throw null; }
public void AppendFormatted(object? value, int alignment = 0, string? format = null) { }
public void AppendFormatted(System.ReadOnlySpan<char> value) { }
public void AppendFormatted(System.ReadOnlySpan<char> value, int alignment = 0, string? format = null) { }
public void AppendFormatted(string? value) { }
public void AppendFormatted(string? value, int alignment = 0, string? format = null) { }
public void AppendFormatted<T>(T value) { }
public void AppendFormatted<T>(T value, int alignment) { }
public void AppendFormatted<T>(T value, int alignment, string? format) { }
public void AppendFormatted<T>(T value, string? format) { }
public void AppendLiteral(string value) { }
}
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Module, AllowMultiple=false)]
public sealed partial class DebuggableAttribute : System.Attribute
{
public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) { }
public DebuggableAttribute(System.Diagnostics.DebuggableAttribute.DebuggingModes modes) { }
public System.Diagnostics.DebuggableAttribute.DebuggingModes DebuggingFlags { get { throw null; } }
public bool IsJITOptimizerDisabled { get { throw null; } }
public bool IsJITTrackingEnabled { get { throw null; } }
[System.FlagsAttribute]
public enum DebuggingModes
{
None = 0,
Default = 1,
IgnoreSymbolStoreSequencePoints = 2,
EnableEditAndContinue = 4,
DisableOptimizations = 256,
}
}
public static partial class Debugger
{
public static readonly string? DefaultCategory;
public static bool IsAttached { get { throw null; } }
public static void Break() { }
public static bool IsLogging() { throw null; }
public static bool Launch() { throw null; }
public static void Log(int level, string? category, string? message) { }
public static void NotifyOfCrossThreadDependency() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false)]
public sealed partial class DebuggerBrowsableAttribute : System.Attribute
{
public DebuggerBrowsableAttribute(System.Diagnostics.DebuggerBrowsableState state) { }
public System.Diagnostics.DebuggerBrowsableState State { get { throw null; } }
}
public enum DebuggerBrowsableState
{
Never = 0,
Collapsed = 2,
RootHidden = 3,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=true)]
public sealed partial class DebuggerDisplayAttribute : System.Attribute
{
public DebuggerDisplayAttribute(string? value) { }
public string? Name { get { throw null; } set { } }
public System.Type? Target { get { throw null; } set { } }
public string? TargetTypeName { get { throw null; } set { } }
public string? Type { get { throw null; } set { } }
public string Value { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)]
public sealed partial class DebuggerHiddenAttribute : System.Attribute
{
public DebuggerHiddenAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class DebuggerNonUserCodeAttribute : System.Attribute
{
public DebuggerNonUserCodeAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class DebuggerStepperBoundaryAttribute : System.Attribute
{
public DebuggerStepperBoundaryAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class DebuggerStepThroughAttribute : System.Attribute
{
public DebuggerStepThroughAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=true)]
public sealed partial class DebuggerTypeProxyAttribute : System.Attribute
{
public DebuggerTypeProxyAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string typeName) { }
public DebuggerTypeProxyAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type) { }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public string ProxyTypeName { get { throw null; } }
public System.Type? Target { get { throw null; } set { } }
public string? TargetTypeName { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=true)]
public sealed partial class DebuggerVisualizerAttribute : System.Attribute
{
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string visualizerTypeName) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string visualizerTypeName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string? visualizerObjectSourceTypeName) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string visualizerTypeName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizerObjectSource) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizer) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizer, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string? visualizerObjectSourceTypeName) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizer, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizerObjectSource) { }
public string? Description { get { throw null; } set { } }
public System.Type? Target { get { throw null; } set { } }
public string? TargetTypeName { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public string? VisualizerObjectSourceTypeName { get { throw null; } }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public string VisualizerTypeName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class StackTraceHiddenAttribute : System.Attribute
{
public StackTraceHiddenAttribute() { }
}
public partial class Stopwatch
{
public static readonly long Frequency;
public static readonly bool IsHighResolution;
public Stopwatch() { }
public System.TimeSpan Elapsed { get { throw null; } }
public long ElapsedMilliseconds { get { throw null; } }
public long ElapsedTicks { get { throw null; } }
public bool IsRunning { get { throw null; } }
public static long GetTimestamp() { throw null; }
public static System.TimeSpan GetElapsedTime(long startingTimestamp) { throw null; }
public static System.TimeSpan GetElapsedTime(long startingTimestamp, long endingTimestamp) { throw null; }
public void Reset() { }
public void Restart() { }
public void Start() { }
public static System.Diagnostics.Stopwatch StartNew() { throw null; }
public void Stop() { }
}
public sealed partial class UnreachableException : System.Exception
{
public UnreachableException() { }
public UnreachableException(string? message) { }
public UnreachableException(string? message, System.Exception? innerException) { }
}
}
namespace System.Diagnostics.CodeAnalysis
{
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, Inherited=false)]
public sealed partial class AllowNullAttribute : System.Attribute
{
public AllowNullAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class ConstantExpectedAttribute : System.Attribute
{
public ConstantExpectedAttribute() { }
public object? Max { get { throw null; } set { } }
public object? Min { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, Inherited=false)]
public sealed partial class DisallowNullAttribute : System.Attribute
{
public DisallowNullAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class DoesNotReturnAttribute : System.Attribute
{
public DoesNotReturnAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class DoesNotReturnIfAttribute : System.Attribute
{
public DoesNotReturnIfAttribute(bool parameterValue) { }
public bool ParameterValue { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Field | System.AttributeTargets.GenericParameter | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class DynamicallyAccessedMembersAttribute : System.Attribute
{
public DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes) { }
public System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberTypes { get { throw null; } }
}
[System.FlagsAttribute]
public enum DynamicallyAccessedMemberTypes
{
All = -1,
None = 0,
PublicParameterlessConstructor = 1,
PublicConstructors = 3,
NonPublicConstructors = 4,
PublicMethods = 8,
NonPublicMethods = 16,
PublicFields = 32,
NonPublicFields = 64,
PublicNestedTypes = 128,
NonPublicNestedTypes = 256,
PublicProperties = 512,
NonPublicProperties = 1024,
PublicEvents = 2048,
NonPublicEvents = 4096,
Interfaces = 8192,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Field | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
public sealed partial class DynamicDependencyAttribute : System.Attribute
{
public DynamicDependencyAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName) { }
public DynamicDependencyAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes, System.Type type) { }
public DynamicDependencyAttribute(string memberSignature) { }
public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName) { }
public DynamicDependencyAttribute(string memberSignature, System.Type type) { }
public string? AssemblyName { get { throw null; } }
public string? Condition { get { throw null; } set { } }
public string? MemberSignature { get { throw null; } }
public System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberTypes { get { throw null; } }
public System.Type? Type { get { throw null; } }
public string? TypeName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
public sealed partial class ExcludeFromCodeCoverageAttribute : System.Attribute
{
public ExcludeFromCodeCoverageAttribute() { }
public string? Justification { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)]
public sealed partial class MaybeNullAttribute : System.Attribute
{
public MaybeNullAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class MaybeNullWhenAttribute : System.Attribute
{
public MaybeNullWhenAttribute(bool returnValue) { }
public bool ReturnValue { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false, AllowMultiple=true)]
public sealed partial class MemberNotNullAttribute : System.Attribute
{
public MemberNotNullAttribute(string member) { }
public MemberNotNullAttribute(params string[] members) { }
public string[] Members { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false, AllowMultiple=true)]
public sealed partial class MemberNotNullWhenAttribute : System.Attribute
{
public MemberNotNullWhenAttribute(bool returnValue, string member) { }
public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { }
public string[] Members { get { throw null; } }
public bool ReturnValue { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)]
public sealed partial class NotNullAttribute : System.Attribute
{
public NotNullAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, AllowMultiple=true, Inherited=false)]
public sealed partial class NotNullIfNotNullAttribute : System.Attribute
{
public NotNullIfNotNullAttribute(string parameterName) { }
public string ParameterName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class NotNullWhenAttribute : System.Attribute
{
public NotNullWhenAttribute(bool returnValue) { }
public bool ReturnValue { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false, AllowMultiple=false)]
public sealed partial class RequiresAssemblyFilesAttribute : System.Attribute
{
public RequiresAssemblyFilesAttribute() { }
public RequiresAssemblyFilesAttribute(string message) { }
public string? Message { get { throw null; } }
public string? Url { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class RequiresDynamicCodeAttribute : System.Attribute
{
public RequiresDynamicCodeAttribute(string message) { }
public string Message { get { throw null; } }
public string? Url { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class RequiresUnreferencedCodeAttribute : System.Attribute
{
public RequiresUnreferencedCodeAttribute(string message) { }
public string Message { get { throw null; } }
public string? Url { get { throw null; } set { } }
}
[System.AttributeUsage(System.AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
public sealed class SetsRequiredMembersAttribute : System.Attribute
{
public SetsRequiredMembersAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter | System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed partial class StringSyntaxAttribute : System.Attribute
{
public StringSyntaxAttribute(string syntax) { }
public StringSyntaxAttribute(string syntax, params object?[] arguments) { }
public string Syntax { get { throw null; } }
public object?[] Arguments { get { throw null; } }
public const string DateTimeFormat = "DateTimeFormat";
public const string Json = "Json";
public const string Regex = "Regex";
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=false, AllowMultiple=true)]
[System.Diagnostics.ConditionalAttribute("CODE_ANALYSIS")]
public sealed partial class SuppressMessageAttribute : System.Attribute
{
public SuppressMessageAttribute(string category, string checkId) { }
public string Category { get { throw null; } }
public string CheckId { get { throw null; } }
public string? Justification { get { throw null; } set { } }
public string? MessageId { get { throw null; } set { } }
public string? Scope { get { throw null; } set { } }
public string? Target { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=false, AllowMultiple=true)]
public sealed partial class UnconditionalSuppressMessageAttribute : System.Attribute
{
public UnconditionalSuppressMessageAttribute(string category, string checkId) { }
public string Category { get { throw null; } }
public string CheckId { get { throw null; } }
public string? Justification { get { throw null; } set { } }
public string? MessageId { get { throw null; } set { } }
public string? Scope { get { throw null; } set { } }
public string? Target { get { throw null; } set { } }
}
}
namespace System.Globalization
{
public abstract partial class Calendar : System.ICloneable
{
public const int CurrentEra = 0;
protected Calendar() { }
public virtual System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
protected virtual int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public abstract int[] Eras { get; }
public bool IsReadOnly { get { throw null; } }
public virtual System.DateTime MaxSupportedDateTime { get { throw null; } }
public virtual System.DateTime MinSupportedDateTime { get { throw null; } }
public virtual int TwoDigitYearMax { get { throw null; } set { } }
public virtual System.DateTime AddDays(System.DateTime time, int days) { throw null; }
public virtual System.DateTime AddHours(System.DateTime time, int hours) { throw null; }
public virtual System.DateTime AddMilliseconds(System.DateTime time, double milliseconds) { throw null; }
public virtual System.DateTime AddMinutes(System.DateTime time, int minutes) { throw null; }
public abstract System.DateTime AddMonths(System.DateTime time, int months);
public virtual System.DateTime AddSeconds(System.DateTime time, int seconds) { throw null; }
public virtual System.DateTime AddWeeks(System.DateTime time, int weeks) { throw null; }
public abstract System.DateTime AddYears(System.DateTime time, int years);
public virtual object Clone() { throw null; }
public abstract int GetDayOfMonth(System.DateTime time);
public abstract System.DayOfWeek GetDayOfWeek(System.DateTime time);
public abstract int GetDayOfYear(System.DateTime time);
public virtual int GetDaysInMonth(int year, int month) { throw null; }
public abstract int GetDaysInMonth(int year, int month, int era);
public virtual int GetDaysInYear(int year) { throw null; }
public abstract int GetDaysInYear(int year, int era);
public abstract int GetEra(System.DateTime time);
public virtual int GetHour(System.DateTime time) { throw null; }
public virtual int GetLeapMonth(int year) { throw null; }
public virtual int GetLeapMonth(int year, int era) { throw null; }
public virtual double GetMilliseconds(System.DateTime time) { throw null; }
public virtual int GetMinute(System.DateTime time) { throw null; }
public abstract int GetMonth(System.DateTime time);
public virtual int GetMonthsInYear(int year) { throw null; }
public abstract int GetMonthsInYear(int year, int era);
public virtual int GetSecond(System.DateTime time) { throw null; }
public virtual int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public abstract int GetYear(System.DateTime time);
public virtual bool IsLeapDay(int year, int month, int day) { throw null; }
public abstract bool IsLeapDay(int year, int month, int day, int era);
public virtual bool IsLeapMonth(int year, int month) { throw null; }
public abstract bool IsLeapMonth(int year, int month, int era);
public virtual bool IsLeapYear(int year) { throw null; }
public abstract bool IsLeapYear(int year, int era);
public static System.Globalization.Calendar ReadOnly(System.Globalization.Calendar calendar) { throw null; }
public virtual System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) { throw null; }
public abstract System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
public virtual int ToFourDigitYear(int year) { throw null; }
}
public enum CalendarAlgorithmType
{
Unknown = 0,
SolarCalendar = 1,
LunarCalendar = 2,
LunisolarCalendar = 3,
}
public enum CalendarWeekRule
{
FirstDay = 0,
FirstFullWeek = 1,
FirstFourDayWeek = 2,
}
public static partial class CharUnicodeInfo
{
public static int GetDecimalDigitValue(char ch) { throw null; }
public static int GetDecimalDigitValue(string s, int index) { throw null; }
public static int GetDigitValue(char ch) { throw null; }
public static int GetDigitValue(string s, int index) { throw null; }
public static double GetNumericValue(char ch) { throw null; }
public static double GetNumericValue(string s, int index) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(char ch) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(int codePoint) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(string s, int index) { throw null; }
}
public partial class ChineseLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
{
public const int ChineseEra = 1;
public ChineseLunisolarCalendar() { }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int GetEra(System.DateTime time) { throw null; }
}
public sealed partial class CompareInfo : System.Runtime.Serialization.IDeserializationCallback
{
internal CompareInfo() { }
public int LCID { get { throw null; } }
public string Name { get { throw null; } }
public System.Globalization.SortVersion Version { get { throw null; } }
public int Compare(System.ReadOnlySpan<char> string1, System.ReadOnlySpan<char> string2, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int Compare(string? string1, int offset1, int length1, string? string2, int offset2, int length2) { throw null; }
public int Compare(string? string1, int offset1, int length1, string? string2, int offset2, int length2, System.Globalization.CompareOptions options) { throw null; }
public int Compare(string? string1, int offset1, string? string2, int offset2) { throw null; }
public int Compare(string? string1, int offset1, string? string2, int offset2, System.Globalization.CompareOptions options) { throw null; }
public int Compare(string? string1, string? string2) { throw null; }
public int Compare(string? string1, string? string2, System.Globalization.CompareOptions options) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.Globalization.CompareInfo GetCompareInfo(int culture) { throw null; }
public static System.Globalization.CompareInfo GetCompareInfo(int culture, System.Reflection.Assembly assembly) { throw null; }
public static System.Globalization.CompareInfo GetCompareInfo(string name) { throw null; }
public static System.Globalization.CompareInfo GetCompareInfo(string name, System.Reflection.Assembly assembly) { throw null; }
public override int GetHashCode() { throw null; }
public int GetHashCode(System.ReadOnlySpan<char> source, System.Globalization.CompareOptions options) { throw null; }
public int GetHashCode(string source, System.Globalization.CompareOptions options) { throw null; }
public int GetSortKey(System.ReadOnlySpan<char> source, System.Span<byte> destination, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public System.Globalization.SortKey GetSortKey(string source) { throw null; }
public System.Globalization.SortKey GetSortKey(string source, System.Globalization.CompareOptions options) { throw null; }
public int GetSortKeyLength(System.ReadOnlySpan<char> source, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int IndexOf(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> value, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int IndexOf(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> value, System.Globalization.CompareOptions options, out int matchLength) { throw null; }
public int IndexOf(System.ReadOnlySpan<char> source, System.Text.Rune value, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int IndexOf(string source, char value) { throw null; }
public int IndexOf(string source, char value, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, char value, int startIndex) { throw null; }
public int IndexOf(string source, char value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, char value, int startIndex, int count) { throw null; }
public int IndexOf(string source, char value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, string value) { throw null; }
public int IndexOf(string source, string value, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, string value, int startIndex) { throw null; }
public int IndexOf(string source, string value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, string value, int startIndex, int count) { throw null; }
public int IndexOf(string source, string value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
public bool IsPrefix(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> prefix, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public bool IsPrefix(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> prefix, System.Globalization.CompareOptions options, out int matchLength) { throw null; }
public bool IsPrefix(string source, string prefix) { throw null; }
public bool IsPrefix(string source, string prefix, System.Globalization.CompareOptions options) { throw null; }
public static bool IsSortable(char ch) { throw null; }
public static bool IsSortable(System.ReadOnlySpan<char> text) { throw null; }
public static bool IsSortable(string text) { throw null; }
public static bool IsSortable(System.Text.Rune value) { throw null; }
public bool IsSuffix(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> suffix, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public bool IsSuffix(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> suffix, System.Globalization.CompareOptions options, out int matchLength) { throw null; }
public bool IsSuffix(string source, string suffix) { throw null; }
public bool IsSuffix(string source, string suffix, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> value, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int LastIndexOf(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> value, System.Globalization.CompareOptions options, out int matchLength) { throw null; }
public int LastIndexOf(System.ReadOnlySpan<char> source, System.Text.Rune value, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int LastIndexOf(string source, char value) { throw null; }
public int LastIndexOf(string source, char value, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, char value, int startIndex) { throw null; }
public int LastIndexOf(string source, char value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, char value, int startIndex, int count) { throw null; }
public int LastIndexOf(string source, char value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, string value) { throw null; }
public int LastIndexOf(string source, string value, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, string value, int startIndex) { throw null; }
public int LastIndexOf(string source, string value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, string value, int startIndex, int count) { throw null; }
public int LastIndexOf(string source, string value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum CompareOptions
{
None = 0,
IgnoreCase = 1,
IgnoreNonSpace = 2,
IgnoreSymbols = 4,
IgnoreKanaType = 8,
IgnoreWidth = 16,
OrdinalIgnoreCase = 268435456,
StringSort = 536870912,
Ordinal = 1073741824,
}
public partial class CultureInfo : System.ICloneable, System.IFormatProvider
{
public CultureInfo(int culture) { }
public CultureInfo(int culture, bool useUserOverride) { }
public CultureInfo(string name) { }
public CultureInfo(string name, bool useUserOverride) { }
public virtual System.Globalization.Calendar Calendar { get { throw null; } }
public virtual System.Globalization.CompareInfo CompareInfo { get { throw null; } }
public System.Globalization.CultureTypes CultureTypes { get { throw null; } }
public static System.Globalization.CultureInfo CurrentCulture { get { throw null; } set { } }
public static System.Globalization.CultureInfo CurrentUICulture { get { throw null; } set { } }
public virtual System.Globalization.DateTimeFormatInfo DateTimeFormat { get { throw null; } set { } }
public static System.Globalization.CultureInfo? DefaultThreadCurrentCulture { get { throw null; } set { } }
public static System.Globalization.CultureInfo? DefaultThreadCurrentUICulture { get { throw null; } set { } }
public virtual string DisplayName { get { throw null; } }
public virtual string EnglishName { get { throw null; } }
public string IetfLanguageTag { get { throw null; } }
public static System.Globalization.CultureInfo InstalledUICulture { get { throw null; } }
public static System.Globalization.CultureInfo InvariantCulture { get { throw null; } }
public virtual bool IsNeutralCulture { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public virtual int KeyboardLayoutId { get { throw null; } }
public virtual int LCID { get { throw null; } }
public virtual string Name { get { throw null; } }
public virtual string NativeName { get { throw null; } }
public virtual System.Globalization.NumberFormatInfo NumberFormat { get { throw null; } set { } }
public virtual System.Globalization.Calendar[] OptionalCalendars { get { throw null; } }
public virtual System.Globalization.CultureInfo Parent { get { throw null; } }
public virtual System.Globalization.TextInfo TextInfo { get { throw null; } }
public virtual string ThreeLetterISOLanguageName { get { throw null; } }
public virtual string ThreeLetterWindowsLanguageName { get { throw null; } }
public virtual string TwoLetterISOLanguageName { get { throw null; } }
public bool UseUserOverride { get { throw null; } }
public void ClearCachedData() { }
public virtual object Clone() { throw null; }
public static System.Globalization.CultureInfo CreateSpecificCulture(string name) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public System.Globalization.CultureInfo GetConsoleFallbackUICulture() { throw null; }
public static System.Globalization.CultureInfo GetCultureInfo(int culture) { throw null; }
public static System.Globalization.CultureInfo GetCultureInfo(string name) { throw null; }
public static System.Globalization.CultureInfo GetCultureInfo(string name, bool predefinedOnly) { throw null; }
public static System.Globalization.CultureInfo GetCultureInfo(string name, string altName) { throw null; }
public static System.Globalization.CultureInfo GetCultureInfoByIetfLanguageTag(string name) { throw null; }
public static System.Globalization.CultureInfo[] GetCultures(System.Globalization.CultureTypes types) { throw null; }
public virtual object? GetFormat(System.Type? formatType) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Globalization.CultureInfo ReadOnly(System.Globalization.CultureInfo ci) { throw null; }
public override string ToString() { throw null; }
}
public partial class CultureNotFoundException : System.ArgumentException
{
public CultureNotFoundException() { }
protected CultureNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public CultureNotFoundException(string? message) { }
public CultureNotFoundException(string? message, System.Exception? innerException) { }
public CultureNotFoundException(string? message, int invalidCultureId, System.Exception? innerException) { }
public CultureNotFoundException(string? paramName, int invalidCultureId, string? message) { }
public CultureNotFoundException(string? paramName, string? message) { }
public CultureNotFoundException(string? message, string? invalidCultureName, System.Exception? innerException) { }
public CultureNotFoundException(string? paramName, string? invalidCultureName, string? message) { }
public virtual int? InvalidCultureId { get { throw null; } }
public virtual string? InvalidCultureName { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
[System.FlagsAttribute]
public enum CultureTypes
{
NeutralCultures = 1,
SpecificCultures = 2,
InstalledWin32Cultures = 4,
AllCultures = 7,
UserCustomCulture = 8,
ReplacementCultures = 16,
[System.ObsoleteAttribute("CultureTypes.WindowsOnlyCultures has been deprecated. Use other values in CultureTypes instead.")]
WindowsOnlyCultures = 32,
[System.ObsoleteAttribute("CultureTypes.FrameworkCultures has been deprecated. Use other values in CultureTypes instead.")]
FrameworkCultures = 64,
}
public sealed partial class DateTimeFormatInfo : System.ICloneable, System.IFormatProvider
{
public DateTimeFormatInfo() { }
public string[] AbbreviatedDayNames { get { throw null; } set { } }
public string[] AbbreviatedMonthGenitiveNames { get { throw null; } set { } }
public string[] AbbreviatedMonthNames { get { throw null; } set { } }
public string AMDesignator { get { throw null; } set { } }
public System.Globalization.Calendar Calendar { get { throw null; } set { } }
public System.Globalization.CalendarWeekRule CalendarWeekRule { get { throw null; } set { } }
public static System.Globalization.DateTimeFormatInfo CurrentInfo { get { throw null; } }
public string DateSeparator { get { throw null; } set { } }
public string[] DayNames { get { throw null; } set { } }
public System.DayOfWeek FirstDayOfWeek { get { throw null; } set { } }
public string FullDateTimePattern { get { throw null; } set { } }
public static System.Globalization.DateTimeFormatInfo InvariantInfo { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public string LongDatePattern { get { throw null; } set { } }
public string LongTimePattern { get { throw null; } set { } }
public string MonthDayPattern { get { throw null; } set { } }
public string[] MonthGenitiveNames { get { throw null; } set { } }
public string[] MonthNames { get { throw null; } set { } }
public string NativeCalendarName { get { throw null; } }
public string PMDesignator { get { throw null; } set { } }
public string RFC1123Pattern { get { throw null; } }
public string ShortDatePattern { get { throw null; } set { } }
public string[] ShortestDayNames { get { throw null; } set { } }
public string ShortTimePattern { get { throw null; } set { } }
public string SortableDateTimePattern { get { throw null; } }
public string TimeSeparator { get { throw null; } set { } }
public string UniversalSortableDateTimePattern { get { throw null; } }
public string YearMonthPattern { get { throw null; } set { } }
public object Clone() { throw null; }
public string GetAbbreviatedDayName(System.DayOfWeek dayofweek) { throw null; }
public string GetAbbreviatedEraName(int era) { throw null; }
public string GetAbbreviatedMonthName(int month) { throw null; }
public string[] GetAllDateTimePatterns() { throw null; }
public string[] GetAllDateTimePatterns(char format) { throw null; }
public string GetDayName(System.DayOfWeek dayofweek) { throw null; }
public int GetEra(string eraName) { throw null; }
public string GetEraName(int era) { throw null; }
public object? GetFormat(System.Type? formatType) { throw null; }
public static System.Globalization.DateTimeFormatInfo GetInstance(System.IFormatProvider? provider) { throw null; }
public string GetMonthName(int month) { throw null; }
public string GetShortestDayName(System.DayOfWeek dayOfWeek) { throw null; }
public static System.Globalization.DateTimeFormatInfo ReadOnly(System.Globalization.DateTimeFormatInfo dtfi) { throw null; }
public void SetAllDateTimePatterns(string[] patterns, char format) { }
}
[System.FlagsAttribute]
public enum DateTimeStyles
{
None = 0,
AllowLeadingWhite = 1,
AllowTrailingWhite = 2,
AllowInnerWhite = 4,
AllowWhiteSpaces = 7,
NoCurrentDateDefault = 8,
AdjustToUniversal = 16,
AssumeLocal = 32,
AssumeUniversal = 64,
RoundtripKind = 128,
}
public partial class DaylightTime
{
public DaylightTime(System.DateTime start, System.DateTime end, System.TimeSpan delta) { }
public System.TimeSpan Delta { get { throw null; } }
public System.DateTime End { get { throw null; } }
public System.DateTime Start { get { throw null; } }
}
public enum DigitShapes
{
Context = 0,
None = 1,
NativeNational = 2,
}
public abstract partial class EastAsianLunisolarCalendar : System.Globalization.Calendar
{
internal EastAsianLunisolarCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public int GetCelestialStem(int sexagenaryYear) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public virtual int GetSexagenaryYear(System.DateTime time) { throw null; }
public int GetTerrestrialBranch(int sexagenaryYear) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public static partial class GlobalizationExtensions
{
public static System.StringComparer GetStringComparer(this System.Globalization.CompareInfo compareInfo, System.Globalization.CompareOptions options) { throw null; }
}
public partial class GregorianCalendar : System.Globalization.Calendar
{
public const int ADEra = 1;
public GregorianCalendar() { }
public GregorianCalendar(System.Globalization.GregorianCalendarTypes type) { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public virtual System.Globalization.GregorianCalendarTypes CalendarType { get { throw null; } set { } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public enum GregorianCalendarTypes
{
Localized = 1,
USEnglish = 2,
MiddleEastFrench = 9,
Arabic = 10,
TransliteratedEnglish = 11,
TransliteratedFrench = 12,
}
public partial class HebrewCalendar : System.Globalization.Calendar
{
public static readonly int HebrewEra;
public HebrewCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class HijriCalendar : System.Globalization.Calendar
{
public static readonly int HijriEra;
public HijriCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public int HijriAdjustment { get { throw null; } set { } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public sealed partial class IdnMapping
{
public IdnMapping() { }
public bool AllowUnassigned { get { throw null; } set { } }
public bool UseStd3AsciiRules { get { throw null; } set { } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public string GetAscii(string unicode) { throw null; }
public string GetAscii(string unicode, int index) { throw null; }
public string GetAscii(string unicode, int index, int count) { throw null; }
public override int GetHashCode() { throw null; }
public string GetUnicode(string ascii) { throw null; }
public string GetUnicode(string ascii, int index) { throw null; }
public string GetUnicode(string ascii, int index, int count) { throw null; }
}
public static partial class ISOWeek
{
public static int GetWeekOfYear(System.DateTime date) { throw null; }
public static int GetWeeksInYear(int year) { throw null; }
public static int GetYear(System.DateTime date) { throw null; }
public static System.DateTime GetYearEnd(int year) { throw null; }
public static System.DateTime GetYearStart(int year) { throw null; }
public static System.DateTime ToDateTime(int year, int week, System.DayOfWeek dayOfWeek) { throw null; }
}
public partial class JapaneseCalendar : System.Globalization.Calendar
{
public JapaneseCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class JapaneseLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
{
public const int JapaneseEra = 1;
public JapaneseLunisolarCalendar() { }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int GetEra(System.DateTime time) { throw null; }
}
public partial class JulianCalendar : System.Globalization.Calendar
{
public static readonly int JulianEra;
public JulianCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class KoreanCalendar : System.Globalization.Calendar
{
public const int KoreanEra = 1;
public KoreanCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class KoreanLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
{
public const int GregorianEra = 1;
public KoreanLunisolarCalendar() { }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int GetEra(System.DateTime time) { throw null; }
}
public sealed partial class NumberFormatInfo : System.ICloneable, System.IFormatProvider
{
public NumberFormatInfo() { }
public int CurrencyDecimalDigits { get { throw null; } set { } }
public string CurrencyDecimalSeparator { get { throw null; } set { } }
public string CurrencyGroupSeparator { get { throw null; } set { } }
public int[] CurrencyGroupSizes { get { throw null; } set { } }
public int CurrencyNegativePattern { get { throw null; } set { } }
public int CurrencyPositivePattern { get { throw null; } set { } }
public string CurrencySymbol { get { throw null; } set { } }
public static System.Globalization.NumberFormatInfo CurrentInfo { get { throw null; } }
public System.Globalization.DigitShapes DigitSubstitution { get { throw null; } set { } }
public static System.Globalization.NumberFormatInfo InvariantInfo { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public string NaNSymbol { get { throw null; } set { } }
public string[] NativeDigits { get { throw null; } set { } }
public string NegativeInfinitySymbol { get { throw null; } set { } }
public string NegativeSign { get { throw null; } set { } }
public int NumberDecimalDigits { get { throw null; } set { } }
public string NumberDecimalSeparator { get { throw null; } set { } }
public string NumberGroupSeparator { get { throw null; } set { } }
public int[] NumberGroupSizes { get { throw null; } set { } }
public int NumberNegativePattern { get { throw null; } set { } }
public int PercentDecimalDigits { get { throw null; } set { } }
public string PercentDecimalSeparator { get { throw null; } set { } }
public string PercentGroupSeparator { get { throw null; } set { } }
public int[] PercentGroupSizes { get { throw null; } set { } }
public int PercentNegativePattern { get { throw null; } set { } }
public int PercentPositivePattern { get { throw null; } set { } }
public string PercentSymbol { get { throw null; } set { } }
public string PerMilleSymbol { get { throw null; } set { } }
public string PositiveInfinitySymbol { get { throw null; } set { } }
public string PositiveSign { get { throw null; } set { } }
public object Clone() { throw null; }
public object? GetFormat(System.Type? formatType) { throw null; }
public static System.Globalization.NumberFormatInfo GetInstance(System.IFormatProvider? formatProvider) { throw null; }
public static System.Globalization.NumberFormatInfo ReadOnly(System.Globalization.NumberFormatInfo nfi) { throw null; }
}
[System.FlagsAttribute]
public enum NumberStyles
{
None = 0,
AllowLeadingWhite = 1,
AllowTrailingWhite = 2,
AllowLeadingSign = 4,
Integer = 7,
AllowTrailingSign = 8,
AllowParentheses = 16,
AllowDecimalPoint = 32,
AllowThousands = 64,
Number = 111,
AllowExponent = 128,
Float = 167,
AllowCurrencySymbol = 256,
Currency = 383,
Any = 511,
AllowHexSpecifier = 512,
HexNumber = 515,
}
public partial class PersianCalendar : System.Globalization.Calendar
{
public static readonly int PersianEra;
public PersianCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class RegionInfo
{
public RegionInfo(int culture) { }
public RegionInfo(string name) { }
public virtual string CurrencyEnglishName { get { throw null; } }
public virtual string CurrencyNativeName { get { throw null; } }
public virtual string CurrencySymbol { get { throw null; } }
public static System.Globalization.RegionInfo CurrentRegion { get { throw null; } }
public virtual string DisplayName { get { throw null; } }
public virtual string EnglishName { get { throw null; } }
public virtual int GeoId { get { throw null; } }
public virtual bool IsMetric { get { throw null; } }
public virtual string ISOCurrencySymbol { get { throw null; } }
public virtual string Name { get { throw null; } }
public virtual string NativeName { get { throw null; } }
public virtual string ThreeLetterISORegionName { get { throw null; } }
public virtual string ThreeLetterWindowsRegionName { get { throw null; } }
public virtual string TwoLetterISORegionName { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public sealed partial class SortKey
{
internal SortKey() { }
public byte[] KeyData { get { throw null; } }
public string OriginalString { get { throw null; } }
public static int Compare(System.Globalization.SortKey sortkey1, System.Globalization.SortKey sortkey2) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public sealed partial class SortVersion : System.IEquatable<System.Globalization.SortVersion?>
{
public SortVersion(int fullVersion, System.Guid sortId) { }
public int FullVersion { get { throw null; } }
public System.Guid SortId { get { throw null; } }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Globalization.SortVersion? other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Globalization.SortVersion? left, System.Globalization.SortVersion? right) { throw null; }
public static bool operator !=(System.Globalization.SortVersion? left, System.Globalization.SortVersion? right) { throw null; }
}
public partial class StringInfo
{
public StringInfo() { }
public StringInfo(string value) { }
public int LengthInTextElements { get { throw null; } }
public string String { get { throw null; } set { } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static string GetNextTextElement(string str) { throw null; }
public static string GetNextTextElement(string str, int index) { throw null; }
public static int GetNextTextElementLength(System.ReadOnlySpan<char> str) { throw null; }
public static int GetNextTextElementLength(string str) { throw null; }
public static int GetNextTextElementLength(string str, int index) { throw null; }
public static System.Globalization.TextElementEnumerator GetTextElementEnumerator(string str) { throw null; }
public static System.Globalization.TextElementEnumerator GetTextElementEnumerator(string str, int index) { throw null; }
public static int[] ParseCombiningCharacters(string str) { throw null; }
public string SubstringByTextElements(int startingTextElement) { throw null; }
public string SubstringByTextElements(int startingTextElement, int lengthInTextElements) { throw null; }
}
public partial class TaiwanCalendar : System.Globalization.Calendar
{
public TaiwanCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class TaiwanLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
{
public TaiwanLunisolarCalendar() { }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int GetEra(System.DateTime time) { throw null; }
}
public partial class TextElementEnumerator : System.Collections.IEnumerator
{
internal TextElementEnumerator() { }
public object Current { get { throw null; } }
public int ElementIndex { get { throw null; } }
public string GetTextElement() { throw null; }
public bool MoveNext() { throw null; }
public void Reset() { }
}
public sealed partial class TextInfo : System.ICloneable, System.Runtime.Serialization.IDeserializationCallback
{
internal TextInfo() { }
public int ANSICodePage { get { throw null; } }
public string CultureName { get { throw null; } }
public int EBCDICCodePage { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public bool IsRightToLeft { get { throw null; } }
public int LCID { get { throw null; } }
public string ListSeparator { get { throw null; } set { } }
public int MacCodePage { get { throw null; } }
public int OEMCodePage { get { throw null; } }
public object Clone() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Globalization.TextInfo ReadOnly(System.Globalization.TextInfo textInfo) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
public char ToLower(char c) { throw null; }
public string ToLower(string str) { throw null; }
public override string ToString() { throw null; }
public string ToTitleCase(string str) { throw null; }
public char ToUpper(char c) { throw null; }
public string ToUpper(string str) { throw null; }
}
public partial class ThaiBuddhistCalendar : System.Globalization.Calendar
{
public const int ThaiBuddhistEra = 1;
public ThaiBuddhistCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
[System.FlagsAttribute]
public enum TimeSpanStyles
{
None = 0,
AssumeNegative = 1,
}
public partial class UmAlQuraCalendar : System.Globalization.Calendar
{
public const int UmAlQuraEra = 1;
public UmAlQuraCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public enum UnicodeCategory
{
UppercaseLetter = 0,
LowercaseLetter = 1,
TitlecaseLetter = 2,
ModifierLetter = 3,
OtherLetter = 4,
NonSpacingMark = 5,
SpacingCombiningMark = 6,
EnclosingMark = 7,
DecimalDigitNumber = 8,
LetterNumber = 9,
OtherNumber = 10,
SpaceSeparator = 11,
LineSeparator = 12,
ParagraphSeparator = 13,
Control = 14,
Format = 15,
Surrogate = 16,
PrivateUse = 17,
ConnectorPunctuation = 18,
DashPunctuation = 19,
OpenPunctuation = 20,
ClosePunctuation = 21,
InitialQuotePunctuation = 22,
FinalQuotePunctuation = 23,
OtherPunctuation = 24,
MathSymbol = 25,
CurrencySymbol = 26,
ModifierSymbol = 27,
OtherSymbol = 28,
OtherNotAssigned = 29,
}
}
namespace System.IO
{
public partial class BinaryReader : System.IDisposable
{
public BinaryReader(System.IO.Stream input) { }
public BinaryReader(System.IO.Stream input, System.Text.Encoding encoding) { }
public BinaryReader(System.IO.Stream input, System.Text.Encoding encoding, bool leaveOpen) { }
public virtual System.IO.Stream BaseStream { get { throw null; } }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
protected virtual void FillBuffer(int numBytes) { }
public virtual int PeekChar() { throw null; }
public virtual int Read() { throw null; }
public virtual int Read(byte[] buffer, int index, int count) { throw null; }
public virtual int Read(char[] buffer, int index, int count) { throw null; }
public virtual int Read(System.Span<byte> buffer) { throw null; }
public virtual int Read(System.Span<char> buffer) { throw null; }
public int Read7BitEncodedInt() { throw null; }
public long Read7BitEncodedInt64() { throw null; }
public virtual bool ReadBoolean() { throw null; }
public virtual byte ReadByte() { throw null; }
public virtual byte[] ReadBytes(int count) { throw null; }
public virtual char ReadChar() { throw null; }
public virtual char[] ReadChars(int count) { throw null; }
public virtual decimal ReadDecimal() { throw null; }
public virtual double ReadDouble() { throw null; }
public virtual System.Half ReadHalf() { throw null; }
public virtual short ReadInt16() { throw null; }
public virtual int ReadInt32() { throw null; }
public virtual long ReadInt64() { throw null; }
[System.CLSCompliantAttribute(false)]
public virtual sbyte ReadSByte() { throw null; }
public virtual float ReadSingle() { throw null; }
public virtual string ReadString() { throw null; }
[System.CLSCompliantAttribute(false)]
public virtual ushort ReadUInt16() { throw null; }
[System.CLSCompliantAttribute(false)]
public virtual uint ReadUInt32() { throw null; }
[System.CLSCompliantAttribute(false)]
public virtual ulong ReadUInt64() { throw null; }
}
public partial class BinaryWriter : System.IAsyncDisposable, System.IDisposable
{
public static readonly System.IO.BinaryWriter Null;
protected System.IO.Stream OutStream;
protected BinaryWriter() { }
public BinaryWriter(System.IO.Stream output) { }
public BinaryWriter(System.IO.Stream output, System.Text.Encoding encoding) { }
public BinaryWriter(System.IO.Stream output, System.Text.Encoding encoding, bool leaveOpen) { }
public virtual System.IO.Stream BaseStream { get { throw null; } }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public virtual void Flush() { }
public virtual long Seek(int offset, System.IO.SeekOrigin origin) { throw null; }
public virtual void Write(bool value) { }
public virtual void Write(byte value) { }
public virtual void Write(byte[] buffer) { }
public virtual void Write(byte[] buffer, int index, int count) { }
public virtual void Write(char ch) { }
public virtual void Write(char[] chars) { }
public virtual void Write(char[] chars, int index, int count) { }
public virtual void Write(decimal value) { }
public virtual void Write(double value) { }
public virtual void Write(System.Half value) { }
public virtual void Write(short value) { }
public virtual void Write(int value) { }
public virtual void Write(long value) { }
public virtual void Write(System.ReadOnlySpan<byte> buffer) { }
public virtual void Write(System.ReadOnlySpan<char> chars) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(sbyte value) { }
public virtual void Write(float value) { }
public virtual void Write(string value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(ushort value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(uint value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(ulong value) { }
public void Write7BitEncodedInt(int value) { }
public void Write7BitEncodedInt64(long value) { }
}
public sealed partial class BufferedStream : System.IO.Stream
{
public BufferedStream(System.IO.Stream stream) { }
public BufferedStream(System.IO.Stream stream, int bufferSize) { }
public int BufferSize { get { throw null; } }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
public override long Length { get { throw null; } }
public override long Position { get { throw null; } set { } }
public System.IO.Stream UnderlyingStream { get { throw null; } }
public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override void CopyTo(System.IO.Stream destination, int bufferSize) { }
public override System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override int EndRead(System.IAsyncResult asyncResult) { throw null; }
public override void EndWrite(System.IAsyncResult asyncResult) { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> destination) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteByte(byte value) { }
}
public static partial class Directory
{
public static System.IO.DirectoryInfo CreateDirectory(string path) { throw null; }
public static System.IO.FileSystemInfo CreateSymbolicLink(string path, string pathToTarget) { throw null; }
public static void Delete(string path) { }
public static void Delete(string path, bool recursive) { }
public static System.Collections.Generic.IEnumerable<string> EnumerateDirectories(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateDirectories(string path, string searchPattern) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateDirectories(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateDirectories(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFiles(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFiles(string path, string searchPattern) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFiles(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFiles(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFileSystemEntries(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; }
public static System.DateTime GetCreationTime(string path) { throw null; }
public static System.DateTime GetCreationTimeUtc(string path) { throw null; }
public static string GetCurrentDirectory() { throw null; }
public static string[] GetDirectories(string path) { throw null; }
public static string[] GetDirectories(string path, string searchPattern) { throw null; }
public static string[] GetDirectories(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static string[] GetDirectories(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static string GetDirectoryRoot(string path) { throw null; }
public static string[] GetFiles(string path) { throw null; }
public static string[] GetFiles(string path, string searchPattern) { throw null; }
public static string[] GetFiles(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static string[] GetFiles(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static string[] GetFileSystemEntries(string path) { throw null; }
public static string[] GetFileSystemEntries(string path, string searchPattern) { throw null; }
public static string[] GetFileSystemEntries(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static string[] GetFileSystemEntries(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static System.DateTime GetLastAccessTime(string path) { throw null; }
public static System.DateTime GetLastAccessTimeUtc(string path) { throw null; }
public static System.DateTime GetLastWriteTime(string path) { throw null; }
public static System.DateTime GetLastWriteTimeUtc(string path) { throw null; }
public static string[] GetLogicalDrives() { throw null; }
public static System.IO.DirectoryInfo? GetParent(string path) { throw null; }
public static void Move(string sourceDirName, string destDirName) { }
public static System.IO.FileSystemInfo? ResolveLinkTarget(string linkPath, bool returnFinalTarget) { throw null; }
public static void SetCreationTime(string path, System.DateTime creationTime) { }
public static void SetCreationTimeUtc(string path, System.DateTime creationTimeUtc) { }
public static void SetCurrentDirectory(string path) { }
public static void SetLastAccessTime(string path, System.DateTime lastAccessTime) { }
public static void SetLastAccessTimeUtc(string path, System.DateTime lastAccessTimeUtc) { }
public static void SetLastWriteTime(string path, System.DateTime lastWriteTime) { }
public static void SetLastWriteTimeUtc(string path, System.DateTime lastWriteTimeUtc) { }
}
public sealed partial class DirectoryInfo : System.IO.FileSystemInfo
{
public DirectoryInfo(string path) { }
public override bool Exists { get { throw null; } }
public override string Name { get { throw null; } }
public System.IO.DirectoryInfo? Parent { get { throw null; } }
public System.IO.DirectoryInfo Root { get { throw null; } }
public void Create() { }
public System.IO.DirectoryInfo CreateSubdirectory(string path) { throw null; }
public override void Delete() { }
public void Delete(bool recursive) { }
public System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> EnumerateDirectories() { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> EnumerateDirectories(string searchPattern) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> EnumerateDirectories(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> EnumerateDirectories(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileInfo> EnumerateFiles() { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileInfo> EnumerateFiles(string searchPattern) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileInfo> EnumerateFiles(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileInfo> EnumerateFiles(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos() { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos(string searchPattern) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.IO.DirectoryInfo[] GetDirectories() { throw null; }
public System.IO.DirectoryInfo[] GetDirectories(string searchPattern) { throw null; }
public System.IO.DirectoryInfo[] GetDirectories(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.IO.DirectoryInfo[] GetDirectories(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.IO.FileInfo[] GetFiles() { throw null; }
public System.IO.FileInfo[] GetFiles(string searchPattern) { throw null; }
public System.IO.FileInfo[] GetFiles(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.IO.FileInfo[] GetFiles(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.IO.FileSystemInfo[] GetFileSystemInfos() { throw null; }
public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern) { throw null; }
public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public void MoveTo(string destDirName) { }
public override string ToString() { throw null; }
}
public partial class DirectoryNotFoundException : System.IO.IOException
{
public DirectoryNotFoundException() { }
protected DirectoryNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public DirectoryNotFoundException(string? message) { }
public DirectoryNotFoundException(string? message, System.Exception? innerException) { }
}
public partial class EndOfStreamException : System.IO.IOException
{
public EndOfStreamException() { }
protected EndOfStreamException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public EndOfStreamException(string? message) { }
public EndOfStreamException(string? message, System.Exception? innerException) { }
}
public partial class EnumerationOptions
{
public EnumerationOptions() { }
public System.IO.FileAttributes AttributesToSkip { get { throw null; } set { } }
public int BufferSize { get { throw null; } set { } }
public bool IgnoreInaccessible { get { throw null; } set { } }
public System.IO.MatchCasing MatchCasing { get { throw null; } set { } }
public System.IO.MatchType MatchType { get { throw null; } set { } }
public int MaxRecursionDepth { get { throw null; } set { } }
public bool RecurseSubdirectories { get { throw null; } set { } }
public bool ReturnSpecialDirectories { get { throw null; } set { } }
}
public static partial class File
{
public static void AppendAllLines(string path, System.Collections.Generic.IEnumerable<string> contents) { }
public static void AppendAllLines(string path, System.Collections.Generic.IEnumerable<string> contents, System.Text.Encoding encoding) { }
public static System.Threading.Tasks.Task AppendAllLinesAsync(string path, System.Collections.Generic.IEnumerable<string> contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task AppendAllLinesAsync(string path, System.Collections.Generic.IEnumerable<string> contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void AppendAllText(string path, string? contents) { }
public static void AppendAllText(string path, string? contents, System.Text.Encoding encoding) { }
public static System.Threading.Tasks.Task AppendAllTextAsync(string path, string? contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task AppendAllTextAsync(string path, string? contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.IO.StreamWriter AppendText(string path) { throw null; }
public static void Copy(string sourceFileName, string destFileName) { }
public static void Copy(string sourceFileName, string destFileName, bool overwrite) { }
public static System.IO.FileStream Create(string path) { throw null; }
public static System.IO.FileStream Create(string path, int bufferSize) { throw null; }
public static System.IO.FileStream Create(string path, int bufferSize, System.IO.FileOptions options) { throw null; }
public static System.IO.FileSystemInfo CreateSymbolicLink(string path, string pathToTarget) { throw null; }
public static System.IO.StreamWriter CreateText(string path) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static void Decrypt(string path) { }
public static void Delete(string path) { }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static void Encrypt(string path) { }
public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; }
public static System.IO.FileAttributes GetAttributes(string path) { throw null; }
public static System.DateTime GetCreationTime(string path) { throw null; }
public static System.DateTime GetCreationTimeUtc(string path) { throw null; }
public static System.DateTime GetLastAccessTime(string path) { throw null; }
public static System.DateTime GetLastAccessTimeUtc(string path) { throw null; }
public static System.DateTime GetLastWriteTime(string path) { throw null; }
public static System.DateTime GetLastWriteTimeUtc(string path) { throw null; }
public static void Move(string sourceFileName, string destFileName) { }
public static void Move(string sourceFileName, string destFileName, bool overwrite) { }
public static System.IO.FileStream Open(string path, System.IO.FileMode mode) { throw null; }
public static System.IO.FileStream Open(string path, System.IO.FileMode mode, System.IO.FileAccess access) { throw null; }
public static System.IO.FileStream Open(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { throw null; }
public static System.IO.FileStream Open(string path, System.IO.FileStreamOptions options) { throw null; }
public static Microsoft.Win32.SafeHandles.SafeFileHandle OpenHandle(string path, System.IO.FileMode mode = System.IO.FileMode.Open, System.IO.FileAccess access = System.IO.FileAccess.Read, System.IO.FileShare share = System.IO.FileShare.Read, System.IO.FileOptions options = System.IO.FileOptions.None, long preallocationSize = (long)0) { throw null; }
public static System.IO.FileStream OpenRead(string path) { throw null; }
public static System.IO.StreamReader OpenText(string path) { throw null; }
public static System.IO.FileStream OpenWrite(string path) { throw null; }
public static byte[] ReadAllBytes(string path) { throw null; }
public static System.Threading.Tasks.Task<byte[]> ReadAllBytesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static string[] ReadAllLines(string path) { throw null; }
public static string[] ReadAllLines(string path, System.Text.Encoding encoding) { throw null; }
public static System.Threading.Tasks.Task<string[]> ReadAllLinesAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<string[]> ReadAllLinesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static string ReadAllText(string path) { throw null; }
public static string ReadAllText(string path, System.Text.Encoding encoding) { throw null; }
public static System.Threading.Tasks.Task<string> ReadAllTextAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<string> ReadAllTextAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Collections.Generic.IEnumerable<string> ReadLines(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> ReadLines(string path, System.Text.Encoding encoding) { throw null; }
public static void Replace(string sourceFileName, string destinationFileName, string? destinationBackupFileName) { }
public static void Replace(string sourceFileName, string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors) { }
public static System.IO.FileSystemInfo? ResolveLinkTarget(string linkPath, bool returnFinalTarget) { throw null; }
public static void SetAttributes(string path, System.IO.FileAttributes fileAttributes) { }
public static void SetCreationTime(string path, System.DateTime creationTime) { }
public static void SetCreationTimeUtc(string path, System.DateTime creationTimeUtc) { }
public static void SetLastAccessTime(string path, System.DateTime lastAccessTime) { }
public static void SetLastAccessTimeUtc(string path, System.DateTime lastAccessTimeUtc) { }
public static void SetLastWriteTime(string path, System.DateTime lastWriteTime) { }
public static void SetLastWriteTimeUtc(string path, System.DateTime lastWriteTimeUtc) { }
public static void WriteAllBytes(string path, byte[] bytes) { }
public static System.Threading.Tasks.Task WriteAllBytesAsync(string path, byte[] bytes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void WriteAllLines(string path, System.Collections.Generic.IEnumerable<string> contents) { }
public static void WriteAllLines(string path, System.Collections.Generic.IEnumerable<string> contents, System.Text.Encoding encoding) { }
public static void WriteAllLines(string path, string[] contents) { }
public static void WriteAllLines(string path, string[] contents, System.Text.Encoding encoding) { }
public static System.Threading.Tasks.Task WriteAllLinesAsync(string path, System.Collections.Generic.IEnumerable<string> contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task WriteAllLinesAsync(string path, System.Collections.Generic.IEnumerable<string> contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void WriteAllText(string path, string? contents) { }
public static void WriteAllText(string path, string? contents, System.Text.Encoding encoding) { }
public static System.Threading.Tasks.Task WriteAllTextAsync(string path, string? contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task WriteAllTextAsync(string path, string? contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
[System.FlagsAttribute]
public enum FileAccess
{
Read = 1,
Write = 2,
ReadWrite = 3,
}
[System.FlagsAttribute]
public enum FileAttributes
{
ReadOnly = 1,
Hidden = 2,
System = 4,
Directory = 16,
Archive = 32,
Device = 64,
Normal = 128,
Temporary = 256,
SparseFile = 512,
ReparsePoint = 1024,
Compressed = 2048,
Offline = 4096,
NotContentIndexed = 8192,
Encrypted = 16384,
IntegrityStream = 32768,
NoScrubData = 131072,
}
public sealed partial class FileInfo : System.IO.FileSystemInfo
{
public FileInfo(string fileName) { }
public System.IO.DirectoryInfo? Directory { get { throw null; } }
public string? DirectoryName { get { throw null; } }
public override bool Exists { get { throw null; } }
public bool IsReadOnly { get { throw null; } set { } }
public long Length { get { throw null; } }
public override string Name { get { throw null; } }
public System.IO.StreamWriter AppendText() { throw null; }
public System.IO.FileInfo CopyTo(string destFileName) { throw null; }
public System.IO.FileInfo CopyTo(string destFileName, bool overwrite) { throw null; }
public System.IO.FileStream Create() { throw null; }
public System.IO.StreamWriter CreateText() { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public void Decrypt() { }
public override void Delete() { }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public void Encrypt() { }
public void MoveTo(string destFileName) { }
public void MoveTo(string destFileName, bool overwrite) { }
public System.IO.FileStream Open(System.IO.FileMode mode) { throw null; }
public System.IO.FileStream Open(System.IO.FileMode mode, System.IO.FileAccess access) { throw null; }
public System.IO.FileStream Open(System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { throw null; }
public System.IO.FileStream Open(System.IO.FileStreamOptions options) { throw null; }
public System.IO.FileStream OpenRead() { throw null; }
public System.IO.StreamReader OpenText() { throw null; }
public System.IO.FileStream OpenWrite() { throw null; }
public System.IO.FileInfo Replace(string destinationFileName, string? destinationBackupFileName) { throw null; }
public System.IO.FileInfo Replace(string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors) { throw null; }
}
public partial class FileLoadException : System.IO.IOException
{
public FileLoadException() { }
protected FileLoadException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public FileLoadException(string? message) { }
public FileLoadException(string? message, System.Exception? inner) { }
public FileLoadException(string? message, string? fileName) { }
public FileLoadException(string? message, string? fileName, System.Exception? inner) { }
public string? FileName { get { throw null; } }
public string? FusionLog { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
public enum FileMode
{
CreateNew = 1,
Create = 2,
Open = 3,
OpenOrCreate = 4,
Truncate = 5,
Append = 6,
}
public partial class FileNotFoundException : System.IO.IOException
{
public FileNotFoundException() { }
protected FileNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public FileNotFoundException(string? message) { }
public FileNotFoundException(string? message, System.Exception? innerException) { }
public FileNotFoundException(string? message, string? fileName) { }
public FileNotFoundException(string? message, string? fileName, System.Exception? innerException) { }
public string? FileName { get { throw null; } }
public string? FusionLog { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum FileOptions
{
WriteThrough = -2147483648,
None = 0,
Encrypted = 16384,
DeleteOnClose = 67108864,
SequentialScan = 134217728,
RandomAccess = 268435456,
Asynchronous = 1073741824,
}
[System.FlagsAttribute]
public enum FileShare
{
None = 0,
Read = 1,
Write = 2,
ReadWrite = 3,
Delete = 4,
Inheritable = 16,
}
public partial class FileStream : System.IO.Stream
{
public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access) { }
public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize) { }
public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize, bool isAsync) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use FileStream(SafeFileHandle handle, FileAccess access) instead.")]
public FileStream(System.IntPtr handle, System.IO.FileAccess access) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use FileStream(SafeFileHandle handle, FileAccess access) and optionally make a new SafeFileHandle with ownsHandle=false if needed instead.")]
public FileStream(System.IntPtr handle, System.IO.FileAccess access, bool ownsHandle) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize) and optionally make a new SafeFileHandle with ownsHandle=false if needed instead.")]
public FileStream(System.IntPtr handle, System.IO.FileAccess access, bool ownsHandle, int bufferSize) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) and optionally make a new SafeFileHandle with ownsHandle=false if needed instead.")]
public FileStream(System.IntPtr handle, System.IO.FileAccess access, bool ownsHandle, int bufferSize, bool isAsync) { }
public FileStream(string path, System.IO.FileMode mode) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, bool useAsync) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, System.IO.FileOptions options) { }
public FileStream(string path, System.IO.FileStreamOptions options) { }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
[System.ObsoleteAttribute("FileStream.Handle has been deprecated. Use FileStream's SafeFileHandle property instead.")]
public virtual System.IntPtr Handle { get { throw null; } }
public virtual bool IsAsync { get { throw null; } }
public override long Length { get { throw null; } }
public virtual string Name { get { throw null; } }
public override long Position { get { throw null; } set { } }
public virtual Microsoft.Win32.SafeHandles.SafeFileHandle SafeFileHandle { get { throw null; } }
public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override int EndRead(System.IAsyncResult asyncResult) { throw null; }
public override void EndWrite(System.IAsyncResult asyncResult) { }
~FileStream() { }
public override void Flush() { }
public virtual void Flush(bool flushToDisk) { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")]
public virtual void Lock(long position, long length) { }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")]
public virtual void Unlock(long position, long length) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteByte(byte value) { }
}
public sealed partial class FileStreamOptions
{
public FileStreamOptions() { }
public System.IO.FileAccess Access { get { throw null; } set { } }
public int BufferSize { get { throw null; } set { } }
public System.IO.FileMode Mode { get { throw null; } set { } }
public System.IO.FileOptions Options { get { throw null; } set { } }
public long PreallocationSize { get { throw null; } set { } }
public System.IO.FileShare Share { get { throw null; } set { } }
}
public abstract partial class FileSystemInfo : System.MarshalByRefObject, System.Runtime.Serialization.ISerializable
{
protected string FullPath;
protected string OriginalPath;
protected FileSystemInfo() { }
protected FileSystemInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public System.IO.FileAttributes Attributes { get { throw null; } set { } }
public System.DateTime CreationTime { get { throw null; } set { } }
public System.DateTime CreationTimeUtc { get { throw null; } set { } }
public abstract bool Exists { get; }
public string Extension { get { throw null; } }
public virtual string FullName { get { throw null; } }
public System.DateTime LastAccessTime { get { throw null; } set { } }
public System.DateTime LastAccessTimeUtc { get { throw null; } set { } }
public System.DateTime LastWriteTime { get { throw null; } set { } }
public System.DateTime LastWriteTimeUtc { get { throw null; } set { } }
public string? LinkTarget { get { throw null; } }
public abstract string Name { get; }
public void CreateAsSymbolicLink(string pathToTarget) { }
public abstract void Delete();
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public void Refresh() { }
public System.IO.FileSystemInfo? ResolveLinkTarget(bool returnFinalTarget) { throw null; }
public override string ToString() { throw null; }
}
public enum HandleInheritability
{
None = 0,
Inheritable = 1,
}
public sealed partial class InvalidDataException : System.SystemException
{
public InvalidDataException() { }
public InvalidDataException(string? message) { }
public InvalidDataException(string? message, System.Exception? innerException) { }
}
public partial class IOException : System.SystemException
{
public IOException() { }
protected IOException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public IOException(string? message) { }
public IOException(string? message, System.Exception? innerException) { }
public IOException(string? message, int hresult) { }
}
public enum MatchCasing
{
PlatformDefault = 0,
CaseSensitive = 1,
CaseInsensitive = 2,
}
public enum MatchType
{
Simple = 0,
Win32 = 1,
}
public partial class MemoryStream : System.IO.Stream
{
public MemoryStream() { }
public MemoryStream(byte[] buffer) { }
public MemoryStream(byte[] buffer, bool writable) { }
public MemoryStream(byte[] buffer, int index, int count) { }
public MemoryStream(byte[] buffer, int index, int count, bool writable) { }
public MemoryStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible) { }
public MemoryStream(int capacity) { }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
public virtual int Capacity { get { throw null; } set { } }
public override long Length { get { throw null; } }
public override long Position { get { throw null; } set { } }
public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override void CopyTo(System.IO.Stream destination, int bufferSize) { }
public override System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
protected override void Dispose(bool disposing) { }
public override int EndRead(System.IAsyncResult asyncResult) { throw null; }
public override void EndWrite(System.IAsyncResult asyncResult) { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual byte[] GetBuffer() { throw null; }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin loc) { throw null; }
public override void SetLength(long value) { }
public virtual byte[] ToArray() { throw null; }
public virtual bool TryGetBuffer(out System.ArraySegment<byte> buffer) { throw null; }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteByte(byte value) { }
public virtual void WriteTo(System.IO.Stream stream) { }
}
public static partial class Path
{
public static readonly char AltDirectorySeparatorChar;
public static readonly char DirectorySeparatorChar;
[System.ObsoleteAttribute("Path.InvalidPathChars has been deprecated. Use GetInvalidPathChars or GetInvalidFileNameChars instead.")]
public static readonly char[] InvalidPathChars;
public static readonly char PathSeparator;
public static readonly char VolumeSeparatorChar;
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? ChangeExtension(string? path, string? extension) { throw null; }
public static string Combine(string path1, string path2) { throw null; }
public static string Combine(string path1, string path2, string path3) { throw null; }
public static string Combine(string path1, string path2, string path3, string path4) { throw null; }
public static string Combine(params string[] paths) { throw null; }
public static bool EndsInDirectorySeparator(System.ReadOnlySpan<char> path) { throw null; }
public static bool EndsInDirectorySeparator(string path) { throw null; }
public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path) { throw null; }
public static System.ReadOnlySpan<char> GetDirectoryName(System.ReadOnlySpan<char> path) { throw null; }
public static string? GetDirectoryName(string? path) { throw null; }
public static System.ReadOnlySpan<char> GetExtension(System.ReadOnlySpan<char> path) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? GetExtension(string? path) { throw null; }
public static System.ReadOnlySpan<char> GetFileName(System.ReadOnlySpan<char> path) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? GetFileName(string? path) { throw null; }
public static System.ReadOnlySpan<char> GetFileNameWithoutExtension(System.ReadOnlySpan<char> path) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? GetFileNameWithoutExtension(string? path) { throw null; }
public static string GetFullPath(string path) { throw null; }
public static string GetFullPath(string path, string basePath) { throw null; }
public static char[] GetInvalidFileNameChars() { throw null; }
public static char[] GetInvalidPathChars() { throw null; }
public static System.ReadOnlySpan<char> GetPathRoot(System.ReadOnlySpan<char> path) { throw null; }
public static string? GetPathRoot(string? path) { throw null; }
public static string GetRandomFileName() { throw null; }
public static string GetRelativePath(string relativeTo, string path) { throw null; }
public static string GetTempFileName() { throw null; }
public static string GetTempPath() { throw null; }
public static bool HasExtension(System.ReadOnlySpan<char> path) { throw null; }
public static bool HasExtension([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; }
public static bool IsPathFullyQualified(System.ReadOnlySpan<char> path) { throw null; }
public static bool IsPathFullyQualified(string path) { throw null; }
public static bool IsPathRooted(System.ReadOnlySpan<char> path) { throw null; }
public static bool IsPathRooted([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; }
public static string Join(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2) { throw null; }
public static string Join(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2, System.ReadOnlySpan<char> path3) { throw null; }
public static string Join(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2, System.ReadOnlySpan<char> path3, System.ReadOnlySpan<char> path4) { throw null; }
public static string Join(string? path1, string? path2) { throw null; }
public static string Join(string? path1, string? path2, string? path3) { throw null; }
public static string Join(string? path1, string? path2, string? path3, string? path4) { throw null; }
public static string Join(params string?[] paths) { throw null; }
public static System.ReadOnlySpan<char> TrimEndingDirectorySeparator(System.ReadOnlySpan<char> path) { throw null; }
public static string TrimEndingDirectorySeparator(string path) { throw null; }
public static bool TryJoin(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2, System.ReadOnlySpan<char> path3, System.Span<char> destination, out int charsWritten) { throw null; }
public static bool TryJoin(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2, System.Span<char> destination, out int charsWritten) { throw null; }
}
public partial class PathTooLongException : System.IO.IOException
{
public PathTooLongException() { }
protected PathTooLongException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public PathTooLongException(string? message) { }
public PathTooLongException(string? message, System.Exception? innerException) { }
}
public static partial class RandomAccess
{
public static long GetLength(Microsoft.Win32.SafeHandles.SafeFileHandle handle) { throw null; }
public static void SetLength(Microsoft.Win32.SafeHandles.SafeFileHandle handle, long length) { throw null; }
public static long Read(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<System.Memory<byte>> buffers, long fileOffset) { throw null; }
public static int Read(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Span<byte> buffer, long fileOffset) { throw null; }
public static System.Threading.Tasks.ValueTask<long> ReadAsync(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<System.Memory<byte>> buffers, long fileOffset, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.ValueTask<int> ReadAsync(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Memory<byte> buffer, long fileOffset, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void Write(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<System.ReadOnlyMemory<byte>> buffers, long fileOffset) { }
public static void Write(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.ReadOnlySpan<byte> buffer, long fileOffset) { }
public static System.Threading.Tasks.ValueTask WriteAsync(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<System.ReadOnlyMemory<byte>> buffers, long fileOffset, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.ValueTask WriteAsync(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.ReadOnlyMemory<byte> buffer, long fileOffset, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public enum SearchOption
{
TopDirectoryOnly = 0,
AllDirectories = 1,
}
public enum SeekOrigin
{
Begin = 0,
Current = 1,
End = 2,
}
public abstract partial class Stream : System.MarshalByRefObject, System.IAsyncDisposable, System.IDisposable
{
public static readonly System.IO.Stream Null;
protected Stream() { }
public abstract bool CanRead { get; }
public abstract bool CanSeek { get; }
public virtual bool CanTimeout { get { throw null; } }
public abstract bool CanWrite { get; }
public abstract long Length { get; }
public abstract long Position { get; set; }
public virtual int ReadTimeout { get { throw null; } set { } }
public virtual int WriteTimeout { get { throw null; } set { } }
public virtual System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public virtual System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public virtual void Close() { }
public void CopyTo(System.IO.Stream destination) { }
public virtual void CopyTo(System.IO.Stream destination, int bufferSize) { }
public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination) { throw null; }
public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize) { throw null; }
public virtual System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ObsoleteAttribute("CreateWaitHandle has been deprecated. Use the ManualResetEvent(false) constructor instead.")]
protected virtual System.Threading.WaitHandle CreateWaitHandle() { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public virtual int EndRead(System.IAsyncResult asyncResult) { throw null; }
public virtual void EndWrite(System.IAsyncResult asyncResult) { }
public abstract void Flush();
public System.Threading.Tasks.Task FlushAsync() { throw null; }
public virtual System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ObsoleteAttribute("Do not call or override this method.")]
protected virtual void ObjectInvariant() { }
public abstract int Read(byte[] buffer, int offset, int count);
public virtual int Read(System.Span<byte> buffer) { throw null; }
public System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count) { throw null; }
public virtual System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual int ReadByte() { throw null; }
public abstract long Seek(long offset, System.IO.SeekOrigin origin);
public abstract void SetLength(long value);
public static System.IO.Stream Synchronized(System.IO.Stream stream) { throw null; }
protected static void ValidateBufferArguments(byte[] buffer, int offset, int count) { }
protected static void ValidateCopyToArguments(System.IO.Stream destination, int bufferSize) { }
public abstract void Write(byte[] buffer, int offset, int count);
public virtual void Write(System.ReadOnlySpan<byte> buffer) { }
public System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual void WriteByte(byte value) { }
}
public partial class StreamReader : System.IO.TextReader
{
public static readonly new System.IO.StreamReader Null;
public StreamReader(System.IO.Stream stream) { }
public StreamReader(System.IO.Stream stream, bool detectEncodingFromByteOrderMarks) { }
public StreamReader(System.IO.Stream stream, System.Text.Encoding encoding) { }
public StreamReader(System.IO.Stream stream, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks) { }
public StreamReader(System.IO.Stream stream, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) { }
public StreamReader(System.IO.Stream stream, System.Text.Encoding? encoding = null, bool detectEncodingFromByteOrderMarks = true, int bufferSize = -1, bool leaveOpen = false) { }
public StreamReader(string path) { }
public StreamReader(string path, bool detectEncodingFromByteOrderMarks) { }
public StreamReader(string path, System.IO.FileStreamOptions options) { }
public StreamReader(string path, System.Text.Encoding encoding) { }
public StreamReader(string path, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks) { }
public StreamReader(string path, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) { }
public StreamReader(string path, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks, System.IO.FileStreamOptions options) { }
public virtual System.IO.Stream BaseStream { get { throw null; } }
public virtual System.Text.Encoding CurrentEncoding { get { throw null; } }
public bool EndOfStream { get { throw null; } }
public override void Close() { }
public void DiscardBufferedData() { }
protected override void Dispose(bool disposing) { }
public override int Peek() { throw null; }
public override int Read() { throw null; }
public override int Read(char[] buffer, int index, int count) { throw null; }
public override int Read(System.Span<char> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadBlock(char[] buffer, int index, int count) { throw null; }
public override int ReadBlock(System.Span<char> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadBlockAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadBlockAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override string? ReadLine() { throw null; }
public override System.Threading.Tasks.Task<string?> ReadLineAsync() { throw null; }
public override System.Threading.Tasks.ValueTask<string?> ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override string ReadToEnd() { throw null; }
public override System.Threading.Tasks.Task<string> ReadToEndAsync() { throw null; }
public override System.Threading.Tasks.Task<string> ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class StreamWriter : System.IO.TextWriter
{
public static readonly new System.IO.StreamWriter Null;
public StreamWriter(System.IO.Stream stream) { }
public StreamWriter(System.IO.Stream stream, System.Text.Encoding encoding) { }
public StreamWriter(System.IO.Stream stream, System.Text.Encoding encoding, int bufferSize) { }
public StreamWriter(System.IO.Stream stream, System.Text.Encoding? encoding = null, int bufferSize = -1, bool leaveOpen = false) { }
public StreamWriter(string path) { }
public StreamWriter(string path, bool append) { }
public StreamWriter(string path, bool append, System.Text.Encoding encoding) { }
public StreamWriter(string path, bool append, System.Text.Encoding encoding, int bufferSize) { }
public StreamWriter(string path, System.IO.FileStreamOptions options) { }
public StreamWriter(string path, System.Text.Encoding encoding, System.IO.FileStreamOptions options) { }
public virtual bool AutoFlush { get { throw null; } set { } }
public virtual System.IO.Stream BaseStream { get { throw null; } }
public override System.Text.Encoding Encoding { get { throw null; } }
public override void Close() { }
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync() { throw null; }
public override void Write(char value) { }
public override void Write(char[]? buffer) { }
public override void Write(char[] buffer, int index, int count) { }
public override void Write(System.ReadOnlySpan<char> buffer) { }
public override void Write(string? value) { }
public override void Write(string format, object? arg0) { }
public override void Write(string format, object? arg0, object? arg1) { }
public override void Write(string format, object? arg0, object? arg1, object? arg2) { }
public override void Write(string format, params object?[] arg) { }
public override System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(string? value) { throw null; }
public override void WriteLine(System.ReadOnlySpan<char> buffer) { }
public override void WriteLine(string? value) { }
public override void WriteLine(string format, object? arg0) { }
public override void WriteLine(string format, object? arg0, object? arg1) { }
public override void WriteLine(string format, object? arg0, object? arg1, object? arg2) { }
public override void WriteLine(string format, params object?[] arg) { }
public override System.Threading.Tasks.Task WriteLineAsync() { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(string? value) { throw null; }
}
public partial class StringReader : System.IO.TextReader
{
public StringReader(string s) { }
public override void Close() { }
protected override void Dispose(bool disposing) { }
public override int Peek() { throw null; }
public override int Read() { throw null; }
public override int Read(char[] buffer, int index, int count) { throw null; }
public override int Read(System.Span<char> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadBlock(System.Span<char> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadBlockAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadBlockAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override string? ReadLine() { throw null; }
public override System.Threading.Tasks.Task<string?> ReadLineAsync() { throw null; }
public override System.Threading.Tasks.ValueTask<string?> ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override string ReadToEnd() { throw null; }
public override System.Threading.Tasks.Task<string> ReadToEndAsync() { throw null; }
public override System.Threading.Tasks.Task<string> ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class StringWriter : System.IO.TextWriter
{
public StringWriter() { }
public StringWriter(System.IFormatProvider? formatProvider) { }
public StringWriter(System.Text.StringBuilder sb) { }
public StringWriter(System.Text.StringBuilder sb, System.IFormatProvider? formatProvider) { }
public override System.Text.Encoding Encoding { get { throw null; } }
public override void Close() { }
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.Task FlushAsync() { throw null; }
public virtual System.Text.StringBuilder GetStringBuilder() { throw null; }
public override string ToString() { throw null; }
public override void Write(char value) { }
public override void Write(char[] buffer, int index, int count) { }
public override void Write(System.ReadOnlySpan<char> buffer) { }
public override void Write(string? value) { }
public override void Write(System.Text.StringBuilder? value) { }
public override System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(string? value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteLine(System.ReadOnlySpan<char> buffer) { }
public override void WriteLine(System.Text.StringBuilder? value) { }
public override System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(string? value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public abstract partial class TextReader : System.MarshalByRefObject, System.IDisposable
{
public static readonly System.IO.TextReader Null;
protected TextReader() { }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual int Peek() { throw null; }
public virtual int Read() { throw null; }
public virtual int Read(char[] buffer, int index, int count) { throw null; }
public virtual int Read(System.Span<char> buffer) { throw null; }
public virtual System.Threading.Tasks.Task<int> ReadAsync(char[] buffer, int index, int count) { throw null; }
public virtual System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual int ReadBlock(char[] buffer, int index, int count) { throw null; }
public virtual int ReadBlock(System.Span<char> buffer) { throw null; }
public virtual System.Threading.Tasks.Task<int> ReadBlockAsync(char[] buffer, int index, int count) { throw null; }
public virtual System.Threading.Tasks.ValueTask<int> ReadBlockAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual string? ReadLine() { throw null; }
public virtual System.Threading.Tasks.Task<string?> ReadLineAsync() { throw null; }
public virtual System.Threading.Tasks.ValueTask<string?> ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual string ReadToEnd() { throw null; }
public virtual System.Threading.Tasks.Task<string> ReadToEndAsync() { throw null; }
public virtual System.Threading.Tasks.Task<string> ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.IO.TextReader Synchronized(System.IO.TextReader reader) { throw null; }
}
public abstract partial class TextWriter : System.MarshalByRefObject, System.IAsyncDisposable, System.IDisposable
{
protected char[] CoreNewLine;
public static readonly System.IO.TextWriter Null;
protected TextWriter() { }
protected TextWriter(System.IFormatProvider? formatProvider) { }
public abstract System.Text.Encoding Encoding { get; }
public virtual System.IFormatProvider FormatProvider { get { throw null; } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public virtual string NewLine { get { throw null; } set { } }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public virtual void Flush() { }
public virtual System.Threading.Tasks.Task FlushAsync() { throw null; }
public static System.IO.TextWriter Synchronized(System.IO.TextWriter writer) { throw null; }
public virtual void Write(bool value) { }
public virtual void Write(char value) { }
public virtual void Write(char[]? buffer) { }
public virtual void Write(char[] buffer, int index, int count) { }
public virtual void Write(decimal value) { }
public virtual void Write(double value) { }
public virtual void Write(int value) { }
public virtual void Write(long value) { }
public virtual void Write(object? value) { }
public virtual void Write(System.ReadOnlySpan<char> buffer) { }
public virtual void Write(float value) { }
public virtual void Write(string? value) { }
public virtual void Write(string format, object? arg0) { }
public virtual void Write(string format, object? arg0, object? arg1) { }
public virtual void Write(string format, object? arg0, object? arg1, object? arg2) { }
public virtual void Write(string format, params object?[] arg) { }
public virtual void Write(System.Text.StringBuilder? value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(uint value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(ulong value) { }
public virtual System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
public System.Threading.Tasks.Task WriteAsync(char[]? buffer) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(string? value) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual void WriteLine() { }
public virtual void WriteLine(bool value) { }
public virtual void WriteLine(char value) { }
public virtual void WriteLine(char[]? buffer) { }
public virtual void WriteLine(char[] buffer, int index, int count) { }
public virtual void WriteLine(decimal value) { }
public virtual void WriteLine(double value) { }
public virtual void WriteLine(int value) { }
public virtual void WriteLine(long value) { }
public virtual void WriteLine(object? value) { }
public virtual void WriteLine(System.ReadOnlySpan<char> buffer) { }
public virtual void WriteLine(float value) { }
public virtual void WriteLine(string? value) { }
public virtual void WriteLine(string format, object? arg0) { }
public virtual void WriteLine(string format, object? arg0, object? arg1) { }
public virtual void WriteLine(string format, object? arg0, object? arg1, object? arg2) { }
public virtual void WriteLine(string format, params object?[] arg) { }
public virtual void WriteLine(System.Text.StringBuilder? value) { }
[System.CLSCompliantAttribute(false)]
public virtual void WriteLine(uint value) { }
[System.CLSCompliantAttribute(false)]
public virtual void WriteLine(ulong value) { }
public virtual System.Threading.Tasks.Task WriteLineAsync() { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
public System.Threading.Tasks.Task WriteLineAsync(char[]? buffer) { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(string? value) { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class UnmanagedMemoryStream : System.IO.Stream
{
protected UnmanagedMemoryStream() { }
[System.CLSCompliantAttribute(false)]
public unsafe UnmanagedMemoryStream(byte* pointer, long length) { }
[System.CLSCompliantAttribute(false)]
public unsafe UnmanagedMemoryStream(byte* pointer, long length, long capacity, System.IO.FileAccess access) { }
public UnmanagedMemoryStream(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length) { }
public UnmanagedMemoryStream(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access) { }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
public long Capacity { get { throw null; } }
public override long Length { get { throw null; } }
public override long Position { get { throw null; } set { } }
[System.CLSCompliantAttribute(false)]
public unsafe byte* PositionPointer { get { throw null; } set { } }
protected override void Dispose(bool disposing) { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
[System.CLSCompliantAttribute(false)]
protected unsafe void Initialize(byte* pointer, long length, long capacity, System.IO.FileAccess access) { }
protected void Initialize(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access) { }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin loc) { throw null; }
public override void SetLength(long value) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteByte(byte value) { }
}
}
namespace System.IO.Enumeration
{
public ref partial struct FileSystemEntry
{
private object _dummy;
private int _dummyPrimitive;
public System.IO.FileAttributes Attributes { get { throw null; } }
public System.DateTimeOffset CreationTimeUtc { get { throw null; } }
public readonly System.ReadOnlySpan<char> Directory { get { throw null; } }
public System.ReadOnlySpan<char> FileName { get { throw null; } }
public bool IsDirectory { get { throw null; } }
public bool IsHidden { get { throw null; } }
public System.DateTimeOffset LastAccessTimeUtc { get { throw null; } }
public System.DateTimeOffset LastWriteTimeUtc { get { throw null; } }
public long Length { get { throw null; } }
public readonly System.ReadOnlySpan<char> OriginalRootDirectory { get { throw null; } }
public readonly System.ReadOnlySpan<char> RootDirectory { get { throw null; } }
public System.IO.FileSystemInfo ToFileSystemInfo() { throw null; }
public string ToFullPath() { throw null; }
public string ToSpecifiedFullPath() { throw null; }
}
public partial class FileSystemEnumerable<TResult> : System.Collections.Generic.IEnumerable<TResult>, System.Collections.IEnumerable
{
public FileSystemEnumerable(string directory, System.IO.Enumeration.FileSystemEnumerable<TResult>.FindTransform transform, System.IO.EnumerationOptions? options = null) { }
public System.IO.Enumeration.FileSystemEnumerable<TResult>.FindPredicate? ShouldIncludePredicate { get { throw null; } set { } }
public System.IO.Enumeration.FileSystemEnumerable<TResult>.FindPredicate? ShouldRecursePredicate { get { throw null; } set { } }
public System.Collections.Generic.IEnumerator<TResult> GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public delegate bool FindPredicate(ref System.IO.Enumeration.FileSystemEntry entry);
public delegate TResult FindTransform(ref System.IO.Enumeration.FileSystemEntry entry);
}
public abstract partial class FileSystemEnumerator<TResult> : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.Collections.Generic.IEnumerator<TResult>, System.Collections.IEnumerator, System.IDisposable
{
public FileSystemEnumerator(string directory, System.IO.EnumerationOptions? options = null) { }
public TResult Current { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
protected virtual bool ContinueOnError(int error) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public bool MoveNext() { throw null; }
protected virtual void OnDirectoryFinished(System.ReadOnlySpan<char> directory) { }
public void Reset() { }
protected virtual bool ShouldIncludeEntry(ref System.IO.Enumeration.FileSystemEntry entry) { throw null; }
protected virtual bool ShouldRecurseIntoEntry(ref System.IO.Enumeration.FileSystemEntry entry) { throw null; }
protected abstract TResult TransformEntry(ref System.IO.Enumeration.FileSystemEntry entry);
}
public static partial class FileSystemName
{
public static bool MatchesSimpleExpression(System.ReadOnlySpan<char> expression, System.ReadOnlySpan<char> name, bool ignoreCase = true) { throw null; }
public static bool MatchesWin32Expression(System.ReadOnlySpan<char> expression, System.ReadOnlySpan<char> name, bool ignoreCase = true) { throw null; }
public static string TranslateWin32Expression(string? expression) { throw null; }
}
}
namespace System.Net
{
public static partial class WebUtility
{
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? HtmlDecode(string? value) { throw null; }
public static void HtmlDecode(string? value, System.IO.TextWriter output) { }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? HtmlEncode(string? value) { throw null; }
public static void HtmlEncode(string? value, System.IO.TextWriter output) { }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("encodedValue")]
public static string? UrlDecode(string? encodedValue) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("encodedValue")]
public static byte[]? UrlDecodeToBytes(byte[]? encodedValue, int offset, int count) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? UrlEncode(string? value) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static byte[]? UrlEncodeToBytes(byte[]? value, int offset, int count) { throw null; }
}
}
namespace System.Numerics
{
public static partial class BitOperations
{
public static bool IsPow2(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool IsPow2(uint value) { throw null; }
public static bool IsPow2(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool IsPow2(ulong value) { throw null; }
public static bool IsPow2(nint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool IsPow2(nuint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int LeadingZeroCount(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int LeadingZeroCount(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int LeadingZeroCount(nuint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int Log2(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int Log2(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int Log2(nuint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int PopCount(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int PopCount(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int PopCount(nuint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint RotateLeft(uint value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong RotateLeft(ulong value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint RotateLeft(nuint value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint RotateRight(uint value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong RotateRight(ulong value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint RotateRight(nuint value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint RoundUpToPowerOf2(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong RoundUpToPowerOf2(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint RoundUpToPowerOf2(nuint value) { throw null; }
public static int TrailingZeroCount(int value) { throw null; }
public static int TrailingZeroCount(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int TrailingZeroCount(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int TrailingZeroCount(ulong value) { throw null; }
public static int TrailingZeroCount(nint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int TrailingZeroCount(nuint value) { throw null; }
}
}
namespace System.Reflection
{
public sealed partial class AmbiguousMatchException : System.SystemException
{
public AmbiguousMatchException() { }
public AmbiguousMatchException(string? message) { }
public AmbiguousMatchException(string? message, System.Exception? inner) { }
}
public abstract partial class Assembly : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
{
protected Assembly() { }
[System.ObsoleteAttribute("Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location.", DiagnosticId = "SYSLIB0012", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual string? CodeBase { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.TypeInfo> DefinedTypes { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")] get { throw null; } }
public virtual System.Reflection.MethodInfo? EntryPoint { get { throw null; } }
[System.ObsoleteAttribute("Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location.", DiagnosticId = "SYSLIB0012", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual string EscapedCodeBase { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Type> ExportedTypes { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")] get { throw null; } }
public virtual string? FullName { get { throw null; } }
[System.ObsoleteAttribute("The Global Assembly Cache is not supported.", DiagnosticId = "SYSLIB0005", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public virtual bool GlobalAssemblyCache { get { throw null; } }
public virtual long HostContext { get { throw null; } }
public virtual string ImageRuntimeVersion { get { throw null; } }
public virtual bool IsCollectible { get { throw null; } }
public virtual bool IsDynamic { get { throw null; } }
public bool IsFullyTrusted { get { throw null; } }
public virtual string Location { get { throw null; } }
public virtual System.Reflection.Module ManifestModule { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.Module> Modules { get { throw null; } }
public virtual bool ReflectionOnly { get { throw null; } }
public virtual System.Security.SecurityRuleSet SecurityRuleSet { get { throw null; } }
public virtual event System.Reflection.ModuleResolveEventHandler? ModuleResolve { add { } remove { } }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Assembly.CreateInstance is not supported with trimming. Use Type.GetType instead.")]
public object? CreateInstance(string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Assembly.CreateInstance is not supported with trimming. Use Type.GetType instead.")]
public object? CreateInstance(string typeName, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Assembly.CreateInstance is not supported with trimming. Use Type.GetType instead.")]
public virtual object? CreateInstance(string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object[]? args, System.Globalization.CultureInfo? culture, object[]? activationAttributes) { throw null; }
public static string CreateQualifiedName(string? assemblyName, string? typeName) { throw null; }
public override bool Equals(object? o) { throw null; }
public static System.Reflection.Assembly? GetAssembly(System.Type type) { throw null; }
public static System.Reflection.Assembly GetCallingAssembly() { throw null; }
public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
public static System.Reflection.Assembly? GetEntryAssembly() { throw null; }
public static System.Reflection.Assembly GetExecutingAssembly() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] GetExportedTypes() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual System.IO.FileStream? GetFile(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual System.IO.FileStream[] GetFiles() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual System.IO.FileStream[] GetFiles(bool getResourceModules) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] GetForwardedTypes() { throw null; }
public override int GetHashCode() { throw null; }
public System.Reflection.Module[] GetLoadedModules() { throw null; }
public virtual System.Reflection.Module[] GetLoadedModules(bool getResourceModules) { throw null; }
public virtual System.Reflection.ManifestResourceInfo? GetManifestResourceInfo(string resourceName) { throw null; }
public virtual string[] GetManifestResourceNames() { throw null; }
public virtual System.IO.Stream? GetManifestResourceStream(string name) { throw null; }
public virtual System.IO.Stream? GetManifestResourceStream(System.Type type, string name) { throw null; }
public virtual System.Reflection.Module? GetModule(string name) { throw null; }
public System.Reflection.Module[] GetModules() { throw null; }
public virtual System.Reflection.Module[] GetModules(bool getResourceModules) { throw null; }
public virtual System.Reflection.AssemblyName GetName() { throw null; }
public virtual System.Reflection.AssemblyName GetName(bool copiedName) { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Assembly references might be removed")]
public virtual System.Reflection.AssemblyName[] GetReferencedAssemblies() { throw null; }
public virtual System.Reflection.Assembly GetSatelliteAssembly(System.Globalization.CultureInfo culture) { throw null; }
public virtual System.Reflection.Assembly GetSatelliteAssembly(System.Globalization.CultureInfo culture, System.Version? version) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string name, bool throwOnError) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string name, bool throwOnError, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] GetTypes() { throw null; }
public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly Load(byte[] rawAssembly) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly Load(byte[] rawAssembly, byte[]? rawSymbolStore) { throw null; }
public static System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyRef) { throw null; }
public static System.Reflection.Assembly Load(string assemblyString) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly LoadFile(string path) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly LoadFrom(string assemblyFile) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly LoadFrom(string assemblyFile, byte[]? hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded module depends on might be removed")]
public System.Reflection.Module LoadModule(string moduleName, byte[]? rawModule) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded module depends on might be removed")]
public virtual System.Reflection.Module LoadModule(string moduleName, byte[]? rawModule, byte[]? rawSymbolStore) { throw null; }
[System.ObsoleteAttribute("Assembly.LoadWithPartialName has been deprecated. Use Assembly.Load() instead.")]
public static System.Reflection.Assembly? LoadWithPartialName(string partialName) { throw null; }
public static bool operator ==(System.Reflection.Assembly? left, System.Reflection.Assembly? right) { throw null; }
public static bool operator !=(System.Reflection.Assembly? left, System.Reflection.Assembly? right) { throw null; }
[System.ObsoleteAttribute("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly ReflectionOnlyLoad(byte[] rawAssembly) { throw null; }
[System.ObsoleteAttribute("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly ReflectionOnlyLoad(string assemblyString) { throw null; }
[System.ObsoleteAttribute("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly ReflectionOnlyLoadFrom(string assemblyFile) { throw null; }
public override string ToString() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly UnsafeLoadFrom(string assemblyFile) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyAlgorithmIdAttribute : System.Attribute
{
public AssemblyAlgorithmIdAttribute(System.Configuration.Assemblies.AssemblyHashAlgorithm algorithmId) { }
[System.CLSCompliantAttribute(false)]
public AssemblyAlgorithmIdAttribute(uint algorithmId) { }
[System.CLSCompliantAttribute(false)]
public uint AlgorithmId { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyCompanyAttribute : System.Attribute
{
public AssemblyCompanyAttribute(string company) { }
public string Company { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyConfigurationAttribute : System.Attribute
{
public AssemblyConfigurationAttribute(string configuration) { }
public string Configuration { get { throw null; } }
}
public enum AssemblyContentType
{
Default = 0,
WindowsRuntime = 1,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyCopyrightAttribute : System.Attribute
{
public AssemblyCopyrightAttribute(string copyright) { }
public string Copyright { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyCultureAttribute : System.Attribute
{
public AssemblyCultureAttribute(string culture) { }
public string Culture { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyDefaultAliasAttribute : System.Attribute
{
public AssemblyDefaultAliasAttribute(string defaultAlias) { }
public string DefaultAlias { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyDelaySignAttribute : System.Attribute
{
public AssemblyDelaySignAttribute(bool delaySign) { }
public bool DelaySign { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyDescriptionAttribute : System.Attribute
{
public AssemblyDescriptionAttribute(string description) { }
public string Description { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyFileVersionAttribute : System.Attribute
{
public AssemblyFileVersionAttribute(string version) { }
public string Version { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyFlagsAttribute : System.Attribute
{
[System.ObsoleteAttribute("This constructor has been deprecated. Use AssemblyFlagsAttribute(AssemblyNameFlags) instead.")]
public AssemblyFlagsAttribute(int assemblyFlags) { }
public AssemblyFlagsAttribute(System.Reflection.AssemblyNameFlags assemblyFlags) { }
[System.CLSCompliantAttribute(false)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use AssemblyFlagsAttribute(AssemblyNameFlags) instead.")]
public AssemblyFlagsAttribute(uint flags) { }
public int AssemblyFlags { get { throw null; } }
[System.CLSCompliantAttribute(false)]
[System.ObsoleteAttribute("AssemblyFlagsAttribute.Flags has been deprecated. Use AssemblyFlags instead.")]
public uint Flags { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyInformationalVersionAttribute : System.Attribute
{
public AssemblyInformationalVersionAttribute(string informationalVersion) { }
public string InformationalVersion { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyKeyFileAttribute : System.Attribute
{
public AssemblyKeyFileAttribute(string keyFile) { }
public string KeyFile { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyKeyNameAttribute : System.Attribute
{
public AssemblyKeyNameAttribute(string keyName) { }
public string KeyName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed partial class AssemblyMetadataAttribute : System.Attribute
{
public AssemblyMetadataAttribute(string key, string? value) { }
public string Key { get { throw null; } }
public string? Value { get { throw null; } }
}
public sealed partial class AssemblyName : System.ICloneable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
public AssemblyName() { }
public AssemblyName(string assemblyName) { }
public string? CodeBase { [System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("The code will return an empty string for assemblies embedded in a single-file app")] get { throw null; } set { } }
public System.Reflection.AssemblyContentType ContentType { get { throw null; } set { } }
public System.Globalization.CultureInfo? CultureInfo { get { throw null; } set { } }
public string? CultureName { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("The code will return an empty string for assemblies embedded in a single-file app")]
public string? EscapedCodeBase { get { throw null; } }
public System.Reflection.AssemblyNameFlags Flags { get { throw null; } set { } }
public string FullName { get { throw null; } }
[System.ObsoleteAttribute("AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.", DiagnosticId = "SYSLIB0037", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Configuration.Assemblies.AssemblyHashAlgorithm HashAlgorithm { get { throw null; } set { } }
[System.ObsoleteAttribute("Strong name signing is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0017", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Reflection.StrongNameKeyPair? KeyPair { get { throw null; } set { } }
public string? Name { get { throw null; } set { } }
[System.ObsoleteAttribute("AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.", DiagnosticId = "SYSLIB0037", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Reflection.ProcessorArchitecture ProcessorArchitecture { get { throw null; } set { } }
public System.Version? Version { get { throw null; } set { } }
[System.ObsoleteAttribute("AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.", DiagnosticId = "SYSLIB0037", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Configuration.Assemblies.AssemblyVersionCompatibility VersionCompatibility { get { throw null; } set { } }
public object Clone() { throw null; }
public static System.Reflection.AssemblyName GetAssemblyName(string assemblyFile) { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public byte[]? GetPublicKey() { throw null; }
public byte[]? GetPublicKeyToken() { throw null; }
public void OnDeserialization(object? sender) { }
public static bool ReferenceMatchesDefinition(System.Reflection.AssemblyName? reference, System.Reflection.AssemblyName? definition) { throw null; }
public void SetPublicKey(byte[]? publicKey) { }
public void SetPublicKeyToken(byte[]? publicKeyToken) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum AssemblyNameFlags
{
None = 0,
PublicKey = 1,
Retargetable = 256,
EnableJITcompileOptimizer = 16384,
EnableJITcompileTracking = 32768,
}
public partial class AssemblyNameProxy : System.MarshalByRefObject
{
public AssemblyNameProxy() { }
public System.Reflection.AssemblyName GetAssemblyName(string assemblyFile) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyProductAttribute : System.Attribute
{
public AssemblyProductAttribute(string product) { }
public string Product { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false, AllowMultiple=false)]
public sealed partial class AssemblySignatureKeyAttribute : System.Attribute
{
public AssemblySignatureKeyAttribute(string publicKey, string countersignature) { }
public string Countersignature { get { throw null; } }
public string PublicKey { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyTitleAttribute : System.Attribute
{
public AssemblyTitleAttribute(string title) { }
public string Title { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyTrademarkAttribute : System.Attribute
{
public AssemblyTrademarkAttribute(string trademark) { }
public string Trademark { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyVersionAttribute : System.Attribute
{
public AssemblyVersionAttribute(string version) { }
public string Version { get { throw null; } }
}
public abstract partial class Binder
{
protected Binder() { }
public abstract System.Reflection.FieldInfo BindToField(System.Reflection.BindingFlags bindingAttr, System.Reflection.FieldInfo[] match, object value, System.Globalization.CultureInfo? culture);
public abstract System.Reflection.MethodBase BindToMethod(System.Reflection.BindingFlags bindingAttr, System.Reflection.MethodBase[] match, ref object?[] args, System.Reflection.ParameterModifier[]? modifiers, System.Globalization.CultureInfo? culture, string[]? names, out object? state);
public abstract object ChangeType(object value, System.Type type, System.Globalization.CultureInfo? culture);
public abstract void ReorderArgumentArray(ref object?[] args, object state);
public abstract System.Reflection.MethodBase? SelectMethod(System.Reflection.BindingFlags bindingAttr, System.Reflection.MethodBase[] match, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers);
public abstract System.Reflection.PropertyInfo? SelectProperty(System.Reflection.BindingFlags bindingAttr, System.Reflection.PropertyInfo[] match, System.Type? returnType, System.Type[]? indexes, System.Reflection.ParameterModifier[]? modifiers);
}
[System.FlagsAttribute]
public enum BindingFlags
{
Default = 0,
IgnoreCase = 1,
DeclaredOnly = 2,
Instance = 4,
Static = 8,
Public = 16,
NonPublic = 32,
FlattenHierarchy = 64,
InvokeMethod = 256,
CreateInstance = 512,
GetField = 1024,
SetField = 2048,
GetProperty = 4096,
SetProperty = 8192,
PutDispProperty = 16384,
PutRefDispProperty = 32768,
ExactBinding = 65536,
SuppressChangeType = 131072,
OptionalParamBinding = 262144,
IgnoreReturn = 16777216,
DoNotWrapExceptions = 33554432,
}
[System.FlagsAttribute]
public enum CallingConventions
{
Standard = 1,
VarArgs = 2,
Any = 3,
HasThis = 32,
ExplicitThis = 64,
}
public abstract partial class ConstructorInfo : System.Reflection.MethodBase
{
public static readonly string ConstructorName;
public static readonly string TypeConstructorName;
protected ConstructorInfo() { }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public object Invoke(object?[]? parameters) { throw null; }
public abstract object Invoke(System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? parameters, System.Globalization.CultureInfo? culture);
public static bool operator ==(System.Reflection.ConstructorInfo? left, System.Reflection.ConstructorInfo? right) { throw null; }
public static bool operator !=(System.Reflection.ConstructorInfo? left, System.Reflection.ConstructorInfo? right) { throw null; }
}
public partial class CustomAttributeData
{
protected CustomAttributeData() { }
public virtual System.Type AttributeType { get { throw null; } }
public virtual System.Reflection.ConstructorInfo Constructor { get { throw null; } }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeTypedArgument> ConstructorArguments { get { throw null; } }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeNamedArgument> NamedArguments { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.Assembly target) { throw null; }
public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.MemberInfo target) { throw null; }
public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.Module target) { throw null; }
public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.ParameterInfo target) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public static partial class CustomAttributeExtensions
{
public static System.Attribute? GetCustomAttribute(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.Module element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Assembly element) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Module element) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Module element, System.Type attributeType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.Assembly element) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.MemberInfo element) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.MemberInfo element, bool inherit) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.Module element) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.ParameterInfo element) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.ParameterInfo element, bool inherit) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.Assembly element) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.MemberInfo element) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.MemberInfo element, bool inherit) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.Module element) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.ParameterInfo element) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.ParameterInfo element, bool inherit) where T : System.Attribute { throw null; }
public static bool IsDefined(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static bool IsDefined(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static bool IsDefined(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static bool IsDefined(this System.Reflection.Module element, System.Type attributeType) { throw null; }
public static bool IsDefined(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static bool IsDefined(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
}
public partial class CustomAttributeFormatException : System.FormatException
{
public CustomAttributeFormatException() { }
protected CustomAttributeFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public CustomAttributeFormatException(string? message) { }
public CustomAttributeFormatException(string? message, System.Exception? inner) { }
}
public readonly partial struct CustomAttributeNamedArgument : System.IEquatable<System.Reflection.CustomAttributeNamedArgument>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public CustomAttributeNamedArgument(System.Reflection.MemberInfo memberInfo, object? value) { throw null; }
public CustomAttributeNamedArgument(System.Reflection.MemberInfo memberInfo, System.Reflection.CustomAttributeTypedArgument typedArgument) { throw null; }
public bool IsField { get { throw null; } }
public System.Reflection.MemberInfo MemberInfo { get { throw null; } }
public string MemberName { get { throw null; } }
public System.Reflection.CustomAttributeTypedArgument TypedValue { get { throw null; } }
public bool Equals(System.Reflection.CustomAttributeNamedArgument other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Reflection.CustomAttributeNamedArgument left, System.Reflection.CustomAttributeNamedArgument right) { throw null; }
public static bool operator !=(System.Reflection.CustomAttributeNamedArgument left, System.Reflection.CustomAttributeNamedArgument right) { throw null; }
public override string ToString() { throw null; }
}
public readonly partial struct CustomAttributeTypedArgument : System.IEquatable<System.Reflection.CustomAttributeTypedArgument>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public CustomAttributeTypedArgument(object value) { throw null; }
public CustomAttributeTypedArgument(System.Type argumentType, object? value) { throw null; }
public System.Type ArgumentType { get { throw null; } }
public object? Value { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Reflection.CustomAttributeTypedArgument other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Reflection.CustomAttributeTypedArgument left, System.Reflection.CustomAttributeTypedArgument right) { throw null; }
public static bool operator !=(System.Reflection.CustomAttributeTypedArgument left, System.Reflection.CustomAttributeTypedArgument right) { throw null; }
public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Struct)]
public sealed partial class DefaultMemberAttribute : System.Attribute
{
public DefaultMemberAttribute(string memberName) { }
public string MemberName { get { throw null; } }
}
[System.FlagsAttribute]
public enum EventAttributes
{
None = 0,
SpecialName = 512,
ReservedMask = 1024,
RTSpecialName = 1024,
}
public abstract partial class EventInfo : System.Reflection.MemberInfo
{
protected EventInfo() { }
public virtual System.Reflection.MethodInfo? AddMethod { get { throw null; } }
public abstract System.Reflection.EventAttributes Attributes { get; }
public virtual System.Type? EventHandlerType { get { throw null; } }
public virtual bool IsMulticast { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public virtual System.Reflection.MethodInfo? RaiseMethod { get { throw null; } }
public virtual System.Reflection.MethodInfo? RemoveMethod { get { throw null; } }
public virtual void AddEventHandler(object? target, System.Delegate? handler) { }
public override bool Equals(object? obj) { throw null; }
public System.Reflection.MethodInfo? GetAddMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetAddMethod(bool nonPublic);
public override int GetHashCode() { throw null; }
public System.Reflection.MethodInfo[] GetOtherMethods() { throw null; }
public virtual System.Reflection.MethodInfo[] GetOtherMethods(bool nonPublic) { throw null; }
public System.Reflection.MethodInfo? GetRaiseMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetRaiseMethod(bool nonPublic);
public System.Reflection.MethodInfo? GetRemoveMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetRemoveMethod(bool nonPublic);
public static bool operator ==(System.Reflection.EventInfo? left, System.Reflection.EventInfo? right) { throw null; }
public static bool operator !=(System.Reflection.EventInfo? left, System.Reflection.EventInfo? right) { throw null; }
public virtual void RemoveEventHandler(object? target, System.Delegate? handler) { }
}
public partial class ExceptionHandlingClause
{
protected ExceptionHandlingClause() { }
public virtual System.Type? CatchType { get { throw null; } }
public virtual int FilterOffset { get { throw null; } }
public virtual System.Reflection.ExceptionHandlingClauseOptions Flags { get { throw null; } }
public virtual int HandlerLength { get { throw null; } }
public virtual int HandlerOffset { get { throw null; } }
public virtual int TryLength { get { throw null; } }
public virtual int TryOffset { get { throw null; } }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum ExceptionHandlingClauseOptions
{
Clause = 0,
Filter = 1,
Finally = 2,
Fault = 4,
}
[System.FlagsAttribute]
public enum FieldAttributes
{
PrivateScope = 0,
Private = 1,
FamANDAssem = 2,
Assembly = 3,
Family = 4,
FamORAssem = 5,
Public = 6,
FieldAccessMask = 7,
Static = 16,
InitOnly = 32,
Literal = 64,
NotSerialized = 128,
HasFieldRVA = 256,
SpecialName = 512,
RTSpecialName = 1024,
HasFieldMarshal = 4096,
PinvokeImpl = 8192,
HasDefault = 32768,
ReservedMask = 38144,
}
public abstract partial class FieldInfo : System.Reflection.MemberInfo
{
protected FieldInfo() { }
public abstract System.Reflection.FieldAttributes Attributes { get; }
public abstract System.RuntimeFieldHandle FieldHandle { get; }
public abstract System.Type FieldType { get; }
public bool IsAssembly { get { throw null; } }
public bool IsFamily { get { throw null; } }
public bool IsFamilyAndAssembly { get { throw null; } }
public bool IsFamilyOrAssembly { get { throw null; } }
public bool IsInitOnly { get { throw null; } }
public bool IsLiteral { get { throw null; } }
public bool IsNotSerialized { get { throw null; } }
public bool IsPinvokeImpl { get { throw null; } }
public bool IsPrivate { get { throw null; } }
public bool IsPublic { get { throw null; } }
public virtual bool IsSecurityCritical { get { throw null; } }
public virtual bool IsSecuritySafeCritical { get { throw null; } }
public virtual bool IsSecurityTransparent { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public bool IsStatic { get { throw null; } }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public static System.Reflection.FieldInfo GetFieldFromHandle(System.RuntimeFieldHandle handle) { throw null; }
public static System.Reflection.FieldInfo GetFieldFromHandle(System.RuntimeFieldHandle handle, System.RuntimeTypeHandle declaringType) { throw null; }
public override int GetHashCode() { throw null; }
public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
public virtual object? GetRawConstantValue() { throw null; }
public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
public abstract object? GetValue(object? obj);
[System.CLSCompliantAttribute(false)]
public virtual object? GetValueDirect(System.TypedReference obj) { throw null; }
public static bool operator ==(System.Reflection.FieldInfo? left, System.Reflection.FieldInfo? right) { throw null; }
public static bool operator !=(System.Reflection.FieldInfo? left, System.Reflection.FieldInfo? right) { throw null; }
public void SetValue(object? obj, object? value) { }
public abstract void SetValue(object? obj, object? value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, System.Globalization.CultureInfo? culture);
[System.CLSCompliantAttribute(false)]
public virtual void SetValueDirect(System.TypedReference obj, object value) { }
}
[System.FlagsAttribute]
public enum GenericParameterAttributes
{
None = 0,
Covariant = 1,
Contravariant = 2,
VarianceMask = 3,
ReferenceTypeConstraint = 4,
NotNullableValueTypeConstraint = 8,
DefaultConstructorConstraint = 16,
SpecialConstraintMask = 28,
}
public partial interface ICustomAttributeProvider
{
object[] GetCustomAttributes(bool inherit);
object[] GetCustomAttributes(System.Type attributeType, bool inherit);
bool IsDefined(System.Type attributeType, bool inherit);
}
public enum ImageFileMachine
{
I386 = 332,
ARM = 452,
IA64 = 512,
AMD64 = 34404,
}
public partial struct InterfaceMapping
{
public System.Reflection.MethodInfo[] InterfaceMethods;
public System.Type InterfaceType;
public System.Reflection.MethodInfo[] TargetMethods;
public System.Type TargetType;
}
public static partial class IntrospectionExtensions
{
public static System.Reflection.TypeInfo GetTypeInfo(this System.Type type) { throw null; }
}
public partial class InvalidFilterCriteriaException : System.ApplicationException
{
public InvalidFilterCriteriaException() { }
protected InvalidFilterCriteriaException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidFilterCriteriaException(string? message) { }
public InvalidFilterCriteriaException(string? message, System.Exception? inner) { }
}
public partial interface IReflect
{
System.Type UnderlyingSystemType { get; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.PropertyInfo? GetProperty(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.PropertyInfo? GetProperty(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args, System.Reflection.ParameterModifier[]? modifiers, System.Globalization.CultureInfo? culture, string[]? namedParameters);
}
public partial interface IReflectableType
{
System.Reflection.TypeInfo GetTypeInfo();
}
public partial class LocalVariableInfo
{
protected LocalVariableInfo() { }
public virtual bool IsPinned { get { throw null; } }
public virtual int LocalIndex { get { throw null; } }
public virtual System.Type LocalType { get { throw null; } }
public override string ToString() { throw null; }
}
public partial class ManifestResourceInfo
{
public ManifestResourceInfo(System.Reflection.Assembly? containingAssembly, string? containingFileName, System.Reflection.ResourceLocation resourceLocation) { }
public virtual string? FileName { get { throw null; } }
public virtual System.Reflection.Assembly? ReferencedAssembly { get { throw null; } }
public virtual System.Reflection.ResourceLocation ResourceLocation { get { throw null; } }
}
public delegate bool MemberFilter(System.Reflection.MemberInfo m, object? filterCriteria);
public abstract partial class MemberInfo : System.Reflection.ICustomAttributeProvider
{
protected MemberInfo() { }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
public abstract System.Type? DeclaringType { get; }
public virtual bool IsCollectible { get { throw null; } }
public abstract System.Reflection.MemberTypes MemberType { get; }
public virtual int MetadataToken { get { throw null; } }
public virtual System.Reflection.Module Module { get { throw null; } }
public abstract string Name { get; }
public abstract System.Type? ReflectedType { get; }
public override bool Equals(object? obj) { throw null; }
public abstract object[] GetCustomAttributes(bool inherit);
public abstract object[] GetCustomAttributes(System.Type attributeType, bool inherit);
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
public override int GetHashCode() { throw null; }
public virtual bool HasSameMetadataDefinitionAs(System.Reflection.MemberInfo other) { throw null; }
public abstract bool IsDefined(System.Type attributeType, bool inherit);
public static bool operator ==(System.Reflection.MemberInfo? left, System.Reflection.MemberInfo? right) { throw null; }
public static bool operator !=(System.Reflection.MemberInfo? left, System.Reflection.MemberInfo? right) { throw null; }
}
[System.FlagsAttribute]
public enum MemberTypes
{
Constructor = 1,
Event = 2,
Field = 4,
Method = 8,
Property = 16,
TypeInfo = 32,
Custom = 64,
NestedType = 128,
All = 191,
}
[System.FlagsAttribute]
public enum MethodAttributes
{
PrivateScope = 0,
ReuseSlot = 0,
Private = 1,
FamANDAssem = 2,
Assembly = 3,
Family = 4,
FamORAssem = 5,
Public = 6,
MemberAccessMask = 7,
UnmanagedExport = 8,
Static = 16,
Final = 32,
Virtual = 64,
HideBySig = 128,
NewSlot = 256,
VtableLayoutMask = 256,
CheckAccessOnOverride = 512,
Abstract = 1024,
SpecialName = 2048,
RTSpecialName = 4096,
PinvokeImpl = 8192,
HasSecurity = 16384,
RequireSecObject = 32768,
ReservedMask = 53248,
}
public abstract partial class MethodBase : System.Reflection.MemberInfo
{
protected MethodBase() { }
public abstract System.Reflection.MethodAttributes Attributes { get; }
public virtual System.Reflection.CallingConventions CallingConvention { get { throw null; } }
public virtual bool ContainsGenericParameters { get { throw null; } }
public bool IsAbstract { get { throw null; } }
public bool IsAssembly { get { throw null; } }
public virtual bool IsConstructedGenericMethod { get { throw null; } }
public bool IsConstructor { get { throw null; } }
public bool IsFamily { get { throw null; } }
public bool IsFamilyAndAssembly { get { throw null; } }
public bool IsFamilyOrAssembly { get { throw null; } }
public bool IsFinal { get { throw null; } }
public virtual bool IsGenericMethod { get { throw null; } }
public virtual bool IsGenericMethodDefinition { get { throw null; } }
public bool IsHideBySig { get { throw null; } }
public bool IsPrivate { get { throw null; } }
public bool IsPublic { get { throw null; } }
public virtual bool IsSecurityCritical { get { throw null; } }
public virtual bool IsSecuritySafeCritical { get { throw null; } }
public virtual bool IsSecurityTransparent { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public bool IsStatic { get { throw null; } }
public bool IsVirtual { get { throw null; } }
public abstract System.RuntimeMethodHandle MethodHandle { get; }
public virtual System.Reflection.MethodImplAttributes MethodImplementationFlags { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Metadata for the method might be incomplete or removed")]
public static System.Reflection.MethodBase? GetCurrentMethod() { throw null; }
public virtual System.Type[] GetGenericArguments() { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming may change method bodies. For example it can change some instructions, remove branches or local variables.")]
public virtual System.Reflection.MethodBody? GetMethodBody() { throw null; }
public static System.Reflection.MethodBase? GetMethodFromHandle(System.RuntimeMethodHandle handle) { throw null; }
public static System.Reflection.MethodBase? GetMethodFromHandle(System.RuntimeMethodHandle handle, System.RuntimeTypeHandle declaringType) { throw null; }
public abstract System.Reflection.MethodImplAttributes GetMethodImplementationFlags();
public abstract System.Reflection.ParameterInfo[] GetParameters();
public object? Invoke(object? obj, object?[]? parameters) { throw null; }
public abstract object? Invoke(object? obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? parameters, System.Globalization.CultureInfo? culture);
public static bool operator ==(System.Reflection.MethodBase? left, System.Reflection.MethodBase? right) { throw null; }
public static bool operator !=(System.Reflection.MethodBase? left, System.Reflection.MethodBase? right) { throw null; }
}
public partial class MethodBody
{
protected MethodBody() { }
public virtual System.Collections.Generic.IList<System.Reflection.ExceptionHandlingClause> ExceptionHandlingClauses { get { throw null; } }
public virtual bool InitLocals { get { throw null; } }
public virtual int LocalSignatureMetadataToken { get { throw null; } }
public virtual System.Collections.Generic.IList<System.Reflection.LocalVariableInfo> LocalVariables { get { throw null; } }
public virtual int MaxStackSize { get { throw null; } }
public virtual byte[]? GetILAsByteArray() { throw null; }
}
public enum MethodImplAttributes
{
IL = 0,
Managed = 0,
Native = 1,
OPTIL = 2,
CodeTypeMask = 3,
Runtime = 3,
ManagedMask = 4,
Unmanaged = 4,
NoInlining = 8,
ForwardRef = 16,
Synchronized = 32,
NoOptimization = 64,
PreserveSig = 128,
AggressiveInlining = 256,
AggressiveOptimization = 512,
InternalCall = 4096,
MaxMethodImplVal = 65535,
}
public abstract partial class MethodInfo : System.Reflection.MethodBase
{
protected MethodInfo() { }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public virtual System.Reflection.ParameterInfo ReturnParameter { get { throw null; } }
public virtual System.Type ReturnType { get { throw null; } }
public abstract System.Reflection.ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
public virtual System.Delegate CreateDelegate(System.Type delegateType) { throw null; }
public virtual System.Delegate CreateDelegate(System.Type delegateType, object? target) { throw null; }
public T CreateDelegate<T>() where T : System.Delegate { throw null; }
public T CreateDelegate<T>(object? target) where T : System.Delegate { throw null; }
public override bool Equals(object? obj) { throw null; }
public abstract System.Reflection.MethodInfo GetBaseDefinition();
public override System.Type[] GetGenericArguments() { throw null; }
public virtual System.Reflection.MethodInfo GetGenericMethodDefinition() { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The native code for this instantiation might not be available at runtime.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]
public virtual System.Reflection.MethodInfo MakeGenericMethod(params System.Type[] typeArguments) { throw null; }
public static bool operator ==(System.Reflection.MethodInfo? left, System.Reflection.MethodInfo? right) { throw null; }
public static bool operator !=(System.Reflection.MethodInfo? left, System.Reflection.MethodInfo? right) { throw null; }
}
public sealed partial class Missing : System.Runtime.Serialization.ISerializable
{
internal Missing() { }
public static readonly System.Reflection.Missing Value;
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public abstract partial class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
{
public static readonly System.Reflection.TypeFilter FilterTypeName;
public static readonly System.Reflection.TypeFilter FilterTypeNameIgnoreCase;
protected Module() { }
public virtual System.Reflection.Assembly Assembly { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("Returns <Unknown> for modules with no file path")]
public virtual string FullyQualifiedName { get { throw null; } }
public virtual int MDStreamVersion { get { throw null; } }
public virtual int MetadataToken { get { throw null; } }
public System.ModuleHandle ModuleHandle { get { throw null; } }
public virtual System.Guid ModuleVersionId { get { throw null; } }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("Returns <Unknown> for modules with no file path")]
public virtual string Name { get { throw null; } }
public virtual string ScopeName { get { throw null; } }
public override bool Equals(object? o) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] FindTypes(System.Reflection.TypeFilter? filter, object? filterCriteria) { throw null; }
public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Fields might be removed")]
public System.Reflection.FieldInfo? GetField(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Fields might be removed")]
public virtual System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Fields might be removed")]
public System.Reflection.FieldInfo[] GetFields() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Fields might be removed")]
public virtual System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingFlags) { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
protected virtual System.Reflection.MethodInfo? GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public System.Reflection.MethodInfo[] GetMethods() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public virtual System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingFlags) { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public virtual void GetPEKind(out System.Reflection.PortableExecutableKinds peKind, out System.Reflection.ImageFileMachine machine) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string className) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string className, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string className, bool throwOnError, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] GetTypes() { throw null; }
public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
public virtual bool IsResource() { throw null; }
public static bool operator ==(System.Reflection.Module? left, System.Reflection.Module? right) { throw null; }
public static bool operator !=(System.Reflection.Module? left, System.Reflection.Module? right) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.Reflection.FieldInfo? ResolveField(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual System.Reflection.FieldInfo? ResolveField(int metadataToken, System.Type[]? genericTypeArguments, System.Type[]? genericMethodArguments) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.Reflection.MemberInfo? ResolveMember(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual System.Reflection.MemberInfo? ResolveMember(int metadataToken, System.Type[]? genericTypeArguments, System.Type[]? genericMethodArguments) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.Reflection.MethodBase? ResolveMethod(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual System.Reflection.MethodBase? ResolveMethod(int metadataToken, System.Type[]? genericTypeArguments, System.Type[]? genericMethodArguments) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual byte[] ResolveSignature(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual string ResolveString(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.Type ResolveType(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual System.Type ResolveType(int metadataToken, System.Type[]? genericTypeArguments, System.Type[]? genericMethodArguments) { throw null; }
public override string ToString() { throw null; }
}
public delegate System.Reflection.Module ModuleResolveEventHandler(object sender, System.ResolveEventArgs e);
public sealed partial class NullabilityInfo
{
internal NullabilityInfo() { }
public System.Reflection.NullabilityInfo? ElementType { get { throw null; } }
public System.Reflection.NullabilityInfo[] GenericTypeArguments { get { throw null; } }
public System.Reflection.NullabilityState ReadState { get { throw null; } }
public System.Type Type { get { throw null; } }
public System.Reflection.NullabilityState WriteState { get { throw null; } }
}
public sealed partial class NullabilityInfoContext
{
public NullabilityInfoContext() { }
public System.Reflection.NullabilityInfo Create(System.Reflection.EventInfo eventInfo) { throw null; }
public System.Reflection.NullabilityInfo Create(System.Reflection.FieldInfo fieldInfo) { throw null; }
public System.Reflection.NullabilityInfo Create(System.Reflection.ParameterInfo parameterInfo) { throw null; }
public System.Reflection.NullabilityInfo Create(System.Reflection.PropertyInfo propertyInfo) { throw null; }
}
public enum NullabilityState
{
Unknown = 0,
NotNull = 1,
Nullable = 2,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class ObfuscateAssemblyAttribute : System.Attribute
{
public ObfuscateAssemblyAttribute(bool assemblyIsPrivate) { }
public bool AssemblyIsPrivate { get { throw null; } }
public bool StripAfterObfuscation { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed partial class ObfuscationAttribute : System.Attribute
{
public ObfuscationAttribute() { }
public bool ApplyToMembers { get { throw null; } set { } }
public bool Exclude { get { throw null; } set { } }
public string? Feature { get { throw null; } set { } }
public bool StripAfterObfuscation { get { throw null; } set { } }
}
[System.FlagsAttribute]
public enum ParameterAttributes
{
None = 0,
In = 1,
Out = 2,
Lcid = 4,
Retval = 8,
Optional = 16,
HasDefault = 4096,
HasFieldMarshal = 8192,
Reserved3 = 16384,
Reserved4 = 32768,
ReservedMask = 61440,
}
public partial class ParameterInfo : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.IObjectReference
{
protected System.Reflection.ParameterAttributes AttrsImpl;
protected System.Type? ClassImpl;
protected object? DefaultValueImpl;
protected System.Reflection.MemberInfo MemberImpl;
protected string? NameImpl;
protected int PositionImpl;
protected ParameterInfo() { }
public virtual System.Reflection.ParameterAttributes Attributes { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
public virtual object? DefaultValue { get { throw null; } }
public virtual bool HasDefaultValue { get { throw null; } }
public bool IsIn { get { throw null; } }
public bool IsLcid { get { throw null; } }
public bool IsOptional { get { throw null; } }
public bool IsOut { get { throw null; } }
public bool IsRetval { get { throw null; } }
public virtual System.Reflection.MemberInfo Member { get { throw null; } }
public virtual int MetadataToken { get { throw null; } }
public virtual string? Name { get { throw null; } }
public virtual System.Type ParameterType { get { throw null; } }
public virtual int Position { get { throw null; } }
public virtual object? RawDefaultValue { get { throw null; } }
public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
public object GetRealObject(System.Runtime.Serialization.StreamingContext context) { throw null; }
public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
public override string ToString() { throw null; }
}
public readonly partial struct ParameterModifier
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ParameterModifier(int parameterCount) { throw null; }
public bool this[int index] { get { throw null; } set { } }
}
[System.CLSCompliantAttribute(false)]
public sealed partial class Pointer : System.Runtime.Serialization.ISerializable
{
internal Pointer() { }
public unsafe static object Box(void* ptr, System.Type type) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public unsafe static void* Unbox(object ptr) { throw null; }
}
[System.FlagsAttribute]
public enum PortableExecutableKinds
{
NotAPortableExecutableImage = 0,
ILOnly = 1,
Required32Bit = 2,
PE32Plus = 4,
Unmanaged32Bit = 8,
Preferred32Bit = 16,
}
public enum ProcessorArchitecture
{
None = 0,
MSIL = 1,
X86 = 2,
IA64 = 3,
Amd64 = 4,
Arm = 5,
}
[System.FlagsAttribute]
public enum PropertyAttributes
{
None = 0,
SpecialName = 512,
RTSpecialName = 1024,
HasDefault = 4096,
Reserved2 = 8192,
Reserved3 = 16384,
Reserved4 = 32768,
ReservedMask = 62464,
}
public abstract partial class PropertyInfo : System.Reflection.MemberInfo
{
protected PropertyInfo() { }
public abstract System.Reflection.PropertyAttributes Attributes { get; }
public abstract bool CanRead { get; }
public abstract bool CanWrite { get; }
public virtual System.Reflection.MethodInfo? GetMethod { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public abstract System.Type PropertyType { get; }
public virtual System.Reflection.MethodInfo? SetMethod { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public System.Reflection.MethodInfo[] GetAccessors() { throw null; }
public abstract System.Reflection.MethodInfo[] GetAccessors(bool nonPublic);
public virtual object? GetConstantValue() { throw null; }
public System.Reflection.MethodInfo? GetGetMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetGetMethod(bool nonPublic);
public override int GetHashCode() { throw null; }
public abstract System.Reflection.ParameterInfo[] GetIndexParameters();
public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
public virtual object? GetRawConstantValue() { throw null; }
public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
public System.Reflection.MethodInfo? GetSetMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetSetMethod(bool nonPublic);
public object? GetValue(object? obj) { throw null; }
public virtual object? GetValue(object? obj, object?[]? index) { throw null; }
public abstract object? GetValue(object? obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? index, System.Globalization.CultureInfo? culture);
public static bool operator ==(System.Reflection.PropertyInfo? left, System.Reflection.PropertyInfo? right) { throw null; }
public static bool operator !=(System.Reflection.PropertyInfo? left, System.Reflection.PropertyInfo? right) { throw null; }
public void SetValue(object? obj, object? value) { }
public virtual void SetValue(object? obj, object? value, object?[]? index) { }
public abstract void SetValue(object? obj, object? value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? index, System.Globalization.CultureInfo? culture);
}
public abstract partial class ReflectionContext
{
protected ReflectionContext() { }
public virtual System.Reflection.TypeInfo GetTypeForObject(object value) { throw null; }
public abstract System.Reflection.Assembly MapAssembly(System.Reflection.Assembly assembly);
public abstract System.Reflection.TypeInfo MapType(System.Reflection.TypeInfo type);
}
public sealed partial class ReflectionTypeLoadException : System.SystemException, System.Runtime.Serialization.ISerializable
{
public ReflectionTypeLoadException(System.Type?[]? classes, System.Exception?[]? exceptions) { }
public ReflectionTypeLoadException(System.Type?[]? classes, System.Exception?[]? exceptions, string? message) { }
public System.Exception?[] LoaderExceptions { get { throw null; } }
public override string Message { get { throw null; } }
public System.Type?[] Types { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum ResourceAttributes
{
Public = 1,
Private = 2,
}
[System.FlagsAttribute]
public enum ResourceLocation
{
Embedded = 1,
ContainedInAnotherAssembly = 2,
ContainedInManifestFile = 4,
}
public static partial class RuntimeReflectionExtensions
{
public static System.Reflection.MethodInfo GetMethodInfo(this System.Delegate del) { throw null; }
public static System.Reflection.MethodInfo? GetRuntimeBaseDefinition(this System.Reflection.MethodInfo method) { throw null; }
public static System.Reflection.EventInfo? GetRuntimeEvent([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)] this System.Type type, string name) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Reflection.EventInfo> GetRuntimeEvents([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)] this System.Type type) { throw null; }
public static System.Reflection.FieldInfo? GetRuntimeField([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)] this System.Type type, string name) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Reflection.FieldInfo> GetRuntimeFields([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)] this System.Type type) { throw null; }
public static System.Reflection.InterfaceMapping GetRuntimeInterfaceMap(this System.Reflection.TypeInfo typeInfo, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type interfaceType) { throw null; }
public static System.Reflection.MethodInfo? GetRuntimeMethod([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] this System.Type type, string name, System.Type[] parameters) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> GetRuntimeMethods([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] this System.Type type) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo> GetRuntimeProperties([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] this System.Type type) { throw null; }
public static System.Reflection.PropertyInfo? GetRuntimeProperty([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] this System.Type type, string name) { throw null; }
}
[System.ObsoleteAttribute("Strong name signing is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0017", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial class StrongNameKeyPair : System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
public StrongNameKeyPair(byte[] keyPairArray) { }
public StrongNameKeyPair(System.IO.FileStream keyPairFile) { }
protected StrongNameKeyPair(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public StrongNameKeyPair(string keyPairContainer) { }
public byte[] PublicKey { get { throw null; } }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class TargetException : System.ApplicationException
{
public TargetException() { }
protected TargetException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TargetException(string? message) { }
public TargetException(string? message, System.Exception? inner) { }
}
public sealed partial class TargetInvocationException : System.ApplicationException
{
public TargetInvocationException(System.Exception? inner) { }
public TargetInvocationException(string? message, System.Exception? inner) { }
}
public sealed partial class TargetParameterCountException : System.ApplicationException
{
public TargetParameterCountException() { }
public TargetParameterCountException(string? message) { }
public TargetParameterCountException(string? message, System.Exception? inner) { }
}
[System.FlagsAttribute]
public enum TypeAttributes
{
AnsiClass = 0,
AutoLayout = 0,
Class = 0,
NotPublic = 0,
Public = 1,
NestedPublic = 2,
NestedPrivate = 3,
NestedFamily = 4,
NestedAssembly = 5,
NestedFamANDAssem = 6,
NestedFamORAssem = 7,
VisibilityMask = 7,
SequentialLayout = 8,
ExplicitLayout = 16,
LayoutMask = 24,
ClassSemanticsMask = 32,
Interface = 32,
Abstract = 128,
Sealed = 256,
SpecialName = 1024,
RTSpecialName = 2048,
Import = 4096,
Serializable = 8192,
WindowsRuntime = 16384,
UnicodeClass = 65536,
AutoClass = 131072,
CustomFormatClass = 196608,
StringFormatMask = 196608,
HasSecurity = 262144,
ReservedMask = 264192,
BeforeFieldInit = 1048576,
CustomFormatMask = 12582912,
}
public partial class TypeDelegator : System.Reflection.TypeInfo
{
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
protected System.Type typeImpl;
protected TypeDelegator() { }
public TypeDelegator([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type delegatingType) { }
public override System.Reflection.Assembly Assembly { get { throw null; } }
public override string? AssemblyQualifiedName { get { throw null; } }
public override System.Type? BaseType { get { throw null; } }
public override string? FullName { get { throw null; } }
public override System.Guid GUID { get { throw null; } }
public override bool IsByRefLike { get { throw null; } }
public override bool IsCollectible { get { throw null; } }
public override bool IsConstructedGenericType { get { throw null; } }
public override bool IsGenericMethodParameter { get { throw null; } }
public override bool IsGenericTypeParameter { get { throw null; } }
public override bool IsSZArray { get { throw null; } }
public override bool IsTypeDefinition { get { throw null; } }
public override bool IsVariableBoundArray { get { throw null; } }
public override int MetadataToken { get { throw null; } }
public override System.Reflection.Module Module { get { throw null; } }
public override string Name { get { throw null; } }
public override string? Namespace { get { throw null; } }
public override System.RuntimeTypeHandle TypeHandle { get { throw null; } }
public override System.Type UnderlyingSystemType { get { throw null; } }
protected override System.Reflection.TypeAttributes GetAttributeFlagsImpl() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
protected override System.Reflection.ConstructorInfo? GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public override System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr) { throw null; }
public override object[] GetCustomAttributes(bool inherit) { throw null; }
public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public override System.Type? GetElementType() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public override System.Reflection.EventInfo? GetEvent(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public override System.Reflection.EventInfo[] GetEvents() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public override System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public override System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
[return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public override System.Type? GetInterface(string name, bool ignoreCase) { throw null; }
public override System.Reflection.InterfaceMapping GetInterfaceMap([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type interfaceType) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public override System.Type[] GetInterfaces() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public override System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public override System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr) { throw null; }
public override System.Reflection.MemberInfo GetMemberWithSameMetadataDefinitionAs(System.Reflection.MemberInfo member) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
protected override System.Reflection.MethodInfo? GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public override System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public override System.Type? GetNestedType(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public override System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public override System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
protected override System.Reflection.PropertyInfo? GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
protected override bool HasElementTypeImpl() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public override object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args, System.Reflection.ParameterModifier[]? modifiers, System.Globalization.CultureInfo? culture, string[]? namedParameters) { throw null; }
protected override bool IsArrayImpl() { throw null; }
public override bool IsAssignableFrom([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Reflection.TypeInfo? typeInfo) { throw null; }
protected override bool IsByRefImpl() { throw null; }
protected override bool IsCOMObjectImpl() { throw null; }
public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
protected override bool IsPointerImpl() { throw null; }
protected override bool IsPrimitiveImpl() { throw null; }
protected override bool IsValueTypeImpl() { throw null; }
}
public delegate bool TypeFilter(System.Type m, object? filterCriteria);
public abstract partial class TypeInfo : System.Type, System.Reflection.IReflectableType
{
protected TypeInfo() { }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.ConstructorInfo> DeclaredConstructors { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.EventInfo> DeclaredEvents { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.FieldInfo> DeclaredFields { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.MemberInfo> DeclaredMembers { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> DeclaredMethods { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.TypeInfo> DeclaredNestedTypes { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo> DeclaredProperties { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] get { throw null; } }
public virtual System.Type[] GenericTypeParameters { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Type> ImplementedInterfaces { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] get { throw null; } }
public virtual System.Type AsType() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public virtual System.Reflection.EventInfo? GetDeclaredEvent(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public virtual System.Reflection.FieldInfo? GetDeclaredField(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public virtual System.Reflection.MethodInfo? GetDeclaredMethod(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public virtual System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> GetDeclaredMethods(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public virtual System.Reflection.TypeInfo? GetDeclaredNestedType(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public virtual System.Reflection.PropertyInfo? GetDeclaredProperty(string name) { throw null; }
public virtual bool IsAssignableFrom([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Reflection.TypeInfo? typeInfo) { throw null; }
System.Reflection.TypeInfo System.Reflection.IReflectableType.GetTypeInfo() { throw null; }
}
}
namespace System.Resources
{
public partial interface IResourceReader : System.Collections.IEnumerable, System.IDisposable
{
void Close();
new System.Collections.IDictionaryEnumerator GetEnumerator();
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public partial class MissingManifestResourceException : System.SystemException
{
public MissingManifestResourceException() { }
protected MissingManifestResourceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingManifestResourceException(string? message) { }
public MissingManifestResourceException(string? message, System.Exception? inner) { }
}
public partial class MissingSatelliteAssemblyException : System.SystemException
{
public MissingSatelliteAssemblyException() { }
protected MissingSatelliteAssemblyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingSatelliteAssemblyException(string? message) { }
public MissingSatelliteAssemblyException(string? message, System.Exception? inner) { }
public MissingSatelliteAssemblyException(string? message, string? cultureName) { }
public string? CultureName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class NeutralResourcesLanguageAttribute : System.Attribute
{
public NeutralResourcesLanguageAttribute(string cultureName) { }
public NeutralResourcesLanguageAttribute(string cultureName, System.Resources.UltimateResourceFallbackLocation location) { }
public string CultureName { get { throw null; } }
public System.Resources.UltimateResourceFallbackLocation Location { get { throw null; } }
}
public partial class ResourceManager
{
public static readonly int HeaderVersionNumber;
public static readonly int MagicNumber;
protected System.Reflection.Assembly? MainAssembly;
protected ResourceManager() { }
public ResourceManager(string baseName, System.Reflection.Assembly assembly) { }
public ResourceManager(string baseName, System.Reflection.Assembly assembly, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type? usingResourceSet) { }
public ResourceManager(System.Type resourceSource) { }
public virtual string BaseName { get { throw null; } }
protected System.Resources.UltimateResourceFallbackLocation FallbackLocation { get { throw null; } set { } }
public virtual bool IgnoreCase { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public virtual System.Type ResourceSetType { get { throw null; } }
public static System.Resources.ResourceManager CreateFileBasedResourceManager(string baseName, string resourceDir, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type? usingResourceSet) { throw null; }
protected static System.Globalization.CultureInfo GetNeutralResourcesLanguage(System.Reflection.Assembly a) { throw null; }
public virtual object? GetObject(string name) { throw null; }
public virtual object? GetObject(string name, System.Globalization.CultureInfo? culture) { throw null; }
protected virtual string GetResourceFileName(System.Globalization.CultureInfo culture) { throw null; }
public virtual System.Resources.ResourceSet? GetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents) { throw null; }
protected static System.Version? GetSatelliteContractVersion(System.Reflection.Assembly a) { throw null; }
public System.IO.UnmanagedMemoryStream? GetStream(string name) { throw null; }
public System.IO.UnmanagedMemoryStream? GetStream(string name, System.Globalization.CultureInfo? culture) { throw null; }
public virtual string? GetString(string name) { throw null; }
public virtual string? GetString(string name, System.Globalization.CultureInfo? culture) { throw null; }
protected virtual System.Resources.ResourceSet? InternalGetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents) { throw null; }
public virtual void ReleaseAllResources() { }
}
public sealed partial class ResourceReader : System.Collections.IEnumerable, System.IDisposable, System.Resources.IResourceReader
{
public ResourceReader(System.IO.Stream stream) { }
public ResourceReader(string fileName) { }
public void Close() { }
public void Dispose() { }
public System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
public void GetResourceData(string resourceName, out string resourceType, out byte[] resourceData) { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial class ResourceSet : System.Collections.IEnumerable, System.IDisposable
{
protected ResourceSet() { }
public ResourceSet(System.IO.Stream stream) { }
public ResourceSet(System.Resources.IResourceReader reader) { }
public ResourceSet(string fileName) { }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual System.Type GetDefaultReader() { throw null; }
public virtual System.Type GetDefaultWriter() { throw null; }
public virtual System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
public virtual object? GetObject(string name) { throw null; }
public virtual object? GetObject(string name, bool ignoreCase) { throw null; }
public virtual string? GetString(string name) { throw null; }
public virtual string? GetString(string name, bool ignoreCase) { throw null; }
protected virtual void ReadResources() { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class SatelliteContractVersionAttribute : System.Attribute
{
public SatelliteContractVersionAttribute(string version) { }
public string Version { get { throw null; } }
}
public enum UltimateResourceFallbackLocation
{
MainAssembly = 0,
Satellite = 1,
}
}
namespace System.Runtime
{
public sealed partial class AmbiguousImplementationException : System.Exception
{
public AmbiguousImplementationException() { }
public AmbiguousImplementationException(string? message) { }
public AmbiguousImplementationException(string? message, System.Exception? innerException) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyTargetedPatchBandAttribute : System.Attribute
{
public AssemblyTargetedPatchBandAttribute(string targetedPatchBand) { }
public string TargetedPatchBand { get { throw null; } }
}
public partial struct DependentHandle : System.IDisposable
{
private object _dummy;
private int _dummyPrimitive;
public DependentHandle(object? target, object? dependent) { throw null; }
public object? Dependent { get { throw null; } set { } }
public bool IsAllocated { get { throw null; } }
public object? Target { get { throw null; } set { } }
public (object? Target, object? Dependent) TargetAndDependent { get { throw null; } }
public void Dispose() { }
}
public enum GCLargeObjectHeapCompactionMode
{
Default = 1,
CompactOnce = 2,
}
public enum GCLatencyMode
{
Batch = 0,
Interactive = 1,
LowLatency = 2,
SustainedLowLatency = 3,
NoGCRegion = 4,
}
public static partial class GCSettings
{
public static bool IsServerGC { get { throw null; } }
public static System.Runtime.GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode { get { throw null; } set { } }
public static System.Runtime.GCLatencyMode LatencyMode { get { throw null; } set { } }
}
public static partial class JitInfo
{
public static System.TimeSpan GetCompilationTime(bool currentThread = false) { throw null; }
public static long GetCompiledILBytes(bool currentThread = false) { throw null; }
public static long GetCompiledMethodCount(bool currentThread = false) { throw null; }
}
public sealed partial class MemoryFailPoint : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
{
public MemoryFailPoint(int sizeInMegabytes) { }
public void Dispose() { }
~MemoryFailPoint() { }
}
public static partial class ProfileOptimization
{
public static void SetProfileRoot(string directoryPath) { }
public static void StartProfile(string? profile) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed partial class TargetedPatchingOptOutAttribute : System.Attribute
{
public TargetedPatchingOptOutAttribute(string reason) { }
public string Reason { get { throw null; } }
}
}
namespace System.Runtime.CompilerServices
{
[System.AttributeUsageAttribute(System.AttributeTargets.Field)]
public sealed partial class AccessedThroughPropertyAttribute : System.Attribute
{
public AccessedThroughPropertyAttribute(string propertyName) { }
public string PropertyName { get { throw null; } }
}
public partial struct AsyncIteratorMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void Complete() { }
public static System.Runtime.CompilerServices.AsyncIteratorMethodBuilder Create() { throw null; }
public void MoveNext<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public sealed partial class AsyncIteratorStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
{
public AsyncIteratorStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
public sealed partial class AsyncMethodBuilderAttribute : System.Attribute
{
public AsyncMethodBuilderAttribute(System.Type builderType) { }
public System.Type BuilderType { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public sealed partial class AsyncStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
{
public AsyncStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
}
public partial struct AsyncTaskMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.Task Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncTaskMethodBuilder Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct AsyncTaskMethodBuilder<TResult>
{
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.Task<TResult> Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult> Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult(TResult result) { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct AsyncValueTaskMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.ValueTask Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct AsyncValueTaskMethodBuilder<TResult>
{
private TResult _result;
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.ValueTask<TResult> Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<TResult> Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult(TResult result) { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct AsyncVoidMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncVoidMethodBuilder Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial class CallConvCdecl
{
public CallConvCdecl() { }
}
public partial class CallConvFastcall
{
public CallConvFastcall() { }
}
public partial class CallConvMemberFunction
{
public CallConvMemberFunction() { }
}
public partial class CallConvStdcall
{
public CallConvStdcall() { }
}
public partial class CallConvSuppressGCTransition
{
public CallConvSuppressGCTransition() { }
}
public partial class CallConvThiscall
{
public CallConvThiscall() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)]
public sealed partial class CallerArgumentExpressionAttribute : System.Attribute
{
public CallerArgumentExpressionAttribute(string parameterName) { }
public string ParameterName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class CallerFilePathAttribute : System.Attribute
{
public CallerFilePathAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class CallerLineNumberAttribute : System.Attribute
{
public CallerLineNumberAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class CallerMemberNameAttribute : System.Attribute
{
public CallerMemberNameAttribute() { }
}
[System.FlagsAttribute]
public enum CompilationRelaxations
{
NoStringInterning = 8,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method | System.AttributeTargets.Module)]
public partial class CompilationRelaxationsAttribute : System.Attribute
{
public CompilationRelaxationsAttribute(int relaxations) { }
public CompilationRelaxationsAttribute(System.Runtime.CompilerServices.CompilationRelaxations relaxations) { }
public int CompilationRelaxations { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=true)]
public sealed partial class CompilerGeneratedAttribute : System.Attribute
{
public CompilerGeneratedAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class)]
public partial class CompilerGlobalScopeAttribute : System.Attribute
{
public CompilerGlobalScopeAttribute() { }
}
public sealed partial class ConditionalWeakTable<TKey, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]TValue> : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerable where TKey : class where TValue : class?
{
public ConditionalWeakTable() { }
public void Add(TKey key, TValue value) { }
public void AddOrUpdate(TKey key, TValue value) { }
public void Clear() { }
public TValue GetOrCreateValue(TKey key) { throw null; }
public TValue GetValue(TKey key, System.Runtime.CompilerServices.ConditionalWeakTable<TKey, TValue>.CreateValueCallback createValueCallback) { throw null; }
public bool Remove(TKey key) { throw null; }
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; }
public delegate TValue CreateValueCallback(TKey key);
}
public readonly partial struct ConfiguredAsyncDisposable
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable DisposeAsync() { throw null; }
}
public readonly partial struct ConfiguredCancelableAsyncEnumerable<T>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T>.Enumerator GetAsyncEnumerator() { throw null; }
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> WithCancellation(System.Threading.CancellationToken cancellationToken) { throw null; }
public readonly partial struct Enumerator
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public T Current { get { throw null; } }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable DisposeAsync() { throw null; }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<bool> MoveNextAsync() { throw null; }
}
}
public readonly partial struct ConfiguredTaskAwaitable
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter GetAwaiter() { throw null; }
public readonly partial struct ConfiguredTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
public readonly partial struct ConfiguredTaskAwaitable<TResult>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter GetAwaiter() { throw null; }
public readonly partial struct ConfiguredTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public TResult GetResult() { throw null; }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
public readonly partial struct ConfiguredValueTaskAwaitable
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter GetAwaiter() { throw null; }
public readonly partial struct ConfiguredValueTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
public readonly partial struct ConfiguredValueTaskAwaitable<TResult>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult>.ConfiguredValueTaskAwaiter GetAwaiter() { throw null; }
public readonly partial struct ConfiguredValueTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public TResult GetResult() { throw null; }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter, Inherited=false)]
public abstract partial class CustomConstantAttribute : System.Attribute
{
protected CustomConstantAttribute() { }
public abstract object? Value { get; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class DateTimeConstantAttribute : System.Runtime.CompilerServices.CustomConstantAttribute
{
public DateTimeConstantAttribute(long ticks) { }
public override object Value { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class DecimalConstantAttribute : System.Attribute
{
public DecimalConstantAttribute(byte scale, byte sign, int hi, int mid, int low) { }
[System.CLSCompliantAttribute(false)]
public DecimalConstantAttribute(byte scale, byte sign, uint hi, uint mid, uint low) { }
public decimal Value { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly)]
public sealed partial class DefaultDependencyAttribute : System.Attribute
{
public DefaultDependencyAttribute(System.Runtime.CompilerServices.LoadHint loadHintArgument) { }
public System.Runtime.CompilerServices.LoadHint LoadHint { get { throw null; } }
}
[System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute]
public ref partial struct DefaultInterpolatedStringHandler
{
private object _dummy;
private int _dummyPrimitive;
public DefaultInterpolatedStringHandler(int literalLength, int formattedCount) { throw null; }
public DefaultInterpolatedStringHandler(int literalLength, int formattedCount, System.IFormatProvider? provider) { throw null; }
public DefaultInterpolatedStringHandler(int literalLength, int formattedCount, System.IFormatProvider? provider, System.Span<char> initialBuffer) { throw null; }
public void AppendFormatted(object? value, int alignment = 0, string? format = null) { }
public void AppendFormatted(System.ReadOnlySpan<char> value) { }
public void AppendFormatted(System.ReadOnlySpan<char> value, int alignment = 0, string? format = null) { }
public void AppendFormatted(string? value) { }
public void AppendFormatted(string? value, int alignment = 0, string? format = null) { }
public void AppendFormatted<T>(T value) { }
public void AppendFormatted<T>(T value, int alignment) { }
public void AppendFormatted<T>(T value, int alignment, string? format) { }
public void AppendFormatted<T>(T value, string? format) { }
public void AppendLiteral(string value) { }
public override string ToString() { throw null; }
public string ToStringAndClear() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true)]
public sealed partial class DependencyAttribute : System.Attribute
{
public DependencyAttribute(string dependentAssemblyArgument, System.Runtime.CompilerServices.LoadHint loadHintArgument) { }
public string DependentAssembly { get { throw null; } }
public System.Runtime.CompilerServices.LoadHint LoadHint { get { throw null; } }
}
[System.ObsoleteAttribute("DisablePrivateReflectionAttribute has no effect in .NET 6.0+.", DiagnosticId = "SYSLIB0015", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class DisablePrivateReflectionAttribute : System.Attribute
{
public DisablePrivateReflectionAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
public sealed class DisableRuntimeMarshallingAttribute : Attribute
{
public DisableRuntimeMarshallingAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All)]
public partial class DiscardableAttribute : System.Attribute
{
public DiscardableAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class EnumeratorCancellationAttribute : System.Attribute
{
public EnumeratorCancellationAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method)]
public sealed partial class ExtensionAttribute : System.Attribute
{
public ExtensionAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field)]
public sealed partial class FixedAddressValueTypeAttribute : System.Attribute
{
public FixedAddressValueTypeAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public sealed partial class FixedBufferAttribute : System.Attribute
{
public FixedBufferAttribute(System.Type elementType, int length) { }
public System.Type ElementType { get { throw null; } }
public int Length { get { throw null; } }
}
public static partial class FormattableStringFactory
{
public static System.FormattableString Create(string format, params object?[] arguments) { throw null; }
}
public partial interface IAsyncStateMachine
{
void MoveNext();
void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine);
}
public partial interface ICriticalNotifyCompletion : System.Runtime.CompilerServices.INotifyCompletion
{
void UnsafeOnCompleted(System.Action continuation);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property, Inherited=true)]
public sealed partial class IndexerNameAttribute : System.Attribute
{
public IndexerNameAttribute(string indexerName) { }
}
public partial interface INotifyCompletion
{
void OnCompleted(System.Action continuation);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed partial class InternalsVisibleToAttribute : System.Attribute
{
public InternalsVisibleToAttribute(string assemblyName) { }
public bool AllInternalsVisible { get { throw null; } set { } }
public string AssemblyName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)]
public sealed partial class InterpolatedStringHandlerArgumentAttribute : System.Attribute
{
public InterpolatedStringHandlerArgumentAttribute(string argument) { }
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { }
public string[] Arguments { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed partial class InterpolatedStringHandlerAttribute : System.Attribute
{
public InterpolatedStringHandlerAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Struct)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class IsByRefLikeAttribute : System.Attribute
{
public IsByRefLikeAttribute() { }
}
public static partial class IsConst
{
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static partial class IsExternalInit
{
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class IsReadOnlyAttribute : System.Attribute
{
public IsReadOnlyAttribute() { }
}
public partial interface IStrongBox
{
object? Value { get; set; }
}
public static partial class IsVolatile
{
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public sealed partial class IteratorStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
{
public IteratorStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
}
public partial interface ITuple
{
object? this[int index] { get; }
int Length { get; }
}
public enum LoadHint
{
Default = 0,
Always = 1,
Sometimes = 2,
}
public enum MethodCodeType
{
IL = 0,
Native = 1,
OPTIL = 2,
Runtime = 3,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class MethodImplAttribute : System.Attribute
{
public System.Runtime.CompilerServices.MethodCodeType MethodCodeType;
public MethodImplAttribute() { }
public MethodImplAttribute(short value) { }
public MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions methodImplOptions) { }
public System.Runtime.CompilerServices.MethodImplOptions Value { get { throw null; } }
}
[System.FlagsAttribute]
public enum MethodImplOptions
{
Unmanaged = 4,
NoInlining = 8,
ForwardRef = 16,
Synchronized = 32,
NoOptimization = 64,
PreserveSig = 128,
AggressiveInlining = 256,
AggressiveOptimization = 512,
InternalCall = 4096,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class ModuleInitializerAttribute : System.Attribute
{
public ModuleInitializerAttribute() { }
}
public partial struct PoolingAsyncValueTaskMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.ValueTask Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct PoolingAsyncValueTaskMethodBuilder<TResult>
{
private TResult _result;
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.ValueTask<TResult> Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder<TResult> Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult(TResult result) { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed partial class PreserveBaseOverridesAttribute : System.Attribute
{
public PreserveBaseOverridesAttribute() { }
}
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class RequiredMemberAttribute : System.Attribute
{
public RequiredMemberAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed partial class ReferenceAssemblyAttribute : System.Attribute
{
public ReferenceAssemblyAttribute() { }
public ReferenceAssemblyAttribute(string? description) { }
public string? Description { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false, AllowMultiple=false)]
public sealed partial class RuntimeCompatibilityAttribute : System.Attribute
{
public RuntimeCompatibilityAttribute() { }
public bool WrapNonExceptionThrows { get { throw null; } set { } }
}
public static partial class RuntimeFeature
{
public const string ByRefFields = "ByRefFields";
public const string CovariantReturnsOfClasses = "CovariantReturnsOfClasses";
public const string DefaultImplementationsOfInterfaces = "DefaultImplementationsOfInterfaces";
public const string PortablePdb = "PortablePdb";
public const string UnmanagedSignatureCallingConvention = "UnmanagedSignatureCallingConvention";
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public const string VirtualStaticsInInterfaces = "VirtualStaticsInInterfaces";
public static bool IsDynamicCodeCompiled { get { throw null; } }
public static bool IsDynamicCodeSupported { get { throw null; } }
public static bool IsSupported(string feature) { throw null; }
}
public static partial class RuntimeHelpers
{
[System.ObsoleteAttribute("OffsetToStringData has been deprecated. Use string.GetPinnableReference() instead.")]
public static int OffsetToStringData { get { throw null; } }
public static System.IntPtr AllocateTypeAssociatedMemory(System.Type type, int size) { throw null; }
public static System.ReadOnlySpan<T> CreateSpan<T>(System.RuntimeFieldHandle fldHandle) { throw null; }
public static void EnsureSufficientExecutionStack() { }
public static new bool Equals(object? o1, object? o2) { throw null; }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void ExecuteCodeWithGuaranteedCleanup(System.Runtime.CompilerServices.RuntimeHelpers.TryCode code, System.Runtime.CompilerServices.RuntimeHelpers.CleanupCode backoutCode, object? userData) { }
public static int GetHashCode(object? o) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("obj")]
public static object? GetObjectValue(object? obj) { throw null; }
public static T[] GetSubArray<T>(T[] array, System.Range range) { throw null; }
public static object GetUninitializedObject([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type) { throw null; }
public static void InitializeArray(System.Array array, System.RuntimeFieldHandle fldHandle) { }
public static bool IsReferenceOrContainsReferences<T>() { throw null; }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void PrepareConstrainedRegions() { }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void PrepareConstrainedRegionsNoOP() { }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void PrepareContractedDelegate(System.Delegate d) { }
public static void PrepareDelegate(System.Delegate d) { }
public static void PrepareMethod(System.RuntimeMethodHandle method) { }
public static void PrepareMethod(System.RuntimeMethodHandle method, System.RuntimeTypeHandle[]? instantiation) { }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void ProbeForSufficientStack() { }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimmer can't guarantee existence of class constructor")]
public static void RunClassConstructor(System.RuntimeTypeHandle type) { }
public static void RunModuleConstructor(System.ModuleHandle module) { }
public static bool TryEnsureSufficientExecutionStack() { throw null; }
public delegate void CleanupCode(object? userData, bool exceptionThrown);
public delegate void TryCode(object? userData);
}
public sealed partial class RuntimeWrappedException : System.Exception
{
public RuntimeWrappedException(object thrownObject) { }
public object WrappedException { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class SkipLocalsInitAttribute : System.Attribute
{
public SkipLocalsInitAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct)]
public sealed partial class SpecialNameAttribute : System.Attribute
{
public SpecialNameAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public partial class StateMachineAttribute : System.Attribute
{
public StateMachineAttribute(System.Type stateMachineType) { }
public System.Type StateMachineType { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class StringFreezingAttribute : System.Attribute
{
public StringFreezingAttribute() { }
}
public partial class StrongBox<T> : System.Runtime.CompilerServices.IStrongBox
{
[System.Diagnostics.CodeAnalysis.MaybeNullAttribute]
public T Value;
public StrongBox() { }
public StrongBox(T value) { }
object? System.Runtime.CompilerServices.IStrongBox.Value { get { throw null; } set { } }
}
[System.ObsoleteAttribute("SuppressIldasmAttribute has no effect in .NET 6.0+.", DiagnosticId = "SYSLIB0025", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Module)]
public sealed partial class SuppressIldasmAttribute : System.Attribute
{
public SuppressIldasmAttribute() { }
}
public sealed partial class SwitchExpressionException : System.InvalidOperationException
{
public SwitchExpressionException() { }
public SwitchExpressionException(System.Exception? innerException) { }
public SwitchExpressionException(object? unmatchedValue) { }
public SwitchExpressionException(string? message) { }
public SwitchExpressionException(string? message, System.Exception? innerException) { }
public override string Message { get { throw null; } }
public object? UnmatchedValue { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public readonly partial struct TaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
public readonly partial struct TaskAwaiter<TResult> : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public TResult GetResult() { throw null; }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue | System.AttributeTargets.Struct)]
[System.CLSCompliantAttribute(false)]
public sealed partial class TupleElementNamesAttribute : System.Attribute
{
public TupleElementNamesAttribute(string?[] transformNames) { }
public System.Collections.Generic.IList<string?> TransformNames { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
public sealed partial class TypeForwardedFromAttribute : System.Attribute
{
public TypeForwardedFromAttribute(string assemblyFullName) { }
public string AssemblyFullName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed partial class TypeForwardedToAttribute : System.Attribute
{
public TypeForwardedToAttribute(System.Type destination) { }
public System.Type Destination { get { throw null; } }
}
public static partial class Unsafe
{
public static ref T AddByteOffset<T>(ref T source, System.IntPtr byteOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ref T AddByteOffset<T>(ref T source, nuint byteOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void* Add<T>(void* source, int elementOffset) { throw null; }
public static ref T Add<T>(ref T source, int elementOffset) { throw null; }
public static ref T Add<T>(ref T source, System.IntPtr elementOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ref T Add<T>(ref T source, nuint elementOffset) { throw null; }
public static bool AreSame<T>([System.Diagnostics.CodeAnalysis.AllowNull] ref T left, [System.Diagnostics.CodeAnalysis.AllowNull] ref T right) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void* AsPointer<T>(ref T value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static ref T AsRef<T>(void* source) { throw null; }
public static ref T AsRef<T>(in T source) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("o")]
public static T? As<T>(object? o) where T : class? { throw null; }
public static ref TTo As<TFrom, TTo>(ref TFrom source) { throw null; }
public static System.IntPtr ByteOffset<T>([System.Diagnostics.CodeAnalysis.AllowNull] ref T origin, [System.Diagnostics.CodeAnalysis.AllowNull] ref T target) { throw null; }
[System.CLSCompliantAttribute(false)]
public static void CopyBlock(ref byte destination, ref byte source, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void CopyBlock(void* destination, void* source, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void Copy<T>(void* destination, ref T source) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void Copy<T>(ref T destination, void* source) { }
[System.CLSCompliantAttribute(false)]
public static void InitBlock(ref byte startAddress, byte value, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount) { }
public static bool IsAddressGreaterThan<T>([System.Diagnostics.CodeAnalysis.AllowNull] ref T left, [System.Diagnostics.CodeAnalysis.AllowNull] ref T right) { throw null; }
public static bool IsAddressLessThan<T>([System.Diagnostics.CodeAnalysis.AllowNull] ref T left, [System.Diagnostics.CodeAnalysis.AllowNull] ref T right) { throw null; }
public static bool IsNullRef<T>(ref T source) { throw null; }
public static ref T NullRef<T>() { throw null; }
public static T ReadUnaligned<T>(ref byte source) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static T ReadUnaligned<T>(void* source) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static T Read<T>(void* source) { throw null; }
public static void SkipInit<T>(out T value) { throw null; }
public static int SizeOf<T>() { throw null; }
public static ref T SubtractByteOffset<T>(ref T source, System.IntPtr byteOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ref T SubtractByteOffset<T>(ref T source, nuint byteOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void* Subtract<T>(void* source, int elementOffset) { throw null; }
public static ref T Subtract<T>(ref T source, int elementOffset) { throw null; }
public static ref T Subtract<T>(ref T source, System.IntPtr elementOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ref T Subtract<T>(ref T source, nuint elementOffset) { throw null; }
public static ref T Unbox<T>(object box) where T : struct { throw null; }
public static void WriteUnaligned<T>(ref byte destination, T value) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void WriteUnaligned<T>(void* destination, T value) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void Write<T>(void* destination, T value) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Struct)]
public sealed partial class UnsafeValueTypeAttribute : System.Attribute
{
public UnsafeValueTypeAttribute() { }
}
public readonly partial struct ValueTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
public readonly partial struct ValueTaskAwaiter<TResult> : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public TResult GetResult() { throw null; }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
public readonly partial struct YieldAwaitable
{
public System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter GetAwaiter() { throw null; }
public readonly partial struct YieldAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
}
namespace System.Runtime.ConstrainedExecution
{
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public enum Cer
{
None = 0,
MayFail = 1,
Success = 2,
}
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public enum Consistency
{
MayCorruptProcess = 0,
MayCorruptAppDomain = 1,
MayCorruptInstance = 2,
WillNotCorruptState = 3,
}
public abstract partial class CriticalFinalizerObject
{
protected CriticalFinalizerObject() { }
~CriticalFinalizerObject() { }
}
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class PrePrepareMethodAttribute : System.Attribute
{
public PrePrepareMethodAttribute() { }
}
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class ReliabilityContractAttribute : System.Attribute
{
public ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency consistencyGuarantee, System.Runtime.ConstrainedExecution.Cer cer) { }
public System.Runtime.ConstrainedExecution.Cer Cer { get { throw null; } }
public System.Runtime.ConstrainedExecution.Consistency ConsistencyGuarantee { get { throw null; } }
}
}
namespace System.Runtime.ExceptionServices
{
public sealed partial class ExceptionDispatchInfo
{
internal ExceptionDispatchInfo() { }
public System.Exception SourceException { get { throw null; } }
public static System.Runtime.ExceptionServices.ExceptionDispatchInfo Capture(System.Exception source) { throw null; }
public static System.Exception SetCurrentStackTrace(System.Exception source) { throw null; }
public static System.Exception SetRemoteStackTrace(System.Exception source, string stackTrace) { throw null; }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public void Throw() => throw null;
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public static void Throw(System.Exception source) => throw null;
}
public partial class FirstChanceExceptionEventArgs : System.EventArgs
{
public FirstChanceExceptionEventArgs(System.Exception exception) { }
public System.Exception Exception { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
[System.ObsoleteAttribute("Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.", DiagnosticId = "SYSLIB0032", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public sealed partial class HandleProcessCorruptedStateExceptionsAttribute : System.Attribute
{
public HandleProcessCorruptedStateExceptionsAttribute() { }
}
}
namespace System.Runtime.InteropServices
{
public enum Architecture
{
X86 = 0,
X64 = 1,
Arm = 2,
Arm64 = 3,
Wasm = 4,
S390x = 5,
LoongArch64 = 6,
Armv6 = 7,
}
public enum CharSet
{
None = 1,
Ansi = 2,
Unicode = 3,
Auto = 4,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class ComVisibleAttribute : System.Attribute
{
public ComVisibleAttribute(bool visibility) { }
public bool Value { get { throw null; } }
}
public abstract partial class CriticalHandle : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
{
protected System.IntPtr handle;
protected CriticalHandle(System.IntPtr invalidHandleValue) { }
public bool IsClosed { get { throw null; } }
public abstract bool IsInvalid { get; }
public void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~CriticalHandle() { }
protected abstract bool ReleaseHandle();
protected void SetHandle(System.IntPtr handle) { }
public void SetHandleAsInvalid() { }
}
public partial class ExternalException : System.SystemException
{
public ExternalException() { }
protected ExternalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ExternalException(string? message) { }
public ExternalException(string? message, System.Exception? inner) { }
public ExternalException(string? message, int errorCode) { }
public virtual int ErrorCode { get { throw null; } }
public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public sealed partial class FieldOffsetAttribute : System.Attribute
{
public FieldOffsetAttribute(int offset) { }
public int Value { get { throw null; } }
}
public partial struct GCHandle : System.IEquatable<System.Runtime.InteropServices.GCHandle>
{
private int _dummyPrimitive;
public bool IsAllocated { get { throw null; } }
public object? Target { get { throw null; } set { } }
public System.IntPtr AddrOfPinnedObject() { throw null; }
public static System.Runtime.InteropServices.GCHandle Alloc(object? value) { throw null; }
public static System.Runtime.InteropServices.GCHandle Alloc(object? value, System.Runtime.InteropServices.GCHandleType type) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; }
public bool Equals(System.Runtime.InteropServices.GCHandle other) { throw null; }
public void Free() { }
public static System.Runtime.InteropServices.GCHandle FromIntPtr(System.IntPtr value) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Runtime.InteropServices.GCHandle a, System.Runtime.InteropServices.GCHandle b) { throw null; }
public static explicit operator System.Runtime.InteropServices.GCHandle (System.IntPtr value) { throw null; }
public static explicit operator System.IntPtr (System.Runtime.InteropServices.GCHandle value) { throw null; }
public static bool operator !=(System.Runtime.InteropServices.GCHandle a, System.Runtime.InteropServices.GCHandle b) { throw null; }
public static System.IntPtr ToIntPtr(System.Runtime.InteropServices.GCHandle value) { throw null; }
}
public enum GCHandleType
{
Weak = 0,
WeakTrackResurrection = 1,
Normal = 2,
Pinned = 3,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class InAttribute : System.Attribute
{
public InAttribute() { }
}
public enum LayoutKind
{
Sequential = 0,
Explicit = 2,
Auto = 3,
}
public readonly partial struct OSPlatform : System.IEquatable<System.Runtime.InteropServices.OSPlatform>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public static System.Runtime.InteropServices.OSPlatform FreeBSD { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform Linux { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform OSX { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform Windows { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Runtime.InteropServices.OSPlatform other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; }
public static bool operator !=(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; }
public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class OutAttribute : System.Attribute
{
public OutAttribute() { }
}
public static partial class RuntimeInformation
{
public static string FrameworkDescription { get { throw null; } }
public static System.Runtime.InteropServices.Architecture OSArchitecture { get { throw null; } }
public static string OSDescription { get { throw null; } }
public static System.Runtime.InteropServices.Architecture ProcessArchitecture { get { throw null; } }
public static string RuntimeIdentifier { get { throw null; } }
public static bool IsOSPlatform(System.Runtime.InteropServices.OSPlatform osPlatform) { throw null; }
}
public abstract partial class SafeBuffer : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
protected SafeBuffer(bool ownsHandle) : base (default(bool)) { }
[System.CLSCompliantAttribute(false)]
public ulong ByteLength { get { throw null; } }
[System.CLSCompliantAttribute(false)]
public unsafe void AcquirePointer(ref byte* pointer) { }
[System.CLSCompliantAttribute(false)]
public void Initialize(uint numElements, uint sizeOfEachElement) { }
[System.CLSCompliantAttribute(false)]
public void Initialize(ulong numBytes) { }
[System.CLSCompliantAttribute(false)]
public void Initialize<T>(uint numElements) where T : struct { }
[System.CLSCompliantAttribute(false)]
public void ReadArray<T>(ulong byteOffset, T[] array, int index, int count) where T : struct { }
[System.CLSCompliantAttribute(false)]
public void ReadSpan<T>(ulong byteOffset, System.Span<T> buffer) where T : struct { }
[System.CLSCompliantAttribute(false)]
public T Read<T>(ulong byteOffset) where T : struct { throw null; }
public void ReleasePointer() { }
[System.CLSCompliantAttribute(false)]
public void WriteArray<T>(ulong byteOffset, T[] array, int index, int count) where T : struct { }
[System.CLSCompliantAttribute(false)]
public void WriteSpan<T>(ulong byteOffset, System.ReadOnlySpan<T> data) where T : struct { }
[System.CLSCompliantAttribute(false)]
public void Write<T>(ulong byteOffset, T value) where T : struct { }
}
public abstract partial class SafeHandle : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
{
protected System.IntPtr handle;
protected SafeHandle(System.IntPtr invalidHandleValue, bool ownsHandle) { }
public bool IsClosed { get { throw null; } }
public abstract bool IsInvalid { get; }
public void Close() { }
public void DangerousAddRef(ref bool success) { }
public System.IntPtr DangerousGetHandle() { throw null; }
public void DangerousRelease() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~SafeHandle() { }
protected abstract bool ReleaseHandle();
protected void SetHandle(System.IntPtr handle) { }
public void SetHandleAsInvalid() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class StructLayoutAttribute : System.Attribute
{
public System.Runtime.InteropServices.CharSet CharSet;
public int Pack;
public int Size;
public StructLayoutAttribute(short layoutKind) { }
public StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind layoutKind) { }
public System.Runtime.InteropServices.LayoutKind Value { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class SuppressGCTransitionAttribute : System.Attribute
{
public SuppressGCTransitionAttribute() { }
}
public enum UnmanagedType
{
Bool = 2,
I1 = 3,
U1 = 4,
I2 = 5,
U2 = 6,
I4 = 7,
U4 = 8,
I8 = 9,
U8 = 10,
R4 = 11,
R8 = 12,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling as Currency may be unavailable in future releases.")]
Currency = 15,
BStr = 19,
LPStr = 20,
LPWStr = 21,
LPTStr = 22,
ByValTStr = 23,
IUnknown = 25,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
IDispatch = 26,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
Struct = 27,
Interface = 28,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
SafeArray = 29,
ByValArray = 30,
SysInt = 31,
SysUInt = 32,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling as VBByRefString may be unavailable in future releases.")]
VBByRefStr = 34,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling as AnsiBStr may be unavailable in future releases.")]
AnsiBStr = 35,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling as TBstr may be unavailable in future releases.")]
TBStr = 36,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
VariantBool = 37,
FunctionPtr = 38,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling arbitrary types may be unavailable in future releases. Specify the type you wish to marshal as.")]
AsAny = 40,
LPArray = 42,
LPStruct = 43,
CustomMarshaler = 44,
Error = 45,
IInspectable = 46,
HString = 47,
LPUTF8Str = 48,
}
}
namespace System.Runtime.Remoting
{
public partial class ObjectHandle : System.MarshalByRefObject
{
public ObjectHandle(object? o) { }
public object? Unwrap() { throw null; }
}
}
namespace System.Runtime.Serialization
{
public partial interface IDeserializationCallback
{
void OnDeserialization(object? sender);
}
[System.CLSCompliantAttribute(false)]
public partial interface IFormatterConverter
{
object Convert(object value, System.Type type);
object Convert(object value, System.TypeCode typeCode);
bool ToBoolean(object value);
byte ToByte(object value);
char ToChar(object value);
System.DateTime ToDateTime(object value);
decimal ToDecimal(object value);
double ToDouble(object value);
short ToInt16(object value);
int ToInt32(object value);
long ToInt64(object value);
sbyte ToSByte(object value);
float ToSingle(object value);
string? ToString(object value);
ushort ToUInt16(object value);
uint ToUInt32(object value);
ulong ToUInt64(object value);
}
public partial interface IObjectReference
{
object GetRealObject(System.Runtime.Serialization.StreamingContext context);
}
public partial interface ISafeSerializationData
{
void CompleteDeserialization(object deserialized);
}
public partial interface ISerializable
{
void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class OnDeserializedAttribute : System.Attribute
{
public OnDeserializedAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class OnDeserializingAttribute : System.Attribute
{
public OnDeserializingAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class OnSerializedAttribute : System.Attribute
{
public OnSerializedAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class OnSerializingAttribute : System.Attribute
{
public OnSerializingAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public sealed partial class OptionalFieldAttribute : System.Attribute
{
public OptionalFieldAttribute() { }
public int VersionAdded { get { throw null; } set { } }
}
public sealed partial class SafeSerializationEventArgs : System.EventArgs
{
internal SafeSerializationEventArgs() { }
public System.Runtime.Serialization.StreamingContext StreamingContext { get { throw null; } }
public void AddSerializedState(System.Runtime.Serialization.ISafeSerializationData serializedState) { }
}
public readonly partial struct SerializationEntry
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public string Name { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
public object? Value { get { throw null; } }
}
public partial class SerializationException : System.SystemException
{
public SerializationException() { }
protected SerializationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public SerializationException(string? message) { }
public SerializationException(string? message, System.Exception? innerException) { }
}
public sealed partial class SerializationInfo
{
[System.CLSCompliantAttribute(false)]
public SerializationInfo(System.Type type, System.Runtime.Serialization.IFormatterConverter converter) { }
[System.CLSCompliantAttribute(false)]
public SerializationInfo(System.Type type, System.Runtime.Serialization.IFormatterConverter converter, bool requireSameTokenInPartialTrust) { }
public string AssemblyName { get { throw null; } set { } }
public string FullTypeName { get { throw null; } set { } }
public bool IsAssemblyNameSetExplicit { get { throw null; } }
public bool IsFullTypeNameSetExplicit { get { throw null; } }
public int MemberCount { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
public void AddValue(string name, bool value) { }
public void AddValue(string name, byte value) { }
public void AddValue(string name, char value) { }
public void AddValue(string name, System.DateTime value) { }
public void AddValue(string name, decimal value) { }
public void AddValue(string name, double value) { }
public void AddValue(string name, short value) { }
public void AddValue(string name, int value) { }
public void AddValue(string name, long value) { }
public void AddValue(string name, object? value) { }
public void AddValue(string name, object? value, System.Type type) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, sbyte value) { }
public void AddValue(string name, float value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, ushort value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, uint value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, ulong value) { }
public bool GetBoolean(string name) { throw null; }
public byte GetByte(string name) { throw null; }
public char GetChar(string name) { throw null; }
public System.DateTime GetDateTime(string name) { throw null; }
public decimal GetDecimal(string name) { throw null; }
public double GetDouble(string name) { throw null; }
public System.Runtime.Serialization.SerializationInfoEnumerator GetEnumerator() { throw null; }
public short GetInt16(string name) { throw null; }
public int GetInt32(string name) { throw null; }
public long GetInt64(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public sbyte GetSByte(string name) { throw null; }
public float GetSingle(string name) { throw null; }
public string? GetString(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public ushort GetUInt16(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public uint GetUInt32(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public ulong GetUInt64(string name) { throw null; }
public object? GetValue(string name, System.Type type) { throw null; }
public void SetType(System.Type type) { }
}
public sealed partial class SerializationInfoEnumerator : System.Collections.IEnumerator
{
internal SerializationInfoEnumerator() { }
public System.Runtime.Serialization.SerializationEntry Current { get { throw null; } }
public string Name { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
public object? Value { get { throw null; } }
public bool MoveNext() { throw null; }
public void Reset() { }
}
public readonly partial struct StreamingContext
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public StreamingContext(System.Runtime.Serialization.StreamingContextStates state) { throw null; }
public StreamingContext(System.Runtime.Serialization.StreamingContextStates state, object? additional) { throw null; }
public object? Context { get { throw null; } }
public System.Runtime.Serialization.StreamingContextStates State { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
[System.FlagsAttribute]
public enum StreamingContextStates
{
CrossProcess = 1,
CrossMachine = 2,
File = 4,
Persistence = 8,
Remoting = 16,
Other = 32,
Clone = 64,
CrossAppDomain = 128,
All = 255,
}
}
namespace System.Runtime.Versioning
{
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed partial class ComponentGuaranteesAttribute : System.Attribute
{
public ComponentGuaranteesAttribute(System.Runtime.Versioning.ComponentGuaranteesOptions guarantees) { }
public System.Runtime.Versioning.ComponentGuaranteesOptions Guarantees { get { throw null; } }
}
[System.FlagsAttribute]
public enum ComponentGuaranteesOptions
{
None = 0,
Exchange = 1,
Stable = 2,
SideBySide = 4,
}
public sealed partial class FrameworkName : System.IEquatable<System.Runtime.Versioning.FrameworkName?>
{
public FrameworkName(string frameworkName) { }
public FrameworkName(string identifier, System.Version version) { }
public FrameworkName(string identifier, System.Version version, string? profile) { }
public string FullName { get { throw null; } }
public string Identifier { get { throw null; } }
public string Profile { get { throw null; } }
public System.Version Version { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Runtime.Versioning.FrameworkName? other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Runtime.Versioning.FrameworkName? left, System.Runtime.Versioning.FrameworkName? right) { throw null; }
public static bool operator !=(System.Runtime.Versioning.FrameworkName? left, System.Runtime.Versioning.FrameworkName? right) { throw null; }
public override string ToString() { throw null; }
}
public abstract partial class OSPlatformAttribute : System.Attribute
{
private protected OSPlatformAttribute(string platformName) { }
public string PlatformName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class RequiresPreviewFeaturesAttribute : System.Attribute
{
public RequiresPreviewFeaturesAttribute() { }
public RequiresPreviewFeaturesAttribute(string? message) { }
public string? Message { get { throw null; } }
public string? Url { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)]
[System.Diagnostics.ConditionalAttribute("RESOURCE_ANNOTATION_WORK")]
public sealed partial class ResourceConsumptionAttribute : System.Attribute
{
public ResourceConsumptionAttribute(System.Runtime.Versioning.ResourceScope resourceScope) { }
public ResourceConsumptionAttribute(System.Runtime.Versioning.ResourceScope resourceScope, System.Runtime.Versioning.ResourceScope consumptionScope) { }
public System.Runtime.Versioning.ResourceScope ConsumptionScope { get { throw null; } }
public System.Runtime.Versioning.ResourceScope ResourceScope { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)]
[System.Diagnostics.ConditionalAttribute("RESOURCE_ANNOTATION_WORK")]
public sealed partial class ResourceExposureAttribute : System.Attribute
{
public ResourceExposureAttribute(System.Runtime.Versioning.ResourceScope exposureLevel) { }
public System.Runtime.Versioning.ResourceScope ResourceExposureLevel { get { throw null; } }
}
[System.FlagsAttribute]
public enum ResourceScope
{
None = 0,
Machine = 1,
Process = 2,
AppDomain = 4,
Library = 8,
Private = 16,
Assembly = 32,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed partial class SupportedOSPlatformAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public SupportedOSPlatformAttribute(string platformName) : base(platformName) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=true, Inherited=false)]
public sealed partial class SupportedOSPlatformGuardAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public SupportedOSPlatformGuardAttribute(string platformName) : base(platformName) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class TargetFrameworkAttribute : System.Attribute
{
public TargetFrameworkAttribute(string frameworkName) { }
public string? FrameworkDisplayName { get { throw null; } set { } }
public string FrameworkName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class TargetPlatformAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public TargetPlatformAttribute(string platformName) : base(platformName) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed partial class UnsupportedOSPlatformAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public UnsupportedOSPlatformAttribute(string platformName) : base(platformName) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=true, Inherited=false)]
public sealed partial class UnsupportedOSPlatformGuardAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public UnsupportedOSPlatformGuardAttribute(string platformName) : base(platformName) { }
}
public static partial class VersioningHelper
{
public static string MakeVersionSafeName(string? name, System.Runtime.Versioning.ResourceScope from, System.Runtime.Versioning.ResourceScope to) { throw null; }
public static string MakeVersionSafeName(string? name, System.Runtime.Versioning.ResourceScope from, System.Runtime.Versioning.ResourceScope to, System.Type? type) { throw null; }
}
}
namespace System.Security
{
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class AllowPartiallyTrustedCallersAttribute : System.Attribute
{
public AllowPartiallyTrustedCallersAttribute() { }
public System.Security.PartialTrustVisibilityLevel PartialTrustVisibilityLevel { get { throw null; } set { } }
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial interface IPermission : System.Security.ISecurityEncodable
{
System.Security.IPermission Copy();
void Demand();
System.Security.IPermission? Intersect(System.Security.IPermission? target);
bool IsSubsetOf(System.Security.IPermission? target);
System.Security.IPermission? Union(System.Security.IPermission? target);
}
public partial interface ISecurityEncodable
{
void FromXml(System.Security.SecurityElement e);
System.Security.SecurityElement? ToXml();
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial interface IStackWalk
{
void Assert();
void Demand();
void Deny();
void PermitOnly();
}
public enum PartialTrustVisibilityLevel
{
VisibleToAllHosts = 0,
NotVisibleByDefault = 1,
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial class PermissionSet : System.Collections.ICollection, System.Collections.IEnumerable, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
{
public PermissionSet(System.Security.Permissions.PermissionState state) { }
public PermissionSet(System.Security.PermissionSet? permSet) { }
public virtual int Count { get { throw null; } }
public virtual bool IsReadOnly { get { throw null; } }
public virtual bool IsSynchronized { get { throw null; } }
public virtual object SyncRoot { get { throw null; } }
public System.Security.IPermission? AddPermission(System.Security.IPermission? perm) { throw null; }
protected virtual System.Security.IPermission? AddPermissionImpl(System.Security.IPermission? perm) { throw null; }
public void Assert() { }
public bool ContainsNonCodeAccessPermissions() { throw null; }
[System.ObsoleteAttribute]
public static byte[] ConvertPermissionSet(string inFormat, byte[] inData, string outFormat) { throw null; }
public virtual System.Security.PermissionSet Copy() { throw null; }
public virtual void CopyTo(System.Array array, int index) { }
public void Demand() { }
[System.ObsoleteAttribute]
public void Deny() { }
public override bool Equals(object? o) { throw null; }
public virtual void FromXml(System.Security.SecurityElement et) { }
public System.Collections.IEnumerator GetEnumerator() { throw null; }
protected virtual System.Collections.IEnumerator GetEnumeratorImpl() { throw null; }
public override int GetHashCode() { throw null; }
public System.Security.IPermission? GetPermission(System.Type? permClass) { throw null; }
protected virtual System.Security.IPermission? GetPermissionImpl(System.Type? permClass) { throw null; }
public System.Security.PermissionSet? Intersect(System.Security.PermissionSet? other) { throw null; }
public bool IsEmpty() { throw null; }
public bool IsSubsetOf(System.Security.PermissionSet? target) { throw null; }
public bool IsUnrestricted() { throw null; }
public void PermitOnly() { }
public System.Security.IPermission? RemovePermission(System.Type? permClass) { throw null; }
protected virtual System.Security.IPermission? RemovePermissionImpl(System.Type? permClass) { throw null; }
public static void RevertAssert() { }
public System.Security.IPermission? SetPermission(System.Security.IPermission? perm) { throw null; }
protected virtual System.Security.IPermission? SetPermissionImpl(System.Security.IPermission? perm) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
public override string ToString() { throw null; }
public virtual System.Security.SecurityElement? ToXml() { throw null; }
public System.Security.PermissionSet? Union(System.Security.PermissionSet? other) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed partial class SecurityCriticalAttribute : System.Attribute
{
public SecurityCriticalAttribute() { }
public SecurityCriticalAttribute(System.Security.SecurityCriticalScope scope) { }
[System.ObsoleteAttribute("SecurityCriticalScope is only used for .NET 2.0 transparency compatibility.")]
public System.Security.SecurityCriticalScope Scope { get { throw null; } }
}
[System.ObsoleteAttribute("SecurityCriticalScope is only used for .NET 2.0 transparency compatibility.")]
public enum SecurityCriticalScope
{
Explicit = 0,
Everything = 1,
}
public sealed partial class SecurityElement
{
public SecurityElement(string tag) { }
public SecurityElement(string tag, string? text) { }
public System.Collections.Hashtable? Attributes { get { throw null; } set { } }
public System.Collections.ArrayList? Children { get { throw null; } set { } }
public string Tag { get { throw null; } set { } }
public string? Text { get { throw null; } set { } }
public void AddAttribute(string name, string value) { }
public void AddChild(System.Security.SecurityElement child) { }
public string? Attribute(string name) { throw null; }
public System.Security.SecurityElement Copy() { throw null; }
public bool Equal([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Security.SecurityElement? other) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("str")]
public static string? Escape(string? str) { throw null; }
public static System.Security.SecurityElement? FromString(string xml) { throw null; }
public static bool IsValidAttributeName([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? name) { throw null; }
public static bool IsValidAttributeValue([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value) { throw null; }
public static bool IsValidTag([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? tag) { throw null; }
public static bool IsValidText([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? text) { throw null; }
public System.Security.SecurityElement? SearchForChildByTag(string tag) { throw null; }
public string? SearchForTextOfTag(string tag) { throw null; }
public override string ToString() { throw null; }
}
public partial class SecurityException : System.SystemException
{
public SecurityException() { }
protected SecurityException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public SecurityException(string? message) { }
public SecurityException(string? message, System.Exception? inner) { }
public SecurityException(string? message, System.Type? type) { }
public SecurityException(string? message, System.Type? type, string? state) { }
public object? Demanded { get { throw null; } set { } }
public object? DenySetInstance { get { throw null; } set { } }
public System.Reflection.AssemblyName? FailedAssemblyInfo { get { throw null; } set { } }
public string? GrantedSet { get { throw null; } set { } }
public System.Reflection.MethodInfo? Method { get { throw null; } set { } }
public string? PermissionState { get { throw null; } set { } }
public System.Type? PermissionType { get { throw null; } set { } }
public object? PermitOnlySetInstance { get { throw null; } set { } }
public string? RefusedSet { get { throw null; } set { } }
public string? Url { get { throw null; } set { } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed partial class SecurityRulesAttribute : System.Attribute
{
public SecurityRulesAttribute(System.Security.SecurityRuleSet ruleSet) { }
public System.Security.SecurityRuleSet RuleSet { get { throw null; } }
public bool SkipVerificationInFullTrust { get { throw null; } set { } }
}
public enum SecurityRuleSet : byte
{
None = (byte)0,
Level1 = (byte)1,
Level2 = (byte)2,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed partial class SecuritySafeCriticalAttribute : System.Attribute
{
public SecuritySafeCriticalAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class SecurityTransparentAttribute : System.Attribute
{
public SecurityTransparentAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
[System.ObsoleteAttribute("SecurityTreatAsSafe is only used for .NET 2.0 transparency compatibility. Use the SecuritySafeCriticalAttribute instead.")]
public sealed partial class SecurityTreatAsSafeAttribute : System.Attribute
{
public SecurityTreatAsSafeAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
public sealed partial class SuppressUnmanagedCodeSecurityAttribute : System.Attribute
{
public SuppressUnmanagedCodeSecurityAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Module, AllowMultiple=true, Inherited=false)]
public sealed partial class UnverifiableCodeAttribute : System.Attribute
{
public UnverifiableCodeAttribute() { }
}
public partial class VerificationException : System.SystemException
{
public VerificationException() { }
protected VerificationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public VerificationException(string? message) { }
public VerificationException(string? message, System.Exception? innerException) { }
}
}
namespace System.Security.Cryptography
{
public partial class CryptographicException : System.SystemException
{
public CryptographicException() { }
public CryptographicException(int hr) { }
protected CryptographicException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public CryptographicException(string? message) { }
public CryptographicException(string? message, System.Exception? inner) { }
public CryptographicException(string format, string? insert) { }
}
}
namespace System.Security.Permissions
{
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public abstract partial class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
{
protected CodeAccessSecurityAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { }
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public enum PermissionState
{
None = 0,
Unrestricted = 1,
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public enum SecurityAction
{
Demand = 2,
Assert = 3,
Deny = 4,
PermitOnly = 5,
LinkDemand = 6,
InheritanceDemand = 7,
RequestMinimum = 8,
RequestOptional = 9,
RequestRefuse = 10,
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public abstract partial class SecurityAttribute : System.Attribute
{
protected SecurityAttribute(System.Security.Permissions.SecurityAction action) { }
public System.Security.Permissions.SecurityAction Action { get { throw null; } set { } }
public bool Unrestricted { get { throw null; } set { } }
public abstract System.Security.IPermission? CreatePermission();
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed partial class SecurityPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute
{
public SecurityPermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { }
public bool Assertion { get { throw null; } set { } }
public bool BindingRedirects { get { throw null; } set { } }
public bool ControlAppDomain { get { throw null; } set { } }
public bool ControlDomainPolicy { get { throw null; } set { } }
public bool ControlEvidence { get { throw null; } set { } }
public bool ControlPolicy { get { throw null; } set { } }
public bool ControlPrincipal { get { throw null; } set { } }
public bool ControlThread { get { throw null; } set { } }
public bool Execution { get { throw null; } set { } }
public System.Security.Permissions.SecurityPermissionFlag Flags { get { throw null; } set { } }
public bool Infrastructure { get { throw null; } set { } }
public bool RemotingConfiguration { get { throw null; } set { } }
public bool SerializationFormatter { get { throw null; } set { } }
public bool SkipVerification { get { throw null; } set { } }
public bool UnmanagedCode { get { throw null; } set { } }
public override System.Security.IPermission? CreatePermission() { throw null; }
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.FlagsAttribute]
public enum SecurityPermissionFlag
{
NoFlags = 0,
Assertion = 1,
UnmanagedCode = 2,
SkipVerification = 4,
Execution = 8,
ControlThread = 16,
ControlEvidence = 32,
ControlPolicy = 64,
SerializationFormatter = 128,
ControlDomainPolicy = 256,
ControlPrincipal = 512,
ControlAppDomain = 1024,
RemotingConfiguration = 2048,
Infrastructure = 4096,
BindingRedirects = 8192,
AllFlags = 16383,
}
}
namespace System.Security.Principal
{
public partial interface IIdentity
{
string? AuthenticationType { get; }
bool IsAuthenticated { get; }
string? Name { get; }
}
public partial interface IPrincipal
{
System.Security.Principal.IIdentity? Identity { get; }
bool IsInRole(string role);
}
public enum PrincipalPolicy
{
UnauthenticatedPrincipal = 0,
NoPrincipal = 1,
WindowsPrincipal = 2,
}
public enum TokenImpersonationLevel
{
None = 0,
Anonymous = 1,
Identification = 2,
Impersonation = 3,
Delegation = 4,
}
}
namespace System.Text
{
public abstract partial class Decoder
{
protected Decoder() { }
public System.Text.DecoderFallback? Fallback { get { throw null; } set { } }
public System.Text.DecoderFallbackBuffer FallbackBuffer { get { throw null; } }
[System.CLSCompliantAttribute(false)]
public unsafe virtual void Convert(byte* bytes, int byteCount, char* chars, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) { throw null; }
public virtual void Convert(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) { throw null; }
public virtual void Convert(System.ReadOnlySpan<byte> bytes, System.Span<char> chars, bool flush, out int bytesUsed, out int charsUsed, out bool completed) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetCharCount(byte* bytes, int count, bool flush) { throw null; }
public abstract int GetCharCount(byte[] bytes, int index, int count);
public virtual int GetCharCount(byte[] bytes, int index, int count, bool flush) { throw null; }
public virtual int GetCharCount(System.ReadOnlySpan<byte> bytes, bool flush) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush) { throw null; }
public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
public virtual int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, bool flush) { throw null; }
public virtual int GetChars(System.ReadOnlySpan<byte> bytes, System.Span<char> chars, bool flush) { throw null; }
public virtual void Reset() { }
}
public sealed partial class DecoderExceptionFallback : System.Text.DecoderFallback
{
public DecoderExceptionFallback() { }
public override int MaxCharCount { get { throw null; } }
public override System.Text.DecoderFallbackBuffer CreateFallbackBuffer() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class DecoderExceptionFallbackBuffer : System.Text.DecoderFallbackBuffer
{
public DecoderExceptionFallbackBuffer() { }
public override int Remaining { get { throw null; } }
public override bool Fallback(byte[] bytesUnknown, int index) { throw null; }
public override char GetNextChar() { throw null; }
public override bool MovePrevious() { throw null; }
}
public abstract partial class DecoderFallback
{
protected DecoderFallback() { }
public static System.Text.DecoderFallback ExceptionFallback { get { throw null; } }
public abstract int MaxCharCount { get; }
public static System.Text.DecoderFallback ReplacementFallback { get { throw null; } }
public abstract System.Text.DecoderFallbackBuffer CreateFallbackBuffer();
}
public abstract partial class DecoderFallbackBuffer
{
protected DecoderFallbackBuffer() { }
public abstract int Remaining { get; }
public abstract bool Fallback(byte[] bytesUnknown, int index);
public abstract char GetNextChar();
public abstract bool MovePrevious();
public virtual void Reset() { }
}
public sealed partial class DecoderFallbackException : System.ArgumentException
{
public DecoderFallbackException() { }
public DecoderFallbackException(string? message) { }
public DecoderFallbackException(string? message, byte[]? bytesUnknown, int index) { }
public DecoderFallbackException(string? message, System.Exception? innerException) { }
public byte[]? BytesUnknown { get { throw null; } }
public int Index { get { throw null; } }
}
public sealed partial class DecoderReplacementFallback : System.Text.DecoderFallback
{
public DecoderReplacementFallback() { }
public DecoderReplacementFallback(string replacement) { }
public string DefaultString { get { throw null; } }
public override int MaxCharCount { get { throw null; } }
public override System.Text.DecoderFallbackBuffer CreateFallbackBuffer() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class DecoderReplacementFallbackBuffer : System.Text.DecoderFallbackBuffer
{
public DecoderReplacementFallbackBuffer(System.Text.DecoderReplacementFallback fallback) { }
public override int Remaining { get { throw null; } }
public override bool Fallback(byte[] bytesUnknown, int index) { throw null; }
public override char GetNextChar() { throw null; }
public override bool MovePrevious() { throw null; }
public override void Reset() { }
}
public abstract partial class Encoder
{
protected Encoder() { }
public System.Text.EncoderFallback? Fallback { get { throw null; } set { } }
public System.Text.EncoderFallbackBuffer FallbackBuffer { get { throw null; } }
[System.CLSCompliantAttribute(false)]
public unsafe virtual void Convert(char* chars, int charCount, byte* bytes, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed) { throw null; }
public virtual void Convert(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed) { throw null; }
public virtual void Convert(System.ReadOnlySpan<char> chars, System.Span<byte> bytes, bool flush, out int charsUsed, out int bytesUsed, out bool completed) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetByteCount(char* chars, int count, bool flush) { throw null; }
public abstract int GetByteCount(char[] chars, int index, int count, bool flush);
public virtual int GetByteCount(System.ReadOnlySpan<char> chars, bool flush) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, bool flush) { throw null; }
public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush);
public virtual int GetBytes(System.ReadOnlySpan<char> chars, System.Span<byte> bytes, bool flush) { throw null; }
public virtual void Reset() { }
}
public sealed partial class EncoderExceptionFallback : System.Text.EncoderFallback
{
public EncoderExceptionFallback() { }
public override int MaxCharCount { get { throw null; } }
public override System.Text.EncoderFallbackBuffer CreateFallbackBuffer() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class EncoderExceptionFallbackBuffer : System.Text.EncoderFallbackBuffer
{
public EncoderExceptionFallbackBuffer() { }
public override int Remaining { get { throw null; } }
public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index) { throw null; }
public override bool Fallback(char charUnknown, int index) { throw null; }
public override char GetNextChar() { throw null; }
public override bool MovePrevious() { throw null; }
}
public abstract partial class EncoderFallback
{
protected EncoderFallback() { }
public static System.Text.EncoderFallback ExceptionFallback { get { throw null; } }
public abstract int MaxCharCount { get; }
public static System.Text.EncoderFallback ReplacementFallback { get { throw null; } }
public abstract System.Text.EncoderFallbackBuffer CreateFallbackBuffer();
}
public abstract partial class EncoderFallbackBuffer
{
protected EncoderFallbackBuffer() { }
public abstract int Remaining { get; }
public abstract bool Fallback(char charUnknownHigh, char charUnknownLow, int index);
public abstract bool Fallback(char charUnknown, int index);
public abstract char GetNextChar();
public abstract bool MovePrevious();
public virtual void Reset() { }
}
public sealed partial class EncoderFallbackException : System.ArgumentException
{
public EncoderFallbackException() { }
public EncoderFallbackException(string? message) { }
public EncoderFallbackException(string? message, System.Exception? innerException) { }
public char CharUnknown { get { throw null; } }
public char CharUnknownHigh { get { throw null; } }
public char CharUnknownLow { get { throw null; } }
public int Index { get { throw null; } }
public bool IsUnknownSurrogate() { throw null; }
}
public sealed partial class EncoderReplacementFallback : System.Text.EncoderFallback
{
public EncoderReplacementFallback() { }
public EncoderReplacementFallback(string replacement) { }
public string DefaultString { get { throw null; } }
public override int MaxCharCount { get { throw null; } }
public override System.Text.EncoderFallbackBuffer CreateFallbackBuffer() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class EncoderReplacementFallbackBuffer : System.Text.EncoderFallbackBuffer
{
public EncoderReplacementFallbackBuffer(System.Text.EncoderReplacementFallback fallback) { }
public override int Remaining { get { throw null; } }
public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index) { throw null; }
public override bool Fallback(char charUnknown, int index) { throw null; }
public override char GetNextChar() { throw null; }
public override bool MovePrevious() { throw null; }
public override void Reset() { }
}
public abstract partial class Encoding : System.ICloneable
{
protected Encoding() { }
protected Encoding(int codePage) { }
protected Encoding(int codePage, System.Text.EncoderFallback? encoderFallback, System.Text.DecoderFallback? decoderFallback) { }
public static System.Text.Encoding ASCII { get { throw null; } }
public static System.Text.Encoding BigEndianUnicode { get { throw null; } }
public virtual string BodyName { get { throw null; } }
public virtual int CodePage { get { throw null; } }
public System.Text.DecoderFallback DecoderFallback { get { throw null; } set { } }
public static System.Text.Encoding Default { get { throw null; } }
public System.Text.EncoderFallback EncoderFallback { get { throw null; } set { } }
public virtual string EncodingName { get { throw null; } }
public virtual string HeaderName { get { throw null; } }
public virtual bool IsBrowserDisplay { get { throw null; } }
public virtual bool IsBrowserSave { get { throw null; } }
public virtual bool IsMailNewsDisplay { get { throw null; } }
public virtual bool IsMailNewsSave { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public virtual bool IsSingleByte { get { throw null; } }
public static System.Text.Encoding Latin1 { get { throw null; } }
public virtual System.ReadOnlySpan<byte> Preamble { get { throw null; } }
public static System.Text.Encoding Unicode { get { throw null; } }
public static System.Text.Encoding UTF32 { get { throw null; } }
[System.ObsoleteAttribute("The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.", DiagnosticId = "SYSLIB0001", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static System.Text.Encoding UTF7 { get { throw null; } }
public static System.Text.Encoding UTF8 { get { throw null; } }
public virtual string WebName { get { throw null; } }
public virtual int WindowsCodePage { get { throw null; } }
public virtual object Clone() { throw null; }
public static byte[] Convert(System.Text.Encoding srcEncoding, System.Text.Encoding dstEncoding, byte[] bytes) { throw null; }
public static byte[] Convert(System.Text.Encoding srcEncoding, System.Text.Encoding dstEncoding, byte[] bytes, int index, int count) { throw null; }
public static System.IO.Stream CreateTranscodingStream(System.IO.Stream innerStream, System.Text.Encoding innerStreamEncoding, System.Text.Encoding outerStreamEncoding, bool leaveOpen = false) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetByteCount(char* chars, int count) { throw null; }
public virtual int GetByteCount(char[] chars) { throw null; }
public abstract int GetByteCount(char[] chars, int index, int count);
public virtual int GetByteCount(System.ReadOnlySpan<char> chars) { throw null; }
public virtual int GetByteCount(string s) { throw null; }
public int GetByteCount(string s, int index, int count) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { throw null; }
public virtual byte[] GetBytes(char[] chars) { throw null; }
public virtual byte[] GetBytes(char[] chars, int index, int count) { throw null; }
public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex);
public virtual int GetBytes(System.ReadOnlySpan<char> chars, System.Span<byte> bytes) { throw null; }
public virtual byte[] GetBytes(string s) { throw null; }
public byte[] GetBytes(string s, int index, int count) { throw null; }
public virtual int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetCharCount(byte* bytes, int count) { throw null; }
public virtual int GetCharCount(byte[] bytes) { throw null; }
public abstract int GetCharCount(byte[] bytes, int index, int count);
public virtual int GetCharCount(System.ReadOnlySpan<byte> bytes) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { throw null; }
public virtual char[] GetChars(byte[] bytes) { throw null; }
public virtual char[] GetChars(byte[] bytes, int index, int count) { throw null; }
public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
public virtual int GetChars(System.ReadOnlySpan<byte> bytes, System.Span<char> chars) { throw null; }
public virtual System.Text.Decoder GetDecoder() { throw null; }
public virtual System.Text.Encoder GetEncoder() { throw null; }
public static System.Text.Encoding GetEncoding(int codepage) { throw null; }
public static System.Text.Encoding GetEncoding(int codepage, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
public static System.Text.Encoding GetEncoding(string name) { throw null; }
public static System.Text.Encoding GetEncoding(string name, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
public static System.Text.EncodingInfo[] GetEncodings() { throw null; }
public override int GetHashCode() { throw null; }
public abstract int GetMaxByteCount(int charCount);
public abstract int GetMaxCharCount(int byteCount);
public virtual byte[] GetPreamble() { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe string GetString(byte* bytes, int byteCount) { throw null; }
public virtual string GetString(byte[] bytes) { throw null; }
public virtual string GetString(byte[] bytes, int index, int count) { throw null; }
public string GetString(System.ReadOnlySpan<byte> bytes) { throw null; }
public bool IsAlwaysNormalized() { throw null; }
public virtual bool IsAlwaysNormalized(System.Text.NormalizationForm form) { throw null; }
public static void RegisterProvider(System.Text.EncodingProvider provider) { }
}
public sealed partial class EncodingInfo
{
public EncodingInfo(System.Text.EncodingProvider provider, int codePage, string name, string displayName) { }
public int CodePage { get { throw null; } }
public string DisplayName { get { throw null; } }
public string Name { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public System.Text.Encoding GetEncoding() { throw null; }
public override int GetHashCode() { throw null; }
}
public abstract partial class EncodingProvider
{
public EncodingProvider() { }
public abstract System.Text.Encoding? GetEncoding(int codepage);
public virtual System.Text.Encoding? GetEncoding(int codepage, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
public abstract System.Text.Encoding? GetEncoding(string name);
public virtual System.Text.Encoding? GetEncoding(string name, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
public virtual System.Collections.Generic.IEnumerable<System.Text.EncodingInfo> GetEncodings() { throw null; }
}
public enum NormalizationForm
{
FormC = 1,
FormD = 2,
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
FormKC = 5,
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
FormKD = 6,
}
public readonly partial struct Rune : System.IComparable, System.IComparable<System.Text.Rune>, System.IEquatable<System.Text.Rune>, System.IFormattable, System.ISpanFormattable
{
private readonly int _dummyPrimitive;
public Rune(char ch) { throw null; }
public Rune(char highSurrogate, char lowSurrogate) { throw null; }
public Rune(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public Rune(uint value) { throw null; }
public bool IsAscii { get { throw null; } }
public bool IsBmp { get { throw null; } }
public int Plane { get { throw null; } }
public static System.Text.Rune ReplacementChar { get { throw null; } }
public int Utf16SequenceLength { get { throw null; } }
public int Utf8SequenceLength { get { throw null; } }
public int Value { get { throw null; } }
public int CompareTo(System.Text.Rune other) { throw null; }
public static System.Buffers.OperationStatus DecodeFromUtf16(System.ReadOnlySpan<char> source, out System.Text.Rune result, out int charsConsumed) { throw null; }
public static System.Buffers.OperationStatus DecodeFromUtf8(System.ReadOnlySpan<byte> source, out System.Text.Rune result, out int bytesConsumed) { throw null; }
public static System.Buffers.OperationStatus DecodeLastFromUtf16(System.ReadOnlySpan<char> source, out System.Text.Rune result, out int charsConsumed) { throw null; }
public static System.Buffers.OperationStatus DecodeLastFromUtf8(System.ReadOnlySpan<byte> source, out System.Text.Rune value, out int bytesConsumed) { throw null; }
public int EncodeToUtf16(System.Span<char> destination) { throw null; }
public int EncodeToUtf8(System.Span<byte> destination) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Text.Rune other) { throw null; }
public override int GetHashCode() { throw null; }
public static double GetNumericValue(System.Text.Rune value) { throw null; }
public static System.Text.Rune GetRuneAt(string input, int index) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(System.Text.Rune value) { throw null; }
public static bool IsControl(System.Text.Rune value) { throw null; }
public static bool IsDigit(System.Text.Rune value) { throw null; }
public static bool IsLetter(System.Text.Rune value) { throw null; }
public static bool IsLetterOrDigit(System.Text.Rune value) { throw null; }
public static bool IsLower(System.Text.Rune value) { throw null; }
public static bool IsNumber(System.Text.Rune value) { throw null; }
public static bool IsPunctuation(System.Text.Rune value) { throw null; }
public static bool IsSeparator(System.Text.Rune value) { throw null; }
public static bool IsSymbol(System.Text.Rune value) { throw null; }
public static bool IsUpper(System.Text.Rune value) { throw null; }
public static bool IsValid(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool IsValid(uint value) { throw null; }
public static bool IsWhiteSpace(System.Text.Rune value) { throw null; }
public static bool operator ==(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static explicit operator System.Text.Rune (char ch) { throw null; }
public static explicit operator System.Text.Rune (int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator System.Text.Rune (uint value) { throw null; }
public static bool operator >(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static bool operator >=(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static bool operator !=(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static bool operator <(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static bool operator <=(System.Text.Rune left, System.Text.Rune right) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
string System.IFormattable.ToString(string? format, System.IFormatProvider? formatProvider) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
public static System.Text.Rune ToLower(System.Text.Rune value, System.Globalization.CultureInfo culture) { throw null; }
public static System.Text.Rune ToLowerInvariant(System.Text.Rune value) { throw null; }
public override string ToString() { throw null; }
public static System.Text.Rune ToUpper(System.Text.Rune value, System.Globalization.CultureInfo culture) { throw null; }
public static System.Text.Rune ToUpperInvariant(System.Text.Rune value) { throw null; }
public static bool TryCreate(char highSurrogate, char lowSurrogate, out System.Text.Rune result) { throw null; }
public static bool TryCreate(char ch, out System.Text.Rune result) { throw null; }
public static bool TryCreate(int value, out System.Text.Rune result) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool TryCreate(uint value, out System.Text.Rune result) { throw null; }
public bool TryEncodeToUtf16(System.Span<char> destination, out int charsWritten) { throw null; }
public bool TryEncodeToUtf8(System.Span<byte> destination, out int bytesWritten) { throw null; }
public static bool TryGetRuneAt(string input, int index, out System.Text.Rune value) { throw null; }
}
public sealed partial class StringBuilder : System.Runtime.Serialization.ISerializable
{
public StringBuilder() { }
public StringBuilder(int capacity) { }
public StringBuilder(int capacity, int maxCapacity) { }
public StringBuilder(string? value) { }
public StringBuilder(string? value, int capacity) { }
public StringBuilder(string? value, int startIndex, int length, int capacity) { }
public int Capacity { get { throw null; } set { } }
[System.Runtime.CompilerServices.IndexerName("Chars")]
public char this[int index] { get { throw null; } set { } }
public int Length { get { throw null; } set { } }
public int MaxCapacity { get { throw null; } }
public System.Text.StringBuilder Append(bool value) { throw null; }
public System.Text.StringBuilder Append(byte value) { throw null; }
public System.Text.StringBuilder Append(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe System.Text.StringBuilder Append(char* value, int valueCount) { throw null; }
public System.Text.StringBuilder Append(char value, int repeatCount) { throw null; }
public System.Text.StringBuilder Append(char[]? value) { throw null; }
public System.Text.StringBuilder Append(char[]? value, int startIndex, int charCount) { throw null; }
public System.Text.StringBuilder Append(decimal value) { throw null; }
public System.Text.StringBuilder Append(double value) { throw null; }
public System.Text.StringBuilder Append(System.IFormatProvider? provider, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute(new string[]{ "", "provider"})] ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler) { throw null; }
public System.Text.StringBuilder Append(short value) { throw null; }
public System.Text.StringBuilder Append(int value) { throw null; }
public System.Text.StringBuilder Append(long value) { throw null; }
public System.Text.StringBuilder Append(object? value) { throw null; }
public System.Text.StringBuilder Append(System.ReadOnlyMemory<char> value) { throw null; }
public System.Text.StringBuilder Append(System.ReadOnlySpan<char> value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Append(sbyte value) { throw null; }
public System.Text.StringBuilder Append(float value) { throw null; }
public System.Text.StringBuilder Append(string? value) { throw null; }
public System.Text.StringBuilder Append(string? value, int startIndex, int count) { throw null; }
public System.Text.StringBuilder Append(System.Text.StringBuilder? value) { throw null; }
public System.Text.StringBuilder Append(System.Text.StringBuilder? value, int startIndex, int count) { throw null; }
public System.Text.StringBuilder Append([System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("")] ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Append(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Append(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Append(ulong value) { throw null; }
public System.Text.StringBuilder AppendFormat(System.IFormatProvider? provider, string format, object? arg0) { throw null; }
public System.Text.StringBuilder AppendFormat(System.IFormatProvider? provider, string format, object? arg0, object? arg1) { throw null; }
public System.Text.StringBuilder AppendFormat(System.IFormatProvider? provider, string format, object? arg0, object? arg1, object? arg2) { throw null; }
public System.Text.StringBuilder AppendFormat(System.IFormatProvider? provider, string format, params object?[] args) { throw null; }
public System.Text.StringBuilder AppendFormat(string format, object? arg0) { throw null; }
public System.Text.StringBuilder AppendFormat(string format, object? arg0, object? arg1) { throw null; }
public System.Text.StringBuilder AppendFormat(string format, object? arg0, object? arg1, object? arg2) { throw null; }
public System.Text.StringBuilder AppendFormat(string format, params object?[] args) { throw null; }
public System.Text.StringBuilder AppendJoin(char separator, params object?[] values) { throw null; }
public System.Text.StringBuilder AppendJoin(char separator, params string?[] values) { throw null; }
public System.Text.StringBuilder AppendJoin(string? separator, params object?[] values) { throw null; }
public System.Text.StringBuilder AppendJoin(string? separator, params string?[] values) { throw null; }
public System.Text.StringBuilder AppendJoin<T>(char separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
public System.Text.StringBuilder AppendJoin<T>(string? separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
public System.Text.StringBuilder AppendLine() { throw null; }
public System.Text.StringBuilder AppendLine(System.IFormatProvider? provider, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute(new string[]{ "", "provider"})] ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler) { throw null; }
public System.Text.StringBuilder AppendLine(string? value) { throw null; }
public System.Text.StringBuilder AppendLine([System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("")] ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler) { throw null; }
public System.Text.StringBuilder Clear() { throw null; }
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { }
public void CopyTo(int sourceIndex, System.Span<char> destination, int count) { }
public int EnsureCapacity(int capacity) { throw null; }
public bool Equals(System.ReadOnlySpan<char> span) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Text.StringBuilder? sb) { throw null; }
public System.Text.StringBuilder.ChunkEnumerator GetChunks() { throw null; }
public System.Text.StringBuilder Insert(int index, bool value) { throw null; }
public System.Text.StringBuilder Insert(int index, byte value) { throw null; }
public System.Text.StringBuilder Insert(int index, char value) { throw null; }
public System.Text.StringBuilder Insert(int index, char[]? value) { throw null; }
public System.Text.StringBuilder Insert(int index, char[]? value, int startIndex, int charCount) { throw null; }
public System.Text.StringBuilder Insert(int index, decimal value) { throw null; }
public System.Text.StringBuilder Insert(int index, double value) { throw null; }
public System.Text.StringBuilder Insert(int index, short value) { throw null; }
public System.Text.StringBuilder Insert(int index, int value) { throw null; }
public System.Text.StringBuilder Insert(int index, long value) { throw null; }
public System.Text.StringBuilder Insert(int index, object? value) { throw null; }
public System.Text.StringBuilder Insert(int index, System.ReadOnlySpan<char> value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Insert(int index, sbyte value) { throw null; }
public System.Text.StringBuilder Insert(int index, float value) { throw null; }
public System.Text.StringBuilder Insert(int index, string? value) { throw null; }
public System.Text.StringBuilder Insert(int index, string? value, int count) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Insert(int index, ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Insert(int index, uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Insert(int index, ulong value) { throw null; }
public System.Text.StringBuilder Remove(int startIndex, int length) { throw null; }
public System.Text.StringBuilder Replace(char oldChar, char newChar) { throw null; }
public System.Text.StringBuilder Replace(char oldChar, char newChar, int startIndex, int count) { throw null; }
public System.Text.StringBuilder Replace(string oldValue, string? newValue) { throw null; }
public System.Text.StringBuilder Replace(string oldValue, string? newValue, int startIndex, int count) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
public string ToString(int startIndex, int length) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute]
public partial struct AppendInterpolatedStringHandler
{
private object _dummy;
private int _dummyPrimitive;
public AppendInterpolatedStringHandler(int literalLength, int formattedCount, System.Text.StringBuilder stringBuilder) { throw null; }
public AppendInterpolatedStringHandler(int literalLength, int formattedCount, System.Text.StringBuilder stringBuilder, System.IFormatProvider? provider) { throw null; }
public void AppendFormatted(object? value, int alignment = 0, string? format = null) { }
public void AppendFormatted(System.ReadOnlySpan<char> value) { }
public void AppendFormatted(System.ReadOnlySpan<char> value, int alignment = 0, string? format = null) { }
public void AppendFormatted(string? value) { }
public void AppendFormatted(string? value, int alignment = 0, string? format = null) { }
public void AppendFormatted<T>(T value) { }
public void AppendFormatted<T>(T value, int alignment) { }
public void AppendFormatted<T>(T value, int alignment, string? format) { }
public void AppendFormatted<T>(T value, string? format) { }
public void AppendLiteral(string value) { }
}
public partial struct ChunkEnumerator
{
private object _dummy;
private int _dummyPrimitive;
public System.ReadOnlyMemory<char> Current { get { throw null; } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public System.Text.StringBuilder.ChunkEnumerator GetEnumerator() { throw null; }
public bool MoveNext() { throw null; }
}
}
public partial struct StringRuneEnumerator : System.Collections.Generic.IEnumerable<System.Text.Rune>, System.Collections.Generic.IEnumerator<System.Text.Rune>, System.Collections.IEnumerable, System.Collections.IEnumerator, System.IDisposable
{
private object _dummy;
private int _dummyPrimitive;
public System.Text.Rune Current { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
public System.Text.StringRuneEnumerator GetEnumerator() { throw null; }
public bool MoveNext() { throw null; }
System.Collections.Generic.IEnumerator<System.Text.Rune> System.Collections.Generic.IEnumerable<System.Text.Rune>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
void System.Collections.IEnumerator.Reset() { }
void System.IDisposable.Dispose() { }
}
}
namespace System.Text.Unicode
{
public static partial class Utf8
{
public static System.Buffers.OperationStatus FromUtf16(System.ReadOnlySpan<char> source, System.Span<byte> destination, out int charsRead, out int bytesWritten, bool replaceInvalidSequences = true, bool isFinalBlock = true) { throw null; }
public static System.Buffers.OperationStatus ToUtf16(System.ReadOnlySpan<byte> source, System.Span<char> destination, out int bytesRead, out int charsWritten, bool replaceInvalidSequences = true, bool isFinalBlock = true) { throw null; }
}
}
namespace System.Threading
{
public readonly partial struct CancellationToken : System.IEquatable<System.Threading.CancellationToken>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public CancellationToken(bool canceled) { throw null; }
public bool CanBeCanceled { get { throw null; } }
public bool IsCancellationRequested { get { throw null; } }
public static System.Threading.CancellationToken None { get { throw null; } }
public System.Threading.WaitHandle WaitHandle { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other) { throw null; }
public bool Equals(System.Threading.CancellationToken other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Threading.CancellationToken left, System.Threading.CancellationToken right) { throw null; }
public static bool operator !=(System.Threading.CancellationToken left, System.Threading.CancellationToken right) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action callback) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action callback, bool useSynchronizationContext) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action<object?, System.Threading.CancellationToken> callback, object? state) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action<object?> callback, object? state) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action<object?> callback, object? state, bool useSynchronizationContext) { throw null; }
public void ThrowIfCancellationRequested() { }
public System.Threading.CancellationTokenRegistration UnsafeRegister(System.Action<object?, System.Threading.CancellationToken> callback, object? state) { throw null; }
public System.Threading.CancellationTokenRegistration UnsafeRegister(System.Action<object?> callback, object? state) { throw null; }
}
public readonly partial struct CancellationTokenRegistration : System.IAsyncDisposable, System.IDisposable, System.IEquatable<System.Threading.CancellationTokenRegistration>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Threading.CancellationToken Token { get { throw null; } }
public void Dispose() { }
public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Threading.CancellationTokenRegistration other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Threading.CancellationTokenRegistration left, System.Threading.CancellationTokenRegistration right) { throw null; }
public static bool operator !=(System.Threading.CancellationTokenRegistration left, System.Threading.CancellationTokenRegistration right) { throw null; }
public bool Unregister() { throw null; }
}
public partial class CancellationTokenSource : System.IDisposable
{
public CancellationTokenSource() { }
public CancellationTokenSource(int millisecondsDelay) { }
public CancellationTokenSource(System.TimeSpan delay) { }
public bool IsCancellationRequested { get { throw null; } }
public System.Threading.CancellationToken Token { get { throw null; } }
public void Cancel() { }
public void Cancel(bool throwOnFirstException) { }
public void CancelAfter(int millisecondsDelay) { }
public void CancelAfter(System.TimeSpan delay) { }
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource(System.Threading.CancellationToken token) { throw null; }
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource(System.Threading.CancellationToken token1, System.Threading.CancellationToken token2) { throw null; }
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource(params System.Threading.CancellationToken[] tokens) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public bool TryReset() { throw null; }
}
public enum LazyThreadSafetyMode
{
None = 0,
PublicationOnly = 1,
ExecutionAndPublication = 2,
}
public sealed partial class PeriodicTimer : System.IDisposable
{
public PeriodicTimer(System.TimeSpan period) { }
public void Dispose() { }
~PeriodicTimer() { }
public System.Threading.Tasks.ValueTask<bool> WaitForNextTickAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public static partial class Timeout
{
public const int Infinite = -1;
public static readonly System.TimeSpan InfiniteTimeSpan;
}
public sealed partial class Timer : System.MarshalByRefObject, System.IAsyncDisposable, System.IDisposable
{
public Timer(System.Threading.TimerCallback callback) { }
public Timer(System.Threading.TimerCallback callback, object? state, int dueTime, int period) { }
public Timer(System.Threading.TimerCallback callback, object? state, long dueTime, long period) { }
public Timer(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period) { }
[System.CLSCompliantAttribute(false)]
public Timer(System.Threading.TimerCallback callback, object? state, uint dueTime, uint period) { }
public static long ActiveCount { get { throw null; } }
public bool Change(int dueTime, int period) { throw null; }
public bool Change(long dueTime, long period) { throw null; }
public bool Change(System.TimeSpan dueTime, System.TimeSpan period) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool Change(uint dueTime, uint period) { throw null; }
public void Dispose() { }
public bool Dispose(System.Threading.WaitHandle notifyObject) { throw null; }
public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
}
public delegate void TimerCallback(object? state);
public abstract partial class WaitHandle : System.MarshalByRefObject, System.IDisposable
{
protected static readonly System.IntPtr InvalidHandle;
public const int WaitTimeout = 258;
protected WaitHandle() { }
[System.ObsoleteAttribute("WaitHandle.Handle has been deprecated. Use the SafeWaitHandle property instead.")]
public virtual System.IntPtr Handle { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public Microsoft.Win32.SafeHandles.SafeWaitHandle SafeWaitHandle { get { throw null; } set { } }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool explicitDisposing) { }
public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn) { throw null; }
public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn, int millisecondsTimeout, bool exitContext) { throw null; }
public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn, System.TimeSpan timeout, bool exitContext) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout, bool exitContext) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout, bool exitContext) { throw null; }
public virtual bool WaitOne() { throw null; }
public virtual bool WaitOne(int millisecondsTimeout) { throw null; }
public virtual bool WaitOne(int millisecondsTimeout, bool exitContext) { throw null; }
public virtual bool WaitOne(System.TimeSpan timeout) { throw null; }
public virtual bool WaitOne(System.TimeSpan timeout, bool exitContext) { throw null; }
}
public static partial class WaitHandleExtensions
{
public static Microsoft.Win32.SafeHandles.SafeWaitHandle GetSafeWaitHandle(this System.Threading.WaitHandle waitHandle) { throw null; }
public static void SetSafeWaitHandle(this System.Threading.WaitHandle waitHandle, Microsoft.Win32.SafeHandles.SafeWaitHandle? value) { }
}
}
namespace System.Threading.Tasks
{
public partial class ConcurrentExclusiveSchedulerPair
{
public ConcurrentExclusiveSchedulerPair() { }
public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler) { }
public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler, int maxConcurrencyLevel) { }
public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler, int maxConcurrencyLevel, int maxItemsPerTask) { }
public System.Threading.Tasks.Task Completion { get { throw null; } }
public System.Threading.Tasks.TaskScheduler ConcurrentScheduler { get { throw null; } }
public System.Threading.Tasks.TaskScheduler ExclusiveScheduler { get { throw null; } }
public void Complete() { }
}
public partial class Task : System.IAsyncResult, System.IDisposable
{
public Task(System.Action action) { }
public Task(System.Action action, System.Threading.CancellationToken cancellationToken) { }
public Task(System.Action action, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public Task(System.Action action, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public Task(System.Action<object?> action, object? state) { }
public Task(System.Action<object?> action, object? state, System.Threading.CancellationToken cancellationToken) { }
public Task(System.Action<object?> action, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public Task(System.Action<object?> action, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public object? AsyncState { get { throw null; } }
public static System.Threading.Tasks.Task CompletedTask { get { throw null; } }
public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
public static int? CurrentId { get { throw null; } }
public System.AggregateException? Exception { get { throw null; } }
public static System.Threading.Tasks.TaskFactory Factory { get { throw null; } }
public int Id { get { throw null; } }
public bool IsCanceled { get { throw null; } }
public bool IsCompleted { get { throw null; } }
public bool IsCompletedSuccessfully { get { throw null; } }
public bool IsFaulted { get { throw null; } }
public System.Threading.Tasks.TaskStatus Status { get { throw null; } }
System.Threading.WaitHandle System.IAsyncResult.AsyncWaitHandle { get { throw null; } }
bool System.IAsyncResult.CompletedSynchronously { get { throw null; } }
public System.Runtime.CompilerServices.ConfiguredTaskAwaitable ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public static System.Threading.Tasks.Task Delay(int millisecondsDelay) { throw null; }
public static System.Threading.Tasks.Task Delay(int millisecondsDelay, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task Delay(System.TimeSpan delay) { throw null; }
public static System.Threading.Tasks.Task Delay(System.TimeSpan delay, System.Threading.CancellationToken cancellationToken) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public static System.Threading.Tasks.Task FromCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task<TResult> FromCanceled<TResult>(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task FromException(System.Exception exception) { throw null; }
public static System.Threading.Tasks.Task<TResult> FromException<TResult>(System.Exception exception) { throw null; }
public static System.Threading.Tasks.Task<TResult> FromResult<TResult>(TResult result) { throw null; }
public System.Runtime.CompilerServices.TaskAwaiter GetAwaiter() { throw null; }
public static System.Threading.Tasks.Task Run(System.Action action) { throw null; }
public static System.Threading.Tasks.Task Run(System.Action action, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task Run(System.Func<System.Threading.Tasks.Task?> function) { throw null; }
public static System.Threading.Tasks.Task Run(System.Func<System.Threading.Tasks.Task?> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public void RunSynchronously() { }
public void RunSynchronously(System.Threading.Tasks.TaskScheduler scheduler) { }
public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<System.Threading.Tasks.Task<TResult>?> function) { throw null; }
public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<System.Threading.Tasks.Task<TResult>?> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<TResult> function) { throw null; }
public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public void Start() { }
public void Start(System.Threading.Tasks.TaskScheduler scheduler) { }
public void Wait() { }
public bool Wait(int millisecondsTimeout) { throw null; }
public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
public void Wait(System.Threading.CancellationToken cancellationToken) { }
public bool Wait(System.TimeSpan timeout) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static void WaitAll(params System.Threading.Tasks.Task[] tasks) { }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static void WaitAll(System.Threading.Tasks.Task[] tasks, System.Threading.CancellationToken cancellationToken) { }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, System.TimeSpan timeout) { throw null; }
public static int WaitAny(params System.Threading.Tasks.Task[] tasks) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, System.Threading.CancellationToken cancellationToken) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, System.TimeSpan timeout) { throw null; }
public System.Threading.Tasks.Task WaitAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task WaitAsync(System.TimeSpan timeout) { throw null; }
public System.Threading.Tasks.Task WaitAsync(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task WhenAll(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task> tasks) { throw null; }
public static System.Threading.Tasks.Task WhenAll(params System.Threading.Tasks.Task[] tasks) { throw null; }
public static System.Threading.Tasks.Task<TResult[]> WhenAll<TResult>(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<TResult>> tasks) { throw null; }
public static System.Threading.Tasks.Task<TResult[]> WhenAll<TResult>(params System.Threading.Tasks.Task<TResult>[] tasks) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task> WhenAny(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task> tasks) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task> WhenAny(System.Threading.Tasks.Task task1, System.Threading.Tasks.Task task2) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task> WhenAny(params System.Threading.Tasks.Task[] tasks) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> WhenAny<TResult>(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<TResult>> tasks) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> WhenAny<TResult>(System.Threading.Tasks.Task<TResult> task1, System.Threading.Tasks.Task<TResult> task2) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> WhenAny<TResult>(params System.Threading.Tasks.Task<TResult>[] tasks) { throw null; }
public static System.Runtime.CompilerServices.YieldAwaitable Yield() { throw null; }
}
public static partial class TaskAsyncEnumerableExtensions
{
public static System.Runtime.CompilerServices.ConfiguredAsyncDisposable ConfigureAwait(this System.IAsyncDisposable source, bool continueOnCapturedContext) { throw null; }
public static System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(this System.Collections.Generic.IAsyncEnumerable<T> source, bool continueOnCapturedContext) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static System.Collections.Generic.IEnumerable<T> ToBlockingEnumerable<T>(this System.Collections.Generic.IAsyncEnumerable<T> source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(this System.Collections.Generic.IAsyncEnumerable<T> source, System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class TaskCanceledException : System.OperationCanceledException
{
public TaskCanceledException() { }
protected TaskCanceledException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TaskCanceledException(string? message) { }
public TaskCanceledException(string? message, System.Exception? innerException) { }
public TaskCanceledException(string? message, System.Exception? innerException, System.Threading.CancellationToken token) { }
public TaskCanceledException(System.Threading.Tasks.Task? task) { }
public System.Threading.Tasks.Task? Task { get { throw null; } }
}
public partial class TaskCompletionSource
{
public TaskCompletionSource() { }
public TaskCompletionSource(object? state) { }
public TaskCompletionSource(object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public TaskCompletionSource(System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public System.Threading.Tasks.Task Task { get { throw null; } }
public void SetCanceled() { }
public void SetCanceled(System.Threading.CancellationToken cancellationToken) { }
public void SetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public bool TrySetCanceled() { throw null; }
public bool TrySetCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
public bool TrySetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { throw null; }
public bool TrySetException(System.Exception exception) { throw null; }
public bool TrySetResult() { throw null; }
}
public partial class TaskCompletionSource<TResult>
{
public TaskCompletionSource() { }
public TaskCompletionSource(object? state) { }
public TaskCompletionSource(object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public TaskCompletionSource(System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public System.Threading.Tasks.Task<TResult> Task { get { throw null; } }
public void SetCanceled() { }
public void SetCanceled(System.Threading.CancellationToken cancellationToken) { }
public void SetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { }
public void SetException(System.Exception exception) { }
public void SetResult(TResult result) { }
public bool TrySetCanceled() { throw null; }
public bool TrySetCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
public bool TrySetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { throw null; }
public bool TrySetException(System.Exception exception) { throw null; }
public bool TrySetResult(TResult result) { throw null; }
}
[System.FlagsAttribute]
public enum TaskContinuationOptions
{
None = 0,
PreferFairness = 1,
LongRunning = 2,
AttachedToParent = 4,
DenyChildAttach = 8,
HideScheduler = 16,
LazyCancellation = 32,
RunContinuationsAsynchronously = 64,
NotOnRanToCompletion = 65536,
NotOnFaulted = 131072,
OnlyOnCanceled = 196608,
NotOnCanceled = 262144,
OnlyOnFaulted = 327680,
OnlyOnRanToCompletion = 393216,
ExecuteSynchronously = 524288,
}
[System.FlagsAttribute]
public enum TaskCreationOptions
{
None = 0,
PreferFairness = 1,
LongRunning = 2,
AttachedToParent = 4,
DenyChildAttach = 8,
HideScheduler = 16,
RunContinuationsAsynchronously = 64,
}
public static partial class TaskExtensions
{
public static System.Threading.Tasks.Task Unwrap(this System.Threading.Tasks.Task<System.Threading.Tasks.Task> task) { throw null; }
public static System.Threading.Tasks.Task<TResult> Unwrap<TResult>(this System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> task) { throw null; }
}
public partial class TaskFactory
{
public TaskFactory() { }
public TaskFactory(System.Threading.CancellationToken cancellationToken) { }
public TaskFactory(System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler? scheduler) { }
public TaskFactory(System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { }
public TaskFactory(System.Threading.Tasks.TaskScheduler? scheduler) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } }
public System.Threading.Tasks.TaskContinuationOptions ContinuationOptions { get { throw null; } }
public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
public System.Threading.Tasks.TaskScheduler? Scheduler { get { throw null; } }
public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, object? state) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, object? state) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TResult>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TResult>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object? state) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TResult>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TResult>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action action) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action<object?> action, object? state) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action<object?> action, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action<object?> action, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action<object?> action, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object?, TResult> function, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object?, TResult> function, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
}
public partial class TaskFactory<TResult>
{
public TaskFactory() { }
public TaskFactory(System.Threading.CancellationToken cancellationToken) { }
public TaskFactory(System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler? scheduler) { }
public TaskFactory(System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { }
public TaskFactory(System.Threading.Tasks.TaskScheduler? scheduler) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } }
public System.Threading.Tasks.TaskContinuationOptions ContinuationOptions { get { throw null; } }
public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
public System.Threading.Tasks.TaskScheduler? Scheduler { get { throw null; } }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object?, TResult> function, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object?, TResult> function, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
}
public abstract partial class TaskScheduler
{
protected TaskScheduler() { }
public static System.Threading.Tasks.TaskScheduler Current { get { throw null; } }
public static System.Threading.Tasks.TaskScheduler Default { get { throw null; } }
public int Id { get { throw null; } }
public virtual int MaximumConcurrencyLevel { get { throw null; } }
public static event System.EventHandler<System.Threading.Tasks.UnobservedTaskExceptionEventArgs>? UnobservedTaskException { add { } remove { } }
public static System.Threading.Tasks.TaskScheduler FromCurrentSynchronizationContext() { throw null; }
protected abstract System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task>? GetScheduledTasks();
protected internal abstract void QueueTask(System.Threading.Tasks.Task task);
protected internal virtual bool TryDequeue(System.Threading.Tasks.Task task) { throw null; }
protected bool TryExecuteTask(System.Threading.Tasks.Task task) { throw null; }
protected abstract bool TryExecuteTaskInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued);
}
public partial class TaskSchedulerException : System.Exception
{
public TaskSchedulerException() { }
public TaskSchedulerException(System.Exception? innerException) { }
protected TaskSchedulerException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TaskSchedulerException(string? message) { }
public TaskSchedulerException(string? message, System.Exception? innerException) { }
}
public enum TaskStatus
{
Created = 0,
WaitingForActivation = 1,
WaitingToRun = 2,
Running = 3,
WaitingForChildrenToComplete = 4,
RanToCompletion = 5,
Canceled = 6,
Faulted = 7,
}
public partial class Task<TResult> : System.Threading.Tasks.Task
{
public Task(System.Func<object?, TResult> function, object? state) : base (default(System.Action)) { }
public Task(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken) : base (default(System.Action)) { }
public Task(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
public Task(System.Func<object?, TResult> function, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
public Task(System.Func<TResult> function) : base (default(System.Action)) { }
public Task(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) : base (default(System.Action)) { }
public Task(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
public Task(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
public static new System.Threading.Tasks.TaskFactory<TResult> Factory { get { throw null; } }
public TResult Result { get { throw null; } }
public new System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public new System.Runtime.CompilerServices.TaskAwaiter<TResult> GetAwaiter() { throw null; }
public new System.Threading.Tasks.Task<TResult> WaitAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public new System.Threading.Tasks.Task<TResult> WaitAsync(System.TimeSpan timeout) { throw null; }
public new System.Threading.Tasks.Task<TResult> WaitAsync(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class UnobservedTaskExceptionEventArgs : System.EventArgs
{
public UnobservedTaskExceptionEventArgs(System.AggregateException exception) { }
public System.AggregateException Exception { get { throw null; } }
public bool Observed { get { throw null; } }
public void SetObserved() { }
}
[System.Runtime.CompilerServices.AsyncMethodBuilderAttribute(typeof(System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder))]
public readonly partial struct ValueTask : System.IEquatable<System.Threading.Tasks.ValueTask>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ValueTask(System.Threading.Tasks.Sources.IValueTaskSource source, short token) { throw null; }
public ValueTask(System.Threading.Tasks.Task task) { throw null; }
public static System.Threading.Tasks.ValueTask CompletedTask { get { throw null; } }
public bool IsCanceled { get { throw null; } }
public bool IsCompleted { get { throw null; } }
public bool IsCompletedSuccessfully { get { throw null; } }
public bool IsFaulted { get { throw null; } }
public System.Threading.Tasks.Task AsTask() { throw null; }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Threading.Tasks.ValueTask other) { throw null; }
public static System.Threading.Tasks.ValueTask FromCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.ValueTask<TResult> FromCanceled<TResult>(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.ValueTask FromException(System.Exception exception) { throw null; }
public static System.Threading.Tasks.ValueTask<TResult> FromException<TResult>(System.Exception exception) { throw null; }
public static System.Threading.Tasks.ValueTask<TResult> FromResult<TResult>(TResult result) { throw null; }
public System.Runtime.CompilerServices.ValueTaskAwaiter GetAwaiter() { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Threading.Tasks.ValueTask left, System.Threading.Tasks.ValueTask right) { throw null; }
public static bool operator !=(System.Threading.Tasks.ValueTask left, System.Threading.Tasks.ValueTask right) { throw null; }
public System.Threading.Tasks.ValueTask Preserve() { throw null; }
}
[System.Runtime.CompilerServices.AsyncMethodBuilderAttribute(typeof(System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<>))]
public readonly partial struct ValueTask<TResult> : System.IEquatable<System.Threading.Tasks.ValueTask<TResult>>
{
private readonly TResult _result;
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ValueTask(System.Threading.Tasks.Sources.IValueTaskSource<TResult> source, short token) { throw null; }
public ValueTask(System.Threading.Tasks.Task<TResult> task) { throw null; }
public ValueTask(TResult result) { throw null; }
public bool IsCanceled { get { throw null; } }
public bool IsCompleted { get { throw null; } }
public bool IsCompletedSuccessfully { get { throw null; } }
public bool IsFaulted { get { throw null; } }
public TResult Result { get { throw null; } }
public System.Threading.Tasks.Task<TResult> AsTask() { throw null; }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Threading.Tasks.ValueTask<TResult> other) { throw null; }
public System.Runtime.CompilerServices.ValueTaskAwaiter<TResult> GetAwaiter() { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Threading.Tasks.ValueTask<TResult> left, System.Threading.Tasks.ValueTask<TResult> right) { throw null; }
public static bool operator !=(System.Threading.Tasks.ValueTask<TResult> left, System.Threading.Tasks.ValueTask<TResult> right) { throw null; }
public System.Threading.Tasks.ValueTask<TResult> Preserve() { throw null; }
public override string? ToString() { throw null; }
}
}
namespace System.Threading.Tasks.Sources
{
public partial interface IValueTaskSource
{
void GetResult(short token);
System.Threading.Tasks.Sources.ValueTaskSourceStatus GetStatus(short token);
void OnCompleted(System.Action<object?> continuation, object? state, short token, System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags flags);
}
public partial interface IValueTaskSource<out TResult>
{
TResult GetResult(short token);
System.Threading.Tasks.Sources.ValueTaskSourceStatus GetStatus(short token);
void OnCompleted(System.Action<object?> continuation, object? state, short token, System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags flags);
}
public partial struct ManualResetValueTaskSourceCore<TResult>
{
private TResult _result;
private object _dummy;
private int _dummyPrimitive;
public bool RunContinuationsAsynchronously { readonly get { throw null; } set { } }
public short Version { get { throw null; } }
public TResult GetResult(short token) { throw null; }
public System.Threading.Tasks.Sources.ValueTaskSourceStatus GetStatus(short token) { throw null; }
public void OnCompleted(System.Action<object?> continuation, object? state, short token, System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags flags) { }
public void Reset() { }
public void SetException(System.Exception error) { }
public void SetResult(TResult result) { }
}
[System.FlagsAttribute]
public enum ValueTaskSourceOnCompletedFlags
{
None = 0,
UseSchedulingContext = 1,
FlowExecutionContext = 2,
}
public enum ValueTaskSourceStatus
{
Pending = 0,
Succeeded = 1,
Faulted = 2,
Canceled = 3,
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace Microsoft.Win32.SafeHandles
{
public abstract partial class CriticalHandleMinusOneIsInvalid : System.Runtime.InteropServices.CriticalHandle
{
protected CriticalHandleMinusOneIsInvalid() : base (default(System.IntPtr)) { }
public override bool IsInvalid { get { throw null; } }
}
public abstract partial class CriticalHandleZeroOrMinusOneIsInvalid : System.Runtime.InteropServices.CriticalHandle
{
protected CriticalHandleZeroOrMinusOneIsInvalid() : base (default(System.IntPtr)) { }
public override bool IsInvalid { get { throw null; } }
}
public sealed partial class SafeFileHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
public SafeFileHandle() : base (default(bool)) { }
public SafeFileHandle(System.IntPtr preexistingHandle, bool ownsHandle) : base (default(bool)) { }
public override bool IsInvalid { get { throw null; } }
public bool IsAsync { get { throw null; } }
protected override bool ReleaseHandle() { throw null; }
}
public abstract partial class SafeHandleMinusOneIsInvalid : System.Runtime.InteropServices.SafeHandle
{
protected SafeHandleMinusOneIsInvalid(bool ownsHandle) : base (default(System.IntPtr), default(bool)) { }
public override bool IsInvalid { get { throw null; } }
}
public abstract partial class SafeHandleZeroOrMinusOneIsInvalid : System.Runtime.InteropServices.SafeHandle
{
protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base (default(System.IntPtr), default(bool)) { }
public override bool IsInvalid { get { throw null; } }
}
public sealed partial class SafeWaitHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
public SafeWaitHandle() : base (default(bool)) { }
public SafeWaitHandle(System.IntPtr existingHandle, bool ownsHandle) : base (default(bool)) { }
protected override bool ReleaseHandle() { throw null; }
}
}
namespace System
{
public partial class AccessViolationException : System.SystemException
{
public AccessViolationException() { }
protected AccessViolationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public AccessViolationException(string? message) { }
public AccessViolationException(string? message, System.Exception? innerException) { }
}
public delegate void Action();
public delegate void Action<in T>(T obj);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, in T16>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16);
public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
public delegate void Action<in T1, in T2, in T3>(T1 arg1, T2 arg2, T3 arg3);
public delegate void Action<in T1, in T2, in T3, in T4>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
public delegate void Action<in T1, in T2, in T3, in T4, in T5>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
public static partial class Activator
{
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName, object?[]? activationAttributes) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] System.Type type) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, bool nonPublic) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, params object?[]? args) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, object?[]? args, object?[]? activationAttributes) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture) { throw null; }
public static object? CreateInstance([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public static System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName, object?[]? activationAttributes) { throw null; }
public static T CreateInstance<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T>() { throw null; }
}
public partial class AggregateException : System.Exception
{
public AggregateException() { }
public AggregateException(System.Collections.Generic.IEnumerable<System.Exception> innerExceptions) { }
public AggregateException(params System.Exception[] innerExceptions) { }
protected AggregateException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public AggregateException(string? message) { }
public AggregateException(string? message, System.Collections.Generic.IEnumerable<System.Exception> innerExceptions) { }
public AggregateException(string? message, System.Exception innerException) { }
public AggregateException(string? message, params System.Exception[] innerExceptions) { }
public System.Collections.ObjectModel.ReadOnlyCollection<System.Exception> InnerExceptions { get { throw null; } }
public override string Message { get { throw null; } }
public System.AggregateException Flatten() { throw null; }
public override System.Exception GetBaseException() { throw null; }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public void Handle(System.Func<System.Exception, bool> predicate) { }
public override string ToString() { throw null; }
}
public static partial class AppContext
{
public static string BaseDirectory { get { throw null; } }
public static string? TargetFrameworkName { get { throw null; } }
public static object? GetData(string name) { throw null; }
public static void SetData(string name, object? data) { }
public static void SetSwitch(string switchName, bool isEnabled) { }
public static bool TryGetSwitch(string switchName, out bool isEnabled) { throw null; }
}
public sealed partial class AppDomain : System.MarshalByRefObject
{
internal AppDomain() { }
public string BaseDirectory { get { throw null; } }
public static System.AppDomain CurrentDomain { get { throw null; } }
public string? DynamicDirectory { get { throw null; } }
public string FriendlyName { get { throw null; } }
public int Id { get { throw null; } }
public bool IsFullyTrusted { get { throw null; } }
public bool IsHomogenous { get { throw null; } }
public static bool MonitoringIsEnabled { get { throw null; } set { } }
public long MonitoringSurvivedMemorySize { get { throw null; } }
public static long MonitoringSurvivedProcessMemorySize { get { throw null; } }
public long MonitoringTotalAllocatedMemorySize { get { throw null; } }
public System.TimeSpan MonitoringTotalProcessorTime { get { throw null; } }
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Security.PermissionSet PermissionSet { get { throw null; } }
public string? RelativeSearchPath { get { throw null; } }
public System.AppDomainSetup SetupInformation { get { throw null; } }
public bool ShadowCopyFiles { get { throw null; } }
public event System.AssemblyLoadEventHandler? AssemblyLoad { add { } remove { } }
public event System.ResolveEventHandler? AssemblyResolve { add { } remove { } }
public event System.EventHandler? DomainUnload { add { } remove { } }
public event System.EventHandler<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>? FirstChanceException { add { } remove { } }
public event System.EventHandler? ProcessExit { add { } remove { } }
public event System.ResolveEventHandler? ReflectionOnlyAssemblyResolve { add { } remove { } }
public event System.ResolveEventHandler? ResourceResolve { add { } remove { } }
public event System.ResolveEventHandler? TypeResolve { add { } remove { } }
public event System.UnhandledExceptionEventHandler? UnhandledException { add { } remove { } }
[System.ObsoleteAttribute("AppDomain.AppendPrivatePath has been deprecated and is not supported.")]
public void AppendPrivatePath(string? path) { }
public string ApplyPolicy(string assemblyName) { throw null; }
[System.ObsoleteAttribute("AppDomain.ClearPrivatePath has been deprecated and is not supported.")]
public void ClearPrivatePath() { }
[System.ObsoleteAttribute("AppDomain.ClearShadowCopyPath has been deprecated and is not supported.")]
public void ClearShadowCopyPath() { }
[System.ObsoleteAttribute("Creating and unloading AppDomains is not supported and throws an exception.", DiagnosticId = "SYSLIB0024", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static System.AppDomain CreateDomain(string friendlyName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstance(string assemblyName, string typeName, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceAndUnwrap(string assemblyName, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceAndUnwrap(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceAndUnwrap(string assemblyName, string typeName, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public System.Runtime.Remoting.ObjectHandle? CreateInstanceFrom(string assemblyFile, string typeName, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object?[]? args, System.Globalization.CultureInfo? culture, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Type and its constructor could be removed")]
public object? CreateInstanceFromAndUnwrap(string assemblyFile, string typeName, object?[]? activationAttributes) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public int ExecuteAssembly(string assemblyFile) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public int ExecuteAssembly(string assemblyFile, string?[]? args) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public int ExecuteAssembly(string assemblyFile, string?[]? args, byte[]? hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm) { throw null; }
public int ExecuteAssemblyByName(System.Reflection.AssemblyName assemblyName, params string?[]? args) { throw null; }
public int ExecuteAssemblyByName(string assemblyName) { throw null; }
public int ExecuteAssemblyByName(string assemblyName, params string?[]? args) { throw null; }
public System.Reflection.Assembly[] GetAssemblies() { throw null; }
[System.ObsoleteAttribute("AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread instead.")]
public static int GetCurrentThreadId() { throw null; }
public object? GetData(string name) { throw null; }
public bool? IsCompatibilitySwitchSet(string value) { throw null; }
public bool IsDefaultAppDomain() { throw null; }
public bool IsFinalizingForUnload() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public System.Reflection.Assembly Load(byte[] rawAssembly) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public System.Reflection.Assembly Load(byte[] rawAssembly, byte[]? rawSymbolStore) { throw null; }
public System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyRef) { throw null; }
public System.Reflection.Assembly Load(string assemblyString) { throw null; }
public System.Reflection.Assembly[] ReflectionOnlyGetAssemblies() { throw null; }
[System.ObsoleteAttribute("AppDomain.SetCachePath has been deprecated and is not supported.")]
public void SetCachePath(string? path) { }
public void SetData(string name, object? data) { }
[System.ObsoleteAttribute("AppDomain.SetDynamicBase has been deprecated and is not supported.")]
public void SetDynamicBase(string? path) { }
public void SetPrincipalPolicy(System.Security.Principal.PrincipalPolicy policy) { }
[System.ObsoleteAttribute("AppDomain.SetShadowCopyFiles has been deprecated and is not supported.")]
public void SetShadowCopyFiles() { }
[System.ObsoleteAttribute("AppDomain.SetShadowCopyPath has been deprecated and is not supported.")]
public void SetShadowCopyPath(string? path) { }
public void SetThreadPrincipal(System.Security.Principal.IPrincipal principal) { }
public override string ToString() { throw null; }
[System.ObsoleteAttribute("Creating and unloading AppDomains is not supported and throws an exception.", DiagnosticId = "SYSLIB0024", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void Unload(System.AppDomain domain) { }
}
public sealed partial class AppDomainSetup
{
internal AppDomainSetup() { }
public string? ApplicationBase { get { throw null; } }
public string? TargetFrameworkName { get { throw null; } }
}
public partial class AppDomainUnloadedException : System.SystemException
{
public AppDomainUnloadedException() { }
protected AppDomainUnloadedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public AppDomainUnloadedException(string? message) { }
public AppDomainUnloadedException(string? message, System.Exception? innerException) { }
}
public partial class ApplicationException : System.Exception
{
public ApplicationException() { }
protected ApplicationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ApplicationException(string? message) { }
public ApplicationException(string? message, System.Exception? innerException) { }
}
public sealed partial class ApplicationId
{
public ApplicationId(byte[] publicKeyToken, string name, System.Version version, string? processorArchitecture, string? culture) { }
public string? Culture { get { throw null; } }
public string Name { get { throw null; } }
public string? ProcessorArchitecture { get { throw null; } }
public byte[] PublicKeyToken { get { throw null; } }
public System.Version Version { get { throw null; } }
public System.ApplicationId Copy() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public ref partial struct ArgIterator
{
private int _dummyPrimitive;
public ArgIterator(System.RuntimeArgumentHandle arglist) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe ArgIterator(System.RuntimeArgumentHandle arglist, void* ptr) { throw null; }
public void End() { }
public override bool Equals(object? o) { throw null; }
public override int GetHashCode() { throw null; }
[System.CLSCompliantAttribute(false)]
public System.TypedReference GetNextArg() { throw null; }
[System.CLSCompliantAttribute(false)]
public System.TypedReference GetNextArg(System.RuntimeTypeHandle rth) { throw null; }
public System.RuntimeTypeHandle GetNextArgType() { throw null; }
public int GetRemainingCount() { throw null; }
}
public partial class ArgumentException : System.SystemException
{
public ArgumentException() { }
protected ArgumentException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArgumentException(string? message) { }
public ArgumentException(string? message, System.Exception? innerException) { }
public ArgumentException(string? message, string? paramName) { }
public ArgumentException(string? message, string? paramName, System.Exception? innerException) { }
public override string Message { get { throw null; } }
public virtual string? ParamName { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static void ThrowIfNullOrEmpty([System.Diagnostics.CodeAnalysis.NotNullAttribute] string? argument, [System.Runtime.CompilerServices.CallerArgumentExpression("argument")] string? paramName = null) { throw null; }
}
public partial class ArgumentNullException : System.ArgumentException
{
public ArgumentNullException() { }
protected ArgumentNullException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArgumentNullException(string? paramName) { }
public ArgumentNullException(string? message, System.Exception? innerException) { }
public ArgumentNullException(string? paramName, string? message) { }
public static void ThrowIfNull([System.Diagnostics.CodeAnalysis.NotNullAttribute] object? argument, [System.Runtime.CompilerServices.CallerArgumentExpressionAttribute("argument")] string? paramName = null) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void ThrowIfNull([System.Diagnostics.CodeAnalysis.NotNullAttribute] void* argument, [System.Runtime.CompilerServices.CallerArgumentExpressionAttribute("argument")] string? paramName = null) { throw null; }
}
public partial class ArgumentOutOfRangeException : System.ArgumentException
{
public ArgumentOutOfRangeException() { }
protected ArgumentOutOfRangeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArgumentOutOfRangeException(string? paramName) { }
public ArgumentOutOfRangeException(string? message, System.Exception? innerException) { }
public ArgumentOutOfRangeException(string? paramName, object? actualValue, string? message) { }
public ArgumentOutOfRangeException(string? paramName, string? message) { }
public virtual object? ActualValue { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class ArithmeticException : System.SystemException
{
public ArithmeticException() { }
protected ArithmeticException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArithmeticException(string? message) { }
public ArithmeticException(string? message, System.Exception? innerException) { }
}
public abstract partial class Array : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.ICloneable
{
internal Array() { }
public bool IsFixedSize { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public bool IsSynchronized { get { throw null; } }
public int Length { get { throw null; } }
public long LongLength { get { throw null; } }
public static int MaxLength { get { throw null; } }
public int Rank { get { throw null; } }
public object SyncRoot { get { throw null; } }
int System.Collections.ICollection.Count { get { throw null; } }
object? System.Collections.IList.this[int index] { get { throw null; } set { } }
public static System.Collections.ObjectModel.ReadOnlyCollection<T> AsReadOnly<T>(T[] array) { throw null; }
public static int BinarySearch(System.Array array, int index, int length, object? value) { throw null; }
public static int BinarySearch(System.Array array, int index, int length, object? value, System.Collections.IComparer? comparer) { throw null; }
public static int BinarySearch(System.Array array, object? value) { throw null; }
public static int BinarySearch(System.Array array, object? value, System.Collections.IComparer? comparer) { throw null; }
public static int BinarySearch<T>(T[] array, int index, int length, T value) { throw null; }
public static int BinarySearch<T>(T[] array, int index, int length, T value, System.Collections.Generic.IComparer<T>? comparer) { throw null; }
public static int BinarySearch<T>(T[] array, T value) { throw null; }
public static int BinarySearch<T>(T[] array, T value, System.Collections.Generic.IComparer<T>? comparer) { throw null; }
public static void Clear(System.Array array) { }
public static void Clear(System.Array array, int index, int length) { }
public object Clone() { throw null; }
public static void ConstrainedCopy(System.Array sourceArray, int sourceIndex, System.Array destinationArray, int destinationIndex, int length) { }
public static TOutput[] ConvertAll<TInput, TOutput>(TInput[] array, System.Converter<TInput, TOutput> converter) { throw null; }
public static void Copy(System.Array sourceArray, System.Array destinationArray, int length) { }
public static void Copy(System.Array sourceArray, System.Array destinationArray, long length) { }
public static void Copy(System.Array sourceArray, int sourceIndex, System.Array destinationArray, int destinationIndex, int length) { }
public static void Copy(System.Array sourceArray, long sourceIndex, System.Array destinationArray, long destinationIndex, long length) { }
public void CopyTo(System.Array array, int index) { }
public void CopyTo(System.Array array, long index) { }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public static System.Array CreateInstance(System.Type elementType, int length) { throw null; }
public static System.Array CreateInstance(System.Type elementType, int length1, int length2) { throw null; }
public static System.Array CreateInstance(System.Type elementType, int length1, int length2, int length3) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public static System.Array CreateInstance(System.Type elementType, params int[] lengths) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public static System.Array CreateInstance(System.Type elementType, int[] lengths, int[] lowerBounds) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public static System.Array CreateInstance(System.Type elementType, params long[] lengths) { throw null; }
public static T[] Empty<T>() { throw null; }
public static bool Exists<T>(T[] array, System.Predicate<T> match) { throw null; }
public static void Fill<T>(T[] array, T value) { }
public static void Fill<T>(T[] array, T value, int startIndex, int count) { }
public static T[] FindAll<T>(T[] array, System.Predicate<T> match) { throw null; }
public static int FindIndex<T>(T[] array, int startIndex, int count, System.Predicate<T> match) { throw null; }
public static int FindIndex<T>(T[] array, int startIndex, System.Predicate<T> match) { throw null; }
public static int FindIndex<T>(T[] array, System.Predicate<T> match) { throw null; }
public static int FindLastIndex<T>(T[] array, int startIndex, int count, System.Predicate<T> match) { throw null; }
public static int FindLastIndex<T>(T[] array, int startIndex, System.Predicate<T> match) { throw null; }
public static int FindLastIndex<T>(T[] array, System.Predicate<T> match) { throw null; }
public static T? FindLast<T>(T[] array, System.Predicate<T> match) { throw null; }
public static T? Find<T>(T[] array, System.Predicate<T> match) { throw null; }
public static void ForEach<T>(T[] array, System.Action<T> action) { }
public System.Collections.IEnumerator GetEnumerator() { throw null; }
public int GetLength(int dimension) { throw null; }
public long GetLongLength(int dimension) { throw null; }
public int GetLowerBound(int dimension) { throw null; }
public int GetUpperBound(int dimension) { throw null; }
public object? GetValue(int index) { throw null; }
public object? GetValue(int index1, int index2) { throw null; }
public object? GetValue(int index1, int index2, int index3) { throw null; }
public object? GetValue(params int[] indices) { throw null; }
public object? GetValue(long index) { throw null; }
public object? GetValue(long index1, long index2) { throw null; }
public object? GetValue(long index1, long index2, long index3) { throw null; }
public object? GetValue(params long[] indices) { throw null; }
public static int IndexOf(System.Array array, object? value) { throw null; }
public static int IndexOf(System.Array array, object? value, int startIndex) { throw null; }
public static int IndexOf(System.Array array, object? value, int startIndex, int count) { throw null; }
public static int IndexOf<T>(T[] array, T value) { throw null; }
public static int IndexOf<T>(T[] array, T value, int startIndex) { throw null; }
public static int IndexOf<T>(T[] array, T value, int startIndex, int count) { throw null; }
public void Initialize() { }
public static int LastIndexOf(System.Array array, object? value) { throw null; }
public static int LastIndexOf(System.Array array, object? value, int startIndex) { throw null; }
public static int LastIndexOf(System.Array array, object? value, int startIndex, int count) { throw null; }
public static int LastIndexOf<T>(T[] array, T value) { throw null; }
public static int LastIndexOf<T>(T[] array, T value, int startIndex) { throw null; }
public static int LastIndexOf<T>(T[] array, T value, int startIndex, int count) { throw null; }
public static void Resize<T>([System.Diagnostics.CodeAnalysis.NotNullAttribute] ref T[]? array, int newSize) { throw null; }
public static void Reverse(System.Array array) { }
public static void Reverse(System.Array array, int index, int length) { }
public static void Reverse<T>(T[] array) { }
public static void Reverse<T>(T[] array, int index, int length) { }
public void SetValue(object? value, int index) { }
public void SetValue(object? value, int index1, int index2) { }
public void SetValue(object? value, int index1, int index2, int index3) { }
public void SetValue(object? value, params int[] indices) { }
public void SetValue(object? value, long index) { }
public void SetValue(object? value, long index1, long index2) { }
public void SetValue(object? value, long index1, long index2, long index3) { }
public void SetValue(object? value, params long[] indices) { }
public static void Sort(System.Array array) { }
public static void Sort(System.Array keys, System.Array? items) { }
public static void Sort(System.Array keys, System.Array? items, System.Collections.IComparer? comparer) { }
public static void Sort(System.Array keys, System.Array? items, int index, int length) { }
public static void Sort(System.Array keys, System.Array? items, int index, int length, System.Collections.IComparer? comparer) { }
public static void Sort(System.Array array, System.Collections.IComparer? comparer) { }
public static void Sort(System.Array array, int index, int length) { }
public static void Sort(System.Array array, int index, int length, System.Collections.IComparer? comparer) { }
public static void Sort<T>(T[] array) { }
public static void Sort<T>(T[] array, System.Collections.Generic.IComparer<T>? comparer) { }
public static void Sort<T>(T[] array, System.Comparison<T> comparison) { }
public static void Sort<T>(T[] array, int index, int length) { }
public static void Sort<T>(T[] array, int index, int length, System.Collections.Generic.IComparer<T>? comparer) { }
public static void Sort<TKey, TValue>(TKey[] keys, TValue[]? items) { }
public static void Sort<TKey, TValue>(TKey[] keys, TValue[]? items, System.Collections.Generic.IComparer<TKey>? comparer) { }
public static void Sort<TKey, TValue>(TKey[] keys, TValue[]? items, int index, int length) { }
public static void Sort<TKey, TValue>(TKey[] keys, TValue[]? items, int index, int length, System.Collections.Generic.IComparer<TKey>? comparer) { }
int System.Collections.IList.Add(object? value) { throw null; }
void System.Collections.IList.Clear() { }
bool System.Collections.IList.Contains(object? value) { throw null; }
int System.Collections.IList.IndexOf(object? value) { throw null; }
void System.Collections.IList.Insert(int index, object? value) { }
void System.Collections.IList.Remove(object? value) { }
void System.Collections.IList.RemoveAt(int index) { }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
public static bool TrueForAll<T>(T[] array, System.Predicate<T> match) { throw null; }
}
public readonly partial struct ArraySegment<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.IEnumerable
{
private readonly T[] _array;
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ArraySegment(T[] array) { throw null; }
public ArraySegment(T[] array, int offset, int count) { throw null; }
public T[]? Array { get { throw null; } }
public int Count { get { throw null; } }
public static System.ArraySegment<T> Empty { get { throw null; } }
public T this[int index] { get { throw null; } set { } }
public int Offset { get { throw null; } }
bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
T System.Collections.Generic.IList<T>.this[int index] { get { throw null; } set { } }
T System.Collections.Generic.IReadOnlyList<T>.this[int index] { get { throw null; } }
public void CopyTo(System.ArraySegment<T> destination) { }
public void CopyTo(T[] destination) { }
public void CopyTo(T[] destination, int destinationIndex) { }
public bool Equals(System.ArraySegment<T> obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public System.ArraySegment<T>.Enumerator GetEnumerator() { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.ArraySegment<T> a, System.ArraySegment<T> b) { throw null; }
public static implicit operator System.ArraySegment<T> (T[] array) { throw null; }
public static bool operator !=(System.ArraySegment<T> a, System.ArraySegment<T> b) { throw null; }
public System.ArraySegment<T> Slice(int index) { throw null; }
public System.ArraySegment<T> Slice(int index, int count) { throw null; }
void System.Collections.Generic.ICollection<T>.Add(T item) { }
void System.Collections.Generic.ICollection<T>.Clear() { }
bool System.Collections.Generic.ICollection<T>.Contains(T item) { throw null; }
bool System.Collections.Generic.ICollection<T>.Remove(T item) { throw null; }
System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerable<T>.GetEnumerator() { throw null; }
int System.Collections.Generic.IList<T>.IndexOf(T item) { throw null; }
void System.Collections.Generic.IList<T>.Insert(int index, T item) { }
void System.Collections.Generic.IList<T>.RemoveAt(int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public T[] ToArray() { throw null; }
public partial struct Enumerator : System.Collections.Generic.IEnumerator<T>, System.Collections.IEnumerator, System.IDisposable
{
private readonly T[] _array;
private object _dummy;
private int _dummyPrimitive;
public T Current { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
public void Dispose() { }
public bool MoveNext() { throw null; }
void System.Collections.IEnumerator.Reset() { }
}
}
public partial class ArrayTypeMismatchException : System.SystemException
{
public ArrayTypeMismatchException() { }
protected ArrayTypeMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ArrayTypeMismatchException(string? message) { }
public ArrayTypeMismatchException(string? message, System.Exception? innerException) { }
}
public partial class AssemblyLoadEventArgs : System.EventArgs
{
public AssemblyLoadEventArgs(System.Reflection.Assembly loadedAssembly) { }
public System.Reflection.Assembly LoadedAssembly { get { throw null; } }
}
public delegate void AssemblyLoadEventHandler(object? sender, System.AssemblyLoadEventArgs args);
public delegate void AsyncCallback(System.IAsyncResult ar);
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=true, AllowMultiple=false)]
public abstract partial class Attribute
{
protected Attribute() { }
public virtual object TypeId { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.Module element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, System.Type attributeType) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, bool inherit) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public override int GetHashCode() { throw null; }
public virtual bool IsDefaultAttribute() { throw null; }
public static bool IsDefined(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static bool IsDefined(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
public static bool IsDefined(System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static bool IsDefined(System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static bool IsDefined(System.Reflection.Module element, System.Type attributeType) { throw null; }
public static bool IsDefined(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
public static bool IsDefined(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static bool IsDefined(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public virtual bool Match(object? obj) { throw null; }
}
[System.FlagsAttribute]
public enum AttributeTargets
{
Assembly = 1,
Module = 2,
Class = 4,
Struct = 8,
Enum = 16,
Constructor = 32,
Method = 64,
Property = 128,
Field = 256,
Event = 512,
Interface = 1024,
Parameter = 2048,
Delegate = 4096,
ReturnValue = 8192,
GenericParameter = 16384,
All = 32767,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class, Inherited=true)]
public sealed partial class AttributeUsageAttribute : System.Attribute
{
public AttributeUsageAttribute(System.AttributeTargets validOn) { }
public bool AllowMultiple { get { throw null; } set { } }
public bool Inherited { get { throw null; } set { } }
public System.AttributeTargets ValidOn { get { throw null; } }
}
public partial class BadImageFormatException : System.SystemException
{
public BadImageFormatException() { }
protected BadImageFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public BadImageFormatException(string? message) { }
public BadImageFormatException(string? message, System.Exception? inner) { }
public BadImageFormatException(string? message, string? fileName) { }
public BadImageFormatException(string? message, string? fileName, System.Exception? inner) { }
public string? FileName { get { throw null; } }
public string? FusionLog { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum Base64FormattingOptions
{
None = 0,
InsertLineBreaks = 1,
}
public static partial class BitConverter
{
public static readonly bool IsLittleEndian;
public static long DoubleToInt64Bits(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong DoubleToUInt64Bits(double value) { throw null; }
public static byte[] GetBytes(bool value) { throw null; }
public static byte[] GetBytes(char value) { throw null; }
public static byte[] GetBytes(double value) { throw null; }
public static byte[] GetBytes(System.Half value) { throw null; }
public static byte[] GetBytes(short value) { throw null; }
public static byte[] GetBytes(int value) { throw null; }
public static byte[] GetBytes(long value) { throw null; }
public static byte[] GetBytes(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte[] GetBytes(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte[] GetBytes(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte[] GetBytes(ulong value) { throw null; }
public static short HalfToInt16Bits(System.Half value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort HalfToUInt16Bits(System.Half value) { throw null; }
public static System.Half Int16BitsToHalf(short value) { throw null; }
public static float Int32BitsToSingle(int value) { throw null; }
public static double Int64BitsToDouble(long value) { throw null; }
public static int SingleToInt32Bits(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint SingleToUInt32Bits(float value) { throw null; }
public static bool ToBoolean(byte[] value, int startIndex) { throw null; }
public static bool ToBoolean(System.ReadOnlySpan<byte> value) { throw null; }
public static char ToChar(byte[] value, int startIndex) { throw null; }
public static char ToChar(System.ReadOnlySpan<byte> value) { throw null; }
public static double ToDouble(byte[] value, int startIndex) { throw null; }
public static double ToDouble(System.ReadOnlySpan<byte> value) { throw null; }
public static System.Half ToHalf(byte[] value, int startIndex) { throw null; }
public static System.Half ToHalf(System.ReadOnlySpan<byte> value) { throw null; }
public static short ToInt16(byte[] value, int startIndex) { throw null; }
public static short ToInt16(System.ReadOnlySpan<byte> value) { throw null; }
public static int ToInt32(byte[] value, int startIndex) { throw null; }
public static int ToInt32(System.ReadOnlySpan<byte> value) { throw null; }
public static long ToInt64(byte[] value, int startIndex) { throw null; }
public static long ToInt64(System.ReadOnlySpan<byte> value) { throw null; }
public static float ToSingle(byte[] value, int startIndex) { throw null; }
public static float ToSingle(System.ReadOnlySpan<byte> value) { throw null; }
public static string ToString(byte[] value) { throw null; }
public static string ToString(byte[] value, int startIndex) { throw null; }
public static string ToString(byte[] value, int startIndex, int length) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(byte[] value, int startIndex) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(System.ReadOnlySpan<byte> value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(byte[] value, int startIndex) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(System.ReadOnlySpan<byte> value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(byte[] value, int startIndex) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(System.ReadOnlySpan<byte> value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, bool value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, char value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, double value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, System.Half value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, short value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, int value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, long value) { throw null; }
public static bool TryWriteBytes(System.Span<byte> destination, float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool TryWriteBytes(System.Span<byte> destination, ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool TryWriteBytes(System.Span<byte> destination, uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool TryWriteBytes(System.Span<byte> destination, ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.Half UInt16BitsToHalf(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float UInt32BitsToSingle(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double UInt64BitsToDouble(ulong value) { throw null; }
}
public readonly partial struct Boolean : System.IComparable, System.IComparable<bool>, System.IConvertible, System.IEquatable<bool>
{
private readonly bool _dummyPrimitive;
public static readonly string FalseString;
public static readonly string TrueString;
public int CompareTo(System.Boolean value) { throw null; }
public int CompareTo(object? obj) { throw null; }
public System.Boolean Equals(System.Boolean obj) { throw null; }
public override System.Boolean Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Boolean Parse(System.ReadOnlySpan<char> value) { throw null; }
public static System.Boolean Parse(string value) { throw null; }
System.Boolean System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public System.Boolean TryFormat(System.Span<char> destination, out int charsWritten) { throw null; }
public static System.Boolean TryParse(System.ReadOnlySpan<char> value, out System.Boolean result) { throw null; }
public static System.Boolean TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value, out System.Boolean result) { throw null; }
}
public static partial class Buffer
{
public static void BlockCopy(System.Array src, int srcOffset, System.Array dst, int dstOffset, int count) { }
public static int ByteLength(System.Array array) { throw null; }
public static byte GetByte(System.Array array, int index) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy) { }
public static void SetByte(System.Array array, int index, byte value) { }
}
public readonly partial struct Byte : System.IComparable, System.IComparable<byte>, System.IConvertible, System.IEquatable<byte>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<byte>,
System.IMinMaxValue<byte>,
System.IUnsignedNumber<byte>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly byte _dummyPrimitive;
public const byte MaxValue = (byte)255;
public const byte MinValue = (byte)0;
public int CompareTo(System.Byte value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Byte obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Byte Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.Byte Parse(string s) { throw null; }
public static System.Byte Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Byte Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Byte Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
System.Byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Byte result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Byte result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Byte result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Byte result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IAdditiveIdentity<byte, byte>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IMinMaxValue<byte>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IMinMaxValue<byte>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IMultiplicativeIdentity<byte, byte>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IAdditionOperators<byte, byte, byte>.operator +(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.LeadingZeroCount(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.PopCount(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.RotateLeft(byte value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.RotateRight(byte value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryInteger<byte>.TrailingZeroCount(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<byte>.IsPow2(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBinaryNumber<byte>.Log2(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBitwiseOperators<byte, byte, byte>.operator &(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBitwiseOperators<byte, byte, byte>.operator |(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBitwiseOperators<byte, byte, byte>.operator ^(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IBitwiseOperators<byte, byte, byte>.operator ~(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<byte, byte>.operator <(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<byte, byte>.operator <=(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<byte, byte>.operator >(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<byte, byte>.operator >=(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IDecrementOperators<byte>.operator --(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IDivisionOperators<byte, byte, byte>.operator /(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<byte, byte>.operator ==(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<byte, byte>.operator !=(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IIncrementOperators<byte>.operator ++(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IModulusOperators<byte, byte, byte>.operator %(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IMultiplyOperators<byte, byte, byte>.operator *(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Abs(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Clamp(byte value, byte min, byte max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (byte Quotient, byte Remainder) INumber<byte>.DivRem(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Max(byte x, byte y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Min(byte x, byte y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte INumber<byte>.Sign(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<byte>.TryCreate<TOther>(TOther value, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<byte>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<byte>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IParseable<byte>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<byte>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IShiftOperators<byte, byte>.operator <<(byte value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IShiftOperators<byte, byte>.operator >>(byte value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte ISpanParseable<byte>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<byte>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out byte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte ISubtractionOperators<byte, byte, byte>.operator -(byte left, byte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IUnaryNegationOperators<byte, byte>.operator -(byte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static byte IUnaryPlusOperators<byte, byte>.operator +(byte value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial class CannotUnloadAppDomainException : System.SystemException
{
public CannotUnloadAppDomainException() { }
protected CannotUnloadAppDomainException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public CannotUnloadAppDomainException(string? message) { }
public CannotUnloadAppDomainException(string? message, System.Exception? innerException) { }
}
public readonly partial struct Char : System.IComparable, System.IComparable<char>, System.IConvertible, System.IEquatable<char>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<char>,
System.IMinMaxValue<char>,
System.IUnsignedNumber<char>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly char _dummyPrimitive;
public const char MaxValue = '\uFFFF';
public const char MinValue = '\0';
public int CompareTo(System.Char value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static string ConvertFromUtf32(int utf32) { throw null; }
public static int ConvertToUtf32(System.Char highSurrogate, System.Char lowSurrogate) { throw null; }
public static int ConvertToUtf32(string s, int index) { throw null; }
public bool Equals(System.Char obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static double GetNumericValue(System.Char c) { throw null; }
public static double GetNumericValue(string s, int index) { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(System.Char c) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(string s, int index) { throw null; }
public static bool IsAscii(System.Char c) { throw null; }
public static bool IsControl(System.Char c) { throw null; }
public static bool IsControl(string s, int index) { throw null; }
public static bool IsDigit(System.Char c) { throw null; }
public static bool IsDigit(string s, int index) { throw null; }
public static bool IsHighSurrogate(System.Char c) { throw null; }
public static bool IsHighSurrogate(string s, int index) { throw null; }
public static bool IsLetter(System.Char c) { throw null; }
public static bool IsLetter(string s, int index) { throw null; }
public static bool IsLetterOrDigit(System.Char c) { throw null; }
public static bool IsLetterOrDigit(string s, int index) { throw null; }
public static bool IsLower(System.Char c) { throw null; }
public static bool IsLower(string s, int index) { throw null; }
public static bool IsLowSurrogate(System.Char c) { throw null; }
public static bool IsLowSurrogate(string s, int index) { throw null; }
public static bool IsNumber(System.Char c) { throw null; }
public static bool IsNumber(string s, int index) { throw null; }
public static bool IsPunctuation(System.Char c) { throw null; }
public static bool IsPunctuation(string s, int index) { throw null; }
public static bool IsSeparator(System.Char c) { throw null; }
public static bool IsSeparator(string s, int index) { throw null; }
public static bool IsSurrogate(System.Char c) { throw null; }
public static bool IsSurrogate(string s, int index) { throw null; }
public static bool IsSurrogatePair(System.Char highSurrogate, System.Char lowSurrogate) { throw null; }
public static bool IsSurrogatePair(string s, int index) { throw null; }
public static bool IsSymbol(System.Char c) { throw null; }
public static bool IsSymbol(string s, int index) { throw null; }
public static bool IsUpper(System.Char c) { throw null; }
public static bool IsUpper(string s, int index) { throw null; }
public static bool IsWhiteSpace(System.Char c) { throw null; }
public static bool IsWhiteSpace(string s, int index) { throw null; }
public static System.Char Parse(string s) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
System.Char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public static System.Char ToLower(System.Char c) { throw null; }
public static System.Char ToLower(System.Char c, System.Globalization.CultureInfo culture) { throw null; }
public static System.Char ToLowerInvariant(System.Char c) { throw null; }
public override string ToString() { throw null; }
public static string ToString(System.Char c) { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public static System.Char ToUpper(System.Char c) { throw null; }
public static System.Char ToUpper(System.Char c, System.Globalization.CultureInfo culture) { throw null; }
public static System.Char ToUpperInvariant(System.Char c) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Char result) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
string System.IFormattable.ToString(string? format, IFormatProvider? formatProvider) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IAdditiveIdentity<char, char>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IMinMaxValue<char>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IMinMaxValue<char>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IMultiplicativeIdentity<char, char>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IAdditionOperators<char, char, char>.operator +(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.LeadingZeroCount(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.PopCount(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.RotateLeft(char value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.RotateRight(char value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryInteger<char>.TrailingZeroCount(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<char>.IsPow2(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBinaryNumber<char>.Log2(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBitwiseOperators<char, char, char>.operator &(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBitwiseOperators<char, char, char>.operator |(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBitwiseOperators<char, char, char>.operator ^(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IBitwiseOperators<char, char, char>.operator ~(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<char, char>.operator <(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<char, char>.operator <=(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<char, char>.operator >(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<char, char>.operator >=(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IDecrementOperators<char>.operator --(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IDivisionOperators<char, char, char>.operator /(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<char, char>.operator ==(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<char, char>.operator !=(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IIncrementOperators<char>.operator ++(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IModulusOperators<char, char, char>.operator %(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IMultiplyOperators<char, char, char>.operator *(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Abs(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Clamp(char value, char min, char max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (char Quotient, char Remainder) INumber<char>.DivRem(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Max(char x, char y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Min(char x, char y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char INumber<char>.Sign(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<char>.TryCreate<TOther>(TOther value, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<char>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<char>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IParseable<char>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<char>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IShiftOperators<char, char>.operator <<(char value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeatures("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview"), System.Runtime.CompilerServices.SpecialNameAttribute]
static char IShiftOperators<char, char>.operator >>(char value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char ISpanParseable<char>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<char>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out char result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char ISubtractionOperators<char, char, char>.operator -(char left, char right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IUnaryNegationOperators<char, char>.operator -(char value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static char IUnaryPlusOperators<char, char>.operator +(char value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public sealed partial class CharEnumerator : System.Collections.Generic.IEnumerator<char>, System.Collections.IEnumerator, System.ICloneable, System.IDisposable
{
internal CharEnumerator() { }
public char Current { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
public object Clone() { throw null; }
public void Dispose() { }
public bool MoveNext() { throw null; }
public void Reset() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=true, AllowMultiple=false)]
public sealed partial class CLSCompliantAttribute : System.Attribute
{
public CLSCompliantAttribute(bool isCompliant) { }
public bool IsCompliant { get { throw null; } }
}
public delegate int Comparison<in T>(T x, T y);
public abstract partial class ContextBoundObject : System.MarshalByRefObject
{
protected ContextBoundObject() { }
}
public partial class ContextMarshalException : System.SystemException
{
public ContextMarshalException() { }
protected ContextMarshalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ContextMarshalException(string? message) { }
public ContextMarshalException(string? message, System.Exception? inner) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public partial class ContextStaticAttribute : System.Attribute
{
public ContextStaticAttribute() { }
}
public static partial class Convert
{
public static readonly object DBNull;
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static object? ChangeType(object? value, System.Type conversionType) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static object? ChangeType(object? value, System.Type conversionType, System.IFormatProvider? provider) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static object? ChangeType(object? value, System.TypeCode typeCode) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static object? ChangeType(object? value, System.TypeCode typeCode, System.IFormatProvider? provider) { throw null; }
public static byte[] FromBase64CharArray(char[] inArray, int offset, int length) { throw null; }
public static byte[] FromBase64String(string s) { throw null; }
public static byte[] FromHexString(System.ReadOnlySpan<char> chars) { throw null; }
public static byte[] FromHexString(string s) { throw null; }
public static System.TypeCode GetTypeCode(object? value) { throw null; }
public static bool IsDBNull([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut) { throw null; }
public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut, System.Base64FormattingOptions options) { throw null; }
public static string ToBase64String(byte[] inArray) { throw null; }
public static string ToBase64String(byte[] inArray, System.Base64FormattingOptions options) { throw null; }
public static string ToBase64String(byte[] inArray, int offset, int length) { throw null; }
public static string ToBase64String(byte[] inArray, int offset, int length, System.Base64FormattingOptions options) { throw null; }
public static string ToBase64String(System.ReadOnlySpan<byte> bytes, System.Base64FormattingOptions options = System.Base64FormattingOptions.None) { throw null; }
public static bool ToBoolean(bool value) { throw null; }
public static bool ToBoolean(byte value) { throw null; }
public static bool ToBoolean(char value) { throw null; }
public static bool ToBoolean(System.DateTime value) { throw null; }
public static bool ToBoolean(decimal value) { throw null; }
public static bool ToBoolean(double value) { throw null; }
public static bool ToBoolean(short value) { throw null; }
public static bool ToBoolean(int value) { throw null; }
public static bool ToBoolean(long value) { throw null; }
public static bool ToBoolean([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static bool ToBoolean([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool ToBoolean(sbyte value) { throw null; }
public static bool ToBoolean(float value) { throw null; }
public static bool ToBoolean([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value) { throw null; }
public static bool ToBoolean([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool ToBoolean(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool ToBoolean(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool ToBoolean(ulong value) { throw null; }
public static byte ToByte(bool value) { throw null; }
public static byte ToByte(byte value) { throw null; }
public static byte ToByte(char value) { throw null; }
public static byte ToByte(System.DateTime value) { throw null; }
public static byte ToByte(decimal value) { throw null; }
public static byte ToByte(double value) { throw null; }
public static byte ToByte(short value) { throw null; }
public static byte ToByte(int value) { throw null; }
public static byte ToByte(long value) { throw null; }
public static byte ToByte(object? value) { throw null; }
public static byte ToByte(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte ToByte(sbyte value) { throw null; }
public static byte ToByte(float value) { throw null; }
public static byte ToByte(string? value) { throw null; }
public static byte ToByte(string? value, System.IFormatProvider? provider) { throw null; }
public static byte ToByte(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte ToByte(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte ToByte(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static byte ToByte(ulong value) { throw null; }
public static char ToChar(bool value) { throw null; }
public static char ToChar(byte value) { throw null; }
public static char ToChar(char value) { throw null; }
public static char ToChar(System.DateTime value) { throw null; }
public static char ToChar(decimal value) { throw null; }
public static char ToChar(double value) { throw null; }
public static char ToChar(short value) { throw null; }
public static char ToChar(int value) { throw null; }
public static char ToChar(long value) { throw null; }
public static char ToChar(object? value) { throw null; }
public static char ToChar(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static char ToChar(sbyte value) { throw null; }
public static char ToChar(float value) { throw null; }
public static char ToChar(string value) { throw null; }
public static char ToChar(string value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static char ToChar(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static char ToChar(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static char ToChar(ulong value) { throw null; }
public static System.DateTime ToDateTime(bool value) { throw null; }
public static System.DateTime ToDateTime(byte value) { throw null; }
public static System.DateTime ToDateTime(char value) { throw null; }
public static System.DateTime ToDateTime(System.DateTime value) { throw null; }
public static System.DateTime ToDateTime(decimal value) { throw null; }
public static System.DateTime ToDateTime(double value) { throw null; }
public static System.DateTime ToDateTime(short value) { throw null; }
public static System.DateTime ToDateTime(int value) { throw null; }
public static System.DateTime ToDateTime(long value) { throw null; }
public static System.DateTime ToDateTime(object? value) { throw null; }
public static System.DateTime ToDateTime(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.DateTime ToDateTime(sbyte value) { throw null; }
public static System.DateTime ToDateTime(float value) { throw null; }
public static System.DateTime ToDateTime(string? value) { throw null; }
public static System.DateTime ToDateTime(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.DateTime ToDateTime(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.DateTime ToDateTime(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static System.DateTime ToDateTime(ulong value) { throw null; }
public static decimal ToDecimal(bool value) { throw null; }
public static decimal ToDecimal(byte value) { throw null; }
public static decimal ToDecimal(char value) { throw null; }
public static decimal ToDecimal(System.DateTime value) { throw null; }
public static decimal ToDecimal(decimal value) { throw null; }
public static decimal ToDecimal(double value) { throw null; }
public static decimal ToDecimal(short value) { throw null; }
public static decimal ToDecimal(int value) { throw null; }
public static decimal ToDecimal(long value) { throw null; }
public static decimal ToDecimal(object? value) { throw null; }
public static decimal ToDecimal(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static decimal ToDecimal(sbyte value) { throw null; }
public static decimal ToDecimal(float value) { throw null; }
public static decimal ToDecimal(string? value) { throw null; }
public static decimal ToDecimal(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static decimal ToDecimal(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static decimal ToDecimal(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static decimal ToDecimal(ulong value) { throw null; }
public static double ToDouble(bool value) { throw null; }
public static double ToDouble(byte value) { throw null; }
public static double ToDouble(char value) { throw null; }
public static double ToDouble(System.DateTime value) { throw null; }
public static double ToDouble(decimal value) { throw null; }
public static double ToDouble(double value) { throw null; }
public static double ToDouble(short value) { throw null; }
public static double ToDouble(int value) { throw null; }
public static double ToDouble(long value) { throw null; }
public static double ToDouble(object? value) { throw null; }
public static double ToDouble(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double ToDouble(sbyte value) { throw null; }
public static double ToDouble(float value) { throw null; }
public static double ToDouble(string? value) { throw null; }
public static double ToDouble(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double ToDouble(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double ToDouble(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static double ToDouble(ulong value) { throw null; }
public static string ToHexString(byte[] inArray) { throw null; }
public static string ToHexString(byte[] inArray, int offset, int length) { throw null; }
public static string ToHexString(System.ReadOnlySpan<byte> bytes) { throw null; }
public static short ToInt16(bool value) { throw null; }
public static short ToInt16(byte value) { throw null; }
public static short ToInt16(char value) { throw null; }
public static short ToInt16(System.DateTime value) { throw null; }
public static short ToInt16(decimal value) { throw null; }
public static short ToInt16(double value) { throw null; }
public static short ToInt16(short value) { throw null; }
public static short ToInt16(int value) { throw null; }
public static short ToInt16(long value) { throw null; }
public static short ToInt16(object? value) { throw null; }
public static short ToInt16(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static short ToInt16(sbyte value) { throw null; }
public static short ToInt16(float value) { throw null; }
public static short ToInt16(string? value) { throw null; }
public static short ToInt16(string? value, System.IFormatProvider? provider) { throw null; }
public static short ToInt16(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static short ToInt16(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static short ToInt16(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static short ToInt16(ulong value) { throw null; }
public static int ToInt32(bool value) { throw null; }
public static int ToInt32(byte value) { throw null; }
public static int ToInt32(char value) { throw null; }
public static int ToInt32(System.DateTime value) { throw null; }
public static int ToInt32(decimal value) { throw null; }
public static int ToInt32(double value) { throw null; }
public static int ToInt32(short value) { throw null; }
public static int ToInt32(int value) { throw null; }
public static int ToInt32(long value) { throw null; }
public static int ToInt32(object? value) { throw null; }
public static int ToInt32(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int ToInt32(sbyte value) { throw null; }
public static int ToInt32(float value) { throw null; }
public static int ToInt32(string? value) { throw null; }
public static int ToInt32(string? value, System.IFormatProvider? provider) { throw null; }
public static int ToInt32(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int ToInt32(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int ToInt32(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int ToInt32(ulong value) { throw null; }
public static long ToInt64(bool value) { throw null; }
public static long ToInt64(byte value) { throw null; }
public static long ToInt64(char value) { throw null; }
public static long ToInt64(System.DateTime value) { throw null; }
public static long ToInt64(decimal value) { throw null; }
public static long ToInt64(double value) { throw null; }
public static long ToInt64(short value) { throw null; }
public static long ToInt64(int value) { throw null; }
public static long ToInt64(long value) { throw null; }
public static long ToInt64(object? value) { throw null; }
public static long ToInt64(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static long ToInt64(sbyte value) { throw null; }
public static long ToInt64(float value) { throw null; }
public static long ToInt64(string? value) { throw null; }
public static long ToInt64(string? value, System.IFormatProvider? provider) { throw null; }
public static long ToInt64(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static long ToInt64(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static long ToInt64(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static long ToInt64(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(bool value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(byte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(System.DateTime value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(short value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(string? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(string value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(ulong value) { throw null; }
public static float ToSingle(bool value) { throw null; }
public static float ToSingle(byte value) { throw null; }
public static float ToSingle(char value) { throw null; }
public static float ToSingle(System.DateTime value) { throw null; }
public static float ToSingle(decimal value) { throw null; }
public static float ToSingle(double value) { throw null; }
public static float ToSingle(short value) { throw null; }
public static float ToSingle(int value) { throw null; }
public static float ToSingle(long value) { throw null; }
public static float ToSingle(object? value) { throw null; }
public static float ToSingle(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float ToSingle(sbyte value) { throw null; }
public static float ToSingle(float value) { throw null; }
public static float ToSingle(string? value) { throw null; }
public static float ToSingle(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float ToSingle(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float ToSingle(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static float ToSingle(ulong value) { throw null; }
public static string ToString(bool value) { throw null; }
public static string ToString(bool value, System.IFormatProvider? provider) { throw null; }
public static string ToString(byte value) { throw null; }
public static string ToString(byte value, System.IFormatProvider? provider) { throw null; }
public static string ToString(byte value, int toBase) { throw null; }
public static string ToString(char value) { throw null; }
public static string ToString(char value, System.IFormatProvider? provider) { throw null; }
public static string ToString(System.DateTime value) { throw null; }
public static string ToString(System.DateTime value, System.IFormatProvider? provider) { throw null; }
public static string ToString(decimal value) { throw null; }
public static string ToString(decimal value, System.IFormatProvider? provider) { throw null; }
public static string ToString(double value) { throw null; }
public static string ToString(double value, System.IFormatProvider? provider) { throw null; }
public static string ToString(short value) { throw null; }
public static string ToString(short value, System.IFormatProvider? provider) { throw null; }
public static string ToString(short value, int toBase) { throw null; }
public static string ToString(int value) { throw null; }
public static string ToString(int value, System.IFormatProvider? provider) { throw null; }
public static string ToString(int value, int toBase) { throw null; }
public static string ToString(long value) { throw null; }
public static string ToString(long value, System.IFormatProvider? provider) { throw null; }
public static string ToString(long value, int toBase) { throw null; }
public static string? ToString(object? value) { throw null; }
public static string? ToString(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(sbyte value, System.IFormatProvider? provider) { throw null; }
public static string ToString(float value) { throw null; }
public static string ToString(float value, System.IFormatProvider? provider) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? ToString(string? value) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? ToString(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(ushort value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(uint value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static string ToString(ulong value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(bool value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(byte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(System.DateTime value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(short value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(string? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(bool value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(byte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(System.DateTime value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(short value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(string? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(bool value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(byte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(System.DateTime value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(double value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(short value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(object? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(string? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(string? value, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(string? value, int fromBase) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(ulong value) { throw null; }
public static bool TryFromBase64Chars(System.ReadOnlySpan<char> chars, System.Span<byte> bytes, out int bytesWritten) { throw null; }
public static bool TryFromBase64String(string s, System.Span<byte> bytes, out int bytesWritten) { throw null; }
public static bool TryToBase64Chars(System.ReadOnlySpan<byte> bytes, System.Span<char> chars, out int charsWritten, System.Base64FormattingOptions options = System.Base64FormattingOptions.None) { throw null; }
}
public delegate TOutput Converter<in TInput, out TOutput>(TInput input);
public readonly partial struct DateOnly : System.IComparable, System.IComparable<System.DateOnly>, System.IEquatable<System.DateOnly>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IComparisonOperators<DateOnly, DateOnly>,
System.IMinMaxValue<DateOnly>,
System.ISpanParseable<DateOnly>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
public static DateOnly MinValue { get { throw null; } }
public static DateOnly MaxValue { get { throw null; } }
public DateOnly(int year, int month, int day) { throw null; }
public DateOnly(int year, int month, int day, System.Globalization.Calendar calendar) { throw null; }
public static DateOnly FromDayNumber(int dayNumber) { throw null; }
public int Year { get { throw null; } }
public int Month { get { throw null; } }
public int Day { get { throw null; } }
public System.DayOfWeek DayOfWeek { get { throw null; } }
public int DayOfYear { get { throw null; } }
public int DayNumber { get { throw null; } }
public System.DateOnly AddDays(int value) { throw null; }
public System.DateOnly AddMonths(int value) { throw null; }
public System.DateOnly AddYears(int value) { throw null; }
public static bool operator ==(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator >(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator >=(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator !=(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator <(System.DateOnly left, System.DateOnly right) { throw null; }
public static bool operator <=(System.DateOnly left, System.DateOnly right) { throw null; }
public System.DateTime ToDateTime(System.TimeOnly time) { throw null; }
public System.DateTime ToDateTime(System.TimeOnly time, System.DateTimeKind kind) { throw null; }
public static System.DateOnly FromDateTime(System.DateTime dateTime) { throw null; }
public int CompareTo(System.DateOnly value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.DateOnly value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.DateOnly Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly ParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, System.IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly ParseExact(System.ReadOnlySpan<char> s, string[] formats) { throw null; }
public static System.DateOnly ParseExact(System.ReadOnlySpan<char> s, string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly Parse(string s) { throw null; }
public static System.DateOnly Parse(string s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly ParseExact(string s, string format) { throw null; }
public static System.DateOnly ParseExact(string s, string format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateOnly ParseExact(string s, string[] formats) { throw null; }
public static System.DateOnly ParseExact(string s, string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.DateOnly result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, out System.DateOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.DateOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.DateOnly result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, out System.DateOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.DateOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateOnly result) { throw null; }
public string ToLongDateString() { throw null; }
public string ToShortDateString() { throw null; }
public override string ToString() { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateOnly IMinMaxValue<System.DateOnly>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateOnly IMinMaxValue<System.DateOnly>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateOnly, System.DateOnly>.operator <(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateOnly, System.DateOnly>.operator <=(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateOnly, System.DateOnly>.operator >(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateOnly, System.DateOnly>.operator >=(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateOnly, System.DateOnly>.operator ==(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateOnly, System.DateOnly>.operator !=(System.DateOnly left, System.DateOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateOnly IParseable<System.DateOnly>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.DateOnly>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateOnly result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateOnly ISpanParseable<System.DateOnly>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.DateOnly>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.DateOnly result) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct DateTime : System.IComparable, System.IComparable<System.DateTime>, System.IConvertible, System.IEquatable<System.DateTime>, System.ISpanFormattable, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IAdditionOperators<System.DateTime, System.TimeSpan, System.DateTime>,
System.IAdditiveIdentity<System.DateTime, System.TimeSpan>,
System.IComparisonOperators<System.DateTime, System.DateTime>,
System.IMinMaxValue<System.DateTime>,
System.ISpanParseable<System.DateTime>,
System.ISubtractionOperators<System.DateTime, System.TimeSpan, System.DateTime>,
System.ISubtractionOperators<System.DateTime, System.DateTime, System.TimeSpan>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.DateTime MaxValue;
public static readonly System.DateTime MinValue;
public static readonly System.DateTime UnixEpoch;
public DateTime(int year, int month, int day) { throw null; }
public DateTime(int year, int month, int day, System.Globalization.Calendar calendar) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, System.DateTimeKind kind) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, System.Globalization.Calendar calendar) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.DateTimeKind kind) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar) { throw null; }
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, System.DateTimeKind kind) { throw null; }
public DateTime(long ticks) { throw null; }
public DateTime(long ticks, System.DateTimeKind kind) { throw null; }
public System.DateTime Date { get { throw null; } }
public int Day { get { throw null; } }
public System.DayOfWeek DayOfWeek { get { throw null; } }
public int DayOfYear { get { throw null; } }
public int Hour { get { throw null; } }
public System.DateTimeKind Kind { get { throw null; } }
public int Millisecond { get { throw null; } }
public int Minute { get { throw null; } }
public int Month { get { throw null; } }
public static System.DateTime Now { get { throw null; } }
public int Second { get { throw null; } }
public long Ticks { get { throw null; } }
public System.TimeSpan TimeOfDay { get { throw null; } }
public static System.DateTime Today { get { throw null; } }
public static System.DateTime UtcNow { get { throw null; } }
public int Year { get { throw null; } }
public System.DateTime Add(System.TimeSpan value) { throw null; }
public System.DateTime AddDays(double value) { throw null; }
public System.DateTime AddHours(double value) { throw null; }
public System.DateTime AddMilliseconds(double value) { throw null; }
public System.DateTime AddMinutes(double value) { throw null; }
public System.DateTime AddMonths(int months) { throw null; }
public System.DateTime AddSeconds(double value) { throw null; }
public System.DateTime AddTicks(long value) { throw null; }
public System.DateTime AddYears(int value) { throw null; }
public static int Compare(System.DateTime t1, System.DateTime t2) { throw null; }
public int CompareTo(System.DateTime value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static int DaysInMonth(int year, int month) { throw null; }
public bool Equals(System.DateTime value) { throw null; }
public static bool Equals(System.DateTime t1, System.DateTime t2) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.DateTime FromBinary(long dateData) { throw null; }
public static System.DateTime FromFileTime(long fileTime) { throw null; }
public static System.DateTime FromFileTimeUtc(long fileTime) { throw null; }
public static System.DateTime FromOADate(double d) { throw null; }
public string[] GetDateTimeFormats() { throw null; }
public string[] GetDateTimeFormats(char format) { throw null; }
public string[] GetDateTimeFormats(char format, System.IFormatProvider? provider) { throw null; }
public string[] GetDateTimeFormats(System.IFormatProvider? provider) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public bool IsDaylightSavingTime() { throw null; }
public static bool IsLeapYear(int year) { throw null; }
public static System.DateTime operator +(System.DateTime d, System.TimeSpan t) { throw null; }
public static bool operator ==(System.DateTime d1, System.DateTime d2) { throw null; }
public static bool operator >(System.DateTime t1, System.DateTime t2) { throw null; }
public static bool operator >=(System.DateTime t1, System.DateTime t2) { throw null; }
public static bool operator !=(System.DateTime d1, System.DateTime d2) { throw null; }
public static bool operator <(System.DateTime t1, System.DateTime t2) { throw null; }
public static bool operator <=(System.DateTime t1, System.DateTime t2) { throw null; }
public static System.TimeSpan operator -(System.DateTime d1, System.DateTime d2) { throw null; }
public static System.DateTime operator -(System.DateTime d, System.TimeSpan t) { throw null; }
public static System.DateTime Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider = null, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTime Parse(string s) { throw null; }
public static System.DateTime Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.DateTime Parse(string s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles styles) { throw null; }
public static System.DateTime ParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTime ParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTime ParseExact(string s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string format, System.IFormatProvider? provider) { throw null; }
public static System.DateTime ParseExact(string s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style) { throw null; }
public static System.DateTime ParseExact(string s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style) { throw null; }
public static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeKind kind) { throw null; }
public System.TimeSpan Subtract(System.DateTime value) { throw null; }
public System.DateTime Subtract(System.TimeSpan value) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public long ToBinary() { throw null; }
public long ToFileTime() { throw null; }
public long ToFileTimeUtc() { throw null; }
public System.DateTime ToLocalTime() { throw null; }
public string ToLongDateString() { throw null; }
public string ToLongTimeString() { throw null; }
public double ToOADate() { throw null; }
public string ToShortDateString() { throw null; }
public string ToShortTimeString() { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format) { throw null; }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format, System.IFormatProvider? provider) { throw null; }
public System.DateTime ToUniversalTime() { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.DateTime result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles styles, out System.DateTime result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.DateTime result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles styles, out System.DateTime result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IAdditiveIdentity<System.DateTime, System.TimeSpan>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime IMinMaxValue<System.DateTime>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime IMinMaxValue<System.DateTime>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime IAdditionOperators<System.DateTime, System.TimeSpan, System.DateTime>.operator +(System.DateTime left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTime, System.DateTime>.operator <(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTime, System.DateTime>.operator <=(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTime, System.DateTime>.operator >(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTime, System.DateTime>.operator >=(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateTime, System.DateTime>.operator ==(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateTime, System.DateTime>.operator !=(System.DateTime left, System.DateTime right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime IParseable<System.DateTime>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.DateTime>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateTime result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime ISpanParseable<System.DateTime>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.DateTime>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.DateTime result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTime ISubtractionOperators<System.DateTime, System.TimeSpan, System.DateTime>.operator -(System.DateTime left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISubtractionOperators<System.DateTime, System.DateTime, System.TimeSpan>.operator -(System.DateTime left, System.DateTime right) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public enum DateTimeKind
{
Unspecified = 0,
Utc = 1,
Local = 2,
}
public readonly partial struct DateTimeOffset : System.IComparable, System.IComparable<System.DateTimeOffset>, System.IEquatable<System.DateTimeOffset>, System.ISpanFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IAdditionOperators<System.DateTimeOffset, System.TimeSpan, System.DateTimeOffset>,
System.IAdditiveIdentity<System.DateTimeOffset, System.TimeSpan>,
System.IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>,
System.IMinMaxValue<System.DateTimeOffset>, System.ISpanParseable<System.DateTimeOffset>,
System.ISubtractionOperators<System.DateTimeOffset, System.TimeSpan, System.DateTimeOffset>,
System.ISubtractionOperators<System.DateTimeOffset, System.DateTimeOffset, System.TimeSpan>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.DateTimeOffset MaxValue;
public static readonly System.DateTimeOffset MinValue;
public static readonly System.DateTimeOffset UnixEpoch;
public DateTimeOffset(System.DateTime dateTime) { throw null; }
public DateTimeOffset(System.DateTime dateTime, System.TimeSpan offset) { throw null; }
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, System.TimeSpan offset) { throw null; }
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, System.TimeSpan offset) { throw null; }
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, System.TimeSpan offset) { throw null; }
public DateTimeOffset(long ticks, System.TimeSpan offset) { throw null; }
public System.DateTime Date { get { throw null; } }
public System.DateTime DateTime { get { throw null; } }
public int Day { get { throw null; } }
public System.DayOfWeek DayOfWeek { get { throw null; } }
public int DayOfYear { get { throw null; } }
public int Hour { get { throw null; } }
public System.DateTime LocalDateTime { get { throw null; } }
public int Millisecond { get { throw null; } }
public int Minute { get { throw null; } }
public int Month { get { throw null; } }
public static System.DateTimeOffset Now { get { throw null; } }
public System.TimeSpan Offset { get { throw null; } }
public int Second { get { throw null; } }
public long Ticks { get { throw null; } }
public System.TimeSpan TimeOfDay { get { throw null; } }
public System.DateTime UtcDateTime { get { throw null; } }
public static System.DateTimeOffset UtcNow { get { throw null; } }
public long UtcTicks { get { throw null; } }
public int Year { get { throw null; } }
public System.DateTimeOffset Add(System.TimeSpan timeSpan) { throw null; }
public System.DateTimeOffset AddDays(double days) { throw null; }
public System.DateTimeOffset AddHours(double hours) { throw null; }
public System.DateTimeOffset AddMilliseconds(double milliseconds) { throw null; }
public System.DateTimeOffset AddMinutes(double minutes) { throw null; }
public System.DateTimeOffset AddMonths(int months) { throw null; }
public System.DateTimeOffset AddSeconds(double seconds) { throw null; }
public System.DateTimeOffset AddTicks(long ticks) { throw null; }
public System.DateTimeOffset AddYears(int years) { throw null; }
public static int Compare(System.DateTimeOffset first, System.DateTimeOffset second) { throw null; }
public int CompareTo(System.DateTimeOffset other) { throw null; }
public bool Equals(System.DateTimeOffset other) { throw null; }
public static bool Equals(System.DateTimeOffset first, System.DateTimeOffset second) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool EqualsExact(System.DateTimeOffset other) { throw null; }
public static System.DateTimeOffset FromFileTime(long fileTime) { throw null; }
public static System.DateTimeOffset FromUnixTimeMilliseconds(long milliseconds) { throw null; }
public static System.DateTimeOffset FromUnixTimeSeconds(long seconds) { throw null; }
public override int GetHashCode() { throw null; }
public static System.DateTimeOffset operator +(System.DateTimeOffset dateTimeOffset, System.TimeSpan timeSpan) { throw null; }
public static bool operator ==(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static bool operator >(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static bool operator >=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static implicit operator System.DateTimeOffset (System.DateTime dateTime) { throw null; }
public static bool operator !=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static bool operator <(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static bool operator <=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static System.TimeSpan operator -(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
public static System.DateTimeOffset operator -(System.DateTimeOffset dateTimeOffset, System.TimeSpan timeSpan) { throw null; }
public static System.DateTimeOffset Parse(System.ReadOnlySpan<char> input, System.IFormatProvider? formatProvider = null, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTimeOffset Parse(string input) { throw null; }
public static System.DateTimeOffset Parse(string input, System.IFormatProvider? formatProvider) { throw null; }
public static System.DateTimeOffset Parse(string input, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
public static System.DateTimeOffset ParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTimeOffset ParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string[] formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.DateTimeOffset ParseExact(string input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string format, System.IFormatProvider? formatProvider) { throw null; }
public static System.DateTimeOffset ParseExact(string input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string format, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
public static System.DateTimeOffset ParseExact(string input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string[] formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
public System.TimeSpan Subtract(System.DateTimeOffset value) { throw null; }
public System.DateTimeOffset Subtract(System.TimeSpan value) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public long ToFileTime() { throw null; }
public System.DateTimeOffset ToLocalTime() { throw null; }
public System.DateTimeOffset ToOffset(System.TimeSpan offset) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? formatProvider) { throw null; }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format) { throw null; }
public string ToString([System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format, System.IFormatProvider? formatProvider) { throw null; }
public System.DateTimeOffset ToUniversalTime() { throw null; }
public long ToUnixTimeMilliseconds() { throw null; }
public long ToUnixTimeSeconds() { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? formatProvider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, out System.DateTimeOffset result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, out System.DateTimeOffset result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string? format, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true), System.Diagnostics.CodeAnalysis.StringSyntaxAttribute(System.Diagnostics.CodeAnalysis.StringSyntaxAttribute.DateTimeFormat)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IAdditiveIdentity<System.DateTimeOffset, System.TimeSpan>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset IMinMaxValue<System.DateTimeOffset>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset IMinMaxValue<System.DateTimeOffset>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset IAdditionOperators<System.DateTimeOffset, System.TimeSpan, System.DateTimeOffset>.operator +(System.DateTimeOffset left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>.operator <(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>.operator <=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>.operator >(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.DateTimeOffset, System.DateTimeOffset>.operator >=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateTimeOffset, System.DateTimeOffset>.operator ==(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.DateTimeOffset, System.DateTimeOffset>.operator !=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset IParseable<System.DateTimeOffset>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.DateTimeOffset>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.DateTimeOffset result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset ISpanParseable<System.DateTimeOffset>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.DateTimeOffset>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.DateTimeOffset result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.DateTimeOffset ISubtractionOperators<System.DateTimeOffset, System.TimeSpan, System.DateTimeOffset>.operator -(System.DateTimeOffset left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISubtractionOperators<System.DateTimeOffset, System.DateTimeOffset, System.TimeSpan>.operator -(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public enum DayOfWeek
{
Sunday = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
}
public sealed partial class DBNull : System.IConvertible, System.Runtime.Serialization.ISerializable
{
internal DBNull() { }
public static readonly System.DBNull Value;
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public System.TypeCode GetTypeCode() { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
}
public readonly partial struct Decimal : System.IComparable, System.IComparable<decimal>, System.IConvertible, System.IEquatable<decimal>, System.ISpanFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IMinMaxValue<decimal>,
System.ISignedNumber<decimal>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)4294967295, (uint)4294967295, (uint)4294967295)]
public static readonly decimal MaxValue;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)0, (uint)0, (uint)1)]
public static readonly decimal MinusOne;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)4294967295, (uint)4294967295, (uint)4294967295)]
public static readonly decimal MinValue;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)1)]
public static readonly decimal One;
[System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)0)]
public static readonly decimal Zero;
public Decimal(double value) { throw null; }
public Decimal(int value) { throw null; }
public Decimal(int lo, int mid, int hi, bool isNegative, byte scale) { throw null; }
public Decimal(int[] bits) { throw null; }
public Decimal(long value) { throw null; }
public Decimal(System.ReadOnlySpan<int> bits) { throw null; }
public Decimal(float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public Decimal(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public Decimal(ulong value) { throw null; }
public byte Scale { get { throw null; } }
public static System.Decimal Add(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal Ceiling(System.Decimal d) { throw null; }
public static int Compare(System.Decimal d1, System.Decimal d2) { throw null; }
public int CompareTo(System.Decimal value) { throw null; }
public int CompareTo(object? value) { throw null; }
public static System.Decimal Divide(System.Decimal d1, System.Decimal d2) { throw null; }
public bool Equals(System.Decimal value) { throw null; }
public static bool Equals(System.Decimal d1, System.Decimal d2) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.Decimal Floor(System.Decimal d) { throw null; }
public static System.Decimal FromOACurrency(long cy) { throw null; }
public static int[] GetBits(System.Decimal d) { throw null; }
public static int GetBits(System.Decimal d, System.Span<int> destination) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Decimal Multiply(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal Negate(System.Decimal d) { throw null; }
public static System.Decimal operator +(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator --(System.Decimal d) { throw null; }
public static System.Decimal operator /(System.Decimal d1, System.Decimal d2) { throw null; }
public static bool operator ==(System.Decimal d1, System.Decimal d2) { throw null; }
public static explicit operator byte (System.Decimal value) { throw null; }
public static explicit operator char (System.Decimal value) { throw null; }
public static explicit operator double (System.Decimal value) { throw null; }
public static explicit operator short (System.Decimal value) { throw null; }
public static explicit operator int (System.Decimal value) { throw null; }
public static explicit operator long (System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator sbyte (System.Decimal value) { throw null; }
public static explicit operator float (System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator ushort (System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator uint (System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator ulong (System.Decimal value) { throw null; }
public static explicit operator System.Decimal (double value) { throw null; }
public static explicit operator System.Decimal (float value) { throw null; }
public static bool operator >(System.Decimal d1, System.Decimal d2) { throw null; }
public static bool operator >=(System.Decimal d1, System.Decimal d2) { throw null; }
public static implicit operator System.Decimal (byte value) { throw null; }
public static implicit operator System.Decimal (char value) { throw null; }
public static implicit operator System.Decimal (short value) { throw null; }
public static implicit operator System.Decimal (int value) { throw null; }
public static implicit operator System.Decimal (long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Decimal (sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Decimal (ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Decimal (uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Decimal (ulong value) { throw null; }
public static System.Decimal operator ++(System.Decimal d) { throw null; }
public static bool operator !=(System.Decimal d1, System.Decimal d2) { throw null; }
public static bool operator <(System.Decimal d1, System.Decimal d2) { throw null; }
public static bool operator <=(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator %(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator *(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator -(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal operator -(System.Decimal d) { throw null; }
public static System.Decimal operator +(System.Decimal d) { throw null; }
public static System.Decimal Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Number, System.IFormatProvider? provider = null) { throw null; }
public static System.Decimal Parse(string s) { throw null; }
public static System.Decimal Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Decimal Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Decimal Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.Decimal Remainder(System.Decimal d1, System.Decimal d2) { throw null; }
public static System.Decimal Round(System.Decimal d) { throw null; }
public static System.Decimal Round(System.Decimal d, int decimals) { throw null; }
public static System.Decimal Round(System.Decimal d, int decimals, System.MidpointRounding mode) { throw null; }
public static System.Decimal Round(System.Decimal d, System.MidpointRounding mode) { throw null; }
public static System.Decimal Subtract(System.Decimal d1, System.Decimal d2) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
System.Decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static byte ToByte(System.Decimal value) { throw null; }
public static double ToDouble(System.Decimal d) { throw null; }
public static short ToInt16(System.Decimal value) { throw null; }
public static int ToInt32(System.Decimal d) { throw null; }
public static long ToInt64(System.Decimal d) { throw null; }
public static long ToOACurrency(System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte ToSByte(System.Decimal value) { throw null; }
public static float ToSingle(System.Decimal d) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort ToUInt16(System.Decimal value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint ToUInt32(System.Decimal d) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong ToUInt64(System.Decimal d) { throw null; }
public static System.Decimal Truncate(System.Decimal d) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryGetBits(System.Decimal d, System.Span<int> destination, out int valuesWritten) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Decimal result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Decimal result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Decimal result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Decimal result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IAdditiveIdentity<decimal, decimal>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IMinMaxValue<decimal>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IMinMaxValue<decimal>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IMultiplicativeIdentity<decimal, decimal>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IAdditionOperators<decimal, decimal, decimal>.operator +(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<decimal, decimal>.operator <(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<decimal, decimal>.operator <=(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<decimal, decimal>.operator >(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<decimal, decimal>.operator >=(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IDecrementOperators<decimal>.operator --(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IDivisionOperators<decimal, decimal, decimal>.operator /(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<decimal, decimal>.operator ==(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<decimal, decimal>.operator !=(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IIncrementOperators<decimal>.operator ++(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IModulusOperators<decimal, decimal, decimal>.operator %(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IMultiplyOperators<decimal, decimal, decimal>.operator *(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Abs(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Clamp(decimal value, decimal min, decimal max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (decimal Quotient, decimal Remainder) INumber<decimal>.DivRem(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Max(decimal x, decimal y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Min(decimal x, decimal y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal INumber<decimal>.Sign(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<decimal>.TryCreate<TOther>(TOther value, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<decimal>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<decimal>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IParseable<decimal>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<decimal>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal ISignedNumber<decimal>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal ISpanParseable<decimal>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<decimal>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out decimal result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal ISubtractionOperators<decimal, decimal, decimal>.operator -(decimal left, decimal right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IUnaryNegationOperators<decimal, decimal>.operator -(decimal value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static decimal IUnaryPlusOperators<decimal, decimal>.operator +(decimal value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public abstract partial class Delegate : System.ICloneable, System.Runtime.Serialization.ISerializable
{
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
protected Delegate(object target, string method) { }
protected Delegate([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method) { }
public System.Reflection.MethodInfo Method { get { throw null; } }
public object? Target { get { throw null; } }
public virtual object Clone() { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("a")]
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("b")]
public static System.Delegate? Combine(System.Delegate? a, System.Delegate? b) { throw null; }
public static System.Delegate? Combine(params System.Delegate?[]? delegates) { throw null; }
protected virtual System.Delegate CombineImpl(System.Delegate? d) { throw null; }
public static System.Delegate CreateDelegate(System.Type type, object? firstArgument, System.Reflection.MethodInfo method) { throw null; }
public static System.Delegate? CreateDelegate(System.Type type, object? firstArgument, System.Reflection.MethodInfo method, bool throwOnBindFailure) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
public static System.Delegate CreateDelegate(System.Type type, object target, string method) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
public static System.Delegate CreateDelegate(System.Type type, object target, string method, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
public static System.Delegate? CreateDelegate(System.Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure) { throw null; }
public static System.Delegate CreateDelegate(System.Type type, System.Reflection.MethodInfo method) { throw null; }
public static System.Delegate? CreateDelegate(System.Type type, System.Reflection.MethodInfo method, bool throwOnBindFailure) { throw null; }
public static System.Delegate CreateDelegate(System.Type type, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method) { throw null; }
public static System.Delegate CreateDelegate(System.Type type, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method, bool ignoreCase) { throw null; }
public static System.Delegate? CreateDelegate(System.Type type, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method, bool ignoreCase, bool throwOnBindFailure) { throw null; }
public object? DynamicInvoke(params object?[]? args) { throw null; }
protected virtual object? DynamicInvokeImpl(object?[]? args) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public virtual System.Delegate[] GetInvocationList() { throw null; }
protected virtual System.Reflection.MethodInfo GetMethodImpl() { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(System.Delegate? d1, System.Delegate? d2) { throw null; }
public static bool operator !=(System.Delegate? d1, System.Delegate? d2) { throw null; }
public static System.Delegate? Remove(System.Delegate? source, System.Delegate? value) { throw null; }
public static System.Delegate? RemoveAll(System.Delegate? source, System.Delegate? value) { throw null; }
protected virtual System.Delegate? RemoveImpl(System.Delegate d) { throw null; }
}
public partial class DivideByZeroException : System.ArithmeticException
{
public DivideByZeroException() { }
protected DivideByZeroException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public DivideByZeroException(string? message) { }
public DivideByZeroException(string? message, System.Exception? innerException) { }
}
public readonly partial struct Double : System.IComparable, System.IComparable<double>, System.IConvertible, System.IEquatable<double>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryFloatingPoint<double>,
System.IMinMaxValue<double>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly double _dummyPrimitive;
public const double Epsilon = 5E-324;
public const double MaxValue = 1.7976931348623157E+308;
public const double MinValue = -1.7976931348623157E+308;
public const double NaN = 0.0 / 0.0;
public const double NegativeInfinity = -1.0 / 0.0;
public const double PositiveInfinity = 1.0 / 0.0;
public int CompareTo(System.Double value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Double obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static bool IsFinite(System.Double d) { throw null; }
public static bool IsInfinity(System.Double d) { throw null; }
public static bool IsNaN(System.Double d) { throw null; }
public static bool IsNegative(System.Double d) { throw null; }
public static bool IsNegativeInfinity(System.Double d) { throw null; }
public static bool IsNormal(System.Double d) { throw null; }
public static bool IsPositiveInfinity(System.Double d) { throw null; }
public static bool IsSubnormal(System.Double d) { throw null; }
public static bool operator ==(System.Double left, System.Double right) { throw null; }
public static bool operator >(System.Double left, System.Double right) { throw null; }
public static bool operator >=(System.Double left, System.Double right) { throw null; }
public static bool operator !=(System.Double left, System.Double right) { throw null; }
public static bool operator <(System.Double left, System.Double right) { throw null; }
public static bool operator <=(System.Double left, System.Double right) { throw null; }
public static System.Double Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Double Parse(string s) { throw null; }
public static System.Double Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Double Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Double Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
System.Double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Double result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Double result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Double result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Double result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IAdditiveIdentity<double, double>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.E { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Epsilon { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.NaN { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.NegativeInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.NegativeZero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Pi { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.PositiveInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Tau { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMinMaxValue<double>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMinMaxValue<double>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMultiplicativeIdentity<double, double>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IAdditionOperators<double, double, double>.operator +(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<double>.IsPow2(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBinaryNumber<double>.Log2(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBitwiseOperators<double, double, double>.operator &(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBitwiseOperators<double, double, double>.operator |(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBitwiseOperators<double, double, double>.operator ^(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IBitwiseOperators<double, double, double>.operator ~(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<double, double>.operator <(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<double, double>.operator <=(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<double, double>.operator >(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<double, double>.operator >=(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IDecrementOperators<double>.operator --(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IDivisionOperators<double, double, double>.operator /(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<double, double>.operator ==(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<double, double>.operator !=(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Acos(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Acosh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Asin(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Asinh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Atan(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Atan2(double y, double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Atanh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.BitIncrement(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.BitDecrement(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Cbrt(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Ceiling(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.CopySign(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Cos(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Cosh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Exp(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Floor(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.FusedMultiplyAdd(double left, double right, double addend) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.IEEERemainder(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static TInteger IFloatingPoint<double>.ILogB<TInteger>(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Log(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Log(double x, double newBase) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Log2(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Log10(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.MaxMagnitude(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.MinMagnitude(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Pow(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Round(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Round<TInteger>(double x, TInteger digits) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Round(double x, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Round<TInteger>(double x, TInteger digits, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.ScaleB<TInteger>(double x, TInteger n) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Sin(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Sinh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Sqrt(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Tan(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Tanh(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IFloatingPoint<double>.Truncate(double x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsFinite(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsInfinity(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsNaN(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsNegative(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsNegativeInfinity(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsNormal(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsPositiveInfinity(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<double>.IsSubnormal(double d) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IIncrementOperators<double>.operator ++(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IModulusOperators<double, double, double>.operator %(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMultiplyOperators<double, double, double>.operator *(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Abs(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Clamp(double value, double min, double max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (double Quotient, double Remainder) INumber<double>.DivRem(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Max(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Min(double x, double y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double INumber<double>.Sign(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<double>.TryCreate<TOther>(TOther value, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<double>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<double>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IParseable<double>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<double>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double ISignedNumber<double>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double ISpanParseable<double>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<double>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out double result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double ISubtractionOperators<double, double, double>.operator -(double left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IUnaryNegationOperators<double, double>.operator -(double value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IUnaryPlusOperators<double, double>.operator +(double value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial class DuplicateWaitObjectException : System.ArgumentException
{
public DuplicateWaitObjectException() { }
protected DuplicateWaitObjectException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public DuplicateWaitObjectException(string? parameterName) { }
public DuplicateWaitObjectException(string? message, System.Exception? innerException) { }
public DuplicateWaitObjectException(string? parameterName, string? message) { }
}
public partial class EntryPointNotFoundException : System.TypeLoadException
{
public EntryPointNotFoundException() { }
protected EntryPointNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public EntryPointNotFoundException(string? message) { }
public EntryPointNotFoundException(string? message, System.Exception? inner) { }
}
public abstract partial class Enum : System.ValueType, System.IComparable, System.IConvertible, System.IFormattable
{
protected Enum() { }
public int CompareTo(object? target) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public static string Format(System.Type enumType, object value, string format) { throw null; }
public override int GetHashCode() { throw null; }
public static string? GetName(System.Type enumType, object value) { throw null; }
public static string? GetName<TEnum>(TEnum value) where TEnum : struct, System.Enum { throw null; }
public static string[] GetNames(System.Type enumType) { throw null; }
public static string[] GetNames<TEnum>() where TEnum: struct, System.Enum { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Type GetUnderlyingType(System.Type enumType) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("It might not be possible to create an array of the enum type at runtime. Use the GetValues<TEnum> overload instead.")]
public static System.Array GetValues(System.Type enumType) { throw null; }
public static TEnum[] GetValues<TEnum>() where TEnum : struct, System.Enum { throw null; }
public bool HasFlag(System.Enum flag) { throw null; }
public static bool IsDefined(System.Type enumType, object value) { throw null; }
public static bool IsDefined<TEnum>(TEnum value) where TEnum : struct, System.Enum { throw null; }
public static object Parse(System.Type enumType, System.ReadOnlySpan<char> value) { throw null; }
public static object Parse(System.Type enumType, System.ReadOnlySpan<char> value, bool ignoreCase) { throw null; }
public static object Parse(System.Type enumType, string value) { throw null; }
public static object Parse(System.Type enumType, string value, bool ignoreCase) { throw null; }
public static TEnum Parse<TEnum>(System.ReadOnlySpan<char> value) where TEnum : struct { throw null; }
public static TEnum Parse<TEnum>(System.ReadOnlySpan<char> value, bool ignoreCase) where TEnum : struct { throw null; }
public static TEnum Parse<TEnum>(string value) where TEnum : struct { throw null; }
public static TEnum Parse<TEnum>(string value, bool ignoreCase) where TEnum : struct { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public static object ToObject(System.Type enumType, byte value) { throw null; }
public static object ToObject(System.Type enumType, short value) { throw null; }
public static object ToObject(System.Type enumType, int value) { throw null; }
public static object ToObject(System.Type enumType, long value) { throw null; }
public static object ToObject(System.Type enumType, object value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static object ToObject(System.Type enumType, sbyte value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static object ToObject(System.Type enumType, ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static object ToObject(System.Type enumType, uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static object ToObject(System.Type enumType, ulong value) { throw null; }
public override string ToString() { throw null; }
[System.ObsoleteAttribute("The provider argument is not used. Use ToString() instead.")]
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
[System.ObsoleteAttribute("The provider argument is not used. Use ToString(String) instead.")]
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public static bool TryParse(System.Type enumType, System.ReadOnlySpan<char> value, bool ignoreCase, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse(System.Type enumType, System.ReadOnlySpan<char> value, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse(System.Type enumType, string? value, bool ignoreCase, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse(System.Type enumType, string? value, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out object? result) { throw null; }
public static bool TryParse<TEnum>(System.ReadOnlySpan<char> value, bool ignoreCase, out TEnum result) where TEnum : struct { throw null; }
public static bool TryParse<TEnum>(System.ReadOnlySpan<char> value, out TEnum result) where TEnum : struct { throw null; }
public static bool TryParse<TEnum>([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value, bool ignoreCase, out TEnum result) where TEnum : struct { throw null; }
public static bool TryParse<TEnum>([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value, out TEnum result) where TEnum : struct { throw null; }
}
public static partial class Environment
{
public static string CommandLine { get { throw null; } }
public static string CurrentDirectory { get { throw null; } set { } }
public static int CurrentManagedThreadId { get { throw null; } }
public static int ExitCode { get { throw null; } set { } }
public static bool HasShutdownStarted { get { throw null; } }
public static bool Is64BitOperatingSystem { get { throw null; } }
public static bool Is64BitProcess { get { throw null; } }
public static string MachineName { get { throw null; } }
public static string NewLine { get { throw null; } }
public static System.OperatingSystem OSVersion { get { throw null; } }
public static int ProcessId { get { throw null; } }
public static int ProcessorCount { get { throw null; } }
public static string? ProcessPath { get { throw null; } }
public static string StackTrace { get { throw null; } }
public static string SystemDirectory { get { throw null; } }
public static int SystemPageSize { get { throw null; } }
public static int TickCount { get { throw null; } }
public static long TickCount64 { get { throw null; } }
public static string UserDomainName { get { throw null; } }
public static bool UserInteractive { get { throw null; } }
public static string UserName { get { throw null; } }
public static System.Version Version { get { throw null; } }
public static long WorkingSet { get { throw null; } }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public static void Exit(int exitCode) { throw null; }
public static string ExpandEnvironmentVariables(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public static void FailFast(string? message) { throw null; }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public static void FailFast(string? message, System.Exception? exception) { throw null; }
public static string[] GetCommandLineArgs() { throw null; }
public static string? GetEnvironmentVariable(string variable) { throw null; }
public static string? GetEnvironmentVariable(string variable, System.EnvironmentVariableTarget target) { throw null; }
public static System.Collections.IDictionary GetEnvironmentVariables() { throw null; }
public static System.Collections.IDictionary GetEnvironmentVariables(System.EnvironmentVariableTarget target) { throw null; }
public static string GetFolderPath(System.Environment.SpecialFolder folder) { throw null; }
public static string GetFolderPath(System.Environment.SpecialFolder folder, System.Environment.SpecialFolderOption option) { throw null; }
public static string[] GetLogicalDrives() { throw null; }
public static void SetEnvironmentVariable(string variable, string? value) { }
public static void SetEnvironmentVariable(string variable, string? value, System.EnvironmentVariableTarget target) { }
public enum SpecialFolder
{
Desktop = 0,
Programs = 2,
MyDocuments = 5,
Personal = 5,
Favorites = 6,
Startup = 7,
Recent = 8,
SendTo = 9,
StartMenu = 11,
MyMusic = 13,
MyVideos = 14,
DesktopDirectory = 16,
MyComputer = 17,
NetworkShortcuts = 19,
Fonts = 20,
Templates = 21,
CommonStartMenu = 22,
CommonPrograms = 23,
CommonStartup = 24,
CommonDesktopDirectory = 25,
ApplicationData = 26,
PrinterShortcuts = 27,
LocalApplicationData = 28,
InternetCache = 32,
Cookies = 33,
History = 34,
CommonApplicationData = 35,
Windows = 36,
System = 37,
ProgramFiles = 38,
MyPictures = 39,
UserProfile = 40,
SystemX86 = 41,
ProgramFilesX86 = 42,
CommonProgramFiles = 43,
CommonProgramFilesX86 = 44,
CommonTemplates = 45,
CommonDocuments = 46,
CommonAdminTools = 47,
AdminTools = 48,
CommonMusic = 53,
CommonPictures = 54,
CommonVideos = 55,
Resources = 56,
LocalizedResources = 57,
CommonOemLinks = 58,
CDBurning = 59,
}
public enum SpecialFolderOption
{
None = 0,
DoNotVerify = 16384,
Create = 32768,
}
}
public enum EnvironmentVariableTarget
{
Process = 0,
User = 1,
Machine = 2,
}
public partial class EventArgs
{
public static readonly System.EventArgs Empty;
public EventArgs() { }
}
public delegate void EventHandler(object? sender, System.EventArgs e);
public delegate void EventHandler<TEventArgs>(object? sender, TEventArgs e);
public partial class Exception : System.Runtime.Serialization.ISerializable
{
public Exception() { }
protected Exception(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public Exception(string? message) { }
public Exception(string? message, System.Exception? innerException) { }
public virtual System.Collections.IDictionary Data { get { throw null; } }
public virtual string? HelpLink { get { throw null; } set { } }
public int HResult { get { throw null; } set { } }
public System.Exception? InnerException { get { throw null; } }
public virtual string Message { get { throw null; } }
public virtual string? Source { get { throw null; } set { } }
public virtual string? StackTrace { get { throw null; } }
public System.Reflection.MethodBase? TargetSite { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Metadata for the method might be incomplete or removed")] get { throw null; } }
[System.ObsoleteAttribute("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId = "SYSLIB0011", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
protected event System.EventHandler<System.Runtime.Serialization.SafeSerializationEventArgs>? SerializeObjectState { add { } remove { } }
public virtual System.Exception GetBaseException() { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public new System.Type GetType() { throw null; }
public override string ToString() { throw null; }
}
[System.ObsoleteAttribute("ExecutionEngineException previously indicated an unspecified fatal error in the runtime. The runtime no longer raises this exception so this type is obsolete.")]
public sealed partial class ExecutionEngineException : System.SystemException
{
public ExecutionEngineException() { }
public ExecutionEngineException(string? message) { }
public ExecutionEngineException(string? message, System.Exception? innerException) { }
}
public partial class FieldAccessException : System.MemberAccessException
{
public FieldAccessException() { }
protected FieldAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public FieldAccessException(string? message) { }
public FieldAccessException(string? message, System.Exception? inner) { }
}
public partial class FileStyleUriParser : System.UriParser
{
public FileStyleUriParser() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Enum, Inherited=false)]
public partial class FlagsAttribute : System.Attribute
{
public FlagsAttribute() { }
}
public partial class FormatException : System.SystemException
{
public FormatException() { }
protected FormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public FormatException(string? message) { }
public FormatException(string? message, System.Exception? innerException) { }
}
public abstract partial class FormattableString : System.IFormattable
{
protected FormattableString() { }
public abstract int ArgumentCount { get; }
public abstract string Format { get; }
public static string CurrentCulture(System.FormattableString formattable) { throw null; }
public abstract object? GetArgument(int index);
public abstract object?[] GetArguments();
public static string Invariant(System.FormattableString formattable) { throw null; }
string System.IFormattable.ToString(string? ignored, System.IFormatProvider? formatProvider) { throw null; }
public override string ToString() { throw null; }
public abstract string ToString(System.IFormatProvider? formatProvider);
}
public partial class FtpStyleUriParser : System.UriParser
{
public FtpStyleUriParser() { }
}
public delegate TResult Func<out TResult>();
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9, in T10, in T11, in T12, in T13, in T14, in T15, in T16, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16);
public delegate TResult Func<in T, out TResult>(T arg);
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
public delegate TResult Func<in T1, in T2, in T3, in T4, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
public static partial class GC
{
public static int MaxGeneration { get { throw null; } }
public static void AddMemoryPressure(long bytesAllocated) { }
public static T[] AllocateArray<T>(int length, bool pinned = false) { throw null; }
public static T[] AllocateUninitializedArray<T>(int length, bool pinned = false) { throw null; }
public static void CancelFullGCNotification() { }
public static void Collect() { }
public static void Collect(int generation) { }
public static void Collect(int generation, System.GCCollectionMode mode) { }
public static void Collect(int generation, System.GCCollectionMode mode, bool blocking) { }
public static void Collect(int generation, System.GCCollectionMode mode, bool blocking, bool compacting) { }
public static int CollectionCount(int generation) { throw null; }
public static void EndNoGCRegion() { }
public static long GetAllocatedBytesForCurrentThread() { throw null; }
public static System.GCMemoryInfo GetGCMemoryInfo() { throw null; }
public static System.GCMemoryInfo GetGCMemoryInfo(System.GCKind kind) { throw null; }
public static int GetGeneration(object obj) { throw null; }
public static int GetGeneration(System.WeakReference wo) { throw null; }
public static long GetTotalAllocatedBytes(bool precise = false) { throw null; }
public static long GetTotalMemory(bool forceFullCollection) { throw null; }
public static void KeepAlive(object? obj) { }
public static void RegisterForFullGCNotification(int maxGenerationThreshold, int largeObjectHeapThreshold) { }
public static void RemoveMemoryPressure(long bytesAllocated) { }
public static void ReRegisterForFinalize(object obj) { }
public static void SuppressFinalize(object obj) { }
public static bool TryStartNoGCRegion(long totalSize) { throw null; }
public static bool TryStartNoGCRegion(long totalSize, bool disallowFullBlockingGC) { throw null; }
public static bool TryStartNoGCRegion(long totalSize, long lohSize) { throw null; }
public static bool TryStartNoGCRegion(long totalSize, long lohSize, bool disallowFullBlockingGC) { throw null; }
public static System.GCNotificationStatus WaitForFullGCApproach() { throw null; }
public static System.GCNotificationStatus WaitForFullGCApproach(int millisecondsTimeout) { throw null; }
public static System.GCNotificationStatus WaitForFullGCComplete() { throw null; }
public static System.GCNotificationStatus WaitForFullGCComplete(int millisecondsTimeout) { throw null; }
public static void WaitForPendingFinalizers() { }
}
public enum GCCollectionMode
{
Default = 0,
Forced = 1,
Optimized = 2,
}
public readonly partial struct GCGenerationInfo
{
private readonly int _dummyPrimitive;
public long FragmentationAfterBytes { get { throw null; } }
public long FragmentationBeforeBytes { get { throw null; } }
public long SizeAfterBytes { get { throw null; } }
public long SizeBeforeBytes { get { throw null; } }
}
public enum GCKind
{
Any = 0,
Ephemeral = 1,
FullBlocking = 2,
Background = 3,
}
public readonly partial struct GCMemoryInfo
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool Compacted { get { throw null; } }
public bool Concurrent { get { throw null; } }
public long FinalizationPendingCount { get { throw null; } }
public long FragmentedBytes { get { throw null; } }
public int Generation { get { throw null; } }
public System.ReadOnlySpan<System.GCGenerationInfo> GenerationInfo { get { throw null; } }
public long HeapSizeBytes { get { throw null; } }
public long HighMemoryLoadThresholdBytes { get { throw null; } }
public long Index { get { throw null; } }
public long MemoryLoadBytes { get { throw null; } }
public System.ReadOnlySpan<System.TimeSpan> PauseDurations { get { throw null; } }
public double PauseTimePercentage { get { throw null; } }
public long PinnedObjectsCount { get { throw null; } }
public long PromotedBytes { get { throw null; } }
public long TotalAvailableMemoryBytes { get { throw null; } }
public long TotalCommittedBytes { get { throw null; } }
}
public enum GCNotificationStatus
{
Succeeded = 0,
Failed = 1,
Canceled = 2,
Timeout = 3,
NotApplicable = 4,
}
public partial class GenericUriParser : System.UriParser
{
public GenericUriParser(System.GenericUriParserOptions options) { }
}
[System.FlagsAttribute]
public enum GenericUriParserOptions
{
Default = 0,
GenericAuthority = 1,
AllowEmptyAuthority = 2,
NoUserInfo = 4,
NoPort = 8,
NoQuery = 16,
NoFragment = 32,
DontConvertPathBackslashes = 64,
DontCompressPath = 128,
DontUnescapePathDotsAndSlashes = 256,
Idn = 512,
IriParsing = 1024,
}
public partial class GopherStyleUriParser : System.UriParser
{
public GopherStyleUriParser() { }
}
public readonly partial struct Guid : System.IComparable, System.IComparable<System.Guid>, System.IEquatable<System.Guid>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IComparisonOperators<System.Guid, System.Guid>,
System.ISpanParseable<System.Guid>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.Guid Empty;
public Guid(byte[] b) { throw null; }
public Guid(int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { throw null; }
public Guid(int a, short b, short c, byte[] d) { throw null; }
public Guid(System.ReadOnlySpan<byte> b) { throw null; }
public Guid(string g) { throw null; }
[System.CLSCompliantAttribute(false)]
public Guid(uint a, ushort b, ushort c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { throw null; }
public int CompareTo(System.Guid value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Guid g) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Guid NewGuid() { throw null; }
public static bool operator ==(System.Guid a, System.Guid b) { throw null; }
public static bool operator !=(System.Guid a, System.Guid b) { throw null; }
public static System.Guid Parse(System.ReadOnlySpan<char> input) { throw null; }
public static System.Guid Parse(string input) { throw null; }
public static System.Guid ParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format) { throw null; }
public static System.Guid ParseExact(string input, string format) { throw null; }
public byte[] ToByteArray() { throw null; }
public override string ToString() { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>)) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, out System.Guid result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, out System.Guid result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format, out System.Guid result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, out System.Guid result) { throw null; }
public bool TryWriteBytes(System.Span<byte> destination) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Guid, System.Guid>.operator <(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Guid, System.Guid>.operator <=(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Guid, System.Guid>.operator >(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Guid, System.Guid>.operator >=(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.Guid, System.Guid>.operator ==(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.Guid, System.Guid>.operator !=(System.Guid left, System.Guid right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Guid IParseable<System.Guid>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.Guid>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Guid result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Guid ISpanParseable<System.Guid>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.Guid>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.Guid result) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct Half : System.IComparable, System.IComparable<System.Half>, System.IEquatable<System.Half>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryFloatingPoint<System.Half>,
System.IMinMaxValue<System.Half>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static System.Half Epsilon { get { throw null; } }
public static System.Half MaxValue { get { throw null; } }
public static System.Half MinValue { get { throw null; } }
public static System.Half NaN { get { throw null; } }
public static System.Half NegativeInfinity { get { throw null; } }
public static System.Half PositiveInfinity { get { throw null; } }
public int CompareTo(System.Half other) { throw null; }
public int CompareTo(object? obj) { throw null; }
public bool Equals(System.Half other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool IsFinite(System.Half value) { throw null; }
public static bool IsInfinity(System.Half value) { throw null; }
public static bool IsNaN(System.Half value) { throw null; }
public static bool IsNegative(System.Half value) { throw null; }
public static bool IsNegativeInfinity(System.Half value) { throw null; }
public static bool IsNormal(System.Half value) { throw null; }
public static bool IsPositiveInfinity(System.Half value) { throw null; }
public static bool IsSubnormal(System.Half value) { throw null; }
public static bool operator ==(System.Half left, System.Half right) { throw null; }
public static explicit operator System.Half (double value) { throw null; }
public static explicit operator double (System.Half value) { throw null; }
public static explicit operator float (System.Half value) { throw null; }
public static explicit operator System.Half (float value) { throw null; }
public static bool operator >(System.Half left, System.Half right) { throw null; }
public static bool operator >=(System.Half left, System.Half right) { throw null; }
public static bool operator !=(System.Half left, System.Half right) { throw null; }
public static bool operator <(System.Half left, System.Half right) { throw null; }
public static bool operator <=(System.Half left, System.Half right) { throw null; }
public static System.Half Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Half Parse(string s) { throw null; }
public static System.Half Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Half Parse(string s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Half Parse(string s, System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Half result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Half result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IAdditiveIdentity<System.Half, System.Half>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.E { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Epsilon { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.NaN { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.NegativeInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.NegativeZero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Pi { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.PositiveInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Tau { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IMinMaxValue<System.Half>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IMinMaxValue<System.Half>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IMultiplicativeIdentity<System.Half, System.Half>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IAdditionOperators<System.Half, System.Half, System.Half>.operator +(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<System.Half>.IsPow2(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBinaryNumber<System.Half>.Log2(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBitwiseOperators<System.Half, System.Half, System.Half>.operator &(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBitwiseOperators<System.Half, System.Half, System.Half>.operator |(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBitwiseOperators<System.Half, System.Half, System.Half>.operator ^(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IBitwiseOperators<System.Half, System.Half, System.Half>.operator ~(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Half, System.Half>.operator <(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Half, System.Half>.operator <=(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Half, System.Half>.operator >(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.Half, System.Half>.operator >=(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IDecrementOperators<System.Half>.operator --(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IDivisionOperators<System.Half, System.Half, System.Half>.operator /(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.Half, System.Half>.operator ==(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.Half, System.Half>.operator !=(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Acos(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Acosh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Asin(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Asinh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Atan(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Atan2(System.Half y, System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Atanh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.BitIncrement(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.BitDecrement(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Cbrt(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Ceiling(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.CopySign(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Cos(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Cosh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Exp(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Floor(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.FusedMultiplyAdd(System.Half left, System.Half right, System.Half addend) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.IEEERemainder(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static TInteger IFloatingPoint<System.Half>.ILogB<TInteger>(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Log(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Log(System.Half x, System.Half newBase) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Log2(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Log10(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.MaxMagnitude(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.MinMagnitude(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Pow(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Round(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Round<TInteger>(System.Half x, TInteger digits) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Round(System.Half x, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Round<TInteger>(System.Half x, TInteger digits, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.ScaleB<TInteger>(System.Half x, TInteger n) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Sin(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Sinh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Sqrt(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Tan(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Tanh(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IFloatingPoint<System.Half>.Truncate(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsFinite(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsInfinity(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsNaN(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsNegative(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsNegativeInfinity(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsNormal(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsPositiveInfinity(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<System.Half>.IsSubnormal(System.Half x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IIncrementOperators<System.Half>.operator ++(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IModulusOperators<System.Half, System.Half, System.Half>.operator %(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IMultiplyOperators<System.Half, System.Half, System.Half>.operator *(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Abs(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Clamp(System.Half value, System.Half min, System.Half max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (System.Half Quotient, System.Half Remainder) INumber<System.Half>.DivRem(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Max(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Min(System.Half x, System.Half y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half INumber<System.Half>.Sign(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<System.Half>.TryCreate<TOther>(TOther value, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<System.Half>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<System.Half>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IParseable<System.Half>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.Half>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half ISignedNumber<System.Half>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half ISpanParseable<System.Half>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.Half>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.Half result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half ISubtractionOperators<System.Half, System.Half, System.Half>.operator -(System.Half left, System.Half right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IUnaryNegationOperators<System.Half, System.Half>.operator -(System.Half value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.Half IUnaryPlusOperators<System.Half, System.Half>.operator +(System.Half value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial struct HashCode
{
private int _dummyPrimitive;
public void AddBytes(System.ReadOnlySpan<byte> value) { }
public void Add<T>(T value) { }
public void Add<T>(T value, System.Collections.Generic.IEqualityComparer<T>? comparer) { }
public static int Combine<T1>(T1 value1) { throw null; }
public static int Combine<T1, T2>(T1 value1, T2 value2) { throw null; }
public static int Combine<T1, T2, T3>(T1 value1, T2 value2, T3 value3) { throw null; }
public static int Combine<T1, T2, T3, T4>(T1 value1, T2 value2, T3 value3, T4 value4) { throw null; }
public static int Combine<T1, T2, T3, T4, T5>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5) { throw null; }
public static int Combine<T1, T2, T3, T4, T5, T6>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6) { throw null; }
public static int Combine<T1, T2, T3, T4, T5, T6, T7>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7) { throw null; }
public static int Combine<T1, T2, T3, T4, T5, T6, T7, T8>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("HashCode is a mutable struct and should not be compared with other HashCodes.", true)]
public override bool Equals(object? obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("HashCode is a mutable struct and should not be compared with other HashCodes. Use ToHashCode to retrieve the computed hash code.", true)]
public override int GetHashCode() { throw null; }
public int ToHashCode() { throw null; }
}
public partial class HttpStyleUriParser : System.UriParser
{
public HttpStyleUriParser() { }
}
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IAdditionOperators<TSelf, TOther, TResult>
where TSelf : System.IAdditionOperators<TSelf, TOther, TResult>
{
static abstract TResult operator +(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IAdditiveIdentity<TSelf, TResult>
where TSelf : System.IAdditiveIdentity<TSelf, TResult>
{
static abstract TResult AdditiveIdentity { get; }
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IBinaryFloatingPoint<TSelf> : System.IBinaryNumber<TSelf>, System.IFloatingPoint<TSelf>
where TSelf : IBinaryFloatingPoint<TSelf>
{
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IBinaryInteger<TSelf> : System.IBinaryNumber<TSelf>, System.IShiftOperators<TSelf, TSelf>
where TSelf : IBinaryInteger<TSelf>
{
static abstract TSelf LeadingZeroCount(TSelf value);
static abstract TSelf PopCount(TSelf value);
static abstract TSelf RotateLeft(TSelf value, int rotateAmount);
static abstract TSelf RotateRight(TSelf value, int rotateAmount);
static abstract TSelf TrailingZeroCount(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IBinaryNumber<TSelf> : System.IBitwiseOperators<TSelf, TSelf, TSelf>, System.INumber<TSelf>
where TSelf : IBinaryNumber<TSelf>
{
static abstract bool IsPow2(TSelf value);
static abstract TSelf Log2(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IBitwiseOperators<TSelf, TOther, TResult>
where TSelf : System.IBitwiseOperators<TSelf, TOther, TResult>
{
static abstract TResult operator &(TSelf left, TOther right);
static abstract TResult operator |(TSelf left, TOther right);
static abstract TResult operator ^(TSelf left, TOther right);
static abstract TResult operator ~(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IComparisonOperators<TSelf, TOther> : System.IComparable, System.IComparable<TOther>, System.IEqualityOperators<TSelf, TOther>
where TSelf : IComparisonOperators<TSelf, TOther>
{
static abstract bool operator <(TSelf left, TOther right);
static abstract bool operator <=(TSelf left, TOther right);
static abstract bool operator >(TSelf left, TOther right);
static abstract bool operator >=(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IDecrementOperators<TSelf>
where TSelf : System.IDecrementOperators<TSelf>
{
static abstract TSelf operator --(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IDivisionOperators<TSelf, TOther, TResult>
where TSelf : System.IDivisionOperators<TSelf, TOther, TResult>
{
static abstract TResult operator /(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IEqualityOperators<TSelf, TOther> : IEquatable<TOther>
where TSelf : System.IEqualityOperators<TSelf, TOther>
{
static abstract bool operator ==(TSelf left, TOther right);
static abstract bool operator !=(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IFloatingPoint<TSelf> : System.ISignedNumber<TSelf>
where TSelf : System.IFloatingPoint<TSelf>
{
static abstract TSelf E { get; }
static abstract TSelf Epsilon { get; }
static abstract TSelf NaN { get; }
static abstract TSelf NegativeInfinity { get; }
static abstract TSelf NegativeZero { get; }
static abstract TSelf Pi { get; }
static abstract TSelf PositiveInfinity { get; }
static abstract TSelf Tau { get; }
static abstract TSelf Acos(TSelf x);
static abstract TSelf Acosh(TSelf x);
static abstract TSelf Asin(TSelf x);
static abstract TSelf Asinh(TSelf x);
static abstract TSelf Atan(TSelf x);
static abstract TSelf Atan2(TSelf y, TSelf x);
static abstract TSelf Atanh(TSelf x);
static abstract TSelf BitIncrement(TSelf x);
static abstract TSelf BitDecrement(TSelf x);
static abstract TSelf Cbrt(TSelf x);
static abstract TSelf Ceiling(TSelf x);
static abstract TSelf CopySign(TSelf x, TSelf y);
static abstract TSelf Cos(TSelf x);
static abstract TSelf Cosh(TSelf x);
static abstract TSelf Exp(TSelf x);
static abstract TSelf Floor(TSelf x);
static abstract TSelf FusedMultiplyAdd(TSelf left, TSelf right, TSelf addend);
static abstract TSelf IEEERemainder(TSelf left, TSelf right);
static abstract TInteger ILogB<TInteger>(TSelf x) where TInteger : IBinaryInteger<TInteger>;
static abstract bool IsFinite(TSelf value);
static abstract bool IsInfinity(TSelf value);
static abstract bool IsNaN(TSelf value);
static abstract bool IsNegative(TSelf value);
static abstract bool IsNegativeInfinity(TSelf value);
static abstract bool IsNormal(TSelf value);
static abstract bool IsPositiveInfinity(TSelf value);
static abstract bool IsSubnormal(TSelf value);
static abstract TSelf Log(TSelf x);
static abstract TSelf Log(TSelf x, TSelf newBase);
static abstract TSelf Log2(TSelf x);
static abstract TSelf Log10(TSelf x);
static abstract TSelf MaxMagnitude(TSelf x, TSelf y);
static abstract TSelf MinMagnitude(TSelf x, TSelf y);
static abstract TSelf Pow(TSelf x, TSelf y);
static abstract TSelf Round(TSelf x);
static abstract TSelf Round<TInteger>(TSelf x, TInteger digits) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf Round(TSelf x, MidpointRounding mode);
static abstract TSelf Round<TInteger>(TSelf x, TInteger digits, MidpointRounding mode) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf ScaleB<TInteger>(TSelf x, TInteger n) where TInteger : IBinaryInteger<TInteger>;
static abstract TSelf Sin(TSelf x);
static abstract TSelf Sinh(TSelf x);
static abstract TSelf Sqrt(TSelf x);
static abstract TSelf Tan(TSelf x);
static abstract TSelf Tanh(TSelf x);
static abstract TSelf Truncate(TSelf x);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IIncrementOperators<TSelf>
where TSelf : System.IIncrementOperators<TSelf>
{
static abstract TSelf operator ++(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IMinMaxValue<TSelf>
where TSelf : System.IMinMaxValue<TSelf>
{
static abstract TSelf MinValue { get; }
static abstract TSelf MaxValue { get; }
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IModulusOperators<TSelf, TOther, TResult>
where TSelf : System.IModulusOperators<TSelf, TOther, TResult>
{
static abstract TResult operator %(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IMultiplicativeIdentity<TSelf, TResult>
where TSelf : System.IMultiplicativeIdentity<TSelf, TResult>
{
static abstract TResult MultiplicativeIdentity { get; }
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IMultiplyOperators<TSelf, TOther, TResult>
where TSelf : System.IMultiplyOperators<TSelf, TOther, TResult>
{
static abstract TResult operator *(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface INumber<TSelf> : System.IAdditionOperators<TSelf, TSelf, TSelf>, System.IAdditiveIdentity<TSelf, TSelf>, System.IComparable, System.IComparable<TSelf>, System.IComparisonOperators<TSelf, TSelf>, System.IDecrementOperators<TSelf>, System.IDivisionOperators<TSelf, TSelf, TSelf>, System.IEquatable<TSelf>, System.IEqualityOperators<TSelf, TSelf>, System.IFormattable, System.IIncrementOperators<TSelf>, System.IModulusOperators<TSelf, TSelf, TSelf>, System.IMultiplicativeIdentity<TSelf, TSelf>, System.IMultiplyOperators<TSelf, TSelf, TSelf>, System.IParseable<TSelf>, System.ISpanFormattable, System.ISpanParseable<TSelf>, System.ISubtractionOperators<TSelf, TSelf, TSelf>, System.IUnaryNegationOperators<TSelf, TSelf>, System.IUnaryPlusOperators<TSelf, TSelf>
where TSelf : System.INumber<TSelf>
{
static abstract TSelf One { get; }
static abstract TSelf Zero { get; }
static abstract TSelf Abs(TSelf value);
static abstract TSelf Clamp(TSelf value, TSelf min, TSelf max);
static abstract TSelf Create<TOther>(TOther value) where TOther : INumber<TOther>;
static abstract TSelf CreateSaturating<TOther>(TOther value) where TOther : INumber<TOther>;
static abstract TSelf CreateTruncating<TOther>(TOther value) where TOther : INumber<TOther>;
static abstract (TSelf Quotient, TSelf Remainder) DivRem(TSelf left, TSelf right);
static abstract TSelf Max(TSelf x, TSelf y);
static abstract TSelf Min(TSelf x, TSelf y);
static abstract TSelf Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider);
static abstract TSelf Parse(ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider);
static abstract TSelf Sign(TSelf value);
static abstract bool TryCreate<TOther>(TOther value, out TSelf result) where TOther : INumber<TOther>;
static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out TSelf result);
static abstract bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IParseable<TSelf>
where TSelf : System.IParseable<TSelf>
{
static abstract TSelf Parse(string s, System.IFormatProvider? provider);
static abstract bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out TSelf result);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IShiftOperators<TSelf, TResult>
where TSelf : System.IShiftOperators<TSelf, TResult>
{
static abstract TResult operator <<(TSelf value, int shiftAmount);
static abstract TResult operator >>(TSelf value, int shiftAmount);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface ISignedNumber<TSelf> : System.INumber<TSelf>, System.IUnaryNegationOperators<TSelf, TSelf>
where TSelf : System.ISignedNumber<TSelf>
{
static abstract TSelf NegativeOne { get; }
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface ISpanParseable<TSelf> : System.IParseable<TSelf>
where TSelf : System.ISpanParseable<TSelf>
{
static abstract TSelf Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider);
static abstract bool TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out TSelf result);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface ISubtractionOperators<TSelf, TOther, TResult>
where TSelf : System.ISubtractionOperators<TSelf, TOther, TResult>
{
static abstract TResult operator -(TSelf left, TOther right);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IUnaryNegationOperators<TSelf, TResult>
where TSelf : System.IUnaryNegationOperators<TSelf, TResult>
{
static abstract TResult operator -(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IUnaryPlusOperators<TSelf, TResult>
where TSelf : System.IUnaryPlusOperators<TSelf, TResult>
{
static abstract TResult operator +(TSelf value);
}
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public partial interface IUnsignedNumber<TSelf> : System.INumber<TSelf>
where TSelf : IUnsignedNumber<TSelf>
{
}
#endif // FEATURE_GENERIC_MATH
public partial interface IAsyncDisposable
{
System.Threading.Tasks.ValueTask DisposeAsync();
}
public partial interface IAsyncResult
{
object? AsyncState { get; }
System.Threading.WaitHandle AsyncWaitHandle { get; }
bool CompletedSynchronously { get; }
bool IsCompleted { get; }
}
public partial interface ICloneable
{
object Clone();
}
public partial interface IComparable
{
int CompareTo(object? obj);
}
public partial interface IComparable<in T>
{
int CompareTo(T? other);
}
[System.CLSCompliantAttribute(false)]
public partial interface IConvertible
{
System.TypeCode GetTypeCode();
bool ToBoolean(System.IFormatProvider? provider);
byte ToByte(System.IFormatProvider? provider);
char ToChar(System.IFormatProvider? provider);
System.DateTime ToDateTime(System.IFormatProvider? provider);
decimal ToDecimal(System.IFormatProvider? provider);
double ToDouble(System.IFormatProvider? provider);
short ToInt16(System.IFormatProvider? provider);
int ToInt32(System.IFormatProvider? provider);
long ToInt64(System.IFormatProvider? provider);
sbyte ToSByte(System.IFormatProvider? provider);
float ToSingle(System.IFormatProvider? provider);
string ToString(System.IFormatProvider? provider);
object ToType(System.Type conversionType, System.IFormatProvider? provider);
ushort ToUInt16(System.IFormatProvider? provider);
uint ToUInt32(System.IFormatProvider? provider);
ulong ToUInt64(System.IFormatProvider? provider);
}
public partial interface ICustomFormatter
{
string Format(string? format, object? arg, System.IFormatProvider? formatProvider);
}
public partial interface IDisposable
{
void Dispose();
}
public partial interface IEquatable<T>
{
bool Equals(T? other);
}
public partial interface IFormatProvider
{
object? GetFormat(System.Type? formatType);
}
public partial interface IFormattable
{
string ToString(string? format, System.IFormatProvider? formatProvider);
}
public readonly partial struct Index : System.IEquatable<System.Index>
{
private readonly int _dummyPrimitive;
public Index(int value, bool fromEnd = false) { throw null; }
public static System.Index End { get { throw null; } }
public bool IsFromEnd { get { throw null; } }
public static System.Index Start { get { throw null; } }
public int Value { get { throw null; } }
public bool Equals(System.Index other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.Index FromEnd(int value) { throw null; }
public static System.Index FromStart(int value) { throw null; }
public override int GetHashCode() { throw null; }
public int GetOffset(int length) { throw null; }
public static implicit operator System.Index (int value) { throw null; }
public override string ToString() { throw null; }
}
public sealed partial class IndexOutOfRangeException : System.SystemException
{
public IndexOutOfRangeException() { }
public IndexOutOfRangeException(string? message) { }
public IndexOutOfRangeException(string? message, System.Exception? innerException) { }
}
public sealed partial class InsufficientExecutionStackException : System.SystemException
{
public InsufficientExecutionStackException() { }
public InsufficientExecutionStackException(string? message) { }
public InsufficientExecutionStackException(string? message, System.Exception? innerException) { }
}
public sealed partial class InsufficientMemoryException : System.OutOfMemoryException
{
public InsufficientMemoryException() { }
public InsufficientMemoryException(string? message) { }
public InsufficientMemoryException(string? message, System.Exception? innerException) { }
}
public readonly partial struct Int16 : System.IComparable, System.IComparable<short>, System.IConvertible, System.IEquatable<short>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<short>,
System.IMinMaxValue<short>,
System.ISignedNumber<short>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly short _dummyPrimitive;
public const short MaxValue = (short)32767;
public const short MinValue = (short)-32768;
public int CompareTo(System.Int16 value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Int16 obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Int16 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.Int16 Parse(string s) { throw null; }
public static System.Int16 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Int16 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Int16 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
System.Int16 System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int16 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Int16 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int16 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int16 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IAdditiveIdentity<short, short>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IMinMaxValue<short>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IMinMaxValue<short>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IMultiplicativeIdentity<short, short>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IAdditionOperators<short, short, short>.operator +(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.LeadingZeroCount(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.PopCount(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.RotateLeft(short value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.RotateRight(short value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryInteger<short>.TrailingZeroCount(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<short>.IsPow2(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBinaryNumber<short>.Log2(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBitwiseOperators<short, short, short>.operator &(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBitwiseOperators<short, short, short>.operator |(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBitwiseOperators<short, short, short>.operator ^(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IBitwiseOperators<short, short, short>.operator ~(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<short, short>.operator <(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<short, short>.operator <=(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<short, short>.operator >(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<short, short>.operator >=(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IDecrementOperators<short>.operator --(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IDivisionOperators<short, short, short>.operator /(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<short, short>.operator ==(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<short, short>.operator !=(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IIncrementOperators<short>.operator ++(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IModulusOperators<short, short, short>.operator %(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IMultiplyOperators<short, short, short>.operator *(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Abs(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Clamp(short value, short min, short max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (short Quotient, short Remainder) INumber<short>.DivRem(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Max(short x, short y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Min(short x, short y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short INumber<short>.Sign(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<short>.TryCreate<TOther>(TOther value, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<short>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<short>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IParseable<short>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<short>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IShiftOperators<short, short>.operator <<(short value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IShiftOperators<short, short>.operator >>(short value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short ISignedNumber<short>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short ISpanParseable<short>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<short>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out short result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short ISubtractionOperators<short, short, short>.operator -(short left, short right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IUnaryNegationOperators<short, short>.operator -(short value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static short IUnaryPlusOperators<short, short>.operator +(short value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct Int32 : System.IComparable, System.IComparable<int>, System.IConvertible, System.IEquatable<int>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<int>,
System.IMinMaxValue<int>,
System.ISignedNumber<int>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public const int MaxValue = 2147483647;
public const int MinValue = -2147483648;
public System.Int32 CompareTo(System.Int32 value) { throw null; }
public System.Int32 CompareTo(object? value) { throw null; }
public bool Equals(System.Int32 obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override System.Int32 GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Int32 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.Int32 Parse(string s) { throw null; }
public static System.Int32 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Int32 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Int32 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
System.Int32 System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out System.Int32 charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int32 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Int32 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int32 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int32 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IAdditiveIdentity<int, int>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IMinMaxValue<int>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IMinMaxValue<int>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IMultiplicativeIdentity<int, int>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IAdditionOperators<int, int, int>.operator +(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.LeadingZeroCount(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.PopCount(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.RotateLeft(int value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.RotateRight(int value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryInteger<int>.TrailingZeroCount(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<int>.IsPow2(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBinaryNumber<int>.Log2(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBitwiseOperators<int, int, int>.operator &(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBitwiseOperators<int, int, int>.operator |(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBitwiseOperators<int, int, int>.operator ^(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IBitwiseOperators<int, int, int>.operator ~(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<int, int>.operator <(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<int, int>.operator <=(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<int, int>.operator >(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<int, int>.operator >=(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IDecrementOperators<int>.operator --(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IDivisionOperators<int, int, int>.operator /(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<int, int>.operator ==(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<int, int>.operator !=(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IIncrementOperators<int>.operator ++(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IModulusOperators<int, int, int>.operator %(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IMultiplyOperators<int, int, int>.operator *(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Abs(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Clamp(int value, int min, int max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (int Quotient, int Remainder) INumber<int>.DivRem(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Max(int x, int y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Min(int x, int y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int INumber<int>.Sign(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<int>.TryCreate<TOther>(TOther value, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<int>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<int>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IParseable<int>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<int>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IShiftOperators<int, int>.operator <<(int value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IShiftOperators<int, int>.operator >>(int value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int ISignedNumber<int>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int ISpanParseable<int>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<int>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out int result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int ISubtractionOperators<int, int, int>.operator -(int left, int right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IUnaryNegationOperators<int, int>.operator -(int value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static int IUnaryPlusOperators<int, int>.operator +(int value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct Int64 : System.IComparable, System.IComparable<long>, System.IConvertible, System.IEquatable<long>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<long>,
System.IMinMaxValue<long>,
System.ISignedNumber<long>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly long _dummyPrimitive;
public const long MaxValue = (long)9223372036854775807;
public const long MinValue = (long)-9223372036854775808;
public int CompareTo(System.Int64 value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.Int64 obj) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.Int64 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.Int64 Parse(string s) { throw null; }
public static System.Int64 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Int64 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Int64 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
System.Int64 System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int64 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Int64 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Int64 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Int64 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IAdditiveIdentity<long, long>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IMinMaxValue<long>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IMinMaxValue<long>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IMultiplicativeIdentity<long, long>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IAdditionOperators<long, long, long>.operator +(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.LeadingZeroCount(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.PopCount(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.RotateLeft(long value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.RotateRight(long value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryInteger<long>.TrailingZeroCount(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<long>.IsPow2(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBinaryNumber<long>.Log2(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBitwiseOperators<long, long, long>.operator &(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBitwiseOperators<long, long, long>.operator |(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBitwiseOperators<long, long, long>.operator ^(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IBitwiseOperators<long, long, long>.operator ~(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<long, long>.operator <(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<long, long>.operator <=(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<long, long>.operator >(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<long, long>.operator >=(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IDecrementOperators<long>.operator --(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IDivisionOperators<long, long, long>.operator /(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<long, long>.operator ==(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<long, long>.operator !=(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IIncrementOperators<long>.operator ++(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IModulusOperators<long, long, long>.operator %(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IMultiplyOperators<long, long, long>.operator *(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Abs(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Clamp(long value, long min, long max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (long Quotient, long Remainder) INumber<long>.DivRem(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Max(long x, long y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Min(long x, long y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long INumber<long>.Sign(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<long>.TryCreate<TOther>(TOther value, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<long>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<long>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IParseable<long>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<long>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IShiftOperators<long, long>.operator <<(long value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IShiftOperators<long, long>.operator >>(long value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long ISignedNumber<long>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long ISpanParseable<long>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<long>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out long result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long ISubtractionOperators<long, long, long>.operator -(long left, long right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IUnaryNegationOperators<long, long>.operator -(long value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static long IUnaryPlusOperators<long, long>.operator +(long value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly partial struct IntPtr : System.IComparable, System.IComparable<nint>, System.IEquatable<nint>, System.ISpanFormattable, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<nint>,
System.IMinMaxValue<nint>,
System.ISignedNumber<nint>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.IntPtr Zero;
public IntPtr(int value) { throw null; }
public IntPtr(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe IntPtr(void* value) { throw null; }
public static System.IntPtr MaxValue { get { throw null; } }
public static System.IntPtr MinValue { get { throw null; } }
public static int Size { get { throw null; } }
public static System.IntPtr Add(System.IntPtr pointer, int offset) { throw null; }
public int CompareTo(System.IntPtr value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.IntPtr other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static System.IntPtr operator +(System.IntPtr pointer, int offset) { throw null; }
public static bool operator ==(System.IntPtr value1, System.IntPtr value2) { throw null; }
public static explicit operator System.IntPtr (int value) { throw null; }
public static explicit operator System.IntPtr (long value) { throw null; }
public static explicit operator int (System.IntPtr value) { throw null; }
public static explicit operator long (System.IntPtr value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static explicit operator void* (System.IntPtr value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static explicit operator System.IntPtr (void* value) { throw null; }
public static bool operator !=(System.IntPtr value1, System.IntPtr value2) { throw null; }
public static System.IntPtr operator -(System.IntPtr pointer, int offset) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static System.IntPtr Parse(string s) { throw null; }
public static System.IntPtr Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.IntPtr Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.IntPtr Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.IntPtr Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.IntPtr Subtract(System.IntPtr pointer, int offset) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public int ToInt32() { throw null; }
public long ToInt64() { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe void* ToPointer() { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.IntPtr result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.IntPtr result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.IntPtr result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.IntPtr result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IAdditiveIdentity<nint, nint>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IMinMaxValue<nint>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IMinMaxValue<nint>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IMultiplicativeIdentity<nint, nint>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IAdditionOperators<nint, nint, nint>.operator +(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.LeadingZeroCount(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.PopCount(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.RotateLeft(nint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.RotateRight(nint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryInteger<nint>.TrailingZeroCount(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<nint>.IsPow2(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBinaryNumber<nint>.Log2(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBitwiseOperators<nint, nint, nint>.operator &(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBitwiseOperators<nint, nint, nint>.operator |(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBitwiseOperators<nint, nint, nint>.operator ^(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IBitwiseOperators<nint, nint, nint>.operator ~(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nint, nint>.operator <(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nint, nint>.operator <=(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nint, nint>.operator >(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nint, nint>.operator >=(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IDecrementOperators<nint>.operator --(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IDivisionOperators<nint, nint, nint>.operator /(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<nint, nint>.operator ==(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<nint, nint>.operator !=(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IIncrementOperators<nint>.operator ++(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IModulusOperators<nint, nint, nint>.operator %(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IMultiplyOperators<nint, nint, nint>.operator *(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Abs(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Clamp(nint value, nint min, nint max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (nint Quotient, nint Remainder) INumber<nint>.DivRem(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Max(nint x, nint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Min(nint x, nint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint INumber<nint>.Sign(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nint>.TryCreate<TOther>(TOther value, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nint>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IParseable<nint>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<nint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IShiftOperators<nint, nint>.operator <<(nint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IShiftOperators<nint, nint>.operator >>(nint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint ISignedNumber<nint>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint ISpanParseable<nint>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<nint>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out nint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint ISubtractionOperators<nint, nint, nint>.operator -(nint left, nint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IUnaryNegationOperators<nint, nint>.operator -(nint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nint IUnaryPlusOperators<nint, nint>.operator +(nint value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial class InvalidCastException : System.SystemException
{
public InvalidCastException() { }
protected InvalidCastException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidCastException(string? message) { }
public InvalidCastException(string? message, System.Exception? innerException) { }
public InvalidCastException(string? message, int errorCode) { }
}
public partial class InvalidOperationException : System.SystemException
{
public InvalidOperationException() { }
protected InvalidOperationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidOperationException(string? message) { }
public InvalidOperationException(string? message, System.Exception? innerException) { }
}
public sealed partial class InvalidProgramException : System.SystemException
{
public InvalidProgramException() { }
public InvalidProgramException(string? message) { }
public InvalidProgramException(string? message, System.Exception? inner) { }
}
public partial class InvalidTimeZoneException : System.Exception
{
public InvalidTimeZoneException() { }
protected InvalidTimeZoneException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidTimeZoneException(string? message) { }
public InvalidTimeZoneException(string? message, System.Exception? innerException) { }
}
public partial interface IObservable<out T>
{
System.IDisposable Subscribe(System.IObserver<T> observer);
}
public partial interface IObserver<in T>
{
void OnCompleted();
void OnError(System.Exception error);
void OnNext(T value);
}
public partial interface IProgress<in T>
{
void Report(T value);
}
public partial interface ISpanFormattable : System.IFormattable
{
bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider);
}
public partial class Lazy<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T>
{
public Lazy() { }
public Lazy(bool isThreadSafe) { }
public Lazy(System.Func<T> valueFactory) { }
public Lazy(System.Func<T> valueFactory, bool isThreadSafe) { }
public Lazy(System.Func<T> valueFactory, System.Threading.LazyThreadSafetyMode mode) { }
public Lazy(System.Threading.LazyThreadSafetyMode mode) { }
public Lazy(T value) { }
public bool IsValueCreated { get { throw null; } }
public T Value { get { throw null; } }
public override string? ToString() { throw null; }
}
public partial class Lazy<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T, TMetadata> : System.Lazy<T>
{
public Lazy(System.Func<T> valueFactory, TMetadata metadata) { }
public Lazy(System.Func<T> valueFactory, TMetadata metadata, bool isThreadSafe) { }
public Lazy(System.Func<T> valueFactory, TMetadata metadata, System.Threading.LazyThreadSafetyMode mode) { }
public Lazy(TMetadata metadata) { }
public Lazy(TMetadata metadata, bool isThreadSafe) { }
public Lazy(TMetadata metadata, System.Threading.LazyThreadSafetyMode mode) { }
public TMetadata Metadata { get { throw null; } }
}
public partial class LdapStyleUriParser : System.UriParser
{
public LdapStyleUriParser() { }
}
public enum LoaderOptimization
{
NotSpecified = 0,
SingleDomain = 1,
MultiDomain = 2,
[System.ObsoleteAttribute("LoaderOptimization.DomainMask has been deprecated and is not supported.")]
DomainMask = 3,
MultiDomainHost = 3,
[System.ObsoleteAttribute("LoaderOptimization.DisallowBindings has been deprecated and is not supported.")]
DisallowBindings = 4,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method)]
public sealed partial class LoaderOptimizationAttribute : System.Attribute
{
public LoaderOptimizationAttribute(byte value) { }
public LoaderOptimizationAttribute(System.LoaderOptimization value) { }
public System.LoaderOptimization Value { get { throw null; } }
}
public abstract partial class MarshalByRefObject
{
protected MarshalByRefObject() { }
[System.ObsoleteAttribute("This Remoting API is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0010", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public object GetLifetimeService() { throw null; }
[System.ObsoleteAttribute("This Remoting API is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0010", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public virtual object InitializeLifetimeService() { throw null; }
protected System.MarshalByRefObject MemberwiseClone(bool cloneIdentity) { throw null; }
}
public static partial class Math
{
public const double E = 2.718281828459045;
public const double PI = 3.141592653589793;
public const double Tau = 6.283185307179586;
public static decimal Abs(decimal value) { throw null; }
public static double Abs(double value) { throw null; }
public static short Abs(short value) { throw null; }
public static int Abs(int value) { throw null; }
public static long Abs(long value) { throw null; }
public static nint Abs(nint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte Abs(sbyte value) { throw null; }
public static float Abs(float value) { throw null; }
public static double Acos(double d) { throw null; }
public static double Acosh(double d) { throw null; }
public static double Asin(double d) { throw null; }
public static double Asinh(double d) { throw null; }
public static double Atan(double d) { throw null; }
public static double Atan2(double y, double x) { throw null; }
public static double Atanh(double d) { throw null; }
public static long BigMul(int a, int b) { throw null; }
public static long BigMul(long a, long b, out long low) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong BigMul(ulong a, ulong b, out ulong low) { throw null; }
public static double BitDecrement(double x) { throw null; }
public static double BitIncrement(double x) { throw null; }
public static double Cbrt(double d) { throw null; }
public static decimal Ceiling(decimal d) { throw null; }
public static double Ceiling(double a) { throw null; }
public static byte Clamp(byte value, byte min, byte max) { throw null; }
public static decimal Clamp(decimal value, decimal min, decimal max) { throw null; }
public static double Clamp(double value, double min, double max) { throw null; }
public static short Clamp(short value, short min, short max) { throw null; }
public static int Clamp(int value, int min, int max) { throw null; }
public static long Clamp(long value, long min, long max) { throw null; }
public static nint Clamp(nint value, nint min, nint max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte Clamp(sbyte value, sbyte min, sbyte max) { throw null; }
public static float Clamp(float value, float min, float max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort Clamp(ushort value, ushort min, ushort max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint Clamp(uint value, uint min, uint max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong Clamp(ulong value, ulong min, ulong max) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint Clamp(nuint value, nuint min, nuint max) { throw null; }
public static double CopySign(double x, double y) { throw null; }
public static double Cos(double d) { throw null; }
public static double Cosh(double value) { throw null; }
public static int DivRem(int a, int b, out int result) { throw null; }
public static long DivRem(long a, long b, out long result) { throw null; }
public static (byte Quotient, byte Remainder) DivRem(byte left, byte right) { throw null; }
public static (short Quotient, short Remainder) DivRem(short left, short right) { throw null; }
public static (int Quotient, int Remainder) DivRem(int left, int right) { throw null; }
public static (long Quotient, long Remainder) DivRem(long left, long right) { throw null; }
public static (nint Quotient, nint Remainder) DivRem(nint left, nint right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (sbyte Quotient, sbyte Remainder) DivRem(sbyte left, sbyte right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (ushort Quotient, ushort Remainder) DivRem(ushort left, ushort right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (uint Quotient, uint Remainder) DivRem(uint left, uint right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (ulong Quotient, ulong Remainder) DivRem(ulong left, ulong right) { throw null; }
[System.CLSCompliantAttribute(false)]
public static (nuint Quotient, nuint Remainder) DivRem(nuint left, nuint right) { throw null; }
public static double Exp(double d) { throw null; }
public static decimal Floor(decimal d) { throw null; }
public static double Floor(double d) { throw null; }
public static double FusedMultiplyAdd(double x, double y, double z) { throw null; }
public static double IEEERemainder(double x, double y) { throw null; }
public static int ILogB(double x) { throw null; }
public static double Log(double d) { throw null; }
public static double Log(double a, double newBase) { throw null; }
public static double Log10(double d) { throw null; }
public static double Log2(double x) { throw null; }
public static byte Max(byte val1, byte val2) { throw null; }
public static decimal Max(decimal val1, decimal val2) { throw null; }
public static double Max(double val1, double val2) { throw null; }
public static short Max(short val1, short val2) { throw null; }
public static int Max(int val1, int val2) { throw null; }
public static long Max(long val1, long val2) { throw null; }
public static nint Max(nint val1, nint val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte Max(sbyte val1, sbyte val2) { throw null; }
public static float Max(float val1, float val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort Max(ushort val1, ushort val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint Max(uint val1, uint val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong Max(ulong val1, ulong val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint Max(nuint val1, nuint val2) { throw null; }
public static double MaxMagnitude(double x, double y) { throw null; }
public static byte Min(byte val1, byte val2) { throw null; }
public static decimal Min(decimal val1, decimal val2) { throw null; }
public static double Min(double val1, double val2) { throw null; }
public static short Min(short val1, short val2) { throw null; }
public static int Min(int val1, int val2) { throw null; }
public static long Min(long val1, long val2) { throw null; }
public static nint Min(nint val1, nint val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static sbyte Min(sbyte val1, sbyte val2) { throw null; }
public static float Min(float val1, float val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ushort Min(ushort val1, ushort val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint Min(uint val1, uint val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong Min(ulong val1, ulong val2) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint Min(nuint val1, nuint val2) { throw null; }
public static double MinMagnitude(double x, double y) { throw null; }
public static double Pow(double x, double y) { throw null; }
public static double ReciprocalEstimate(double d) { throw null; }
public static double ReciprocalSqrtEstimate(double d) { throw null; }
public static decimal Round(decimal d) { throw null; }
public static decimal Round(decimal d, int decimals) { throw null; }
public static decimal Round(decimal d, int decimals, System.MidpointRounding mode) { throw null; }
public static decimal Round(decimal d, System.MidpointRounding mode) { throw null; }
public static double Round(double a) { throw null; }
public static double Round(double value, int digits) { throw null; }
public static double Round(double value, int digits, System.MidpointRounding mode) { throw null; }
public static double Round(double value, System.MidpointRounding mode) { throw null; }
public static double ScaleB(double x, int n) { throw null; }
public static int Sign(decimal value) { throw null; }
public static int Sign(double value) { throw null; }
public static int Sign(short value) { throw null; }
public static int Sign(int value) { throw null; }
public static int Sign(long value) { throw null; }
public static int Sign(nint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int Sign(sbyte value) { throw null; }
public static int Sign(float value) { throw null; }
public static double Sin(double a) { throw null; }
public static (double Sin, double Cos) SinCos(double x) { throw null; }
public static double Sinh(double value) { throw null; }
public static double Sqrt(double d) { throw null; }
public static double Tan(double a) { throw null; }
public static double Tanh(double value) { throw null; }
public static decimal Truncate(decimal d) { throw null; }
public static double Truncate(double d) { throw null; }
}
public static partial class MathF
{
public const float E = 2.7182817f;
public const float PI = 3.1415927f;
public const float Tau = 6.2831855f;
public static float Abs(float x) { throw null; }
public static float Acos(float x) { throw null; }
public static float Acosh(float x) { throw null; }
public static float Asin(float x) { throw null; }
public static float Asinh(float x) { throw null; }
public static float Atan(float x) { throw null; }
public static float Atan2(float y, float x) { throw null; }
public static float Atanh(float x) { throw null; }
public static float BitDecrement(float x) { throw null; }
public static float BitIncrement(float x) { throw null; }
public static float Cbrt(float x) { throw null; }
public static float Ceiling(float x) { throw null; }
public static float CopySign(float x, float y) { throw null; }
public static float Cos(float x) { throw null; }
public static float Cosh(float x) { throw null; }
public static float Exp(float x) { throw null; }
public static float Floor(float x) { throw null; }
public static float FusedMultiplyAdd(float x, float y, float z) { throw null; }
public static float IEEERemainder(float x, float y) { throw null; }
public static int ILogB(float x) { throw null; }
public static float Log(float x) { throw null; }
public static float Log(float x, float y) { throw null; }
public static float Log10(float x) { throw null; }
public static float Log2(float x) { throw null; }
public static float Max(float x, float y) { throw null; }
public static float MaxMagnitude(float x, float y) { throw null; }
public static float Min(float x, float y) { throw null; }
public static float MinMagnitude(float x, float y) { throw null; }
public static float Pow(float x, float y) { throw null; }
public static float ReciprocalEstimate(float x) { throw null; }
public static float ReciprocalSqrtEstimate(float x) { throw null; }
public static float Round(float x) { throw null; }
public static float Round(float x, int digits) { throw null; }
public static float Round(float x, int digits, System.MidpointRounding mode) { throw null; }
public static float Round(float x, System.MidpointRounding mode) { throw null; }
public static float ScaleB(float x, int n) { throw null; }
public static int Sign(float x) { throw null; }
public static float Sin(float x) { throw null; }
public static (float Sin, float Cos) SinCos(float x) { throw null; }
public static float Sinh(float x) { throw null; }
public static float Sqrt(float x) { throw null; }
public static float Tan(float x) { throw null; }
public static float Tanh(float x) { throw null; }
public static float Truncate(float x) { throw null; }
}
public partial class MemberAccessException : System.SystemException
{
public MemberAccessException() { }
protected MemberAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MemberAccessException(string? message) { }
public MemberAccessException(string? message, System.Exception? inner) { }
}
public readonly partial struct Memory<T> : System.IEquatable<System.Memory<T>>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public Memory(T[]? array) { throw null; }
public Memory(T[]? array, int start, int length) { throw null; }
public static System.Memory<T> Empty { get { throw null; } }
public bool IsEmpty { get { throw null; } }
public int Length { get { throw null; } }
public System.Span<T> Span { get { throw null; } }
public void CopyTo(System.Memory<T> destination) { }
public bool Equals(System.Memory<T> other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static implicit operator System.Memory<T> (System.ArraySegment<T> segment) { throw null; }
public static implicit operator System.ReadOnlyMemory<T> (System.Memory<T> memory) { throw null; }
public static implicit operator System.Memory<T> (T[]? array) { throw null; }
public System.Buffers.MemoryHandle Pin() { throw null; }
public System.Memory<T> Slice(int start) { throw null; }
public System.Memory<T> Slice(int start, int length) { throw null; }
public T[] ToArray() { throw null; }
public override string ToString() { throw null; }
public bool TryCopyTo(System.Memory<T> destination) { throw null; }
}
public partial class MethodAccessException : System.MemberAccessException
{
public MethodAccessException() { }
protected MethodAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MethodAccessException(string? message) { }
public MethodAccessException(string? message, System.Exception? inner) { }
}
public enum MidpointRounding
{
ToEven = 0,
AwayFromZero = 1,
ToZero = 2,
ToNegativeInfinity = 3,
ToPositiveInfinity = 4,
}
public partial class MissingFieldException : System.MissingMemberException, System.Runtime.Serialization.ISerializable
{
public MissingFieldException() { }
protected MissingFieldException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingFieldException(string? message) { }
public MissingFieldException(string? message, System.Exception? inner) { }
public MissingFieldException(string? className, string? fieldName) { }
public override string Message { get { throw null; } }
}
public partial class MissingMemberException : System.MemberAccessException, System.Runtime.Serialization.ISerializable
{
protected string? ClassName;
protected string? MemberName;
protected byte[]? Signature;
public MissingMemberException() { }
protected MissingMemberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingMemberException(string? message) { }
public MissingMemberException(string? message, System.Exception? inner) { }
public MissingMemberException(string? className, string? memberName) { }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class MissingMethodException : System.MissingMemberException
{
public MissingMethodException() { }
protected MissingMethodException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingMethodException(string? message) { }
public MissingMethodException(string? message, System.Exception? inner) { }
public MissingMethodException(string? className, string? methodName) { }
public override string Message { get { throw null; } }
}
public partial struct ModuleHandle : System.IEquatable<System.ModuleHandle>
{
private object _dummy;
private int _dummyPrimitive;
public static readonly System.ModuleHandle EmptyHandle;
public int MDStreamVersion { get { throw null; } }
public bool Equals(System.ModuleHandle handle) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeFieldHandle GetRuntimeFieldHandleFromMetadataToken(int fieldToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeMethodHandle GetRuntimeMethodHandleFromMetadataToken(int methodToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeTypeHandle GetRuntimeTypeHandleFromMetadataToken(int typeToken) { throw null; }
public static bool operator ==(System.ModuleHandle left, System.ModuleHandle right) { throw null; }
public static bool operator !=(System.ModuleHandle left, System.ModuleHandle right) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeFieldHandle ResolveFieldHandle(int fieldToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeFieldHandle ResolveFieldHandle(int fieldToken, System.RuntimeTypeHandle[]? typeInstantiationContext, System.RuntimeTypeHandle[]? methodInstantiationContext) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeMethodHandle ResolveMethodHandle(int methodToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeMethodHandle ResolveMethodHandle(int methodToken, System.RuntimeTypeHandle[]? typeInstantiationContext, System.RuntimeTypeHandle[]? methodInstantiationContext) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeTypeHandle ResolveTypeHandle(int typeToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.RuntimeTypeHandle ResolveTypeHandle(int typeToken, System.RuntimeTypeHandle[]? typeInstantiationContext, System.RuntimeTypeHandle[]? methodInstantiationContext) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method)]
public sealed partial class MTAThreadAttribute : System.Attribute
{
public MTAThreadAttribute() { }
}
public abstract partial class MulticastDelegate : System.Delegate
{
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The target method might be removed")]
protected MulticastDelegate(object target, string method) : base (default(object), default(string)) { }
protected MulticastDelegate([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type target, string method) : base (default(object), default(string)) { }
protected sealed override System.Delegate CombineImpl(System.Delegate? follow) { throw null; }
public sealed override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public sealed override int GetHashCode() { throw null; }
public sealed override System.Delegate[] GetInvocationList() { throw null; }
protected override System.Reflection.MethodInfo GetMethodImpl() { throw null; }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(System.MulticastDelegate? d1, System.MulticastDelegate? d2) { throw null; }
public static bool operator !=(System.MulticastDelegate? d1, System.MulticastDelegate? d2) { throw null; }
protected sealed override System.Delegate? RemoveImpl(System.Delegate value) { throw null; }
}
public sealed partial class MulticastNotSupportedException : System.SystemException
{
public MulticastNotSupportedException() { }
public MulticastNotSupportedException(string? message) { }
public MulticastNotSupportedException(string? message, System.Exception? inner) { }
}
public partial class NetPipeStyleUriParser : System.UriParser
{
public NetPipeStyleUriParser() { }
}
public partial class NetTcpStyleUriParser : System.UriParser
{
public NetTcpStyleUriParser() { }
}
public partial class NewsStyleUriParser : System.UriParser
{
public NewsStyleUriParser() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public sealed partial class NonSerializedAttribute : System.Attribute
{
public NonSerializedAttribute() { }
}
public partial class NotFiniteNumberException : System.ArithmeticException
{
public NotFiniteNumberException() { }
public NotFiniteNumberException(double offendingNumber) { }
protected NotFiniteNumberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public NotFiniteNumberException(string? message) { }
public NotFiniteNumberException(string? message, double offendingNumber) { }
public NotFiniteNumberException(string? message, double offendingNumber, System.Exception? innerException) { }
public NotFiniteNumberException(string? message, System.Exception? innerException) { }
public double OffendingNumber { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class NotImplementedException : System.SystemException
{
public NotImplementedException() { }
protected NotImplementedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public NotImplementedException(string? message) { }
public NotImplementedException(string? message, System.Exception? inner) { }
}
public partial class NotSupportedException : System.SystemException
{
public NotSupportedException() { }
protected NotSupportedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public NotSupportedException(string? message) { }
public NotSupportedException(string? message, System.Exception? innerException) { }
}
public static partial class Nullable
{
public static int Compare<T>(T? n1, T? n2) where T : struct { throw null; }
public static bool Equals<T>(T? n1, T? n2) where T : struct { throw null; }
public static System.Type? GetUnderlyingType(System.Type nullableType) { throw null; }
public static ref readonly T GetValueRefOrDefaultRef<T>(in T? nullable) where T : struct { throw null; }
}
public partial struct Nullable<T> where T : struct
{
private T value;
private int _dummyPrimitive;
public Nullable(T value) { throw null; }
public readonly bool HasValue { get { throw null; } }
public readonly T Value { get { throw null; } }
public override bool Equals(object? other) { throw null; }
public override int GetHashCode() { throw null; }
public readonly T GetValueOrDefault() { throw null; }
public readonly T GetValueOrDefault(T defaultValue) { throw null; }
public static explicit operator T (T? value) { throw null; }
public static implicit operator T? (T value) { throw null; }
public override string? ToString() { throw null; }
}
public partial class NullReferenceException : System.SystemException
{
public NullReferenceException() { }
protected NullReferenceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public NullReferenceException(string? message) { }
public NullReferenceException(string? message, System.Exception? innerException) { }
}
public partial class Object
{
public Object() { }
public virtual bool Equals(System.Object? obj) { throw null; }
public static bool Equals(System.Object? objA, System.Object? objB) { throw null; }
~Object() { }
public virtual int GetHashCode() { throw null; }
public System.Type GetType() { throw null; }
protected System.Object MemberwiseClone() { throw null; }
public static bool ReferenceEquals(System.Object? objA, System.Object? objB) { throw null; }
public virtual string? ToString() { throw null; }
}
public partial class ObjectDisposedException : System.InvalidOperationException
{
protected ObjectDisposedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ObjectDisposedException(string? objectName) { }
public ObjectDisposedException(string? message, System.Exception? innerException) { }
public ObjectDisposedException(string? objectName, string? message) { }
public override string Message { get { throw null; } }
public string ObjectName { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static void ThrowIf([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(true)] bool condition, object instance) => throw null;
public static void ThrowIf([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(true)] bool condition, System.Type type) => throw null;
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class ObsoleteAttribute : System.Attribute
{
public ObsoleteAttribute() { }
public ObsoleteAttribute(string? message) { }
public ObsoleteAttribute(string? message, bool error) { }
public string? DiagnosticId { get { throw null; } set { } }
public bool IsError { get { throw null; } }
public string? Message { get { throw null; } }
public string? UrlFormat { get { throw null; } set { } }
}
public sealed partial class OperatingSystem : System.ICloneable, System.Runtime.Serialization.ISerializable
{
public OperatingSystem(System.PlatformID platform, System.Version version) { }
public System.PlatformID Platform { get { throw null; } }
public string ServicePack { get { throw null; } }
public System.Version Version { get { throw null; } }
public string VersionString { get { throw null; } }
public object Clone() { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool IsAndroid() { throw null; }
public static bool IsAndroidVersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0) { throw null; }
public static bool IsBrowser() { throw null; }
public static bool IsFreeBSD() { throw null; }
public static bool IsFreeBSDVersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformGuardAttribute("maccatalyst")]
public static bool IsIOS() { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformGuardAttribute("maccatalyst")]
public static bool IsIOSVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsLinux() { throw null; }
public static bool IsMacCatalyst() { throw null; }
public static bool IsMacCatalystVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsMacOS() { throw null; }
public static bool IsMacOSVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsOSPlatform(string platform) { throw null; }
public static bool IsOSPlatformVersionAtLeast(string platform, int major, int minor = 0, int build = 0, int revision = 0) { throw null; }
public static bool IsTvOS() { throw null; }
public static bool IsTvOSVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsWatchOS() { throw null; }
public static bool IsWatchOSVersionAtLeast(int major, int minor = 0, int build = 0) { throw null; }
public static bool IsWindows() { throw null; }
public static bool IsWindowsVersionAtLeast(int major, int minor = 0, int build = 0, int revision = 0) { throw null; }
public override string ToString() { throw null; }
}
public partial class OperationCanceledException : System.SystemException
{
public OperationCanceledException() { }
protected OperationCanceledException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public OperationCanceledException(string? message) { }
public OperationCanceledException(string? message, System.Exception? innerException) { }
public OperationCanceledException(string? message, System.Exception? innerException, System.Threading.CancellationToken token) { }
public OperationCanceledException(string? message, System.Threading.CancellationToken token) { }
public OperationCanceledException(System.Threading.CancellationToken token) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } }
}
public partial class OutOfMemoryException : System.SystemException
{
public OutOfMemoryException() { }
protected OutOfMemoryException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public OutOfMemoryException(string? message) { }
public OutOfMemoryException(string? message, System.Exception? innerException) { }
}
public partial class OverflowException : System.ArithmeticException
{
public OverflowException() { }
protected OverflowException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public OverflowException(string? message) { }
public OverflowException(string? message, System.Exception? innerException) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=true, AllowMultiple=false)]
public sealed partial class ParamArrayAttribute : System.Attribute
{
public ParamArrayAttribute() { }
}
public enum PlatformID
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
Win32S = 0,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
Win32Windows = 1,
Win32NT = 2,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
WinCE = 3,
Unix = 4,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
Xbox = 5,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
MacOSX = 6,
Other = 7,
}
public partial class PlatformNotSupportedException : System.NotSupportedException
{
public PlatformNotSupportedException() { }
protected PlatformNotSupportedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public PlatformNotSupportedException(string? message) { }
public PlatformNotSupportedException(string? message, System.Exception? inner) { }
}
public delegate bool Predicate<in T>(T obj);
public partial class Progress<T> : System.IProgress<T>
{
public Progress() { }
public Progress(System.Action<T> handler) { }
public event System.EventHandler<T>? ProgressChanged { add { } remove { } }
protected virtual void OnReport(T value) { }
void System.IProgress<T>.Report(T value) { }
}
public partial class Random
{
public Random() { }
public Random(int Seed) { }
public static System.Random Shared { get { throw null; } }
public virtual int Next() { throw null; }
public virtual int Next(int maxValue) { throw null; }
public virtual int Next(int minValue, int maxValue) { throw null; }
public virtual void NextBytes(byte[] buffer) { }
public virtual void NextBytes(System.Span<byte> buffer) { }
public virtual double NextDouble() { throw null; }
public virtual long NextInt64() { throw null; }
public virtual long NextInt64(long maxValue) { throw null; }
public virtual long NextInt64(long minValue, long maxValue) { throw null; }
public virtual float NextSingle() { throw null; }
protected virtual double Sample() { throw null; }
}
public readonly partial struct Range : System.IEquatable<System.Range>
{
private readonly int _dummyPrimitive;
public Range(System.Index start, System.Index end) { throw null; }
public static System.Range All { get { throw null; } }
public System.Index End { get { throw null; } }
public System.Index Start { get { throw null; } }
public static System.Range EndAt(System.Index end) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public bool Equals(System.Range other) { throw null; }
public override int GetHashCode() { throw null; }
public (int Offset, int Length) GetOffsetAndLength(int length) { throw null; }
public static System.Range StartAt(System.Index start) { throw null; }
public override string ToString() { throw null; }
}
public partial class RankException : System.SystemException
{
public RankException() { }
protected RankException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public RankException(string? message) { }
public RankException(string? message, System.Exception? innerException) { }
}
public readonly partial struct ReadOnlyMemory<T> : System.IEquatable<System.ReadOnlyMemory<T>>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ReadOnlyMemory(T[]? array) { throw null; }
public ReadOnlyMemory(T[]? array, int start, int length) { throw null; }
public static System.ReadOnlyMemory<T> Empty { get { throw null; } }
public bool IsEmpty { get { throw null; } }
public int Length { get { throw null; } }
public System.ReadOnlySpan<T> Span { get { throw null; } }
public void CopyTo(System.Memory<T> destination) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.ReadOnlyMemory<T> other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static implicit operator System.ReadOnlyMemory<T> (System.ArraySegment<T> segment) { throw null; }
public static implicit operator System.ReadOnlyMemory<T> (T[]? array) { throw null; }
public System.Buffers.MemoryHandle Pin() { throw null; }
public System.ReadOnlyMemory<T> Slice(int start) { throw null; }
public System.ReadOnlyMemory<T> Slice(int start, int length) { throw null; }
public T[] ToArray() { throw null; }
public override string ToString() { throw null; }
public bool TryCopyTo(System.Memory<T> destination) { throw null; }
}
public readonly ref partial struct ReadOnlySpan<T>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
[System.CLSCompliantAttribute(false)]
public unsafe ReadOnlySpan(void* pointer, int length) { throw null; }
public ReadOnlySpan(T[]? array) { throw null; }
public ReadOnlySpan(T[]? array, int start, int length) { throw null; }
public static System.ReadOnlySpan<T> Empty { get { throw null; } }
public bool IsEmpty { get { throw null; } }
public ref readonly T this[int index] { get { throw null; } }
public int Length { get { throw null; } }
public void CopyTo(System.Span<T> destination) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Equals() on ReadOnlySpan will always throw an exception. Use the equality operator instead.")]
public override bool Equals(object? obj) { throw null; }
public System.ReadOnlySpan<T>.Enumerator GetEnumerator() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("GetHashCode() on ReadOnlySpan will always throw an exception.")]
public override int GetHashCode() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public ref readonly T GetPinnableReference() { throw null; }
public static bool operator ==(System.ReadOnlySpan<T> left, System.ReadOnlySpan<T> right) { throw null; }
public static implicit operator System.ReadOnlySpan<T> (System.ArraySegment<T> segment) { throw null; }
public static implicit operator System.ReadOnlySpan<T> (T[]? array) { throw null; }
public static bool operator !=(System.ReadOnlySpan<T> left, System.ReadOnlySpan<T> right) { throw null; }
public System.ReadOnlySpan<T> Slice(int start) { throw null; }
public System.ReadOnlySpan<T> Slice(int start, int length) { throw null; }
public T[] ToArray() { throw null; }
public override string ToString() { throw null; }
public bool TryCopyTo(System.Span<T> destination) { throw null; }
public ref partial struct Enumerator
{
private object _dummy;
private int _dummyPrimitive;
public ref readonly T Current { get { throw null; } }
public bool MoveNext() { throw null; }
}
}
public partial class ResolveEventArgs : System.EventArgs
{
public ResolveEventArgs(string name) { }
public ResolveEventArgs(string name, System.Reflection.Assembly? requestingAssembly) { }
public string Name { get { throw null; } }
public System.Reflection.Assembly? RequestingAssembly { get { throw null; } }
}
public delegate System.Reflection.Assembly? ResolveEventHandler(object? sender, System.ResolveEventArgs args);
public ref partial struct RuntimeArgumentHandle
{
private int _dummyPrimitive;
}
public partial struct RuntimeFieldHandle : System.IEquatable<System.RuntimeFieldHandle>, System.Runtime.Serialization.ISerializable
{
private object _dummy;
private int _dummyPrimitive;
public System.IntPtr Value { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public bool Equals(System.RuntimeFieldHandle handle) { throw null; }
public override int GetHashCode() { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(System.RuntimeFieldHandle left, System.RuntimeFieldHandle right) { throw null; }
public static bool operator !=(System.RuntimeFieldHandle left, System.RuntimeFieldHandle right) { throw null; }
}
public partial struct RuntimeMethodHandle : System.IEquatable<System.RuntimeMethodHandle>, System.Runtime.Serialization.ISerializable
{
private object _dummy;
private int _dummyPrimitive;
public System.IntPtr Value { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public bool Equals(System.RuntimeMethodHandle handle) { throw null; }
public System.IntPtr GetFunctionPointer() { throw null; }
public override int GetHashCode() { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(System.RuntimeMethodHandle left, System.RuntimeMethodHandle right) { throw null; }
public static bool operator !=(System.RuntimeMethodHandle left, System.RuntimeMethodHandle right) { throw null; }
}
public partial struct RuntimeTypeHandle : System.IEquatable<System.RuntimeTypeHandle>, System.Runtime.Serialization.ISerializable
{
private object _dummy;
private int _dummyPrimitive;
public System.IntPtr Value { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public bool Equals(System.RuntimeTypeHandle handle) { throw null; }
public override int GetHashCode() { throw null; }
public System.ModuleHandle GetModuleHandle() { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public static bool operator ==(object? left, System.RuntimeTypeHandle right) { throw null; }
public static bool operator ==(System.RuntimeTypeHandle left, object? right) { throw null; }
public static bool operator !=(object? left, System.RuntimeTypeHandle right) { throw null; }
public static bool operator !=(System.RuntimeTypeHandle left, object? right) { throw null; }
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct SByte : System.IComparable, System.IComparable<sbyte>, System.IConvertible, System.IEquatable<sbyte>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<sbyte>,
System.IMinMaxValue<sbyte>,
System.ISignedNumber<sbyte>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly sbyte _dummyPrimitive;
public const sbyte MaxValue = (sbyte)127;
public const sbyte MinValue = (sbyte)-128;
public int CompareTo(object? obj) { throw null; }
public int CompareTo(System.SByte value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.SByte obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.SByte Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.SByte Parse(string s) { throw null; }
public static System.SByte Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.SByte Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.SByte Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
System.SByte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.SByte result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.SByte result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.SByte result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.SByte result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IAdditiveIdentity<sbyte, sbyte>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IMinMaxValue<sbyte>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IMinMaxValue<sbyte>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IMultiplicativeIdentity<sbyte, sbyte>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IAdditionOperators<sbyte, sbyte, sbyte>.operator +(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.LeadingZeroCount(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.PopCount(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.RotateLeft(sbyte value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.RotateRight(sbyte value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryInteger<sbyte>.TrailingZeroCount(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<sbyte>.IsPow2(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBinaryNumber<sbyte>.Log2(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBitwiseOperators<sbyte, sbyte, sbyte>.operator &(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBitwiseOperators<sbyte, sbyte, sbyte>.operator |(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBitwiseOperators<sbyte, sbyte, sbyte>.operator ^(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IBitwiseOperators<sbyte, sbyte, sbyte>.operator ~(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<sbyte, sbyte>.operator <(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<sbyte, sbyte>.operator <=(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<sbyte, sbyte>.operator >(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<sbyte, sbyte>.operator >=(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IDecrementOperators<sbyte>.operator --(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IDivisionOperators<sbyte, sbyte, sbyte>.operator /(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<sbyte, sbyte>.operator ==(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<sbyte, sbyte>.operator !=(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IIncrementOperators<sbyte>.operator ++(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IModulusOperators<sbyte, sbyte, sbyte>.operator %(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IMultiplyOperators<sbyte, sbyte, sbyte>.operator *(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Abs(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Clamp(sbyte value, sbyte min, sbyte max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (sbyte Quotient, sbyte Remainder) INumber<sbyte>.DivRem(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Max(sbyte x, sbyte y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Min(sbyte x, sbyte y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte INumber<sbyte>.Sign(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<sbyte>.TryCreate<TOther>(TOther value, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<sbyte>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<sbyte>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IParseable<sbyte>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<sbyte>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IShiftOperators<sbyte, sbyte>.operator <<(sbyte value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IShiftOperators<sbyte, sbyte>.operator >>(sbyte value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte ISignedNumber<sbyte>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte ISpanParseable<sbyte>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<sbyte>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out sbyte result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte ISubtractionOperators<sbyte, sbyte, sbyte>.operator -(sbyte left, sbyte right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IUnaryNegationOperators<sbyte, sbyte>.operator -(sbyte value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static sbyte IUnaryPlusOperators<sbyte, sbyte>.operator +(sbyte value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class SerializableAttribute : System.Attribute
{
public SerializableAttribute() { }
}
public readonly partial struct Single : System.IComparable, System.IComparable<float>, System.IConvertible, System.IEquatable<float>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryFloatingPoint<float>,
System.IMinMaxValue<float>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly float _dummyPrimitive;
public const float Epsilon = 1E-45f;
public const float MaxValue = 3.4028235E+38f;
public const float MinValue = -3.4028235E+38f;
public const float NaN = 0.0f / 0.0f;
public const float NegativeInfinity = -1.0f / 0.0f;
public const float PositiveInfinity = 1.0f / 0.0f;
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.Single value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Single obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static bool IsFinite(System.Single f) { throw null; }
public static bool IsInfinity(System.Single f) { throw null; }
public static bool IsNaN(System.Single f) { throw null; }
public static bool IsNegative(System.Single f) { throw null; }
public static bool IsNegativeInfinity(System.Single f) { throw null; }
public static bool IsNormal(System.Single f) { throw null; }
public static bool IsPositiveInfinity(System.Single f) { throw null; }
public static bool IsSubnormal(System.Single f) { throw null; }
public static bool operator ==(System.Single left, System.Single right) { throw null; }
public static bool operator >(System.Single left, System.Single right) { throw null; }
public static bool operator >=(System.Single left, System.Single right) { throw null; }
public static bool operator !=(System.Single left, System.Single right) { throw null; }
public static bool operator <(System.Single left, System.Single right) { throw null; }
public static bool operator <=(System.Single left, System.Single right) { throw null; }
public static System.Single Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowDecimalPoint | System.Globalization.NumberStyles.AllowExponent | System.Globalization.NumberStyles.AllowLeadingSign | System.Globalization.NumberStyles.AllowLeadingWhite | System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.AllowTrailingWhite, System.IFormatProvider? provider = null) { throw null; }
public static System.Single Parse(string s) { throw null; }
public static System.Single Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.Single Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.Single Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
System.Single System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Single result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.Single result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.Single result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.Single result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IAdditiveIdentity<float, float>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.E { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Epsilon { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.NaN { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.NegativeInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.NegativeZero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Pi { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.PositiveInfinity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Tau { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IMinMaxValue<float>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IMinMaxValue<float>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IMultiplicativeIdentity<float, float>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IAdditionOperators<float, float, float>.operator +(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<float>.IsPow2(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBinaryNumber<float>.Log2(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBitwiseOperators<float, float, float>.operator &(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBitwiseOperators<float, float, float>.operator |(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBitwiseOperators<float, float, float>.operator ^(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IBitwiseOperators<float, float, float>.operator ~(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<float, float>.operator <(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<float, float>.operator <=(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<float, float>.operator >(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<float, float>.operator >=(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IDecrementOperators<float>.operator --(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IDivisionOperators<float, float, float>.operator /(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<float, float>.operator ==(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<float, float>.operator !=(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Acos(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Acosh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Asin(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Asinh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Atan(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Atan2(float y, float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Atanh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.BitIncrement(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.BitDecrement(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Cbrt(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Ceiling(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.CopySign(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Cos(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Cosh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Exp(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Floor(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.FusedMultiplyAdd(float left, float right, float addend) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.IEEERemainder(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static TInteger IFloatingPoint<float>.ILogB<TInteger>(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Log(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Log(float x, float newBase) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Log2(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Log10(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.MaxMagnitude(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.MinMagnitude(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Pow(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Round(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Round<TInteger>(float x, TInteger digits) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Round(float x, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Round<TInteger>(float x, TInteger digits, System.MidpointRounding mode) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.ScaleB<TInteger>(float x, TInteger n) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Sin(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Sinh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Sqrt(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Tan(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Tanh(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IFloatingPoint<float>.Truncate(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsFinite(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsInfinity(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsNaN(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsNegative(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsNegativeInfinity(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsNormal(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsPositiveInfinity(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IFloatingPoint<float>.IsSubnormal(float x) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IIncrementOperators<float>.operator ++(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IModulusOperators<float, float, float>.operator %(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IMultiplyOperators<float, float, float>.operator *(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Abs(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Clamp(float value, float min, float max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (float Quotient, float Remainder) INumber<float>.DivRem(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Max(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Min(float x, float y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float INumber<float>.Sign(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<float>.TryCreate<TOther>(TOther value, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<float>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<float>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IParseable<float>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<float>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float ISignedNumber<float>.NegativeOne { get; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float ISpanParseable<float>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<float>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out float result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float ISubtractionOperators<float, float, float>.operator -(float left, float right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IUnaryNegationOperators<float, float>.operator -(float value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static float IUnaryPlusOperators<float, float>.operator +(float value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public readonly ref partial struct Span<T>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
[System.CLSCompliantAttribute(false)]
public unsafe Span(void* pointer, int length) { throw null; }
public Span(T[]? array) { throw null; }
public Span(T[]? array, int start, int length) { throw null; }
public static System.Span<T> Empty { get { throw null; } }
public bool IsEmpty { get { throw null; } }
public ref T this[int index] { get { throw null; } }
public int Length { get { throw null; } }
public void Clear() { }
public void CopyTo(System.Span<T> destination) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Equals() on Span will always throw an exception. Use the equality operator instead.")]
public override bool Equals(object? obj) { throw null; }
public void Fill(T value) { }
public System.Span<T>.Enumerator GetEnumerator() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("GetHashCode() on Span will always throw an exception.")]
public override int GetHashCode() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public ref T GetPinnableReference() { throw null; }
public static bool operator ==(System.Span<T> left, System.Span<T> right) { throw null; }
public static implicit operator System.Span<T> (System.ArraySegment<T> segment) { throw null; }
public static implicit operator System.ReadOnlySpan<T> (System.Span<T> span) { throw null; }
public static implicit operator System.Span<T> (T[]? array) { throw null; }
public static bool operator !=(System.Span<T> left, System.Span<T> right) { throw null; }
public System.Span<T> Slice(int start) { throw null; }
public System.Span<T> Slice(int start, int length) { throw null; }
public T[] ToArray() { throw null; }
public override string ToString() { throw null; }
public bool TryCopyTo(System.Span<T> destination) { throw null; }
public ref partial struct Enumerator
{
private object _dummy;
private int _dummyPrimitive;
public ref T Current { get { throw null; } }
public bool MoveNext() { throw null; }
}
}
public sealed partial class StackOverflowException : System.SystemException
{
public StackOverflowException() { }
public StackOverflowException(string? message) { }
public StackOverflowException(string? message, System.Exception? innerException) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method)]
public sealed partial class STAThreadAttribute : System.Attribute
{
public STAThreadAttribute() { }
}
public sealed partial class String : System.Collections.Generic.IEnumerable<char>, System.Collections.IEnumerable, System.ICloneable, System.IComparable, System.IComparable<string?>, System.IConvertible, System.IEquatable<string?>
{
public static readonly string Empty;
[System.CLSCompliantAttribute(false)]
public unsafe String(char* value) { }
[System.CLSCompliantAttribute(false)]
public unsafe String(char* value, int startIndex, int length) { }
public String(char c, int count) { }
public String(char[]? value) { }
public String(char[] value, int startIndex, int length) { }
public String(System.ReadOnlySpan<char> value) { }
[System.CLSCompliantAttribute(false)]
public unsafe String(sbyte* value) { }
[System.CLSCompliantAttribute(false)]
public unsafe String(sbyte* value, int startIndex, int length) { }
[System.CLSCompliantAttribute(false)]
public unsafe String(sbyte* value, int startIndex, int length, System.Text.Encoding enc) { }
[System.Runtime.CompilerServices.IndexerName("Chars")]
public char this[int index] { get { throw null; } }
public int Length { get { throw null; } }
public object Clone() { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length) { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length, bool ignoreCase) { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length, System.Globalization.CultureInfo? culture, System.Globalization.CompareOptions options) { throw null; }
public static int Compare(System.String? strA, int indexA, System.String? strB, int indexB, int length, System.StringComparison comparisonType) { throw null; }
public static int Compare(System.String? strA, System.String? strB) { throw null; }
public static int Compare(System.String? strA, System.String? strB, bool ignoreCase) { throw null; }
public static int Compare(System.String? strA, System.String? strB, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public static int Compare(System.String? strA, System.String? strB, System.Globalization.CultureInfo? culture, System.Globalization.CompareOptions options) { throw null; }
public static int Compare(System.String? strA, System.String? strB, System.StringComparison comparisonType) { throw null; }
public static int CompareOrdinal(System.String? strA, int indexA, System.String? strB, int indexB, int length) { throw null; }
public static int CompareOrdinal(System.String? strA, System.String? strB) { throw null; }
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.String? strB) { throw null; }
public static System.String Concat(System.Collections.Generic.IEnumerable<string?> values) { throw null; }
public static System.String Concat(object? arg0) { throw null; }
public static System.String Concat(object? arg0, object? arg1) { throw null; }
public static System.String Concat(object? arg0, object? arg1, object? arg2) { throw null; }
public static System.String Concat(params object?[] args) { throw null; }
public static System.String Concat(System.ReadOnlySpan<char> str0, System.ReadOnlySpan<char> str1) { throw null; }
public static System.String Concat(System.ReadOnlySpan<char> str0, System.ReadOnlySpan<char> str1, System.ReadOnlySpan<char> str2) { throw null; }
public static System.String Concat(System.ReadOnlySpan<char> str0, System.ReadOnlySpan<char> str1, System.ReadOnlySpan<char> str2, System.ReadOnlySpan<char> str3) { throw null; }
public static System.String Concat(System.String? str0, System.String? str1) { throw null; }
public static System.String Concat(System.String? str0, System.String? str1, System.String? str2) { throw null; }
public static System.String Concat(System.String? str0, System.String? str1, System.String? str2, System.String? str3) { throw null; }
public static System.String Concat(params string?[] values) { throw null; }
public static System.String Concat<T>(System.Collections.Generic.IEnumerable<T> values) { throw null; }
public bool Contains(char value) { throw null; }
public bool Contains(char value, System.StringComparison comparisonType) { throw null; }
public bool Contains(System.String value) { throw null; }
public bool Contains(System.String value, System.StringComparison comparisonType) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This API should not be used to create mutable strings. See https://go.microsoft.com/fwlink/?linkid=2084035 for alternatives.")]
public static System.String Copy(System.String str) { throw null; }
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { }
public void CopyTo(System.Span<char> destination) { }
public static System.String Create(System.IFormatProvider? provider, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("provider")] ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler handler) { throw null; }
public static System.String Create(System.IFormatProvider? provider, System.Span<char> initialBuffer, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute(new string[]{ "provider", "initialBuffer"})] ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler handler) { throw null; }
public static System.String Create<TState>(int length, TState state, System.Buffers.SpanAction<char, TState> action) { throw null; }
public bool EndsWith(char value) { throw null; }
public bool EndsWith(System.String value) { throw null; }
public bool EndsWith(System.String value, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public bool EndsWith(System.String value, System.StringComparison comparisonType) { throw null; }
public System.Text.StringRuneEnumerator EnumerateRunes() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.String? value) { throw null; }
public static bool Equals(System.String? a, System.String? b) { throw null; }
public static bool Equals(System.String? a, System.String? b, System.StringComparison comparisonType) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.String? value, System.StringComparison comparisonType) { throw null; }
public static System.String Format(System.IFormatProvider? provider, System.String format, object? arg0) { throw null; }
public static System.String Format(System.IFormatProvider? provider, System.String format, object? arg0, object? arg1) { throw null; }
public static System.String Format(System.IFormatProvider? provider, System.String format, object? arg0, object? arg1, object? arg2) { throw null; }
public static System.String Format(System.IFormatProvider? provider, System.String format, params object?[] args) { throw null; }
public static System.String Format(System.String format, object? arg0) { throw null; }
public static System.String Format(System.String format, object? arg0, object? arg1) { throw null; }
public static System.String Format(System.String format, object? arg0, object? arg1, object? arg2) { throw null; }
public static System.String Format(System.String format, params object?[] args) { throw null; }
public System.CharEnumerator GetEnumerator() { throw null; }
public override int GetHashCode() { throw null; }
public static int GetHashCode(System.ReadOnlySpan<char> value) { throw null; }
public static int GetHashCode(System.ReadOnlySpan<char> value, System.StringComparison comparisonType) { throw null; }
public int GetHashCode(System.StringComparison comparisonType) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public ref readonly char GetPinnableReference() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public int IndexOf(char value) { throw null; }
public int IndexOf(char value, int startIndex) { throw null; }
public int IndexOf(char value, int startIndex, int count) { throw null; }
public int IndexOf(char value, System.StringComparison comparisonType) { throw null; }
public int IndexOf(System.String value) { throw null; }
public int IndexOf(System.String value, int startIndex) { throw null; }
public int IndexOf(System.String value, int startIndex, int count) { throw null; }
public int IndexOf(System.String value, int startIndex, int count, System.StringComparison comparisonType) { throw null; }
public int IndexOf(System.String value, int startIndex, System.StringComparison comparisonType) { throw null; }
public int IndexOf(System.String value, System.StringComparison comparisonType) { throw null; }
public int IndexOfAny(char[] anyOf) { throw null; }
public int IndexOfAny(char[] anyOf, int startIndex) { throw null; }
public int IndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
public System.String Insert(int startIndex, System.String value) { throw null; }
public static System.String Intern(System.String str) { throw null; }
public static System.String? IsInterned(System.String str) { throw null; }
public bool IsNormalized() { throw null; }
public bool IsNormalized(System.Text.NormalizationForm normalizationForm) { throw null; }
public static bool IsNullOrEmpty([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(false)] System.String? value) { throw null; }
public static bool IsNullOrWhiteSpace([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(false)] System.String? value) { throw null; }
public static System.String Join(char separator, params object?[] values) { throw null; }
public static System.String Join(char separator, params string?[] value) { throw null; }
public static System.String Join(char separator, string?[] value, int startIndex, int count) { throw null; }
public static System.String Join(System.String? separator, System.Collections.Generic.IEnumerable<string?> values) { throw null; }
public static System.String Join(System.String? separator, params object?[] values) { throw null; }
public static System.String Join(System.String? separator, params string?[] value) { throw null; }
public static System.String Join(System.String? separator, string?[] value, int startIndex, int count) { throw null; }
public static System.String Join<T>(char separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
public static System.String Join<T>(System.String? separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
public int LastIndexOf(char value) { throw null; }
public int LastIndexOf(char value, int startIndex) { throw null; }
public int LastIndexOf(char value, int startIndex, int count) { throw null; }
public int LastIndexOf(System.String value) { throw null; }
public int LastIndexOf(System.String value, int startIndex) { throw null; }
public int LastIndexOf(System.String value, int startIndex, int count) { throw null; }
public int LastIndexOf(System.String value, int startIndex, int count, System.StringComparison comparisonType) { throw null; }
public int LastIndexOf(System.String value, int startIndex, System.StringComparison comparisonType) { throw null; }
public int LastIndexOf(System.String value, System.StringComparison comparisonType) { throw null; }
public int LastIndexOfAny(char[] anyOf) { throw null; }
public int LastIndexOfAny(char[] anyOf, int startIndex) { throw null; }
public int LastIndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
public System.String Normalize() { throw null; }
public System.String Normalize(System.Text.NormalizationForm normalizationForm) { throw null; }
public static bool operator ==(System.String? a, System.String? b) { throw null; }
public static implicit operator System.ReadOnlySpan<char> (System.String? value) { throw null; }
public static bool operator !=(System.String? a, System.String? b) { throw null; }
public System.String PadLeft(int totalWidth) { throw null; }
public System.String PadLeft(int totalWidth, char paddingChar) { throw null; }
public System.String PadRight(int totalWidth) { throw null; }
public System.String PadRight(int totalWidth, char paddingChar) { throw null; }
public System.String Remove(int startIndex) { throw null; }
public System.String Remove(int startIndex, int count) { throw null; }
public System.String Replace(char oldChar, char newChar) { throw null; }
public System.String Replace(System.String oldValue, System.String? newValue) { throw null; }
public System.String Replace(System.String oldValue, System.String? newValue, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public System.String Replace(System.String oldValue, System.String? newValue, System.StringComparison comparisonType) { throw null; }
public System.String ReplaceLineEndings() { throw null; }
public System.String ReplaceLineEndings(System.String replacementText) { throw null; }
public string[] Split(char separator, int count, System.StringSplitOptions options = System.StringSplitOptions.None) { throw null; }
public string[] Split(char separator, System.StringSplitOptions options = System.StringSplitOptions.None) { throw null; }
public string[] Split(params char[]? separator) { throw null; }
public string[] Split(char[]? separator, int count) { throw null; }
public string[] Split(char[]? separator, int count, System.StringSplitOptions options) { throw null; }
public string[] Split(char[]? separator, System.StringSplitOptions options) { throw null; }
public string[] Split(System.String? separator, int count, System.StringSplitOptions options = System.StringSplitOptions.None) { throw null; }
public string[] Split(System.String? separator, System.StringSplitOptions options = System.StringSplitOptions.None) { throw null; }
public string[] Split(string[]? separator, int count, System.StringSplitOptions options) { throw null; }
public string[] Split(string[]? separator, System.StringSplitOptions options) { throw null; }
public bool StartsWith(char value) { throw null; }
public bool StartsWith(System.String value) { throw null; }
public bool StartsWith(System.String value, bool ignoreCase, System.Globalization.CultureInfo? culture) { throw null; }
public bool StartsWith(System.String value, System.StringComparison comparisonType) { throw null; }
public System.String Substring(int startIndex) { throw null; }
public System.String Substring(int startIndex, int length) { throw null; }
System.Collections.Generic.IEnumerator<char> System.Collections.Generic.IEnumerable<char>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public char[] ToCharArray() { throw null; }
public char[] ToCharArray(int startIndex, int length) { throw null; }
public System.String ToLower() { throw null; }
public System.String ToLower(System.Globalization.CultureInfo? culture) { throw null; }
public System.String ToLowerInvariant() { throw null; }
public override System.String ToString() { throw null; }
public System.String ToString(System.IFormatProvider? provider) { throw null; }
public System.String ToUpper() { throw null; }
public System.String ToUpper(System.Globalization.CultureInfo? culture) { throw null; }
public System.String ToUpperInvariant() { throw null; }
public System.String Trim() { throw null; }
public System.String Trim(char trimChar) { throw null; }
public System.String Trim(params char[]? trimChars) { throw null; }
public System.String TrimEnd() { throw null; }
public System.String TrimEnd(char trimChar) { throw null; }
public System.String TrimEnd(params char[]? trimChars) { throw null; }
public System.String TrimStart() { throw null; }
public System.String TrimStart(char trimChar) { throw null; }
public System.String TrimStart(params char[]? trimChars) { throw null; }
public bool TryCopyTo(System.Span<char> destination) { throw null; }
}
public abstract partial class StringComparer : System.Collections.Generic.IComparer<string?>, System.Collections.Generic.IEqualityComparer<string?>, System.Collections.IComparer, System.Collections.IEqualityComparer
{
protected StringComparer() { }
public static System.StringComparer CurrentCulture { get { throw null; } }
public static System.StringComparer CurrentCultureIgnoreCase { get { throw null; } }
public static System.StringComparer InvariantCulture { get { throw null; } }
public static System.StringComparer InvariantCultureIgnoreCase { get { throw null; } }
public static System.StringComparer Ordinal { get { throw null; } }
public static System.StringComparer OrdinalIgnoreCase { get { throw null; } }
public int Compare(object? x, object? y) { throw null; }
public abstract int Compare(string? x, string? y);
public static System.StringComparer Create(System.Globalization.CultureInfo culture, bool ignoreCase) { throw null; }
public static System.StringComparer Create(System.Globalization.CultureInfo culture, System.Globalization.CompareOptions options) { throw null; }
public new bool Equals(object? x, object? y) { throw null; }
public abstract bool Equals(string? x, string? y);
public static System.StringComparer FromComparison(System.StringComparison comparisonType) { throw null; }
public int GetHashCode(object obj) { throw null; }
public abstract int GetHashCode(string obj);
public static bool IsWellKnownCultureAwareComparer(System.Collections.Generic.IEqualityComparer<string?>? comparer, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Globalization.CompareInfo? compareInfo, out System.Globalization.CompareOptions compareOptions) { throw null; }
public static bool IsWellKnownOrdinalComparer(System.Collections.Generic.IEqualityComparer<string?>? comparer, out bool ignoreCase) { throw null; }
}
public enum StringComparison
{
CurrentCulture = 0,
CurrentCultureIgnoreCase = 1,
InvariantCulture = 2,
InvariantCultureIgnoreCase = 3,
Ordinal = 4,
OrdinalIgnoreCase = 5,
}
public static partial class StringNormalizationExtensions
{
public static bool IsNormalized(this string strInput) { throw null; }
public static bool IsNormalized(this string strInput, System.Text.NormalizationForm normalizationForm) { throw null; }
public static string Normalize(this string strInput) { throw null; }
public static string Normalize(this string strInput, System.Text.NormalizationForm normalizationForm) { throw null; }
}
[System.FlagsAttribute]
public enum StringSplitOptions
{
None = 0,
RemoveEmptyEntries = 1,
TrimEntries = 2,
}
public partial class SystemException : System.Exception
{
public SystemException() { }
protected SystemException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public SystemException(string? message) { }
public SystemException(string? message, System.Exception? innerException) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public partial class ThreadStaticAttribute : System.Attribute
{
public ThreadStaticAttribute() { }
}
public readonly partial struct TimeOnly : System.IComparable, System.IComparable<System.TimeOnly>, System.IEquatable<System.TimeOnly>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IComparisonOperators<System.TimeOnly, System.TimeOnly>,
System.IMinMaxValue<System.TimeOnly>,
System.ISpanParseable<System.TimeOnly>,
System.ISubtractionOperators<System.TimeOnly, System.TimeOnly, System.TimeSpan>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
public static System.TimeOnly MinValue { get { throw null; } }
public static System.TimeOnly MaxValue { get { throw null; } }
public TimeOnly(int hour, int minute) { throw null; }
public TimeOnly(int hour, int minute, int second) { throw null; }
public TimeOnly(int hour, int minute, int second, int millisecond) { throw null; }
public TimeOnly(long ticks) { throw null; }
public int Hour { get { throw null; } }
public int Minute { get { throw null; } }
public int Second { get { throw null; } }
public int Millisecond { get { throw null; } }
public long Ticks { get { throw null; } }
public System.TimeOnly Add(System.TimeSpan value) { throw null; }
public System.TimeOnly Add(System.TimeSpan value, out int wrappedDays) { throw null; }
public System.TimeOnly AddHours(double value) { throw null; }
public System.TimeOnly AddHours(double value, out int wrappedDays) { throw null; }
public System.TimeOnly AddMinutes(double value) { throw null; }
public System.TimeOnly AddMinutes(double value, out int wrappedDays) { throw null; }
public bool IsBetween(System.TimeOnly start, System.TimeOnly end) { throw null; }
public static bool operator ==(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator >(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator >=(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator !=(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator <(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static bool operator <=(System.TimeOnly left, System.TimeOnly right) { throw null; }
public static System.TimeSpan operator -(System.TimeOnly t1, System.TimeOnly t2) { throw null; }
public static System.TimeOnly FromTimeSpan(System.TimeSpan timeSpan) { throw null; }
public static System.TimeOnly FromDateTime(System.DateTime dateTime) { throw null; }
public System.TimeSpan ToTimeSpan() { throw null; }
public int CompareTo(System.TimeOnly value) { throw null; }
public int CompareTo(object? value) { throw null; }
public bool Equals(System.TimeOnly value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static System.TimeOnly Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly ParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, System.IFormatProvider? provider = default, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly ParseExact(System.ReadOnlySpan<char> s, string[] formats) { throw null; }
public static System.TimeOnly ParseExact(System.ReadOnlySpan<char> s, string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly Parse(string s) { throw null; }
public static System.TimeOnly Parse(string s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly ParseExact(string s, string format) { throw null; }
public static System.TimeOnly ParseExact(string s, string format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static System.TimeOnly ParseExact(string s, string[] formats) { throw null; }
public static System.TimeOnly ParseExact(string s, string[] formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style = System.Globalization.DateTimeStyles.None) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.TimeOnly result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, out System.TimeOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, System.ReadOnlySpan<char> format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.TimeOnly result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.TimeOnly result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, out System.TimeOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, out System.TimeOnly result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? provider, System.Globalization.DateTimeStyles style, out System.TimeOnly result) { throw null; }
public string ToLongTimeString() { throw null; }
public string ToShortTimeString() { throw null; }
public override string ToString() { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeOnly, System.TimeOnly>.operator <(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeOnly, System.TimeOnly>.operator <=(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeOnly, System.TimeOnly>.operator >(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeOnly, System.TimeOnly>.operator >=(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.TimeOnly, System.TimeOnly>.operator ==(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.TimeOnly, System.TimeOnly>.operator !=(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeOnly IParseable<System.TimeOnly>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.TimeOnly>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.TimeOnly result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeOnly ISpanParseable<System.TimeOnly>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.TimeOnly>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.TimeOnly result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISubtractionOperators<System.TimeOnly, System.TimeOnly, System.TimeSpan>.operator -(System.TimeOnly left, System.TimeOnly right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeOnly IMinMaxValue<System.TimeOnly>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeOnly IMinMaxValue<System.TimeOnly>.MaxValue { get { throw null; } }
#endif // FEATURE_GENERIC_MATH
}
public partial class TimeoutException : System.SystemException
{
public TimeoutException() { }
protected TimeoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TimeoutException(string? message) { }
public TimeoutException(string? message, System.Exception? innerException) { }
}
public readonly partial struct TimeSpan : System.IComparable, System.IComparable<System.TimeSpan>, System.IEquatable<System.TimeSpan>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IAdditionOperators<System.TimeSpan, System.TimeSpan, System.TimeSpan>,
System.IAdditiveIdentity<System.TimeSpan, System.TimeSpan>,
System.IComparisonOperators<System.TimeSpan, System.TimeSpan>,
System.IDivisionOperators<System.TimeSpan, double, System.TimeSpan>,
System.IDivisionOperators<System.TimeSpan, System.TimeSpan, double>,
System.IMinMaxValue<System.TimeSpan>,
System.IMultiplyOperators<System.TimeSpan, double, System.TimeSpan>,
System.IMultiplicativeIdentity<System.TimeSpan, double>,
System.ISpanParseable<System.TimeSpan>,
System.ISubtractionOperators<System.TimeSpan, System.TimeSpan, System.TimeSpan>,
System.IUnaryNegationOperators<System.TimeSpan, System.TimeSpan>,
System.IUnaryPlusOperators<System.TimeSpan, System.TimeSpan>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.TimeSpan MaxValue;
public static readonly System.TimeSpan MinValue;
public const long TicksPerDay = (long)864000000000;
public const long TicksPerHour = (long)36000000000;
public const long TicksPerMillisecond = (long)10000;
public const long TicksPerMinute = (long)600000000;
public const long TicksPerSecond = (long)10000000;
public static readonly System.TimeSpan Zero;
public TimeSpan(int hours, int minutes, int seconds) { throw null; }
public TimeSpan(int days, int hours, int minutes, int seconds) { throw null; }
public TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds) { throw null; }
public TimeSpan(long ticks) { throw null; }
public int Days { get { throw null; } }
public int Hours { get { throw null; } }
public int Milliseconds { get { throw null; } }
public int Minutes { get { throw null; } }
public int Seconds { get { throw null; } }
public long Ticks { get { throw null; } }
public double TotalDays { get { throw null; } }
public double TotalHours { get { throw null; } }
public double TotalMilliseconds { get { throw null; } }
public double TotalMinutes { get { throw null; } }
public double TotalSeconds { get { throw null; } }
public System.TimeSpan Add(System.TimeSpan ts) { throw null; }
public static int Compare(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.TimeSpan value) { throw null; }
public System.TimeSpan Divide(double divisor) { throw null; }
public double Divide(System.TimeSpan ts) { throw null; }
public System.TimeSpan Duration() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public bool Equals(System.TimeSpan obj) { throw null; }
public static bool Equals(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static System.TimeSpan FromDays(double value) { throw null; }
public static System.TimeSpan FromHours(double value) { throw null; }
public static System.TimeSpan FromMilliseconds(double value) { throw null; }
public static System.TimeSpan FromMinutes(double value) { throw null; }
public static System.TimeSpan FromSeconds(double value) { throw null; }
public static System.TimeSpan FromTicks(long value) { throw null; }
public override int GetHashCode() { throw null; }
public System.TimeSpan Multiply(double factor) { throw null; }
public System.TimeSpan Negate() { throw null; }
public static System.TimeSpan operator +(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static System.TimeSpan operator /(System.TimeSpan timeSpan, double divisor) { throw null; }
public static double operator /(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator ==(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator >(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator >=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator !=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator <(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static bool operator <=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static System.TimeSpan operator *(double factor, System.TimeSpan timeSpan) { throw null; }
public static System.TimeSpan operator *(System.TimeSpan timeSpan, double factor) { throw null; }
public static System.TimeSpan operator -(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
public static System.TimeSpan operator -(System.TimeSpan t) { throw null; }
public static System.TimeSpan operator +(System.TimeSpan t) { throw null; }
public static System.TimeSpan Parse(System.ReadOnlySpan<char> input, System.IFormatProvider? formatProvider = null) { throw null; }
public static System.TimeSpan Parse(string s) { throw null; }
public static System.TimeSpan Parse(string input, System.IFormatProvider? formatProvider) { throw null; }
public static System.TimeSpan ParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles = System.Globalization.TimeSpanStyles.None) { throw null; }
public static System.TimeSpan ParseExact(System.ReadOnlySpan<char> input, string[] formats, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles = System.Globalization.TimeSpanStyles.None) { throw null; }
public static System.TimeSpan ParseExact(string input, string format, System.IFormatProvider? formatProvider) { throw null; }
public static System.TimeSpan ParseExact(string input, string format, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles) { throw null; }
public static System.TimeSpan ParseExact(string input, string[] formats, System.IFormatProvider? formatProvider) { throw null; }
public static System.TimeSpan ParseExact(string input, string[] formats, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles) { throw null; }
public System.TimeSpan Subtract(System.TimeSpan ts) { throw null; }
public override string ToString() { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? formatProvider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? formatProvider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.TimeSpan result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.TimeSpan result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, System.ReadOnlySpan<char> format, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { throw null; }
public static bool TryParseExact(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? format, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { throw null; }
public static bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string?[]? formats, System.IFormatProvider? formatProvider, out System.TimeSpan result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IAdditiveIdentity<System.TimeSpan, System.TimeSpan>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IMinMaxValue<System.TimeSpan>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IMinMaxValue<System.TimeSpan>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IMultiplicativeIdentity<System.TimeSpan, double>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IAdditionOperators<System.TimeSpan, System.TimeSpan, System.TimeSpan>.operator +(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeSpan, System.TimeSpan>.operator <(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeSpan, System.TimeSpan>.operator <=(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeSpan, System.TimeSpan>.operator >(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<System.TimeSpan, System.TimeSpan>.operator >=(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IDivisionOperators<System.TimeSpan, double, System.TimeSpan>.operator /(System.TimeSpan left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static double IDivisionOperators<System.TimeSpan, System.TimeSpan, double>.operator /(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.TimeSpan, System.TimeSpan>.operator ==(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<System.TimeSpan, System.TimeSpan>.operator !=(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IMultiplyOperators<System.TimeSpan, double, System.TimeSpan>.operator *(System.TimeSpan left, double right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IParseable<System.TimeSpan>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<System.TimeSpan>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out System.TimeSpan result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISpanParseable<System.TimeSpan>.Parse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<System.TimeSpan>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out System.TimeSpan result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan ISubtractionOperators<System.TimeSpan, System.TimeSpan, System.TimeSpan>.operator -(System.TimeSpan left, System.TimeSpan right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IUnaryNegationOperators<System.TimeSpan, System.TimeSpan>.operator -(System.TimeSpan value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static System.TimeSpan IUnaryPlusOperators<System.TimeSpan, System.TimeSpan>.operator +(System.TimeSpan value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.ObsoleteAttribute("System.TimeZone has been deprecated. Investigate the use of System.TimeZoneInfo instead.")]
public abstract partial class TimeZone
{
protected TimeZone() { }
public static System.TimeZone CurrentTimeZone { get { throw null; } }
public abstract string DaylightName { get; }
public abstract string StandardName { get; }
public abstract System.Globalization.DaylightTime GetDaylightChanges(int year);
public abstract System.TimeSpan GetUtcOffset(System.DateTime time);
public virtual bool IsDaylightSavingTime(System.DateTime time) { throw null; }
public static bool IsDaylightSavingTime(System.DateTime time, System.Globalization.DaylightTime daylightTimes) { throw null; }
public virtual System.DateTime ToLocalTime(System.DateTime time) { throw null; }
public virtual System.DateTime ToUniversalTime(System.DateTime time) { throw null; }
}
public sealed partial class TimeZoneInfo : System.IEquatable<System.TimeZoneInfo?>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
internal TimeZoneInfo() { }
public System.TimeSpan BaseUtcOffset { get { throw null; } }
public string DaylightName { get { throw null; } }
public string DisplayName { get { throw null; } }
public bool HasIanaId { get { throw null; } }
public string Id { get { throw null; } }
public static System.TimeZoneInfo Local { get { throw null; } }
public string StandardName { get { throw null; } }
public bool SupportsDaylightSavingTime { get { throw null; } }
public static System.TimeZoneInfo Utc { get { throw null; } }
public static void ClearCachedData() { }
public static System.DateTime ConvertTime(System.DateTime dateTime, System.TimeZoneInfo destinationTimeZone) { throw null; }
public static System.DateTime ConvertTime(System.DateTime dateTime, System.TimeZoneInfo sourceTimeZone, System.TimeZoneInfo destinationTimeZone) { throw null; }
public static System.DateTimeOffset ConvertTime(System.DateTimeOffset dateTimeOffset, System.TimeZoneInfo destinationTimeZone) { throw null; }
public static System.DateTime ConvertTimeBySystemTimeZoneId(System.DateTime dateTime, string destinationTimeZoneId) { throw null; }
public static System.DateTime ConvertTimeBySystemTimeZoneId(System.DateTime dateTime, string sourceTimeZoneId, string destinationTimeZoneId) { throw null; }
public static System.DateTimeOffset ConvertTimeBySystemTimeZoneId(System.DateTimeOffset dateTimeOffset, string destinationTimeZoneId) { throw null; }
public static System.DateTime ConvertTimeFromUtc(System.DateTime dateTime, System.TimeZoneInfo destinationTimeZone) { throw null; }
public static System.DateTime ConvertTimeToUtc(System.DateTime dateTime) { throw null; }
public static System.DateTime ConvertTimeToUtc(System.DateTime dateTime, System.TimeZoneInfo sourceTimeZone) { throw null; }
public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string? displayName, string? standardDisplayName) { throw null; }
public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string? displayName, string? standardDisplayName, string? daylightDisplayName, System.TimeZoneInfo.AdjustmentRule[]? adjustmentRules) { throw null; }
public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string? displayName, string? standardDisplayName, string? daylightDisplayName, System.TimeZoneInfo.AdjustmentRule[]? adjustmentRules, bool disableDaylightSavingTime) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.TimeZoneInfo? other) { throw null; }
public static System.TimeZoneInfo FindSystemTimeZoneById(string id) { throw null; }
public static System.TimeZoneInfo FromSerializedString(string source) { throw null; }
public System.TimeZoneInfo.AdjustmentRule[] GetAdjustmentRules() { throw null; }
public System.TimeSpan[] GetAmbiguousTimeOffsets(System.DateTime dateTime) { throw null; }
public System.TimeSpan[] GetAmbiguousTimeOffsets(System.DateTimeOffset dateTimeOffset) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Collections.ObjectModel.ReadOnlyCollection<System.TimeZoneInfo> GetSystemTimeZones() { throw null; }
public System.TimeSpan GetUtcOffset(System.DateTime dateTime) { throw null; }
public System.TimeSpan GetUtcOffset(System.DateTimeOffset dateTimeOffset) { throw null; }
public bool HasSameRules(System.TimeZoneInfo other) { throw null; }
public bool IsAmbiguousTime(System.DateTime dateTime) { throw null; }
public bool IsAmbiguousTime(System.DateTimeOffset dateTimeOffset) { throw null; }
public bool IsDaylightSavingTime(System.DateTime dateTime) { throw null; }
public bool IsDaylightSavingTime(System.DateTimeOffset dateTimeOffset) { throw null; }
public bool IsInvalidTime(System.DateTime dateTime) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public string ToSerializedString() { throw null; }
public override string ToString() { throw null; }
public static bool TryConvertIanaIdToWindowsId(string ianaId, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? windowsId) { throw null; }
public static bool TryConvertWindowsIdToIanaId(string windowsId, string? region, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? ianaId) { throw null; }
public static bool TryConvertWindowsIdToIanaId(string windowsId, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? ianaId) { throw null; }
public sealed partial class AdjustmentRule : System.IEquatable<System.TimeZoneInfo.AdjustmentRule?>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
internal AdjustmentRule() { }
public System.TimeSpan BaseUtcOffsetDelta { get { throw null; } }
public System.DateTime DateEnd { get { throw null; } }
public System.DateTime DateStart { get { throw null; } }
public System.TimeSpan DaylightDelta { get { throw null; } }
public System.TimeZoneInfo.TransitionTime DaylightTransitionEnd { get { throw null; } }
public System.TimeZoneInfo.TransitionTime DaylightTransitionStart { get { throw null; } }
public static System.TimeZoneInfo.AdjustmentRule CreateAdjustmentRule(System.DateTime dateStart, System.DateTime dateEnd, System.TimeSpan daylightDelta, System.TimeZoneInfo.TransitionTime daylightTransitionStart, System.TimeZoneInfo.TransitionTime daylightTransitionEnd) { throw null; }
public static System.TimeZoneInfo.AdjustmentRule CreateAdjustmentRule(System.DateTime dateStart, System.DateTime dateEnd, System.TimeSpan daylightDelta, System.TimeZoneInfo.TransitionTime daylightTransitionStart, System.TimeZoneInfo.TransitionTime daylightTransitionEnd, System.TimeSpan baseUtcOffsetDelta) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.TimeZoneInfo.AdjustmentRule? other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public readonly partial struct TransitionTime : System.IEquatable<System.TimeZoneInfo.TransitionTime>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
private readonly int _dummyPrimitive;
public int Day { get { throw null; } }
public System.DayOfWeek DayOfWeek { get { throw null; } }
public bool IsFixedDateRule { get { throw null; } }
public int Month { get { throw null; } }
public System.DateTime TimeOfDay { get { throw null; } }
public int Week { get { throw null; } }
public static System.TimeZoneInfo.TransitionTime CreateFixedDateRule(System.DateTime timeOfDay, int month, int day) { throw null; }
public static System.TimeZoneInfo.TransitionTime CreateFloatingDateRule(System.DateTime timeOfDay, int month, int week, System.DayOfWeek dayOfWeek) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.TimeZoneInfo.TransitionTime other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.TimeZoneInfo.TransitionTime t1, System.TimeZoneInfo.TransitionTime t2) { throw null; }
public static bool operator !=(System.TimeZoneInfo.TransitionTime t1, System.TimeZoneInfo.TransitionTime t2) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
}
public partial class TimeZoneNotFoundException : System.Exception
{
public TimeZoneNotFoundException() { }
protected TimeZoneNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TimeZoneNotFoundException(string? message) { }
public TimeZoneNotFoundException(string? message, System.Exception? innerException) { }
}
public static partial class Tuple
{
public static System.Tuple<T1> Create<T1>(T1 item1) { throw null; }
public static System.Tuple<T1, T2> Create<T1, T2>(T1 item1, T2 item2) { throw null; }
public static System.Tuple<T1, T2, T3> Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3) { throw null; }
public static System.Tuple<T1, T2, T3, T4> Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5> Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6> Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7> Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) { throw null; }
}
public static partial class TupleExtensions
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1>(this System.Tuple<T1> value, out T1 item1) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2>(this System.Tuple<T1, T2> value, out T1 item1, out T2 item2) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19, out T20 item20) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20, T21>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19, out T20 item20, out T21 item21) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3>(this System.Tuple<T1, T2, T3> value, out T1 item1, out T2 item2, out T3 item3) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4>(this System.Tuple<T1, T2, T3, T4> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5>(this System.Tuple<T1, T2, T3, T4, T5> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6>(this System.Tuple<T1, T2, T3, T4, T5, T6> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9) { throw null; }
public static System.Tuple<T1> ToTuple<T1>(this System.ValueTuple<T1> value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) value) { throw null; }
public static System.Tuple<T1, T2> ToTuple<T1, T2>(this (T1, T2) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20, T21>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) value) { throw null; }
public static System.Tuple<T1, T2, T3> ToTuple<T1, T2, T3>(this (T1, T2, T3) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4> ToTuple<T1, T2, T3, T4>(this (T1, T2, T3, T4) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5> ToTuple<T1, T2, T3, T4, T5>(this (T1, T2, T3, T4, T5) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6> ToTuple<T1, T2, T3, T4, T5, T6>(this (T1, T2, T3, T4, T5, T6) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7> ToTuple<T1, T2, T3, T4, T5, T6, T7>(this (T1, T2, T3, T4, T5, T6, T7) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8>(this (T1, T2, T3, T4, T5, T6, T7, T8) value) { throw null; }
public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9) value) { throw null; }
public static System.ValueTuple<T1> ToValueTuple<T1>(this System.Tuple<T1> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19>>> value) { throw null; }
public static (T1, T2) ToValueTuple<T1, T2>(this System.Tuple<T1, T2> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20>>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9, T10, T11, T12, T13, T14, System.Tuple<T15, T16, T17, T18, T19, T20, T21>>> value) { throw null; }
public static (T1, T2, T3) ToValueTuple<T1, T2, T3>(this System.Tuple<T1, T2, T3> value) { throw null; }
public static (T1, T2, T3, T4) ToValueTuple<T1, T2, T3, T4>(this System.Tuple<T1, T2, T3, T4> value) { throw null; }
public static (T1, T2, T3, T4, T5) ToValueTuple<T1, T2, T3, T4, T5>(this System.Tuple<T1, T2, T3, T4, T5> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6) ToValueTuple<T1, T2, T3, T4, T5, T6>(this System.Tuple<T1, T2, T3, T4, T5, T6> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7) ToValueTuple<T1, T2, T3, T4, T5, T6, T7>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> value) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8, T9) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8, T9>> value) { throw null; }
}
public partial class Tuple<T1> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1) { }
public T1 Item1 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4, T5> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
public T5 Item5 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4, T5, T6> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
public T5 Item5 { get { throw null; } }
public T6 Item6 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4, T5, T6, T7> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
public T5 Item5 { get { throw null; } }
public T6 Item6 { get { throw null; } }
public T7 Item7 { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public partial class Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.Runtime.CompilerServices.ITuple where TRest : notnull
{
public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) { }
public T1 Item1 { get { throw null; } }
public T2 Item2 { get { throw null; } }
public T3 Item3 { get { throw null; } }
public T4 Item4 { get { throw null; } }
public T5 Item5 { get { throw null; } }
public T6 Item6 { get { throw null; } }
public T7 Item7 { get { throw null; } }
public TRest Rest { get { throw null; } }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
public override string ToString() { throw null; }
}
public abstract partial class Type : System.Reflection.MemberInfo, System.Reflection.IReflect
{
public static readonly char Delimiter;
public static readonly System.Type[] EmptyTypes;
public static readonly System.Reflection.MemberFilter FilterAttribute;
public static readonly System.Reflection.MemberFilter FilterName;
public static readonly System.Reflection.MemberFilter FilterNameIgnoreCase;
public static readonly object Missing;
protected Type() { }
public abstract System.Reflection.Assembly Assembly { get; }
public abstract string? AssemblyQualifiedName { get; }
public System.Reflection.TypeAttributes Attributes { get { throw null; } }
public abstract System.Type? BaseType { get; }
public virtual bool ContainsGenericParameters { get { throw null; } }
public virtual System.Reflection.MethodBase? DeclaringMethod { get { throw null; } }
public override System.Type? DeclaringType { get { throw null; } }
public static System.Reflection.Binder DefaultBinder { get { throw null; } }
public abstract string? FullName { get; }
public virtual System.Reflection.GenericParameterAttributes GenericParameterAttributes { get { throw null; } }
public virtual int GenericParameterPosition { get { throw null; } }
public virtual System.Type[] GenericTypeArguments { get { throw null; } }
public abstract System.Guid GUID { get; }
public bool HasElementType { get { throw null; } }
public bool IsAbstract { get { throw null; } }
public bool IsAnsiClass { get { throw null; } }
public bool IsArray { get { throw null; } }
public bool IsAutoClass { get { throw null; } }
public bool IsAutoLayout { get { throw null; } }
public bool IsByRef { get { throw null; } }
public virtual bool IsByRefLike { get { throw null; } }
public bool IsClass { get { throw null; } }
public bool IsCOMObject { get { throw null; } }
public virtual bool IsConstructedGenericType { get { throw null; } }
public bool IsContextful { get { throw null; } }
public virtual bool IsEnum { get { throw null; } }
public bool IsExplicitLayout { get { throw null; } }
public virtual bool IsGenericMethodParameter { get { throw null; } }
public virtual bool IsGenericParameter { get { throw null; } }
public virtual bool IsGenericType { get { throw null; } }
public virtual bool IsGenericTypeDefinition { get { throw null; } }
public virtual bool IsGenericTypeParameter { get { throw null; } }
public bool IsImport { get { throw null; } }
public bool IsInterface { get { throw null; } }
public bool IsLayoutSequential { get { throw null; } }
public bool IsMarshalByRef { get { throw null; } }
public bool IsNested { get { throw null; } }
public bool IsNestedAssembly { get { throw null; } }
public bool IsNestedFamANDAssem { get { throw null; } }
public bool IsNestedFamily { get { throw null; } }
public bool IsNestedFamORAssem { get { throw null; } }
public bool IsNestedPrivate { get { throw null; } }
public bool IsNestedPublic { get { throw null; } }
public bool IsNotPublic { get { throw null; } }
public bool IsPointer { get { throw null; } }
public bool IsPrimitive { get { throw null; } }
public bool IsPublic { get { throw null; } }
public bool IsSealed { get { throw null; } }
public virtual bool IsSecurityCritical { get { throw null; } }
public virtual bool IsSecuritySafeCritical { get { throw null; } }
public virtual bool IsSecurityTransparent { get { throw null; } }
public virtual bool IsSerializable { get { throw null; } }
public virtual bool IsSignatureType { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public virtual bool IsSZArray { get { throw null; } }
public virtual bool IsTypeDefinition { get { throw null; } }
public bool IsUnicodeClass { get { throw null; } }
public bool IsValueType { get { throw null; } }
public virtual bool IsVariableBoundArray { get { throw null; } }
public bool IsVisible { get { throw null; } }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public abstract new System.Reflection.Module Module { get; }
public abstract string? Namespace { get; }
public override System.Type? ReflectedType { get { throw null; } }
public virtual System.Runtime.InteropServices.StructLayoutAttribute? StructLayoutAttribute { get { throw null; } }
public virtual System.RuntimeTypeHandle TypeHandle { get { throw null; } }
public System.Reflection.ConstructorInfo? TypeInitializer { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] get { throw null; } }
public abstract System.Type UnderlyingSystemType { get; }
public override bool Equals(object? o) { throw null; }
public virtual bool Equals(System.Type? o) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public virtual System.Type[] FindInterfaces(System.Reflection.TypeFilter filter, object? filterCriteria) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public virtual System.Reflection.MemberInfo[] FindMembers(System.Reflection.MemberTypes memberType, System.Reflection.BindingFlags bindingAttr, System.Reflection.MemberFilter? filter, object? filterCriteria) { throw null; }
public virtual int GetArrayRank() { throw null; }
protected abstract System.Reflection.TypeAttributes GetAttributeFlagsImpl();
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo? GetConstructor(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo? GetConstructor(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo? GetConstructor(System.Reflection.BindingFlags bindingAttr, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo? GetConstructor(System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
protected abstract System.Reflection.ConstructorInfo? GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public System.Reflection.ConstructorInfo[] GetConstructors() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public abstract System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public virtual System.Reflection.MemberInfo[] GetDefaultMembers() { throw null; }
public abstract System.Type? GetElementType();
public virtual string? GetEnumName(object value) { throw null; }
public virtual string[] GetEnumNames() { throw null; }
public virtual System.Type GetEnumUnderlyingType() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("It might not be possible to create an array of the enum type at runtime. Use Enum.GetValues<TEnum> instead.")]
public virtual System.Array GetEnumValues() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public System.Reflection.EventInfo? GetEvent(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public abstract System.Reflection.EventInfo? GetEvent(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public virtual System.Reflection.EventInfo[] GetEvents() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public abstract System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public System.Reflection.FieldInfo? GetField(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public abstract System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public System.Reflection.FieldInfo[] GetFields() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public abstract System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr);
public virtual System.Type[] GetGenericArguments() { throw null; }
public virtual System.Type[] GetGenericParameterConstraints() { throw null; }
public virtual System.Type GetGenericTypeDefinition() { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
[return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public System.Type? GetInterface(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
[return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public abstract System.Type? GetInterface(string name, bool ignoreCase);
public virtual System.Reflection.InterfaceMapping GetInterfaceMap([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type interfaceType) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public abstract System.Type[] GetInterfaces();
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.MemberInfo[] GetMember(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public virtual System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public virtual System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.MemberInfo[] GetMembers() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public abstract System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr);
public virtual System.Reflection.MemberInfo GetMemberWithSameMetadataDefinitionAs(System.Reflection.MemberInfo member) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, int genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, int genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, int genericParameterCount, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, int genericParameterCount, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo? GetMethod(string name, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
protected virtual System.Reflection.MethodInfo? GetMethodImpl(string name, int genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
protected abstract System.Reflection.MethodInfo? GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public System.Reflection.MethodInfo[] GetMethods() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public abstract System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public System.Type? GetNestedType(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public abstract System.Type? GetNestedType(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public System.Type[] GetNestedTypes() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public abstract System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo[] GetProperties() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public abstract System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Type? returnType) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Type? returnType, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Type? returnType, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public System.Reflection.PropertyInfo? GetProperty(string name, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
protected abstract System.Reflection.PropertyInfo? GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers);
public new System.Type GetType() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, bool throwOnError) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, bool throwOnError, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver, bool throwOnError) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The type might be removed")]
public static System.Type? GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly?>? assemblyResolver, System.Func<System.Reflection.Assembly?, string, bool, System.Type?>? typeResolver, bool throwOnError, bool ignoreCase) { throw null; }
public static System.Type[] GetTypeArray(object[] args) { throw null; }
public static System.TypeCode GetTypeCode(System.Type? type) { throw null; }
protected virtual System.TypeCode GetTypeCodeImpl() { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, bool throwOnError) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, string? server) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromCLSID(System.Guid clsid, string? server, bool throwOnError) { throw null; }
public static System.Type? GetTypeFromHandle(System.RuntimeTypeHandle handle) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, bool throwOnError) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, string? server) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static System.Type? GetTypeFromProgID(string progID, string? server, bool throwOnError) { throw null; }
public static System.RuntimeTypeHandle GetTypeHandle(object o) { throw null; }
protected abstract bool HasElementTypeImpl();
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args, System.Globalization.CultureInfo? culture) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public abstract object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args, System.Reflection.ParameterModifier[]? modifiers, System.Globalization.CultureInfo? culture, string[]? namedParameters);
protected abstract bool IsArrayImpl();
public virtual bool IsAssignableFrom([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Type? c) { throw null; }
public bool IsAssignableTo([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Type? targetType) { throw null; }
protected abstract bool IsByRefImpl();
protected abstract bool IsCOMObjectImpl();
protected virtual bool IsContextfulImpl() { throw null; }
public virtual bool IsEnumDefined(object value) { throw null; }
public virtual bool IsEquivalentTo([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Type? other) { throw null; }
public virtual bool IsInstanceOfType([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; }
protected virtual bool IsMarshalByRefImpl() { throw null; }
protected abstract bool IsPointerImpl();
protected abstract bool IsPrimitiveImpl();
public virtual bool IsSubclassOf(System.Type c) { throw null; }
protected virtual bool IsValueTypeImpl() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public virtual System.Type MakeArrayType() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public virtual System.Type MakeArrayType(int rank) { throw null; }
public virtual System.Type MakeByRefType() { throw null; }
public static System.Type MakeGenericMethodParameter(int position) { throw null; }
public static System.Type MakeGenericSignatureType(System.Type genericTypeDefinition, params System.Type[] typeArguments) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The native code for this instantiation might not be available at runtime.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]
public virtual System.Type MakeGenericType(params System.Type[] typeArguments) { throw null; }
public virtual System.Type MakePointerType() { throw null; }
public static bool operator ==(System.Type? left, System.Type? right) { throw null; }
public static bool operator !=(System.Type? left, System.Type? right) { throw null; }
[System.ObsoleteAttribute("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static System.Type? ReflectionOnlyGetType(string typeName, bool throwIfNotFound, bool ignoreCase) { throw null; }
public override string ToString() { throw null; }
}
public partial class TypeAccessException : System.TypeLoadException
{
public TypeAccessException() { }
protected TypeAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TypeAccessException(string? message) { }
public TypeAccessException(string? message, System.Exception? inner) { }
}
public enum TypeCode
{
Empty = 0,
Object = 1,
DBNull = 2,
Boolean = 3,
Char = 4,
SByte = 5,
Byte = 6,
Int16 = 7,
UInt16 = 8,
Int32 = 9,
UInt32 = 10,
Int64 = 11,
UInt64 = 12,
Single = 13,
Double = 14,
Decimal = 15,
DateTime = 16,
String = 18,
}
[System.CLSCompliantAttribute(false)]
public ref partial struct TypedReference
{
private object _dummy;
private int _dummyPrimitive;
public override bool Equals(object? o) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Type GetTargetType(System.TypedReference value) { throw null; }
public static System.TypedReference MakeTypedReference(object target, System.Reflection.FieldInfo[] flds) { throw null; }
public static void SetTypedReference(System.TypedReference target, object? value) { }
public static System.RuntimeTypeHandle TargetTypeToken(System.TypedReference value) { throw null; }
public static object ToObject(System.TypedReference value) { throw null; }
}
public sealed partial class TypeInitializationException : System.SystemException
{
public TypeInitializationException(string? fullTypeName, System.Exception? innerException) { }
public string TypeName { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class TypeLoadException : System.SystemException, System.Runtime.Serialization.ISerializable
{
public TypeLoadException() { }
protected TypeLoadException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TypeLoadException(string? message) { }
public TypeLoadException(string? message, System.Exception? inner) { }
public override string Message { get { throw null; } }
public string TypeName { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class TypeUnloadedException : System.SystemException
{
public TypeUnloadedException() { }
protected TypeUnloadedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TypeUnloadedException(string? message) { }
public TypeUnloadedException(string? message, System.Exception? innerException) { }
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct UInt16 : System.IComparable, System.IComparable<ushort>, System.IConvertible, System.IEquatable<ushort>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<ushort>,
System.IMinMaxValue<ushort>,
System.IUnsignedNumber<ushort>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly ushort _dummyPrimitive;
public const ushort MaxValue = (ushort)65535;
public const ushort MinValue = (ushort)0;
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.UInt16 value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.UInt16 obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.UInt16 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.UInt16 Parse(string s) { throw null; }
public static System.UInt16 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.UInt16 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.UInt16 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
System.UInt16 System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt16 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.UInt16 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt16 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt16 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IAdditiveIdentity<ushort, ushort>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IMinMaxValue<ushort>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IMinMaxValue<ushort>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IMultiplicativeIdentity<ushort, ushort>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IAdditionOperators<ushort, ushort, ushort>.operator +(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.LeadingZeroCount(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.PopCount(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.RotateLeft(ushort value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.RotateRight(ushort value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryInteger<ushort>.TrailingZeroCount(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<ushort>.IsPow2(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBinaryNumber<ushort>.Log2(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBitwiseOperators<ushort, ushort, ushort>.operator &(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBitwiseOperators<ushort, ushort, ushort>.operator |(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBitwiseOperators<ushort, ushort, ushort>.operator ^(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IBitwiseOperators<ushort, ushort, ushort>.operator ~(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ushort, ushort>.operator <(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ushort, ushort>.operator <=(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ushort, ushort>.operator >(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ushort, ushort>.operator >=(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IDecrementOperators<ushort>.operator --(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IDivisionOperators<ushort, ushort, ushort>.operator /(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<ushort, ushort>.operator ==(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<ushort, ushort>.operator !=(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IIncrementOperators<ushort>.operator ++(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IModulusOperators<ushort, ushort, ushort>.operator %(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IMultiplyOperators<ushort, ushort, ushort>.operator *(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Abs(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Clamp(ushort value, ushort min, ushort max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (ushort Quotient, ushort Remainder) INumber<ushort>.DivRem(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Max(ushort x, ushort y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Min(ushort x, ushort y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort INumber<ushort>.Sign(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ushort>.TryCreate<TOther>(TOther value, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ushort>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ushort>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IParseable<ushort>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<ushort>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IShiftOperators<ushort, ushort>.operator <<(ushort value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IShiftOperators<ushort, ushort>.operator >>(ushort value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort ISpanParseable<ushort>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<ushort>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out ushort result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort ISubtractionOperators<ushort, ushort, ushort>.operator -(ushort left, ushort right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IUnaryNegationOperators<ushort, ushort>.operator -(ushort value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ushort IUnaryPlusOperators<ushort, ushort>.operator +(ushort value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct UInt32 : System.IComparable, System.IComparable<uint>, System.IConvertible, System.IEquatable<uint>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<uint>,
System.IMinMaxValue<uint>,
System.IUnsignedNumber<uint>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly uint _dummyPrimitive;
public const uint MaxValue = (uint)4294967295;
public const uint MinValue = (uint)0;
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.UInt32 value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.UInt32 obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.UInt32 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.UInt32 Parse(string s) { throw null; }
public static System.UInt32 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.UInt32 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.UInt32 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
System.UInt32 System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
ulong System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt32 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.UInt32 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt32 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt32 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IAdditiveIdentity<uint, uint>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IMinMaxValue<uint>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IMinMaxValue<uint>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IMultiplicativeIdentity<uint, uint>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IAdditionOperators<uint, uint, uint>.operator +(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.LeadingZeroCount(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.PopCount(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.RotateLeft(uint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.RotateRight(uint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryInteger<uint>.TrailingZeroCount(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<uint>.IsPow2(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBinaryNumber<uint>.Log2(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBitwiseOperators<uint, uint, uint>.operator &(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBitwiseOperators<uint, uint, uint>.operator |(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBitwiseOperators<uint, uint, uint>.operator ^(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IBitwiseOperators<uint, uint, uint>.operator ~(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<uint, uint>.operator <(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<uint, uint>.operator <=(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<uint, uint>.operator >(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<uint, uint>.operator >=(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IDecrementOperators<uint>.operator --(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IDivisionOperators<uint, uint, uint>.operator /(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<uint, uint>.operator ==(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<uint, uint>.operator !=(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IIncrementOperators<uint>.operator ++(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IModulusOperators<uint, uint, uint>.operator %(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IMultiplyOperators<uint, uint, uint>.operator *(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Abs(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Clamp(uint value, uint min, uint max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (uint Quotient, uint Remainder) INumber<uint>.DivRem(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Max(uint x, uint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Min(uint x, uint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint INumber<uint>.Sign(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<uint>.TryCreate<TOther>(TOther value, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<uint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<uint>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IParseable<uint>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<uint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IShiftOperators<uint, uint>.operator <<(uint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IShiftOperators<uint, uint>.operator >>(uint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint ISpanParseable<uint>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<uint>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out uint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint ISubtractionOperators<uint, uint, uint>.operator -(uint left, uint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IUnaryNegationOperators<uint, uint>.operator -(uint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static uint IUnaryPlusOperators<uint, uint>.operator +(uint value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct UInt64 : System.IComparable, System.IComparable<ulong>, System.IConvertible, System.IEquatable<ulong>, System.ISpanFormattable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<ulong>,
System.IMinMaxValue<ulong>,
System.IUnsignedNumber<ulong>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly ulong _dummyPrimitive;
public const ulong MaxValue = (ulong)18446744073709551615;
public const ulong MinValue = (ulong)0;
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.UInt64 value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.UInt64 obj) { throw null; }
public override int GetHashCode() { throw null; }
public System.TypeCode GetTypeCode() { throw null; }
public static System.UInt64 Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.UInt64 Parse(string s) { throw null; }
public static System.UInt64 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.UInt64 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.UInt64 Parse(string s, System.IFormatProvider? provider) { throw null; }
bool System.IConvertible.ToBoolean(System.IFormatProvider? provider) { throw null; }
byte System.IConvertible.ToByte(System.IFormatProvider? provider) { throw null; }
char System.IConvertible.ToChar(System.IFormatProvider? provider) { throw null; }
System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider? provider) { throw null; }
decimal System.IConvertible.ToDecimal(System.IFormatProvider? provider) { throw null; }
double System.IConvertible.ToDouble(System.IFormatProvider? provider) { throw null; }
short System.IConvertible.ToInt16(System.IFormatProvider? provider) { throw null; }
int System.IConvertible.ToInt32(System.IFormatProvider? provider) { throw null; }
long System.IConvertible.ToInt64(System.IFormatProvider? provider) { throw null; }
sbyte System.IConvertible.ToSByte(System.IFormatProvider? provider) { throw null; }
float System.IConvertible.ToSingle(System.IFormatProvider? provider) { throw null; }
object System.IConvertible.ToType(System.Type type, System.IFormatProvider? provider) { throw null; }
ushort System.IConvertible.ToUInt16(System.IFormatProvider? provider) { throw null; }
uint System.IConvertible.ToUInt32(System.IFormatProvider? provider) { throw null; }
System.UInt64 System.IConvertible.ToUInt64(System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt64 result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.UInt64 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UInt64 result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UInt64 result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IAdditiveIdentity<ulong, ulong>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IMinMaxValue<ulong>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IMinMaxValue<ulong>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IMultiplicativeIdentity<ulong, ulong>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IAdditionOperators<ulong, ulong, ulong>.operator +(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.LeadingZeroCount(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.PopCount(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.RotateLeft(ulong value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.RotateRight(ulong value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryInteger<ulong>.TrailingZeroCount(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<ulong>.IsPow2(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBinaryNumber<ulong>.Log2(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBitwiseOperators<ulong, ulong, ulong>.operator &(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBitwiseOperators<ulong, ulong, ulong>.operator |(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBitwiseOperators<ulong, ulong, ulong>.operator ^(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IBitwiseOperators<ulong, ulong, ulong>.operator ~(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ulong, ulong>.operator <(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ulong, ulong>.operator <=(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ulong, ulong>.operator >(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<ulong, ulong>.operator >=(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IDecrementOperators<ulong>.operator --(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IDivisionOperators<ulong, ulong, ulong>.operator /(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<ulong, ulong>.operator ==(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<ulong, ulong>.operator !=(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IIncrementOperators<ulong>.operator ++(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IModulusOperators<ulong, ulong, ulong>.operator %(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IMultiplyOperators<ulong, ulong, ulong>.operator *(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Abs(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Clamp(ulong value, ulong min, ulong max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (ulong Quotient, ulong Remainder) INumber<ulong>.DivRem(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Max(ulong x, ulong y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Min(ulong x, ulong y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong INumber<ulong>.Sign(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ulong>.TryCreate<TOther>(TOther value, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ulong>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<ulong>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IParseable<ulong>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<ulong>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IShiftOperators<ulong, ulong>.operator <<(ulong value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IShiftOperators<ulong, ulong>.operator >>(ulong value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong ISpanParseable<ulong>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<ulong>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out ulong result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong ISubtractionOperators<ulong, ulong, ulong>.operator -(ulong left, ulong right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IUnaryNegationOperators<ulong, ulong>.operator -(ulong value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static ulong IUnaryPlusOperators<ulong, ulong>.operator +(ulong value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
[System.CLSCompliantAttribute(false)]
public readonly partial struct UIntPtr : System.IComparable, System.IComparable<nuint>, System.IEquatable<nuint>, System.ISpanFormattable, System.Runtime.Serialization.ISerializable
#if FEATURE_GENERIC_MATH
#pragma warning disable SA1001
, System.IBinaryInteger<nuint>,
System.IMinMaxValue<nuint>,
System.IUnsignedNumber<nuint>
#pragma warning restore SA1001
#endif // FEATURE_GENERIC_MATH
{
private readonly int _dummyPrimitive;
public static readonly System.UIntPtr Zero;
public UIntPtr(uint value) { throw null; }
public UIntPtr(ulong value) { throw null; }
public unsafe UIntPtr(void* value) { throw null; }
public static System.UIntPtr MaxValue { get { throw null; } }
public static System.UIntPtr MinValue { get { throw null; } }
public static int Size { get { throw null; } }
public static System.UIntPtr Add(System.UIntPtr pointer, int offset) { throw null; }
public int CompareTo(object? value) { throw null; }
public int CompareTo(System.UIntPtr value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.UIntPtr other) { throw null; }
public override int GetHashCode() { throw null; }
public static System.UIntPtr operator +(System.UIntPtr pointer, int offset) { throw null; }
public static bool operator ==(System.UIntPtr value1, System.UIntPtr value2) { throw null; }
public static explicit operator System.UIntPtr (uint value) { throw null; }
public static explicit operator System.UIntPtr (ulong value) { throw null; }
public static explicit operator uint (System.UIntPtr value) { throw null; }
public static explicit operator ulong (System.UIntPtr value) { throw null; }
public unsafe static explicit operator void* (System.UIntPtr value) { throw null; }
public unsafe static explicit operator System.UIntPtr (void* value) { throw null; }
public static bool operator !=(System.UIntPtr value1, System.UIntPtr value2) { throw null; }
public static System.UIntPtr operator -(System.UIntPtr pointer, int offset) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format = default(System.ReadOnlySpan<char>), System.IFormatProvider? provider = null) { throw null; }
public static System.UIntPtr Parse(string s) { throw null; }
public static System.UIntPtr Parse(string s, System.Globalization.NumberStyles style) { throw null; }
public static System.UIntPtr Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
public static System.UIntPtr Parse(string s, System.IFormatProvider? provider) { throw null; }
public static System.UIntPtr Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.Integer, System.IFormatProvider? provider = null) { throw null; }
public static System.UIntPtr Subtract(System.UIntPtr pointer, int offset) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public unsafe void* ToPointer() { throw null; }
public override string ToString() { throw null; }
public string ToString(System.IFormatProvider? provider) { throw null; }
public string ToString(string? format) { throw null; }
public string ToString(string? format, System.IFormatProvider? provider) { throw null; }
public uint ToUInt32() { throw null; }
public ulong ToUInt64() { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UIntPtr result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, out System.UIntPtr result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, out System.UIntPtr result) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out System.UIntPtr result) { throw null; }
#if FEATURE_GENERIC_MATH
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IAdditiveIdentity<nuint, nuint>.AdditiveIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IMinMaxValue<nuint>.MinValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IMinMaxValue<nuint>.MaxValue { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IMultiplicativeIdentity<nuint, nuint>.MultiplicativeIdentity { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.One { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Zero { get { throw null; } }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IAdditionOperators<nuint, nuint, nuint>.operator +(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.LeadingZeroCount(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.PopCount(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.RotateLeft(nuint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.RotateRight(nuint value, int rotateAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryInteger<nuint>.TrailingZeroCount(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IBinaryNumber<nuint>.IsPow2(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBinaryNumber<nuint>.Log2(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBitwiseOperators<nuint, nuint, nuint>.operator &(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBitwiseOperators<nuint, nuint, nuint>.operator |(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBitwiseOperators<nuint, nuint, nuint>.operator ^(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IBitwiseOperators<nuint, nuint, nuint>.operator ~(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nuint, nuint>.operator <(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nuint, nuint>.operator <=(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nuint, nuint>.operator >(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IComparisonOperators<nuint, nuint>.operator >=(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IDecrementOperators<nuint>.operator --(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IDivisionOperators<nuint, nuint, nuint>.operator /(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<nuint, nuint>.operator ==(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IEqualityOperators<nuint, nuint>.operator !=(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IIncrementOperators<nuint>.operator ++(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IModulusOperators<nuint, nuint, nuint>.operator %(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IMultiplyOperators<nuint, nuint, nuint>.operator *(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Abs(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Clamp(nuint value, nuint min, nuint max) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Create<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.CreateSaturating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.CreateTruncating<TOther>(TOther value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static (nuint Quotient, nuint Remainder) INumber<nuint>.DivRem(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Max(nuint x, nuint y) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Min(nuint x, nuint y) { throw null; }[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Parse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint INumber<nuint>.Sign(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nuint>.TryCreate<TOther>(TOther value, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nuint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool INumber<nuint>.TryParse(System.ReadOnlySpan<char> s, System.Globalization.NumberStyles style, System.IFormatProvider? provider, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IParseable<nuint>.Parse(string s, System.IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool IParseable<nuint>.TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? s, System.IFormatProvider? provider, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IShiftOperators<nuint, nuint>.operator <<(nuint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IShiftOperators<nuint, nuint>.operator >>(nuint value, int shiftAmount) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint ISpanParseable<nuint>.Parse(System.ReadOnlySpan<char> s, IFormatProvider? provider) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static bool ISpanParseable<nuint>.TryParse(System.ReadOnlySpan<char> s, System.IFormatProvider? provider, out nuint result) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint ISubtractionOperators<nuint, nuint, nuint>.operator -(nuint left, nuint right) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IUnaryNegationOperators<nuint, nuint>.operator -(nuint value) { throw null; }
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
static nuint IUnaryPlusOperators<nuint, nuint>.operator +(nuint value) { throw null; }
#endif // FEATURE_GENERIC_MATH
}
public partial class UnauthorizedAccessException : System.SystemException
{
public UnauthorizedAccessException() { }
protected UnauthorizedAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public UnauthorizedAccessException(string? message) { }
public UnauthorizedAccessException(string? message, System.Exception? inner) { }
}
public partial class UnhandledExceptionEventArgs : System.EventArgs
{
public UnhandledExceptionEventArgs(object exception, bool isTerminating) { }
public object ExceptionObject { get { throw null; } }
public bool IsTerminating { get { throw null; } }
}
public delegate void UnhandledExceptionEventHandler(object sender, System.UnhandledExceptionEventArgs e);
public partial class Uri : System.Runtime.Serialization.ISerializable
{
public static readonly string SchemeDelimiter;
public static readonly string UriSchemeFile;
public static readonly string UriSchemeFtp;
public static readonly string UriSchemeFtps;
public static readonly string UriSchemeGopher;
public static readonly string UriSchemeHttp;
public static readonly string UriSchemeHttps;
public static readonly string UriSchemeMailto;
public static readonly string UriSchemeNetPipe;
public static readonly string UriSchemeNetTcp;
public static readonly string UriSchemeNews;
public static readonly string UriSchemeNntp;
public static readonly string UriSchemeSftp;
public static readonly string UriSchemeSsh;
public static readonly string UriSchemeTelnet;
public static readonly string UriSchemeWs;
public static readonly string UriSchemeWss;
protected Uri(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
public Uri(string uriString) { }
[System.ObsoleteAttribute("This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(string) instead.")]
public Uri(string uriString, bool dontEscape) { }
public Uri(string uriString, in System.UriCreationOptions creationOptions) { }
public Uri(string uriString, System.UriKind uriKind) { }
public Uri(System.Uri baseUri, string? relativeUri) { }
[System.ObsoleteAttribute("This constructor has been deprecated; the dontEscape parameter is always false. Use Uri(Uri, string) instead.")]
public Uri(System.Uri baseUri, string? relativeUri, bool dontEscape) { }
public Uri(System.Uri baseUri, System.Uri relativeUri) { }
public string AbsolutePath { get { throw null; } }
public string AbsoluteUri { get { throw null; } }
public string Authority { get { throw null; } }
public string DnsSafeHost { get { throw null; } }
public string Fragment { get { throw null; } }
public string Host { get { throw null; } }
public System.UriHostNameType HostNameType { get { throw null; } }
public string IdnHost { get { throw null; } }
public bool IsAbsoluteUri { get { throw null; } }
public bool IsDefaultPort { get { throw null; } }
public bool IsFile { get { throw null; } }
public bool IsLoopback { get { throw null; } }
public bool IsUnc { get { throw null; } }
public string LocalPath { get { throw null; } }
public string OriginalString { get { throw null; } }
public string PathAndQuery { get { throw null; } }
public int Port { get { throw null; } }
public string Query { get { throw null; } }
public string Scheme { get { throw null; } }
public string[] Segments { get { throw null; } }
public bool UserEscaped { get { throw null; } }
public string UserInfo { get { throw null; } }
[System.ObsoleteAttribute("Uri.Canonicalize has been deprecated and is not supported.")]
protected virtual void Canonicalize() { }
public static System.UriHostNameType CheckHostName(string? name) { throw null; }
public static bool CheckSchemeName([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? schemeName) { throw null; }
[System.ObsoleteAttribute("Uri.CheckSecurity has been deprecated and is not supported.")]
protected virtual void CheckSecurity() { }
public static int Compare(System.Uri? uri1, System.Uri? uri2, System.UriComponents partsToCompare, System.UriFormat compareFormat, System.StringComparison comparisonType) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? comparand) { throw null; }
[System.ObsoleteAttribute("Uri.Escape has been deprecated and is not supported.")]
protected virtual void Escape() { }
public static string EscapeDataString(string stringToEscape) { throw null; }
[System.ObsoleteAttribute("Uri.EscapeString has been deprecated. Use GetComponents() or Uri.EscapeDataString to escape a Uri component or a string.")]
protected static string EscapeString(string? str) { throw null; }
[System.ObsoleteAttribute("Uri.EscapeUriString can corrupt the Uri string in some cases. Consider using Uri.EscapeDataString for query string components instead.", DiagnosticId = "SYSLIB0013", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static string EscapeUriString(string stringToEscape) { throw null; }
public static int FromHex(char digit) { throw null; }
public string GetComponents(System.UriComponents components, System.UriFormat format) { throw null; }
public override int GetHashCode() { throw null; }
public string GetLeftPart(System.UriPartial part) { throw null; }
protected void GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
public static string HexEscape(char character) { throw null; }
public static char HexUnescape(string pattern, ref int index) { throw null; }
[System.ObsoleteAttribute("Uri.IsBadFileSystemCharacter has been deprecated and is not supported.")]
protected virtual bool IsBadFileSystemCharacter(char character) { throw null; }
public bool IsBaseOf(System.Uri uri) { throw null; }
[System.ObsoleteAttribute("Uri.IsExcludedCharacter has been deprecated and is not supported.")]
protected static bool IsExcludedCharacter(char character) { throw null; }
public static bool IsHexDigit(char character) { throw null; }
public static bool IsHexEncoding(string pattern, int index) { throw null; }
[System.ObsoleteAttribute("Uri.IsReservedCharacter has been deprecated and is not supported.")]
protected virtual bool IsReservedCharacter(char character) { throw null; }
public bool IsWellFormedOriginalString() { throw null; }
public static bool IsWellFormedUriString([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? uriString, System.UriKind uriKind) { throw null; }
[System.ObsoleteAttribute("Uri.MakeRelative has been deprecated. Use MakeRelativeUri(Uri uri) instead.")]
public string MakeRelative(System.Uri toUri) { throw null; }
public System.Uri MakeRelativeUri(System.Uri uri) { throw null; }
public static bool operator ==(System.Uri? uri1, System.Uri? uri2) { throw null; }
public static bool operator !=(System.Uri? uri1, System.Uri? uri2) { throw null; }
[System.ObsoleteAttribute("Uri.Parse has been deprecated and is not supported.")]
protected virtual void Parse() { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
public override string ToString() { throw null; }
public static bool TryCreate([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? uriString, in System.UriCreationOptions creationOptions, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; }
public static bool TryCreate([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? uriString, System.UriKind uriKind, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; }
public static bool TryCreate(System.Uri? baseUri, string? relativeUri, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; }
public static bool TryCreate(System.Uri? baseUri, System.Uri? relativeUri, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Uri? result) { throw null; }
[System.ObsoleteAttribute("Uri.Unescape has been deprecated. Use GetComponents() or Uri.UnescapeDataString() to unescape a Uri component or a string.")]
protected virtual string Unescape(string path) { throw null; }
public static string UnescapeDataString(string stringToUnescape) { throw null; }
}
public partial class UriBuilder
{
public UriBuilder() { }
public UriBuilder(string uri) { }
public UriBuilder(string? schemeName, string? hostName) { }
public UriBuilder(string? scheme, string? host, int portNumber) { }
public UriBuilder(string? scheme, string? host, int port, string? pathValue) { }
public UriBuilder(string? scheme, string? host, int port, string? path, string? extraValue) { }
public UriBuilder(System.Uri uri) { }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Fragment { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Host { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Password { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Path { get { throw null; } set { } }
public int Port { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Query { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string Scheme { get { throw null; } set { } }
public System.Uri Uri { get { throw null; } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public string UserName { get { throw null; } set { } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? rparam) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum UriComponents
{
SerializationInfoString = -2147483648,
Scheme = 1,
UserInfo = 2,
Host = 4,
Port = 8,
SchemeAndServer = 13,
Path = 16,
Query = 32,
PathAndQuery = 48,
HttpRequestUrl = 61,
Fragment = 64,
AbsoluteUri = 127,
StrongPort = 128,
HostAndPort = 132,
StrongAuthority = 134,
NormalizedHost = 256,
KeepDelimiter = 1073741824,
}
public partial struct UriCreationOptions
{
private int _dummyPrimitive;
public bool DangerousDisablePathAndQueryCanonicalization { readonly get { throw null; } set { } }
}
public enum UriFormat
{
UriEscaped = 1,
Unescaped = 2,
SafeUnescaped = 3,
}
public partial class UriFormatException : System.FormatException, System.Runtime.Serialization.ISerializable
{
public UriFormatException() { }
protected UriFormatException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
public UriFormatException(string? textString) { }
public UriFormatException(string? textString, System.Exception? e) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
}
public enum UriHostNameType
{
Unknown = 0,
Basic = 1,
Dns = 2,
IPv4 = 3,
IPv6 = 4,
}
public enum UriKind
{
RelativeOrAbsolute = 0,
Absolute = 1,
Relative = 2,
}
public abstract partial class UriParser
{
protected UriParser() { }
protected virtual string GetComponents(System.Uri uri, System.UriComponents components, System.UriFormat format) { throw null; }
protected virtual void InitializeAndValidate(System.Uri uri, out System.UriFormatException? parsingError) { throw null; }
protected virtual bool IsBaseOf(System.Uri baseUri, System.Uri relativeUri) { throw null; }
public static bool IsKnownScheme(string schemeName) { throw null; }
protected virtual bool IsWellFormedOriginalString(System.Uri uri) { throw null; }
protected virtual System.UriParser OnNewUri() { throw null; }
protected virtual void OnRegister(string schemeName, int defaultPort) { }
public static void Register(System.UriParser uriParser, string schemeName, int defaultPort) { }
protected virtual string? Resolve(System.Uri baseUri, System.Uri? relativeUri, out System.UriFormatException? parsingError) { throw null; }
}
public enum UriPartial
{
Scheme = 0,
Authority = 1,
Path = 2,
Query = 3,
}
public partial struct ValueTuple : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<System.ValueTuple>, System.IEquatable<System.ValueTuple>, System.Runtime.CompilerServices.ITuple
{
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo(System.ValueTuple other) { throw null; }
public static System.ValueTuple Create() { throw null; }
public static System.ValueTuple<T1> Create<T1>(T1 item1) { throw null; }
public static (T1, T2) Create<T1, T2>(T1 item1, T2 item2) { throw null; }
public static (T1, T2, T3) Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3) { throw null; }
public static (T1, T2, T3, T4) Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4) { throw null; }
public static (T1, T2, T3, T4, T5) Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { throw null; }
public static (T1, T2, T3, T4, T5, T6) Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7) Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { throw null; }
public static (T1, T2, T3, T4, T5, T6, T7, T8) Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.ValueTuple other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<System.ValueTuple<T1>>, System.IEquatable<System.ValueTuple<T1>>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public ValueTuple(T1 item1) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo(System.ValueTuple<T1> other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.ValueTuple<T1> other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2)>, System.IEquatable<(T1, T2)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public ValueTuple(T1 item1, T2 item2) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3)>, System.IEquatable<(T1, T2, T3)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public ValueTuple(T1 item1, T2 item2, T3 item3) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3, T4)>, System.IEquatable<(T1, T2, T3, T4)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3, T4) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3, T4) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4, T5> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3, T4, T5)>, System.IEquatable<(T1, T2, T3, T4, T5)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3, T4, T5) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3, T4, T5) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4, T5, T6> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3, T4, T5, T6)>, System.IEquatable<(T1, T2, T3, T4, T5, T6)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3, T4, T5, T6) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3, T4, T5, T6) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4, T5, T6, T7> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<(T1, T2, T3, T4, T5, T6, T7)>, System.IEquatable<(T1, T2, T3, T4, T5, T6, T7)>, System.Runtime.CompilerServices.ITuple
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public T7 Item7;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo((T1, T2, T3, T4, T5, T6, T7) other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals((T1, T2, T3, T4, T5, T6, T7) other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public partial struct ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable<System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, System.IEquatable<System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, System.Runtime.CompilerServices.ITuple where TRest : struct
{
public T1 Item1;
public T2 Item2;
public T3 Item3;
public T4 Item4;
public T5 Item5;
public T6 Item6;
public T7 Item7;
public TRest Rest;
public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) { throw null; }
object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } }
int System.Runtime.CompilerServices.ITuple.Length { get { throw null; } }
public int CompareTo(System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> other) { throw null; }
public override int GetHashCode() { throw null; }
int System.Collections.IStructuralComparable.CompareTo(object? other, System.Collections.IComparer comparer) { throw null; }
bool System.Collections.IStructuralEquatable.Equals(object? other, System.Collections.IEqualityComparer comparer) { throw null; }
int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
int System.IComparable.CompareTo(object? other) { throw null; }
public override string ToString() { throw null; }
}
public abstract partial class ValueType
{
protected ValueType() { }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public override string? ToString() { throw null; }
}
public sealed partial class Version : System.ICloneable, System.IComparable, System.IComparable<System.Version?>, System.IEquatable<System.Version?>, System.IFormattable, System.ISpanFormattable
{
public Version() { }
public Version(int major, int minor) { }
public Version(int major, int minor, int build) { }
public Version(int major, int minor, int build, int revision) { }
public Version(string version) { }
public int Build { get { throw null; } }
public int Major { get { throw null; } }
public short MajorRevision { get { throw null; } }
public int Minor { get { throw null; } }
public short MinorRevision { get { throw null; } }
public int Revision { get { throw null; } }
public object Clone() { throw null; }
public int CompareTo(object? version) { throw null; }
public int CompareTo(System.Version? value) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Version? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator >(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator >=(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator !=(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator <(System.Version? v1, System.Version? v2) { throw null; }
public static bool operator <=(System.Version? v1, System.Version? v2) { throw null; }
public static System.Version Parse(System.ReadOnlySpan<char> input) { throw null; }
public static System.Version Parse(string input) { throw null; }
string System.IFormattable.ToString(string? format, System.IFormatProvider? formatProvider) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
public override string ToString() { throw null; }
public string ToString(int fieldCount) { throw null; }
public bool TryFormat(System.Span<char> destination, int fieldCount, out int charsWritten) { throw null; }
public bool TryFormat(System.Span<char> destination, out int charsWritten) { throw null; }
public static bool TryParse(System.ReadOnlySpan<char> input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Version? result) { throw null; }
public static bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Version? result) { throw null; }
}
public partial struct Void
{
}
public partial class WeakReference : System.Runtime.Serialization.ISerializable
{
public WeakReference(object? target) { }
public WeakReference(object? target, bool trackResurrection) { }
protected WeakReference(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public virtual bool IsAlive { get { throw null; } }
public virtual object? Target { get { throw null; } set { } }
public virtual bool TrackResurrection { get { throw null; } }
~WeakReference() { }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public sealed partial class WeakReference<T> : System.Runtime.Serialization.ISerializable where T : class?
{
public WeakReference(T target) { }
public WeakReference(T target, bool trackResurrection) { }
~WeakReference() { }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public void SetTarget(T target) { }
public bool TryGetTarget([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false), System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out T target) { throw null; }
}
}
namespace System.Buffers
{
public abstract partial class ArrayPool<T>
{
protected ArrayPool() { }
public static System.Buffers.ArrayPool<T> Shared { get { throw null; } }
public static System.Buffers.ArrayPool<T> Create() { throw null; }
public static System.Buffers.ArrayPool<T> Create(int maxArrayLength, int maxArraysPerBucket) { throw null; }
public abstract T[] Rent(int minimumLength);
public abstract void Return(T[] array, bool clearArray = false);
}
public partial interface IMemoryOwner<T> : System.IDisposable
{
System.Memory<T> Memory { get; }
}
public partial interface IPinnable
{
System.Buffers.MemoryHandle Pin(int elementIndex);
void Unpin();
}
public partial struct MemoryHandle : System.IDisposable
{
private object _dummy;
private int _dummyPrimitive;
[System.CLSCompliantAttribute(false)]
public unsafe MemoryHandle(void* pointer, System.Runtime.InteropServices.GCHandle handle = default(System.Runtime.InteropServices.GCHandle), System.Buffers.IPinnable? pinnable = null) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe void* Pointer { get { throw null; } }
public void Dispose() { }
}
public abstract partial class MemoryManager<T> : System.Buffers.IMemoryOwner<T>, System.Buffers.IPinnable, System.IDisposable
{
protected MemoryManager() { }
public virtual System.Memory<T> Memory { get { throw null; } }
protected System.Memory<T> CreateMemory(int length) { throw null; }
protected System.Memory<T> CreateMemory(int start, int length) { throw null; }
protected abstract void Dispose(bool disposing);
public abstract System.Span<T> GetSpan();
public abstract System.Buffers.MemoryHandle Pin(int elementIndex = 0);
void System.IDisposable.Dispose() { }
protected internal virtual bool TryGetArray(out System.ArraySegment<T> segment) { throw null; }
public abstract void Unpin();
}
public enum OperationStatus
{
Done = 0,
DestinationTooSmall = 1,
NeedMoreData = 2,
InvalidData = 3,
}
public delegate void ReadOnlySpanAction<T, in TArg>(System.ReadOnlySpan<T> span, TArg arg);
public delegate void SpanAction<T, in TArg>(System.Span<T> span, TArg arg);
}
namespace System.CodeDom.Compiler
{
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=false, AllowMultiple=false)]
public sealed partial class GeneratedCodeAttribute : System.Attribute
{
public GeneratedCodeAttribute(string? tool, string? version) { }
public string? Tool { get { throw null; } }
public string? Version { get { throw null; } }
}
public partial class IndentedTextWriter : System.IO.TextWriter
{
public const string DefaultTabString = " ";
public IndentedTextWriter(System.IO.TextWriter writer) { }
public IndentedTextWriter(System.IO.TextWriter writer, string tabString) { }
public override System.Text.Encoding Encoding { get { throw null; } }
public int Indent { get { throw null; } set { } }
public System.IO.TextWriter InnerWriter { get { throw null; } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public override string NewLine { get { throw null; } set { } }
public override void Close() { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync() { throw null; }
protected virtual void OutputTabs() { }
protected virtual System.Threading.Tasks.Task OutputTabsAsync() { throw null; }
public override void Write(bool value) { }
public override void Write(char value) { }
public override void Write(char[]? buffer) { }
public override void Write(char[] buffer, int index, int count) { }
public override void Write(double value) { }
public override void Write(int value) { }
public override void Write(long value) { }
public override void Write(object? value) { }
public override void Write(float value) { }
public override void Write(string? s) { }
public override void Write(string format, object? arg0) { }
public override void Write(string format, object? arg0, object? arg1) { }
public override void Write(string format, params object?[] arg) { }
public override System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(string? value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteLine() { }
public override void WriteLine(bool value) { }
public override void WriteLine(char value) { }
public override void WriteLine(char[]? buffer) { }
public override void WriteLine(char[] buffer, int index, int count) { }
public override void WriteLine(double value) { }
public override void WriteLine(int value) { }
public override void WriteLine(long value) { }
public override void WriteLine(object? value) { }
public override void WriteLine(float value) { }
public override void WriteLine(string? s) { }
public override void WriteLine(string format, object? arg0) { }
public override void WriteLine(string format, object? arg0, object? arg1) { }
public override void WriteLine(string format, params object?[] arg) { }
[System.CLSCompliantAttribute(false)]
public override void WriteLine(uint value) { }
public override System.Threading.Tasks.Task WriteLineAsync() { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(string? value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public void WriteLineNoTabs(string? s) { }
public System.Threading.Tasks.Task WriteLineNoTabsAsync(string? s) { throw null; }
}
}
namespace System.Collections
{
public partial class ArrayList : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable
{
public ArrayList() { }
public ArrayList(System.Collections.ICollection c) { }
public ArrayList(int capacity) { }
public virtual int Capacity { get { throw null; } set { } }
public virtual int Count { get { throw null; } }
public virtual bool IsFixedSize { get { throw null; } }
public virtual bool IsReadOnly { get { throw null; } }
public virtual bool IsSynchronized { get { throw null; } }
public virtual object? this[int index] { get { throw null; } set { } }
public virtual object SyncRoot { get { throw null; } }
public static System.Collections.ArrayList Adapter(System.Collections.IList list) { throw null; }
public virtual int Add(object? value) { throw null; }
public virtual void AddRange(System.Collections.ICollection c) { }
public virtual int BinarySearch(int index, int count, object? value, System.Collections.IComparer? comparer) { throw null; }
public virtual int BinarySearch(object? value) { throw null; }
public virtual int BinarySearch(object? value, System.Collections.IComparer? comparer) { throw null; }
public virtual void Clear() { }
public virtual object Clone() { throw null; }
public virtual bool Contains(object? item) { throw null; }
public virtual void CopyTo(System.Array array) { }
public virtual void CopyTo(System.Array array, int arrayIndex) { }
public virtual void CopyTo(int index, System.Array array, int arrayIndex, int count) { }
public static System.Collections.ArrayList FixedSize(System.Collections.ArrayList list) { throw null; }
public static System.Collections.IList FixedSize(System.Collections.IList list) { throw null; }
public virtual System.Collections.IEnumerator GetEnumerator() { throw null; }
public virtual System.Collections.IEnumerator GetEnumerator(int index, int count) { throw null; }
public virtual System.Collections.ArrayList GetRange(int index, int count) { throw null; }
public virtual int IndexOf(object? value) { throw null; }
public virtual int IndexOf(object? value, int startIndex) { throw null; }
public virtual int IndexOf(object? value, int startIndex, int count) { throw null; }
public virtual void Insert(int index, object? value) { }
public virtual void InsertRange(int index, System.Collections.ICollection c) { }
public virtual int LastIndexOf(object? value) { throw null; }
public virtual int LastIndexOf(object? value, int startIndex) { throw null; }
public virtual int LastIndexOf(object? value, int startIndex, int count) { throw null; }
public static System.Collections.ArrayList ReadOnly(System.Collections.ArrayList list) { throw null; }
public static System.Collections.IList ReadOnly(System.Collections.IList list) { throw null; }
public virtual void Remove(object? obj) { }
public virtual void RemoveAt(int index) { }
public virtual void RemoveRange(int index, int count) { }
public static System.Collections.ArrayList Repeat(object? value, int count) { throw null; }
public virtual void Reverse() { }
public virtual void Reverse(int index, int count) { }
public virtual void SetRange(int index, System.Collections.ICollection c) { }
public virtual void Sort() { }
public virtual void Sort(System.Collections.IComparer? comparer) { }
public virtual void Sort(int index, int count, System.Collections.IComparer? comparer) { }
public static System.Collections.ArrayList Synchronized(System.Collections.ArrayList list) { throw null; }
public static System.Collections.IList Synchronized(System.Collections.IList list) { throw null; }
public virtual object?[] ToArray() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public virtual System.Array ToArray(System.Type type) { throw null; }
public virtual void TrimToSize() { }
}
public sealed partial class Comparer : System.Collections.IComparer, System.Runtime.Serialization.ISerializable
{
public static readonly System.Collections.Comparer Default;
public static readonly System.Collections.Comparer DefaultInvariant;
public Comparer(System.Globalization.CultureInfo culture) { }
public int Compare(object? a, object? b) { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial struct DictionaryEntry
{
private object _dummy;
private int _dummyPrimitive;
public DictionaryEntry(object key, object? value) { throw null; }
public object Key { get { throw null; } set { } }
public object? Value { get { throw null; } set { } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public void Deconstruct(out object key, out object? value) { throw null; }
}
public partial class Hashtable : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable, System.ICloneable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
public Hashtable() { }
public Hashtable(System.Collections.IDictionary d) { }
public Hashtable(System.Collections.IDictionary d, System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(IDictionary, IEqualityComparer) instead.")]
public Hashtable(System.Collections.IDictionary d, System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
public Hashtable(System.Collections.IDictionary d, float loadFactor) { }
public Hashtable(System.Collections.IDictionary d, float loadFactor, System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(IDictionary, float, IEqualityComparer) instead.")]
public Hashtable(System.Collections.IDictionary d, float loadFactor, System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
public Hashtable(System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(IEqualityComparer) instead.")]
public Hashtable(System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
public Hashtable(int capacity) { }
public Hashtable(int capacity, System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(int, IEqualityComparer) instead.")]
public Hashtable(int capacity, System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
public Hashtable(int capacity, float loadFactor) { }
public Hashtable(int capacity, float loadFactor, System.Collections.IEqualityComparer? equalityComparer) { }
[System.ObsoleteAttribute("This constructor has been deprecated. Use Hashtable(int, float, IEqualityComparer) instead.")]
public Hashtable(int capacity, float loadFactor, System.Collections.IHashCodeProvider? hcp, System.Collections.IComparer? comparer) { }
protected Hashtable(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
[System.ObsoleteAttribute("Hashtable.comparer has been deprecated. Use the KeyComparer properties instead.")]
protected System.Collections.IComparer? comparer { get { throw null; } set { } }
public virtual int Count { get { throw null; } }
protected System.Collections.IEqualityComparer? EqualityComparer { get { throw null; } }
[System.ObsoleteAttribute("Hashtable.hcp has been deprecated. Use the EqualityComparer property instead.")]
protected System.Collections.IHashCodeProvider? hcp { get { throw null; } set { } }
public virtual bool IsFixedSize { get { throw null; } }
public virtual bool IsReadOnly { get { throw null; } }
public virtual bool IsSynchronized { get { throw null; } }
public virtual object? this[object key] { get { throw null; } set { } }
public virtual System.Collections.ICollection Keys { get { throw null; } }
public virtual object SyncRoot { get { throw null; } }
public virtual System.Collections.ICollection Values { get { throw null; } }
public virtual void Add(object key, object? value) { }
public virtual void Clear() { }
public virtual object Clone() { throw null; }
public virtual bool Contains(object key) { throw null; }
public virtual bool ContainsKey(object key) { throw null; }
public virtual bool ContainsValue(object? value) { throw null; }
public virtual void CopyTo(System.Array array, int arrayIndex) { }
public virtual System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
protected virtual int GetHash(object key) { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
protected virtual bool KeyEquals(object? item, object key) { throw null; }
public virtual void OnDeserialization(object? sender) { }
public virtual void Remove(object key) { }
public static System.Collections.Hashtable Synchronized(System.Collections.Hashtable table) { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial interface ICollection : System.Collections.IEnumerable
{
int Count { get; }
bool IsSynchronized { get; }
object SyncRoot { get; }
void CopyTo(System.Array array, int index);
}
public partial interface IComparer
{
int Compare(object? x, object? y);
}
public partial interface IDictionary : System.Collections.ICollection, System.Collections.IEnumerable
{
bool IsFixedSize { get; }
bool IsReadOnly { get; }
object? this[object key] { get; set; }
System.Collections.ICollection Keys { get; }
System.Collections.ICollection Values { get; }
void Add(object key, object? value);
void Clear();
bool Contains(object key);
new System.Collections.IDictionaryEnumerator GetEnumerator();
void Remove(object key);
}
public partial interface IDictionaryEnumerator : System.Collections.IEnumerator
{
System.Collections.DictionaryEntry Entry { get; }
object Key { get; }
object? Value { get; }
}
public partial interface IEnumerable
{
System.Collections.IEnumerator GetEnumerator();
}
public partial interface IEnumerator
{
#nullable disable // explicitly leaving Current as "oblivious" to avoid spurious warnings in foreach over non-generic enumerables
object Current { get; }
#nullable restore
bool MoveNext();
void Reset();
}
public partial interface IEqualityComparer
{
bool Equals(object? x, object? y);
int GetHashCode(object obj);
}
[System.ObsoleteAttribute("IHashCodeProvider has been deprecated. Use IEqualityComparer instead.")]
public partial interface IHashCodeProvider
{
int GetHashCode(object obj);
}
public partial interface IList : System.Collections.ICollection, System.Collections.IEnumerable
{
bool IsFixedSize { get; }
bool IsReadOnly { get; }
object? this[int index] { get; set; }
int Add(object? value);
void Clear();
bool Contains(object? value);
int IndexOf(object? value);
void Insert(int index, object? value);
void Remove(object? value);
void RemoveAt(int index);
}
public partial interface IStructuralComparable
{
int CompareTo(object? other, System.Collections.IComparer comparer);
}
public partial interface IStructuralEquatable
{
bool Equals(object? other, System.Collections.IEqualityComparer comparer);
int GetHashCode(System.Collections.IEqualityComparer comparer);
}
}
namespace System.Collections.Generic
{
public partial interface IAsyncEnumerable<out T>
{
System.Collections.Generic.IAsyncEnumerator<T> GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
}
public partial interface IAsyncEnumerator<out T> : System.IAsyncDisposable
{
T Current { get; }
System.Threading.Tasks.ValueTask<bool> MoveNextAsync();
}
public partial interface ICollection<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
{
int Count { get; }
bool IsReadOnly { get; }
void Add(T item);
void Clear();
bool Contains(T item);
void CopyTo(T[] array, int arrayIndex);
bool Remove(T item);
}
public partial interface IComparer<in T>
{
int Compare(T? x, T? y);
}
public partial interface IDictionary<TKey, TValue> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerable
{
TValue this[TKey key] { get; set; }
System.Collections.Generic.ICollection<TKey> Keys { get; }
System.Collections.Generic.ICollection<TValue> Values { get; }
void Add(TKey key, TValue value);
bool ContainsKey(TKey key);
bool Remove(TKey key);
bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value);
}
public partial interface IEnumerable<out T> : System.Collections.IEnumerable
{
new System.Collections.Generic.IEnumerator<T> GetEnumerator();
}
public partial interface IEnumerator<out T> : System.Collections.IEnumerator, System.IDisposable
{
new T Current { get; }
}
public partial interface IEqualityComparer<in T>
{
bool Equals(T? x, T? y);
int GetHashCode([System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T obj);
}
public partial interface IList<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
{
T this[int index] { get; set; }
int IndexOf(T item);
void Insert(int index, T item);
void RemoveAt(int index);
}
public partial interface IReadOnlyCollection<out T> : System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
{
int Count { get; }
}
public partial interface IReadOnlyDictionary<TKey, TValue> : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerable
{
TValue this[TKey key] { get; }
System.Collections.Generic.IEnumerable<TKey> Keys { get; }
System.Collections.Generic.IEnumerable<TValue> Values { get; }
bool ContainsKey(TKey key);
bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value);
}
public partial interface IReadOnlyList<out T> : System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.IEnumerable
{
T this[int index] { get; }
}
public partial interface IReadOnlySet<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.IEnumerable
{
bool Contains(T item);
bool IsProperSubsetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other);
bool Overlaps(System.Collections.Generic.IEnumerable<T> other);
bool SetEquals(System.Collections.Generic.IEnumerable<T> other);
}
public partial interface ISet<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
{
new bool Add(T item);
void ExceptWith(System.Collections.Generic.IEnumerable<T> other);
void IntersectWith(System.Collections.Generic.IEnumerable<T> other);
bool IsProperSubsetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsProperSupersetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsSubsetOf(System.Collections.Generic.IEnumerable<T> other);
bool IsSupersetOf(System.Collections.Generic.IEnumerable<T> other);
bool Overlaps(System.Collections.Generic.IEnumerable<T> other);
bool SetEquals(System.Collections.Generic.IEnumerable<T> other);
void SymmetricExceptWith(System.Collections.Generic.IEnumerable<T> other);
void UnionWith(System.Collections.Generic.IEnumerable<T> other);
}
public partial class KeyNotFoundException : System.SystemException
{
public KeyNotFoundException() { }
protected KeyNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public KeyNotFoundException(string? message) { }
public KeyNotFoundException(string? message, System.Exception? innerException) { }
}
public static partial class KeyValuePair
{
public static System.Collections.Generic.KeyValuePair<TKey, TValue> Create<TKey, TValue>(TKey key, TValue value) { throw null; }
}
public readonly partial struct KeyValuePair<TKey, TValue>
{
private readonly TKey key;
private readonly TValue value;
private readonly int _dummyPrimitive;
public KeyValuePair(TKey key, TValue value) { throw null; }
public TKey Key { get { throw null; } }
public TValue Value { get { throw null; } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public void Deconstruct(out TKey key, out TValue value) { throw null; }
public override string ToString() { throw null; }
}
}
namespace System.Collections.ObjectModel
{
public partial class Collection<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
{
public Collection() { }
public Collection(System.Collections.Generic.IList<T> list) { }
public int Count { get { throw null; } }
public T this[int index] { get { throw null; } set { } }
protected System.Collections.Generic.IList<T> Items { get { throw null; } }
bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
bool System.Collections.IList.IsFixedSize { get { throw null; } }
bool System.Collections.IList.IsReadOnly { get { throw null; } }
object? System.Collections.IList.this[int index] { get { throw null; } set { } }
public void Add(T item) { }
public void Clear() { }
protected virtual void ClearItems() { }
public bool Contains(T item) { throw null; }
public void CopyTo(T[] array, int index) { }
public System.Collections.Generic.IEnumerator<T> GetEnumerator() { throw null; }
public int IndexOf(T item) { throw null; }
public void Insert(int index, T item) { }
protected virtual void InsertItem(int index, T item) { }
public bool Remove(T item) { throw null; }
public void RemoveAt(int index) { }
protected virtual void RemoveItem(int index) { }
protected virtual void SetItem(int index, T item) { }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
int System.Collections.IList.Add(object? value) { throw null; }
bool System.Collections.IList.Contains(object? value) { throw null; }
int System.Collections.IList.IndexOf(object? value) { throw null; }
void System.Collections.IList.Insert(int index, object? value) { }
void System.Collections.IList.Remove(object? value) { }
}
public partial class ReadOnlyCollection<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
{
public ReadOnlyCollection(System.Collections.Generic.IList<T> list) { }
public int Count { get { throw null; } }
public T this[int index] { get { throw null; } }
protected System.Collections.Generic.IList<T> Items { get { throw null; } }
bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
T System.Collections.Generic.IList<T>.this[int index] { get { throw null; } set { } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
bool System.Collections.IList.IsFixedSize { get { throw null; } }
bool System.Collections.IList.IsReadOnly { get { throw null; } }
object? System.Collections.IList.this[int index] { get { throw null; } set { } }
public bool Contains(T value) { throw null; }
public void CopyTo(T[] array, int index) { }
public System.Collections.Generic.IEnumerator<T> GetEnumerator() { throw null; }
public int IndexOf(T value) { throw null; }
void System.Collections.Generic.ICollection<T>.Add(T value) { }
void System.Collections.Generic.ICollection<T>.Clear() { }
bool System.Collections.Generic.ICollection<T>.Remove(T value) { throw null; }
void System.Collections.Generic.IList<T>.Insert(int index, T value) { }
void System.Collections.Generic.IList<T>.RemoveAt(int index) { }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
int System.Collections.IList.Add(object? value) { throw null; }
void System.Collections.IList.Clear() { }
bool System.Collections.IList.Contains(object? value) { throw null; }
int System.Collections.IList.IndexOf(object? value) { throw null; }
void System.Collections.IList.Insert(int index, object? value) { }
void System.Collections.IList.Remove(object? value) { }
void System.Collections.IList.RemoveAt(int index) { }
}
public partial class ReadOnlyDictionary<TKey, TValue> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IDictionary<TKey, TValue>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>, System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable where TKey : notnull
{
public ReadOnlyDictionary(System.Collections.Generic.IDictionary<TKey, TValue> dictionary) { }
public int Count { get { throw null; } }
protected System.Collections.Generic.IDictionary<TKey, TValue> Dictionary { get { throw null; } }
public TValue this[TKey key] { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>.KeyCollection Keys { get { throw null; } }
bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.IsReadOnly { get { throw null; } }
TValue System.Collections.Generic.IDictionary<TKey, TValue>.this[TKey key] { get { throw null; } set { } }
System.Collections.Generic.ICollection<TKey> System.Collections.Generic.IDictionary<TKey, TValue>.Keys { get { throw null; } }
System.Collections.Generic.ICollection<TValue> System.Collections.Generic.IDictionary<TKey, TValue>.Values { get { throw null; } }
System.Collections.Generic.IEnumerable<TKey> System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>.Keys { get { throw null; } }
System.Collections.Generic.IEnumerable<TValue> System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>.Values { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
bool System.Collections.IDictionary.IsFixedSize { get { throw null; } }
bool System.Collections.IDictionary.IsReadOnly { get { throw null; } }
object? System.Collections.IDictionary.this[object key] { get { throw null; } set { } }
System.Collections.ICollection System.Collections.IDictionary.Keys { get { throw null; } }
System.Collections.ICollection System.Collections.IDictionary.Values { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>.ValueCollection Values { get { throw null; } }
public bool ContainsKey(TKey key) { throw null; }
public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> GetEnumerator() { throw null; }
void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Add(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { }
void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Clear() { }
bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Contains(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { throw null; }
void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.CopyTo(System.Collections.Generic.KeyValuePair<TKey, TValue>[] array, int arrayIndex) { }
bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>.Remove(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { throw null; }
void System.Collections.Generic.IDictionary<TKey, TValue>.Add(TKey key, TValue value) { }
bool System.Collections.Generic.IDictionary<TKey, TValue>.Remove(TKey key) { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
void System.Collections.IDictionary.Add(object key, object? value) { }
void System.Collections.IDictionary.Clear() { }
bool System.Collections.IDictionary.Contains(object key) { throw null; }
System.Collections.IDictionaryEnumerator System.Collections.IDictionary.GetEnumerator() { throw null; }
void System.Collections.IDictionary.Remove(object key) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; }
public sealed partial class KeyCollection : System.Collections.Generic.ICollection<TKey>, System.Collections.Generic.IEnumerable<TKey>, System.Collections.Generic.IReadOnlyCollection<TKey>, System.Collections.ICollection, System.Collections.IEnumerable
{
internal KeyCollection() { }
public int Count { get { throw null; } }
bool System.Collections.Generic.ICollection<TKey>.IsReadOnly { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
public void CopyTo(TKey[] array, int arrayIndex) { }
public System.Collections.Generic.IEnumerator<TKey> GetEnumerator() { throw null; }
void System.Collections.Generic.ICollection<TKey>.Add(TKey item) { }
void System.Collections.Generic.ICollection<TKey>.Clear() { }
bool System.Collections.Generic.ICollection<TKey>.Contains(TKey item) { throw null; }
bool System.Collections.Generic.ICollection<TKey>.Remove(TKey item) { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public sealed partial class ValueCollection : System.Collections.Generic.ICollection<TValue>, System.Collections.Generic.IEnumerable<TValue>, System.Collections.Generic.IReadOnlyCollection<TValue>, System.Collections.ICollection, System.Collections.IEnumerable
{
internal ValueCollection() { }
public int Count { get { throw null; } }
bool System.Collections.Generic.ICollection<TValue>.IsReadOnly { get { throw null; } }
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
object System.Collections.ICollection.SyncRoot { get { throw null; } }
public void CopyTo(TValue[] array, int arrayIndex) { }
public System.Collections.Generic.IEnumerator<TValue> GetEnumerator() { throw null; }
void System.Collections.Generic.ICollection<TValue>.Add(TValue item) { }
void System.Collections.Generic.ICollection<TValue>.Clear() { }
bool System.Collections.Generic.ICollection<TValue>.Contains(TValue item) { throw null; }
bool System.Collections.Generic.ICollection<TValue>.Remove(TValue item) { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
}
}
namespace System.ComponentModel
{
[System.AttributeUsageAttribute(System.AttributeTargets.All)]
public partial class DefaultValueAttribute : System.Attribute
{
public DefaultValueAttribute(bool value) { }
public DefaultValueAttribute(byte value) { }
public DefaultValueAttribute(char value) { }
public DefaultValueAttribute(double value) { }
public DefaultValueAttribute(short value) { }
public DefaultValueAttribute(int value) { }
public DefaultValueAttribute(long value) { }
public DefaultValueAttribute(object? value) { }
[System.CLSCompliantAttribute(false)]
public DefaultValueAttribute(sbyte value) { }
public DefaultValueAttribute(float value) { }
public DefaultValueAttribute(string? value) { }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
public DefaultValueAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type, string? value) { }
[System.CLSCompliantAttribute(false)]
public DefaultValueAttribute(ushort value) { }
[System.CLSCompliantAttribute(false)]
public DefaultValueAttribute(uint value) { }
[System.CLSCompliantAttribute(false)]
public DefaultValueAttribute(ulong value) { }
public virtual object? Value { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
protected void SetValue(object? value) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct)]
public sealed partial class EditorBrowsableAttribute : System.Attribute
{
public EditorBrowsableAttribute() { }
public EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState state) { }
public System.ComponentModel.EditorBrowsableState State { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public enum EditorBrowsableState
{
Always = 0,
Never = 1,
Advanced = 2,
}
}
namespace System.Configuration.Assemblies
{
public enum AssemblyHashAlgorithm
{
None = 0,
MD5 = 32771,
SHA1 = 32772,
SHA256 = 32780,
SHA384 = 32781,
SHA512 = 32782,
}
public enum AssemblyVersionCompatibility
{
SameMachine = 1,
SameProcess = 2,
SameDomain = 3,
}
}
namespace System.Diagnostics
{
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true)]
public sealed partial class ConditionalAttribute : System.Attribute
{
public ConditionalAttribute(string conditionString) { }
public string ConditionString { get { throw null; } }
}
public static partial class Debug
{
public static bool AutoFlush { get { throw null; } set { } }
public static int IndentLevel { get { throw null; } set { } }
public static int IndentSize { get { throw null; } set { } }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.AssertInterpolatedStringHandler message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.AssertInterpolatedStringHandler message, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.AssertInterpolatedStringHandler detailMessage) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, string? message, string? detailMessage) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Assert([System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute(false)] bool condition, string? message, string detailMessageFormat, params object?[] args) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Close() { }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Fail(string? message) => throw null;
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Fail(string? message, string? detailMessage) => throw null;
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Flush() { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Indent() { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Print(string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Print(string format, params object?[] args) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Unindent() { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Write(object? value) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Write(object? value, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Write(string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void Write(string? message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.WriteIfInterpolatedStringHandler message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.WriteIfInterpolatedStringHandler message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, object? value) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, object? value, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteIf(bool condition, string? message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(object? value) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(object? value, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(string format, params object?[] args) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLine(string? message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.WriteIfInterpolatedStringHandler message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("condition")] ref System.Diagnostics.Debug.WriteIfInterpolatedStringHandler message, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, object? value) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, object? value, string? category) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, string? message) { }
[System.Diagnostics.ConditionalAttribute("DEBUG")]
public static void WriteLineIf(bool condition, string? message, string? category) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute]
public partial struct AssertInterpolatedStringHandler
{
private object _dummy;
private int _dummyPrimitive;
public AssertInterpolatedStringHandler(int literalLength, int formattedCount, bool condition, out bool shouldAppend) { throw null; }
public void AppendFormatted(object? value, int alignment = 0, string? format = null) { }
public void AppendFormatted(System.ReadOnlySpan<char> value) { }
public void AppendFormatted(System.ReadOnlySpan<char> value, int alignment = 0, string? format = null) { }
public void AppendFormatted(string? value) { }
public void AppendFormatted(string? value, int alignment = 0, string? format = null) { }
public void AppendFormatted<T>(T value) { }
public void AppendFormatted<T>(T value, int alignment) { }
public void AppendFormatted<T>(T value, int alignment, string? format) { }
public void AppendFormatted<T>(T value, string? format) { }
public void AppendLiteral(string value) { }
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute]
public partial struct WriteIfInterpolatedStringHandler
{
private object _dummy;
private int _dummyPrimitive;
public WriteIfInterpolatedStringHandler(int literalLength, int formattedCount, bool condition, out bool shouldAppend) { throw null; }
public void AppendFormatted(object? value, int alignment = 0, string? format = null) { }
public void AppendFormatted(System.ReadOnlySpan<char> value) { }
public void AppendFormatted(System.ReadOnlySpan<char> value, int alignment = 0, string? format = null) { }
public void AppendFormatted(string? value) { }
public void AppendFormatted(string? value, int alignment = 0, string? format = null) { }
public void AppendFormatted<T>(T value) { }
public void AppendFormatted<T>(T value, int alignment) { }
public void AppendFormatted<T>(T value, int alignment, string? format) { }
public void AppendFormatted<T>(T value, string? format) { }
public void AppendLiteral(string value) { }
}
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Module, AllowMultiple=false)]
public sealed partial class DebuggableAttribute : System.Attribute
{
public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) { }
public DebuggableAttribute(System.Diagnostics.DebuggableAttribute.DebuggingModes modes) { }
public System.Diagnostics.DebuggableAttribute.DebuggingModes DebuggingFlags { get { throw null; } }
public bool IsJITOptimizerDisabled { get { throw null; } }
public bool IsJITTrackingEnabled { get { throw null; } }
[System.FlagsAttribute]
public enum DebuggingModes
{
None = 0,
Default = 1,
IgnoreSymbolStoreSequencePoints = 2,
EnableEditAndContinue = 4,
DisableOptimizations = 256,
}
}
public static partial class Debugger
{
public static readonly string? DefaultCategory;
public static bool IsAttached { get { throw null; } }
public static void Break() { }
public static bool IsLogging() { throw null; }
public static bool Launch() { throw null; }
public static void Log(int level, string? category, string? message) { }
public static void NotifyOfCrossThreadDependency() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple=false)]
public sealed partial class DebuggerBrowsableAttribute : System.Attribute
{
public DebuggerBrowsableAttribute(System.Diagnostics.DebuggerBrowsableState state) { }
public System.Diagnostics.DebuggerBrowsableState State { get { throw null; } }
}
public enum DebuggerBrowsableState
{
Never = 0,
Collapsed = 2,
RootHidden = 3,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=true)]
public sealed partial class DebuggerDisplayAttribute : System.Attribute
{
public DebuggerDisplayAttribute(string? value) { }
public string? Name { get { throw null; } set { } }
public System.Type? Target { get { throw null; } set { } }
public string? TargetTypeName { get { throw null; } set { } }
public string? Type { get { throw null; } set { } }
public string Value { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)]
public sealed partial class DebuggerHiddenAttribute : System.Attribute
{
public DebuggerHiddenAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class DebuggerNonUserCodeAttribute : System.Attribute
{
public DebuggerNonUserCodeAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class DebuggerStepperBoundaryAttribute : System.Attribute
{
public DebuggerStepperBoundaryAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class DebuggerStepThroughAttribute : System.Attribute
{
public DebuggerStepThroughAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=true)]
public sealed partial class DebuggerTypeProxyAttribute : System.Attribute
{
public DebuggerTypeProxyAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string typeName) { }
public DebuggerTypeProxyAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type type) { }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public string ProxyTypeName { get { throw null; } }
public System.Type? Target { get { throw null; } set { } }
public string? TargetTypeName { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=true)]
public sealed partial class DebuggerVisualizerAttribute : System.Attribute
{
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string visualizerTypeName) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string visualizerTypeName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string? visualizerObjectSourceTypeName) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string visualizerTypeName, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizerObjectSource) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizer) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizer, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] string? visualizerObjectSourceTypeName) { }
public DebuggerVisualizerAttribute([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizer, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type visualizerObjectSource) { }
public string? Description { get { throw null; } set { } }
public System.Type? Target { get { throw null; } set { } }
public string? TargetTypeName { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public string? VisualizerObjectSourceTypeName { get { throw null; } }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public string VisualizerTypeName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class StackTraceHiddenAttribute : System.Attribute
{
public StackTraceHiddenAttribute() { }
}
public partial class Stopwatch
{
public static readonly long Frequency;
public static readonly bool IsHighResolution;
public Stopwatch() { }
public System.TimeSpan Elapsed { get { throw null; } }
public long ElapsedMilliseconds { get { throw null; } }
public long ElapsedTicks { get { throw null; } }
public bool IsRunning { get { throw null; } }
public static long GetTimestamp() { throw null; }
public static System.TimeSpan GetElapsedTime(long startingTimestamp) { throw null; }
public static System.TimeSpan GetElapsedTime(long startingTimestamp, long endingTimestamp) { throw null; }
public void Reset() { }
public void Restart() { }
public void Start() { }
public static System.Diagnostics.Stopwatch StartNew() { throw null; }
public void Stop() { }
}
public sealed partial class UnreachableException : System.Exception
{
public UnreachableException() { }
public UnreachableException(string? message) { }
public UnreachableException(string? message, System.Exception? innerException) { }
}
}
namespace System.Diagnostics.CodeAnalysis
{
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, Inherited=false)]
public sealed partial class AllowNullAttribute : System.Attribute
{
public AllowNullAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class ConstantExpectedAttribute : System.Attribute
{
public ConstantExpectedAttribute() { }
public object? Max { get { throw null; } set { } }
public object? Min { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property, Inherited=false)]
public sealed partial class DisallowNullAttribute : System.Attribute
{
public DisallowNullAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class DoesNotReturnAttribute : System.Attribute
{
public DoesNotReturnAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class DoesNotReturnIfAttribute : System.Attribute
{
public DoesNotReturnIfAttribute(bool parameterValue) { }
public bool ParameterValue { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Field | System.AttributeTargets.GenericParameter | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class DynamicallyAccessedMembersAttribute : System.Attribute
{
public DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes) { }
public System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberTypes { get { throw null; } }
}
[System.FlagsAttribute]
public enum DynamicallyAccessedMemberTypes
{
All = -1,
None = 0,
PublicParameterlessConstructor = 1,
PublicConstructors = 3,
NonPublicConstructors = 4,
PublicMethods = 8,
NonPublicMethods = 16,
PublicFields = 32,
NonPublicFields = 64,
PublicNestedTypes = 128,
NonPublicNestedTypes = 256,
PublicProperties = 512,
NonPublicProperties = 1024,
PublicEvents = 2048,
NonPublicEvents = 4096,
Interfaces = 8192,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Field | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
public sealed partial class DynamicDependencyAttribute : System.Attribute
{
public DynamicDependencyAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName) { }
public DynamicDependencyAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes, System.Type type) { }
public DynamicDependencyAttribute(string memberSignature) { }
public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName) { }
public DynamicDependencyAttribute(string memberSignature, System.Type type) { }
public string? AssemblyName { get { throw null; } }
public string? Condition { get { throw null; } set { } }
public string? MemberSignature { get { throw null; } }
public System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberTypes { get { throw null; } }
public System.Type? Type { get { throw null; } }
public string? TypeName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
public sealed partial class ExcludeFromCodeCoverageAttribute : System.Attribute
{
public ExcludeFromCodeCoverageAttribute() { }
public string? Justification { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)]
public sealed partial class MaybeNullAttribute : System.Attribute
{
public MaybeNullAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class MaybeNullWhenAttribute : System.Attribute
{
public MaybeNullWhenAttribute(bool returnValue) { }
public bool ReturnValue { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false, AllowMultiple=true)]
public sealed partial class MemberNotNullAttribute : System.Attribute
{
public MemberNotNullAttribute(string member) { }
public MemberNotNullAttribute(params string[] members) { }
public string[] Members { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false, AllowMultiple=true)]
public sealed partial class MemberNotNullWhenAttribute : System.Attribute
{
public MemberNotNullWhenAttribute(bool returnValue, string member) { }
public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { }
public string[] Members { get { throw null; } }
public bool ReturnValue { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)]
public sealed partial class NotNullAttribute : System.Attribute
{
public NotNullAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, AllowMultiple=true, Inherited=false)]
public sealed partial class NotNullIfNotNullAttribute : System.Attribute
{
public NotNullIfNotNullAttribute(string parameterName) { }
public string ParameterName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class NotNullWhenAttribute : System.Attribute
{
public NotNullWhenAttribute(bool returnValue) { }
public bool ReturnValue { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false, AllowMultiple=false)]
public sealed partial class RequiresAssemblyFilesAttribute : System.Attribute
{
public RequiresAssemblyFilesAttribute() { }
public RequiresAssemblyFilesAttribute(string message) { }
public string? Message { get { throw null; } }
public string? Url { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class RequiresDynamicCodeAttribute : System.Attribute
{
public RequiresDynamicCodeAttribute(string message) { }
public string Message { get { throw null; } }
public string? Url { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class RequiresUnreferencedCodeAttribute : System.Attribute
{
public RequiresUnreferencedCodeAttribute(string message) { }
public string Message { get { throw null; } }
public string? Url { get { throw null; } set { } }
}
[System.AttributeUsage(System.AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
public sealed class SetsRequiredMembersAttribute : System.Attribute
{
public SetsRequiredMembersAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter | System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed partial class StringSyntaxAttribute : System.Attribute
{
public StringSyntaxAttribute(string syntax) { }
public StringSyntaxAttribute(string syntax, params object?[] arguments) { }
public string Syntax { get { throw null; } }
public object?[] Arguments { get { throw null; } }
public const string DateTimeFormat = "DateTimeFormat";
public const string Json = "Json";
public const string Regex = "Regex";
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=false, AllowMultiple=true)]
[System.Diagnostics.ConditionalAttribute("CODE_ANALYSIS")]
public sealed partial class SuppressMessageAttribute : System.Attribute
{
public SuppressMessageAttribute(string category, string checkId) { }
public string Category { get { throw null; } }
public string CheckId { get { throw null; } }
public string? Justification { get { throw null; } set { } }
public string? MessageId { get { throw null; } set { } }
public string? Scope { get { throw null; } set { } }
public string? Target { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=false, AllowMultiple=true)]
public sealed partial class UnconditionalSuppressMessageAttribute : System.Attribute
{
public UnconditionalSuppressMessageAttribute(string category, string checkId) { }
public string Category { get { throw null; } }
public string CheckId { get { throw null; } }
public string? Justification { get { throw null; } set { } }
public string? MessageId { get { throw null; } set { } }
public string? Scope { get { throw null; } set { } }
public string? Target { get { throw null; } set { } }
}
}
namespace System.Globalization
{
public abstract partial class Calendar : System.ICloneable
{
public const int CurrentEra = 0;
protected Calendar() { }
public virtual System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
protected virtual int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public abstract int[] Eras { get; }
public bool IsReadOnly { get { throw null; } }
public virtual System.DateTime MaxSupportedDateTime { get { throw null; } }
public virtual System.DateTime MinSupportedDateTime { get { throw null; } }
public virtual int TwoDigitYearMax { get { throw null; } set { } }
public virtual System.DateTime AddDays(System.DateTime time, int days) { throw null; }
public virtual System.DateTime AddHours(System.DateTime time, int hours) { throw null; }
public virtual System.DateTime AddMilliseconds(System.DateTime time, double milliseconds) { throw null; }
public virtual System.DateTime AddMinutes(System.DateTime time, int minutes) { throw null; }
public abstract System.DateTime AddMonths(System.DateTime time, int months);
public virtual System.DateTime AddSeconds(System.DateTime time, int seconds) { throw null; }
public virtual System.DateTime AddWeeks(System.DateTime time, int weeks) { throw null; }
public abstract System.DateTime AddYears(System.DateTime time, int years);
public virtual object Clone() { throw null; }
public abstract int GetDayOfMonth(System.DateTime time);
public abstract System.DayOfWeek GetDayOfWeek(System.DateTime time);
public abstract int GetDayOfYear(System.DateTime time);
public virtual int GetDaysInMonth(int year, int month) { throw null; }
public abstract int GetDaysInMonth(int year, int month, int era);
public virtual int GetDaysInYear(int year) { throw null; }
public abstract int GetDaysInYear(int year, int era);
public abstract int GetEra(System.DateTime time);
public virtual int GetHour(System.DateTime time) { throw null; }
public virtual int GetLeapMonth(int year) { throw null; }
public virtual int GetLeapMonth(int year, int era) { throw null; }
public virtual double GetMilliseconds(System.DateTime time) { throw null; }
public virtual int GetMinute(System.DateTime time) { throw null; }
public abstract int GetMonth(System.DateTime time);
public virtual int GetMonthsInYear(int year) { throw null; }
public abstract int GetMonthsInYear(int year, int era);
public virtual int GetSecond(System.DateTime time) { throw null; }
public virtual int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public abstract int GetYear(System.DateTime time);
public virtual bool IsLeapDay(int year, int month, int day) { throw null; }
public abstract bool IsLeapDay(int year, int month, int day, int era);
public virtual bool IsLeapMonth(int year, int month) { throw null; }
public abstract bool IsLeapMonth(int year, int month, int era);
public virtual bool IsLeapYear(int year) { throw null; }
public abstract bool IsLeapYear(int year, int era);
public static System.Globalization.Calendar ReadOnly(System.Globalization.Calendar calendar) { throw null; }
public virtual System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) { throw null; }
public abstract System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
public virtual int ToFourDigitYear(int year) { throw null; }
}
public enum CalendarAlgorithmType
{
Unknown = 0,
SolarCalendar = 1,
LunarCalendar = 2,
LunisolarCalendar = 3,
}
public enum CalendarWeekRule
{
FirstDay = 0,
FirstFullWeek = 1,
FirstFourDayWeek = 2,
}
public static partial class CharUnicodeInfo
{
public static int GetDecimalDigitValue(char ch) { throw null; }
public static int GetDecimalDigitValue(string s, int index) { throw null; }
public static int GetDigitValue(char ch) { throw null; }
public static int GetDigitValue(string s, int index) { throw null; }
public static double GetNumericValue(char ch) { throw null; }
public static double GetNumericValue(string s, int index) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(char ch) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(int codePoint) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(string s, int index) { throw null; }
}
public partial class ChineseLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
{
public const int ChineseEra = 1;
public ChineseLunisolarCalendar() { }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int GetEra(System.DateTime time) { throw null; }
}
public sealed partial class CompareInfo : System.Runtime.Serialization.IDeserializationCallback
{
internal CompareInfo() { }
public int LCID { get { throw null; } }
public string Name { get { throw null; } }
public System.Globalization.SortVersion Version { get { throw null; } }
public int Compare(System.ReadOnlySpan<char> string1, System.ReadOnlySpan<char> string2, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int Compare(string? string1, int offset1, int length1, string? string2, int offset2, int length2) { throw null; }
public int Compare(string? string1, int offset1, int length1, string? string2, int offset2, int length2, System.Globalization.CompareOptions options) { throw null; }
public int Compare(string? string1, int offset1, string? string2, int offset2) { throw null; }
public int Compare(string? string1, int offset1, string? string2, int offset2, System.Globalization.CompareOptions options) { throw null; }
public int Compare(string? string1, string? string2) { throw null; }
public int Compare(string? string1, string? string2, System.Globalization.CompareOptions options) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public static System.Globalization.CompareInfo GetCompareInfo(int culture) { throw null; }
public static System.Globalization.CompareInfo GetCompareInfo(int culture, System.Reflection.Assembly assembly) { throw null; }
public static System.Globalization.CompareInfo GetCompareInfo(string name) { throw null; }
public static System.Globalization.CompareInfo GetCompareInfo(string name, System.Reflection.Assembly assembly) { throw null; }
public override int GetHashCode() { throw null; }
public int GetHashCode(System.ReadOnlySpan<char> source, System.Globalization.CompareOptions options) { throw null; }
public int GetHashCode(string source, System.Globalization.CompareOptions options) { throw null; }
public int GetSortKey(System.ReadOnlySpan<char> source, System.Span<byte> destination, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public System.Globalization.SortKey GetSortKey(string source) { throw null; }
public System.Globalization.SortKey GetSortKey(string source, System.Globalization.CompareOptions options) { throw null; }
public int GetSortKeyLength(System.ReadOnlySpan<char> source, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int IndexOf(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> value, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int IndexOf(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> value, System.Globalization.CompareOptions options, out int matchLength) { throw null; }
public int IndexOf(System.ReadOnlySpan<char> source, System.Text.Rune value, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int IndexOf(string source, char value) { throw null; }
public int IndexOf(string source, char value, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, char value, int startIndex) { throw null; }
public int IndexOf(string source, char value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, char value, int startIndex, int count) { throw null; }
public int IndexOf(string source, char value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, string value) { throw null; }
public int IndexOf(string source, string value, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, string value, int startIndex) { throw null; }
public int IndexOf(string source, string value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
public int IndexOf(string source, string value, int startIndex, int count) { throw null; }
public int IndexOf(string source, string value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
public bool IsPrefix(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> prefix, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public bool IsPrefix(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> prefix, System.Globalization.CompareOptions options, out int matchLength) { throw null; }
public bool IsPrefix(string source, string prefix) { throw null; }
public bool IsPrefix(string source, string prefix, System.Globalization.CompareOptions options) { throw null; }
public static bool IsSortable(char ch) { throw null; }
public static bool IsSortable(System.ReadOnlySpan<char> text) { throw null; }
public static bool IsSortable(string text) { throw null; }
public static bool IsSortable(System.Text.Rune value) { throw null; }
public bool IsSuffix(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> suffix, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public bool IsSuffix(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> suffix, System.Globalization.CompareOptions options, out int matchLength) { throw null; }
public bool IsSuffix(string source, string suffix) { throw null; }
public bool IsSuffix(string source, string suffix, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> value, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int LastIndexOf(System.ReadOnlySpan<char> source, System.ReadOnlySpan<char> value, System.Globalization.CompareOptions options, out int matchLength) { throw null; }
public int LastIndexOf(System.ReadOnlySpan<char> source, System.Text.Rune value, System.Globalization.CompareOptions options = System.Globalization.CompareOptions.None) { throw null; }
public int LastIndexOf(string source, char value) { throw null; }
public int LastIndexOf(string source, char value, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, char value, int startIndex) { throw null; }
public int LastIndexOf(string source, char value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, char value, int startIndex, int count) { throw null; }
public int LastIndexOf(string source, char value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, string value) { throw null; }
public int LastIndexOf(string source, string value, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, string value, int startIndex) { throw null; }
public int LastIndexOf(string source, string value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
public int LastIndexOf(string source, string value, int startIndex, int count) { throw null; }
public int LastIndexOf(string source, string value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum CompareOptions
{
None = 0,
IgnoreCase = 1,
IgnoreNonSpace = 2,
IgnoreSymbols = 4,
IgnoreKanaType = 8,
IgnoreWidth = 16,
OrdinalIgnoreCase = 268435456,
StringSort = 536870912,
Ordinal = 1073741824,
}
public partial class CultureInfo : System.ICloneable, System.IFormatProvider
{
public CultureInfo(int culture) { }
public CultureInfo(int culture, bool useUserOverride) { }
public CultureInfo(string name) { }
public CultureInfo(string name, bool useUserOverride) { }
public virtual System.Globalization.Calendar Calendar { get { throw null; } }
public virtual System.Globalization.CompareInfo CompareInfo { get { throw null; } }
public System.Globalization.CultureTypes CultureTypes { get { throw null; } }
public static System.Globalization.CultureInfo CurrentCulture { get { throw null; } set { } }
public static System.Globalization.CultureInfo CurrentUICulture { get { throw null; } set { } }
public virtual System.Globalization.DateTimeFormatInfo DateTimeFormat { get { throw null; } set { } }
public static System.Globalization.CultureInfo? DefaultThreadCurrentCulture { get { throw null; } set { } }
public static System.Globalization.CultureInfo? DefaultThreadCurrentUICulture { get { throw null; } set { } }
public virtual string DisplayName { get { throw null; } }
public virtual string EnglishName { get { throw null; } }
public string IetfLanguageTag { get { throw null; } }
public static System.Globalization.CultureInfo InstalledUICulture { get { throw null; } }
public static System.Globalization.CultureInfo InvariantCulture { get { throw null; } }
public virtual bool IsNeutralCulture { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public virtual int KeyboardLayoutId { get { throw null; } }
public virtual int LCID { get { throw null; } }
public virtual string Name { get { throw null; } }
public virtual string NativeName { get { throw null; } }
public virtual System.Globalization.NumberFormatInfo NumberFormat { get { throw null; } set { } }
public virtual System.Globalization.Calendar[] OptionalCalendars { get { throw null; } }
public virtual System.Globalization.CultureInfo Parent { get { throw null; } }
public virtual System.Globalization.TextInfo TextInfo { get { throw null; } }
public virtual string ThreeLetterISOLanguageName { get { throw null; } }
public virtual string ThreeLetterWindowsLanguageName { get { throw null; } }
public virtual string TwoLetterISOLanguageName { get { throw null; } }
public bool UseUserOverride { get { throw null; } }
public void ClearCachedData() { }
public virtual object Clone() { throw null; }
public static System.Globalization.CultureInfo CreateSpecificCulture(string name) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public System.Globalization.CultureInfo GetConsoleFallbackUICulture() { throw null; }
public static System.Globalization.CultureInfo GetCultureInfo(int culture) { throw null; }
public static System.Globalization.CultureInfo GetCultureInfo(string name) { throw null; }
public static System.Globalization.CultureInfo GetCultureInfo(string name, bool predefinedOnly) { throw null; }
public static System.Globalization.CultureInfo GetCultureInfo(string name, string altName) { throw null; }
public static System.Globalization.CultureInfo GetCultureInfoByIetfLanguageTag(string name) { throw null; }
public static System.Globalization.CultureInfo[] GetCultures(System.Globalization.CultureTypes types) { throw null; }
public virtual object? GetFormat(System.Type? formatType) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Globalization.CultureInfo ReadOnly(System.Globalization.CultureInfo ci) { throw null; }
public override string ToString() { throw null; }
}
public partial class CultureNotFoundException : System.ArgumentException
{
public CultureNotFoundException() { }
protected CultureNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public CultureNotFoundException(string? message) { }
public CultureNotFoundException(string? message, System.Exception? innerException) { }
public CultureNotFoundException(string? message, int invalidCultureId, System.Exception? innerException) { }
public CultureNotFoundException(string? paramName, int invalidCultureId, string? message) { }
public CultureNotFoundException(string? paramName, string? message) { }
public CultureNotFoundException(string? message, string? invalidCultureName, System.Exception? innerException) { }
public CultureNotFoundException(string? paramName, string? invalidCultureName, string? message) { }
public virtual int? InvalidCultureId { get { throw null; } }
public virtual string? InvalidCultureName { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
[System.FlagsAttribute]
public enum CultureTypes
{
NeutralCultures = 1,
SpecificCultures = 2,
InstalledWin32Cultures = 4,
AllCultures = 7,
UserCustomCulture = 8,
ReplacementCultures = 16,
[System.ObsoleteAttribute("CultureTypes.WindowsOnlyCultures has been deprecated. Use other values in CultureTypes instead.")]
WindowsOnlyCultures = 32,
[System.ObsoleteAttribute("CultureTypes.FrameworkCultures has been deprecated. Use other values in CultureTypes instead.")]
FrameworkCultures = 64,
}
public sealed partial class DateTimeFormatInfo : System.ICloneable, System.IFormatProvider
{
public DateTimeFormatInfo() { }
public string[] AbbreviatedDayNames { get { throw null; } set { } }
public string[] AbbreviatedMonthGenitiveNames { get { throw null; } set { } }
public string[] AbbreviatedMonthNames { get { throw null; } set { } }
public string AMDesignator { get { throw null; } set { } }
public System.Globalization.Calendar Calendar { get { throw null; } set { } }
public System.Globalization.CalendarWeekRule CalendarWeekRule { get { throw null; } set { } }
public static System.Globalization.DateTimeFormatInfo CurrentInfo { get { throw null; } }
public string DateSeparator { get { throw null; } set { } }
public string[] DayNames { get { throw null; } set { } }
public System.DayOfWeek FirstDayOfWeek { get { throw null; } set { } }
public string FullDateTimePattern { get { throw null; } set { } }
public static System.Globalization.DateTimeFormatInfo InvariantInfo { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public string LongDatePattern { get { throw null; } set { } }
public string LongTimePattern { get { throw null; } set { } }
public string MonthDayPattern { get { throw null; } set { } }
public string[] MonthGenitiveNames { get { throw null; } set { } }
public string[] MonthNames { get { throw null; } set { } }
public string NativeCalendarName { get { throw null; } }
public string PMDesignator { get { throw null; } set { } }
public string RFC1123Pattern { get { throw null; } }
public string ShortDatePattern { get { throw null; } set { } }
public string[] ShortestDayNames { get { throw null; } set { } }
public string ShortTimePattern { get { throw null; } set { } }
public string SortableDateTimePattern { get { throw null; } }
public string TimeSeparator { get { throw null; } set { } }
public string UniversalSortableDateTimePattern { get { throw null; } }
public string YearMonthPattern { get { throw null; } set { } }
public object Clone() { throw null; }
public string GetAbbreviatedDayName(System.DayOfWeek dayofweek) { throw null; }
public string GetAbbreviatedEraName(int era) { throw null; }
public string GetAbbreviatedMonthName(int month) { throw null; }
public string[] GetAllDateTimePatterns() { throw null; }
public string[] GetAllDateTimePatterns(char format) { throw null; }
public string GetDayName(System.DayOfWeek dayofweek) { throw null; }
public int GetEra(string eraName) { throw null; }
public string GetEraName(int era) { throw null; }
public object? GetFormat(System.Type? formatType) { throw null; }
public static System.Globalization.DateTimeFormatInfo GetInstance(System.IFormatProvider? provider) { throw null; }
public string GetMonthName(int month) { throw null; }
public string GetShortestDayName(System.DayOfWeek dayOfWeek) { throw null; }
public static System.Globalization.DateTimeFormatInfo ReadOnly(System.Globalization.DateTimeFormatInfo dtfi) { throw null; }
public void SetAllDateTimePatterns(string[] patterns, char format) { }
}
[System.FlagsAttribute]
public enum DateTimeStyles
{
None = 0,
AllowLeadingWhite = 1,
AllowTrailingWhite = 2,
AllowInnerWhite = 4,
AllowWhiteSpaces = 7,
NoCurrentDateDefault = 8,
AdjustToUniversal = 16,
AssumeLocal = 32,
AssumeUniversal = 64,
RoundtripKind = 128,
}
public partial class DaylightTime
{
public DaylightTime(System.DateTime start, System.DateTime end, System.TimeSpan delta) { }
public System.TimeSpan Delta { get { throw null; } }
public System.DateTime End { get { throw null; } }
public System.DateTime Start { get { throw null; } }
}
public enum DigitShapes
{
Context = 0,
None = 1,
NativeNational = 2,
}
public abstract partial class EastAsianLunisolarCalendar : System.Globalization.Calendar
{
internal EastAsianLunisolarCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public int GetCelestialStem(int sexagenaryYear) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public virtual int GetSexagenaryYear(System.DateTime time) { throw null; }
public int GetTerrestrialBranch(int sexagenaryYear) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public static partial class GlobalizationExtensions
{
public static System.StringComparer GetStringComparer(this System.Globalization.CompareInfo compareInfo, System.Globalization.CompareOptions options) { throw null; }
}
public partial class GregorianCalendar : System.Globalization.Calendar
{
public const int ADEra = 1;
public GregorianCalendar() { }
public GregorianCalendar(System.Globalization.GregorianCalendarTypes type) { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public virtual System.Globalization.GregorianCalendarTypes CalendarType { get { throw null; } set { } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public enum GregorianCalendarTypes
{
Localized = 1,
USEnglish = 2,
MiddleEastFrench = 9,
Arabic = 10,
TransliteratedEnglish = 11,
TransliteratedFrench = 12,
}
public partial class HebrewCalendar : System.Globalization.Calendar
{
public static readonly int HebrewEra;
public HebrewCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class HijriCalendar : System.Globalization.Calendar
{
public static readonly int HijriEra;
public HijriCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public int HijriAdjustment { get { throw null; } set { } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public sealed partial class IdnMapping
{
public IdnMapping() { }
public bool AllowUnassigned { get { throw null; } set { } }
public bool UseStd3AsciiRules { get { throw null; } set { } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public string GetAscii(string unicode) { throw null; }
public string GetAscii(string unicode, int index) { throw null; }
public string GetAscii(string unicode, int index, int count) { throw null; }
public override int GetHashCode() { throw null; }
public string GetUnicode(string ascii) { throw null; }
public string GetUnicode(string ascii, int index) { throw null; }
public string GetUnicode(string ascii, int index, int count) { throw null; }
}
public static partial class ISOWeek
{
public static int GetWeekOfYear(System.DateTime date) { throw null; }
public static int GetWeeksInYear(int year) { throw null; }
public static int GetYear(System.DateTime date) { throw null; }
public static System.DateTime GetYearEnd(int year) { throw null; }
public static System.DateTime GetYearStart(int year) { throw null; }
public static System.DateTime ToDateTime(int year, int week, System.DayOfWeek dayOfWeek) { throw null; }
}
public partial class JapaneseCalendar : System.Globalization.Calendar
{
public JapaneseCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class JapaneseLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
{
public const int JapaneseEra = 1;
public JapaneseLunisolarCalendar() { }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int GetEra(System.DateTime time) { throw null; }
}
public partial class JulianCalendar : System.Globalization.Calendar
{
public static readonly int JulianEra;
public JulianCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class KoreanCalendar : System.Globalization.Calendar
{
public const int KoreanEra = 1;
public KoreanCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class KoreanLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
{
public const int GregorianEra = 1;
public KoreanLunisolarCalendar() { }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int GetEra(System.DateTime time) { throw null; }
}
public sealed partial class NumberFormatInfo : System.ICloneable, System.IFormatProvider
{
public NumberFormatInfo() { }
public int CurrencyDecimalDigits { get { throw null; } set { } }
public string CurrencyDecimalSeparator { get { throw null; } set { } }
public string CurrencyGroupSeparator { get { throw null; } set { } }
public int[] CurrencyGroupSizes { get { throw null; } set { } }
public int CurrencyNegativePattern { get { throw null; } set { } }
public int CurrencyPositivePattern { get { throw null; } set { } }
public string CurrencySymbol { get { throw null; } set { } }
public static System.Globalization.NumberFormatInfo CurrentInfo { get { throw null; } }
public System.Globalization.DigitShapes DigitSubstitution { get { throw null; } set { } }
public static System.Globalization.NumberFormatInfo InvariantInfo { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public string NaNSymbol { get { throw null; } set { } }
public string[] NativeDigits { get { throw null; } set { } }
public string NegativeInfinitySymbol { get { throw null; } set { } }
public string NegativeSign { get { throw null; } set { } }
public int NumberDecimalDigits { get { throw null; } set { } }
public string NumberDecimalSeparator { get { throw null; } set { } }
public string NumberGroupSeparator { get { throw null; } set { } }
public int[] NumberGroupSizes { get { throw null; } set { } }
public int NumberNegativePattern { get { throw null; } set { } }
public int PercentDecimalDigits { get { throw null; } set { } }
public string PercentDecimalSeparator { get { throw null; } set { } }
public string PercentGroupSeparator { get { throw null; } set { } }
public int[] PercentGroupSizes { get { throw null; } set { } }
public int PercentNegativePattern { get { throw null; } set { } }
public int PercentPositivePattern { get { throw null; } set { } }
public string PercentSymbol { get { throw null; } set { } }
public string PerMilleSymbol { get { throw null; } set { } }
public string PositiveInfinitySymbol { get { throw null; } set { } }
public string PositiveSign { get { throw null; } set { } }
public object Clone() { throw null; }
public object? GetFormat(System.Type? formatType) { throw null; }
public static System.Globalization.NumberFormatInfo GetInstance(System.IFormatProvider? formatProvider) { throw null; }
public static System.Globalization.NumberFormatInfo ReadOnly(System.Globalization.NumberFormatInfo nfi) { throw null; }
}
[System.FlagsAttribute]
public enum NumberStyles
{
None = 0,
AllowLeadingWhite = 1,
AllowTrailingWhite = 2,
AllowLeadingSign = 4,
Integer = 7,
AllowTrailingSign = 8,
AllowParentheses = 16,
AllowDecimalPoint = 32,
AllowThousands = 64,
Number = 111,
AllowExponent = 128,
Float = 167,
AllowCurrencySymbol = 256,
Currency = 383,
Any = 511,
AllowHexSpecifier = 512,
HexNumber = 515,
}
public partial class PersianCalendar : System.Globalization.Calendar
{
public static readonly int PersianEra;
public PersianCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class RegionInfo
{
public RegionInfo(int culture) { }
public RegionInfo(string name) { }
public virtual string CurrencyEnglishName { get { throw null; } }
public virtual string CurrencyNativeName { get { throw null; } }
public virtual string CurrencySymbol { get { throw null; } }
public static System.Globalization.RegionInfo CurrentRegion { get { throw null; } }
public virtual string DisplayName { get { throw null; } }
public virtual string EnglishName { get { throw null; } }
public virtual int GeoId { get { throw null; } }
public virtual bool IsMetric { get { throw null; } }
public virtual string ISOCurrencySymbol { get { throw null; } }
public virtual string Name { get { throw null; } }
public virtual string NativeName { get { throw null; } }
public virtual string ThreeLetterISORegionName { get { throw null; } }
public virtual string ThreeLetterWindowsRegionName { get { throw null; } }
public virtual string TwoLetterISORegionName { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public sealed partial class SortKey
{
internal SortKey() { }
public byte[] KeyData { get { throw null; } }
public string OriginalString { get { throw null; } }
public static int Compare(System.Globalization.SortKey sortkey1, System.Globalization.SortKey sortkey2) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public sealed partial class SortVersion : System.IEquatable<System.Globalization.SortVersion?>
{
public SortVersion(int fullVersion, System.Guid sortId) { }
public int FullVersion { get { throw null; } }
public System.Guid SortId { get { throw null; } }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Globalization.SortVersion? other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Globalization.SortVersion? left, System.Globalization.SortVersion? right) { throw null; }
public static bool operator !=(System.Globalization.SortVersion? left, System.Globalization.SortVersion? right) { throw null; }
}
public partial class StringInfo
{
public StringInfo() { }
public StringInfo(string value) { }
public int LengthInTextElements { get { throw null; } }
public string String { get { throw null; } set { } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
public static string GetNextTextElement(string str) { throw null; }
public static string GetNextTextElement(string str, int index) { throw null; }
public static int GetNextTextElementLength(System.ReadOnlySpan<char> str) { throw null; }
public static int GetNextTextElementLength(string str) { throw null; }
public static int GetNextTextElementLength(string str, int index) { throw null; }
public static System.Globalization.TextElementEnumerator GetTextElementEnumerator(string str) { throw null; }
public static System.Globalization.TextElementEnumerator GetTextElementEnumerator(string str, int index) { throw null; }
public static int[] ParseCombiningCharacters(string str) { throw null; }
public string SubstringByTextElements(int startingTextElement) { throw null; }
public string SubstringByTextElements(int startingTextElement, int lengthInTextElements) { throw null; }
}
public partial class TaiwanCalendar : System.Globalization.Calendar
{
public TaiwanCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public partial class TaiwanLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
{
public TaiwanLunisolarCalendar() { }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int GetEra(System.DateTime time) { throw null; }
}
public partial class TextElementEnumerator : System.Collections.IEnumerator
{
internal TextElementEnumerator() { }
public object Current { get { throw null; } }
public int ElementIndex { get { throw null; } }
public string GetTextElement() { throw null; }
public bool MoveNext() { throw null; }
public void Reset() { }
}
public sealed partial class TextInfo : System.ICloneable, System.Runtime.Serialization.IDeserializationCallback
{
internal TextInfo() { }
public int ANSICodePage { get { throw null; } }
public string CultureName { get { throw null; } }
public int EBCDICCodePage { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public bool IsRightToLeft { get { throw null; } }
public int LCID { get { throw null; } }
public string ListSeparator { get { throw null; } set { } }
public int MacCodePage { get { throw null; } }
public int OEMCodePage { get { throw null; } }
public object Clone() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static System.Globalization.TextInfo ReadOnly(System.Globalization.TextInfo textInfo) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
public char ToLower(char c) { throw null; }
public string ToLower(string str) { throw null; }
public override string ToString() { throw null; }
public string ToTitleCase(string str) { throw null; }
public char ToUpper(char c) { throw null; }
public string ToUpper(string str) { throw null; }
}
public partial class ThaiBuddhistCalendar : System.Globalization.Calendar
{
public const int ThaiBuddhistEra = 1;
public ThaiBuddhistCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
[System.FlagsAttribute]
public enum TimeSpanStyles
{
None = 0,
AssumeNegative = 1,
}
public partial class UmAlQuraCalendar : System.Globalization.Calendar
{
public const int UmAlQuraEra = 1;
public UmAlQuraCalendar() { }
public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
public override int[] Eras { get { throw null; } }
public override System.DateTime MaxSupportedDateTime { get { throw null; } }
public override System.DateTime MinSupportedDateTime { get { throw null; } }
public override int TwoDigitYearMax { get { throw null; } set { } }
public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
public override int GetDayOfMonth(System.DateTime time) { throw null; }
public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
public override int GetDayOfYear(System.DateTime time) { throw null; }
public override int GetDaysInMonth(int year, int month, int era) { throw null; }
public override int GetDaysInYear(int year, int era) { throw null; }
public override int GetEra(System.DateTime time) { throw null; }
public override int GetLeapMonth(int year, int era) { throw null; }
public override int GetMonth(System.DateTime time) { throw null; }
public override int GetMonthsInYear(int year, int era) { throw null; }
public override int GetYear(System.DateTime time) { throw null; }
public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
public override bool IsLeapMonth(int year, int month, int era) { throw null; }
public override bool IsLeapYear(int year, int era) { throw null; }
public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
public override int ToFourDigitYear(int year) { throw null; }
}
public enum UnicodeCategory
{
UppercaseLetter = 0,
LowercaseLetter = 1,
TitlecaseLetter = 2,
ModifierLetter = 3,
OtherLetter = 4,
NonSpacingMark = 5,
SpacingCombiningMark = 6,
EnclosingMark = 7,
DecimalDigitNumber = 8,
LetterNumber = 9,
OtherNumber = 10,
SpaceSeparator = 11,
LineSeparator = 12,
ParagraphSeparator = 13,
Control = 14,
Format = 15,
Surrogate = 16,
PrivateUse = 17,
ConnectorPunctuation = 18,
DashPunctuation = 19,
OpenPunctuation = 20,
ClosePunctuation = 21,
InitialQuotePunctuation = 22,
FinalQuotePunctuation = 23,
OtherPunctuation = 24,
MathSymbol = 25,
CurrencySymbol = 26,
ModifierSymbol = 27,
OtherSymbol = 28,
OtherNotAssigned = 29,
}
}
namespace System.IO
{
public partial class BinaryReader : System.IDisposable
{
public BinaryReader(System.IO.Stream input) { }
public BinaryReader(System.IO.Stream input, System.Text.Encoding encoding) { }
public BinaryReader(System.IO.Stream input, System.Text.Encoding encoding, bool leaveOpen) { }
public virtual System.IO.Stream BaseStream { get { throw null; } }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
protected virtual void FillBuffer(int numBytes) { }
public virtual int PeekChar() { throw null; }
public virtual int Read() { throw null; }
public virtual int Read(byte[] buffer, int index, int count) { throw null; }
public virtual int Read(char[] buffer, int index, int count) { throw null; }
public virtual int Read(System.Span<byte> buffer) { throw null; }
public virtual int Read(System.Span<char> buffer) { throw null; }
public int Read7BitEncodedInt() { throw null; }
public long Read7BitEncodedInt64() { throw null; }
public virtual bool ReadBoolean() { throw null; }
public virtual byte ReadByte() { throw null; }
public virtual byte[] ReadBytes(int count) { throw null; }
public virtual char ReadChar() { throw null; }
public virtual char[] ReadChars(int count) { throw null; }
public virtual decimal ReadDecimal() { throw null; }
public virtual double ReadDouble() { throw null; }
public virtual System.Half ReadHalf() { throw null; }
public virtual short ReadInt16() { throw null; }
public virtual int ReadInt32() { throw null; }
public virtual long ReadInt64() { throw null; }
[System.CLSCompliantAttribute(false)]
public virtual sbyte ReadSByte() { throw null; }
public virtual float ReadSingle() { throw null; }
public virtual string ReadString() { throw null; }
[System.CLSCompliantAttribute(false)]
public virtual ushort ReadUInt16() { throw null; }
[System.CLSCompliantAttribute(false)]
public virtual uint ReadUInt32() { throw null; }
[System.CLSCompliantAttribute(false)]
public virtual ulong ReadUInt64() { throw null; }
}
public partial class BinaryWriter : System.IAsyncDisposable, System.IDisposable
{
public static readonly System.IO.BinaryWriter Null;
protected System.IO.Stream OutStream;
protected BinaryWriter() { }
public BinaryWriter(System.IO.Stream output) { }
public BinaryWriter(System.IO.Stream output, System.Text.Encoding encoding) { }
public BinaryWriter(System.IO.Stream output, System.Text.Encoding encoding, bool leaveOpen) { }
public virtual System.IO.Stream BaseStream { get { throw null; } }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public virtual void Flush() { }
public virtual long Seek(int offset, System.IO.SeekOrigin origin) { throw null; }
public virtual void Write(bool value) { }
public virtual void Write(byte value) { }
public virtual void Write(byte[] buffer) { }
public virtual void Write(byte[] buffer, int index, int count) { }
public virtual void Write(char ch) { }
public virtual void Write(char[] chars) { }
public virtual void Write(char[] chars, int index, int count) { }
public virtual void Write(decimal value) { }
public virtual void Write(double value) { }
public virtual void Write(System.Half value) { }
public virtual void Write(short value) { }
public virtual void Write(int value) { }
public virtual void Write(long value) { }
public virtual void Write(System.ReadOnlySpan<byte> buffer) { }
public virtual void Write(System.ReadOnlySpan<char> chars) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(sbyte value) { }
public virtual void Write(float value) { }
public virtual void Write(string value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(ushort value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(uint value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(ulong value) { }
public void Write7BitEncodedInt(int value) { }
public void Write7BitEncodedInt64(long value) { }
}
public sealed partial class BufferedStream : System.IO.Stream
{
public BufferedStream(System.IO.Stream stream) { }
public BufferedStream(System.IO.Stream stream, int bufferSize) { }
public int BufferSize { get { throw null; } }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
public override long Length { get { throw null; } }
public override long Position { get { throw null; } set { } }
public System.IO.Stream UnderlyingStream { get { throw null; } }
public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override void CopyTo(System.IO.Stream destination, int bufferSize) { }
public override System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override int EndRead(System.IAsyncResult asyncResult) { throw null; }
public override void EndWrite(System.IAsyncResult asyncResult) { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> destination) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteByte(byte value) { }
}
public static partial class Directory
{
public static System.IO.DirectoryInfo CreateDirectory(string path) { throw null; }
public static System.IO.FileSystemInfo CreateSymbolicLink(string path, string pathToTarget) { throw null; }
public static void Delete(string path) { }
public static void Delete(string path, bool recursive) { }
public static System.Collections.Generic.IEnumerable<string> EnumerateDirectories(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateDirectories(string path, string searchPattern) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateDirectories(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateDirectories(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFiles(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFiles(string path, string searchPattern) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFiles(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFiles(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFileSystemEntries(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static System.Collections.Generic.IEnumerable<string> EnumerateFileSystemEntries(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; }
public static System.DateTime GetCreationTime(string path) { throw null; }
public static System.DateTime GetCreationTimeUtc(string path) { throw null; }
public static string GetCurrentDirectory() { throw null; }
public static string[] GetDirectories(string path) { throw null; }
public static string[] GetDirectories(string path, string searchPattern) { throw null; }
public static string[] GetDirectories(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static string[] GetDirectories(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static string GetDirectoryRoot(string path) { throw null; }
public static string[] GetFiles(string path) { throw null; }
public static string[] GetFiles(string path, string searchPattern) { throw null; }
public static string[] GetFiles(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static string[] GetFiles(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static string[] GetFileSystemEntries(string path) { throw null; }
public static string[] GetFileSystemEntries(string path, string searchPattern) { throw null; }
public static string[] GetFileSystemEntries(string path, string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public static string[] GetFileSystemEntries(string path, string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public static System.DateTime GetLastAccessTime(string path) { throw null; }
public static System.DateTime GetLastAccessTimeUtc(string path) { throw null; }
public static System.DateTime GetLastWriteTime(string path) { throw null; }
public static System.DateTime GetLastWriteTimeUtc(string path) { throw null; }
public static string[] GetLogicalDrives() { throw null; }
public static System.IO.DirectoryInfo? GetParent(string path) { throw null; }
public static void Move(string sourceDirName, string destDirName) { }
public static System.IO.FileSystemInfo? ResolveLinkTarget(string linkPath, bool returnFinalTarget) { throw null; }
public static void SetCreationTime(string path, System.DateTime creationTime) { }
public static void SetCreationTimeUtc(string path, System.DateTime creationTimeUtc) { }
public static void SetCurrentDirectory(string path) { }
public static void SetLastAccessTime(string path, System.DateTime lastAccessTime) { }
public static void SetLastAccessTimeUtc(string path, System.DateTime lastAccessTimeUtc) { }
public static void SetLastWriteTime(string path, System.DateTime lastWriteTime) { }
public static void SetLastWriteTimeUtc(string path, System.DateTime lastWriteTimeUtc) { }
}
public sealed partial class DirectoryInfo : System.IO.FileSystemInfo
{
public DirectoryInfo(string path) { }
public override bool Exists { get { throw null; } }
public override string Name { get { throw null; } }
public System.IO.DirectoryInfo? Parent { get { throw null; } }
public System.IO.DirectoryInfo Root { get { throw null; } }
public void Create() { }
public System.IO.DirectoryInfo CreateSubdirectory(string path) { throw null; }
public override void Delete() { }
public void Delete(bool recursive) { }
public System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> EnumerateDirectories() { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> EnumerateDirectories(string searchPattern) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> EnumerateDirectories(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> EnumerateDirectories(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileInfo> EnumerateFiles() { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileInfo> EnumerateFiles(string searchPattern) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileInfo> EnumerateFiles(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileInfo> EnumerateFiles(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos() { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos(string searchPattern) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.Collections.Generic.IEnumerable<System.IO.FileSystemInfo> EnumerateFileSystemInfos(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.IO.DirectoryInfo[] GetDirectories() { throw null; }
public System.IO.DirectoryInfo[] GetDirectories(string searchPattern) { throw null; }
public System.IO.DirectoryInfo[] GetDirectories(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.IO.DirectoryInfo[] GetDirectories(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.IO.FileInfo[] GetFiles() { throw null; }
public System.IO.FileInfo[] GetFiles(string searchPattern) { throw null; }
public System.IO.FileInfo[] GetFiles(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.IO.FileInfo[] GetFiles(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public System.IO.FileSystemInfo[] GetFileSystemInfos() { throw null; }
public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern) { throw null; }
public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern, System.IO.EnumerationOptions enumerationOptions) { throw null; }
public System.IO.FileSystemInfo[] GetFileSystemInfos(string searchPattern, System.IO.SearchOption searchOption) { throw null; }
public void MoveTo(string destDirName) { }
public override string ToString() { throw null; }
}
public partial class DirectoryNotFoundException : System.IO.IOException
{
public DirectoryNotFoundException() { }
protected DirectoryNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public DirectoryNotFoundException(string? message) { }
public DirectoryNotFoundException(string? message, System.Exception? innerException) { }
}
public partial class EndOfStreamException : System.IO.IOException
{
public EndOfStreamException() { }
protected EndOfStreamException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public EndOfStreamException(string? message) { }
public EndOfStreamException(string? message, System.Exception? innerException) { }
}
public partial class EnumerationOptions
{
public EnumerationOptions() { }
public System.IO.FileAttributes AttributesToSkip { get { throw null; } set { } }
public int BufferSize { get { throw null; } set { } }
public bool IgnoreInaccessible { get { throw null; } set { } }
public System.IO.MatchCasing MatchCasing { get { throw null; } set { } }
public System.IO.MatchType MatchType { get { throw null; } set { } }
public int MaxRecursionDepth { get { throw null; } set { } }
public bool RecurseSubdirectories { get { throw null; } set { } }
public bool ReturnSpecialDirectories { get { throw null; } set { } }
}
public static partial class File
{
public static void AppendAllLines(string path, System.Collections.Generic.IEnumerable<string> contents) { }
public static void AppendAllLines(string path, System.Collections.Generic.IEnumerable<string> contents, System.Text.Encoding encoding) { }
public static System.Threading.Tasks.Task AppendAllLinesAsync(string path, System.Collections.Generic.IEnumerable<string> contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task AppendAllLinesAsync(string path, System.Collections.Generic.IEnumerable<string> contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void AppendAllText(string path, string? contents) { }
public static void AppendAllText(string path, string? contents, System.Text.Encoding encoding) { }
public static System.Threading.Tasks.Task AppendAllTextAsync(string path, string? contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task AppendAllTextAsync(string path, string? contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.IO.StreamWriter AppendText(string path) { throw null; }
public static void Copy(string sourceFileName, string destFileName) { }
public static void Copy(string sourceFileName, string destFileName, bool overwrite) { }
public static System.IO.FileStream Create(string path) { throw null; }
public static System.IO.FileStream Create(string path, int bufferSize) { throw null; }
public static System.IO.FileStream Create(string path, int bufferSize, System.IO.FileOptions options) { throw null; }
public static System.IO.FileSystemInfo CreateSymbolicLink(string path, string pathToTarget) { throw null; }
public static System.IO.StreamWriter CreateText(string path) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static void Decrypt(string path) { }
public static void Delete(string path) { }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static void Encrypt(string path) { }
public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; }
public static System.IO.FileAttributes GetAttributes(string path) { throw null; }
public static System.DateTime GetCreationTime(string path) { throw null; }
public static System.DateTime GetCreationTimeUtc(string path) { throw null; }
public static System.DateTime GetLastAccessTime(string path) { throw null; }
public static System.DateTime GetLastAccessTimeUtc(string path) { throw null; }
public static System.DateTime GetLastWriteTime(string path) { throw null; }
public static System.DateTime GetLastWriteTimeUtc(string path) { throw null; }
public static void Move(string sourceFileName, string destFileName) { }
public static void Move(string sourceFileName, string destFileName, bool overwrite) { }
public static System.IO.FileStream Open(string path, System.IO.FileMode mode) { throw null; }
public static System.IO.FileStream Open(string path, System.IO.FileMode mode, System.IO.FileAccess access) { throw null; }
public static System.IO.FileStream Open(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { throw null; }
public static System.IO.FileStream Open(string path, System.IO.FileStreamOptions options) { throw null; }
public static Microsoft.Win32.SafeHandles.SafeFileHandle OpenHandle(string path, System.IO.FileMode mode = System.IO.FileMode.Open, System.IO.FileAccess access = System.IO.FileAccess.Read, System.IO.FileShare share = System.IO.FileShare.Read, System.IO.FileOptions options = System.IO.FileOptions.None, long preallocationSize = (long)0) { throw null; }
public static System.IO.FileStream OpenRead(string path) { throw null; }
public static System.IO.StreamReader OpenText(string path) { throw null; }
public static System.IO.FileStream OpenWrite(string path) { throw null; }
public static byte[] ReadAllBytes(string path) { throw null; }
public static System.Threading.Tasks.Task<byte[]> ReadAllBytesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static string[] ReadAllLines(string path) { throw null; }
public static string[] ReadAllLines(string path, System.Text.Encoding encoding) { throw null; }
public static System.Threading.Tasks.Task<string[]> ReadAllLinesAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<string[]> ReadAllLinesAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static string ReadAllText(string path) { throw null; }
public static string ReadAllText(string path, System.Text.Encoding encoding) { throw null; }
public static System.Threading.Tasks.Task<string> ReadAllTextAsync(string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<string> ReadAllTextAsync(string path, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Collections.Generic.IEnumerable<string> ReadLines(string path) { throw null; }
public static System.Collections.Generic.IEnumerable<string> ReadLines(string path, System.Text.Encoding encoding) { throw null; }
public static void Replace(string sourceFileName, string destinationFileName, string? destinationBackupFileName) { }
public static void Replace(string sourceFileName, string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors) { }
public static System.IO.FileSystemInfo? ResolveLinkTarget(string linkPath, bool returnFinalTarget) { throw null; }
public static void SetAttributes(string path, System.IO.FileAttributes fileAttributes) { }
public static void SetCreationTime(string path, System.DateTime creationTime) { }
public static void SetCreationTimeUtc(string path, System.DateTime creationTimeUtc) { }
public static void SetLastAccessTime(string path, System.DateTime lastAccessTime) { }
public static void SetLastAccessTimeUtc(string path, System.DateTime lastAccessTimeUtc) { }
public static void SetLastWriteTime(string path, System.DateTime lastWriteTime) { }
public static void SetLastWriteTimeUtc(string path, System.DateTime lastWriteTimeUtc) { }
public static void WriteAllBytes(string path, byte[] bytes) { }
public static System.Threading.Tasks.Task WriteAllBytesAsync(string path, byte[] bytes, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void WriteAllLines(string path, System.Collections.Generic.IEnumerable<string> contents) { }
public static void WriteAllLines(string path, System.Collections.Generic.IEnumerable<string> contents, System.Text.Encoding encoding) { }
public static void WriteAllLines(string path, string[] contents) { }
public static void WriteAllLines(string path, string[] contents, System.Text.Encoding encoding) { }
public static System.Threading.Tasks.Task WriteAllLinesAsync(string path, System.Collections.Generic.IEnumerable<string> contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task WriteAllLinesAsync(string path, System.Collections.Generic.IEnumerable<string> contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void WriteAllText(string path, string? contents) { }
public static void WriteAllText(string path, string? contents, System.Text.Encoding encoding) { }
public static System.Threading.Tasks.Task WriteAllTextAsync(string path, string? contents, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task WriteAllTextAsync(string path, string? contents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
[System.FlagsAttribute]
public enum FileAccess
{
Read = 1,
Write = 2,
ReadWrite = 3,
}
[System.FlagsAttribute]
public enum FileAttributes
{
ReadOnly = 1,
Hidden = 2,
System = 4,
Directory = 16,
Archive = 32,
Device = 64,
Normal = 128,
Temporary = 256,
SparseFile = 512,
ReparsePoint = 1024,
Compressed = 2048,
Offline = 4096,
NotContentIndexed = 8192,
Encrypted = 16384,
IntegrityStream = 32768,
NoScrubData = 131072,
}
public sealed partial class FileInfo : System.IO.FileSystemInfo
{
public FileInfo(string fileName) { }
public System.IO.DirectoryInfo? Directory { get { throw null; } }
public string? DirectoryName { get { throw null; } }
public override bool Exists { get { throw null; } }
public bool IsReadOnly { get { throw null; } set { } }
public long Length { get { throw null; } }
public override string Name { get { throw null; } }
public System.IO.StreamWriter AppendText() { throw null; }
public System.IO.FileInfo CopyTo(string destFileName) { throw null; }
public System.IO.FileInfo CopyTo(string destFileName, bool overwrite) { throw null; }
public System.IO.FileStream Create() { throw null; }
public System.IO.StreamWriter CreateText() { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public void Decrypt() { }
public override void Delete() { }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public void Encrypt() { }
public void MoveTo(string destFileName) { }
public void MoveTo(string destFileName, bool overwrite) { }
public System.IO.FileStream Open(System.IO.FileMode mode) { throw null; }
public System.IO.FileStream Open(System.IO.FileMode mode, System.IO.FileAccess access) { throw null; }
public System.IO.FileStream Open(System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { throw null; }
public System.IO.FileStream Open(System.IO.FileStreamOptions options) { throw null; }
public System.IO.FileStream OpenRead() { throw null; }
public System.IO.StreamReader OpenText() { throw null; }
public System.IO.FileStream OpenWrite() { throw null; }
public System.IO.FileInfo Replace(string destinationFileName, string? destinationBackupFileName) { throw null; }
public System.IO.FileInfo Replace(string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors) { throw null; }
}
public partial class FileLoadException : System.IO.IOException
{
public FileLoadException() { }
protected FileLoadException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public FileLoadException(string? message) { }
public FileLoadException(string? message, System.Exception? inner) { }
public FileLoadException(string? message, string? fileName) { }
public FileLoadException(string? message, string? fileName, System.Exception? inner) { }
public string? FileName { get { throw null; } }
public string? FusionLog { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
public enum FileMode
{
CreateNew = 1,
Create = 2,
Open = 3,
OpenOrCreate = 4,
Truncate = 5,
Append = 6,
}
public partial class FileNotFoundException : System.IO.IOException
{
public FileNotFoundException() { }
protected FileNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public FileNotFoundException(string? message) { }
public FileNotFoundException(string? message, System.Exception? innerException) { }
public FileNotFoundException(string? message, string? fileName) { }
public FileNotFoundException(string? message, string? fileName, System.Exception? innerException) { }
public string? FileName { get { throw null; } }
public string? FusionLog { get { throw null; } }
public override string Message { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum FileOptions
{
WriteThrough = -2147483648,
None = 0,
Encrypted = 16384,
DeleteOnClose = 67108864,
SequentialScan = 134217728,
RandomAccess = 268435456,
Asynchronous = 1073741824,
}
[System.FlagsAttribute]
public enum FileShare
{
None = 0,
Read = 1,
Write = 2,
ReadWrite = 3,
Delete = 4,
Inheritable = 16,
}
public partial class FileStream : System.IO.Stream
{
public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access) { }
public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize) { }
public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize, bool isAsync) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use FileStream(SafeFileHandle handle, FileAccess access) instead.")]
public FileStream(System.IntPtr handle, System.IO.FileAccess access) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use FileStream(SafeFileHandle handle, FileAccess access) and optionally make a new SafeFileHandle with ownsHandle=false if needed instead.")]
public FileStream(System.IntPtr handle, System.IO.FileAccess access, bool ownsHandle) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize) and optionally make a new SafeFileHandle with ownsHandle=false if needed instead.")]
public FileStream(System.IntPtr handle, System.IO.FileAccess access, bool ownsHandle, int bufferSize) { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) and optionally make a new SafeFileHandle with ownsHandle=false if needed instead.")]
public FileStream(System.IntPtr handle, System.IO.FileAccess access, bool ownsHandle, int bufferSize, bool isAsync) { }
public FileStream(string path, System.IO.FileMode mode) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, bool useAsync) { }
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, System.IO.FileOptions options) { }
public FileStream(string path, System.IO.FileStreamOptions options) { }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
[System.ObsoleteAttribute("FileStream.Handle has been deprecated. Use FileStream's SafeFileHandle property instead.")]
public virtual System.IntPtr Handle { get { throw null; } }
public virtual bool IsAsync { get { throw null; } }
public override long Length { get { throw null; } }
public virtual string Name { get { throw null; } }
public override long Position { get { throw null; } set { } }
public virtual Microsoft.Win32.SafeHandles.SafeFileHandle SafeFileHandle { get { throw null; } }
public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override int EndRead(System.IAsyncResult asyncResult) { throw null; }
public override void EndWrite(System.IAsyncResult asyncResult) { }
~FileStream() { }
public override void Flush() { }
public virtual void Flush(bool flushToDisk) { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")]
public virtual void Lock(long position, long length) { }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")]
public virtual void Unlock(long position, long length) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteByte(byte value) { }
}
public sealed partial class FileStreamOptions
{
public FileStreamOptions() { }
public System.IO.FileAccess Access { get { throw null; } set { } }
public int BufferSize { get { throw null; } set { } }
public System.IO.FileMode Mode { get { throw null; } set { } }
public System.IO.FileOptions Options { get { throw null; } set { } }
public long PreallocationSize { get { throw null; } set { } }
public System.IO.FileShare Share { get { throw null; } set { } }
}
public abstract partial class FileSystemInfo : System.MarshalByRefObject, System.Runtime.Serialization.ISerializable
{
protected string FullPath;
protected string OriginalPath;
protected FileSystemInfo() { }
protected FileSystemInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public System.IO.FileAttributes Attributes { get { throw null; } set { } }
public System.DateTime CreationTime { get { throw null; } set { } }
public System.DateTime CreationTimeUtc { get { throw null; } set { } }
public abstract bool Exists { get; }
public string Extension { get { throw null; } }
public virtual string FullName { get { throw null; } }
public System.DateTime LastAccessTime { get { throw null; } set { } }
public System.DateTime LastAccessTimeUtc { get { throw null; } set { } }
public System.DateTime LastWriteTime { get { throw null; } set { } }
public System.DateTime LastWriteTimeUtc { get { throw null; } set { } }
public string? LinkTarget { get { throw null; } }
public abstract string Name { get; }
public void CreateAsSymbolicLink(string pathToTarget) { }
public abstract void Delete();
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public void Refresh() { }
public System.IO.FileSystemInfo? ResolveLinkTarget(bool returnFinalTarget) { throw null; }
public override string ToString() { throw null; }
}
public enum HandleInheritability
{
None = 0,
Inheritable = 1,
}
public sealed partial class InvalidDataException : System.SystemException
{
public InvalidDataException() { }
public InvalidDataException(string? message) { }
public InvalidDataException(string? message, System.Exception? innerException) { }
}
public partial class IOException : System.SystemException
{
public IOException() { }
protected IOException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public IOException(string? message) { }
public IOException(string? message, System.Exception? innerException) { }
public IOException(string? message, int hresult) { }
}
public enum MatchCasing
{
PlatformDefault = 0,
CaseSensitive = 1,
CaseInsensitive = 2,
}
public enum MatchType
{
Simple = 0,
Win32 = 1,
}
public partial class MemoryStream : System.IO.Stream
{
public MemoryStream() { }
public MemoryStream(byte[] buffer) { }
public MemoryStream(byte[] buffer, bool writable) { }
public MemoryStream(byte[] buffer, int index, int count) { }
public MemoryStream(byte[] buffer, int index, int count, bool writable) { }
public MemoryStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible) { }
public MemoryStream(int capacity) { }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
public virtual int Capacity { get { throw null; } set { } }
public override long Length { get { throw null; } }
public override long Position { get { throw null; } set { } }
public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public override void CopyTo(System.IO.Stream destination, int bufferSize) { }
public override System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
protected override void Dispose(bool disposing) { }
public override int EndRead(System.IAsyncResult asyncResult) { throw null; }
public override void EndWrite(System.IAsyncResult asyncResult) { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual byte[] GetBuffer() { throw null; }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin loc) { throw null; }
public override void SetLength(long value) { }
public virtual byte[] ToArray() { throw null; }
public virtual bool TryGetBuffer(out System.ArraySegment<byte> buffer) { throw null; }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteByte(byte value) { }
public virtual void WriteTo(System.IO.Stream stream) { }
}
public static partial class Path
{
public static readonly char AltDirectorySeparatorChar;
public static readonly char DirectorySeparatorChar;
[System.ObsoleteAttribute("Path.InvalidPathChars has been deprecated. Use GetInvalidPathChars or GetInvalidFileNameChars instead.")]
public static readonly char[] InvalidPathChars;
public static readonly char PathSeparator;
public static readonly char VolumeSeparatorChar;
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? ChangeExtension(string? path, string? extension) { throw null; }
public static string Combine(string path1, string path2) { throw null; }
public static string Combine(string path1, string path2, string path3) { throw null; }
public static string Combine(string path1, string path2, string path3, string path4) { throw null; }
public static string Combine(params string[] paths) { throw null; }
public static bool EndsInDirectorySeparator(System.ReadOnlySpan<char> path) { throw null; }
public static bool EndsInDirectorySeparator(string path) { throw null; }
public static bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path) { throw null; }
public static System.ReadOnlySpan<char> GetDirectoryName(System.ReadOnlySpan<char> path) { throw null; }
public static string? GetDirectoryName(string? path) { throw null; }
public static System.ReadOnlySpan<char> GetExtension(System.ReadOnlySpan<char> path) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? GetExtension(string? path) { throw null; }
public static System.ReadOnlySpan<char> GetFileName(System.ReadOnlySpan<char> path) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? GetFileName(string? path) { throw null; }
public static System.ReadOnlySpan<char> GetFileNameWithoutExtension(System.ReadOnlySpan<char> path) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("path")]
public static string? GetFileNameWithoutExtension(string? path) { throw null; }
public static string GetFullPath(string path) { throw null; }
public static string GetFullPath(string path, string basePath) { throw null; }
public static char[] GetInvalidFileNameChars() { throw null; }
public static char[] GetInvalidPathChars() { throw null; }
public static System.ReadOnlySpan<char> GetPathRoot(System.ReadOnlySpan<char> path) { throw null; }
public static string? GetPathRoot(string? path) { throw null; }
public static string GetRandomFileName() { throw null; }
public static string GetRelativePath(string relativeTo, string path) { throw null; }
public static string GetTempFileName() { throw null; }
public static string GetTempPath() { throw null; }
public static bool HasExtension(System.ReadOnlySpan<char> path) { throw null; }
public static bool HasExtension([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; }
public static bool IsPathFullyQualified(System.ReadOnlySpan<char> path) { throw null; }
public static bool IsPathFullyQualified(string path) { throw null; }
public static bool IsPathRooted(System.ReadOnlySpan<char> path) { throw null; }
public static bool IsPathRooted([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? path) { throw null; }
public static string Join(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2) { throw null; }
public static string Join(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2, System.ReadOnlySpan<char> path3) { throw null; }
public static string Join(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2, System.ReadOnlySpan<char> path3, System.ReadOnlySpan<char> path4) { throw null; }
public static string Join(string? path1, string? path2) { throw null; }
public static string Join(string? path1, string? path2, string? path3) { throw null; }
public static string Join(string? path1, string? path2, string? path3, string? path4) { throw null; }
public static string Join(params string?[] paths) { throw null; }
public static System.ReadOnlySpan<char> TrimEndingDirectorySeparator(System.ReadOnlySpan<char> path) { throw null; }
public static string TrimEndingDirectorySeparator(string path) { throw null; }
public static bool TryJoin(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2, System.ReadOnlySpan<char> path3, System.Span<char> destination, out int charsWritten) { throw null; }
public static bool TryJoin(System.ReadOnlySpan<char> path1, System.ReadOnlySpan<char> path2, System.Span<char> destination, out int charsWritten) { throw null; }
}
public partial class PathTooLongException : System.IO.IOException
{
public PathTooLongException() { }
protected PathTooLongException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public PathTooLongException(string? message) { }
public PathTooLongException(string? message, System.Exception? innerException) { }
}
public static partial class RandomAccess
{
public static long GetLength(Microsoft.Win32.SafeHandles.SafeFileHandle handle) { throw null; }
public static void SetLength(Microsoft.Win32.SafeHandles.SafeFileHandle handle, long length) { throw null; }
public static long Read(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<System.Memory<byte>> buffers, long fileOffset) { throw null; }
public static int Read(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Span<byte> buffer, long fileOffset) { throw null; }
public static System.Threading.Tasks.ValueTask<long> ReadAsync(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<System.Memory<byte>> buffers, long fileOffset, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.ValueTask<int> ReadAsync(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Memory<byte> buffer, long fileOffset, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void Write(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<System.ReadOnlyMemory<byte>> buffers, long fileOffset) { }
public static void Write(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.ReadOnlySpan<byte> buffer, long fileOffset) { }
public static System.Threading.Tasks.ValueTask WriteAsync(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.Collections.Generic.IReadOnlyList<System.ReadOnlyMemory<byte>> buffers, long fileOffset, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.ValueTask WriteAsync(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.ReadOnlyMemory<byte> buffer, long fileOffset, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public enum SearchOption
{
TopDirectoryOnly = 0,
AllDirectories = 1,
}
public enum SeekOrigin
{
Begin = 0,
Current = 1,
End = 2,
}
public abstract partial class Stream : System.MarshalByRefObject, System.IAsyncDisposable, System.IDisposable
{
public static readonly System.IO.Stream Null;
protected Stream() { }
public abstract bool CanRead { get; }
public abstract bool CanSeek { get; }
public virtual bool CanTimeout { get { throw null; } }
public abstract bool CanWrite { get; }
public abstract long Length { get; }
public abstract long Position { get; set; }
public virtual int ReadTimeout { get { throw null; } set { } }
public virtual int WriteTimeout { get { throw null; } set { } }
public virtual System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public virtual System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback? callback, object? state) { throw null; }
public virtual void Close() { }
public void CopyTo(System.IO.Stream destination) { }
public virtual void CopyTo(System.IO.Stream destination, int bufferSize) { }
public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination) { throw null; }
public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize) { throw null; }
public virtual System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ObsoleteAttribute("CreateWaitHandle has been deprecated. Use the ManualResetEvent(false) constructor instead.")]
protected virtual System.Threading.WaitHandle CreateWaitHandle() { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public virtual int EndRead(System.IAsyncResult asyncResult) { throw null; }
public virtual void EndWrite(System.IAsyncResult asyncResult) { }
public abstract void Flush();
public System.Threading.Tasks.Task FlushAsync() { throw null; }
public virtual System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
[System.ObsoleteAttribute("Do not call or override this method.")]
protected virtual void ObjectInvariant() { }
public abstract int Read(byte[] buffer, int offset, int count);
public virtual int Read(System.Span<byte> buffer) { throw null; }
public System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count) { throw null; }
public virtual System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual int ReadByte() { throw null; }
public abstract long Seek(long offset, System.IO.SeekOrigin origin);
public abstract void SetLength(long value);
public static System.IO.Stream Synchronized(System.IO.Stream stream) { throw null; }
protected static void ValidateBufferArguments(byte[] buffer, int offset, int count) { }
protected static void ValidateCopyToArguments(System.IO.Stream destination, int bufferSize) { }
public abstract void Write(byte[] buffer, int offset, int count);
public virtual void Write(System.ReadOnlySpan<byte> buffer) { }
public System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual void WriteByte(byte value) { }
}
public partial class StreamReader : System.IO.TextReader
{
public static readonly new System.IO.StreamReader Null;
public StreamReader(System.IO.Stream stream) { }
public StreamReader(System.IO.Stream stream, bool detectEncodingFromByteOrderMarks) { }
public StreamReader(System.IO.Stream stream, System.Text.Encoding encoding) { }
public StreamReader(System.IO.Stream stream, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks) { }
public StreamReader(System.IO.Stream stream, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) { }
public StreamReader(System.IO.Stream stream, System.Text.Encoding? encoding = null, bool detectEncodingFromByteOrderMarks = true, int bufferSize = -1, bool leaveOpen = false) { }
public StreamReader(string path) { }
public StreamReader(string path, bool detectEncodingFromByteOrderMarks) { }
public StreamReader(string path, System.IO.FileStreamOptions options) { }
public StreamReader(string path, System.Text.Encoding encoding) { }
public StreamReader(string path, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks) { }
public StreamReader(string path, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) { }
public StreamReader(string path, System.Text.Encoding encoding, bool detectEncodingFromByteOrderMarks, System.IO.FileStreamOptions options) { }
public virtual System.IO.Stream BaseStream { get { throw null; } }
public virtual System.Text.Encoding CurrentEncoding { get { throw null; } }
public bool EndOfStream { get { throw null; } }
public override void Close() { }
public void DiscardBufferedData() { }
protected override void Dispose(bool disposing) { }
public override int Peek() { throw null; }
public override int Read() { throw null; }
public override int Read(char[] buffer, int index, int count) { throw null; }
public override int Read(System.Span<char> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadBlock(char[] buffer, int index, int count) { throw null; }
public override int ReadBlock(System.Span<char> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadBlockAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadBlockAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override string? ReadLine() { throw null; }
public override System.Threading.Tasks.Task<string?> ReadLineAsync() { throw null; }
public override System.Threading.Tasks.ValueTask<string?> ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override string ReadToEnd() { throw null; }
public override System.Threading.Tasks.Task<string> ReadToEndAsync() { throw null; }
public override System.Threading.Tasks.Task<string> ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class StreamWriter : System.IO.TextWriter
{
public static readonly new System.IO.StreamWriter Null;
public StreamWriter(System.IO.Stream stream) { }
public StreamWriter(System.IO.Stream stream, System.Text.Encoding encoding) { }
public StreamWriter(System.IO.Stream stream, System.Text.Encoding encoding, int bufferSize) { }
public StreamWriter(System.IO.Stream stream, System.Text.Encoding? encoding = null, int bufferSize = -1, bool leaveOpen = false) { }
public StreamWriter(string path) { }
public StreamWriter(string path, bool append) { }
public StreamWriter(string path, bool append, System.Text.Encoding encoding) { }
public StreamWriter(string path, bool append, System.Text.Encoding encoding, int bufferSize) { }
public StreamWriter(string path, System.IO.FileStreamOptions options) { }
public StreamWriter(string path, System.Text.Encoding encoding, System.IO.FileStreamOptions options) { }
public virtual bool AutoFlush { get { throw null; } set { } }
public virtual System.IO.Stream BaseStream { get { throw null; } }
public override System.Text.Encoding Encoding { get { throw null; } }
public override void Close() { }
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync() { throw null; }
public override void Write(char value) { }
public override void Write(char[]? buffer) { }
public override void Write(char[] buffer, int index, int count) { }
public override void Write(System.ReadOnlySpan<char> buffer) { }
public override void Write(string? value) { }
public override void Write(string format, object? arg0) { }
public override void Write(string format, object? arg0, object? arg1) { }
public override void Write(string format, object? arg0, object? arg1, object? arg2) { }
public override void Write(string format, params object?[] arg) { }
public override System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(string? value) { throw null; }
public override void WriteLine(System.ReadOnlySpan<char> buffer) { }
public override void WriteLine(string? value) { }
public override void WriteLine(string format, object? arg0) { }
public override void WriteLine(string format, object? arg0, object? arg1) { }
public override void WriteLine(string format, object? arg0, object? arg1, object? arg2) { }
public override void WriteLine(string format, params object?[] arg) { }
public override System.Threading.Tasks.Task WriteLineAsync() { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(string? value) { throw null; }
}
public partial class StringReader : System.IO.TextReader
{
public StringReader(string s) { }
public override void Close() { }
protected override void Dispose(bool disposing) { }
public override int Peek() { throw null; }
public override int Read() { throw null; }
public override int Read(char[] buffer, int index, int count) { throw null; }
public override int Read(System.Span<char> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadBlock(System.Span<char> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadBlockAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadBlockAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override string? ReadLine() { throw null; }
public override System.Threading.Tasks.Task<string?> ReadLineAsync() { throw null; }
public override System.Threading.Tasks.ValueTask<string?> ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override string ReadToEnd() { throw null; }
public override System.Threading.Tasks.Task<string> ReadToEndAsync() { throw null; }
public override System.Threading.Tasks.Task<string> ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class StringWriter : System.IO.TextWriter
{
public StringWriter() { }
public StringWriter(System.IFormatProvider? formatProvider) { }
public StringWriter(System.Text.StringBuilder sb) { }
public StringWriter(System.Text.StringBuilder sb, System.IFormatProvider? formatProvider) { }
public override System.Text.Encoding Encoding { get { throw null; } }
public override void Close() { }
protected override void Dispose(bool disposing) { }
public override System.Threading.Tasks.Task FlushAsync() { throw null; }
public virtual System.Text.StringBuilder GetStringBuilder() { throw null; }
public override string ToString() { throw null; }
public override void Write(char value) { }
public override void Write(char[] buffer, int index, int count) { }
public override void Write(System.ReadOnlySpan<char> buffer) { }
public override void Write(string? value) { }
public override void Write(System.Text.StringBuilder? value) { }
public override System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(string? value) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteLine(System.ReadOnlySpan<char> buffer) { }
public override void WriteLine(System.Text.StringBuilder? value) { }
public override System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(string? value) { throw null; }
public override System.Threading.Tasks.Task WriteLineAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public abstract partial class TextReader : System.MarshalByRefObject, System.IDisposable
{
public static readonly System.IO.TextReader Null;
protected TextReader() { }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual int Peek() { throw null; }
public virtual int Read() { throw null; }
public virtual int Read(char[] buffer, int index, int count) { throw null; }
public virtual int Read(System.Span<char> buffer) { throw null; }
public virtual System.Threading.Tasks.Task<int> ReadAsync(char[] buffer, int index, int count) { throw null; }
public virtual System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual int ReadBlock(char[] buffer, int index, int count) { throw null; }
public virtual int ReadBlock(System.Span<char> buffer) { throw null; }
public virtual System.Threading.Tasks.Task<int> ReadBlockAsync(char[] buffer, int index, int count) { throw null; }
public virtual System.Threading.Tasks.ValueTask<int> ReadBlockAsync(System.Memory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual string? ReadLine() { throw null; }
public virtual System.Threading.Tasks.Task<string?> ReadLineAsync() { throw null; }
public virtual System.Threading.Tasks.ValueTask<string?> ReadLineAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public virtual string ReadToEnd() { throw null; }
public virtual System.Threading.Tasks.Task<string> ReadToEndAsync() { throw null; }
public virtual System.Threading.Tasks.Task<string> ReadToEndAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.IO.TextReader Synchronized(System.IO.TextReader reader) { throw null; }
}
public abstract partial class TextWriter : System.MarshalByRefObject, System.IAsyncDisposable, System.IDisposable
{
protected char[] CoreNewLine;
public static readonly System.IO.TextWriter Null;
protected TextWriter() { }
protected TextWriter(System.IFormatProvider? formatProvider) { }
public abstract System.Text.Encoding Encoding { get; }
public virtual System.IFormatProvider FormatProvider { get { throw null; } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public virtual string NewLine { get { throw null; } set { } }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public virtual void Flush() { }
public virtual System.Threading.Tasks.Task FlushAsync() { throw null; }
public static System.IO.TextWriter Synchronized(System.IO.TextWriter writer) { throw null; }
public virtual void Write(bool value) { }
public virtual void Write(char value) { }
public virtual void Write(char[]? buffer) { }
public virtual void Write(char[] buffer, int index, int count) { }
public virtual void Write(decimal value) { }
public virtual void Write(double value) { }
public virtual void Write(int value) { }
public virtual void Write(long value) { }
public virtual void Write(object? value) { }
public virtual void Write(System.ReadOnlySpan<char> buffer) { }
public virtual void Write(float value) { }
public virtual void Write(string? value) { }
public virtual void Write(string format, object? arg0) { }
public virtual void Write(string format, object? arg0, object? arg1) { }
public virtual void Write(string format, object? arg0, object? arg1, object? arg2) { }
public virtual void Write(string format, params object?[] arg) { }
public virtual void Write(System.Text.StringBuilder? value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(uint value) { }
[System.CLSCompliantAttribute(false)]
public virtual void Write(ulong value) { }
public virtual System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
public System.Threading.Tasks.Task WriteAsync(char[]? buffer) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(string? value) { throw null; }
public virtual System.Threading.Tasks.Task WriteAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual void WriteLine() { }
public virtual void WriteLine(bool value) { }
public virtual void WriteLine(char value) { }
public virtual void WriteLine(char[]? buffer) { }
public virtual void WriteLine(char[] buffer, int index, int count) { }
public virtual void WriteLine(decimal value) { }
public virtual void WriteLine(double value) { }
public virtual void WriteLine(int value) { }
public virtual void WriteLine(long value) { }
public virtual void WriteLine(object? value) { }
public virtual void WriteLine(System.ReadOnlySpan<char> buffer) { }
public virtual void WriteLine(float value) { }
public virtual void WriteLine(string? value) { }
public virtual void WriteLine(string format, object? arg0) { }
public virtual void WriteLine(string format, object? arg0, object? arg1) { }
public virtual void WriteLine(string format, object? arg0, object? arg1, object? arg2) { }
public virtual void WriteLine(string format, params object?[] arg) { }
public virtual void WriteLine(System.Text.StringBuilder? value) { }
[System.CLSCompliantAttribute(false)]
public virtual void WriteLine(uint value) { }
[System.CLSCompliantAttribute(false)]
public virtual void WriteLine(ulong value) { }
public virtual System.Threading.Tasks.Task WriteLineAsync() { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
public System.Threading.Tasks.Task WriteLineAsync(char[]? buffer) { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(System.ReadOnlyMemory<char> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(string? value) { throw null; }
public virtual System.Threading.Tasks.Task WriteLineAsync(System.Text.StringBuilder? value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class UnmanagedMemoryStream : System.IO.Stream
{
protected UnmanagedMemoryStream() { }
[System.CLSCompliantAttribute(false)]
public unsafe UnmanagedMemoryStream(byte* pointer, long length) { }
[System.CLSCompliantAttribute(false)]
public unsafe UnmanagedMemoryStream(byte* pointer, long length, long capacity, System.IO.FileAccess access) { }
public UnmanagedMemoryStream(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length) { }
public UnmanagedMemoryStream(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access) { }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanWrite { get { throw null; } }
public long Capacity { get { throw null; } }
public override long Length { get { throw null; } }
public override long Position { get { throw null; } set { } }
[System.CLSCompliantAttribute(false)]
public unsafe byte* PositionPointer { get { throw null; } set { } }
protected override void Dispose(bool disposing) { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
[System.CLSCompliantAttribute(false)]
protected unsafe void Initialize(byte* pointer, long length, long capacity, System.IO.FileAccess access) { }
protected void Initialize(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access) { }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin loc) { throw null; }
public override void SetLength(long value) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void WriteByte(byte value) { }
}
}
namespace System.IO.Enumeration
{
public ref partial struct FileSystemEntry
{
private object _dummy;
private int _dummyPrimitive;
public System.IO.FileAttributes Attributes { get { throw null; } }
public System.DateTimeOffset CreationTimeUtc { get { throw null; } }
public readonly System.ReadOnlySpan<char> Directory { get { throw null; } }
public System.ReadOnlySpan<char> FileName { get { throw null; } }
public bool IsDirectory { get { throw null; } }
public bool IsHidden { get { throw null; } }
public System.DateTimeOffset LastAccessTimeUtc { get { throw null; } }
public System.DateTimeOffset LastWriteTimeUtc { get { throw null; } }
public long Length { get { throw null; } }
public readonly System.ReadOnlySpan<char> OriginalRootDirectory { get { throw null; } }
public readonly System.ReadOnlySpan<char> RootDirectory { get { throw null; } }
public System.IO.FileSystemInfo ToFileSystemInfo() { throw null; }
public string ToFullPath() { throw null; }
public string ToSpecifiedFullPath() { throw null; }
}
public partial class FileSystemEnumerable<TResult> : System.Collections.Generic.IEnumerable<TResult>, System.Collections.IEnumerable
{
public FileSystemEnumerable(string directory, System.IO.Enumeration.FileSystemEnumerable<TResult>.FindTransform transform, System.IO.EnumerationOptions? options = null) { }
public System.IO.Enumeration.FileSystemEnumerable<TResult>.FindPredicate? ShouldIncludePredicate { get { throw null; } set { } }
public System.IO.Enumeration.FileSystemEnumerable<TResult>.FindPredicate? ShouldRecursePredicate { get { throw null; } set { } }
public System.Collections.Generic.IEnumerator<TResult> GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public delegate bool FindPredicate(ref System.IO.Enumeration.FileSystemEntry entry);
public delegate TResult FindTransform(ref System.IO.Enumeration.FileSystemEntry entry);
}
public abstract partial class FileSystemEnumerator<TResult> : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.Collections.Generic.IEnumerator<TResult>, System.Collections.IEnumerator, System.IDisposable
{
public FileSystemEnumerator(string directory, System.IO.EnumerationOptions? options = null) { }
public TResult Current { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
protected virtual bool ContinueOnError(int error) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public bool MoveNext() { throw null; }
protected virtual void OnDirectoryFinished(System.ReadOnlySpan<char> directory) { }
public void Reset() { }
protected virtual bool ShouldIncludeEntry(ref System.IO.Enumeration.FileSystemEntry entry) { throw null; }
protected virtual bool ShouldRecurseIntoEntry(ref System.IO.Enumeration.FileSystemEntry entry) { throw null; }
protected abstract TResult TransformEntry(ref System.IO.Enumeration.FileSystemEntry entry);
}
public static partial class FileSystemName
{
public static bool MatchesSimpleExpression(System.ReadOnlySpan<char> expression, System.ReadOnlySpan<char> name, bool ignoreCase = true) { throw null; }
public static bool MatchesWin32Expression(System.ReadOnlySpan<char> expression, System.ReadOnlySpan<char> name, bool ignoreCase = true) { throw null; }
public static string TranslateWin32Expression(string? expression) { throw null; }
}
}
namespace System.Net
{
public static partial class WebUtility
{
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? HtmlDecode(string? value) { throw null; }
public static void HtmlDecode(string? value, System.IO.TextWriter output) { }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? HtmlEncode(string? value) { throw null; }
public static void HtmlEncode(string? value, System.IO.TextWriter output) { }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("encodedValue")]
public static string? UrlDecode(string? encodedValue) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("encodedValue")]
public static byte[]? UrlDecodeToBytes(byte[]? encodedValue, int offset, int count) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static string? UrlEncode(string? value) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("value")]
public static byte[]? UrlEncodeToBytes(byte[]? value, int offset, int count) { throw null; }
}
}
namespace System.Numerics
{
public static partial class BitOperations
{
public static bool IsPow2(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool IsPow2(uint value) { throw null; }
public static bool IsPow2(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool IsPow2(ulong value) { throw null; }
public static bool IsPow2(nint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool IsPow2(nuint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int LeadingZeroCount(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int LeadingZeroCount(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int LeadingZeroCount(nuint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int Log2(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int Log2(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int Log2(nuint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int PopCount(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int PopCount(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int PopCount(nuint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint RotateLeft(uint value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong RotateLeft(ulong value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint RotateLeft(nuint value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint RotateRight(uint value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong RotateRight(ulong value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint RotateRight(nuint value, int offset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static uint RoundUpToPowerOf2(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ulong RoundUpToPowerOf2(ulong value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static nuint RoundUpToPowerOf2(nuint value) { throw null; }
public static int TrailingZeroCount(int value) { throw null; }
public static int TrailingZeroCount(long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int TrailingZeroCount(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int TrailingZeroCount(ulong value) { throw null; }
public static int TrailingZeroCount(nint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static int TrailingZeroCount(nuint value) { throw null; }
}
}
namespace System.Reflection
{
public sealed partial class AmbiguousMatchException : System.SystemException
{
public AmbiguousMatchException() { }
public AmbiguousMatchException(string? message) { }
public AmbiguousMatchException(string? message, System.Exception? inner) { }
}
public abstract partial class Assembly : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
{
protected Assembly() { }
[System.ObsoleteAttribute("Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location.", DiagnosticId = "SYSLIB0012", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual string? CodeBase { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.TypeInfo> DefinedTypes { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")] get { throw null; } }
public virtual System.Reflection.MethodInfo? EntryPoint { get { throw null; } }
[System.ObsoleteAttribute("Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location.", DiagnosticId = "SYSLIB0012", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual string EscapedCodeBase { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Type> ExportedTypes { [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")] get { throw null; } }
public virtual string? FullName { get { throw null; } }
[System.ObsoleteAttribute("The Global Assembly Cache is not supported.", DiagnosticId = "SYSLIB0005", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public virtual bool GlobalAssemblyCache { get { throw null; } }
public virtual long HostContext { get { throw null; } }
public virtual string ImageRuntimeVersion { get { throw null; } }
public virtual bool IsCollectible { get { throw null; } }
public virtual bool IsDynamic { get { throw null; } }
public bool IsFullyTrusted { get { throw null; } }
public virtual string Location { get { throw null; } }
public virtual System.Reflection.Module ManifestModule { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.Module> Modules { get { throw null; } }
public virtual bool ReflectionOnly { get { throw null; } }
public virtual System.Security.SecurityRuleSet SecurityRuleSet { get { throw null; } }
public virtual event System.Reflection.ModuleResolveEventHandler? ModuleResolve { add { } remove { } }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Assembly.CreateInstance is not supported with trimming. Use Type.GetType instead.")]
public object? CreateInstance(string typeName) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Assembly.CreateInstance is not supported with trimming. Use Type.GetType instead.")]
public object? CreateInstance(string typeName, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Assembly.CreateInstance is not supported with trimming. Use Type.GetType instead.")]
public virtual object? CreateInstance(string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, object[]? args, System.Globalization.CultureInfo? culture, object[]? activationAttributes) { throw null; }
public static string CreateQualifiedName(string? assemblyName, string? typeName) { throw null; }
public override bool Equals(object? o) { throw null; }
public static System.Reflection.Assembly? GetAssembly(System.Type type) { throw null; }
public static System.Reflection.Assembly GetCallingAssembly() { throw null; }
public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
public static System.Reflection.Assembly? GetEntryAssembly() { throw null; }
public static System.Reflection.Assembly GetExecutingAssembly() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] GetExportedTypes() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual System.IO.FileStream? GetFile(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual System.IO.FileStream[] GetFiles() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("This member throws an exception for assemblies embedded in a single-file app")]
public virtual System.IO.FileStream[] GetFiles(bool getResourceModules) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] GetForwardedTypes() { throw null; }
public override int GetHashCode() { throw null; }
public System.Reflection.Module[] GetLoadedModules() { throw null; }
public virtual System.Reflection.Module[] GetLoadedModules(bool getResourceModules) { throw null; }
public virtual System.Reflection.ManifestResourceInfo? GetManifestResourceInfo(string resourceName) { throw null; }
public virtual string[] GetManifestResourceNames() { throw null; }
public virtual System.IO.Stream? GetManifestResourceStream(string name) { throw null; }
public virtual System.IO.Stream? GetManifestResourceStream(System.Type type, string name) { throw null; }
public virtual System.Reflection.Module? GetModule(string name) { throw null; }
public System.Reflection.Module[] GetModules() { throw null; }
public virtual System.Reflection.Module[] GetModules(bool getResourceModules) { throw null; }
public virtual System.Reflection.AssemblyName GetName() { throw null; }
public virtual System.Reflection.AssemblyName GetName(bool copiedName) { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Assembly references might be removed")]
public virtual System.Reflection.AssemblyName[] GetReferencedAssemblies() { throw null; }
public virtual System.Reflection.Assembly GetSatelliteAssembly(System.Globalization.CultureInfo culture) { throw null; }
public virtual System.Reflection.Assembly GetSatelliteAssembly(System.Globalization.CultureInfo culture, System.Version? version) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string name, bool throwOnError) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string name, bool throwOnError, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] GetTypes() { throw null; }
public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly Load(byte[] rawAssembly) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly Load(byte[] rawAssembly, byte[]? rawSymbolStore) { throw null; }
public static System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyRef) { throw null; }
public static System.Reflection.Assembly Load(string assemblyString) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly LoadFile(string path) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly LoadFrom(string assemblyFile) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly LoadFrom(string assemblyFile, byte[]? hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded module depends on might be removed")]
public System.Reflection.Module LoadModule(string moduleName, byte[]? rawModule) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded module depends on might be removed")]
public virtual System.Reflection.Module LoadModule(string moduleName, byte[]? rawModule, byte[]? rawSymbolStore) { throw null; }
[System.ObsoleteAttribute("Assembly.LoadWithPartialName has been deprecated. Use Assembly.Load() instead.")]
public static System.Reflection.Assembly? LoadWithPartialName(string partialName) { throw null; }
public static bool operator ==(System.Reflection.Assembly? left, System.Reflection.Assembly? right) { throw null; }
public static bool operator !=(System.Reflection.Assembly? left, System.Reflection.Assembly? right) { throw null; }
[System.ObsoleteAttribute("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly ReflectionOnlyLoad(byte[] rawAssembly) { throw null; }
[System.ObsoleteAttribute("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly ReflectionOnlyLoad(string assemblyString) { throw null; }
[System.ObsoleteAttribute("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0018", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly ReflectionOnlyLoadFrom(string assemblyFile) { throw null; }
public override string ToString() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly UnsafeLoadFrom(string assemblyFile) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyAlgorithmIdAttribute : System.Attribute
{
public AssemblyAlgorithmIdAttribute(System.Configuration.Assemblies.AssemblyHashAlgorithm algorithmId) { }
[System.CLSCompliantAttribute(false)]
public AssemblyAlgorithmIdAttribute(uint algorithmId) { }
[System.CLSCompliantAttribute(false)]
public uint AlgorithmId { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyCompanyAttribute : System.Attribute
{
public AssemblyCompanyAttribute(string company) { }
public string Company { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyConfigurationAttribute : System.Attribute
{
public AssemblyConfigurationAttribute(string configuration) { }
public string Configuration { get { throw null; } }
}
public enum AssemblyContentType
{
Default = 0,
WindowsRuntime = 1,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyCopyrightAttribute : System.Attribute
{
public AssemblyCopyrightAttribute(string copyright) { }
public string Copyright { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyCultureAttribute : System.Attribute
{
public AssemblyCultureAttribute(string culture) { }
public string Culture { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyDefaultAliasAttribute : System.Attribute
{
public AssemblyDefaultAliasAttribute(string defaultAlias) { }
public string DefaultAlias { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyDelaySignAttribute : System.Attribute
{
public AssemblyDelaySignAttribute(bool delaySign) { }
public bool DelaySign { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyDescriptionAttribute : System.Attribute
{
public AssemblyDescriptionAttribute(string description) { }
public string Description { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyFileVersionAttribute : System.Attribute
{
public AssemblyFileVersionAttribute(string version) { }
public string Version { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyFlagsAttribute : System.Attribute
{
[System.ObsoleteAttribute("This constructor has been deprecated. Use AssemblyFlagsAttribute(AssemblyNameFlags) instead.")]
public AssemblyFlagsAttribute(int assemblyFlags) { }
public AssemblyFlagsAttribute(System.Reflection.AssemblyNameFlags assemblyFlags) { }
[System.CLSCompliantAttribute(false)]
[System.ObsoleteAttribute("This constructor has been deprecated. Use AssemblyFlagsAttribute(AssemblyNameFlags) instead.")]
public AssemblyFlagsAttribute(uint flags) { }
public int AssemblyFlags { get { throw null; } }
[System.CLSCompliantAttribute(false)]
[System.ObsoleteAttribute("AssemblyFlagsAttribute.Flags has been deprecated. Use AssemblyFlags instead.")]
public uint Flags { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyInformationalVersionAttribute : System.Attribute
{
public AssemblyInformationalVersionAttribute(string informationalVersion) { }
public string InformationalVersion { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyKeyFileAttribute : System.Attribute
{
public AssemblyKeyFileAttribute(string keyFile) { }
public string KeyFile { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyKeyNameAttribute : System.Attribute
{
public AssemblyKeyNameAttribute(string keyName) { }
public string KeyName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed partial class AssemblyMetadataAttribute : System.Attribute
{
public AssemblyMetadataAttribute(string key, string? value) { }
public string Key { get { throw null; } }
public string? Value { get { throw null; } }
}
public sealed partial class AssemblyName : System.ICloneable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
public AssemblyName() { }
public AssemblyName(string assemblyName) { }
public string? CodeBase { [System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("The code will return an empty string for assemblies embedded in a single-file app")] get { throw null; } set { } }
public System.Reflection.AssemblyContentType ContentType { get { throw null; } set { } }
public System.Globalization.CultureInfo? CultureInfo { get { throw null; } set { } }
public string? CultureName { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("The code will return an empty string for assemblies embedded in a single-file app")]
public string? EscapedCodeBase { get { throw null; } }
public System.Reflection.AssemblyNameFlags Flags { get { throw null; } set { } }
public string FullName { get { throw null; } }
[System.ObsoleteAttribute("AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.", DiagnosticId = "SYSLIB0037", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Configuration.Assemblies.AssemblyHashAlgorithm HashAlgorithm { get { throw null; } set { } }
[System.ObsoleteAttribute("Strong name signing is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0017", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Reflection.StrongNameKeyPair? KeyPair { get { throw null; } set { } }
public string? Name { get { throw null; } set { } }
[System.ObsoleteAttribute("AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.", DiagnosticId = "SYSLIB0037", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Reflection.ProcessorArchitecture ProcessorArchitecture { get { throw null; } set { } }
public System.Version? Version { get { throw null; } set { } }
[System.ObsoleteAttribute("AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.", DiagnosticId = "SYSLIB0037", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public System.Configuration.Assemblies.AssemblyVersionCompatibility VersionCompatibility { get { throw null; } set { } }
public object Clone() { throw null; }
public static System.Reflection.AssemblyName GetAssemblyName(string assemblyFile) { throw null; }
public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public byte[]? GetPublicKey() { throw null; }
public byte[]? GetPublicKeyToken() { throw null; }
public void OnDeserialization(object? sender) { }
public static bool ReferenceMatchesDefinition(System.Reflection.AssemblyName? reference, System.Reflection.AssemblyName? definition) { throw null; }
public void SetPublicKey(byte[]? publicKey) { }
public void SetPublicKeyToken(byte[]? publicKeyToken) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum AssemblyNameFlags
{
None = 0,
PublicKey = 1,
Retargetable = 256,
EnableJITcompileOptimizer = 16384,
EnableJITcompileTracking = 32768,
}
public partial class AssemblyNameProxy : System.MarshalByRefObject
{
public AssemblyNameProxy() { }
public System.Reflection.AssemblyName GetAssemblyName(string assemblyFile) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyProductAttribute : System.Attribute
{
public AssemblyProductAttribute(string product) { }
public string Product { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false, AllowMultiple=false)]
public sealed partial class AssemblySignatureKeyAttribute : System.Attribute
{
public AssemblySignatureKeyAttribute(string publicKey, string countersignature) { }
public string Countersignature { get { throw null; } }
public string PublicKey { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyTitleAttribute : System.Attribute
{
public AssemblyTitleAttribute(string title) { }
public string Title { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyTrademarkAttribute : System.Attribute
{
public AssemblyTrademarkAttribute(string trademark) { }
public string Trademark { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyVersionAttribute : System.Attribute
{
public AssemblyVersionAttribute(string version) { }
public string Version { get { throw null; } }
}
public abstract partial class Binder
{
protected Binder() { }
public abstract System.Reflection.FieldInfo BindToField(System.Reflection.BindingFlags bindingAttr, System.Reflection.FieldInfo[] match, object value, System.Globalization.CultureInfo? culture);
public abstract System.Reflection.MethodBase BindToMethod(System.Reflection.BindingFlags bindingAttr, System.Reflection.MethodBase[] match, ref object?[] args, System.Reflection.ParameterModifier[]? modifiers, System.Globalization.CultureInfo? culture, string[]? names, out object? state);
public abstract object ChangeType(object value, System.Type type, System.Globalization.CultureInfo? culture);
public abstract void ReorderArgumentArray(ref object?[] args, object state);
public abstract System.Reflection.MethodBase? SelectMethod(System.Reflection.BindingFlags bindingAttr, System.Reflection.MethodBase[] match, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers);
public abstract System.Reflection.PropertyInfo? SelectProperty(System.Reflection.BindingFlags bindingAttr, System.Reflection.PropertyInfo[] match, System.Type? returnType, System.Type[]? indexes, System.Reflection.ParameterModifier[]? modifiers);
}
[System.FlagsAttribute]
public enum BindingFlags
{
Default = 0,
IgnoreCase = 1,
DeclaredOnly = 2,
Instance = 4,
Static = 8,
Public = 16,
NonPublic = 32,
FlattenHierarchy = 64,
InvokeMethod = 256,
CreateInstance = 512,
GetField = 1024,
SetField = 2048,
GetProperty = 4096,
SetProperty = 8192,
PutDispProperty = 16384,
PutRefDispProperty = 32768,
ExactBinding = 65536,
SuppressChangeType = 131072,
OptionalParamBinding = 262144,
IgnoreReturn = 16777216,
DoNotWrapExceptions = 33554432,
}
[System.FlagsAttribute]
public enum CallingConventions
{
Standard = 1,
VarArgs = 2,
Any = 3,
HasThis = 32,
ExplicitThis = 64,
}
public abstract partial class ConstructorInfo : System.Reflection.MethodBase
{
public static readonly string ConstructorName;
public static readonly string TypeConstructorName;
protected ConstructorInfo() { }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public object Invoke(object?[]? parameters) { throw null; }
public abstract object Invoke(System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? parameters, System.Globalization.CultureInfo? culture);
public static bool operator ==(System.Reflection.ConstructorInfo? left, System.Reflection.ConstructorInfo? right) { throw null; }
public static bool operator !=(System.Reflection.ConstructorInfo? left, System.Reflection.ConstructorInfo? right) { throw null; }
}
public partial class CustomAttributeData
{
protected CustomAttributeData() { }
public virtual System.Type AttributeType { get { throw null; } }
public virtual System.Reflection.ConstructorInfo Constructor { get { throw null; } }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeTypedArgument> ConstructorArguments { get { throw null; } }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeNamedArgument> NamedArguments { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.Assembly target) { throw null; }
public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.MemberInfo target) { throw null; }
public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.Module target) { throw null; }
public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.ParameterInfo target) { throw null; }
public override int GetHashCode() { throw null; }
public override string ToString() { throw null; }
}
public static partial class CustomAttributeExtensions
{
public static System.Attribute? GetCustomAttribute(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.Module element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static System.Attribute? GetCustomAttribute(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Assembly element) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Module element) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Module element, System.Type attributeType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.Assembly element) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.MemberInfo element) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.MemberInfo element, bool inherit) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.Module element) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.ParameterInfo element) where T : System.Attribute { throw null; }
public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.ParameterInfo element, bool inherit) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.Assembly element) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.MemberInfo element) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.MemberInfo element, bool inherit) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.Module element) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.ParameterInfo element) where T : System.Attribute { throw null; }
public static T? GetCustomAttribute<T>(this System.Reflection.ParameterInfo element, bool inherit) where T : System.Attribute { throw null; }
public static bool IsDefined(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
public static bool IsDefined(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
public static bool IsDefined(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
public static bool IsDefined(this System.Reflection.Module element, System.Type attributeType) { throw null; }
public static bool IsDefined(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
public static bool IsDefined(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
}
public partial class CustomAttributeFormatException : System.FormatException
{
public CustomAttributeFormatException() { }
protected CustomAttributeFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public CustomAttributeFormatException(string? message) { }
public CustomAttributeFormatException(string? message, System.Exception? inner) { }
}
public readonly partial struct CustomAttributeNamedArgument : System.IEquatable<System.Reflection.CustomAttributeNamedArgument>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public CustomAttributeNamedArgument(System.Reflection.MemberInfo memberInfo, object? value) { throw null; }
public CustomAttributeNamedArgument(System.Reflection.MemberInfo memberInfo, System.Reflection.CustomAttributeTypedArgument typedArgument) { throw null; }
public bool IsField { get { throw null; } }
public System.Reflection.MemberInfo MemberInfo { get { throw null; } }
public string MemberName { get { throw null; } }
public System.Reflection.CustomAttributeTypedArgument TypedValue { get { throw null; } }
public bool Equals(System.Reflection.CustomAttributeNamedArgument other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Reflection.CustomAttributeNamedArgument left, System.Reflection.CustomAttributeNamedArgument right) { throw null; }
public static bool operator !=(System.Reflection.CustomAttributeNamedArgument left, System.Reflection.CustomAttributeNamedArgument right) { throw null; }
public override string ToString() { throw null; }
}
public readonly partial struct CustomAttributeTypedArgument : System.IEquatable<System.Reflection.CustomAttributeTypedArgument>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public CustomAttributeTypedArgument(object value) { throw null; }
public CustomAttributeTypedArgument(System.Type argumentType, object? value) { throw null; }
public System.Type ArgumentType { get { throw null; } }
public object? Value { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Reflection.CustomAttributeTypedArgument other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Reflection.CustomAttributeTypedArgument left, System.Reflection.CustomAttributeTypedArgument right) { throw null; }
public static bool operator !=(System.Reflection.CustomAttributeTypedArgument left, System.Reflection.CustomAttributeTypedArgument right) { throw null; }
public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Struct)]
public sealed partial class DefaultMemberAttribute : System.Attribute
{
public DefaultMemberAttribute(string memberName) { }
public string MemberName { get { throw null; } }
}
[System.FlagsAttribute]
public enum EventAttributes
{
None = 0,
SpecialName = 512,
ReservedMask = 1024,
RTSpecialName = 1024,
}
public abstract partial class EventInfo : System.Reflection.MemberInfo
{
protected EventInfo() { }
public virtual System.Reflection.MethodInfo? AddMethod { get { throw null; } }
public abstract System.Reflection.EventAttributes Attributes { get; }
public virtual System.Type? EventHandlerType { get { throw null; } }
public virtual bool IsMulticast { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public virtual System.Reflection.MethodInfo? RaiseMethod { get { throw null; } }
public virtual System.Reflection.MethodInfo? RemoveMethod { get { throw null; } }
public virtual void AddEventHandler(object? target, System.Delegate? handler) { }
public override bool Equals(object? obj) { throw null; }
public System.Reflection.MethodInfo? GetAddMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetAddMethod(bool nonPublic);
public override int GetHashCode() { throw null; }
public System.Reflection.MethodInfo[] GetOtherMethods() { throw null; }
public virtual System.Reflection.MethodInfo[] GetOtherMethods(bool nonPublic) { throw null; }
public System.Reflection.MethodInfo? GetRaiseMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetRaiseMethod(bool nonPublic);
public System.Reflection.MethodInfo? GetRemoveMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetRemoveMethod(bool nonPublic);
public static bool operator ==(System.Reflection.EventInfo? left, System.Reflection.EventInfo? right) { throw null; }
public static bool operator !=(System.Reflection.EventInfo? left, System.Reflection.EventInfo? right) { throw null; }
public virtual void RemoveEventHandler(object? target, System.Delegate? handler) { }
}
public partial class ExceptionHandlingClause
{
protected ExceptionHandlingClause() { }
public virtual System.Type? CatchType { get { throw null; } }
public virtual int FilterOffset { get { throw null; } }
public virtual System.Reflection.ExceptionHandlingClauseOptions Flags { get { throw null; } }
public virtual int HandlerLength { get { throw null; } }
public virtual int HandlerOffset { get { throw null; } }
public virtual int TryLength { get { throw null; } }
public virtual int TryOffset { get { throw null; } }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum ExceptionHandlingClauseOptions
{
Clause = 0,
Filter = 1,
Finally = 2,
Fault = 4,
}
[System.FlagsAttribute]
public enum FieldAttributes
{
PrivateScope = 0,
Private = 1,
FamANDAssem = 2,
Assembly = 3,
Family = 4,
FamORAssem = 5,
Public = 6,
FieldAccessMask = 7,
Static = 16,
InitOnly = 32,
Literal = 64,
NotSerialized = 128,
HasFieldRVA = 256,
SpecialName = 512,
RTSpecialName = 1024,
HasFieldMarshal = 4096,
PinvokeImpl = 8192,
HasDefault = 32768,
ReservedMask = 38144,
}
public abstract partial class FieldInfo : System.Reflection.MemberInfo
{
protected FieldInfo() { }
public abstract System.Reflection.FieldAttributes Attributes { get; }
public abstract System.RuntimeFieldHandle FieldHandle { get; }
public abstract System.Type FieldType { get; }
public bool IsAssembly { get { throw null; } }
public bool IsFamily { get { throw null; } }
public bool IsFamilyAndAssembly { get { throw null; } }
public bool IsFamilyOrAssembly { get { throw null; } }
public bool IsInitOnly { get { throw null; } }
public bool IsLiteral { get { throw null; } }
public bool IsNotSerialized { get { throw null; } }
public bool IsPinvokeImpl { get { throw null; } }
public bool IsPrivate { get { throw null; } }
public bool IsPublic { get { throw null; } }
public virtual bool IsSecurityCritical { get { throw null; } }
public virtual bool IsSecuritySafeCritical { get { throw null; } }
public virtual bool IsSecurityTransparent { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public bool IsStatic { get { throw null; } }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public static System.Reflection.FieldInfo GetFieldFromHandle(System.RuntimeFieldHandle handle) { throw null; }
public static System.Reflection.FieldInfo GetFieldFromHandle(System.RuntimeFieldHandle handle, System.RuntimeTypeHandle declaringType) { throw null; }
public override int GetHashCode() { throw null; }
public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
public virtual object? GetRawConstantValue() { throw null; }
public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
public abstract object? GetValue(object? obj);
[System.CLSCompliantAttribute(false)]
public virtual object? GetValueDirect(System.TypedReference obj) { throw null; }
public static bool operator ==(System.Reflection.FieldInfo? left, System.Reflection.FieldInfo? right) { throw null; }
public static bool operator !=(System.Reflection.FieldInfo? left, System.Reflection.FieldInfo? right) { throw null; }
public void SetValue(object? obj, object? value) { }
public abstract void SetValue(object? obj, object? value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, System.Globalization.CultureInfo? culture);
[System.CLSCompliantAttribute(false)]
public virtual void SetValueDirect(System.TypedReference obj, object value) { }
}
[System.FlagsAttribute]
public enum GenericParameterAttributes
{
None = 0,
Covariant = 1,
Contravariant = 2,
VarianceMask = 3,
ReferenceTypeConstraint = 4,
NotNullableValueTypeConstraint = 8,
DefaultConstructorConstraint = 16,
SpecialConstraintMask = 28,
}
public partial interface ICustomAttributeProvider
{
object[] GetCustomAttributes(bool inherit);
object[] GetCustomAttributes(System.Type attributeType, bool inherit);
bool IsDefined(System.Type attributeType, bool inherit);
}
public enum ImageFileMachine
{
I386 = 332,
ARM = 452,
IA64 = 512,
AMD64 = 34404,
}
public partial struct InterfaceMapping
{
public System.Reflection.MethodInfo[] InterfaceMethods;
public System.Type InterfaceType;
public System.Reflection.MethodInfo[] TargetMethods;
public System.Type TargetType;
}
public static partial class IntrospectionExtensions
{
public static System.Reflection.TypeInfo GetTypeInfo(this System.Type type) { throw null; }
}
public partial class InvalidFilterCriteriaException : System.ApplicationException
{
public InvalidFilterCriteriaException() { }
protected InvalidFilterCriteriaException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public InvalidFilterCriteriaException(string? message) { }
public InvalidFilterCriteriaException(string? message, System.Exception? inner) { }
}
public partial interface IReflect
{
System.Type UnderlyingSystemType { get; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.PropertyInfo? GetProperty(string name, System.Reflection.BindingFlags bindingAttr);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
System.Reflection.PropertyInfo? GetProperty(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers);
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args, System.Reflection.ParameterModifier[]? modifiers, System.Globalization.CultureInfo? culture, string[]? namedParameters);
}
public partial interface IReflectableType
{
System.Reflection.TypeInfo GetTypeInfo();
}
public partial class LocalVariableInfo
{
protected LocalVariableInfo() { }
public virtual bool IsPinned { get { throw null; } }
public virtual int LocalIndex { get { throw null; } }
public virtual System.Type LocalType { get { throw null; } }
public override string ToString() { throw null; }
}
public partial class ManifestResourceInfo
{
public ManifestResourceInfo(System.Reflection.Assembly? containingAssembly, string? containingFileName, System.Reflection.ResourceLocation resourceLocation) { }
public virtual string? FileName { get { throw null; } }
public virtual System.Reflection.Assembly? ReferencedAssembly { get { throw null; } }
public virtual System.Reflection.ResourceLocation ResourceLocation { get { throw null; } }
}
public delegate bool MemberFilter(System.Reflection.MemberInfo m, object? filterCriteria);
public abstract partial class MemberInfo : System.Reflection.ICustomAttributeProvider
{
protected MemberInfo() { }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
public abstract System.Type? DeclaringType { get; }
public virtual bool IsCollectible { get { throw null; } }
public abstract System.Reflection.MemberTypes MemberType { get; }
public virtual int MetadataToken { get { throw null; } }
public virtual System.Reflection.Module Module { get { throw null; } }
public abstract string Name { get; }
public abstract System.Type? ReflectedType { get; }
public override bool Equals(object? obj) { throw null; }
public abstract object[] GetCustomAttributes(bool inherit);
public abstract object[] GetCustomAttributes(System.Type attributeType, bool inherit);
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
public override int GetHashCode() { throw null; }
public virtual bool HasSameMetadataDefinitionAs(System.Reflection.MemberInfo other) { throw null; }
public abstract bool IsDefined(System.Type attributeType, bool inherit);
public static bool operator ==(System.Reflection.MemberInfo? left, System.Reflection.MemberInfo? right) { throw null; }
public static bool operator !=(System.Reflection.MemberInfo? left, System.Reflection.MemberInfo? right) { throw null; }
}
[System.FlagsAttribute]
public enum MemberTypes
{
Constructor = 1,
Event = 2,
Field = 4,
Method = 8,
Property = 16,
TypeInfo = 32,
Custom = 64,
NestedType = 128,
All = 191,
}
[System.FlagsAttribute]
public enum MethodAttributes
{
PrivateScope = 0,
ReuseSlot = 0,
Private = 1,
FamANDAssem = 2,
Assembly = 3,
Family = 4,
FamORAssem = 5,
Public = 6,
MemberAccessMask = 7,
UnmanagedExport = 8,
Static = 16,
Final = 32,
Virtual = 64,
HideBySig = 128,
NewSlot = 256,
VtableLayoutMask = 256,
CheckAccessOnOverride = 512,
Abstract = 1024,
SpecialName = 2048,
RTSpecialName = 4096,
PinvokeImpl = 8192,
HasSecurity = 16384,
RequireSecObject = 32768,
ReservedMask = 53248,
}
public abstract partial class MethodBase : System.Reflection.MemberInfo
{
protected MethodBase() { }
public abstract System.Reflection.MethodAttributes Attributes { get; }
public virtual System.Reflection.CallingConventions CallingConvention { get { throw null; } }
public virtual bool ContainsGenericParameters { get { throw null; } }
public bool IsAbstract { get { throw null; } }
public bool IsAssembly { get { throw null; } }
public virtual bool IsConstructedGenericMethod { get { throw null; } }
public bool IsConstructor { get { throw null; } }
public bool IsFamily { get { throw null; } }
public bool IsFamilyAndAssembly { get { throw null; } }
public bool IsFamilyOrAssembly { get { throw null; } }
public bool IsFinal { get { throw null; } }
public virtual bool IsGenericMethod { get { throw null; } }
public virtual bool IsGenericMethodDefinition { get { throw null; } }
public bool IsHideBySig { get { throw null; } }
public bool IsPrivate { get { throw null; } }
public bool IsPublic { get { throw null; } }
public virtual bool IsSecurityCritical { get { throw null; } }
public virtual bool IsSecuritySafeCritical { get { throw null; } }
public virtual bool IsSecurityTransparent { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public bool IsStatic { get { throw null; } }
public bool IsVirtual { get { throw null; } }
public abstract System.RuntimeMethodHandle MethodHandle { get; }
public virtual System.Reflection.MethodImplAttributes MethodImplementationFlags { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Metadata for the method might be incomplete or removed")]
public static System.Reflection.MethodBase? GetCurrentMethod() { throw null; }
public virtual System.Type[] GetGenericArguments() { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming may change method bodies. For example it can change some instructions, remove branches or local variables.")]
public virtual System.Reflection.MethodBody? GetMethodBody() { throw null; }
public static System.Reflection.MethodBase? GetMethodFromHandle(System.RuntimeMethodHandle handle) { throw null; }
public static System.Reflection.MethodBase? GetMethodFromHandle(System.RuntimeMethodHandle handle, System.RuntimeTypeHandle declaringType) { throw null; }
public abstract System.Reflection.MethodImplAttributes GetMethodImplementationFlags();
public abstract System.Reflection.ParameterInfo[] GetParameters();
public object? Invoke(object? obj, object?[]? parameters) { throw null; }
public abstract object? Invoke(object? obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? parameters, System.Globalization.CultureInfo? culture);
public static bool operator ==(System.Reflection.MethodBase? left, System.Reflection.MethodBase? right) { throw null; }
public static bool operator !=(System.Reflection.MethodBase? left, System.Reflection.MethodBase? right) { throw null; }
}
public partial class MethodBody
{
protected MethodBody() { }
public virtual System.Collections.Generic.IList<System.Reflection.ExceptionHandlingClause> ExceptionHandlingClauses { get { throw null; } }
public virtual bool InitLocals { get { throw null; } }
public virtual int LocalSignatureMetadataToken { get { throw null; } }
public virtual System.Collections.Generic.IList<System.Reflection.LocalVariableInfo> LocalVariables { get { throw null; } }
public virtual int MaxStackSize { get { throw null; } }
public virtual byte[]? GetILAsByteArray() { throw null; }
}
public enum MethodImplAttributes
{
IL = 0,
Managed = 0,
Native = 1,
OPTIL = 2,
CodeTypeMask = 3,
Runtime = 3,
ManagedMask = 4,
Unmanaged = 4,
NoInlining = 8,
ForwardRef = 16,
Synchronized = 32,
NoOptimization = 64,
PreserveSig = 128,
AggressiveInlining = 256,
AggressiveOptimization = 512,
InternalCall = 4096,
MaxMethodImplVal = 65535,
}
public abstract partial class MethodInfo : System.Reflection.MethodBase
{
protected MethodInfo() { }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public virtual System.Reflection.ParameterInfo ReturnParameter { get { throw null; } }
public virtual System.Type ReturnType { get { throw null; } }
public abstract System.Reflection.ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
public virtual System.Delegate CreateDelegate(System.Type delegateType) { throw null; }
public virtual System.Delegate CreateDelegate(System.Type delegateType, object? target) { throw null; }
public T CreateDelegate<T>() where T : System.Delegate { throw null; }
public T CreateDelegate<T>(object? target) where T : System.Delegate { throw null; }
public override bool Equals(object? obj) { throw null; }
public abstract System.Reflection.MethodInfo GetBaseDefinition();
public override System.Type[] GetGenericArguments() { throw null; }
public virtual System.Reflection.MethodInfo GetGenericMethodDefinition() { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("The native code for this instantiation might not be available at runtime.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]
public virtual System.Reflection.MethodInfo MakeGenericMethod(params System.Type[] typeArguments) { throw null; }
public static bool operator ==(System.Reflection.MethodInfo? left, System.Reflection.MethodInfo? right) { throw null; }
public static bool operator !=(System.Reflection.MethodInfo? left, System.Reflection.MethodInfo? right) { throw null; }
}
public sealed partial class Missing : System.Runtime.Serialization.ISerializable
{
internal Missing() { }
public static readonly System.Reflection.Missing Value;
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public abstract partial class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
{
public static readonly System.Reflection.TypeFilter FilterTypeName;
public static readonly System.Reflection.TypeFilter FilterTypeNameIgnoreCase;
protected Module() { }
public virtual System.Reflection.Assembly Assembly { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("Returns <Unknown> for modules with no file path")]
public virtual string FullyQualifiedName { get { throw null; } }
public virtual int MDStreamVersion { get { throw null; } }
public virtual int MetadataToken { get { throw null; } }
public System.ModuleHandle ModuleHandle { get { throw null; } }
public virtual System.Guid ModuleVersionId { get { throw null; } }
[System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute("Returns <Unknown> for modules with no file path")]
public virtual string Name { get { throw null; } }
public virtual string ScopeName { get { throw null; } }
public override bool Equals(object? o) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] FindTypes(System.Reflection.TypeFilter? filter, object? filterCriteria) { throw null; }
public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Fields might be removed")]
public System.Reflection.FieldInfo? GetField(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Fields might be removed")]
public virtual System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Fields might be removed")]
public System.Reflection.FieldInfo[] GetFields() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Fields might be removed")]
public virtual System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingFlags) { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public System.Reflection.MethodInfo? GetMethod(string name, System.Type[] types) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
protected virtual System.Reflection.MethodInfo? GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public System.Reflection.MethodInfo[] GetMethods() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Methods might be removed")]
public virtual System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingFlags) { throw null; }
public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public virtual void GetPEKind(out System.Reflection.PortableExecutableKinds peKind, out System.Reflection.ImageFileMachine machine) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string className) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string className, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type? GetType(string className, bool throwOnError, bool ignoreCase) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Types might be removed")]
public virtual System.Type[] GetTypes() { throw null; }
public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
public virtual bool IsResource() { throw null; }
public static bool operator ==(System.Reflection.Module? left, System.Reflection.Module? right) { throw null; }
public static bool operator !=(System.Reflection.Module? left, System.Reflection.Module? right) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.Reflection.FieldInfo? ResolveField(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual System.Reflection.FieldInfo? ResolveField(int metadataToken, System.Type[]? genericTypeArguments, System.Type[]? genericMethodArguments) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.Reflection.MemberInfo? ResolveMember(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual System.Reflection.MemberInfo? ResolveMember(int metadataToken, System.Type[]? genericTypeArguments, System.Type[]? genericMethodArguments) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.Reflection.MethodBase? ResolveMethod(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual System.Reflection.MethodBase? ResolveMethod(int metadataToken, System.Type[]? genericTypeArguments, System.Type[]? genericMethodArguments) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual byte[] ResolveSignature(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual string ResolveString(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public System.Type ResolveType(int metadataToken) { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimming changes metadata tokens")]
public virtual System.Type ResolveType(int metadataToken, System.Type[]? genericTypeArguments, System.Type[]? genericMethodArguments) { throw null; }
public override string ToString() { throw null; }
}
public delegate System.Reflection.Module ModuleResolveEventHandler(object sender, System.ResolveEventArgs e);
public sealed partial class NullabilityInfo
{
internal NullabilityInfo() { }
public System.Reflection.NullabilityInfo? ElementType { get { throw null; } }
public System.Reflection.NullabilityInfo[] GenericTypeArguments { get { throw null; } }
public System.Reflection.NullabilityState ReadState { get { throw null; } }
public System.Type Type { get { throw null; } }
public System.Reflection.NullabilityState WriteState { get { throw null; } }
}
public sealed partial class NullabilityInfoContext
{
public NullabilityInfoContext() { }
public System.Reflection.NullabilityInfo Create(System.Reflection.EventInfo eventInfo) { throw null; }
public System.Reflection.NullabilityInfo Create(System.Reflection.FieldInfo fieldInfo) { throw null; }
public System.Reflection.NullabilityInfo Create(System.Reflection.ParameterInfo parameterInfo) { throw null; }
public System.Reflection.NullabilityInfo Create(System.Reflection.PropertyInfo propertyInfo) { throw null; }
}
public enum NullabilityState
{
Unknown = 0,
NotNull = 1,
Nullable = 2,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class ObfuscateAssemblyAttribute : System.Attribute
{
public ObfuscateAssemblyAttribute(bool assemblyIsPrivate) { }
public bool AssemblyIsPrivate { get { throw null; } }
public bool StripAfterObfuscation { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed partial class ObfuscationAttribute : System.Attribute
{
public ObfuscationAttribute() { }
public bool ApplyToMembers { get { throw null; } set { } }
public bool Exclude { get { throw null; } set { } }
public string? Feature { get { throw null; } set { } }
public bool StripAfterObfuscation { get { throw null; } set { } }
}
[System.FlagsAttribute]
public enum ParameterAttributes
{
None = 0,
In = 1,
Out = 2,
Lcid = 4,
Retval = 8,
Optional = 16,
HasDefault = 4096,
HasFieldMarshal = 8192,
Reserved3 = 16384,
Reserved4 = 32768,
ReservedMask = 61440,
}
public partial class ParameterInfo : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.IObjectReference
{
protected System.Reflection.ParameterAttributes AttrsImpl;
protected System.Type? ClassImpl;
protected object? DefaultValueImpl;
protected System.Reflection.MemberInfo MemberImpl;
protected string? NameImpl;
protected int PositionImpl;
protected ParameterInfo() { }
public virtual System.Reflection.ParameterAttributes Attributes { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
public virtual object? DefaultValue { get { throw null; } }
public virtual bool HasDefaultValue { get { throw null; } }
public bool IsIn { get { throw null; } }
public bool IsLcid { get { throw null; } }
public bool IsOptional { get { throw null; } }
public bool IsOut { get { throw null; } }
public bool IsRetval { get { throw null; } }
public virtual System.Reflection.MemberInfo Member { get { throw null; } }
public virtual int MetadataToken { get { throw null; } }
public virtual string? Name { get { throw null; } }
public virtual System.Type ParameterType { get { throw null; } }
public virtual int Position { get { throw null; } }
public virtual object? RawDefaultValue { get { throw null; } }
public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
public object GetRealObject(System.Runtime.Serialization.StreamingContext context) { throw null; }
public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
public override string ToString() { throw null; }
}
public readonly partial struct ParameterModifier
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ParameterModifier(int parameterCount) { throw null; }
public bool this[int index] { get { throw null; } set { } }
}
[System.CLSCompliantAttribute(false)]
public sealed partial class Pointer : System.Runtime.Serialization.ISerializable
{
internal Pointer() { }
public unsafe static object Box(void* ptr, System.Type type) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public unsafe static void* Unbox(object ptr) { throw null; }
}
[System.FlagsAttribute]
public enum PortableExecutableKinds
{
NotAPortableExecutableImage = 0,
ILOnly = 1,
Required32Bit = 2,
PE32Plus = 4,
Unmanaged32Bit = 8,
Preferred32Bit = 16,
}
public enum ProcessorArchitecture
{
None = 0,
MSIL = 1,
X86 = 2,
IA64 = 3,
Amd64 = 4,
Arm = 5,
}
[System.FlagsAttribute]
public enum PropertyAttributes
{
None = 0,
SpecialName = 512,
RTSpecialName = 1024,
HasDefault = 4096,
Reserved2 = 8192,
Reserved3 = 16384,
Reserved4 = 32768,
ReservedMask = 62464,
}
public abstract partial class PropertyInfo : System.Reflection.MemberInfo
{
protected PropertyInfo() { }
public abstract System.Reflection.PropertyAttributes Attributes { get; }
public abstract bool CanRead { get; }
public abstract bool CanWrite { get; }
public virtual System.Reflection.MethodInfo? GetMethod { get { throw null; } }
public bool IsSpecialName { get { throw null; } }
public override System.Reflection.MemberTypes MemberType { get { throw null; } }
public abstract System.Type PropertyType { get; }
public virtual System.Reflection.MethodInfo? SetMethod { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public System.Reflection.MethodInfo[] GetAccessors() { throw null; }
public abstract System.Reflection.MethodInfo[] GetAccessors(bool nonPublic);
public virtual object? GetConstantValue() { throw null; }
public System.Reflection.MethodInfo? GetGetMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetGetMethod(bool nonPublic);
public override int GetHashCode() { throw null; }
public abstract System.Reflection.ParameterInfo[] GetIndexParameters();
public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
public virtual object? GetRawConstantValue() { throw null; }
public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
public System.Reflection.MethodInfo? GetSetMethod() { throw null; }
public abstract System.Reflection.MethodInfo? GetSetMethod(bool nonPublic);
public object? GetValue(object? obj) { throw null; }
public virtual object? GetValue(object? obj, object?[]? index) { throw null; }
public abstract object? GetValue(object? obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? index, System.Globalization.CultureInfo? culture);
public static bool operator ==(System.Reflection.PropertyInfo? left, System.Reflection.PropertyInfo? right) { throw null; }
public static bool operator !=(System.Reflection.PropertyInfo? left, System.Reflection.PropertyInfo? right) { throw null; }
public void SetValue(object? obj, object? value) { }
public virtual void SetValue(object? obj, object? value, object?[]? index) { }
public abstract void SetValue(object? obj, object? value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object?[]? index, System.Globalization.CultureInfo? culture);
}
public abstract partial class ReflectionContext
{
protected ReflectionContext() { }
public virtual System.Reflection.TypeInfo GetTypeForObject(object value) { throw null; }
public abstract System.Reflection.Assembly MapAssembly(System.Reflection.Assembly assembly);
public abstract System.Reflection.TypeInfo MapType(System.Reflection.TypeInfo type);
}
public sealed partial class ReflectionTypeLoadException : System.SystemException, System.Runtime.Serialization.ISerializable
{
public ReflectionTypeLoadException(System.Type?[]? classes, System.Exception?[]? exceptions) { }
public ReflectionTypeLoadException(System.Type?[]? classes, System.Exception?[]? exceptions, string? message) { }
public System.Exception?[] LoaderExceptions { get { throw null; } }
public override string Message { get { throw null; } }
public System.Type?[] Types { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
[System.FlagsAttribute]
public enum ResourceAttributes
{
Public = 1,
Private = 2,
}
[System.FlagsAttribute]
public enum ResourceLocation
{
Embedded = 1,
ContainedInAnotherAssembly = 2,
ContainedInManifestFile = 4,
}
public static partial class RuntimeReflectionExtensions
{
public static System.Reflection.MethodInfo GetMethodInfo(this System.Delegate del) { throw null; }
public static System.Reflection.MethodInfo? GetRuntimeBaseDefinition(this System.Reflection.MethodInfo method) { throw null; }
public static System.Reflection.EventInfo? GetRuntimeEvent([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)] this System.Type type, string name) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Reflection.EventInfo> GetRuntimeEvents([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)] this System.Type type) { throw null; }
public static System.Reflection.FieldInfo? GetRuntimeField([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)] this System.Type type, string name) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Reflection.FieldInfo> GetRuntimeFields([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)] this System.Type type) { throw null; }
public static System.Reflection.InterfaceMapping GetRuntimeInterfaceMap(this System.Reflection.TypeInfo typeInfo, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type interfaceType) { throw null; }
public static System.Reflection.MethodInfo? GetRuntimeMethod([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] this System.Type type, string name, System.Type[] parameters) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> GetRuntimeMethods([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] this System.Type type) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo> GetRuntimeProperties([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] this System.Type type) { throw null; }
public static System.Reflection.PropertyInfo? GetRuntimeProperty([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] this System.Type type, string name) { throw null; }
}
[System.ObsoleteAttribute("Strong name signing is not supported and throws PlatformNotSupportedException.", DiagnosticId = "SYSLIB0017", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial class StrongNameKeyPair : System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
{
public StrongNameKeyPair(byte[] keyPairArray) { }
public StrongNameKeyPair(System.IO.FileStream keyPairFile) { }
protected StrongNameKeyPair(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public StrongNameKeyPair(string keyPairContainer) { }
public byte[] PublicKey { get { throw null; } }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public partial class TargetException : System.ApplicationException
{
public TargetException() { }
protected TargetException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TargetException(string? message) { }
public TargetException(string? message, System.Exception? inner) { }
}
public sealed partial class TargetInvocationException : System.ApplicationException
{
public TargetInvocationException(System.Exception? inner) { }
public TargetInvocationException(string? message, System.Exception? inner) { }
}
public sealed partial class TargetParameterCountException : System.ApplicationException
{
public TargetParameterCountException() { }
public TargetParameterCountException(string? message) { }
public TargetParameterCountException(string? message, System.Exception? inner) { }
}
[System.FlagsAttribute]
public enum TypeAttributes
{
AnsiClass = 0,
AutoLayout = 0,
Class = 0,
NotPublic = 0,
Public = 1,
NestedPublic = 2,
NestedPrivate = 3,
NestedFamily = 4,
NestedAssembly = 5,
NestedFamANDAssem = 6,
NestedFamORAssem = 7,
VisibilityMask = 7,
SequentialLayout = 8,
ExplicitLayout = 16,
LayoutMask = 24,
ClassSemanticsMask = 32,
Interface = 32,
Abstract = 128,
Sealed = 256,
SpecialName = 1024,
RTSpecialName = 2048,
Import = 4096,
Serializable = 8192,
WindowsRuntime = 16384,
UnicodeClass = 65536,
AutoClass = 131072,
CustomFormatClass = 196608,
StringFormatMask = 196608,
HasSecurity = 262144,
ReservedMask = 264192,
BeforeFieldInit = 1048576,
CustomFormatMask = 12582912,
}
public partial class TypeDelegator : System.Reflection.TypeInfo
{
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
protected System.Type typeImpl;
protected TypeDelegator() { }
public TypeDelegator([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] System.Type delegatingType) { }
public override System.Reflection.Assembly Assembly { get { throw null; } }
public override string? AssemblyQualifiedName { get { throw null; } }
public override System.Type? BaseType { get { throw null; } }
public override string? FullName { get { throw null; } }
public override System.Guid GUID { get { throw null; } }
public override bool IsByRefLike { get { throw null; } }
public override bool IsCollectible { get { throw null; } }
public override bool IsConstructedGenericType { get { throw null; } }
public override bool IsGenericMethodParameter { get { throw null; } }
public override bool IsGenericTypeParameter { get { throw null; } }
public override bool IsSZArray { get { throw null; } }
public override bool IsTypeDefinition { get { throw null; } }
public override bool IsVariableBoundArray { get { throw null; } }
public override int MetadataToken { get { throw null; } }
public override System.Reflection.Module Module { get { throw null; } }
public override string Name { get { throw null; } }
public override string? Namespace { get { throw null; } }
public override System.RuntimeTypeHandle TypeHandle { get { throw null; } }
public override System.Type UnderlyingSystemType { get { throw null; } }
protected override System.Reflection.TypeAttributes GetAttributeFlagsImpl() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
protected override System.Reflection.ConstructorInfo? GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public override System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr) { throw null; }
public override object[] GetCustomAttributes(bool inherit) { throw null; }
public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
public override System.Type? GetElementType() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public override System.Reflection.EventInfo? GetEvent(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public override System.Reflection.EventInfo[] GetEvents() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public override System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public override System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
[return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public override System.Type? GetInterface(string name, bool ignoreCase) { throw null; }
public override System.Reflection.InterfaceMapping GetInterfaceMap([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] System.Type interfaceType) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)]
public override System.Type[] GetInterfaces() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public override System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public override System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr) { throw null; }
public override System.Reflection.MemberInfo GetMemberWithSameMetadataDefinitionAs(System.Reflection.MemberInfo member) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
protected override System.Reflection.MethodInfo? GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Reflection.CallingConventions callConvention, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public override System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public override System.Type? GetNestedType(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public override System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public override System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
protected override System.Reflection.PropertyInfo? GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder? binder, System.Type? returnType, System.Type[]? types, System.Reflection.ParameterModifier[]? modifiers) { throw null; }
protected override bool HasElementTypeImpl() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)]
public override object? InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder? binder, object? target, object?[]? args, System.Reflection.ParameterModifier[]? modifiers, System.Globalization.CultureInfo? culture, string[]? namedParameters) { throw null; }
protected override bool IsArrayImpl() { throw null; }
public override bool IsAssignableFrom([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Reflection.TypeInfo? typeInfo) { throw null; }
protected override bool IsByRefImpl() { throw null; }
protected override bool IsCOMObjectImpl() { throw null; }
public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
protected override bool IsPointerImpl() { throw null; }
protected override bool IsPrimitiveImpl() { throw null; }
protected override bool IsValueTypeImpl() { throw null; }
}
public delegate bool TypeFilter(System.Type m, object? filterCriteria);
public abstract partial class TypeInfo : System.Type, System.Reflection.IReflectableType
{
protected TypeInfo() { }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.ConstructorInfo> DeclaredConstructors { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.EventInfo> DeclaredEvents { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.FieldInfo> DeclaredFields { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.MemberInfo> DeclaredMembers { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> DeclaredMethods { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.TypeInfo> DeclaredNestedTypes { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)] get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo> DeclaredProperties { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)] get { throw null; } }
public virtual System.Type[] GenericTypeParameters { get { throw null; } }
public virtual System.Collections.Generic.IEnumerable<System.Type> ImplementedInterfaces { [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces)] get { throw null; } }
public virtual System.Type AsType() { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents)]
public virtual System.Reflection.EventInfo? GetDeclaredEvent(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields)]
public virtual System.Reflection.FieldInfo? GetDeclaredField(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public virtual System.Reflection.MethodInfo? GetDeclaredMethod(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods)]
public virtual System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> GetDeclaredMethods(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes)]
public virtual System.Reflection.TypeInfo? GetDeclaredNestedType(string name) { throw null; }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
public virtual System.Reflection.PropertyInfo? GetDeclaredProperty(string name) { throw null; }
public virtual bool IsAssignableFrom([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Reflection.TypeInfo? typeInfo) { throw null; }
System.Reflection.TypeInfo System.Reflection.IReflectableType.GetTypeInfo() { throw null; }
}
}
namespace System.Resources
{
public partial interface IResourceReader : System.Collections.IEnumerable, System.IDisposable
{
void Close();
new System.Collections.IDictionaryEnumerator GetEnumerator();
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public partial class MissingManifestResourceException : System.SystemException
{
public MissingManifestResourceException() { }
protected MissingManifestResourceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingManifestResourceException(string? message) { }
public MissingManifestResourceException(string? message, System.Exception? inner) { }
}
public partial class MissingSatelliteAssemblyException : System.SystemException
{
public MissingSatelliteAssemblyException() { }
protected MissingSatelliteAssemblyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public MissingSatelliteAssemblyException(string? message) { }
public MissingSatelliteAssemblyException(string? message, System.Exception? inner) { }
public MissingSatelliteAssemblyException(string? message, string? cultureName) { }
public string? CultureName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class NeutralResourcesLanguageAttribute : System.Attribute
{
public NeutralResourcesLanguageAttribute(string cultureName) { }
public NeutralResourcesLanguageAttribute(string cultureName, System.Resources.UltimateResourceFallbackLocation location) { }
public string CultureName { get { throw null; } }
public System.Resources.UltimateResourceFallbackLocation Location { get { throw null; } }
}
public partial class ResourceManager
{
public static readonly int HeaderVersionNumber;
public static readonly int MagicNumber;
protected System.Reflection.Assembly? MainAssembly;
protected ResourceManager() { }
public ResourceManager(string baseName, System.Reflection.Assembly assembly) { }
public ResourceManager(string baseName, System.Reflection.Assembly assembly, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type? usingResourceSet) { }
public ResourceManager(System.Type resourceSource) { }
public virtual string BaseName { get { throw null; } }
protected System.Resources.UltimateResourceFallbackLocation FallbackLocation { get { throw null; } set { } }
public virtual bool IgnoreCase { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)]
public virtual System.Type ResourceSetType { get { throw null; } }
public static System.Resources.ResourceManager CreateFileBasedResourceManager(string baseName, string resourceDir, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type? usingResourceSet) { throw null; }
protected static System.Globalization.CultureInfo GetNeutralResourcesLanguage(System.Reflection.Assembly a) { throw null; }
public virtual object? GetObject(string name) { throw null; }
public virtual object? GetObject(string name, System.Globalization.CultureInfo? culture) { throw null; }
protected virtual string GetResourceFileName(System.Globalization.CultureInfo culture) { throw null; }
public virtual System.Resources.ResourceSet? GetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents) { throw null; }
protected static System.Version? GetSatelliteContractVersion(System.Reflection.Assembly a) { throw null; }
public System.IO.UnmanagedMemoryStream? GetStream(string name) { throw null; }
public System.IO.UnmanagedMemoryStream? GetStream(string name, System.Globalization.CultureInfo? culture) { throw null; }
public virtual string? GetString(string name) { throw null; }
public virtual string? GetString(string name, System.Globalization.CultureInfo? culture) { throw null; }
protected virtual System.Resources.ResourceSet? InternalGetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents) { throw null; }
public virtual void ReleaseAllResources() { }
}
public sealed partial class ResourceReader : System.Collections.IEnumerable, System.IDisposable, System.Resources.IResourceReader
{
public ResourceReader(System.IO.Stream stream) { }
public ResourceReader(string fileName) { }
public void Close() { }
public void Dispose() { }
public System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
public void GetResourceData(string resourceName, out string resourceType, out byte[] resourceData) { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public partial class ResourceSet : System.Collections.IEnumerable, System.IDisposable
{
protected ResourceSet() { }
public ResourceSet(System.IO.Stream stream) { }
public ResourceSet(System.Resources.IResourceReader reader) { }
public ResourceSet(string fileName) { }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public virtual System.Type GetDefaultReader() { throw null; }
public virtual System.Type GetDefaultWriter() { throw null; }
public virtual System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
public virtual object? GetObject(string name) { throw null; }
public virtual object? GetObject(string name, bool ignoreCase) { throw null; }
public virtual string? GetString(string name) { throw null; }
public virtual string? GetString(string name, bool ignoreCase) { throw null; }
protected virtual void ReadResources() { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class SatelliteContractVersionAttribute : System.Attribute
{
public SatelliteContractVersionAttribute(string version) { }
public string Version { get { throw null; } }
}
public enum UltimateResourceFallbackLocation
{
MainAssembly = 0,
Satellite = 1,
}
}
namespace System.Runtime
{
public sealed partial class AmbiguousImplementationException : System.Exception
{
public AmbiguousImplementationException() { }
public AmbiguousImplementationException(string? message) { }
public AmbiguousImplementationException(string? message, System.Exception? innerException) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class AssemblyTargetedPatchBandAttribute : System.Attribute
{
public AssemblyTargetedPatchBandAttribute(string targetedPatchBand) { }
public string TargetedPatchBand { get { throw null; } }
}
public partial struct DependentHandle : System.IDisposable
{
private object _dummy;
private int _dummyPrimitive;
public DependentHandle(object? target, object? dependent) { throw null; }
public object? Dependent { get { throw null; } set { } }
public bool IsAllocated { get { throw null; } }
public object? Target { get { throw null; } set { } }
public (object? Target, object? Dependent) TargetAndDependent { get { throw null; } }
public void Dispose() { }
}
public enum GCLargeObjectHeapCompactionMode
{
Default = 1,
CompactOnce = 2,
}
public enum GCLatencyMode
{
Batch = 0,
Interactive = 1,
LowLatency = 2,
SustainedLowLatency = 3,
NoGCRegion = 4,
}
public static partial class GCSettings
{
public static bool IsServerGC { get { throw null; } }
public static System.Runtime.GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode { get { throw null; } set { } }
public static System.Runtime.GCLatencyMode LatencyMode { get { throw null; } set { } }
}
public static partial class JitInfo
{
public static System.TimeSpan GetCompilationTime(bool currentThread = false) { throw null; }
public static long GetCompiledILBytes(bool currentThread = false) { throw null; }
public static long GetCompiledMethodCount(bool currentThread = false) { throw null; }
}
public sealed partial class MemoryFailPoint : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
{
public MemoryFailPoint(int sizeInMegabytes) { }
public void Dispose() { }
~MemoryFailPoint() { }
}
public static partial class ProfileOptimization
{
public static void SetProfileRoot(string directoryPath) { }
public static void StartProfile(string? profile) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed partial class TargetedPatchingOptOutAttribute : System.Attribute
{
public TargetedPatchingOptOutAttribute(string reason) { }
public string Reason { get { throw null; } }
}
}
namespace System.Runtime.CompilerServices
{
[System.AttributeUsageAttribute(System.AttributeTargets.Field)]
public sealed partial class AccessedThroughPropertyAttribute : System.Attribute
{
public AccessedThroughPropertyAttribute(string propertyName) { }
public string PropertyName { get { throw null; } }
}
public partial struct AsyncIteratorMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void Complete() { }
public static System.Runtime.CompilerServices.AsyncIteratorMethodBuilder Create() { throw null; }
public void MoveNext<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public sealed partial class AsyncIteratorStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
{
public AsyncIteratorStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
public sealed partial class AsyncMethodBuilderAttribute : System.Attribute
{
public AsyncMethodBuilderAttribute(System.Type builderType) { }
public System.Type BuilderType { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public sealed partial class AsyncStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
{
public AsyncStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
}
public partial struct AsyncTaskMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.Task Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncTaskMethodBuilder Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct AsyncTaskMethodBuilder<TResult>
{
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.Task<TResult> Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult> Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult(TResult result) { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct AsyncValueTaskMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.ValueTask Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct AsyncValueTaskMethodBuilder<TResult>
{
private TResult _result;
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.ValueTask<TResult> Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<TResult> Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult(TResult result) { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct AsyncVoidMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.AsyncVoidMethodBuilder Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial class CallConvCdecl
{
public CallConvCdecl() { }
}
public partial class CallConvFastcall
{
public CallConvFastcall() { }
}
public partial class CallConvMemberFunction
{
public CallConvMemberFunction() { }
}
public partial class CallConvStdcall
{
public CallConvStdcall() { }
}
public partial class CallConvSuppressGCTransition
{
public CallConvSuppressGCTransition() { }
}
public partial class CallConvThiscall
{
public CallConvThiscall() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)]
public sealed partial class CallerArgumentExpressionAttribute : System.Attribute
{
public CallerArgumentExpressionAttribute(string parameterName) { }
public string ParameterName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class CallerFilePathAttribute : System.Attribute
{
public CallerFilePathAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class CallerLineNumberAttribute : System.Attribute
{
public CallerLineNumberAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class CallerMemberNameAttribute : System.Attribute
{
public CallerMemberNameAttribute() { }
}
[System.FlagsAttribute]
public enum CompilationRelaxations
{
NoStringInterning = 8,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method | System.AttributeTargets.Module)]
public partial class CompilationRelaxationsAttribute : System.Attribute
{
public CompilationRelaxationsAttribute(int relaxations) { }
public CompilationRelaxationsAttribute(System.Runtime.CompilerServices.CompilationRelaxations relaxations) { }
public int CompilationRelaxations { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=true)]
public sealed partial class CompilerGeneratedAttribute : System.Attribute
{
public CompilerGeneratedAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class)]
public partial class CompilerGlobalScopeAttribute : System.Attribute
{
public CompilerGlobalScopeAttribute() { }
}
public sealed partial class ConditionalWeakTable<TKey, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]TValue> : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerable where TKey : class where TValue : class?
{
public ConditionalWeakTable() { }
public void Add(TKey key, TValue value) { }
public void AddOrUpdate(TKey key, TValue value) { }
public void Clear() { }
public TValue GetOrCreateValue(TKey key) { throw null; }
public TValue GetValue(TKey key, System.Runtime.CompilerServices.ConditionalWeakTable<TKey, TValue>.CreateValueCallback createValueCallback) { throw null; }
public bool Remove(TKey key) { throw null; }
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
public bool TryGetValue(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; }
public delegate TValue CreateValueCallback(TKey key);
}
public readonly partial struct ConfiguredAsyncDisposable
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable DisposeAsync() { throw null; }
}
public readonly partial struct ConfiguredCancelableAsyncEnumerable<T>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T>.Enumerator GetAsyncEnumerator() { throw null; }
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> WithCancellation(System.Threading.CancellationToken cancellationToken) { throw null; }
public readonly partial struct Enumerator
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public T Current { get { throw null; } }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable DisposeAsync() { throw null; }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<bool> MoveNextAsync() { throw null; }
}
}
public readonly partial struct ConfiguredTaskAwaitable
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter GetAwaiter() { throw null; }
public readonly partial struct ConfiguredTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
public readonly partial struct ConfiguredTaskAwaitable<TResult>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter GetAwaiter() { throw null; }
public readonly partial struct ConfiguredTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public TResult GetResult() { throw null; }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
public readonly partial struct ConfiguredValueTaskAwaitable
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter GetAwaiter() { throw null; }
public readonly partial struct ConfiguredValueTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
public readonly partial struct ConfiguredValueTaskAwaitable<TResult>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult>.ConfiguredValueTaskAwaiter GetAwaiter() { throw null; }
public readonly partial struct ConfiguredValueTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public TResult GetResult() { throw null; }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter, Inherited=false)]
public abstract partial class CustomConstantAttribute : System.Attribute
{
protected CustomConstantAttribute() { }
public abstract object? Value { get; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class DateTimeConstantAttribute : System.Runtime.CompilerServices.CustomConstantAttribute
{
public DateTimeConstantAttribute(long ticks) { }
public override object Value { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class DecimalConstantAttribute : System.Attribute
{
public DecimalConstantAttribute(byte scale, byte sign, int hi, int mid, int low) { }
[System.CLSCompliantAttribute(false)]
public DecimalConstantAttribute(byte scale, byte sign, uint hi, uint mid, uint low) { }
public decimal Value { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly)]
public sealed partial class DefaultDependencyAttribute : System.Attribute
{
public DefaultDependencyAttribute(System.Runtime.CompilerServices.LoadHint loadHintArgument) { }
public System.Runtime.CompilerServices.LoadHint LoadHint { get { throw null; } }
}
[System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute]
public ref partial struct DefaultInterpolatedStringHandler
{
private object _dummy;
private int _dummyPrimitive;
public DefaultInterpolatedStringHandler(int literalLength, int formattedCount) { throw null; }
public DefaultInterpolatedStringHandler(int literalLength, int formattedCount, System.IFormatProvider? provider) { throw null; }
public DefaultInterpolatedStringHandler(int literalLength, int formattedCount, System.IFormatProvider? provider, System.Span<char> initialBuffer) { throw null; }
public void AppendFormatted(object? value, int alignment = 0, string? format = null) { }
public void AppendFormatted(System.ReadOnlySpan<char> value) { }
public void AppendFormatted(System.ReadOnlySpan<char> value, int alignment = 0, string? format = null) { }
public void AppendFormatted(string? value) { }
public void AppendFormatted(string? value, int alignment = 0, string? format = null) { }
public void AppendFormatted<T>(T value) { }
public void AppendFormatted<T>(T value, int alignment) { }
public void AppendFormatted<T>(T value, int alignment, string? format) { }
public void AppendFormatted<T>(T value, string? format) { }
public void AppendLiteral(string value) { }
public override string ToString() { throw null; }
public string ToStringAndClear() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true)]
public sealed partial class DependencyAttribute : System.Attribute
{
public DependencyAttribute(string dependentAssemblyArgument, System.Runtime.CompilerServices.LoadHint loadHintArgument) { }
public string DependentAssembly { get { throw null; } }
public System.Runtime.CompilerServices.LoadHint LoadHint { get { throw null; } }
}
[System.ObsoleteAttribute("DisablePrivateReflectionAttribute has no effect in .NET 6.0+.", DiagnosticId = "SYSLIB0015", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class DisablePrivateReflectionAttribute : System.Attribute
{
public DisablePrivateReflectionAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
public sealed class DisableRuntimeMarshallingAttribute : Attribute
{
public DisableRuntimeMarshallingAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All)]
public partial class DiscardableAttribute : System.Attribute
{
public DiscardableAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class EnumeratorCancellationAttribute : System.Attribute
{
public EnumeratorCancellationAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method)]
public sealed partial class ExtensionAttribute : System.Attribute
{
public ExtensionAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field)]
public sealed partial class FixedAddressValueTypeAttribute : System.Attribute
{
public FixedAddressValueTypeAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public sealed partial class FixedBufferAttribute : System.Attribute
{
public FixedBufferAttribute(System.Type elementType, int length) { }
public System.Type ElementType { get { throw null; } }
public int Length { get { throw null; } }
}
public static partial class FormattableStringFactory
{
public static System.FormattableString Create(string format, params object?[] arguments) { throw null; }
}
public partial interface IAsyncStateMachine
{
void MoveNext();
void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine);
}
public partial interface ICriticalNotifyCompletion : System.Runtime.CompilerServices.INotifyCompletion
{
void UnsafeOnCompleted(System.Action continuation);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property, Inherited=true)]
public sealed partial class IndexerNameAttribute : System.Attribute
{
public IndexerNameAttribute(string indexerName) { }
}
public partial interface INotifyCompletion
{
void OnCompleted(System.Action continuation);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed partial class InternalsVisibleToAttribute : System.Attribute
{
public InternalsVisibleToAttribute(string assemblyName) { }
public bool AllInternalsVisible { get { throw null; } set { } }
public string AssemblyName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, AllowMultiple=false, Inherited=false)]
public sealed partial class InterpolatedStringHandlerArgumentAttribute : System.Attribute
{
public InterpolatedStringHandlerArgumentAttribute(string argument) { }
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { }
public string[] Arguments { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed partial class InterpolatedStringHandlerAttribute : System.Attribute
{
public InterpolatedStringHandlerAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Struct)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class IsByRefLikeAttribute : System.Attribute
{
public IsByRefLikeAttribute() { }
}
public static partial class IsConst
{
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static partial class IsExternalInit
{
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=false)]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public sealed partial class IsReadOnlyAttribute : System.Attribute
{
public IsReadOnlyAttribute() { }
}
public partial interface IStrongBox
{
object? Value { get; set; }
}
public static partial class IsVolatile
{
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public sealed partial class IteratorStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
{
public IteratorStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
}
public partial interface ITuple
{
object? this[int index] { get; }
int Length { get; }
}
public enum LoadHint
{
Default = 0,
Always = 1,
Sometimes = 2,
}
public enum MethodCodeType
{
IL = 0,
Native = 1,
OPTIL = 2,
Runtime = 3,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class MethodImplAttribute : System.Attribute
{
public System.Runtime.CompilerServices.MethodCodeType MethodCodeType;
public MethodImplAttribute() { }
public MethodImplAttribute(short value) { }
public MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions methodImplOptions) { }
public System.Runtime.CompilerServices.MethodImplOptions Value { get { throw null; } }
}
[System.FlagsAttribute]
public enum MethodImplOptions
{
Unmanaged = 4,
NoInlining = 8,
ForwardRef = 16,
Synchronized = 32,
NoOptimization = 64,
PreserveSig = 128,
AggressiveInlining = 256,
AggressiveOptimization = 512,
InternalCall = 4096,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class ModuleInitializerAttribute : System.Attribute
{
public ModuleInitializerAttribute() { }
}
public partial struct PoolingAsyncValueTaskMethodBuilder
{
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.ValueTask Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct PoolingAsyncValueTaskMethodBuilder<TResult>
{
private TResult _result;
private object _dummy;
private int _dummyPrimitive;
public System.Threading.Tasks.ValueTask<TResult> Task { get { throw null; } }
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
public static System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder<TResult> Create() { throw null; }
public void SetException(System.Exception exception) { }
public void SetResult(TResult result) { }
public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
public sealed partial class PreserveBaseOverridesAttribute : System.Attribute
{
public PreserveBaseOverridesAttribute() { }
}
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class RequiredMemberAttribute : System.Attribute
{
public RequiredMemberAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed partial class ReferenceAssemblyAttribute : System.Attribute
{
public ReferenceAssemblyAttribute() { }
public ReferenceAssemblyAttribute(string? description) { }
public string? Description { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false, AllowMultiple=false)]
public sealed partial class RuntimeCompatibilityAttribute : System.Attribute
{
public RuntimeCompatibilityAttribute() { }
public bool WrapNonExceptionThrows { get { throw null; } set { } }
}
public static partial class RuntimeFeature
{
public const string ByRefFields = "ByRefFields";
public const string CovariantReturnsOfClasses = "CovariantReturnsOfClasses";
public const string DefaultImplementationsOfInterfaces = "DefaultImplementationsOfInterfaces";
public const string PortablePdb = "PortablePdb";
public const string UnmanagedSignatureCallingConvention = "UnmanagedSignatureCallingConvention";
[System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")]
public const string VirtualStaticsInInterfaces = "VirtualStaticsInInterfaces";
public static bool IsDynamicCodeCompiled { get { throw null; } }
public static bool IsDynamicCodeSupported { get { throw null; } }
public static bool IsSupported(string feature) { throw null; }
}
public static partial class RuntimeHelpers
{
[System.ObsoleteAttribute("OffsetToStringData has been deprecated. Use string.GetPinnableReference() instead.")]
public static int OffsetToStringData { get { throw null; } }
public static System.IntPtr AllocateTypeAssociatedMemory(System.Type type, int size) { throw null; }
public static System.ReadOnlySpan<T> CreateSpan<T>(System.RuntimeFieldHandle fldHandle) { throw null; }
public static void EnsureSufficientExecutionStack() { }
public static new bool Equals(object? o1, object? o2) { throw null; }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void ExecuteCodeWithGuaranteedCleanup(System.Runtime.CompilerServices.RuntimeHelpers.TryCode code, System.Runtime.CompilerServices.RuntimeHelpers.CleanupCode backoutCode, object? userData) { }
public static int GetHashCode(object? o) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("obj")]
public static object? GetObjectValue(object? obj) { throw null; }
public static T[] GetSubArray<T>(T[] array, System.Range range) { throw null; }
public static object GetUninitializedObject([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] System.Type type) { throw null; }
public static void InitializeArray(System.Array array, System.RuntimeFieldHandle fldHandle) { }
public static bool IsReferenceOrContainsReferences<T>() { throw null; }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void PrepareConstrainedRegions() { }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void PrepareConstrainedRegionsNoOP() { }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void PrepareContractedDelegate(System.Delegate d) { }
public static void PrepareDelegate(System.Delegate d) { }
public static void PrepareMethod(System.RuntimeMethodHandle method) { }
public static void PrepareMethod(System.RuntimeMethodHandle method, System.RuntimeTypeHandle[]? instantiation) { }
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static void ProbeForSufficientStack() { }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Trimmer can't guarantee existence of class constructor")]
public static void RunClassConstructor(System.RuntimeTypeHandle type) { }
public static void RunModuleConstructor(System.ModuleHandle module) { }
public static bool TryEnsureSufficientExecutionStack() { throw null; }
public delegate void CleanupCode(object? userData, bool exceptionThrown);
public delegate void TryCode(object? userData);
}
public sealed partial class RuntimeWrappedException : System.Exception
{
public RuntimeWrappedException(object thrownObject) { }
public object WrappedException { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class SkipLocalsInitAttribute : System.Attribute
{
public SkipLocalsInitAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct)]
public sealed partial class SpecialNameAttribute : System.Attribute
{
public SpecialNameAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
public partial class StateMachineAttribute : System.Attribute
{
public StateMachineAttribute(System.Type stateMachineType) { }
public System.Type StateMachineType { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)]
public sealed partial class StringFreezingAttribute : System.Attribute
{
public StringFreezingAttribute() { }
}
public partial class StrongBox<T> : System.Runtime.CompilerServices.IStrongBox
{
[System.Diagnostics.CodeAnalysis.MaybeNullAttribute]
public T Value;
public StrongBox() { }
public StrongBox(T value) { }
object? System.Runtime.CompilerServices.IStrongBox.Value { get { throw null; } set { } }
}
[System.ObsoleteAttribute("SuppressIldasmAttribute has no effect in .NET 6.0+.", DiagnosticId = "SYSLIB0025", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Module)]
public sealed partial class SuppressIldasmAttribute : System.Attribute
{
public SuppressIldasmAttribute() { }
}
public sealed partial class SwitchExpressionException : System.InvalidOperationException
{
public SwitchExpressionException() { }
public SwitchExpressionException(System.Exception? innerException) { }
public SwitchExpressionException(object? unmatchedValue) { }
public SwitchExpressionException(string? message) { }
public SwitchExpressionException(string? message, System.Exception? innerException) { }
public override string Message { get { throw null; } }
public object? UnmatchedValue { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public readonly partial struct TaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
public readonly partial struct TaskAwaiter<TResult> : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public TResult GetResult() { throw null; }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue | System.AttributeTargets.Struct)]
[System.CLSCompliantAttribute(false)]
public sealed partial class TupleElementNamesAttribute : System.Attribute
{
public TupleElementNamesAttribute(string?[] transformNames) { }
public System.Collections.Generic.IList<string?> TransformNames { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false, AllowMultiple=false)]
public sealed partial class TypeForwardedFromAttribute : System.Attribute
{
public TypeForwardedFromAttribute(string assemblyFullName) { }
public string AssemblyFullName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed partial class TypeForwardedToAttribute : System.Attribute
{
public TypeForwardedToAttribute(System.Type destination) { }
public System.Type Destination { get { throw null; } }
}
public static partial class Unsafe
{
public static ref T AddByteOffset<T>(ref T source, System.IntPtr byteOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ref T AddByteOffset<T>(ref T source, nuint byteOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void* Add<T>(void* source, int elementOffset) { throw null; }
public static ref T Add<T>(ref T source, int elementOffset) { throw null; }
public static ref T Add<T>(ref T source, System.IntPtr elementOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ref T Add<T>(ref T source, nuint elementOffset) { throw null; }
public static bool AreSame<T>([System.Diagnostics.CodeAnalysis.AllowNull] ref T left, [System.Diagnostics.CodeAnalysis.AllowNull] ref T right) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void* AsPointer<T>(ref T value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static ref T AsRef<T>(void* source) { throw null; }
public static ref T AsRef<T>(in T source) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("o")]
public static T? As<T>(object? o) where T : class? { throw null; }
public static ref TTo As<TFrom, TTo>(ref TFrom source) { throw null; }
public static System.IntPtr ByteOffset<T>([System.Diagnostics.CodeAnalysis.AllowNull] ref T origin, [System.Diagnostics.CodeAnalysis.AllowNull] ref T target) { throw null; }
[System.CLSCompliantAttribute(false)]
public static void CopyBlock(ref byte destination, ref byte source, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void CopyBlock(void* destination, void* source, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void Copy<T>(void* destination, ref T source) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void Copy<T>(ref T destination, void* source) { }
[System.CLSCompliantAttribute(false)]
public static void InitBlock(ref byte startAddress, byte value, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount) { }
public static bool IsAddressGreaterThan<T>([System.Diagnostics.CodeAnalysis.AllowNull] ref T left, [System.Diagnostics.CodeAnalysis.AllowNull] ref T right) { throw null; }
public static bool IsAddressLessThan<T>([System.Diagnostics.CodeAnalysis.AllowNull] ref T left, [System.Diagnostics.CodeAnalysis.AllowNull] ref T right) { throw null; }
public static bool IsNullRef<T>(ref T source) { throw null; }
public static ref T NullRef<T>() { throw null; }
public static T ReadUnaligned<T>(ref byte source) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static T ReadUnaligned<T>(void* source) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static T Read<T>(void* source) { throw null; }
public static void SkipInit<T>(out T value) { throw null; }
public static int SizeOf<T>() { throw null; }
public static ref T SubtractByteOffset<T>(ref T source, System.IntPtr byteOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ref T SubtractByteOffset<T>(ref T source, nuint byteOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe static void* Subtract<T>(void* source, int elementOffset) { throw null; }
public static ref T Subtract<T>(ref T source, int elementOffset) { throw null; }
public static ref T Subtract<T>(ref T source, System.IntPtr elementOffset) { throw null; }
[System.CLSCompliantAttribute(false)]
public static ref T Subtract<T>(ref T source, nuint elementOffset) { throw null; }
public static ref T Unbox<T>(object box) where T : struct { throw null; }
public static void WriteUnaligned<T>(ref byte destination, T value) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void WriteUnaligned<T>(void* destination, T value) { }
[System.CLSCompliantAttribute(false)]
public unsafe static void Write<T>(void* destination, T value) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Struct)]
public sealed partial class UnsafeValueTypeAttribute : System.Attribute
{
public UnsafeValueTypeAttribute() { }
}
public readonly partial struct ValueTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
public readonly partial struct ValueTaskAwaiter<TResult> : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public bool IsCompleted { get { throw null; } }
public TResult GetResult() { throw null; }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
public readonly partial struct YieldAwaitable
{
public System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter GetAwaiter() { throw null; }
public readonly partial struct YieldAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
{
public bool IsCompleted { get { throw null; } }
public void GetResult() { }
public void OnCompleted(System.Action continuation) { }
public void UnsafeOnCompleted(System.Action continuation) { }
}
}
}
namespace System.Runtime.ConstrainedExecution
{
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public enum Cer
{
None = 0,
MayFail = 1,
Success = 2,
}
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public enum Consistency
{
MayCorruptProcess = 0,
MayCorruptAppDomain = 1,
MayCorruptInstance = 2,
WillNotCorruptState = 3,
}
public abstract partial class CriticalFinalizerObject
{
protected CriticalFinalizerObject() { }
~CriticalFinalizerObject() { }
}
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method, Inherited=false)]
public sealed partial class PrePrepareMethodAttribute : System.Attribute
{
public PrePrepareMethodAttribute() { }
}
[System.ObsoleteAttribute("The Constrained Execution Region (CER) feature is not supported.", DiagnosticId = "SYSLIB0004", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class ReliabilityContractAttribute : System.Attribute
{
public ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency consistencyGuarantee, System.Runtime.ConstrainedExecution.Cer cer) { }
public System.Runtime.ConstrainedExecution.Cer Cer { get { throw null; } }
public System.Runtime.ConstrainedExecution.Consistency ConsistencyGuarantee { get { throw null; } }
}
}
namespace System.Runtime.ExceptionServices
{
public sealed partial class ExceptionDispatchInfo
{
internal ExceptionDispatchInfo() { }
public System.Exception SourceException { get { throw null; } }
public static System.Runtime.ExceptionServices.ExceptionDispatchInfo Capture(System.Exception source) { throw null; }
public static System.Exception SetCurrentStackTrace(System.Exception source) { throw null; }
public static System.Exception SetRemoteStackTrace(System.Exception source, string stackTrace) { throw null; }
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public void Throw() => throw null;
[System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute]
public static void Throw(System.Exception source) => throw null;
}
public partial class FirstChanceExceptionEventArgs : System.EventArgs
{
public FirstChanceExceptionEventArgs(System.Exception exception) { }
public System.Exception Exception { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]
[System.ObsoleteAttribute("Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.", DiagnosticId = "SYSLIB0032", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public sealed partial class HandleProcessCorruptedStateExceptionsAttribute : System.Attribute
{
public HandleProcessCorruptedStateExceptionsAttribute() { }
}
}
namespace System.Runtime.InteropServices
{
public enum Architecture
{
X86 = 0,
X64 = 1,
Arm = 2,
Arm64 = 3,
Wasm = 4,
S390x = 5,
LoongArch64 = 6,
Armv6 = 7,
}
public enum CharSet
{
None = 1,
Ansi = 2,
Unicode = 3,
Auto = 4,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class ComVisibleAttribute : System.Attribute
{
public ComVisibleAttribute(bool visibility) { }
public bool Value { get { throw null; } }
}
public abstract partial class CriticalHandle : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
{
protected System.IntPtr handle;
protected CriticalHandle(System.IntPtr invalidHandleValue) { }
public bool IsClosed { get { throw null; } }
public abstract bool IsInvalid { get; }
public void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~CriticalHandle() { }
protected abstract bool ReleaseHandle();
protected void SetHandle(System.IntPtr handle) { }
public void SetHandleAsInvalid() { }
}
public partial class ExternalException : System.SystemException
{
public ExternalException() { }
protected ExternalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public ExternalException(string? message) { }
public ExternalException(string? message, System.Exception? inner) { }
public ExternalException(string? message, int errorCode) { }
public virtual int ErrorCode { get { throw null; } }
public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public sealed partial class FieldOffsetAttribute : System.Attribute
{
public FieldOffsetAttribute(int offset) { }
public int Value { get { throw null; } }
}
public partial struct GCHandle : System.IEquatable<System.Runtime.InteropServices.GCHandle>
{
private int _dummyPrimitive;
public bool IsAllocated { get { throw null; } }
public object? Target { get { throw null; } set { } }
public System.IntPtr AddrOfPinnedObject() { throw null; }
public static System.Runtime.InteropServices.GCHandle Alloc(object? value) { throw null; }
public static System.Runtime.InteropServices.GCHandle Alloc(object? value, System.Runtime.InteropServices.GCHandleType type) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? o) { throw null; }
public bool Equals(System.Runtime.InteropServices.GCHandle other) { throw null; }
public void Free() { }
public static System.Runtime.InteropServices.GCHandle FromIntPtr(System.IntPtr value) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Runtime.InteropServices.GCHandle a, System.Runtime.InteropServices.GCHandle b) { throw null; }
public static explicit operator System.Runtime.InteropServices.GCHandle (System.IntPtr value) { throw null; }
public static explicit operator System.IntPtr (System.Runtime.InteropServices.GCHandle value) { throw null; }
public static bool operator !=(System.Runtime.InteropServices.GCHandle a, System.Runtime.InteropServices.GCHandle b) { throw null; }
public static System.IntPtr ToIntPtr(System.Runtime.InteropServices.GCHandle value) { throw null; }
}
public enum GCHandleType
{
Weak = 0,
WeakTrackResurrection = 1,
Normal = 2,
Pinned = 3,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class InAttribute : System.Attribute
{
public InAttribute() { }
}
public enum LayoutKind
{
Sequential = 0,
Explicit = 2,
Auto = 3,
}
public readonly partial struct OSPlatform : System.IEquatable<System.Runtime.InteropServices.OSPlatform>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public static System.Runtime.InteropServices.OSPlatform FreeBSD { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform Linux { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform OSX { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform Windows { get { throw null; } }
public static System.Runtime.InteropServices.OSPlatform Create(string osPlatform) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Runtime.InteropServices.OSPlatform other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; }
public static bool operator !=(System.Runtime.InteropServices.OSPlatform left, System.Runtime.InteropServices.OSPlatform right) { throw null; }
public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter, Inherited=false)]
public sealed partial class OutAttribute : System.Attribute
{
public OutAttribute() { }
}
public static partial class RuntimeInformation
{
public static string FrameworkDescription { get { throw null; } }
public static System.Runtime.InteropServices.Architecture OSArchitecture { get { throw null; } }
public static string OSDescription { get { throw null; } }
public static System.Runtime.InteropServices.Architecture ProcessArchitecture { get { throw null; } }
public static string RuntimeIdentifier { get { throw null; } }
public static bool IsOSPlatform(System.Runtime.InteropServices.OSPlatform osPlatform) { throw null; }
}
public abstract partial class SafeBuffer : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
protected SafeBuffer(bool ownsHandle) : base (default(bool)) { }
[System.CLSCompliantAttribute(false)]
public ulong ByteLength { get { throw null; } }
[System.CLSCompliantAttribute(false)]
public unsafe void AcquirePointer(ref byte* pointer) { }
[System.CLSCompliantAttribute(false)]
public void Initialize(uint numElements, uint sizeOfEachElement) { }
[System.CLSCompliantAttribute(false)]
public void Initialize(ulong numBytes) { }
[System.CLSCompliantAttribute(false)]
public void Initialize<T>(uint numElements) where T : struct { }
[System.CLSCompliantAttribute(false)]
public void ReadArray<T>(ulong byteOffset, T[] array, int index, int count) where T : struct { }
[System.CLSCompliantAttribute(false)]
public void ReadSpan<T>(ulong byteOffset, System.Span<T> buffer) where T : struct { }
[System.CLSCompliantAttribute(false)]
public T Read<T>(ulong byteOffset) where T : struct { throw null; }
public void ReleasePointer() { }
[System.CLSCompliantAttribute(false)]
public void WriteArray<T>(ulong byteOffset, T[] array, int index, int count) where T : struct { }
[System.CLSCompliantAttribute(false)]
public void WriteSpan<T>(ulong byteOffset, System.ReadOnlySpan<T> data) where T : struct { }
[System.CLSCompliantAttribute(false)]
public void Write<T>(ulong byteOffset, T value) where T : struct { }
}
public abstract partial class SafeHandle : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
{
protected System.IntPtr handle;
protected SafeHandle(System.IntPtr invalidHandleValue, bool ownsHandle) { }
public bool IsClosed { get { throw null; } }
public abstract bool IsInvalid { get; }
public void Close() { }
public void DangerousAddRef(ref bool success) { }
public System.IntPtr DangerousGetHandle() { throw null; }
public void DangerousRelease() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~SafeHandle() { }
protected abstract bool ReleaseHandle();
protected void SetHandle(System.IntPtr handle) { }
public void SetHandleAsInvalid() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class StructLayoutAttribute : System.Attribute
{
public System.Runtime.InteropServices.CharSet CharSet;
public int Pack;
public int Size;
public StructLayoutAttribute(short layoutKind) { }
public StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind layoutKind) { }
public System.Runtime.InteropServices.LayoutKind Value { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class SuppressGCTransitionAttribute : System.Attribute
{
public SuppressGCTransitionAttribute() { }
}
public enum UnmanagedType
{
Bool = 2,
I1 = 3,
U1 = 4,
I2 = 5,
U2 = 6,
I4 = 7,
U4 = 8,
I8 = 9,
U8 = 10,
R4 = 11,
R8 = 12,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling as Currency may be unavailable in future releases.")]
Currency = 15,
BStr = 19,
LPStr = 20,
LPWStr = 21,
LPTStr = 22,
ByValTStr = 23,
IUnknown = 25,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
IDispatch = 26,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
Struct = 27,
Interface = 28,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
SafeArray = 29,
ByValArray = 30,
SysInt = 31,
SysUInt = 32,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling as VBByRefString may be unavailable in future releases.")]
VBByRefStr = 34,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling as AnsiBStr may be unavailable in future releases.")]
AnsiBStr = 35,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling as TBstr may be unavailable in future releases.")]
TBStr = 36,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
VariantBool = 37,
FunctionPtr = 38,
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.ObsoleteAttribute("Marshalling arbitrary types may be unavailable in future releases. Specify the type you wish to marshal as.")]
AsAny = 40,
LPArray = 42,
LPStruct = 43,
CustomMarshaler = 44,
Error = 45,
IInspectable = 46,
HString = 47,
LPUTF8Str = 48,
}
}
namespace System.Runtime.Remoting
{
public partial class ObjectHandle : System.MarshalByRefObject
{
public ObjectHandle(object? o) { }
public object? Unwrap() { throw null; }
}
}
namespace System.Runtime.Serialization
{
public partial interface IDeserializationCallback
{
void OnDeserialization(object? sender);
}
[System.CLSCompliantAttribute(false)]
public partial interface IFormatterConverter
{
object Convert(object value, System.Type type);
object Convert(object value, System.TypeCode typeCode);
bool ToBoolean(object value);
byte ToByte(object value);
char ToChar(object value);
System.DateTime ToDateTime(object value);
decimal ToDecimal(object value);
double ToDouble(object value);
short ToInt16(object value);
int ToInt32(object value);
long ToInt64(object value);
sbyte ToSByte(object value);
float ToSingle(object value);
string? ToString(object value);
ushort ToUInt16(object value);
uint ToUInt32(object value);
ulong ToUInt64(object value);
}
public partial interface IObjectReference
{
object GetRealObject(System.Runtime.Serialization.StreamingContext context);
}
public partial interface ISafeSerializationData
{
void CompleteDeserialization(object deserialized);
}
public partial interface ISerializable
{
void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class OnDeserializedAttribute : System.Attribute
{
public OnDeserializedAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class OnDeserializingAttribute : System.Attribute
{
public OnDeserializingAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class OnSerializedAttribute : System.Attribute
{
public OnSerializedAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)]
public sealed partial class OnSerializingAttribute : System.Attribute
{
public OnSerializingAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)]
public sealed partial class OptionalFieldAttribute : System.Attribute
{
public OptionalFieldAttribute() { }
public int VersionAdded { get { throw null; } set { } }
}
public sealed partial class SafeSerializationEventArgs : System.EventArgs
{
internal SafeSerializationEventArgs() { }
public System.Runtime.Serialization.StreamingContext StreamingContext { get { throw null; } }
public void AddSerializedState(System.Runtime.Serialization.ISafeSerializationData serializedState) { }
}
public readonly partial struct SerializationEntry
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public string Name { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
public object? Value { get { throw null; } }
}
public partial class SerializationException : System.SystemException
{
public SerializationException() { }
protected SerializationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public SerializationException(string? message) { }
public SerializationException(string? message, System.Exception? innerException) { }
}
public sealed partial class SerializationInfo
{
[System.CLSCompliantAttribute(false)]
public SerializationInfo(System.Type type, System.Runtime.Serialization.IFormatterConverter converter) { }
[System.CLSCompliantAttribute(false)]
public SerializationInfo(System.Type type, System.Runtime.Serialization.IFormatterConverter converter, bool requireSameTokenInPartialTrust) { }
public string AssemblyName { get { throw null; } set { } }
public string FullTypeName { get { throw null; } set { } }
public bool IsAssemblyNameSetExplicit { get { throw null; } }
public bool IsFullTypeNameSetExplicit { get { throw null; } }
public int MemberCount { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
public void AddValue(string name, bool value) { }
public void AddValue(string name, byte value) { }
public void AddValue(string name, char value) { }
public void AddValue(string name, System.DateTime value) { }
public void AddValue(string name, decimal value) { }
public void AddValue(string name, double value) { }
public void AddValue(string name, short value) { }
public void AddValue(string name, int value) { }
public void AddValue(string name, long value) { }
public void AddValue(string name, object? value) { }
public void AddValue(string name, object? value, System.Type type) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, sbyte value) { }
public void AddValue(string name, float value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, ushort value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, uint value) { }
[System.CLSCompliantAttribute(false)]
public void AddValue(string name, ulong value) { }
public bool GetBoolean(string name) { throw null; }
public byte GetByte(string name) { throw null; }
public char GetChar(string name) { throw null; }
public System.DateTime GetDateTime(string name) { throw null; }
public decimal GetDecimal(string name) { throw null; }
public double GetDouble(string name) { throw null; }
public System.Runtime.Serialization.SerializationInfoEnumerator GetEnumerator() { throw null; }
public short GetInt16(string name) { throw null; }
public int GetInt32(string name) { throw null; }
public long GetInt64(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public sbyte GetSByte(string name) { throw null; }
public float GetSingle(string name) { throw null; }
public string? GetString(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public ushort GetUInt16(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public uint GetUInt32(string name) { throw null; }
[System.CLSCompliantAttribute(false)]
public ulong GetUInt64(string name) { throw null; }
public object? GetValue(string name, System.Type type) { throw null; }
public void SetType(System.Type type) { }
}
public sealed partial class SerializationInfoEnumerator : System.Collections.IEnumerator
{
internal SerializationInfoEnumerator() { }
public System.Runtime.Serialization.SerializationEntry Current { get { throw null; } }
public string Name { get { throw null; } }
public System.Type ObjectType { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
public object? Value { get { throw null; } }
public bool MoveNext() { throw null; }
public void Reset() { }
}
public readonly partial struct StreamingContext
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public StreamingContext(System.Runtime.Serialization.StreamingContextStates state) { throw null; }
public StreamingContext(System.Runtime.Serialization.StreamingContextStates state, object? additional) { throw null; }
public object? Context { get { throw null; } }
public System.Runtime.Serialization.StreamingContextStates State { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
[System.FlagsAttribute]
public enum StreamingContextStates
{
CrossProcess = 1,
CrossMachine = 2,
File = 4,
Persistence = 8,
Remoting = 16,
Other = 32,
Clone = 64,
CrossAppDomain = 128,
All = 255,
}
}
namespace System.Runtime.Versioning
{
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed partial class ComponentGuaranteesAttribute : System.Attribute
{
public ComponentGuaranteesAttribute(System.Runtime.Versioning.ComponentGuaranteesOptions guarantees) { }
public System.Runtime.Versioning.ComponentGuaranteesOptions Guarantees { get { throw null; } }
}
[System.FlagsAttribute]
public enum ComponentGuaranteesOptions
{
None = 0,
Exchange = 1,
Stable = 2,
SideBySide = 4,
}
public sealed partial class FrameworkName : System.IEquatable<System.Runtime.Versioning.FrameworkName?>
{
public FrameworkName(string frameworkName) { }
public FrameworkName(string identifier, System.Version version) { }
public FrameworkName(string identifier, System.Version version, string? profile) { }
public string FullName { get { throw null; } }
public string Identifier { get { throw null; } }
public string Profile { get { throw null; } }
public System.Version Version { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Runtime.Versioning.FrameworkName? other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Runtime.Versioning.FrameworkName? left, System.Runtime.Versioning.FrameworkName? right) { throw null; }
public static bool operator !=(System.Runtime.Versioning.FrameworkName? left, System.Runtime.Versioning.FrameworkName? right) { throw null; }
public override string ToString() { throw null; }
}
public abstract partial class OSPlatformAttribute : System.Attribute
{
private protected OSPlatformAttribute(string platformName) { }
public string PlatformName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, Inherited=false)]
public sealed partial class RequiresPreviewFeaturesAttribute : System.Attribute
{
public RequiresPreviewFeaturesAttribute() { }
public RequiresPreviewFeaturesAttribute(string? message) { }
public string? Message { get { throw null; } }
public string? Url { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)]
[System.Diagnostics.ConditionalAttribute("RESOURCE_ANNOTATION_WORK")]
public sealed partial class ResourceConsumptionAttribute : System.Attribute
{
public ResourceConsumptionAttribute(System.Runtime.Versioning.ResourceScope resourceScope) { }
public ResourceConsumptionAttribute(System.Runtime.Versioning.ResourceScope resourceScope, System.Runtime.Versioning.ResourceScope consumptionScope) { }
public System.Runtime.Versioning.ResourceScope ConsumptionScope { get { throw null; } }
public System.Runtime.Versioning.ResourceScope ResourceScope { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Constructor | System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, Inherited=false)]
[System.Diagnostics.ConditionalAttribute("RESOURCE_ANNOTATION_WORK")]
public sealed partial class ResourceExposureAttribute : System.Attribute
{
public ResourceExposureAttribute(System.Runtime.Versioning.ResourceScope exposureLevel) { }
public System.Runtime.Versioning.ResourceScope ResourceExposureLevel { get { throw null; } }
}
[System.FlagsAttribute]
public enum ResourceScope
{
None = 0,
Machine = 1,
Process = 2,
AppDomain = 4,
Library = 8,
Private = 16,
Assembly = 32,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed partial class SupportedOSPlatformAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public SupportedOSPlatformAttribute(string platformName) : base(platformName) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=true, Inherited=false)]
public sealed partial class SupportedOSPlatformGuardAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public SupportedOSPlatformGuardAttribute(string platformName) : base(platformName) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class TargetFrameworkAttribute : System.Attribute
{
public TargetFrameworkAttribute(string frameworkName) { }
public string? FrameworkDisplayName { get { throw null; } set { } }
public string FrameworkName { get { throw null; } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class TargetPlatformAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public TargetPlatformAttribute(string platformName) : base(platformName) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Enum | System.AttributeTargets.Event | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Module | System.AttributeTargets.Property | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed partial class UnsupportedOSPlatformAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public UnsupportedOSPlatformAttribute(string platformName) : base(platformName) { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=true, Inherited=false)]
public sealed partial class UnsupportedOSPlatformGuardAttribute : System.Runtime.Versioning.OSPlatformAttribute
{
public UnsupportedOSPlatformGuardAttribute(string platformName) : base(platformName) { }
}
public static partial class VersioningHelper
{
public static string MakeVersionSafeName(string? name, System.Runtime.Versioning.ResourceScope from, System.Runtime.Versioning.ResourceScope to) { throw null; }
public static string MakeVersionSafeName(string? name, System.Runtime.Versioning.ResourceScope from, System.Runtime.Versioning.ResourceScope to, System.Type? type) { throw null; }
}
}
namespace System.Security
{
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class AllowPartiallyTrustedCallersAttribute : System.Attribute
{
public AllowPartiallyTrustedCallersAttribute() { }
public System.Security.PartialTrustVisibilityLevel PartialTrustVisibilityLevel { get { throw null; } set { } }
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial interface IPermission : System.Security.ISecurityEncodable
{
System.Security.IPermission Copy();
void Demand();
System.Security.IPermission? Intersect(System.Security.IPermission? target);
bool IsSubsetOf(System.Security.IPermission? target);
System.Security.IPermission? Union(System.Security.IPermission? target);
}
public partial interface ISecurityEncodable
{
void FromXml(System.Security.SecurityElement e);
System.Security.SecurityElement? ToXml();
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial interface IStackWalk
{
void Assert();
void Demand();
void Deny();
void PermitOnly();
}
public enum PartialTrustVisibilityLevel
{
VisibleToAllHosts = 0,
NotVisibleByDefault = 1,
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public partial class PermissionSet : System.Collections.ICollection, System.Collections.IEnumerable, System.Runtime.Serialization.IDeserializationCallback, System.Security.ISecurityEncodable, System.Security.IStackWalk
{
public PermissionSet(System.Security.Permissions.PermissionState state) { }
public PermissionSet(System.Security.PermissionSet? permSet) { }
public virtual int Count { get { throw null; } }
public virtual bool IsReadOnly { get { throw null; } }
public virtual bool IsSynchronized { get { throw null; } }
public virtual object SyncRoot { get { throw null; } }
public System.Security.IPermission? AddPermission(System.Security.IPermission? perm) { throw null; }
protected virtual System.Security.IPermission? AddPermissionImpl(System.Security.IPermission? perm) { throw null; }
public void Assert() { }
public bool ContainsNonCodeAccessPermissions() { throw null; }
[System.ObsoleteAttribute]
public static byte[] ConvertPermissionSet(string inFormat, byte[] inData, string outFormat) { throw null; }
public virtual System.Security.PermissionSet Copy() { throw null; }
public virtual void CopyTo(System.Array array, int index) { }
public void Demand() { }
[System.ObsoleteAttribute]
public void Deny() { }
public override bool Equals(object? o) { throw null; }
public virtual void FromXml(System.Security.SecurityElement et) { }
public System.Collections.IEnumerator GetEnumerator() { throw null; }
protected virtual System.Collections.IEnumerator GetEnumeratorImpl() { throw null; }
public override int GetHashCode() { throw null; }
public System.Security.IPermission? GetPermission(System.Type? permClass) { throw null; }
protected virtual System.Security.IPermission? GetPermissionImpl(System.Type? permClass) { throw null; }
public System.Security.PermissionSet? Intersect(System.Security.PermissionSet? other) { throw null; }
public bool IsEmpty() { throw null; }
public bool IsSubsetOf(System.Security.PermissionSet? target) { throw null; }
public bool IsUnrestricted() { throw null; }
public void PermitOnly() { }
public System.Security.IPermission? RemovePermission(System.Type? permClass) { throw null; }
protected virtual System.Security.IPermission? RemovePermissionImpl(System.Type? permClass) { throw null; }
public static void RevertAssert() { }
public System.Security.IPermission? SetPermission(System.Security.IPermission? perm) { throw null; }
protected virtual System.Security.IPermission? SetPermissionImpl(System.Security.IPermission? perm) { throw null; }
void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object? sender) { }
public override string ToString() { throw null; }
public virtual System.Security.SecurityElement? ToXml() { throw null; }
public System.Security.PermissionSet? Union(System.Security.PermissionSet? other) { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed partial class SecurityCriticalAttribute : System.Attribute
{
public SecurityCriticalAttribute() { }
public SecurityCriticalAttribute(System.Security.SecurityCriticalScope scope) { }
[System.ObsoleteAttribute("SecurityCriticalScope is only used for .NET 2.0 transparency compatibility.")]
public System.Security.SecurityCriticalScope Scope { get { throw null; } }
}
[System.ObsoleteAttribute("SecurityCriticalScope is only used for .NET 2.0 transparency compatibility.")]
public enum SecurityCriticalScope
{
Explicit = 0,
Everything = 1,
}
public sealed partial class SecurityElement
{
public SecurityElement(string tag) { }
public SecurityElement(string tag, string? text) { }
public System.Collections.Hashtable? Attributes { get { throw null; } set { } }
public System.Collections.ArrayList? Children { get { throw null; } set { } }
public string Tag { get { throw null; } set { } }
public string? Text { get { throw null; } set { } }
public void AddAttribute(string name, string value) { }
public void AddChild(System.Security.SecurityElement child) { }
public string? Attribute(string name) { throw null; }
public System.Security.SecurityElement Copy() { throw null; }
public bool Equal([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Security.SecurityElement? other) { throw null; }
[return: System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("str")]
public static string? Escape(string? str) { throw null; }
public static System.Security.SecurityElement? FromString(string xml) { throw null; }
public static bool IsValidAttributeName([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? name) { throw null; }
public static bool IsValidAttributeValue([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? value) { throw null; }
public static bool IsValidTag([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? tag) { throw null; }
public static bool IsValidText([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] string? text) { throw null; }
public System.Security.SecurityElement? SearchForChildByTag(string tag) { throw null; }
public string? SearchForTextOfTag(string tag) { throw null; }
public override string ToString() { throw null; }
}
public partial class SecurityException : System.SystemException
{
public SecurityException() { }
protected SecurityException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public SecurityException(string? message) { }
public SecurityException(string? message, System.Exception? inner) { }
public SecurityException(string? message, System.Type? type) { }
public SecurityException(string? message, System.Type? type, string? state) { }
public object? Demanded { get { throw null; } set { } }
public object? DenySetInstance { get { throw null; } set { } }
public System.Reflection.AssemblyName? FailedAssemblyInfo { get { throw null; } set { } }
public string? GrantedSet { get { throw null; } set { } }
public System.Reflection.MethodInfo? Method { get { throw null; } set { } }
public string? PermissionState { get { throw null; } set { } }
public System.Type? PermissionType { get { throw null; } set { } }
public object? PermitOnlySetInstance { get { throw null; } set { } }
public string? RefusedSet { get { throw null; } set { } }
public string? Url { get { throw null; } set { } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed partial class SecurityRulesAttribute : System.Attribute
{
public SecurityRulesAttribute(System.Security.SecurityRuleSet ruleSet) { }
public System.Security.SecurityRuleSet RuleSet { get { throw null; } }
public bool SkipVerificationInFullTrust { get { throw null; } set { } }
}
public enum SecurityRuleSet : byte
{
None = (byte)0,
Level1 = (byte)1,
Level2 = (byte)2,
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed partial class SecuritySafeCriticalAttribute : System.Attribute
{
public SecuritySafeCriticalAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed partial class SecurityTransparentAttribute : System.Attribute
{
public SecurityTransparentAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Delegate | System.AttributeTargets.Enum | System.AttributeTargets.Field | System.AttributeTargets.Interface | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
[System.ObsoleteAttribute("SecurityTreatAsSafe is only used for .NET 2.0 transparency compatibility. Use the SecuritySafeCriticalAttribute instead.")]
public sealed partial class SecurityTreatAsSafeAttribute : System.Attribute
{
public SecurityTreatAsSafeAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Delegate | System.AttributeTargets.Interface | System.AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
public sealed partial class SuppressUnmanagedCodeSecurityAttribute : System.Attribute
{
public SuppressUnmanagedCodeSecurityAttribute() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Module, AllowMultiple=true, Inherited=false)]
public sealed partial class UnverifiableCodeAttribute : System.Attribute
{
public UnverifiableCodeAttribute() { }
}
public partial class VerificationException : System.SystemException
{
public VerificationException() { }
protected VerificationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public VerificationException(string? message) { }
public VerificationException(string? message, System.Exception? innerException) { }
}
}
namespace System.Security.Cryptography
{
public partial class CryptographicException : System.SystemException
{
public CryptographicException() { }
public CryptographicException(int hr) { }
protected CryptographicException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public CryptographicException(string? message) { }
public CryptographicException(string? message, System.Exception? inner) { }
public CryptographicException(string format, string? insert) { }
}
}
namespace System.Security.Permissions
{
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public abstract partial class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
{
protected CodeAccessSecurityAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { }
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public enum PermissionState
{
None = 0,
Unrestricted = 1,
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public enum SecurityAction
{
Demand = 2,
Assert = 3,
Deny = 4,
PermitOnly = 5,
LinkDemand = 6,
InheritanceDemand = 7,
RequestMinimum = 8,
RequestOptional = 9,
RequestRefuse = 10,
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public abstract partial class SecurityAttribute : System.Attribute
{
protected SecurityAttribute(System.Security.Permissions.SecurityAction action) { }
public System.Security.Permissions.SecurityAction Action { get { throw null; } set { } }
public bool Unrestricted { get { throw null; } set { } }
public abstract System.Security.IPermission? CreatePermission();
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed partial class SecurityPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute
{
public SecurityPermissionAttribute(System.Security.Permissions.SecurityAction action) : base (default(System.Security.Permissions.SecurityAction)) { }
public bool Assertion { get { throw null; } set { } }
public bool BindingRedirects { get { throw null; } set { } }
public bool ControlAppDomain { get { throw null; } set { } }
public bool ControlDomainPolicy { get { throw null; } set { } }
public bool ControlEvidence { get { throw null; } set { } }
public bool ControlPolicy { get { throw null; } set { } }
public bool ControlPrincipal { get { throw null; } set { } }
public bool ControlThread { get { throw null; } set { } }
public bool Execution { get { throw null; } set { } }
public System.Security.Permissions.SecurityPermissionFlag Flags { get { throw null; } set { } }
public bool Infrastructure { get { throw null; } set { } }
public bool RemotingConfiguration { get { throw null; } set { } }
public bool SerializationFormatter { get { throw null; } set { } }
public bool SkipVerification { get { throw null; } set { } }
public bool UnmanagedCode { get { throw null; } set { } }
public override System.Security.IPermission? CreatePermission() { throw null; }
}
[System.ObsoleteAttribute("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
[System.FlagsAttribute]
public enum SecurityPermissionFlag
{
NoFlags = 0,
Assertion = 1,
UnmanagedCode = 2,
SkipVerification = 4,
Execution = 8,
ControlThread = 16,
ControlEvidence = 32,
ControlPolicy = 64,
SerializationFormatter = 128,
ControlDomainPolicy = 256,
ControlPrincipal = 512,
ControlAppDomain = 1024,
RemotingConfiguration = 2048,
Infrastructure = 4096,
BindingRedirects = 8192,
AllFlags = 16383,
}
}
namespace System.Security.Principal
{
public partial interface IIdentity
{
string? AuthenticationType { get; }
bool IsAuthenticated { get; }
string? Name { get; }
}
public partial interface IPrincipal
{
System.Security.Principal.IIdentity? Identity { get; }
bool IsInRole(string role);
}
public enum PrincipalPolicy
{
UnauthenticatedPrincipal = 0,
NoPrincipal = 1,
WindowsPrincipal = 2,
}
public enum TokenImpersonationLevel
{
None = 0,
Anonymous = 1,
Identification = 2,
Impersonation = 3,
Delegation = 4,
}
}
namespace System.Text
{
public abstract partial class Decoder
{
protected Decoder() { }
public System.Text.DecoderFallback? Fallback { get { throw null; } set { } }
public System.Text.DecoderFallbackBuffer FallbackBuffer { get { throw null; } }
[System.CLSCompliantAttribute(false)]
public unsafe virtual void Convert(byte* bytes, int byteCount, char* chars, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) { throw null; }
public virtual void Convert(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) { throw null; }
public virtual void Convert(System.ReadOnlySpan<byte> bytes, System.Span<char> chars, bool flush, out int bytesUsed, out int charsUsed, out bool completed) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetCharCount(byte* bytes, int count, bool flush) { throw null; }
public abstract int GetCharCount(byte[] bytes, int index, int count);
public virtual int GetCharCount(byte[] bytes, int index, int count, bool flush) { throw null; }
public virtual int GetCharCount(System.ReadOnlySpan<byte> bytes, bool flush) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush) { throw null; }
public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
public virtual int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, bool flush) { throw null; }
public virtual int GetChars(System.ReadOnlySpan<byte> bytes, System.Span<char> chars, bool flush) { throw null; }
public virtual void Reset() { }
}
public sealed partial class DecoderExceptionFallback : System.Text.DecoderFallback
{
public DecoderExceptionFallback() { }
public override int MaxCharCount { get { throw null; } }
public override System.Text.DecoderFallbackBuffer CreateFallbackBuffer() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class DecoderExceptionFallbackBuffer : System.Text.DecoderFallbackBuffer
{
public DecoderExceptionFallbackBuffer() { }
public override int Remaining { get { throw null; } }
public override bool Fallback(byte[] bytesUnknown, int index) { throw null; }
public override char GetNextChar() { throw null; }
public override bool MovePrevious() { throw null; }
}
public abstract partial class DecoderFallback
{
protected DecoderFallback() { }
public static System.Text.DecoderFallback ExceptionFallback { get { throw null; } }
public abstract int MaxCharCount { get; }
public static System.Text.DecoderFallback ReplacementFallback { get { throw null; } }
public abstract System.Text.DecoderFallbackBuffer CreateFallbackBuffer();
}
public abstract partial class DecoderFallbackBuffer
{
protected DecoderFallbackBuffer() { }
public abstract int Remaining { get; }
public abstract bool Fallback(byte[] bytesUnknown, int index);
public abstract char GetNextChar();
public abstract bool MovePrevious();
public virtual void Reset() { }
}
public sealed partial class DecoderFallbackException : System.ArgumentException
{
public DecoderFallbackException() { }
public DecoderFallbackException(string? message) { }
public DecoderFallbackException(string? message, byte[]? bytesUnknown, int index) { }
public DecoderFallbackException(string? message, System.Exception? innerException) { }
public byte[]? BytesUnknown { get { throw null; } }
public int Index { get { throw null; } }
}
public sealed partial class DecoderReplacementFallback : System.Text.DecoderFallback
{
public DecoderReplacementFallback() { }
public DecoderReplacementFallback(string replacement) { }
public string DefaultString { get { throw null; } }
public override int MaxCharCount { get { throw null; } }
public override System.Text.DecoderFallbackBuffer CreateFallbackBuffer() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class DecoderReplacementFallbackBuffer : System.Text.DecoderFallbackBuffer
{
public DecoderReplacementFallbackBuffer(System.Text.DecoderReplacementFallback fallback) { }
public override int Remaining { get { throw null; } }
public override bool Fallback(byte[] bytesUnknown, int index) { throw null; }
public override char GetNextChar() { throw null; }
public override bool MovePrevious() { throw null; }
public override void Reset() { }
}
public abstract partial class Encoder
{
protected Encoder() { }
public System.Text.EncoderFallback? Fallback { get { throw null; } set { } }
public System.Text.EncoderFallbackBuffer FallbackBuffer { get { throw null; } }
[System.CLSCompliantAttribute(false)]
public unsafe virtual void Convert(char* chars, int charCount, byte* bytes, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed) { throw null; }
public virtual void Convert(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed) { throw null; }
public virtual void Convert(System.ReadOnlySpan<char> chars, System.Span<byte> bytes, bool flush, out int charsUsed, out int bytesUsed, out bool completed) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetByteCount(char* chars, int count, bool flush) { throw null; }
public abstract int GetByteCount(char[] chars, int index, int count, bool flush);
public virtual int GetByteCount(System.ReadOnlySpan<char> chars, bool flush) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, bool flush) { throw null; }
public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush);
public virtual int GetBytes(System.ReadOnlySpan<char> chars, System.Span<byte> bytes, bool flush) { throw null; }
public virtual void Reset() { }
}
public sealed partial class EncoderExceptionFallback : System.Text.EncoderFallback
{
public EncoderExceptionFallback() { }
public override int MaxCharCount { get { throw null; } }
public override System.Text.EncoderFallbackBuffer CreateFallbackBuffer() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class EncoderExceptionFallbackBuffer : System.Text.EncoderFallbackBuffer
{
public EncoderExceptionFallbackBuffer() { }
public override int Remaining { get { throw null; } }
public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index) { throw null; }
public override bool Fallback(char charUnknown, int index) { throw null; }
public override char GetNextChar() { throw null; }
public override bool MovePrevious() { throw null; }
}
public abstract partial class EncoderFallback
{
protected EncoderFallback() { }
public static System.Text.EncoderFallback ExceptionFallback { get { throw null; } }
public abstract int MaxCharCount { get; }
public static System.Text.EncoderFallback ReplacementFallback { get { throw null; } }
public abstract System.Text.EncoderFallbackBuffer CreateFallbackBuffer();
}
public abstract partial class EncoderFallbackBuffer
{
protected EncoderFallbackBuffer() { }
public abstract int Remaining { get; }
public abstract bool Fallback(char charUnknownHigh, char charUnknownLow, int index);
public abstract bool Fallback(char charUnknown, int index);
public abstract char GetNextChar();
public abstract bool MovePrevious();
public virtual void Reset() { }
}
public sealed partial class EncoderFallbackException : System.ArgumentException
{
public EncoderFallbackException() { }
public EncoderFallbackException(string? message) { }
public EncoderFallbackException(string? message, System.Exception? innerException) { }
public char CharUnknown { get { throw null; } }
public char CharUnknownHigh { get { throw null; } }
public char CharUnknownLow { get { throw null; } }
public int Index { get { throw null; } }
public bool IsUnknownSurrogate() { throw null; }
}
public sealed partial class EncoderReplacementFallback : System.Text.EncoderFallback
{
public EncoderReplacementFallback() { }
public EncoderReplacementFallback(string replacement) { }
public string DefaultString { get { throw null; } }
public override int MaxCharCount { get { throw null; } }
public override System.Text.EncoderFallbackBuffer CreateFallbackBuffer() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class EncoderReplacementFallbackBuffer : System.Text.EncoderFallbackBuffer
{
public EncoderReplacementFallbackBuffer(System.Text.EncoderReplacementFallback fallback) { }
public override int Remaining { get { throw null; } }
public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index) { throw null; }
public override bool Fallback(char charUnknown, int index) { throw null; }
public override char GetNextChar() { throw null; }
public override bool MovePrevious() { throw null; }
public override void Reset() { }
}
public abstract partial class Encoding : System.ICloneable
{
protected Encoding() { }
protected Encoding(int codePage) { }
protected Encoding(int codePage, System.Text.EncoderFallback? encoderFallback, System.Text.DecoderFallback? decoderFallback) { }
public static System.Text.Encoding ASCII { get { throw null; } }
public static System.Text.Encoding BigEndianUnicode { get { throw null; } }
public virtual string BodyName { get { throw null; } }
public virtual int CodePage { get { throw null; } }
public System.Text.DecoderFallback DecoderFallback { get { throw null; } set { } }
public static System.Text.Encoding Default { get { throw null; } }
public System.Text.EncoderFallback EncoderFallback { get { throw null; } set { } }
public virtual string EncodingName { get { throw null; } }
public virtual string HeaderName { get { throw null; } }
public virtual bool IsBrowserDisplay { get { throw null; } }
public virtual bool IsBrowserSave { get { throw null; } }
public virtual bool IsMailNewsDisplay { get { throw null; } }
public virtual bool IsMailNewsSave { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public virtual bool IsSingleByte { get { throw null; } }
public static System.Text.Encoding Latin1 { get { throw null; } }
public virtual System.ReadOnlySpan<byte> Preamble { get { throw null; } }
public static System.Text.Encoding Unicode { get { throw null; } }
public static System.Text.Encoding UTF32 { get { throw null; } }
[System.ObsoleteAttribute("The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.", DiagnosticId = "SYSLIB0001", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public static System.Text.Encoding UTF7 { get { throw null; } }
public static System.Text.Encoding UTF8 { get { throw null; } }
public virtual string WebName { get { throw null; } }
public virtual int WindowsCodePage { get { throw null; } }
public virtual object Clone() { throw null; }
public static byte[] Convert(System.Text.Encoding srcEncoding, System.Text.Encoding dstEncoding, byte[] bytes) { throw null; }
public static byte[] Convert(System.Text.Encoding srcEncoding, System.Text.Encoding dstEncoding, byte[] bytes, int index, int count) { throw null; }
public static System.IO.Stream CreateTranscodingStream(System.IO.Stream innerStream, System.Text.Encoding innerStreamEncoding, System.Text.Encoding outerStreamEncoding, bool leaveOpen = false) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetByteCount(char* chars, int count) { throw null; }
public virtual int GetByteCount(char[] chars) { throw null; }
public abstract int GetByteCount(char[] chars, int index, int count);
public virtual int GetByteCount(System.ReadOnlySpan<char> chars) { throw null; }
public virtual int GetByteCount(string s) { throw null; }
public int GetByteCount(string s, int index, int count) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { throw null; }
public virtual byte[] GetBytes(char[] chars) { throw null; }
public virtual byte[] GetBytes(char[] chars, int index, int count) { throw null; }
public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex);
public virtual int GetBytes(System.ReadOnlySpan<char> chars, System.Span<byte> bytes) { throw null; }
public virtual byte[] GetBytes(string s) { throw null; }
public byte[] GetBytes(string s, int index, int count) { throw null; }
public virtual int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetCharCount(byte* bytes, int count) { throw null; }
public virtual int GetCharCount(byte[] bytes) { throw null; }
public abstract int GetCharCount(byte[] bytes, int index, int count);
public virtual int GetCharCount(System.ReadOnlySpan<byte> bytes) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { throw null; }
public virtual char[] GetChars(byte[] bytes) { throw null; }
public virtual char[] GetChars(byte[] bytes, int index, int count) { throw null; }
public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
public virtual int GetChars(System.ReadOnlySpan<byte> bytes, System.Span<char> chars) { throw null; }
public virtual System.Text.Decoder GetDecoder() { throw null; }
public virtual System.Text.Encoder GetEncoder() { throw null; }
public static System.Text.Encoding GetEncoding(int codepage) { throw null; }
public static System.Text.Encoding GetEncoding(int codepage, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
public static System.Text.Encoding GetEncoding(string name) { throw null; }
public static System.Text.Encoding GetEncoding(string name, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
public static System.Text.EncodingInfo[] GetEncodings() { throw null; }
public override int GetHashCode() { throw null; }
public abstract int GetMaxByteCount(int charCount);
public abstract int GetMaxCharCount(int byteCount);
public virtual byte[] GetPreamble() { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe string GetString(byte* bytes, int byteCount) { throw null; }
public virtual string GetString(byte[] bytes) { throw null; }
public virtual string GetString(byte[] bytes, int index, int count) { throw null; }
public string GetString(System.ReadOnlySpan<byte> bytes) { throw null; }
public bool IsAlwaysNormalized() { throw null; }
public virtual bool IsAlwaysNormalized(System.Text.NormalizationForm form) { throw null; }
public static void RegisterProvider(System.Text.EncodingProvider provider) { }
}
public sealed partial class EncodingInfo
{
public EncodingInfo(System.Text.EncodingProvider provider, int codePage, string name, string displayName) { }
public int CodePage { get { throw null; } }
public string DisplayName { get { throw null; } }
public string Name { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? value) { throw null; }
public System.Text.Encoding GetEncoding() { throw null; }
public override int GetHashCode() { throw null; }
}
public abstract partial class EncodingProvider
{
public EncodingProvider() { }
public abstract System.Text.Encoding? GetEncoding(int codepage);
public virtual System.Text.Encoding? GetEncoding(int codepage, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
public abstract System.Text.Encoding? GetEncoding(string name);
public virtual System.Text.Encoding? GetEncoding(string name, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
public virtual System.Collections.Generic.IEnumerable<System.Text.EncodingInfo> GetEncodings() { throw null; }
}
public enum NormalizationForm
{
FormC = 1,
FormD = 2,
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
FormKC = 5,
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
FormKD = 6,
}
public readonly partial struct Rune : System.IComparable, System.IComparable<System.Text.Rune>, System.IEquatable<System.Text.Rune>, System.IFormattable, System.ISpanFormattable
{
private readonly int _dummyPrimitive;
public Rune(char ch) { throw null; }
public Rune(char highSurrogate, char lowSurrogate) { throw null; }
public Rune(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public Rune(uint value) { throw null; }
public bool IsAscii { get { throw null; } }
public bool IsBmp { get { throw null; } }
public int Plane { get { throw null; } }
public static System.Text.Rune ReplacementChar { get { throw null; } }
public int Utf16SequenceLength { get { throw null; } }
public int Utf8SequenceLength { get { throw null; } }
public int Value { get { throw null; } }
public int CompareTo(System.Text.Rune other) { throw null; }
public static System.Buffers.OperationStatus DecodeFromUtf16(System.ReadOnlySpan<char> source, out System.Text.Rune result, out int charsConsumed) { throw null; }
public static System.Buffers.OperationStatus DecodeFromUtf8(System.ReadOnlySpan<byte> source, out System.Text.Rune result, out int bytesConsumed) { throw null; }
public static System.Buffers.OperationStatus DecodeLastFromUtf16(System.ReadOnlySpan<char> source, out System.Text.Rune result, out int charsConsumed) { throw null; }
public static System.Buffers.OperationStatus DecodeLastFromUtf8(System.ReadOnlySpan<byte> source, out System.Text.Rune value, out int bytesConsumed) { throw null; }
public int EncodeToUtf16(System.Span<char> destination) { throw null; }
public int EncodeToUtf8(System.Span<byte> destination) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Text.Rune other) { throw null; }
public override int GetHashCode() { throw null; }
public static double GetNumericValue(System.Text.Rune value) { throw null; }
public static System.Text.Rune GetRuneAt(string input, int index) { throw null; }
public static System.Globalization.UnicodeCategory GetUnicodeCategory(System.Text.Rune value) { throw null; }
public static bool IsControl(System.Text.Rune value) { throw null; }
public static bool IsDigit(System.Text.Rune value) { throw null; }
public static bool IsLetter(System.Text.Rune value) { throw null; }
public static bool IsLetterOrDigit(System.Text.Rune value) { throw null; }
public static bool IsLower(System.Text.Rune value) { throw null; }
public static bool IsNumber(System.Text.Rune value) { throw null; }
public static bool IsPunctuation(System.Text.Rune value) { throw null; }
public static bool IsSeparator(System.Text.Rune value) { throw null; }
public static bool IsSymbol(System.Text.Rune value) { throw null; }
public static bool IsUpper(System.Text.Rune value) { throw null; }
public static bool IsValid(int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool IsValid(uint value) { throw null; }
public static bool IsWhiteSpace(System.Text.Rune value) { throw null; }
public static bool operator ==(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static explicit operator System.Text.Rune (char ch) { throw null; }
public static explicit operator System.Text.Rune (int value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static explicit operator System.Text.Rune (uint value) { throw null; }
public static bool operator >(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static bool operator >=(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static bool operator !=(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static bool operator <(System.Text.Rune left, System.Text.Rune right) { throw null; }
public static bool operator <=(System.Text.Rune left, System.Text.Rune right) { throw null; }
int System.IComparable.CompareTo(object? obj) { throw null; }
string System.IFormattable.ToString(string? format, System.IFormatProvider? formatProvider) { throw null; }
bool System.ISpanFormattable.TryFormat(System.Span<char> destination, out int charsWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider) { throw null; }
public static System.Text.Rune ToLower(System.Text.Rune value, System.Globalization.CultureInfo culture) { throw null; }
public static System.Text.Rune ToLowerInvariant(System.Text.Rune value) { throw null; }
public override string ToString() { throw null; }
public static System.Text.Rune ToUpper(System.Text.Rune value, System.Globalization.CultureInfo culture) { throw null; }
public static System.Text.Rune ToUpperInvariant(System.Text.Rune value) { throw null; }
public static bool TryCreate(char highSurrogate, char lowSurrogate, out System.Text.Rune result) { throw null; }
public static bool TryCreate(char ch, out System.Text.Rune result) { throw null; }
public static bool TryCreate(int value, out System.Text.Rune result) { throw null; }
[System.CLSCompliantAttribute(false)]
public static bool TryCreate(uint value, out System.Text.Rune result) { throw null; }
public bool TryEncodeToUtf16(System.Span<char> destination, out int charsWritten) { throw null; }
public bool TryEncodeToUtf8(System.Span<byte> destination, out int bytesWritten) { throw null; }
public static bool TryGetRuneAt(string input, int index, out System.Text.Rune value) { throw null; }
}
public sealed partial class StringBuilder : System.Runtime.Serialization.ISerializable
{
public StringBuilder() { }
public StringBuilder(int capacity) { }
public StringBuilder(int capacity, int maxCapacity) { }
public StringBuilder(string? value) { }
public StringBuilder(string? value, int capacity) { }
public StringBuilder(string? value, int startIndex, int length, int capacity) { }
public int Capacity { get { throw null; } set { } }
[System.Runtime.CompilerServices.IndexerName("Chars")]
public char this[int index] { get { throw null; } set { } }
public int Length { get { throw null; } set { } }
public int MaxCapacity { get { throw null; } }
public System.Text.StringBuilder Append(bool value) { throw null; }
public System.Text.StringBuilder Append(byte value) { throw null; }
public System.Text.StringBuilder Append(char value) { throw null; }
[System.CLSCompliantAttribute(false)]
public unsafe System.Text.StringBuilder Append(char* value, int valueCount) { throw null; }
public System.Text.StringBuilder Append(char value, int repeatCount) { throw null; }
public System.Text.StringBuilder Append(char[]? value) { throw null; }
public System.Text.StringBuilder Append(char[]? value, int startIndex, int charCount) { throw null; }
public System.Text.StringBuilder Append(decimal value) { throw null; }
public System.Text.StringBuilder Append(double value) { throw null; }
public System.Text.StringBuilder Append(System.IFormatProvider? provider, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute(new string[]{ "", "provider"})] ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler) { throw null; }
public System.Text.StringBuilder Append(short value) { throw null; }
public System.Text.StringBuilder Append(int value) { throw null; }
public System.Text.StringBuilder Append(long value) { throw null; }
public System.Text.StringBuilder Append(object? value) { throw null; }
public System.Text.StringBuilder Append(System.ReadOnlyMemory<char> value) { throw null; }
public System.Text.StringBuilder Append(System.ReadOnlySpan<char> value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Append(sbyte value) { throw null; }
public System.Text.StringBuilder Append(float value) { throw null; }
public System.Text.StringBuilder Append(string? value) { throw null; }
public System.Text.StringBuilder Append(string? value, int startIndex, int count) { throw null; }
public System.Text.StringBuilder Append(System.Text.StringBuilder? value) { throw null; }
public System.Text.StringBuilder Append(System.Text.StringBuilder? value, int startIndex, int count) { throw null; }
public System.Text.StringBuilder Append([System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("")] ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Append(ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Append(uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Append(ulong value) { throw null; }
public System.Text.StringBuilder AppendFormat(System.IFormatProvider? provider, string format, object? arg0) { throw null; }
public System.Text.StringBuilder AppendFormat(System.IFormatProvider? provider, string format, object? arg0, object? arg1) { throw null; }
public System.Text.StringBuilder AppendFormat(System.IFormatProvider? provider, string format, object? arg0, object? arg1, object? arg2) { throw null; }
public System.Text.StringBuilder AppendFormat(System.IFormatProvider? provider, string format, params object?[] args) { throw null; }
public System.Text.StringBuilder AppendFormat(string format, object? arg0) { throw null; }
public System.Text.StringBuilder AppendFormat(string format, object? arg0, object? arg1) { throw null; }
public System.Text.StringBuilder AppendFormat(string format, object? arg0, object? arg1, object? arg2) { throw null; }
public System.Text.StringBuilder AppendFormat(string format, params object?[] args) { throw null; }
public System.Text.StringBuilder AppendJoin(char separator, params object?[] values) { throw null; }
public System.Text.StringBuilder AppendJoin(char separator, params string?[] values) { throw null; }
public System.Text.StringBuilder AppendJoin(string? separator, params object?[] values) { throw null; }
public System.Text.StringBuilder AppendJoin(string? separator, params string?[] values) { throw null; }
public System.Text.StringBuilder AppendJoin<T>(char separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
public System.Text.StringBuilder AppendJoin<T>(string? separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
public System.Text.StringBuilder AppendLine() { throw null; }
public System.Text.StringBuilder AppendLine(System.IFormatProvider? provider, [System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute(new string[]{ "", "provider"})] ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler) { throw null; }
public System.Text.StringBuilder AppendLine(string? value) { throw null; }
public System.Text.StringBuilder AppendLine([System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute("")] ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler) { throw null; }
public System.Text.StringBuilder Clear() { throw null; }
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { }
public void CopyTo(int sourceIndex, System.Span<char> destination, int count) { }
public int EnsureCapacity(int capacity) { throw null; }
public bool Equals(System.ReadOnlySpan<char> span) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.Text.StringBuilder? sb) { throw null; }
public System.Text.StringBuilder.ChunkEnumerator GetChunks() { throw null; }
public System.Text.StringBuilder Insert(int index, bool value) { throw null; }
public System.Text.StringBuilder Insert(int index, byte value) { throw null; }
public System.Text.StringBuilder Insert(int index, char value) { throw null; }
public System.Text.StringBuilder Insert(int index, char[]? value) { throw null; }
public System.Text.StringBuilder Insert(int index, char[]? value, int startIndex, int charCount) { throw null; }
public System.Text.StringBuilder Insert(int index, decimal value) { throw null; }
public System.Text.StringBuilder Insert(int index, double value) { throw null; }
public System.Text.StringBuilder Insert(int index, short value) { throw null; }
public System.Text.StringBuilder Insert(int index, int value) { throw null; }
public System.Text.StringBuilder Insert(int index, long value) { throw null; }
public System.Text.StringBuilder Insert(int index, object? value) { throw null; }
public System.Text.StringBuilder Insert(int index, System.ReadOnlySpan<char> value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Insert(int index, sbyte value) { throw null; }
public System.Text.StringBuilder Insert(int index, float value) { throw null; }
public System.Text.StringBuilder Insert(int index, string? value) { throw null; }
public System.Text.StringBuilder Insert(int index, string? value, int count) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Insert(int index, ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Insert(int index, uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public System.Text.StringBuilder Insert(int index, ulong value) { throw null; }
public System.Text.StringBuilder Remove(int startIndex, int length) { throw null; }
public System.Text.StringBuilder Replace(char oldChar, char newChar) { throw null; }
public System.Text.StringBuilder Replace(char oldChar, char newChar, int startIndex, int count) { throw null; }
public System.Text.StringBuilder Replace(string oldValue, string? newValue) { throw null; }
public System.Text.StringBuilder Replace(string oldValue, string? newValue, int startIndex, int count) { throw null; }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
public string ToString(int startIndex, int length) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute]
public partial struct AppendInterpolatedStringHandler
{
private object _dummy;
private int _dummyPrimitive;
public AppendInterpolatedStringHandler(int literalLength, int formattedCount, System.Text.StringBuilder stringBuilder) { throw null; }
public AppendInterpolatedStringHandler(int literalLength, int formattedCount, System.Text.StringBuilder stringBuilder, System.IFormatProvider? provider) { throw null; }
public void AppendFormatted(object? value, int alignment = 0, string? format = null) { }
public void AppendFormatted(System.ReadOnlySpan<char> value) { }
public void AppendFormatted(System.ReadOnlySpan<char> value, int alignment = 0, string? format = null) { }
public void AppendFormatted(string? value) { }
public void AppendFormatted(string? value, int alignment = 0, string? format = null) { }
public void AppendFormatted<T>(T value) { }
public void AppendFormatted<T>(T value, int alignment) { }
public void AppendFormatted<T>(T value, int alignment, string? format) { }
public void AppendFormatted<T>(T value, string? format) { }
public void AppendLiteral(string value) { }
}
public partial struct ChunkEnumerator
{
private object _dummy;
private int _dummyPrimitive;
public System.ReadOnlyMemory<char> Current { get { throw null; } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public System.Text.StringBuilder.ChunkEnumerator GetEnumerator() { throw null; }
public bool MoveNext() { throw null; }
}
}
public partial struct StringRuneEnumerator : System.Collections.Generic.IEnumerable<System.Text.Rune>, System.Collections.Generic.IEnumerator<System.Text.Rune>, System.Collections.IEnumerable, System.Collections.IEnumerator, System.IDisposable
{
private object _dummy;
private int _dummyPrimitive;
public System.Text.Rune Current { get { throw null; } }
object? System.Collections.IEnumerator.Current { get { throw null; } }
public System.Text.StringRuneEnumerator GetEnumerator() { throw null; }
public bool MoveNext() { throw null; }
System.Collections.Generic.IEnumerator<System.Text.Rune> System.Collections.Generic.IEnumerable<System.Text.Rune>.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
void System.Collections.IEnumerator.Reset() { }
void System.IDisposable.Dispose() { }
}
}
namespace System.Text.Unicode
{
public static partial class Utf8
{
public static System.Buffers.OperationStatus FromUtf16(System.ReadOnlySpan<char> source, System.Span<byte> destination, out int charsRead, out int bytesWritten, bool replaceInvalidSequences = true, bool isFinalBlock = true) { throw null; }
public static System.Buffers.OperationStatus ToUtf16(System.ReadOnlySpan<byte> source, System.Span<char> destination, out int bytesRead, out int charsWritten, bool replaceInvalidSequences = true, bool isFinalBlock = true) { throw null; }
}
}
namespace System.Threading
{
public readonly partial struct CancellationToken : System.IEquatable<System.Threading.CancellationToken>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public CancellationToken(bool canceled) { throw null; }
public bool CanBeCanceled { get { throw null; } }
public bool IsCancellationRequested { get { throw null; } }
public static System.Threading.CancellationToken None { get { throw null; } }
public System.Threading.WaitHandle WaitHandle { get { throw null; } }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other) { throw null; }
public bool Equals(System.Threading.CancellationToken other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Threading.CancellationToken left, System.Threading.CancellationToken right) { throw null; }
public static bool operator !=(System.Threading.CancellationToken left, System.Threading.CancellationToken right) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action callback) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action callback, bool useSynchronizationContext) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action<object?, System.Threading.CancellationToken> callback, object? state) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action<object?> callback, object? state) { throw null; }
public System.Threading.CancellationTokenRegistration Register(System.Action<object?> callback, object? state, bool useSynchronizationContext) { throw null; }
public void ThrowIfCancellationRequested() { }
public System.Threading.CancellationTokenRegistration UnsafeRegister(System.Action<object?, System.Threading.CancellationToken> callback, object? state) { throw null; }
public System.Threading.CancellationTokenRegistration UnsafeRegister(System.Action<object?> callback, object? state) { throw null; }
}
public readonly partial struct CancellationTokenRegistration : System.IAsyncDisposable, System.IDisposable, System.IEquatable<System.Threading.CancellationTokenRegistration>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public System.Threading.CancellationToken Token { get { throw null; } }
public void Dispose() { }
public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Threading.CancellationTokenRegistration other) { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Threading.CancellationTokenRegistration left, System.Threading.CancellationTokenRegistration right) { throw null; }
public static bool operator !=(System.Threading.CancellationTokenRegistration left, System.Threading.CancellationTokenRegistration right) { throw null; }
public bool Unregister() { throw null; }
}
public partial class CancellationTokenSource : System.IDisposable
{
public CancellationTokenSource() { }
public CancellationTokenSource(int millisecondsDelay) { }
public CancellationTokenSource(System.TimeSpan delay) { }
public bool IsCancellationRequested { get { throw null; } }
public System.Threading.CancellationToken Token { get { throw null; } }
public void Cancel() { }
public void Cancel(bool throwOnFirstException) { }
public void CancelAfter(int millisecondsDelay) { }
public void CancelAfter(System.TimeSpan delay) { }
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource(System.Threading.CancellationToken token) { throw null; }
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource(System.Threading.CancellationToken token1, System.Threading.CancellationToken token2) { throw null; }
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource(params System.Threading.CancellationToken[] tokens) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public bool TryReset() { throw null; }
}
public enum LazyThreadSafetyMode
{
None = 0,
PublicationOnly = 1,
ExecutionAndPublication = 2,
}
public sealed partial class PeriodicTimer : System.IDisposable
{
public PeriodicTimer(System.TimeSpan period) { }
public void Dispose() { }
~PeriodicTimer() { }
public System.Threading.Tasks.ValueTask<bool> WaitForNextTickAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public static partial class Timeout
{
public const int Infinite = -1;
public static readonly System.TimeSpan InfiniteTimeSpan;
}
public sealed partial class Timer : System.MarshalByRefObject, System.IAsyncDisposable, System.IDisposable
{
public Timer(System.Threading.TimerCallback callback) { }
public Timer(System.Threading.TimerCallback callback, object? state, int dueTime, int period) { }
public Timer(System.Threading.TimerCallback callback, object? state, long dueTime, long period) { }
public Timer(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period) { }
[System.CLSCompliantAttribute(false)]
public Timer(System.Threading.TimerCallback callback, object? state, uint dueTime, uint period) { }
public static long ActiveCount { get { throw null; } }
public bool Change(int dueTime, int period) { throw null; }
public bool Change(long dueTime, long period) { throw null; }
public bool Change(System.TimeSpan dueTime, System.TimeSpan period) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool Change(uint dueTime, uint period) { throw null; }
public void Dispose() { }
public bool Dispose(System.Threading.WaitHandle notifyObject) { throw null; }
public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
}
public delegate void TimerCallback(object? state);
public abstract partial class WaitHandle : System.MarshalByRefObject, System.IDisposable
{
protected static readonly System.IntPtr InvalidHandle;
public const int WaitTimeout = 258;
protected WaitHandle() { }
[System.ObsoleteAttribute("WaitHandle.Handle has been deprecated. Use the SafeWaitHandle property instead.")]
public virtual System.IntPtr Handle { get { throw null; } set { } }
[System.Diagnostics.CodeAnalysis.AllowNullAttribute]
public Microsoft.Win32.SafeHandles.SafeWaitHandle SafeWaitHandle { get { throw null; } set { } }
public virtual void Close() { }
public void Dispose() { }
protected virtual void Dispose(bool explicitDisposing) { }
public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn) { throw null; }
public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn, int millisecondsTimeout, bool exitContext) { throw null; }
public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn, System.TimeSpan timeout, bool exitContext) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout) { throw null; }
public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout, bool exitContext) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout) { throw null; }
public static int WaitAny(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout, bool exitContext) { throw null; }
public virtual bool WaitOne() { throw null; }
public virtual bool WaitOne(int millisecondsTimeout) { throw null; }
public virtual bool WaitOne(int millisecondsTimeout, bool exitContext) { throw null; }
public virtual bool WaitOne(System.TimeSpan timeout) { throw null; }
public virtual bool WaitOne(System.TimeSpan timeout, bool exitContext) { throw null; }
}
public static partial class WaitHandleExtensions
{
public static Microsoft.Win32.SafeHandles.SafeWaitHandle GetSafeWaitHandle(this System.Threading.WaitHandle waitHandle) { throw null; }
public static void SetSafeWaitHandle(this System.Threading.WaitHandle waitHandle, Microsoft.Win32.SafeHandles.SafeWaitHandle? value) { }
}
}
namespace System.Threading.Tasks
{
public partial class ConcurrentExclusiveSchedulerPair
{
public ConcurrentExclusiveSchedulerPair() { }
public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler) { }
public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler, int maxConcurrencyLevel) { }
public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler, int maxConcurrencyLevel, int maxItemsPerTask) { }
public System.Threading.Tasks.Task Completion { get { throw null; } }
public System.Threading.Tasks.TaskScheduler ConcurrentScheduler { get { throw null; } }
public System.Threading.Tasks.TaskScheduler ExclusiveScheduler { get { throw null; } }
public void Complete() { }
}
public partial class Task : System.IAsyncResult, System.IDisposable
{
public Task(System.Action action) { }
public Task(System.Action action, System.Threading.CancellationToken cancellationToken) { }
public Task(System.Action action, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public Task(System.Action action, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public Task(System.Action<object?> action, object? state) { }
public Task(System.Action<object?> action, object? state, System.Threading.CancellationToken cancellationToken) { }
public Task(System.Action<object?> action, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public Task(System.Action<object?> action, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public object? AsyncState { get { throw null; } }
public static System.Threading.Tasks.Task CompletedTask { get { throw null; } }
public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
public static int? CurrentId { get { throw null; } }
public System.AggregateException? Exception { get { throw null; } }
public static System.Threading.Tasks.TaskFactory Factory { get { throw null; } }
public int Id { get { throw null; } }
public bool IsCanceled { get { throw null; } }
public bool IsCompleted { get { throw null; } }
public bool IsCompletedSuccessfully { get { throw null; } }
public bool IsFaulted { get { throw null; } }
public System.Threading.Tasks.TaskStatus Status { get { throw null; } }
System.Threading.WaitHandle System.IAsyncResult.AsyncWaitHandle { get { throw null; } }
bool System.IAsyncResult.CompletedSynchronously { get { throw null; } }
public System.Runtime.CompilerServices.ConfiguredTaskAwaitable ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object?> continuationAction, object? state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object?, TResult> continuationFunction, object? state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public static System.Threading.Tasks.Task Delay(int millisecondsDelay) { throw null; }
public static System.Threading.Tasks.Task Delay(int millisecondsDelay, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task Delay(System.TimeSpan delay) { throw null; }
public static System.Threading.Tasks.Task Delay(System.TimeSpan delay, System.Threading.CancellationToken cancellationToken) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public static System.Threading.Tasks.Task FromCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task<TResult> FromCanceled<TResult>(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task FromException(System.Exception exception) { throw null; }
public static System.Threading.Tasks.Task<TResult> FromException<TResult>(System.Exception exception) { throw null; }
public static System.Threading.Tasks.Task<TResult> FromResult<TResult>(TResult result) { throw null; }
public System.Runtime.CompilerServices.TaskAwaiter GetAwaiter() { throw null; }
public static System.Threading.Tasks.Task Run(System.Action action) { throw null; }
public static System.Threading.Tasks.Task Run(System.Action action, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task Run(System.Func<System.Threading.Tasks.Task?> function) { throw null; }
public static System.Threading.Tasks.Task Run(System.Func<System.Threading.Tasks.Task?> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public void RunSynchronously() { }
public void RunSynchronously(System.Threading.Tasks.TaskScheduler scheduler) { }
public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<System.Threading.Tasks.Task<TResult>?> function) { throw null; }
public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<System.Threading.Tasks.Task<TResult>?> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<TResult> function) { throw null; }
public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public void Start() { }
public void Start(System.Threading.Tasks.TaskScheduler scheduler) { }
public void Wait() { }
public bool Wait(int millisecondsTimeout) { throw null; }
public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
public void Wait(System.Threading.CancellationToken cancellationToken) { }
public bool Wait(System.TimeSpan timeout) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static void WaitAll(params System.Threading.Tasks.Task[] tasks) { }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static void WaitAll(System.Threading.Tasks.Task[] tasks, System.Threading.CancellationToken cancellationToken) { }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, System.TimeSpan timeout) { throw null; }
public static int WaitAny(params System.Threading.Tasks.Task[] tasks) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, System.Threading.CancellationToken cancellationToken) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, System.TimeSpan timeout) { throw null; }
public System.Threading.Tasks.Task WaitAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task WaitAsync(System.TimeSpan timeout) { throw null; }
public System.Threading.Tasks.Task WaitAsync(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task WhenAll(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task> tasks) { throw null; }
public static System.Threading.Tasks.Task WhenAll(params System.Threading.Tasks.Task[] tasks) { throw null; }
public static System.Threading.Tasks.Task<TResult[]> WhenAll<TResult>(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<TResult>> tasks) { throw null; }
public static System.Threading.Tasks.Task<TResult[]> WhenAll<TResult>(params System.Threading.Tasks.Task<TResult>[] tasks) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task> WhenAny(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task> tasks) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task> WhenAny(System.Threading.Tasks.Task task1, System.Threading.Tasks.Task task2) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task> WhenAny(params System.Threading.Tasks.Task[] tasks) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> WhenAny<TResult>(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<TResult>> tasks) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> WhenAny<TResult>(System.Threading.Tasks.Task<TResult> task1, System.Threading.Tasks.Task<TResult> task2) { throw null; }
public static System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> WhenAny<TResult>(params System.Threading.Tasks.Task<TResult>[] tasks) { throw null; }
public static System.Runtime.CompilerServices.YieldAwaitable Yield() { throw null; }
}
public static partial class TaskAsyncEnumerableExtensions
{
public static System.Runtime.CompilerServices.ConfiguredAsyncDisposable ConfigureAwait(this System.IAsyncDisposable source, bool continueOnCapturedContext) { throw null; }
public static System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(this System.Collections.Generic.IAsyncEnumerable<T> source, bool continueOnCapturedContext) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static System.Collections.Generic.IEnumerable<T> ToBlockingEnumerable<T>(this System.Collections.Generic.IAsyncEnumerable<T> source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(this System.Collections.Generic.IAsyncEnumerable<T> source, System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class TaskCanceledException : System.OperationCanceledException
{
public TaskCanceledException() { }
protected TaskCanceledException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TaskCanceledException(string? message) { }
public TaskCanceledException(string? message, System.Exception? innerException) { }
public TaskCanceledException(string? message, System.Exception? innerException, System.Threading.CancellationToken token) { }
public TaskCanceledException(System.Threading.Tasks.Task? task) { }
public System.Threading.Tasks.Task? Task { get { throw null; } }
}
public partial class TaskCompletionSource
{
public TaskCompletionSource() { }
public TaskCompletionSource(object? state) { }
public TaskCompletionSource(object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public TaskCompletionSource(System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public System.Threading.Tasks.Task Task { get { throw null; } }
public void SetCanceled() { }
public void SetCanceled(System.Threading.CancellationToken cancellationToken) { }
public void SetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { }
public void SetException(System.Exception exception) { }
public void SetResult() { }
public bool TrySetCanceled() { throw null; }
public bool TrySetCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
public bool TrySetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { throw null; }
public bool TrySetException(System.Exception exception) { throw null; }
public bool TrySetResult() { throw null; }
}
public partial class TaskCompletionSource<TResult>
{
public TaskCompletionSource() { }
public TaskCompletionSource(object? state) { }
public TaskCompletionSource(object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public TaskCompletionSource(System.Threading.Tasks.TaskCreationOptions creationOptions) { }
public System.Threading.Tasks.Task<TResult> Task { get { throw null; } }
public void SetCanceled() { }
public void SetCanceled(System.Threading.CancellationToken cancellationToken) { }
public void SetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { }
public void SetException(System.Exception exception) { }
public void SetResult(TResult result) { }
public bool TrySetCanceled() { throw null; }
public bool TrySetCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
public bool TrySetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { throw null; }
public bool TrySetException(System.Exception exception) { throw null; }
public bool TrySetResult(TResult result) { throw null; }
}
[System.FlagsAttribute]
public enum TaskContinuationOptions
{
None = 0,
PreferFairness = 1,
LongRunning = 2,
AttachedToParent = 4,
DenyChildAttach = 8,
HideScheduler = 16,
LazyCancellation = 32,
RunContinuationsAsynchronously = 64,
NotOnRanToCompletion = 65536,
NotOnFaulted = 131072,
OnlyOnCanceled = 196608,
NotOnCanceled = 262144,
OnlyOnFaulted = 327680,
OnlyOnRanToCompletion = 393216,
ExecuteSynchronously = 524288,
}
[System.FlagsAttribute]
public enum TaskCreationOptions
{
None = 0,
PreferFairness = 1,
LongRunning = 2,
AttachedToParent = 4,
DenyChildAttach = 8,
HideScheduler = 16,
RunContinuationsAsynchronously = 64,
}
public static partial class TaskExtensions
{
public static System.Threading.Tasks.Task Unwrap(this System.Threading.Tasks.Task<System.Threading.Tasks.Task> task) { throw null; }
public static System.Threading.Tasks.Task<TResult> Unwrap<TResult>(this System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> task) { throw null; }
}
public partial class TaskFactory
{
public TaskFactory() { }
public TaskFactory(System.Threading.CancellationToken cancellationToken) { }
public TaskFactory(System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler? scheduler) { }
public TaskFactory(System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { }
public TaskFactory(System.Threading.Tasks.TaskScheduler? scheduler) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } }
public System.Threading.Tasks.TaskContinuationOptions ContinuationOptions { get { throw null; } }
public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
public System.Threading.Tasks.TaskScheduler? Scheduler { get { throw null; } }
public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, object? state) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, object? state) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TResult>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TResult>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object? state) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TResult>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TResult>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state) { throw null; }
public System.Threading.Tasks.Task FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action action) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action<object?> action, object? state) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action<object?> action, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action<object?> action, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task StartNew(System.Action<object?> action, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object?, TResult> function, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object?, TResult> function, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
}
public partial class TaskFactory<TResult>
{
public TaskFactory() { }
public TaskFactory(System.Threading.CancellationToken cancellationToken) { }
public TaskFactory(System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler? scheduler) { }
public TaskFactory(System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { }
public TaskFactory(System.Threading.Tasks.TaskScheduler? scheduler) { }
public System.Threading.CancellationToken CancellationToken { get { throw null; } }
public System.Threading.Tasks.TaskContinuationOptions ContinuationOptions { get { throw null; } }
public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
public System.Threading.Tasks.TaskScheduler? Scheduler { get { throw null; } }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.Func<System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object?, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object?, TResult> function, object? state) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object?, TResult> function, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
}
public abstract partial class TaskScheduler
{
protected TaskScheduler() { }
public static System.Threading.Tasks.TaskScheduler Current { get { throw null; } }
public static System.Threading.Tasks.TaskScheduler Default { get { throw null; } }
public int Id { get { throw null; } }
public virtual int MaximumConcurrencyLevel { get { throw null; } }
public static event System.EventHandler<System.Threading.Tasks.UnobservedTaskExceptionEventArgs>? UnobservedTaskException { add { } remove { } }
public static System.Threading.Tasks.TaskScheduler FromCurrentSynchronizationContext() { throw null; }
protected abstract System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task>? GetScheduledTasks();
protected internal abstract void QueueTask(System.Threading.Tasks.Task task);
protected internal virtual bool TryDequeue(System.Threading.Tasks.Task task) { throw null; }
protected bool TryExecuteTask(System.Threading.Tasks.Task task) { throw null; }
protected abstract bool TryExecuteTaskInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued);
}
public partial class TaskSchedulerException : System.Exception
{
public TaskSchedulerException() { }
public TaskSchedulerException(System.Exception? innerException) { }
protected TaskSchedulerException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public TaskSchedulerException(string? message) { }
public TaskSchedulerException(string? message, System.Exception? innerException) { }
}
public enum TaskStatus
{
Created = 0,
WaitingForActivation = 1,
WaitingToRun = 2,
Running = 3,
WaitingForChildrenToComplete = 4,
RanToCompletion = 5,
Canceled = 6,
Faulted = 7,
}
public partial class Task<TResult> : System.Threading.Tasks.Task
{
public Task(System.Func<object?, TResult> function, object? state) : base (default(System.Action)) { }
public Task(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken) : base (default(System.Action)) { }
public Task(System.Func<object?, TResult> function, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
public Task(System.Func<object?, TResult> function, object? state, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
public Task(System.Func<TResult> function) : base (default(System.Action)) { }
public Task(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) : base (default(System.Action)) { }
public Task(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
public Task(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
public static new System.Threading.Tasks.TaskFactory<TResult> Factory { get { throw null; } }
public TResult Result { get { throw null; } }
public new System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object?> continuationAction, object? state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object?, TNewResult> continuationFunction, object? state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
public new System.Runtime.CompilerServices.TaskAwaiter<TResult> GetAwaiter() { throw null; }
public new System.Threading.Tasks.Task<TResult> WaitAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public new System.Threading.Tasks.Task<TResult> WaitAsync(System.TimeSpan timeout) { throw null; }
public new System.Threading.Tasks.Task<TResult> WaitAsync(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class UnobservedTaskExceptionEventArgs : System.EventArgs
{
public UnobservedTaskExceptionEventArgs(System.AggregateException exception) { }
public System.AggregateException Exception { get { throw null; } }
public bool Observed { get { throw null; } }
public void SetObserved() { }
}
[System.Runtime.CompilerServices.AsyncMethodBuilderAttribute(typeof(System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder))]
public readonly partial struct ValueTask : System.IEquatable<System.Threading.Tasks.ValueTask>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ValueTask(System.Threading.Tasks.Sources.IValueTaskSource source, short token) { throw null; }
public ValueTask(System.Threading.Tasks.Task task) { throw null; }
public static System.Threading.Tasks.ValueTask CompletedTask { get { throw null; } }
public bool IsCanceled { get { throw null; } }
public bool IsCompleted { get { throw null; } }
public bool IsCompletedSuccessfully { get { throw null; } }
public bool IsFaulted { get { throw null; } }
public System.Threading.Tasks.Task AsTask() { throw null; }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Threading.Tasks.ValueTask other) { throw null; }
public static System.Threading.Tasks.ValueTask FromCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.ValueTask<TResult> FromCanceled<TResult>(System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.ValueTask FromException(System.Exception exception) { throw null; }
public static System.Threading.Tasks.ValueTask<TResult> FromException<TResult>(System.Exception exception) { throw null; }
public static System.Threading.Tasks.ValueTask<TResult> FromResult<TResult>(TResult result) { throw null; }
public System.Runtime.CompilerServices.ValueTaskAwaiter GetAwaiter() { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Threading.Tasks.ValueTask left, System.Threading.Tasks.ValueTask right) { throw null; }
public static bool operator !=(System.Threading.Tasks.ValueTask left, System.Threading.Tasks.ValueTask right) { throw null; }
public System.Threading.Tasks.ValueTask Preserve() { throw null; }
}
[System.Runtime.CompilerServices.AsyncMethodBuilderAttribute(typeof(System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<>))]
public readonly partial struct ValueTask<TResult> : System.IEquatable<System.Threading.Tasks.ValueTask<TResult>>
{
private readonly TResult _result;
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ValueTask(System.Threading.Tasks.Sources.IValueTaskSource<TResult> source, short token) { throw null; }
public ValueTask(System.Threading.Tasks.Task<TResult> task) { throw null; }
public ValueTask(TResult result) { throw null; }
public bool IsCanceled { get { throw null; } }
public bool IsCompleted { get { throw null; } }
public bool IsCompletedSuccessfully { get { throw null; } }
public bool IsFaulted { get { throw null; } }
public TResult Result { get { throw null; } }
public System.Threading.Tasks.Task<TResult> AsTask() { throw null; }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; }
public bool Equals(System.Threading.Tasks.ValueTask<TResult> other) { throw null; }
public System.Runtime.CompilerServices.ValueTaskAwaiter<TResult> GetAwaiter() { throw null; }
public override int GetHashCode() { throw null; }
public static bool operator ==(System.Threading.Tasks.ValueTask<TResult> left, System.Threading.Tasks.ValueTask<TResult> right) { throw null; }
public static bool operator !=(System.Threading.Tasks.ValueTask<TResult> left, System.Threading.Tasks.ValueTask<TResult> right) { throw null; }
public System.Threading.Tasks.ValueTask<TResult> Preserve() { throw null; }
public override string? ToString() { throw null; }
}
}
namespace System.Threading.Tasks.Sources
{
public partial interface IValueTaskSource
{
void GetResult(short token);
System.Threading.Tasks.Sources.ValueTaskSourceStatus GetStatus(short token);
void OnCompleted(System.Action<object?> continuation, object? state, short token, System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags flags);
}
public partial interface IValueTaskSource<out TResult>
{
TResult GetResult(short token);
System.Threading.Tasks.Sources.ValueTaskSourceStatus GetStatus(short token);
void OnCompleted(System.Action<object?> continuation, object? state, short token, System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags flags);
}
public partial struct ManualResetValueTaskSourceCore<TResult>
{
private TResult _result;
private object _dummy;
private int _dummyPrimitive;
public bool RunContinuationsAsynchronously { readonly get { throw null; } set { } }
public short Version { get { throw null; } }
public TResult GetResult(short token) { throw null; }
public System.Threading.Tasks.Sources.ValueTaskSourceStatus GetStatus(short token) { throw null; }
public void OnCompleted(System.Action<object?> continuation, object? state, short token, System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags flags) { }
public void Reset() { }
public void SetException(System.Exception error) { }
public void SetResult(TResult result) { }
}
[System.FlagsAttribute]
public enum ValueTaskSourceOnCompletedFlags
{
None = 0,
UseSchedulingContext = 1,
FlowExecutionContext = 2,
}
public enum ValueTaskSourceStatus
{
Pending = 0,
Succeeded = 1,
Faulted = 2,
Canceled = 3,
}
}
| 1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Runtime/tests/System/DecimalTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Numerics;
using Microsoft.DotNet.RemoteExecutor;
using Xunit;
namespace System.Tests
{
public class DecimalTests
{
[Fact]
public void MaxValue_Get_ReturnsExpected()
{
Assert.Equal(79228162514264337593543950335m, decimal.MaxValue);
}
[Fact]
public void MinusOne_Get_ReturnsExpected()
{
Assert.Equal(-1, decimal.MinusOne);
}
[Fact]
public void MinValue_GetReturnsExpected()
{
Assert.Equal(-79228162514264337593543950335m, decimal.MinValue);
}
[Fact]
public static void One_Get_ReturnsExpected()
{
Assert.Equal(1, decimal.One);
}
[Fact]
public static void Zero_Get_ReturnsExpected()
{
Assert.Equal(0, decimal.Zero);
}
[Theory]
[InlineData(0)]
[InlineData(ulong.MaxValue)]
public static void Ctor_ULong(ulong value)
{
Assert.Equal(value, new decimal(value));
}
[Theory]
[InlineData(0)]
[InlineData(uint.MaxValue)]
public static void Ctor_UInt(uint value)
{
Assert.Equal(value, new decimal(value));
}
public static IEnumerable<object[]> Ctor_Float_TestData()
{
yield return new object[] { 123456789.123456f, new int[] { 123456800, 0, 0, 0 } };
yield return new object[] { 2.0123456789123456f, new int[] { 2012346, 0, 0, 393216 } };
yield return new object[] { 2E-28f, new int[] { 2, 0, 0, 1835008 } };
yield return new object[] { 2E-29f, new int[] { 0, 0, 0, 0 } };
yield return new object[] { 2E28f, new int[] { 536870912, 2085225666, 1084202172, 0 } };
yield return new object[] { 1.5f, new int[] { 15, 0, 0, 65536 } };
yield return new object[] { 0f, new int[] { 0, 0, 0, 0 } };
yield return new object[] { float.Parse("-0.0", CultureInfo.InvariantCulture), new int[] { 0, 0, 0, 0 } };
yield return new object[] { 1000000.1f, new int[] { 1000000, 0, 0, 0 } };
yield return new object[] { 100000.1f, new int[] { 1000001, 0, 0, 65536 } };
yield return new object[] { 10000.1f, new int[] { 100001, 0, 0, 65536 } };
yield return new object[] { 1000.1f, new int[] { 10001, 0, 0, 65536 } };
yield return new object[] { 100.1f, new int[] { 1001, 0, 0, 65536 } };
yield return new object[] { 10.1f, new int[] { 101, 0, 0, 65536 } };
yield return new object[] { 1.1f, new int[] { 11, 0, 0, 65536 } };
yield return new object[] { 1f, new int[] { 1, 0, 0, 0 } };
yield return new object[] { 0.1f, new int[] { 1, 0, 0, 65536 } };
yield return new object[] { 0.01f, new int[] { 10, 0, 0, 196608 } };
yield return new object[] { 0.001f, new int[] { 1, 0, 0, 196608 } };
yield return new object[] { 0.0001f, new int[] { 10, 0, 0, 327680 } };
yield return new object[] { 0.00001f, new int[] { 10, 0, 0, 393216 } };
yield return new object[] { 0.0000000000000000000000000001f, new int[] { 1, 0, 0, 1835008 } };
yield return new object[] { 0.00000000000000000000000000001f, new int[] { 0, 0, 0, 0 } };
}
[Theory]
[MemberData(nameof(Ctor_Float_TestData))]
public void Ctor_Float(float value, int[] bits)
{
var d = new decimal(value);
Assert.Equal((decimal)value, d);
Assert.Equal(bits, Decimal.GetBits(d));
}
[Theory]
[InlineData(2E29)]
[InlineData(float.NaN)]
[InlineData(float.MaxValue)]
[InlineData(float.MinValue)]
[InlineData(float.PositiveInfinity)]
[InlineData(float.NegativeInfinity)]
public void Ctor_InvalidFloat_ThrowsOverlowException(float value)
{
Assert.Throws<OverflowException>(() => new decimal(value));
}
[Theory]
[InlineData(long.MinValue)]
[InlineData(0)]
[InlineData(long.MaxValue)]
public void Ctor_Long(long value)
{
Assert.Equal(value, new decimal(value));
}
public static IEnumerable<object[]> Ctor_IntArray_TestData()
{
decimal expected = 3;
expected += uint.MaxValue;
expected += ulong.MaxValue;
yield return new object[] { new int[] { 1, 1, 1, 0 }, expected };
yield return new object[] { new int[] { 1, 0, 0, 0 }, decimal.One };
yield return new object[] { new int[] { 1000, 0, 0, 0x30000 }, decimal.One };
yield return new object[] { new int[] { 1000, 0, 0, unchecked((int)0x80030000) }, -decimal.One };
yield return new object[] { new int[] { 0, 0, 0, 0x1C0000 }, decimal.Zero };
yield return new object[] { new int[] { 1000, 0, 0, 0x1C0000 }, 0.0000000000000000000000001 };
yield return new object[] { new int[] { 0, 0, 0, 0 }, decimal.Zero };
yield return new object[] { new int[] { 0, 0, 0, unchecked((int)0x80000000) }, decimal.Zero };
}
[Theory]
[MemberData(nameof(Ctor_IntArray_TestData))]
public void Ctor_IntArray(int[] value, decimal expected)
{
Assert.Equal(expected, new decimal(value));
}
[Theory]
[MemberData(nameof(Ctor_IntArray_TestData))]
public void Ctor_IntSpan(int[] value, decimal expected)
{
Assert.Equal(expected, new decimal(value.AsSpan()));
}
[Fact]
public void Ctor_NullBits_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("bits", () => new decimal(null));
}
[Theory]
[InlineData(new int[] { 0, 0, 0 })]
[InlineData(new int[] { 0, 0, 0, 0, 0 })]
[InlineData(new int[] { 0, 0, 0, 1 })]
[InlineData(new int[] { 0, 0, 0, 0x1D0000 })]
[InlineData(new int[] { 0, 0, 0, unchecked((int)0x40000000) })]
public void Ctor_InvalidBits_ThrowsArgumentException(int[] bits)
{
AssertExtensions.Throws<ArgumentException>(null, () => new decimal(bits));
AssertExtensions.Throws<ArgumentException>(null, () => new decimal(bits.AsSpan()));
}
[Theory]
[InlineData(int.MinValue)]
[InlineData(0)]
[InlineData(int.MaxValue)]
public void Ctor_Int(int value)
{
Assert.Equal(value, new decimal(value));
}
public static IEnumerable<object[]> Ctor_Double_TestData()
{
yield return new object[] { 123456789.123456, new int[] { -2045800064, 28744, 0, 393216 } };
yield return new object[] { 2.0123456789123456, new int[] { -1829795549, 46853, 0, 917504 } };
yield return new object[] { 2E-28, new int[] { 2, 0, 0, 1835008 } };
yield return new object[] { 2E-29, new int[] { 0, 0, 0, 0 } };
yield return new object[] { 2E28, new int[] { 536870912, 2085225666, 1084202172, 0 } };
yield return new object[] { 1.5, new int[] { 15, 0, 0, 65536 } };
yield return new object[] { 0, new int[] { 0, 0, 0, 0 } };
yield return new object[] { double.Parse("-0.0", CultureInfo.InvariantCulture), new int[] { 0, 0, 0, 0 } };
yield return new object[] { 100000000000000.1, new int[] { 276447232, 23283, 0, 0 } };
yield return new object[] { 10000000000000.1, new int[] { 276447233, 23283, 0, 65536 } };
yield return new object[] { 1000000000000.1, new int[] { 1316134913, 2328, 0, 65536 } };
yield return new object[] { 100000000000.1, new int[] { -727379967, 232, 0, 65536 } };
yield return new object[] { 10000000000.1, new int[] { 1215752193, 23, 0, 65536 } };
yield return new object[] { 1000000000.1, new int[] { 1410065409, 2, 0, 65536 } };
yield return new object[] { 100000000.1, new int[] { 1000000001, 0, 0, 65536 } };
yield return new object[] { 10000000.1, new int[] { 100000001, 0, 0, 65536 } };
yield return new object[] { 1000000.1, new int[] { 10000001, 0, 0, 65536 } };
yield return new object[] { 100000.1, new int[] { 1000001, 0, 0, 65536 } };
yield return new object[] { 10000.1, new int[] { 100001, 0, 0, 65536 } };
yield return new object[] { 1000.1, new int[] { 10001, 0, 0, 65536 } };
yield return new object[] { 100.1, new int[] { 1001, 0, 0, 65536 } };
yield return new object[] { 10.1, new int[] { 101, 0, 0, 65536 } };
yield return new object[] { 1.1, new int[] { 11, 0, 0, 65536 } };
yield return new object[] { 1, new int[] { 1, 0, 0, 0 } };
yield return new object[] { 0.1, new int[] { 1, 0, 0, 65536 } };
yield return new object[] { 0.01, new int[] { 1, 0, 0, 131072 } };
yield return new object[] { 0.001, new int[] { 1, 0, 0, 196608 } };
yield return new object[] { 0.0001, new int[] { 1, 0, 0, 262144 } };
yield return new object[] { 0.00001, new int[] { 1, 0, 0, 327680 } };
yield return new object[] { 0.0000000000000000000000000001, new int[] { 1, 0, 0, 1835008 } };
yield return new object[] { 0.00000000000000000000000000001, new int[] { 0, 0, 0, 0 } };
}
[Theory]
[MemberData(nameof(Ctor_Double_TestData))]
public void Ctor_Double(double value, int[] bits)
{
var d = new decimal(value);
Assert.Equal((decimal)value, d);
Assert.Equal(bits, Decimal.GetBits(d));
}
[Theory]
[InlineData(double.NaN)]
[InlineData(double.MaxValue)]
[InlineData(double.MinValue)]
[InlineData(double.PositiveInfinity)]
[InlineData(double.NegativeInfinity)]
public void Ctor_LargeDouble_ThrowsOverlowException(double value)
{
Assert.Throws<OverflowException>(() => new decimal(value));
}
public static IEnumerable<object[]> Ctor_Int_Int_Int_Bool_Byte_TestData()
{
decimal expected = 3;
expected += uint.MaxValue;
expected += ulong.MaxValue;
yield return new object[] { 1, 1, 1, false, 0, expected };
yield return new object[] { 1, 0, 0, false, 0, decimal.One };
yield return new object[] { 1000, 0, 0, false, 3, decimal.One };
yield return new object[] { 1000, 0, 0, true, 3, -decimal.One };
yield return new object[] { 0, 0, 0, false, 28, decimal.Zero };
yield return new object[] { 1000, 0, 0, false, 28, 0.0000000000000000000000001 };
yield return new object[] { 0, 0, 0, false, 0, decimal.Zero };
yield return new object[] { 0, 0, 0, true, 0, decimal.Zero };
}
[Theory]
[MemberData(nameof(Ctor_Int_Int_Int_Bool_Byte_TestData))]
public void Ctor_Int_Int_Int_Bool_Byte(int lo, int mid, int hi, bool isNegative, byte scale, decimal expected)
{
Assert.Equal(expected, new decimal(lo, mid, hi, isNegative, scale));
}
[Fact]
public void Ctor_LargeScale_ThrowsArgumentOutOfRangeException()
{
AssertExtensions.Throws<ArgumentOutOfRangeException>("scale", () => new Decimal(1, 2, 3, false, 29));
}
public static IEnumerable<object[]> Add_Valid_TestData()
{
yield return new object[] { 1m, 1m, 2m };
yield return new object[] { -1m, 1m, 0m };
yield return new object[] { 1m, -1m, 0m };
yield return new object[] { 1m, 0, 1m };
yield return new object[] { 79228162514264337593543950330m, 5m, decimal.MaxValue };
yield return new object[] { 79228162514264337593543950335m, -5m, 79228162514264337593543950330m };
yield return new object[] { -79228162514264337593543950330m, 5m, -79228162514264337593543950325m };
yield return new object[] { -79228162514264337593543950330m, -5m, decimal.MinValue };
yield return new object[] { 1234.5678m, 0.00009m, 1234.56789m };
yield return new object[] { -1234.5678m, 0.00009m, -1234.56771m };
yield return new object[] { 0.1111111111111111111111111111m, 0.1111111111111111111111111111m, 0.2222222222222222222222222222m };
yield return new object[] { 0.5555555555555555555555555555m, 0.5555555555555555555555555555m, 1.1111111111111111111111111110m };
yield return new object[] { decimal.MinValue, decimal.Zero, decimal.MinValue };
yield return new object[] { decimal.MaxValue, decimal.Zero, decimal.MaxValue };
yield return new object[] { decimal.MinValue, decimal.Zero, decimal.MinValue };
}
[Theory]
[MemberData(nameof(Add_Valid_TestData))]
public static void Add(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 + d2);
Assert.Equal(expected, decimal.Add(d1, d2));
decimal d3 = d1;
d3 += d2;
Assert.Equal(expected, d3);
}
public static IEnumerable<object[]> Add_Overflows_TestData()
{
yield return new object[] { decimal.MaxValue, decimal.MaxValue };
yield return new object[] { 79228162514264337593543950330m, 6 };
yield return new object[] { -79228162514264337593543950330m, -6 };
}
[Theory]
[MemberData(nameof(Add_Overflows_TestData))]
public void Add_Overflows_ThrowsOverflowException(decimal d1, decimal d2)
{
Assert.Throws<OverflowException>(() => d1 + d2);
Assert.Throws<OverflowException>(() => decimal.Add(d1, d2));
decimal d3 = d1;
Assert.Throws<OverflowException>(() => d3 += d2);
}
public static IEnumerable<object[]> Ceiling_TestData()
{
yield return new object[] { 123m, 123m };
yield return new object[] { 123.123m, 124m };
yield return new object[] { 123.456m, 124m };
yield return new object[] { -123.123m, -123m };
yield return new object[] { -123.456m, -123m };
}
[Theory]
[MemberData(nameof(Ceiling_TestData))]
public static void Ceiling(decimal d, decimal expected)
{
Assert.Equal(expected, decimal.Ceiling(d));
}
public static IEnumerable<object[]> Compare_TestData()
{
yield return new object[] { 5m, 15m, -1 };
yield return new object[] { 15m, 15m, 0 };
yield return new object[] { 15m, 5m, 1 };
yield return new object[] { 15m, null, 1 };
yield return new object[] { decimal.Zero, decimal.Zero, 0 };
yield return new object[] { decimal.Zero, decimal.One, -1 };
yield return new object[] { decimal.One, decimal.Zero, 1 };
yield return new object[] { decimal.MaxValue, decimal.MaxValue, 0 };
yield return new object[] { decimal.MinValue, decimal.MinValue, 0 };
yield return new object[] { decimal.MaxValue, decimal.MinValue, 1 };
yield return new object[] { decimal.MinValue, decimal.MaxValue, -1 };
}
[Theory]
[MemberData(nameof(Compare_TestData))]
public void CompareTo_Other_ReturnsExpected(decimal d1, object obj, int expected)
{
if (obj is decimal d2)
{
Assert.Equal(expected, Math.Sign(d1.CompareTo(d2)));
if (expected >= 0)
{
Assert.True(d1 >= d2);
Assert.False(d1 < d2);
}
if (expected > 0)
{
Assert.True(d1 > d2);
Assert.False(d1 <= d2);
}
if (expected <= 0)
{
Assert.True(d1 <= d2);
Assert.False(d1 > d2);
}
if (expected < 0)
{
Assert.True(d1 < d2);
Assert.False(d1 >= d2);
}
Assert.Equal(expected, Math.Sign(decimal.Compare(d1, d2)));
}
Assert.Equal(expected, Math.Sign(d1.CompareTo(obj)));
}
[Theory]
[InlineData("a")]
[InlineData(234)]
public void CompareTo_ObjectNotDouble_ThrowsArgumentException(object value)
{
AssertExtensions.Throws<ArgumentException>(null, () => ((decimal)123).CompareTo(value));
}
public static IEnumerable<object[]> Divide_Valid_TestData()
{
yield return new object[] { decimal.One, decimal.One, decimal.One };
yield return new object[] { decimal.MinusOne, decimal.MinusOne, decimal.One };
yield return new object[] { 15m, 2m, 7.5m };
yield return new object[] { 10m, 2m, 5m };
yield return new object[] { -10m, -2m, 5m };
yield return new object[] { 10m, -2m, -5m };
yield return new object[] { -10m, 2m, -5m };
yield return new object[] { 0.9214206543486529434634231456m, decimal.MaxValue, decimal.Zero };
yield return new object[] { 38214206543486529434634231456m, 0.49214206543486529434634231456m, 77648730371625094566866001277m };
yield return new object[] { -78228162514264337593543950335m, decimal.MaxValue, -0.987378225516463811113412343m };
yield return new object[] { decimal.MaxValue, decimal.MinusOne, decimal.MinValue };
yield return new object[] { decimal.MinValue, decimal.MaxValue, decimal.MinusOne };
yield return new object[] { decimal.MaxValue, decimal.MaxValue, decimal.One };
yield return new object[] { decimal.MinValue, decimal.MinValue, decimal.One };
// Tests near MaxValue
yield return new object[] { 792281625142643375935439503.4m, 0.1m, 7922816251426433759354395034m };
yield return new object[] { 79228162514264337593543950.34m, 0.1m, 792281625142643375935439503.4m };
yield return new object[] { 7922816251426433759354395.034m, 0.1m, 79228162514264337593543950.34m };
yield return new object[] { 792281625142643375935439.5034m, 0.1m, 7922816251426433759354395.034m };
yield return new object[] { 79228162514264337593543950335m, 10m, 7922816251426433759354395033.5m };
yield return new object[] { 79228162514264337567774146561m, 10m, 7922816251426433756777414656.1m };
yield return new object[] { 79228162514264337567774146560m, 10m, 7922816251426433756777414656m };
yield return new object[] { 79228162514264337567774146559m, 10m, 7922816251426433756777414655.9m };
yield return new object[] { 79228162514264337593543950335m, 1.1m, 72025602285694852357767227577m };
yield return new object[] { 79228162514264337593543950335m, 1.01m, 78443725261647859003508861718m };
yield return new object[] { 79228162514264337593543950335m, 1.001m, 79149013500763574019524425909.091m };
yield return new object[] { 79228162514264337593543950335m, 1.0001m, 79220240490215316061937756559.344m };
yield return new object[] { 79228162514264337593543950335m, 1.00001m, 79227370240561931974224208092.919m };
yield return new object[] { 79228162514264337593543950335m, 1.000001m, 79228083286181051412492537842.462m };
yield return new object[] { 79228162514264337593543950335m, 1.0000001m, 79228154591448878448656105469.389m };
yield return new object[] { 79228162514264337593543950335m, 1.00000001m, 79228161721982720373716746597.833m };
yield return new object[] { 79228162514264337593543950335m, 1.000000001m, 79228162435036175158507775176.492m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000001m, 79228162506341521342909798200.709m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000001m, 79228162513472055968409229775.316m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000001m, 79228162514185109431029765225.569m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000001m, 79228162514256414777292524693.522m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000001m, 79228162514263545311918807699.547m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000001m, 79228162514264258365381436070.742m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000001m, 79228162514264329670727698908.567m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000001m, 79228162514264336801262325192.357m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000001m, 79228162514264337514315787820.736m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000001m, 79228162514264337585621134083.574m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000001m, 79228162514264337592751668709.857m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000001m, 79228162514264337593464722172.486m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000001m, 79228162514264337593536027518.749m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000000001m, 79228162514264337593543158053.375m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000000001m, 79228162514264337593543871106.837m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000000001m, 79228162514264337593543942412.184m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000000000001m, 79228162514264337593543949542.718m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000000000001m, 79228162514264337593543950255.772m };
yield return new object[] { 7922816251426433759354395033.5m, 0.9999999999999999999999999999m, 7922816251426433759354395034m };
yield return new object[] { 79228162514264337593543950335m, 10000000m, 7922816251426433759354.3950335m };
yield return new object[] { 7922816251426433759354395033.5m, 1.000001m, 7922808328618105141249253784.2m };
yield return new object[] { 7922816251426433759354395033.5m, 1.0000000000000000000000000001m, 7922816251426433759354395032.7m };
yield return new object[] { 7922816251426433759354395033.5m, 1.0000000000000000000000000002m, 7922816251426433759354395031.9m };
yield return new object[] { 7922816251426433759354395033.5m, 0.9999999999999999999999999999m, 7922816251426433759354395034m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000000000001m, 79228162514264337593543950327m };
decimal boundary7 = new decimal((int)429u, (int)2133437386u, 0, false, 0);
decimal boundary71 = new decimal((int)429u, (int)2133437387u, 0, false, 0);
decimal maxValueBy7 = decimal.MaxValue * 0.0000001m;
yield return new object[] { maxValueBy7, 1m, maxValueBy7 };
yield return new object[] { maxValueBy7, 1m, maxValueBy7 };
yield return new object[] { maxValueBy7, 0.0000001m, decimal.MaxValue };
yield return new object[] { boundary7, 1m, boundary7 };
yield return new object[] { boundary7, 0.000000100000000000000000001m, 91630438009337286849083695.62m };
yield return new object[] { boundary71, 0.000000100000000000000000001m, 91630438052286959809083695.62m };
yield return new object[] { 7922816251426433759354.3950335m, 1m, 7922816251426433759354.3950335m };
yield return new object[] { 7922816251426433759354.3950335m, 0.0000001m, 79228162514264337593543950335m };
}
[Theory]
[MemberData(nameof(Divide_Valid_TestData))]
public static void Divide(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 / d2);
Assert.Equal(expected, decimal.Divide(d1, d2));
}
public static IEnumerable<object[]> Divide_ZeroDenominator_TestData()
{
yield return new object[] { decimal.One, decimal.Zero };
yield return new object[] { decimal.Zero, decimal.Zero };
yield return new object[] { 0.0m, 0.0m };
}
[Theory]
[MemberData(nameof(Divide_ZeroDenominator_TestData))]
public void Divide_ZeroDenominator_ThrowsDivideByZeroException(decimal d1, decimal d2)
{
Assert.Throws<DivideByZeroException>(() => d1 / d2);
Assert.Throws<DivideByZeroException>(() => decimal.Divide(d1, d2));
}
public static IEnumerable<object[]> Divide_Overflows_TestData()
{
yield return new object[] { 79228162514264337593543950335m, -0.9999999999999999999999999m };
yield return new object[] { 792281625142643.37593543950335m, -0.0000000000000079228162514264337593543950335m };
yield return new object[] { 79228162514264337593543950335m, 0.1m };
yield return new object[] { 7922816251426433759354395034m, 0.1m };
yield return new object[] { 79228162514264337593543950335m, 0.9m };
yield return new object[] { 79228162514264337593543950335m, 0.99m };
yield return new object[] { 79228162514264337593543950335m, 0.9999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, -0.1m };
yield return new object[] { 79228162514264337593543950335m, -0.9999999999999999999999999m };
yield return new object[] { decimal.MaxValue / 2m, 0.5m };
}
[Theory]
[MemberData(nameof(Divide_Overflows_TestData))]
public void Divide_Overflows_ThrowsOverflowException(decimal d1, decimal d2)
{
Assert.Throws<OverflowException>(() => d1 / d2);
Assert.Throws<OverflowException>(() => decimal.Divide(d1, d2));
}
public static IEnumerable<object[]> Equals_TestData()
{
yield return new object[] { decimal.Zero, decimal.Zero, true };
yield return new object[] { decimal.Zero, decimal.One, false };
yield return new object[] { decimal.MaxValue, decimal.MaxValue, true };
yield return new object[] { decimal.MinValue, decimal.MinValue, true };
yield return new object[] { decimal.MaxValue, decimal.MinValue, false };
yield return new object[] { decimal.One, null, false };
yield return new object[] { decimal.One, 1, false };
yield return new object[] { decimal.One, "one", false };
}
[Theory]
[MemberData(nameof(Equals_TestData))]
public static void EqualsTest(object obj1, object obj2, bool expected)
{
if (obj1 is decimal d1)
{
if (obj2 is decimal d2)
{
Assert.Equal(expected, d1.Equals(d2));
Assert.Equal(expected, decimal.Equals(d1, d2));
Assert.Equal(expected, d1 == d2);
Assert.Equal(!expected, d1 != d2);
Assert.Equal(expected, d1.GetHashCode().Equals(d2.GetHashCode()));
Assert.True(d1.Equals(d1));
Assert.True(d1 == d1);
Assert.False(d1 != d1);
Assert.Equal(d1.GetHashCode(), d1.GetHashCode());
}
Assert.Equal(expected, d1.Equals(obj2));
}
Assert.Equal(expected, Equals(obj1, obj2));
}
public static IEnumerable<object[]> FromOACurrency_TestData()
{
yield return new object[] { 0L, 0m };
yield return new object[] { 1L, 0.0001m };
yield return new object[] { 100000L, 10m };
yield return new object[] { 10000000000L, 1000000m };
yield return new object[] { 1000000000000000000L, 100000000000000m };
yield return new object[] { 9223372036854775807L, 922337203685477.5807m };
yield return new object[] { -9223372036854775808L, -922337203685477.5808m };
yield return new object[] { 123456789L, 12345.6789m };
yield return new object[] { 1234567890000L, 123456789m };
yield return new object[] { 1234567890987654321L, 123456789098765.4321m };
yield return new object[] { 4294967295L, 429496.7295m };
}
[Theory]
[MemberData(nameof(FromOACurrency_TestData))]
public static void FromOACurrency(long oac, decimal expected)
{
Assert.Equal(expected, decimal.FromOACurrency(oac));
}
public static IEnumerable<object[]> Floor_TestData()
{
yield return new object[] { 123m, 123m };
yield return new object[] { 123.123m, 123m };
yield return new object[] { 123.456m, 123m };
yield return new object[] { -123.123m, -124m };
yield return new object[] { -123.456m, -124m };
}
[Theory]
[MemberData(nameof(Floor_TestData))]
public static void Floor(decimal d, decimal expected)
{
Assert.Equal(expected, decimal.Floor(d));
}
public static IEnumerable<object[]> GetBits_TestData()
{
yield return new object[] { 1M, new int[] { 0x00000001, 0x00000000, 0x00000000, 0x00000000 } };
yield return new object[] { 100000000000000M, new int[] { 0x107A4000, 0x00005AF3, 0x00000000, 0x00000000 } };
yield return new object[] { 100000000000000.00000000000000M, new int[] { 0x10000000, 0x3E250261, 0x204FCE5E, 0x000E0000 } };
yield return new object[] { 1.0000000000000000000000000000M, new int[] { 0x10000000, 0x3E250261, 0x204FCE5E, 0x001C0000 } };
yield return new object[] { 123456789M, new int[] { 0x075BCD15, 0x00000000, 0x00000000, 0x00000000 } };
yield return new object[] { 0.123456789M, new int[] { 0x075BCD15, 0x00000000, 0x00000000, 0x00090000 } };
yield return new object[] { 0.000000000123456789M, new int[] { 0x075BCD15, 0x00000000, 0x00000000, 0x00120000 } };
yield return new object[] { 0.000000000000000000123456789M, new int[] { 0x075BCD15, 0x00000000, 0x00000000, 0x001B0000 } };
yield return new object[] { 4294967295M, new int[] { unchecked((int)0xFFFFFFFF), 0x00000000, 0x00000000, 0x00000000 } };
yield return new object[] { 18446744073709551615M, new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), 0x00000000, 0x00000000 } };
yield return new object[] { decimal.MaxValue, new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), 0x00000000 } };
yield return new object[] { decimal.MinValue, new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0x80000000) } };
yield return new object[] { -7.9228162514264337593543950335M, new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0x801C0000) } };
}
[Theory]
[MemberData(nameof(GetBits_TestData))]
public static void GetBits(decimal input, int[] expected)
{
int[] bits = decimal.GetBits(input);
Assert.Equal(expected, bits);
bool sign = (bits[3] & 0x80000000) != 0;
byte scale = (byte)((bits[3] >> 16) & 0x7F);
decimal newValue = new decimal(bits[0], bits[1], bits[2], sign, scale);
Assert.Equal(input, newValue);
}
[Theory]
[MemberData(nameof(GetBits_TestData))]
public static void GetBitsSpan(decimal input, int[] expected)
{
Span<int> bits = new int[4];
int bitsWritten = decimal.GetBits(input, bits);
Assert.Equal(4, bitsWritten);
Assert.Equal(expected, bits.ToArray());
bool sign = (bits[3] & 0x80000000) != 0;
byte scale = (byte)((bits[3] >> 16) & 0x7F);
decimal newValue = new decimal(bits[0], bits[1], bits[2], sign, scale);
Assert.Equal(input, newValue);
}
[Fact]
public static void GetBitsSpan_TooShort_ThrowsArgumentException()
{
AssertExtensions.Throws<ArgumentException>("destination", () => decimal.GetBits(123, new int[3]));
}
[Theory]
[MemberData(nameof(GetBits_TestData))]
public static void TryGetBits(decimal input, int[] expected)
{
Span<int> bits;
int valuesWritten;
bits = new int[3] { 42, 43, 44 };
Assert.False(decimal.TryGetBits(input, bits, out valuesWritten));
Assert.Equal(0, valuesWritten);
Assert.Equal(new int[3] { 42, 43, 44 }, bits.ToArray());
bits = new int[4];
Assert.True(decimal.TryGetBits(input, bits, out valuesWritten));
Assert.Equal(4, valuesWritten);
Assert.Equal(expected, bits.ToArray());
bits = new int[5];
bits[4] = 42;
Assert.True(decimal.TryGetBits(input, bits, out valuesWritten));
Assert.Equal(4, valuesWritten);
Assert.Equal(expected, bits.Slice(0, 4).ToArray());
Assert.Equal(42, bits[4]);
}
[Fact]
public void GetTypeCode_Invoke_ReturnsDecimal()
{
Assert.Equal(TypeCode.Decimal, decimal.MaxValue.GetTypeCode());
}
public static IEnumerable<object[]> Multiply_Valid_TestData()
{
yield return new object[] { decimal.One, decimal.One, decimal.One };
yield return new object[] { 7922816251426433759354395033.5m, new decimal(10), decimal.MaxValue };
yield return new object[] { 0.2352523523423422342354395033m, 56033525474612414574574757495m, 13182018677937129120135020796m };
yield return new object[] { 46161363632634613634.093453337m, 461613636.32634613634083453337m, 21308714924243214928823669051m };
yield return new object[] { 0.0000000000000345435353453563m, .0000000000000023525235234234m, 0.0000000000000000000000000001m };
// Near decimal.MaxValue
yield return new object[] { 79228162514264337593543950335m, 0.9m, 71305346262837903834189555302m };
yield return new object[] { 79228162514264337593543950335m, 0.99m, 78435880889121694217608510832m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999999999999999m, 79228162514264337593543950327m };
yield return new object[] { -79228162514264337593543950335m, 0.9m, -71305346262837903834189555302m };
yield return new object[] { -79228162514264337593543950335m, 0.99m, -78435880889121694217608510832m };
yield return new object[] { -79228162514264337593543950335m, 0.9999999999999999999999999999m, -79228162514264337593543950327m };
}
[Theory]
[MemberData(nameof(Multiply_Valid_TestData))]
public static void Multiply(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 * d2);
Assert.Equal(expected, decimal.Multiply(d1, d2));
}
public static IEnumerable<object[]> Multiply_Invalid_TestData()
{
yield return new object[] { decimal.MaxValue, decimal.MinValue };
yield return new object[] { decimal.MinValue, 1.1m };
yield return new object[] { 79228162514264337593543950335m, 1.1m };
yield return new object[] { 79228162514264337593543950335m, 1.01m };
yield return new object[] { 79228162514264337593543950335m, 1.001m };
yield return new object[] { 79228162514264337593543950335m, 1.0001m };
yield return new object[] { 79228162514264337593543950335m, 1.00001m };
yield return new object[] { 79228162514264337593543950335m, 1.000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000000000001m };
yield return new object[] { decimal.MaxValue / 2, 2m };
}
[Theory]
[MemberData(nameof(Multiply_Invalid_TestData))]
public static void Multiply_Invalid(decimal d1, decimal d2)
{
Assert.Throws<OverflowException>(() => d1 * d2);
Assert.Throws<OverflowException>(() => decimal.Multiply(d1, d2));
}
public static IEnumerable<object[]> Negate_TestData()
{
yield return new object[] { 1m, -1m };
yield return new object[] { 0m, 0m };
yield return new object[] { -1m, 1m };
yield return new object[] { decimal.MaxValue, decimal.MinValue };
yield return new object[] { decimal.MinValue, decimal.MaxValue };
}
[Theory]
[MemberData(nameof(Negate_TestData))]
public static void Negate(decimal d, decimal expected)
{
Assert.Equal(expected, decimal.Negate(d));
}
public static IEnumerable<object[]> Parse_Valid_TestData()
{
NumberStyles defaultStyle = NumberStyles.Number;
NumberFormatInfo invariantFormat = NumberFormatInfo.InvariantInfo;
NumberFormatInfo emptyFormat = NumberFormatInfo.CurrentInfo;
var customFormat1 = new NumberFormatInfo();
customFormat1.CurrencySymbol = "$";
customFormat1.CurrencyGroupSeparator = ",";
var customFormat2 = new NumberFormatInfo();
customFormat2.NumberDecimalSeparator = ".";
var customFormat3 = new NumberFormatInfo();
customFormat3.NumberGroupSeparator = ",";
var customFormat4 = new NumberFormatInfo();
customFormat4.NumberDecimalSeparator = ".";
yield return new object[] { "-123", defaultStyle, null, -123m };
yield return new object[] { "0", defaultStyle, null, 0m };
yield return new object[] { "123", defaultStyle, null, 123m };
yield return new object[] { " 123 ", defaultStyle, null, 123m };
yield return new object[] { (567.89m).ToString(), defaultStyle, null, 567.89m };
yield return new object[] { (-567.89m).ToString(), defaultStyle, null, -567.89m };
yield return new object[] { "0.6666666666666666666666666666500000000000000000000000000000000000000000000000000000000000000", defaultStyle, invariantFormat, 0.6666666666666666666666666666m };
yield return new object[] { emptyFormat.NumberDecimalSeparator + "234", defaultStyle, null, 0.234m };
yield return new object[] { "234" + emptyFormat.NumberDecimalSeparator, defaultStyle, null, 234.0m };
yield return new object[] { "7" + new string('0', 28) + emptyFormat.NumberDecimalSeparator, defaultStyle, null, 7E28m };
yield return new object[] { "07" + new string('0', 28) + emptyFormat.NumberDecimalSeparator, defaultStyle, null, 7E28m };
yield return new object[] { "79228162514264337593543950335", defaultStyle, null, 79228162514264337593543950335m };
yield return new object[] { "-79228162514264337593543950335", defaultStyle, null, -79228162514264337593543950335m };
yield return new object[] { "79,228,162,514,264,337,593,543,950,335", NumberStyles.AllowThousands, customFormat3, 79228162514264337593543950335m };
yield return new object[] { (123.1m).ToString(), NumberStyles.AllowDecimalPoint, null, 123.1m };
yield return new object[] { 1000.ToString("N0"), NumberStyles.AllowThousands, null, 1000m };
yield return new object[] { "123", NumberStyles.Any, emptyFormat, 123m };
yield return new object[] { (123.567m).ToString(), NumberStyles.Any, emptyFormat, 123.567m };
yield return new object[] { "123", NumberStyles.Float, emptyFormat, 123m };
yield return new object[] { "$1000", NumberStyles.Currency, customFormat1, 1000m };
yield return new object[] { "123.123", NumberStyles.Float, customFormat2, 123.123m };
yield return new object[] { "(123)", NumberStyles.AllowParentheses, customFormat2, -123m };
// Number buffer limit ran out (string too long)
yield return new object[] { "1234567890123456789012345.678456", defaultStyle, customFormat4, 1234567890123456789012345.6785m };
}
[Theory]
[MemberData(nameof(Parse_Valid_TestData))]
public static void Parse(string value, NumberStyles style, IFormatProvider provider, decimal expected)
{
bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo;
decimal result;
if ((style & ~NumberStyles.Number) == 0 && style != NumberStyles.None)
{
// Use Parse(string) or Parse(string, IFormatProvider)
if (isDefaultProvider)
{
Assert.True(decimal.TryParse(value, out result));
Assert.Equal(expected, result);
Assert.Equal(expected, decimal.Parse(value));
}
Assert.Equal(expected, decimal.Parse(value, provider));
}
// Use Parse(string, NumberStyles, IFormatProvider)
Assert.True(decimal.TryParse(value, style, provider, out result));
Assert.Equal(expected, result);
Assert.Equal(expected, decimal.Parse(value, style, provider));
if (isDefaultProvider)
{
// Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider)
Assert.True(decimal.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result));
Assert.Equal(expected, result);
Assert.Equal(expected, decimal.Parse(value, style));
Assert.Equal(expected, decimal.Parse(value, style, NumberFormatInfo.CurrentInfo));
}
}
public static IEnumerable<object[]> Parse_Invalid_TestData()
{
NumberStyles defaultStyle = NumberStyles.Number;
var customFormat = new NumberFormatInfo();
customFormat.CurrencySymbol = "$";
customFormat.NumberDecimalSeparator = ".";
yield return new object[] { null, defaultStyle, null, typeof(ArgumentNullException) };
yield return new object[] { "79228162514264337593543950336", defaultStyle, null, typeof(OverflowException) };
yield return new object[] { "", defaultStyle, null, typeof(FormatException) };
yield return new object[] { " ", defaultStyle, null, typeof(FormatException) };
yield return new object[] { "Garbage", defaultStyle, null, typeof(FormatException) };
yield return new object[] { "ab", defaultStyle, null, typeof(FormatException) }; // Hex value
yield return new object[] { "(123)", defaultStyle, null, typeof(FormatException) }; // Parentheses
yield return new object[] { 100.ToString("C0"), defaultStyle, null, typeof(FormatException) }; // Currency
yield return new object[] { (123.456m).ToString(), NumberStyles.Integer, null, typeof(FormatException) }; // Decimal
yield return new object[] { " " + (123.456m).ToString(), NumberStyles.None, null, typeof(FormatException) }; // Leading space
yield return new object[] { (123.456m).ToString() + " ", NumberStyles.None, null, typeof(FormatException) }; // Leading space
yield return new object[] { "1E23", NumberStyles.None, null, typeof(FormatException) }; // Exponent
yield return new object[] { "ab", NumberStyles.None, null, typeof(FormatException) }; // Hex value
yield return new object[] { " 123 ", NumberStyles.None, null, typeof(FormatException) }; // Trailing and leading whitespace
}
[Theory]
[MemberData(nameof(Parse_Invalid_TestData))]
public static void Parse_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType)
{
bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo;
decimal result;
if ((style & ~NumberStyles.Number) == 0 && style != NumberStyles.None && (style & NumberStyles.AllowLeadingWhite) == (style & NumberStyles.AllowTrailingWhite))
{
// Use Parse(string) or Parse(string, IFormatProvider)
if (isDefaultProvider)
{
Assert.False(decimal.TryParse(value, out result));
Assert.Equal(default(decimal), result);
Assert.Throws(exceptionType, () => decimal.Parse(value));
}
Assert.Throws(exceptionType, () => decimal.Parse(value, provider));
}
// Use Parse(string, NumberStyles, IFormatProvider)
Assert.False(decimal.TryParse(value, style, provider, out result));
Assert.Equal(default(decimal), result);
Assert.Throws(exceptionType, () => decimal.Parse(value, style, provider));
if (isDefaultProvider)
{
// Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider)
Assert.False(decimal.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result));
Assert.Equal(default(decimal), result);
Assert.Throws(exceptionType, () => decimal.Parse(value, style));
Assert.Throws(exceptionType, () => decimal.Parse(value, style, NumberFormatInfo.CurrentInfo));
}
}
public static IEnumerable<object[]> Parse_ValidWithOffsetCount_TestData()
{
foreach (object[] inputs in Parse_Valid_TestData())
{
yield return new object[] { inputs[0], 0, ((string)inputs[0]).Length, inputs[1], inputs[2], inputs[3] };
}
yield return new object[] { "-123", 1, 3, NumberStyles.Number, null, 123m };
yield return new object[] { "-123", 0, 3, NumberStyles.Number, null, -12m };
yield return new object[] { 1000.ToString("N0"), 0, 4, NumberStyles.AllowThousands, null, 100m };
yield return new object[] { 1000.ToString("N0"), 2, 3, NumberStyles.AllowThousands, null, 0m };
yield return new object[] { "(123)", 1, 3, NumberStyles.AllowParentheses, new NumberFormatInfo() { NumberDecimalSeparator = "." }, 123m };
yield return new object[] { "1234567890123456789012345.678456", 1, 4, NumberStyles.Number, new NumberFormatInfo() { NumberDecimalSeparator = "." }, 2345m };
}
[Theory]
[MemberData(nameof(Parse_ValidWithOffsetCount_TestData))]
public static void Parse_Span_Valid(string value, int offset, int count, NumberStyles style, IFormatProvider provider, decimal expected)
{
bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo;
decimal result;
if ((style & ~NumberStyles.Number) == 0 && style != NumberStyles.None)
{
// Use Parse(string) or Parse(string, IFormatProvider)
if (isDefaultProvider)
{
Assert.True(decimal.TryParse(value.AsSpan(offset, count), out result));
Assert.Equal(expected, result);
Assert.Equal(expected, decimal.Parse(value.AsSpan(offset, count)));
}
Assert.Equal(expected, decimal.Parse(value.AsSpan(offset, count), provider: provider));
}
Assert.Equal(expected, decimal.Parse(value.AsSpan(offset, count), style, provider));
Assert.True(decimal.TryParse(value.AsSpan(offset, count), style, provider, out result));
Assert.Equal(expected, result);
}
[Theory]
[MemberData(nameof(Parse_Invalid_TestData))]
public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType)
{
if (value != null)
{
Assert.Throws(exceptionType, () => decimal.Parse(value.AsSpan(), style, provider));
Assert.False(decimal.TryParse(value.AsSpan(), style, provider, out decimal result));
Assert.Equal(0, result);
}
}
public static IEnumerable<object[]> Remainder_Valid_TestData()
{
decimal NegativeZero = new decimal(0, 0, 0, true, 0);
yield return new object[] { 5m, 3m, 2m };
yield return new object[] { 5m, -3m, 2m };
yield return new object[] { -5m, 3m, -2m };
yield return new object[] { -5m, -3m, -2m };
yield return new object[] { 3m, 5m, 3m };
yield return new object[] { 3m, -5m, 3m };
yield return new object[] { -3m, 5m, -3m };
yield return new object[] { -3m, -5m, -3m };
yield return new object[] { 10m, -3m, 1m };
yield return new object[] { -10m, 3m, -1m };
yield return new object[] { -2.0m, 0.5m, -0.0m };
yield return new object[] { 2.3m, 0.531m, 0.176m };
yield return new object[] { 0.00123m, 3242m, 0.00123m };
yield return new object[] { 3242m, 0.00123m, 0.00044m };
yield return new object[] { 17.3m, 3m, 2.3m };
yield return new object[] { 8.55m, 2.25m, 1.80m };
yield return new object[] { 0.00m, 3m, 0.00m };
yield return new object[] { NegativeZero, 2.2m, NegativeZero };
// Max/Min
yield return new object[] { decimal.MaxValue, decimal.MaxValue, 0m };
yield return new object[] { decimal.MaxValue, decimal.MinValue, 0m };
yield return new object[] { decimal.MaxValue, 1, 0m };
yield return new object[] { decimal.MaxValue, 2394713m, 1494647m };
yield return new object[] { decimal.MaxValue, -32768m, 32767m };
yield return new object[] { -0.00m, decimal.MaxValue, -0.00m };
yield return new object[] { 1.23984m, decimal.MaxValue, 1.23984m };
yield return new object[] { 2398412.12983m, decimal.MaxValue, 2398412.12983m };
yield return new object[] { -0.12938m, decimal.MaxValue, -0.12938m };
yield return new object[] { decimal.MinValue, decimal.MinValue, NegativeZero };
yield return new object[] { decimal.MinValue, decimal.MaxValue, NegativeZero };
yield return new object[] { decimal.MinValue, 1, NegativeZero };
yield return new object[] { decimal.MinValue, 2394713m, -1494647m };
yield return new object[] { decimal.MinValue, -32768m, -32767m };
yield return new object[] { 0.0m, decimal.MinValue, 0.0m };
yield return new object[] { 1.23984m, decimal.MinValue, 1.23984m };
yield return new object[] { 2398412.12983m, decimal.MinValue, 2398412.12983m };
yield return new object[] { -0.12938m, decimal.MinValue, -0.12938m };
yield return new object[] { 57675350989891243676868034225m, 7m, 5m };
yield return new object[] { -57675350989891243676868034225m, 7m, -5m };
yield return new object[] { 57675350989891243676868034225m, -7m, 5m };
yield return new object[] { -57675350989891243676868034225m, -7m, -5m };
yield return new object[] { 792281625142643375935439503.4m, 0.1m, 0.0m };
yield return new object[] { 79228162514264337593543950.34m, 0.1m, 0.04m };
yield return new object[] { 7922816251426433759354395.034m, 0.1m, 0.034m };
yield return new object[] { 792281625142643375935439.5034m, 0.1m, 0.0034m };
yield return new object[] { 79228162514264337593543950335m, 10m, 5m };
yield return new object[] { 79228162514264337567774146561m, 10m, 1m };
yield return new object[] { 79228162514264337567774146560m, 10m, 0m };
yield return new object[] { 79228162514264337567774146559m, 10m, 9m };
}
[Theory]
[MemberData(nameof(Remainder_Valid_TestData))]
public static void Remainder(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 % d2);
Assert.Equal(expected, decimal.Remainder(d1, d2));
}
public static IEnumerable<object[]> Remainder_Valid_TestDataV2()
{
yield return new object[] { decimal.MaxValue, 0.1m, 0.0m };
yield return new object[] { decimal.MaxValue, 7.081881059m, 3.702941036m };
yield return new object[] { decimal.MaxValue, 2004094637636.6280382536104438m, 1980741879937.1051521151154118m };
yield return new object[] { decimal.MaxValue, new decimal(0, 0, 1, false, 28), 0.0000000013968756053316206592m };
yield return new object[] { decimal.MaxValue, new decimal(0, 1, 0, false, 28), 0.0000000000000000004026531840m };
yield return new object[] { decimal.MaxValue, new decimal(1, 0, 0, false, 28), 0.0000000000000000000000000000m };
yield return new object[] { 5m, 0.0000000000000000000000000003m, 0.0000000000000000000000000002m };
yield return new object[] { 5.94499443m, 0.0000000000000000000000000007m, 0.0000000000000000000000000005m };
yield return new object[] { 1667m, 325.66574961026426932314500573m, 38.67125194867865338427497135m };
yield return new object[] { 1667m, 0.00000000013630700224712809m, 0.00000000002527942770321278m };
yield return new object[] { 60596869520933069.9m, 8063773.1275438997671m, 5700076.9722872002614m };
}
[Theory]
[MemberData(nameof(Remainder_Valid_TestDataV2))]
public static void RemainderV2(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 % d2);
Assert.Equal(expected, decimal.Remainder(d1, d2));
}
public static IEnumerable<object[]> Remainder_Invalid_TestData()
{
yield return new object[] { 5m, 0m };
}
[Theory]
[MemberData(nameof(Remainder_Invalid_TestData))]
public static void Remainder_ZeroDenominator_ThrowsDivideByZeroException(decimal d1, decimal d2)
{
Assert.Throws<DivideByZeroException>(() => d1 % d2);
Assert.Throws<DivideByZeroException>(() => decimal.Remainder(d1, d2));
}
public static IEnumerable<object[]> Round_Valid_TestData()
{
yield return new object[] { 0m, 0m };
yield return new object[] { 0.1m, 0m };
yield return new object[] { 0.5m, 0m };
yield return new object[] { 0.7m, 1m };
yield return new object[] { 1.3m, 1m };
yield return new object[] { 1.5m, 2m };
yield return new object[] { -0.1m, 0m };
yield return new object[] { -0.5m, 0m };
yield return new object[] { -0.7m, -1m };
yield return new object[] { -1.3m, -1m };
yield return new object[] { -1.5m, -2m };
}
[Theory]
[MemberData(nameof(Round_Valid_TestData))]
public static void Round(decimal d1, decimal expected)
{
Assert.Equal(expected, decimal.Round(d1));
}
public static IEnumerable<object[]> Round_Digit_Valid_TestData()
{
yield return new object[] { 1.45m, 1, 1.4m };
yield return new object[] { 1.55m, 1, 1.6m };
yield return new object[] { 123.456789m, 4, 123.4568m };
yield return new object[] { 123.456789m, 6, 123.456789m };
yield return new object[] { 123.456789m, 8, 123.456789m };
yield return new object[] { -123.456m, 0, -123m };
yield return new object[] { -123.0000000m, 3, -123.000m };
yield return new object[] { -123.0000000m, 11, -123.0000000m };
yield return new object[] { -9999999999.9999999999, 9, -10000000000.000000000m };
yield return new object[] { -9999999999.9999999999, 10, -9999999999.9999999999 };
}
[Theory]
[MemberData(nameof(Round_Digit_Valid_TestData))]
public static void Round_Digits_ReturnsExpected(decimal d, int digits, decimal expected)
{
Assert.Equal(expected, decimal.Round(d, digits));
}
public static IEnumerable<object[]> Round_Digit_Mid_Valid_TestData()
{
yield return new object[] { 1.45m, 1, MidpointRounding.ToEven, 1.4m };
yield return new object[] { 1.45m, 1, MidpointRounding.AwayFromZero, 1.5m };
yield return new object[] { 1.55m, 1, MidpointRounding.ToEven, 1.6m };
yield return new object[] { 1.55m, 1, MidpointRounding.AwayFromZero, 1.6m };
yield return new object[] { -1.45m, 1, MidpointRounding.ToEven, -1.4m };
yield return new object[] { -1.45m, 1, MidpointRounding.AwayFromZero, -1.5m };
yield return new object[] { 123.456789m, 4, MidpointRounding.ToEven, 123.4568m };
yield return new object[] { 123.456789m, 4, MidpointRounding.AwayFromZero, 123.4568m };
yield return new object[] { 123.456789m, 6, MidpointRounding.ToEven, 123.456789m };
yield return new object[] { 123.456789m, 6, MidpointRounding.AwayFromZero, 123.456789m };
yield return new object[] { 123.456789m, 8, MidpointRounding.ToEven, 123.456789m };
yield return new object[] { 123.456789m, 8, MidpointRounding.AwayFromZero, 123.456789m };
yield return new object[] { -123.456m, 0, MidpointRounding.ToEven, -123m };
yield return new object[] { -123.456m, 0, MidpointRounding.AwayFromZero, -123m };
yield return new object[] { -123.0000000m, 3, MidpointRounding.ToEven, -123.000m };
yield return new object[] { -123.0000000m, 3, MidpointRounding.AwayFromZero, -123.000m };
yield return new object[] { -123.0000000m, 11, MidpointRounding.ToEven, -123.0000000m };
yield return new object[] { -123.0000000m, 11, MidpointRounding.AwayFromZero, -123.0000000m };
yield return new object[] { -9999999999.9999999999, 9, MidpointRounding.ToEven, -10000000000.000000000m };
yield return new object[] { -9999999999.9999999999, 9, MidpointRounding.AwayFromZero, -10000000000.000000000m };
yield return new object[] { -9999999999.9999999999, 10, MidpointRounding.ToEven, -9999999999.9999999999 };
yield return new object[] { -9999999999.9999999999, 10, MidpointRounding.AwayFromZero, -9999999999.9999999999 };
}
[Theory]
[MemberData(nameof(Round_Digit_Mid_Valid_TestData))]
public static void Round_DigitsMode_ReturnsExpected(decimal d, int digits, MidpointRounding mode, decimal expected)
{
Assert.Equal(expected, decimal.Round(d, digits, mode));
}
public static IEnumerable<object[]> Round_Mid_Valid_TestData()
{
yield return new object[] { 0m, MidpointRounding.ToEven, 0m };
yield return new object[] { 0m, MidpointRounding.AwayFromZero, 0m };
yield return new object[] { 0.1m, MidpointRounding.ToEven, 0m };
yield return new object[] { 0.1m, MidpointRounding.AwayFromZero, 0m };
yield return new object[] { 0.5m, MidpointRounding.ToEven, 0m };
yield return new object[] { 0.5m, MidpointRounding.AwayFromZero, 1m };
yield return new object[] { 0.7m, MidpointRounding.ToEven, 1m };
yield return new object[] { 0.7m, MidpointRounding.AwayFromZero, 1m };
yield return new object[] { 1.3m, MidpointRounding.ToEven, 1m };
yield return new object[] { 1.3m, MidpointRounding.AwayFromZero, 1m };
yield return new object[] { 1.5m, MidpointRounding.ToEven, 2m };
yield return new object[] { 1.5m, MidpointRounding.AwayFromZero, 2m };
yield return new object[] { -0.1m, MidpointRounding.ToEven, 0m };
yield return new object[] { -0.1m, MidpointRounding.AwayFromZero, 0m };
yield return new object[] { -0.5m, MidpointRounding.ToEven, 0m };
yield return new object[] { -0.5m, MidpointRounding.AwayFromZero, -1m };
yield return new object[] { -0.7m, MidpointRounding.ToEven, -1m };
yield return new object[] { -0.7m, MidpointRounding.AwayFromZero, -1m };
yield return new object[] { -1.3m, MidpointRounding.ToEven, -1m };
yield return new object[] { -1.3m, MidpointRounding.AwayFromZero, -1m };
yield return new object[] { -1.5m, MidpointRounding.ToEven, -2m };
yield return new object[] { -1.5m, MidpointRounding.AwayFromZero, -2m };
}
[Theory]
[MemberData(nameof(Round_Mid_Valid_TestData))]
public void Round_MidpointRounding_ReturnsExpected(decimal d, MidpointRounding mode, decimal expected)
{
Assert.Equal(expected, decimal.Round(d, mode));
}
[Theory]
[InlineData(-1)]
[InlineData(29)]
public void Round_InvalidDecimals_ThrowsArgumentOutOfRangeException(int decimals)
{
AssertExtensions.Throws<ArgumentOutOfRangeException>("decimals", () => decimal.Round(1, decimals));
AssertExtensions.Throws<ArgumentOutOfRangeException>("decimals", () => decimal.Round(1, decimals, MidpointRounding.AwayFromZero));
}
public static IEnumerable<object[]> Subtract_Valid_TestData()
{
yield return new object[] { 1m, 1m, 0m };
yield return new object[] { 1m, 0m, 1m };
yield return new object[] { 0m, 1m, -1m };
yield return new object[] { 1m, 1m, 0m };
yield return new object[] { -1m, 1m, -2m };
yield return new object[] { 1m, -1m, 2m };
yield return new object[] { decimal.MaxValue, decimal.Zero, decimal.MaxValue };
yield return new object[] { decimal.MinValue, decimal.Zero, decimal.MinValue };
yield return new object[] { 79228162514264337593543950330m, -5, decimal.MaxValue };
yield return new object[] { 79228162514264337593543950330m, 5, 79228162514264337593543950325m };
yield return new object[] { -79228162514264337593543950330m, 5, decimal.MinValue };
yield return new object[] { -79228162514264337593543950330m, -5, -79228162514264337593543950325m };
yield return new object[] { 1234.5678m, 0.00009m, 1234.56771m };
yield return new object[] { -1234.5678m, 0.00009m, -1234.56789m };
yield return new object[] { 0.1111111111111111111111111111m, 0.1111111111111111111111111111m, 0 };
yield return new object[] { 0.2222222222222222222222222222m, 0.1111111111111111111111111111m, 0.1111111111111111111111111111m };
yield return new object[] { 1.1111111111111111111111111110m, 0.5555555555555555555555555555m, 0.5555555555555555555555555555m };
}
[Theory]
[MemberData(nameof(Subtract_Valid_TestData))]
public static void Subtract(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 - d2);
Assert.Equal(expected, decimal.Subtract(d1, d2));
decimal d3 = d1;
d3 -= d2;
Assert.Equal(expected, d3);
}
public static IEnumerable<object[]> Subtract_Invalid_TestData()
{
yield return new object[] { 79228162514264337593543950330m, -6 };
yield return new object[] { -79228162514264337593543950330m, 6 };
}
[Theory]
[MemberData(nameof(Subtract_Invalid_TestData))]
public static void Subtract_Invalid(decimal d1, decimal d2)
{
Assert.Throws<OverflowException>(() => decimal.Subtract(d1, d2));
Assert.Throws<OverflowException>(() => d1 - d2);
decimal d3 = d1;
Assert.Throws<OverflowException>(() => d3 -= d2);
}
public static IEnumerable<object[]> ToOACurrency_TestData()
{
yield return new object[] { 0m, 0L };
yield return new object[] { 1m, 10000L };
yield return new object[] { 1.000000000000000m, 10000L };
yield return new object[] { 10000000000m, 100000000000000L };
yield return new object[] { 10000000000.00000000000000000m, 100000000000000L };
yield return new object[] { 0.000000000123456789m, 0L };
yield return new object[] { 0.123456789m, 1235L };
yield return new object[] { 123456789m, 1234567890000L };
yield return new object[] { 4294967295m, 42949672950000L };
yield return new object[] { -79.228162514264337593543950335m, -792282L };
yield return new object[] { -79228162514264.337593543950335m, -792281625142643376L };
}
[Theory]
[MemberData(nameof(ToOACurrency_TestData))]
public void ToOACurrency_Value_ReturnsExpected(decimal value, long expected)
{
Assert.Equal(expected, decimal.ToOACurrency(value));
}
[Fact]
public void ToOACurrency_InvalidAsLong_ThrowsOverflowException()
{
Assert.Throws<OverflowException>(() => decimal.ToOACurrency(new decimal(long.MaxValue) + 1));
Assert.Throws<OverflowException>(() => decimal.ToOACurrency(new decimal(long.MinValue) - 1));
}
[Fact]
public static void ToByte()
{
Assert.Equal(byte.MinValue, decimal.ToByte(byte.MinValue));
Assert.Equal(123, decimal.ToByte(123));
Assert.Equal(123, decimal.ToByte(123.123m));
Assert.Equal(byte.MaxValue, decimal.ToByte(byte.MaxValue));
}
[Fact]
public static void ToByte_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToByte(byte.MinValue - 1)); // Decimal < byte.MinValue
Assert.Throws<OverflowException>(() => decimal.ToByte(byte.MaxValue + 1)); // Decimal > byte.MaxValue
}
[Fact]
public static void ToDouble()
{
double d = decimal.ToDouble(new decimal(0, 0, 1, false, 0));
double dbl = 123456789.123456;
Assert.Equal(dbl, decimal.ToDouble((decimal)dbl));
Assert.Equal(-dbl, decimal.ToDouble((decimal)-dbl));
dbl = 1e20;
Assert.Equal(dbl, decimal.ToDouble((decimal)dbl));
Assert.Equal(-dbl, decimal.ToDouble((decimal)-dbl));
dbl = 1e27;
Assert.Equal(dbl, decimal.ToDouble((decimal)dbl));
Assert.Equal(-dbl, decimal.ToDouble((decimal)-dbl));
dbl = long.MaxValue;
// Need to pass in the Int64.MaxValue to ToDouble and not dbl because the conversion to double is a little lossy and we want precision
Assert.Equal(dbl, decimal.ToDouble(long.MaxValue));
Assert.Equal(-dbl, decimal.ToDouble(-long.MaxValue));
}
[Fact]
public static void ToInt16()
{
Assert.Equal(short.MinValue, decimal.ToInt16(short.MinValue));
Assert.Equal(-123, decimal.ToInt16(-123));
Assert.Equal(0, decimal.ToInt16(0));
Assert.Equal(123, decimal.ToInt16(123));
Assert.Equal(123, decimal.ToInt16(123.123m));
Assert.Equal(short.MaxValue, decimal.ToInt16(short.MaxValue));
}
[Fact]
public static void ToInt16_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToInt16(short.MinValue - 1)); // Decimal < short.MinValue
Assert.Throws<OverflowException>(() => decimal.ToInt16(short.MaxValue + 1)); // Decimal > short.MaxValue
Assert.Throws<OverflowException>(() => decimal.ToInt16((long)int.MinValue - 1)); // Decimal < short.MinValue
Assert.Throws<OverflowException>(() => decimal.ToInt16((long)int.MaxValue + 1)); // Decimal > short.MaxValue
}
[Fact]
public static void ToInt32()
{
Assert.Equal(int.MinValue, decimal.ToInt32(int.MinValue));
Assert.Equal(-123, decimal.ToInt32(-123));
Assert.Equal(0, decimal.ToInt32(0));
Assert.Equal(123, decimal.ToInt32(123));
Assert.Equal(123, decimal.ToInt32(123.123m));
Assert.Equal(int.MaxValue, decimal.ToInt32(int.MaxValue));
}
[Fact]
public static void ToInt32_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToInt32((long)int.MinValue - 1)); // Decimal < int.MinValue
Assert.Throws<OverflowException>(() => decimal.ToInt32((long)int.MaxValue + 1)); // Decimal > int.MaxValue
}
[Fact]
public static void ToInt64()
{
Assert.Equal(long.MinValue, decimal.ToInt64(long.MinValue));
Assert.Equal(-123, decimal.ToInt64(-123));
Assert.Equal(0, decimal.ToInt64(0));
Assert.Equal(123, decimal.ToInt64(123));
Assert.Equal(123, decimal.ToInt64(123.123m));
Assert.Equal(long.MaxValue, decimal.ToInt64(long.MaxValue));
}
[Fact]
public static void ToInt64_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToUInt64(decimal.MinValue)); // Decimal < long.MinValue
Assert.Throws<OverflowException>(() => decimal.ToUInt64(decimal.MaxValue)); // Decimal > long.MaxValue
}
[Fact]
public static void ToSByte()
{
Assert.Equal(sbyte.MinValue, decimal.ToSByte(sbyte.MinValue));
Assert.Equal(-123, decimal.ToSByte(-123));
Assert.Equal(0, decimal.ToSByte(0));
Assert.Equal(123, decimal.ToSByte(123));
Assert.Equal(123, decimal.ToSByte(123.123m));
Assert.Equal(sbyte.MaxValue, decimal.ToSByte(sbyte.MaxValue));
}
[Fact]
public static void ToSByte_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToSByte(sbyte.MinValue - 1)); // Decimal < sbyte.MinValue
Assert.Throws<OverflowException>(() => decimal.ToSByte(sbyte.MaxValue + 1)); // Decimal > sbyte.MaxValue
Assert.Throws<OverflowException>(() => decimal.ToSByte((long)int.MinValue - 1)); // Decimal < sbyte.MinValue
Assert.Throws<OverflowException>(() => decimal.ToSByte((long)int.MaxValue + 1)); // Decimal > sbyte.MaxValue
}
[Fact]
public static void ToSingle()
{
float f = 12345.12f;
Assert.Equal(f, decimal.ToSingle((decimal)f));
Assert.Equal(-f, decimal.ToSingle((decimal)-f));
f = 1e20f;
Assert.Equal(f, decimal.ToSingle((decimal)f));
Assert.Equal(-f, decimal.ToSingle((decimal)-f));
f = 1e27f;
Assert.Equal(f, decimal.ToSingle((decimal)f));
Assert.Equal(-f, decimal.ToSingle((decimal)-f));
}
[Fact]
public static void ToUInt16()
{
Assert.Equal(ushort.MinValue, decimal.ToUInt16(ushort.MinValue));
Assert.Equal(123, decimal.ToByte(123));
Assert.Equal(123, decimal.ToByte(123.123m));
Assert.Equal(ushort.MaxValue, decimal.ToUInt16(ushort.MaxValue));
}
[Fact]
public static void ToUInt16_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToUInt16(ushort.MinValue - 1)); // Decimal < ushort.MinValue
Assert.Throws<OverflowException>(() => decimal.ToUInt16(ushort.MaxValue + 1)); // Decimal > ushort.MaxValue
}
[Fact]
public static void ToUInt32()
{
Assert.Equal(uint.MinValue, decimal.ToUInt32(uint.MinValue));
Assert.Equal((uint)123, decimal.ToUInt32(123));
Assert.Equal((uint)123, decimal.ToUInt32(123.123m));
Assert.Equal(uint.MaxValue, decimal.ToUInt32(uint.MaxValue));
}
[Fact]
public static void ToUInt32_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToUInt32((long)uint.MinValue - 1)); // Decimal < uint.MinValue
Assert.Throws<OverflowException>(() => decimal.ToUInt32((long)uint.MaxValue + 1)); // Decimal > uint.MaxValue
}
[Fact]
public static void ToUInt64()
{
Assert.Equal(ulong.MinValue, decimal.ToUInt64(ulong.MinValue));
Assert.Equal((ulong)123, decimal.ToUInt64(123));
Assert.Equal((ulong)123, decimal.ToUInt64(123.123m));
Assert.Equal(ulong.MaxValue, decimal.ToUInt64(ulong.MaxValue));
}
[Fact]
public static void ToUInt64_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToUInt64((long)ulong.MinValue - 1)); // Decimal < uint.MinValue
}
public static IEnumerable<object[]> ToString_TestData()
{
foreach (NumberFormatInfo defaultFormat in new[] { null, NumberFormatInfo.CurrentInfo })
{
yield return new object[] { decimal.MinValue, "G", defaultFormat, "-79228162514264337593543950335" };
yield return new object[] { (decimal)-4567, "G", defaultFormat, "-4567" };
yield return new object[] { (decimal)-4567.89101, "G", defaultFormat, "-4567.89101" };
yield return new object[] { (decimal)0, "G", defaultFormat, "0" };
yield return new object[] { (decimal)4567, "G", defaultFormat, "4567" };
yield return new object[] { (decimal)4567.89101, "G", defaultFormat, "4567.89101" };
yield return new object[] { decimal.MaxValue, "G", defaultFormat, "79228162514264337593543950335" };
yield return new object[] { decimal.MinusOne, "G", defaultFormat, "-1" };
yield return new object[] { decimal.Zero, "G", defaultFormat, "0" };
yield return new object[] { decimal.One, "G", defaultFormat, "1" };
yield return new object[] { (decimal)2468, "N", defaultFormat, "2,468.00" };
yield return new object[] { (decimal)2467, "[#-##-#]", defaultFormat, "[2-46-7]" };
}
NumberFormatInfo invariantFormat = NumberFormatInfo.InvariantInfo;
yield return new object[] { 32.5m, "C100", invariantFormat, "¤32.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" };
yield return new object[] { 32.5m, "P100", invariantFormat, "3,250.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %" };
yield return new object[] { 32.5m, "E100", invariantFormat, "3.2500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+001" };
yield return new object[] { 32.5m, "F100", invariantFormat, "32.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" };
yield return new object[] { 32.5m, "N100", invariantFormat, "32.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" };
// Changing the negative pattern doesn't do anything without also passing in a format string
var customFormat1 = new NumberFormatInfo();
customFormat1.NumberNegativePattern = 0;
yield return new object[] { (decimal)-6310, "G", customFormat1, "-6310" };
var customFormat2 = new NumberFormatInfo();
customFormat2.NegativeSign = "#";
customFormat2.NumberDecimalSeparator = "~";
customFormat2.NumberGroupSeparator = "*";
yield return new object[] { (decimal)-2468, "N", customFormat2, "#2*468~00" };
yield return new object[] { (decimal)2468, "N", customFormat2, "2*468~00" };
var customFormat3 = new NumberFormatInfo();
customFormat3.NegativeSign = "xx"; // Set to trash to make sure it doesn't show up
customFormat3.NumberGroupSeparator = "*";
customFormat3.NumberNegativePattern = 0;
yield return new object[] { (decimal)-2468, "N", customFormat3, "(2*468.00)" };
var customFormat4 = new NumberFormatInfo()
{
NegativeSign = "#",
NumberDecimalSeparator = "~",
NumberGroupSeparator = "*",
PositiveSign = "&",
NumberDecimalDigits = 2,
PercentSymbol = "@",
PercentGroupSeparator = ",",
PercentDecimalSeparator = ".",
PercentDecimalDigits = 5
};
yield return new object[] { (decimal)123, "E", customFormat4, "1~230000E&002" };
yield return new object[] { (decimal)123, "F", customFormat4, "123~00" };
yield return new object[] { (decimal)123, "P", customFormat4, "12,300.00000 @" };
}
[Fact]
public static void Test_ToString()
{
using (new ThreadCultureChange(CultureInfo.InvariantCulture))
{
foreach (object[] testdata in ToString_TestData())
{
ToString((decimal)testdata[0], (string)testdata[1], (IFormatProvider)testdata[2], (string)testdata[3]);
}
}
}
private static void ToString(decimal f, string format, IFormatProvider provider, string expected)
{
bool isDefaultProvider = provider == null;
if (string.IsNullOrEmpty(format) || format.ToUpperInvariant() == "G")
{
if (isDefaultProvider)
{
Assert.Equal(expected, f.ToString());
Assert.Equal(expected, f.ToString((IFormatProvider)null));
}
Assert.Equal(expected, f.ToString(provider));
}
if (isDefaultProvider)
{
Assert.Equal(expected.Replace('e', 'E'), f.ToString(format.ToUpperInvariant())); // If format is upper case, then exponents are printed in upper case
Assert.Equal(expected.Replace('E', 'e'), f.ToString(format.ToLowerInvariant())); // If format is lower case, then exponents are printed in lower case
Assert.Equal(expected.Replace('e', 'E'), f.ToString(format.ToUpperInvariant(), null));
Assert.Equal(expected.Replace('E', 'e'), f.ToString(format.ToLowerInvariant(), null));
}
Assert.Equal(expected.Replace('e', 'E'), f.ToString(format.ToUpperInvariant(), provider));
Assert.Equal(expected.Replace('E', 'e'), f.ToString(format.ToLowerInvariant(), provider));
}
[Fact]
public static void ToString_InvalidFormat_ThrowsFormatException()
{
decimal f = 123;
Assert.Throws<FormatException>(() => f.ToString("Y"));
Assert.Throws<FormatException>(() => f.ToString("Y", null));
long intMaxPlus1 = (long)int.MaxValue + 1;
string intMaxPlus1String = intMaxPlus1.ToString();
Assert.Throws<FormatException>(() => f.ToString("E" + intMaxPlus1String));
}
[Theory]
[InlineData("3.00")]
public void TestRoundTripDecimalToString(string input)
{
decimal d = Decimal.Parse(input, NumberStyles.Number, NumberFormatInfo.InvariantInfo);
string dString = d.ToString(CultureInfo.InvariantCulture);
Assert.Equal(input, dString);
}
public static IEnumerable<object[]> Truncate_TestData()
{
yield return new object[] { 123m, 123m };
yield return new object[] { 123.123m, 123m };
yield return new object[] { 123.456m, 123m };
yield return new object[] { -123.123m, -123m };
yield return new object[] { -123.456m, -123m };
}
[Theory]
[MemberData(nameof(Truncate_TestData))]
public static void Truncate(decimal d, decimal expected)
{
Assert.Equal(expected, decimal.Truncate(d));
}
public static IEnumerable<object[]> Increment_TestData()
{
yield return new object[] { 1m, 2m };
yield return new object[] { 0m, 1m };
yield return new object[] { -1m, -0m };
yield return new object[] { 12345m, 12346m };
yield return new object[] { 12345.678m, 12346.678m };
yield return new object[] { -12345.678m, -12344.678m };
}
[Theory]
[MemberData(nameof(Increment_TestData))]
public static void IncrementOperator(decimal d, decimal expected)
{
Assert.Equal(expected, ++d);
}
public static IEnumerable<object[]> Decrement_TestData()
{
yield return new object[] { 1m, 0m };
yield return new object[] { 0m, -1m };
yield return new object[] { -1m, -2m };
yield return new object[] { 12345m, 12344m };
yield return new object[] { 12345.678m, 12344.678m };
yield return new object[] { -12345.678m, -12346.678m };
}
[Theory]
[MemberData(nameof(Decrement_TestData))]
public static void DecrementOperator(decimal d, decimal expected)
{
Assert.Equal(expected, --d);
}
public static class BigIntegerCompare
{
[Fact]
public static void Test()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
int expected = b1.CompareTo(bigDecimals[j]);
int actual = d1.CompareTo(d2);
if (expected != actual)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " CMP " + d2);
}
}
}
}
public static class BigIntegerAdd
{
[Fact]
public static void Test()
{
int overflowBudget = 1000;
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
BigDecimal expected = b1.Add(bigDecimals[j], out bool expectedOverflow);
if (expectedOverflow)
{
if (--overflowBudget < 0)
continue;
try
{
decimal actual = d1 + d2;
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " + " + d2);
}
catch (OverflowException) { }
}
else
unsafe
{
decimal actual = d1 + d2;
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " + " + d2);
}
}
}
}
}
public static class BigIntegerMul
{
[Fact]
public static void Test()
{
int overflowBudget = 1000;
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
BigDecimal expected = b1.Mul(bigDecimals[j], out bool expectedOverflow);
if (expectedOverflow)
{
if (--overflowBudget < 0)
continue;
try
{
decimal actual = d1 * d2;
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " * " + d2);
}
catch (OverflowException) { }
}
else
unsafe
{
decimal actual = d1 * d2;
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " * " + d2);
}
}
}
}
}
public static class BigIntegerDiv
{
[Fact]
public static void Test()
{
int overflowBudget = 1000;
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
if (Math.Sign(d2) == 0)
continue;
BigDecimal expected = b1.Div(bigDecimals[j], out bool expectedOverflow);
if (expectedOverflow)
{
if (--overflowBudget < 0)
continue;
try
{
decimal actual = d1 / d2;
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " / " + d2);
}
catch (OverflowException) { }
}
else
unsafe
{
decimal actual = d1 / d2;
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " / " + d2);
}
}
}
}
}
public static class BigIntegerMod
{
[Fact]
public static void Test()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
if (Math.Sign(d2) == 0)
continue;
BigDecimal expected = b1.Mod(bigDecimals[j]);
try
{
decimal actual = d1 % d2;
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " % " + d2);
}
}
catch (OverflowException actual)
{
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " % " + d2);
}
}
}
}
}
[Fact]
public static void BigInteger_Floor()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal expected = bigDecimals[i].Floor();
decimal actual = decimal.Floor(d1);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " Floor");
}
}
}
[Fact]
public static void BigInteger_Ceiling()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal expected = bigDecimals[i].Ceiling();
decimal actual = decimal.Ceiling(d1);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " Ceiling");
}
}
}
[Fact]
public static void BigInteger_Truncate()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal expected = bigDecimals[i].Truncate();
decimal actual = decimal.Truncate(d1);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " Truncate");
}
}
}
[Fact]
public static void BigInteger_ToInt32()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
int expected = bigDecimals[i].ToInt32(out bool expectedOverflow);
if (expectedOverflow)
{
try
{
int actual = decimal.ToInt32(d1);
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " ToInt32");
}
catch (OverflowException) { }
}
else
{
int actual = decimal.ToInt32(d1);
if (expected != actual)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " ToInt32");
}
}
}
[Fact]
public static void BigInteger_ToOACurrency()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
long expected = bigDecimals[i].ToOACurrency(out bool expectedOverflow);
if (expectedOverflow)
{
try
{
long actual = decimal.ToOACurrency(d1);
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " ToOACurrency");
}
catch (OverflowException) { }
}
else
{
long actual = decimal.ToOACurrency(d1);
if (expected != actual)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " ToOACurrency");
}
}
}
[Fact]
public static void BigInteger_Round()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j <= 28; j++)
{
BigDecimal expected = b1.Round(j);
decimal actual = decimal.Round(d1, j);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " Round(" + j + ")");
}
}
}
}
[Fact]
public static void BigInteger_RoundAwayFromZero()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j <= 28; j++)
{
BigDecimal expected = b1.RoundAwayFromZero(j);
decimal actual = decimal.Round(d1, j, MidpointRounding.AwayFromZero);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " RoundAwayFromZero(" + j + ")");
}
}
}
}
[Fact]
public static void GetHashCodeTest()
{
var dict = new Dictionary<string, (int hash, string value)>();
foreach (decimal d in GetRandomData(out _, hash: true))
{
string value = d.ToString(CultureInfo.InvariantCulture);
string key = value[value.Length - 1] == '0' && value.Contains('.') ? value.AsSpan().TrimEnd('0').TrimEnd('.').ToString() : value;
int hash = d.GetHashCode();
if (!dict.TryGetValue(key, out var ex))
{
dict.Add(key, (hash, value));
}
else if (ex.hash != hash)
{
throw new Xunit.Sdk.XunitException($"Decimal {key} has multiple hash codes: {ex.hash} ({ex.value}) and {hash} ({value})");
}
}
}
static decimal[] GetRandomData(out BigDecimal[] bigDecimals, bool hash = false)
{
// some static data to test the limits
var list = new List<decimal> { new decimal(0, 0, 0, true, 0), decimal.Zero, decimal.MinusOne, decimal.One, decimal.MinValue, decimal.MaxValue,
new decimal(1, 0, 0, true, 28), new decimal(1, 0, 0, false, 28),
new decimal(123877878, -16789245, 1086421879, true, 16), new decimal(527635459, -80701438, 1767087216, true, 24), new decimal(253511426, -909347550, -753557281, false, 12) };
// ~1000 different random decimals covering every scale and sign with ~20 different bitpatterns each
var rnd = new Random(42);
var unique = new HashSet<string>();
for (byte scale = 0; scale <= 28; scale++)
for (int sign = 0; sign <= 1; sign++)
for (int high = 0; high <= 96; high = IncBitLimits(high))
for (int low = 0; low < high || (high | low) == 0; low = IncBitLimits(high))
{
var d = new decimal(GetDigits(low, high), GetDigits(low - 32, high - 32), GetDigits(low - 64, high - 64), sign != 0, scale);
if (!unique.Add(d.ToString(CultureInfo.InvariantCulture)))
continue; // skip duplicates
list.Add(d);
if (hash)
{
// generate all possible variants of the number up-to max decimal scale
for (byte lastScale = scale; lastScale < 28;)
{
d *= 1.0m;
unsafe
{
byte curScale = (byte)(*(uint*)&d >> BigDecimal.ScaleShift);
if (curScale <= lastScale)
break;
lastScale = curScale;
}
list.Add(d);
}
}
}
decimal[] decimalValues = list.ToArray();
bigDecimals = hash ? null : Array.ConvertAll(decimalValues, d => new BigDecimal(d));
return decimalValues;
// While the decimals are random in general,
// they are particularly focused on numbers starting or ending at bits 0-3, 30-34, 62-66, 94-96 to focus more on the corner cases around uint32 boundaries.
int IncBitLimits(int i)
{
switch (i)
{
case 3:
return 30;
case 34:
return 62;
case 66:
return 94;
default:
return i + 1;
}
}
// Generates a random number, only bits between low and high can be set.
int GetDigits(int low, int high)
{
if (high <= 0 || low >= 32)
return 0;
uint res = 0;
if (high <= 32)
res = 1u << (high - 1);
res |= (uint)Math.Ceiling((uint.MaxValue >> Math.Max(0, 32 - high)) * rnd.NextDouble());
if (low > 0)
res = (res >> low) << low;
return (int)res;
}
}
/// <summary>
/// Decimal implementation roughly based on the oleaut32 native decimal code (especially ScaleResult), but optimized for simplicity instead of speed
/// </summary>
struct BigDecimal
{
public readonly BigInteger Integer;
public readonly byte Scale;
public unsafe BigDecimal(decimal value)
{
Scale = (byte)(*(uint*)&value >> ScaleShift);
*(uint*)&value &= ~ScaleMask;
Integer = new BigInteger(value);
}
private const uint ScaleMask = 0x00FF0000;
public const int ScaleShift = 16;
public override string ToString()
{
if (Scale == 0)
return Integer.ToString();
var s = Integer.ToString("D" + (Scale + 1));
return s.Insert(s.Length - Scale, ".");
}
BigDecimal(BigInteger integer, byte scale)
{
Integer = integer;
Scale = scale;
}
static readonly BigInteger[] Pow10 = Enumerable.Range(0, 60).Select(i => BigInteger.Pow(10, i)).ToArray();
public int CompareTo(BigDecimal value)
{
int sd = Scale - value.Scale;
if (sd > 0)
return Integer.CompareTo(value.Integer * Pow10[sd]);
else if (sd < 0)
return (Integer * Pow10[-sd]).CompareTo(value.Integer);
else
return Integer.CompareTo(value.Integer);
}
public BigDecimal Add(BigDecimal value, out bool overflow)
{
int sd = Scale - value.Scale;
BigInteger a = Integer, b = value.Integer;
if (sd > 0)
b *= Pow10[sd];
else if (sd < 0)
a *= Pow10[-sd];
var res = a + b;
int scale = Math.Max(Scale, value.Scale);
overflow = ScaleResult(ref res, ref scale);
return new BigDecimal(res, (byte)scale);
}
public BigDecimal Mul(BigDecimal value, out bool overflow)
{
var res = Integer * value.Integer;
int scale = Scale + value.Scale;
if (res.IsZero)
{
overflow = false;
// VarDecMul quirk: multipling by zero results in a scaled zero (e.g., 0.000) only if the intermediate scale is <=47 and both inputs fit in 32 bits!
if (scale <= 47 && BigInteger.Abs(Integer) <= MaxInteger32 && BigInteger.Abs(value.Integer) <= MaxInteger32)
scale = Math.Min(scale, 28);
else
scale = 0;
}
else
{
overflow = ScaleResult(ref res, ref scale);
// VarDecMul quirk: rounding to zero results in a scaled zero (e.g., 0.000), except if the intermediate scale is >47 and both inputs fit in 32 bits!
if (res.IsZero && scale == 28 && Scale + value.Scale > 47 && BigInteger.Abs(Integer) <= MaxInteger32 && BigInteger.Abs(value.Integer) <= MaxInteger32)
scale = 0;
}
return new BigDecimal(res, (byte)scale);
}
public BigDecimal Div(BigDecimal value, out bool overflow)
{
int scale = Scale - value.Scale;
var dividend = Integer;
if (scale < 0)
{
dividend *= Pow10[-scale];
scale = 0;
}
var quo = BigInteger.DivRem(dividend, value.Integer, out var remainder);
if (remainder.IsZero)
overflow = BigInteger.Abs(quo) > MaxInteger;
else
{
// We have computed a quotient based on the natural scale ( <dividend scale> - <divisor scale> ).
// We have a non-zero remainder, so now we increase the scale to DEC_SCALE_MAX+1 to include more quotient bits.
var pow = Pow10[29 - scale];
quo *= pow;
quo += BigInteger.DivRem(remainder * pow, value.Integer, out remainder);
scale = 29;
overflow = ScaleResult(ref quo, ref scale, !remainder.IsZero);
// Unscale the result (removes extra zeroes).
while (scale > 0 && quo.IsEven)
{
var tmp = BigInteger.DivRem(quo, 10, out remainder);
if (!remainder.IsZero)
break;
quo = tmp;
scale--;
}
}
return new BigDecimal(quo, (byte)scale);
}
public BigDecimal Mod(BigDecimal den)
{
if (den.Integer.IsZero)
{
throw new DivideByZeroException();
}
int sign = Integer.Sign;
if (sign == 0)
{
return this;
}
if (den.Integer.Sign != sign)
{
den = -den;
}
int cmp = CompareTo(den) * sign;
if (cmp <= 0)
{
return cmp < 0 ? this : new BigDecimal(default, Math.Max(Scale, den.Scale));
}
int sd = Scale - den.Scale;
BigInteger a = Integer, b = den.Integer;
if (sd > 0)
b *= Pow10[sd];
else if (sd < 0)
a *= Pow10[-sd];
return new BigDecimal(a % b, Math.Max(Scale, den.Scale));
}
public static BigDecimal operator -(BigDecimal value) => new BigDecimal(-value.Integer, value.Scale);
static readonly BigInteger MaxInteger = (new BigInteger(ulong.MaxValue) << 32) | uint.MaxValue;
static readonly BigInteger MaxInteger32 = uint.MaxValue;
static readonly double Log2To10 = Math.Log(2) / Math.Log(10);
/// <summary>
/// Returns Log10 for the given number, offset by 96bits.
/// </summary>
static int ScaleOverMaxInteger(BigInteger abs) => abs.IsZero ? -28 : (int)(((int)BigInteger.Log(abs, 2) - 95) * Log2To10);
/// <summary>
/// See if we need to scale the result to fit it in 96 bits.
/// Perform needed scaling. Adjust scale factor accordingly.
/// </summary>
static bool ScaleResult(ref BigInteger res, ref int scale, bool sticky = false)
{
int newScale = 0;
var abs = BigInteger.Abs(res);
if (abs > MaxInteger)
{
// Find the min scale factor to make the result to fit it in 96 bits, 0 - 29.
// This reduces the scale factor of the result. If it exceeds the current scale of the result, we'll overflow.
newScale = Math.Max(1, ScaleOverMaxInteger(abs));
if (newScale > scale)
return true;
}
// Make sure we scale by enough to bring the current scale factor into valid range.
newScale = Math.Max(newScale, scale - 28);
if (newScale != 0)
{
// Scale by the power of 10 given by newScale.
// This is not guaranteed to bring the number within 96 bits -- it could be 1 power of 10 short.
scale -= newScale;
var pow = Pow10[newScale];
while (true)
{
abs = BigInteger.DivRem(abs, pow, out var remainder);
// If we didn't scale enough, divide by 10 more.
if (abs > MaxInteger)
{
if (scale == 0)
return true;
pow = 10;
scale--;
sticky |= !remainder.IsZero;
continue;
}
// Round final result. See if remainder >= 1/2 of divisor.
// If remainder == 1/2 divisor, round up if odd or sticky bit set.
pow >>= 1;
if (remainder < pow || remainder == pow && !sticky && abs.IsEven)
break;
if (++abs <= MaxInteger)
break;
// The rounding caused us to carry beyond 96 bits. Scale by 10 more.
if (scale == 0)
return true;
pow = 10;
scale--;
sticky = false;
}
res = res.Sign < 0 ? -abs : abs;
}
return false;
}
public BigDecimal Floor() => FloorCeiling(Integer.Sign < 0);
public BigDecimal Ceiling() => FloorCeiling(Integer.Sign > 0);
BigDecimal FloorCeiling(bool up)
{
if (Scale == 0)
return this;
var res = BigInteger.DivRem(Integer, Pow10[Scale], out var remainder);
if (up && !remainder.IsZero)
res += Integer.Sign;
return new BigDecimal(res, 0);
}
public BigDecimal Truncate() => Scale == 0 ? this : new BigDecimal(Integer / Pow10[Scale], 0);
public int ToInt32(out bool expectedOverflow)
{
var i = Truncate().Integer;
return (expectedOverflow = i < int.MinValue || i > int.MaxValue) ? 0 : (int)i;
}
public long ToOACurrency(out bool expectedOverflow)
{
var i = Integer;
if (Scale < 4)
i *= Pow10[4 - Scale];
else if (Scale > 4)
i = RoundToEven(i, Scale - 4);
return (expectedOverflow = i < long.MinValue || i > long.MaxValue) ? 0 : (long)i;
}
static BigInteger RoundToEven(BigInteger value, int scale)
{
var pow = Pow10[scale];
var res = BigInteger.DivRem(value, pow, out var remainder);
pow >>= 1;
remainder = BigInteger.Abs(remainder);
if (remainder > pow || remainder == pow && !res.IsEven)
res += value.Sign;
return res;
}
public BigDecimal Round(int scale)
{
var diff = Scale - scale;
if (diff <= 0)
return this;
return new BigDecimal(RoundToEven(Integer, diff), (byte)scale);
}
public BigDecimal RoundAwayFromZero(int scale)
{
var diff = Scale - scale;
if (diff <= 0)
return this;
var pow = Pow10[diff];
var res = BigInteger.DivRem(Integer, pow, out var remainder);
if (BigInteger.Abs(remainder) >= (pow >> 1))
res += Integer.Sign;
return new BigDecimal(res, (byte)scale);
}
}
[Theory]
[InlineData(MidpointRounding.ToEven - 1)]
[InlineData(MidpointRounding.ToPositiveInfinity + 1)]
public void Round_InvalidMidpointRounding_ThrowsArgumentException(MidpointRounding mode)
{
AssertExtensions.Throws<ArgumentException>("mode", () => decimal.Round(1, 2, mode));
}
[Fact]
public static void TryFormat()
{
using (new ThreadCultureChange(CultureInfo.InvariantCulture))
{
foreach (object[] testdata in ToString_TestData())
{
decimal localI = (decimal)testdata[0];
string localFormat = (string)testdata[1];
IFormatProvider localProvider = (IFormatProvider)testdata[2];
string localExpected = (string)testdata[3];
try
{
char[] actual;
int charsWritten;
// Just right
actual = new char[localExpected.Length];
Assert.True(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat, localProvider));
Assert.Equal(localExpected.Length, charsWritten);
Assert.Equal(localExpected, new string(actual));
// Longer than needed
actual = new char[localExpected.Length + 1];
Assert.True(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat, localProvider));
Assert.Equal(localExpected.Length, charsWritten);
Assert.Equal(localExpected, new string(actual, 0, charsWritten));
// Too short
if (localExpected.Length > 0)
{
actual = new char[localExpected.Length - 1];
Assert.False(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat, localProvider));
Assert.Equal(0, charsWritten);
}
if (localFormat != null)
{
// Upper localFormat
actual = new char[localExpected.Length];
Assert.True(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat.ToUpperInvariant(), localProvider));
Assert.Equal(localExpected.Length, charsWritten);
Assert.Equal(localExpected.ToUpperInvariant(), new string(actual));
// Lower format
actual = new char[localExpected.Length];
Assert.True(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat.ToLowerInvariant(), localProvider));
Assert.Equal(localExpected.Length, charsWritten);
Assert.Equal(localExpected.ToLowerInvariant(), new string(actual));
}
}
catch (Exception exc)
{
throw new Exception($"Failed on `{localI}`, `{localFormat}`, `{localProvider}`, `{localExpected}`. {exc}");
}
}
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Numerics;
using Microsoft.DotNet.RemoteExecutor;
using Xunit;
namespace System.Tests
{
public class DecimalTests
{
[Fact]
public void MaxValue_Get_ReturnsExpected()
{
Assert.Equal(79228162514264337593543950335m, decimal.MaxValue);
}
[Fact]
public void MinusOne_Get_ReturnsExpected()
{
Assert.Equal(-1, decimal.MinusOne);
}
[Fact]
public void MinValue_GetReturnsExpected()
{
Assert.Equal(-79228162514264337593543950335m, decimal.MinValue);
}
[Fact]
public static void One_Get_ReturnsExpected()
{
Assert.Equal(1, decimal.One);
}
[Fact]
public static void Zero_Get_ReturnsExpected()
{
Assert.Equal(0, decimal.Zero);
}
[Theory]
[InlineData(0)]
[InlineData(ulong.MaxValue)]
public static void Ctor_ULong(ulong value)
{
Assert.Equal(value, new decimal(value));
}
[Theory]
[InlineData(0)]
[InlineData(uint.MaxValue)]
public static void Ctor_UInt(uint value)
{
Assert.Equal(value, new decimal(value));
}
public static IEnumerable<object[]> Ctor_Float_TestData()
{
yield return new object[] { 123456789.123456f, new int[] { 123456800, 0, 0, 0 } };
yield return new object[] { 2.0123456789123456f, new int[] { 2012346, 0, 0, 393216 } };
yield return new object[] { 2E-28f, new int[] { 2, 0, 0, 1835008 } };
yield return new object[] { 2E-29f, new int[] { 0, 0, 0, 0 } };
yield return new object[] { 2E28f, new int[] { 536870912, 2085225666, 1084202172, 0 } };
yield return new object[] { 1.5f, new int[] { 15, 0, 0, 65536 } };
yield return new object[] { 0f, new int[] { 0, 0, 0, 0 } };
yield return new object[] { float.Parse("-0.0", CultureInfo.InvariantCulture), new int[] { 0, 0, 0, 0 } };
yield return new object[] { 1000000.1f, new int[] { 1000000, 0, 0, 0 } };
yield return new object[] { 100000.1f, new int[] { 1000001, 0, 0, 65536 } };
yield return new object[] { 10000.1f, new int[] { 100001, 0, 0, 65536 } };
yield return new object[] { 1000.1f, new int[] { 10001, 0, 0, 65536 } };
yield return new object[] { 100.1f, new int[] { 1001, 0, 0, 65536 } };
yield return new object[] { 10.1f, new int[] { 101, 0, 0, 65536 } };
yield return new object[] { 1.1f, new int[] { 11, 0, 0, 65536 } };
yield return new object[] { 1f, new int[] { 1, 0, 0, 0 } };
yield return new object[] { 0.1f, new int[] { 1, 0, 0, 65536 } };
yield return new object[] { 0.01f, new int[] { 10, 0, 0, 196608 } };
yield return new object[] { 0.001f, new int[] { 1, 0, 0, 196608 } };
yield return new object[] { 0.0001f, new int[] { 10, 0, 0, 327680 } };
yield return new object[] { 0.00001f, new int[] { 10, 0, 0, 393216 } };
yield return new object[] { 0.0000000000000000000000000001f, new int[] { 1, 0, 0, 1835008 } };
yield return new object[] { 0.00000000000000000000000000001f, new int[] { 0, 0, 0, 0 } };
}
[Theory]
[MemberData(nameof(Ctor_Float_TestData))]
public void Ctor_Float(float value, int[] bits)
{
var d = new decimal(value);
Assert.Equal((decimal)value, d);
Assert.Equal(bits, Decimal.GetBits(d));
}
[Theory]
[InlineData(2E29)]
[InlineData(float.NaN)]
[InlineData(float.MaxValue)]
[InlineData(float.MinValue)]
[InlineData(float.PositiveInfinity)]
[InlineData(float.NegativeInfinity)]
public void Ctor_InvalidFloat_ThrowsOverlowException(float value)
{
Assert.Throws<OverflowException>(() => new decimal(value));
}
[Theory]
[InlineData(long.MinValue)]
[InlineData(0)]
[InlineData(long.MaxValue)]
public void Ctor_Long(long value)
{
Assert.Equal(value, new decimal(value));
}
public static IEnumerable<object[]> Ctor_IntArray_TestData()
{
decimal expected = 3;
expected += uint.MaxValue;
expected += ulong.MaxValue;
yield return new object[] { new int[] { 1, 1, 1, 0 }, expected };
yield return new object[] { new int[] { 1, 0, 0, 0 }, decimal.One };
yield return new object[] { new int[] { 1000, 0, 0, 0x30000 }, decimal.One };
yield return new object[] { new int[] { 1000, 0, 0, unchecked((int)0x80030000) }, -decimal.One };
yield return new object[] { new int[] { 0, 0, 0, 0x1C0000 }, decimal.Zero };
yield return new object[] { new int[] { 1000, 0, 0, 0x1C0000 }, 0.0000000000000000000000001 };
yield return new object[] { new int[] { 0, 0, 0, 0 }, decimal.Zero };
yield return new object[] { new int[] { 0, 0, 0, unchecked((int)0x80000000) }, decimal.Zero };
}
[Theory]
[MemberData(nameof(Ctor_IntArray_TestData))]
public void Ctor_IntArray(int[] value, decimal expected)
{
Assert.Equal(expected, new decimal(value));
}
[Theory]
[MemberData(nameof(Ctor_IntArray_TestData))]
public void Ctor_IntSpan(int[] value, decimal expected)
{
Assert.Equal(expected, new decimal(value.AsSpan()));
}
[Fact]
public void Ctor_NullBits_ThrowsArgumentNullException()
{
AssertExtensions.Throws<ArgumentNullException>("bits", () => new decimal(null));
}
[Theory]
[InlineData(new int[] { 0, 0, 0 })]
[InlineData(new int[] { 0, 0, 0, 0, 0 })]
[InlineData(new int[] { 0, 0, 0, 1 })]
[InlineData(new int[] { 0, 0, 0, 0x1D0000 })]
[InlineData(new int[] { 0, 0, 0, unchecked((int)0x40000000) })]
public void Ctor_InvalidBits_ThrowsArgumentException(int[] bits)
{
AssertExtensions.Throws<ArgumentException>(null, () => new decimal(bits));
AssertExtensions.Throws<ArgumentException>(null, () => new decimal(bits.AsSpan()));
}
[Theory]
[InlineData(int.MinValue)]
[InlineData(0)]
[InlineData(int.MaxValue)]
public void Ctor_Int(int value)
{
Assert.Equal(value, new decimal(value));
}
public static IEnumerable<object[]> Ctor_Double_TestData()
{
yield return new object[] { 123456789.123456, new int[] { -2045800064, 28744, 0, 393216 } };
yield return new object[] { 2.0123456789123456, new int[] { -1829795549, 46853, 0, 917504 } };
yield return new object[] { 2E-28, new int[] { 2, 0, 0, 1835008 } };
yield return new object[] { 2E-29, new int[] { 0, 0, 0, 0 } };
yield return new object[] { 2E28, new int[] { 536870912, 2085225666, 1084202172, 0 } };
yield return new object[] { 1.5, new int[] { 15, 0, 0, 65536 } };
yield return new object[] { 0, new int[] { 0, 0, 0, 0 } };
yield return new object[] { double.Parse("-0.0", CultureInfo.InvariantCulture), new int[] { 0, 0, 0, 0 } };
yield return new object[] { 100000000000000.1, new int[] { 276447232, 23283, 0, 0 } };
yield return new object[] { 10000000000000.1, new int[] { 276447233, 23283, 0, 65536 } };
yield return new object[] { 1000000000000.1, new int[] { 1316134913, 2328, 0, 65536 } };
yield return new object[] { 100000000000.1, new int[] { -727379967, 232, 0, 65536 } };
yield return new object[] { 10000000000.1, new int[] { 1215752193, 23, 0, 65536 } };
yield return new object[] { 1000000000.1, new int[] { 1410065409, 2, 0, 65536 } };
yield return new object[] { 100000000.1, new int[] { 1000000001, 0, 0, 65536 } };
yield return new object[] { 10000000.1, new int[] { 100000001, 0, 0, 65536 } };
yield return new object[] { 1000000.1, new int[] { 10000001, 0, 0, 65536 } };
yield return new object[] { 100000.1, new int[] { 1000001, 0, 0, 65536 } };
yield return new object[] { 10000.1, new int[] { 100001, 0, 0, 65536 } };
yield return new object[] { 1000.1, new int[] { 10001, 0, 0, 65536 } };
yield return new object[] { 100.1, new int[] { 1001, 0, 0, 65536 } };
yield return new object[] { 10.1, new int[] { 101, 0, 0, 65536 } };
yield return new object[] { 1.1, new int[] { 11, 0, 0, 65536 } };
yield return new object[] { 1, new int[] { 1, 0, 0, 0 } };
yield return new object[] { 0.1, new int[] { 1, 0, 0, 65536 } };
yield return new object[] { 0.01, new int[] { 1, 0, 0, 131072 } };
yield return new object[] { 0.001, new int[] { 1, 0, 0, 196608 } };
yield return new object[] { 0.0001, new int[] { 1, 0, 0, 262144 } };
yield return new object[] { 0.00001, new int[] { 1, 0, 0, 327680 } };
yield return new object[] { 0.0000000000000000000000000001, new int[] { 1, 0, 0, 1835008 } };
yield return new object[] { 0.00000000000000000000000000001, new int[] { 0, 0, 0, 0 } };
}
[Theory]
[MemberData(nameof(Ctor_Double_TestData))]
public void Ctor_Double(double value, int[] bits)
{
var d = new decimal(value);
Assert.Equal((decimal)value, d);
Assert.Equal(bits, Decimal.GetBits(d));
}
[Theory]
[InlineData(double.NaN)]
[InlineData(double.MaxValue)]
[InlineData(double.MinValue)]
[InlineData(double.PositiveInfinity)]
[InlineData(double.NegativeInfinity)]
public void Ctor_LargeDouble_ThrowsOverlowException(double value)
{
Assert.Throws<OverflowException>(() => new decimal(value));
}
public static IEnumerable<object[]> Ctor_Int_Int_Int_Bool_Byte_TestData()
{
decimal expected = 3;
expected += uint.MaxValue;
expected += ulong.MaxValue;
yield return new object[] { 1, 1, 1, false, 0, expected };
yield return new object[] { 1, 0, 0, false, 0, decimal.One };
yield return new object[] { 1000, 0, 0, false, 3, decimal.One };
yield return new object[] { 1000, 0, 0, true, 3, -decimal.One };
yield return new object[] { 0, 0, 0, false, 28, decimal.Zero };
yield return new object[] { 1000, 0, 0, false, 28, 0.0000000000000000000000001 };
yield return new object[] { 0, 0, 0, false, 0, decimal.Zero };
yield return new object[] { 0, 0, 0, true, 0, decimal.Zero };
}
[Theory]
[MemberData(nameof(Ctor_Int_Int_Int_Bool_Byte_TestData))]
public void Ctor_Int_Int_Int_Bool_Byte(int lo, int mid, int hi, bool isNegative, byte scale, decimal expected)
{
Assert.Equal(expected, new decimal(lo, mid, hi, isNegative, scale));
}
[Fact]
public void Ctor_LargeScale_ThrowsArgumentOutOfRangeException()
{
AssertExtensions.Throws<ArgumentOutOfRangeException>("scale", () => new Decimal(1, 2, 3, false, 29));
}
public static IEnumerable<object[]> Scale_TestData()
{
yield return new object[] { 10m, 0 };
yield return new object[] { 1m, 0 };
yield return new object[] { -1m, 0 };
yield return new object[] { 1.0m, 1 };
yield return new object[] { -1.0m, 1 };
yield return new object[] { 1.1m, 1 };
yield return new object[] { 1.00m, 2 };
yield return new object[] { 1.01m, 2 };
yield return new object[] { 1.0000000000000000000000000000m, 28};
}
[Theory]
[MemberData(nameof(Scale_TestData))]
public static void Scale(decimal value, byte expectedScale)
{
Assert.Equal(expectedScale, value.Scale);
}
[Theory]
[InlineData(new int[] { 1, 0, 0, 0 }, 0)] // 1
[InlineData(new int[] { 10, 0, 0, 65536 }, 1)] // 1.0
[InlineData(new int[] { 100, 0, 0, 131072 }, 2)] // 1.00
[InlineData(new int[] { 268435456, 1042612833, 542101086, 1835008 }, 28)] // 1.0000000000000000000000000000
[InlineData(new int[] { 10, 0, 0, -2147418112 }, 1)] // -1.0
public static void ScaleFromBits(int[] bits, byte expectedScale)
{
Assert.Equal(expectedScale, new decimal(bits).Scale);
}
public static IEnumerable<object[]> Add_Valid_TestData()
{
yield return new object[] { 1m, 1m, 2m };
yield return new object[] { -1m, 1m, 0m };
yield return new object[] { 1m, -1m, 0m };
yield return new object[] { 1m, 0, 1m };
yield return new object[] { 79228162514264337593543950330m, 5m, decimal.MaxValue };
yield return new object[] { 79228162514264337593543950335m, -5m, 79228162514264337593543950330m };
yield return new object[] { -79228162514264337593543950330m, 5m, -79228162514264337593543950325m };
yield return new object[] { -79228162514264337593543950330m, -5m, decimal.MinValue };
yield return new object[] { 1234.5678m, 0.00009m, 1234.56789m };
yield return new object[] { -1234.5678m, 0.00009m, -1234.56771m };
yield return new object[] { 0.1111111111111111111111111111m, 0.1111111111111111111111111111m, 0.2222222222222222222222222222m };
yield return new object[] { 0.5555555555555555555555555555m, 0.5555555555555555555555555555m, 1.1111111111111111111111111110m };
yield return new object[] { decimal.MinValue, decimal.Zero, decimal.MinValue };
yield return new object[] { decimal.MaxValue, decimal.Zero, decimal.MaxValue };
yield return new object[] { decimal.MinValue, decimal.Zero, decimal.MinValue };
}
[Theory]
[MemberData(nameof(Add_Valid_TestData))]
public static void Add(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 + d2);
Assert.Equal(expected, decimal.Add(d1, d2));
decimal d3 = d1;
d3 += d2;
Assert.Equal(expected, d3);
}
public static IEnumerable<object[]> Add_Overflows_TestData()
{
yield return new object[] { decimal.MaxValue, decimal.MaxValue };
yield return new object[] { 79228162514264337593543950330m, 6 };
yield return new object[] { -79228162514264337593543950330m, -6 };
}
[Theory]
[MemberData(nameof(Add_Overflows_TestData))]
public void Add_Overflows_ThrowsOverflowException(decimal d1, decimal d2)
{
Assert.Throws<OverflowException>(() => d1 + d2);
Assert.Throws<OverflowException>(() => decimal.Add(d1, d2));
decimal d3 = d1;
Assert.Throws<OverflowException>(() => d3 += d2);
}
public static IEnumerable<object[]> Ceiling_TestData()
{
yield return new object[] { 123m, 123m };
yield return new object[] { 123.123m, 124m };
yield return new object[] { 123.456m, 124m };
yield return new object[] { -123.123m, -123m };
yield return new object[] { -123.456m, -123m };
}
[Theory]
[MemberData(nameof(Ceiling_TestData))]
public static void Ceiling(decimal d, decimal expected)
{
Assert.Equal(expected, decimal.Ceiling(d));
}
public static IEnumerable<object[]> Compare_TestData()
{
yield return new object[] { 5m, 15m, -1 };
yield return new object[] { 15m, 15m, 0 };
yield return new object[] { 15m, 5m, 1 };
yield return new object[] { 15m, null, 1 };
yield return new object[] { decimal.Zero, decimal.Zero, 0 };
yield return new object[] { decimal.Zero, decimal.One, -1 };
yield return new object[] { decimal.One, decimal.Zero, 1 };
yield return new object[] { decimal.MaxValue, decimal.MaxValue, 0 };
yield return new object[] { decimal.MinValue, decimal.MinValue, 0 };
yield return new object[] { decimal.MaxValue, decimal.MinValue, 1 };
yield return new object[] { decimal.MinValue, decimal.MaxValue, -1 };
}
[Theory]
[MemberData(nameof(Compare_TestData))]
public void CompareTo_Other_ReturnsExpected(decimal d1, object obj, int expected)
{
if (obj is decimal d2)
{
Assert.Equal(expected, Math.Sign(d1.CompareTo(d2)));
if (expected >= 0)
{
Assert.True(d1 >= d2);
Assert.False(d1 < d2);
}
if (expected > 0)
{
Assert.True(d1 > d2);
Assert.False(d1 <= d2);
}
if (expected <= 0)
{
Assert.True(d1 <= d2);
Assert.False(d1 > d2);
}
if (expected < 0)
{
Assert.True(d1 < d2);
Assert.False(d1 >= d2);
}
Assert.Equal(expected, Math.Sign(decimal.Compare(d1, d2)));
}
Assert.Equal(expected, Math.Sign(d1.CompareTo(obj)));
}
[Theory]
[InlineData("a")]
[InlineData(234)]
public void CompareTo_ObjectNotDouble_ThrowsArgumentException(object value)
{
AssertExtensions.Throws<ArgumentException>(null, () => ((decimal)123).CompareTo(value));
}
public static IEnumerable<object[]> Divide_Valid_TestData()
{
yield return new object[] { decimal.One, decimal.One, decimal.One };
yield return new object[] { decimal.MinusOne, decimal.MinusOne, decimal.One };
yield return new object[] { 15m, 2m, 7.5m };
yield return new object[] { 10m, 2m, 5m };
yield return new object[] { -10m, -2m, 5m };
yield return new object[] { 10m, -2m, -5m };
yield return new object[] { -10m, 2m, -5m };
yield return new object[] { 0.9214206543486529434634231456m, decimal.MaxValue, decimal.Zero };
yield return new object[] { 38214206543486529434634231456m, 0.49214206543486529434634231456m, 77648730371625094566866001277m };
yield return new object[] { -78228162514264337593543950335m, decimal.MaxValue, -0.987378225516463811113412343m };
yield return new object[] { decimal.MaxValue, decimal.MinusOne, decimal.MinValue };
yield return new object[] { decimal.MinValue, decimal.MaxValue, decimal.MinusOne };
yield return new object[] { decimal.MaxValue, decimal.MaxValue, decimal.One };
yield return new object[] { decimal.MinValue, decimal.MinValue, decimal.One };
// Tests near MaxValue
yield return new object[] { 792281625142643375935439503.4m, 0.1m, 7922816251426433759354395034m };
yield return new object[] { 79228162514264337593543950.34m, 0.1m, 792281625142643375935439503.4m };
yield return new object[] { 7922816251426433759354395.034m, 0.1m, 79228162514264337593543950.34m };
yield return new object[] { 792281625142643375935439.5034m, 0.1m, 7922816251426433759354395.034m };
yield return new object[] { 79228162514264337593543950335m, 10m, 7922816251426433759354395033.5m };
yield return new object[] { 79228162514264337567774146561m, 10m, 7922816251426433756777414656.1m };
yield return new object[] { 79228162514264337567774146560m, 10m, 7922816251426433756777414656m };
yield return new object[] { 79228162514264337567774146559m, 10m, 7922816251426433756777414655.9m };
yield return new object[] { 79228162514264337593543950335m, 1.1m, 72025602285694852357767227577m };
yield return new object[] { 79228162514264337593543950335m, 1.01m, 78443725261647859003508861718m };
yield return new object[] { 79228162514264337593543950335m, 1.001m, 79149013500763574019524425909.091m };
yield return new object[] { 79228162514264337593543950335m, 1.0001m, 79220240490215316061937756559.344m };
yield return new object[] { 79228162514264337593543950335m, 1.00001m, 79227370240561931974224208092.919m };
yield return new object[] { 79228162514264337593543950335m, 1.000001m, 79228083286181051412492537842.462m };
yield return new object[] { 79228162514264337593543950335m, 1.0000001m, 79228154591448878448656105469.389m };
yield return new object[] { 79228162514264337593543950335m, 1.00000001m, 79228161721982720373716746597.833m };
yield return new object[] { 79228162514264337593543950335m, 1.000000001m, 79228162435036175158507775176.492m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000001m, 79228162506341521342909798200.709m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000001m, 79228162513472055968409229775.316m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000001m, 79228162514185109431029765225.569m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000001m, 79228162514256414777292524693.522m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000001m, 79228162514263545311918807699.547m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000001m, 79228162514264258365381436070.742m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000001m, 79228162514264329670727698908.567m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000001m, 79228162514264336801262325192.357m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000001m, 79228162514264337514315787820.736m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000001m, 79228162514264337585621134083.574m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000001m, 79228162514264337592751668709.857m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000001m, 79228162514264337593464722172.486m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000001m, 79228162514264337593536027518.749m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000000001m, 79228162514264337593543158053.375m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000000001m, 79228162514264337593543871106.837m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000000001m, 79228162514264337593543942412.184m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000000000001m, 79228162514264337593543949542.718m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000000000001m, 79228162514264337593543950255.772m };
yield return new object[] { 7922816251426433759354395033.5m, 0.9999999999999999999999999999m, 7922816251426433759354395034m };
yield return new object[] { 79228162514264337593543950335m, 10000000m, 7922816251426433759354.3950335m };
yield return new object[] { 7922816251426433759354395033.5m, 1.000001m, 7922808328618105141249253784.2m };
yield return new object[] { 7922816251426433759354395033.5m, 1.0000000000000000000000000001m, 7922816251426433759354395032.7m };
yield return new object[] { 7922816251426433759354395033.5m, 1.0000000000000000000000000002m, 7922816251426433759354395031.9m };
yield return new object[] { 7922816251426433759354395033.5m, 0.9999999999999999999999999999m, 7922816251426433759354395034m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000000000001m, 79228162514264337593543950327m };
decimal boundary7 = new decimal((int)429u, (int)2133437386u, 0, false, 0);
decimal boundary71 = new decimal((int)429u, (int)2133437387u, 0, false, 0);
decimal maxValueBy7 = decimal.MaxValue * 0.0000001m;
yield return new object[] { maxValueBy7, 1m, maxValueBy7 };
yield return new object[] { maxValueBy7, 1m, maxValueBy7 };
yield return new object[] { maxValueBy7, 0.0000001m, decimal.MaxValue };
yield return new object[] { boundary7, 1m, boundary7 };
yield return new object[] { boundary7, 0.000000100000000000000000001m, 91630438009337286849083695.62m };
yield return new object[] { boundary71, 0.000000100000000000000000001m, 91630438052286959809083695.62m };
yield return new object[] { 7922816251426433759354.3950335m, 1m, 7922816251426433759354.3950335m };
yield return new object[] { 7922816251426433759354.3950335m, 0.0000001m, 79228162514264337593543950335m };
}
[Theory]
[MemberData(nameof(Divide_Valid_TestData))]
public static void Divide(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 / d2);
Assert.Equal(expected, decimal.Divide(d1, d2));
}
public static IEnumerable<object[]> Divide_ZeroDenominator_TestData()
{
yield return new object[] { decimal.One, decimal.Zero };
yield return new object[] { decimal.Zero, decimal.Zero };
yield return new object[] { 0.0m, 0.0m };
}
[Theory]
[MemberData(nameof(Divide_ZeroDenominator_TestData))]
public void Divide_ZeroDenominator_ThrowsDivideByZeroException(decimal d1, decimal d2)
{
Assert.Throws<DivideByZeroException>(() => d1 / d2);
Assert.Throws<DivideByZeroException>(() => decimal.Divide(d1, d2));
}
public static IEnumerable<object[]> Divide_Overflows_TestData()
{
yield return new object[] { 79228162514264337593543950335m, -0.9999999999999999999999999m };
yield return new object[] { 792281625142643.37593543950335m, -0.0000000000000079228162514264337593543950335m };
yield return new object[] { 79228162514264337593543950335m, 0.1m };
yield return new object[] { 7922816251426433759354395034m, 0.1m };
yield return new object[] { 79228162514264337593543950335m, 0.9m };
yield return new object[] { 79228162514264337593543950335m, 0.99m };
yield return new object[] { 79228162514264337593543950335m, 0.9999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.99999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.999999999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999999999999999m };
yield return new object[] { 79228162514264337593543950335m, -0.1m };
yield return new object[] { 79228162514264337593543950335m, -0.9999999999999999999999999m };
yield return new object[] { decimal.MaxValue / 2m, 0.5m };
}
[Theory]
[MemberData(nameof(Divide_Overflows_TestData))]
public void Divide_Overflows_ThrowsOverflowException(decimal d1, decimal d2)
{
Assert.Throws<OverflowException>(() => d1 / d2);
Assert.Throws<OverflowException>(() => decimal.Divide(d1, d2));
}
public static IEnumerable<object[]> Equals_TestData()
{
yield return new object[] { decimal.Zero, decimal.Zero, true };
yield return new object[] { decimal.Zero, decimal.One, false };
yield return new object[] { decimal.MaxValue, decimal.MaxValue, true };
yield return new object[] { decimal.MinValue, decimal.MinValue, true };
yield return new object[] { decimal.MaxValue, decimal.MinValue, false };
yield return new object[] { decimal.One, null, false };
yield return new object[] { decimal.One, 1, false };
yield return new object[] { decimal.One, "one", false };
}
[Theory]
[MemberData(nameof(Equals_TestData))]
public static void EqualsTest(object obj1, object obj2, bool expected)
{
if (obj1 is decimal d1)
{
if (obj2 is decimal d2)
{
Assert.Equal(expected, d1.Equals(d2));
Assert.Equal(expected, decimal.Equals(d1, d2));
Assert.Equal(expected, d1 == d2);
Assert.Equal(!expected, d1 != d2);
Assert.Equal(expected, d1.GetHashCode().Equals(d2.GetHashCode()));
Assert.True(d1.Equals(d1));
Assert.True(d1 == d1);
Assert.False(d1 != d1);
Assert.Equal(d1.GetHashCode(), d1.GetHashCode());
}
Assert.Equal(expected, d1.Equals(obj2));
}
Assert.Equal(expected, Equals(obj1, obj2));
}
public static IEnumerable<object[]> FromOACurrency_TestData()
{
yield return new object[] { 0L, 0m };
yield return new object[] { 1L, 0.0001m };
yield return new object[] { 100000L, 10m };
yield return new object[] { 10000000000L, 1000000m };
yield return new object[] { 1000000000000000000L, 100000000000000m };
yield return new object[] { 9223372036854775807L, 922337203685477.5807m };
yield return new object[] { -9223372036854775808L, -922337203685477.5808m };
yield return new object[] { 123456789L, 12345.6789m };
yield return new object[] { 1234567890000L, 123456789m };
yield return new object[] { 1234567890987654321L, 123456789098765.4321m };
yield return new object[] { 4294967295L, 429496.7295m };
}
[Theory]
[MemberData(nameof(FromOACurrency_TestData))]
public static void FromOACurrency(long oac, decimal expected)
{
Assert.Equal(expected, decimal.FromOACurrency(oac));
}
public static IEnumerable<object[]> Floor_TestData()
{
yield return new object[] { 123m, 123m };
yield return new object[] { 123.123m, 123m };
yield return new object[] { 123.456m, 123m };
yield return new object[] { -123.123m, -124m };
yield return new object[] { -123.456m, -124m };
}
[Theory]
[MemberData(nameof(Floor_TestData))]
public static void Floor(decimal d, decimal expected)
{
Assert.Equal(expected, decimal.Floor(d));
}
public static IEnumerable<object[]> GetBits_TestData()
{
yield return new object[] { 1M, new int[] { 0x00000001, 0x00000000, 0x00000000, 0x00000000 } };
yield return new object[] { 100000000000000M, new int[] { 0x107A4000, 0x00005AF3, 0x00000000, 0x00000000 } };
yield return new object[] { 100000000000000.00000000000000M, new int[] { 0x10000000, 0x3E250261, 0x204FCE5E, 0x000E0000 } };
yield return new object[] { 1.0000000000000000000000000000M, new int[] { 0x10000000, 0x3E250261, 0x204FCE5E, 0x001C0000 } };
yield return new object[] { 123456789M, new int[] { 0x075BCD15, 0x00000000, 0x00000000, 0x00000000 } };
yield return new object[] { 0.123456789M, new int[] { 0x075BCD15, 0x00000000, 0x00000000, 0x00090000 } };
yield return new object[] { 0.000000000123456789M, new int[] { 0x075BCD15, 0x00000000, 0x00000000, 0x00120000 } };
yield return new object[] { 0.000000000000000000123456789M, new int[] { 0x075BCD15, 0x00000000, 0x00000000, 0x001B0000 } };
yield return new object[] { 4294967295M, new int[] { unchecked((int)0xFFFFFFFF), 0x00000000, 0x00000000, 0x00000000 } };
yield return new object[] { 18446744073709551615M, new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), 0x00000000, 0x00000000 } };
yield return new object[] { decimal.MaxValue, new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), 0x00000000 } };
yield return new object[] { decimal.MinValue, new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0x80000000) } };
yield return new object[] { -7.9228162514264337593543950335M, new int[] { unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0xFFFFFFFF), unchecked((int)0x801C0000) } };
}
[Theory]
[MemberData(nameof(GetBits_TestData))]
public static void GetBits(decimal input, int[] expected)
{
int[] bits = decimal.GetBits(input);
Assert.Equal(expected, bits);
bool sign = (bits[3] & 0x80000000) != 0;
byte scale = (byte)((bits[3] >> 16) & 0x7F);
decimal newValue = new decimal(bits[0], bits[1], bits[2], sign, scale);
Assert.Equal(input, newValue);
}
[Theory]
[MemberData(nameof(GetBits_TestData))]
public static void GetBitsSpan(decimal input, int[] expected)
{
Span<int> bits = new int[4];
int bitsWritten = decimal.GetBits(input, bits);
Assert.Equal(4, bitsWritten);
Assert.Equal(expected, bits.ToArray());
bool sign = (bits[3] & 0x80000000) != 0;
byte scale = (byte)((bits[3] >> 16) & 0x7F);
decimal newValue = new decimal(bits[0], bits[1], bits[2], sign, scale);
Assert.Equal(input, newValue);
}
[Fact]
public static void GetBitsSpan_TooShort_ThrowsArgumentException()
{
AssertExtensions.Throws<ArgumentException>("destination", () => decimal.GetBits(123, new int[3]));
}
[Theory]
[MemberData(nameof(GetBits_TestData))]
public static void TryGetBits(decimal input, int[] expected)
{
Span<int> bits;
int valuesWritten;
bits = new int[3] { 42, 43, 44 };
Assert.False(decimal.TryGetBits(input, bits, out valuesWritten));
Assert.Equal(0, valuesWritten);
Assert.Equal(new int[3] { 42, 43, 44 }, bits.ToArray());
bits = new int[4];
Assert.True(decimal.TryGetBits(input, bits, out valuesWritten));
Assert.Equal(4, valuesWritten);
Assert.Equal(expected, bits.ToArray());
bits = new int[5];
bits[4] = 42;
Assert.True(decimal.TryGetBits(input, bits, out valuesWritten));
Assert.Equal(4, valuesWritten);
Assert.Equal(expected, bits.Slice(0, 4).ToArray());
Assert.Equal(42, bits[4]);
}
[Fact]
public void GetTypeCode_Invoke_ReturnsDecimal()
{
Assert.Equal(TypeCode.Decimal, decimal.MaxValue.GetTypeCode());
}
public static IEnumerable<object[]> Multiply_Valid_TestData()
{
yield return new object[] { decimal.One, decimal.One, decimal.One };
yield return new object[] { 7922816251426433759354395033.5m, new decimal(10), decimal.MaxValue };
yield return new object[] { 0.2352523523423422342354395033m, 56033525474612414574574757495m, 13182018677937129120135020796m };
yield return new object[] { 46161363632634613634.093453337m, 461613636.32634613634083453337m, 21308714924243214928823669051m };
yield return new object[] { 0.0000000000000345435353453563m, .0000000000000023525235234234m, 0.0000000000000000000000000001m };
// Near decimal.MaxValue
yield return new object[] { 79228162514264337593543950335m, 0.9m, 71305346262837903834189555302m };
yield return new object[] { 79228162514264337593543950335m, 0.99m, 78435880889121694217608510832m };
yield return new object[] { 79228162514264337593543950335m, 0.9999999999999999999999999999m, 79228162514264337593543950327m };
yield return new object[] { -79228162514264337593543950335m, 0.9m, -71305346262837903834189555302m };
yield return new object[] { -79228162514264337593543950335m, 0.99m, -78435880889121694217608510832m };
yield return new object[] { -79228162514264337593543950335m, 0.9999999999999999999999999999m, -79228162514264337593543950327m };
}
[Theory]
[MemberData(nameof(Multiply_Valid_TestData))]
public static void Multiply(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 * d2);
Assert.Equal(expected, decimal.Multiply(d1, d2));
}
public static IEnumerable<object[]> Multiply_Invalid_TestData()
{
yield return new object[] { decimal.MaxValue, decimal.MinValue };
yield return new object[] { decimal.MinValue, 1.1m };
yield return new object[] { 79228162514264337593543950335m, 1.1m };
yield return new object[] { 79228162514264337593543950335m, 1.01m };
yield return new object[] { 79228162514264337593543950335m, 1.001m };
yield return new object[] { 79228162514264337593543950335m, 1.0001m };
yield return new object[] { 79228162514264337593543950335m, 1.00001m };
yield return new object[] { 79228162514264337593543950335m, 1.000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.0000000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.00000000000000000000000001m };
yield return new object[] { 79228162514264337593543950335m, 1.000000000000000000000000001m };
yield return new object[] { decimal.MaxValue / 2, 2m };
}
[Theory]
[MemberData(nameof(Multiply_Invalid_TestData))]
public static void Multiply_Invalid(decimal d1, decimal d2)
{
Assert.Throws<OverflowException>(() => d1 * d2);
Assert.Throws<OverflowException>(() => decimal.Multiply(d1, d2));
}
public static IEnumerable<object[]> Negate_TestData()
{
yield return new object[] { 1m, -1m };
yield return new object[] { 0m, 0m };
yield return new object[] { -1m, 1m };
yield return new object[] { decimal.MaxValue, decimal.MinValue };
yield return new object[] { decimal.MinValue, decimal.MaxValue };
}
[Theory]
[MemberData(nameof(Negate_TestData))]
public static void Negate(decimal d, decimal expected)
{
Assert.Equal(expected, decimal.Negate(d));
}
public static IEnumerable<object[]> Parse_Valid_TestData()
{
NumberStyles defaultStyle = NumberStyles.Number;
NumberFormatInfo invariantFormat = NumberFormatInfo.InvariantInfo;
NumberFormatInfo emptyFormat = NumberFormatInfo.CurrentInfo;
var customFormat1 = new NumberFormatInfo();
customFormat1.CurrencySymbol = "$";
customFormat1.CurrencyGroupSeparator = ",";
var customFormat2 = new NumberFormatInfo();
customFormat2.NumberDecimalSeparator = ".";
var customFormat3 = new NumberFormatInfo();
customFormat3.NumberGroupSeparator = ",";
var customFormat4 = new NumberFormatInfo();
customFormat4.NumberDecimalSeparator = ".";
yield return new object[] { "-123", defaultStyle, null, -123m };
yield return new object[] { "0", defaultStyle, null, 0m };
yield return new object[] { "123", defaultStyle, null, 123m };
yield return new object[] { " 123 ", defaultStyle, null, 123m };
yield return new object[] { (567.89m).ToString(), defaultStyle, null, 567.89m };
yield return new object[] { (-567.89m).ToString(), defaultStyle, null, -567.89m };
yield return new object[] { "0.6666666666666666666666666666500000000000000000000000000000000000000000000000000000000000000", defaultStyle, invariantFormat, 0.6666666666666666666666666666m };
yield return new object[] { emptyFormat.NumberDecimalSeparator + "234", defaultStyle, null, 0.234m };
yield return new object[] { "234" + emptyFormat.NumberDecimalSeparator, defaultStyle, null, 234.0m };
yield return new object[] { "7" + new string('0', 28) + emptyFormat.NumberDecimalSeparator, defaultStyle, null, 7E28m };
yield return new object[] { "07" + new string('0', 28) + emptyFormat.NumberDecimalSeparator, defaultStyle, null, 7E28m };
yield return new object[] { "79228162514264337593543950335", defaultStyle, null, 79228162514264337593543950335m };
yield return new object[] { "-79228162514264337593543950335", defaultStyle, null, -79228162514264337593543950335m };
yield return new object[] { "79,228,162,514,264,337,593,543,950,335", NumberStyles.AllowThousands, customFormat3, 79228162514264337593543950335m };
yield return new object[] { (123.1m).ToString(), NumberStyles.AllowDecimalPoint, null, 123.1m };
yield return new object[] { 1000.ToString("N0"), NumberStyles.AllowThousands, null, 1000m };
yield return new object[] { "123", NumberStyles.Any, emptyFormat, 123m };
yield return new object[] { (123.567m).ToString(), NumberStyles.Any, emptyFormat, 123.567m };
yield return new object[] { "123", NumberStyles.Float, emptyFormat, 123m };
yield return new object[] { "$1000", NumberStyles.Currency, customFormat1, 1000m };
yield return new object[] { "123.123", NumberStyles.Float, customFormat2, 123.123m };
yield return new object[] { "(123)", NumberStyles.AllowParentheses, customFormat2, -123m };
// Number buffer limit ran out (string too long)
yield return new object[] { "1234567890123456789012345.678456", defaultStyle, customFormat4, 1234567890123456789012345.6785m };
}
[Theory]
[MemberData(nameof(Parse_Valid_TestData))]
public static void Parse(string value, NumberStyles style, IFormatProvider provider, decimal expected)
{
bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo;
decimal result;
if ((style & ~NumberStyles.Number) == 0 && style != NumberStyles.None)
{
// Use Parse(string) or Parse(string, IFormatProvider)
if (isDefaultProvider)
{
Assert.True(decimal.TryParse(value, out result));
Assert.Equal(expected, result);
Assert.Equal(expected, decimal.Parse(value));
}
Assert.Equal(expected, decimal.Parse(value, provider));
}
// Use Parse(string, NumberStyles, IFormatProvider)
Assert.True(decimal.TryParse(value, style, provider, out result));
Assert.Equal(expected, result);
Assert.Equal(expected, decimal.Parse(value, style, provider));
if (isDefaultProvider)
{
// Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider)
Assert.True(decimal.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result));
Assert.Equal(expected, result);
Assert.Equal(expected, decimal.Parse(value, style));
Assert.Equal(expected, decimal.Parse(value, style, NumberFormatInfo.CurrentInfo));
}
}
public static IEnumerable<object[]> Parse_Invalid_TestData()
{
NumberStyles defaultStyle = NumberStyles.Number;
var customFormat = new NumberFormatInfo();
customFormat.CurrencySymbol = "$";
customFormat.NumberDecimalSeparator = ".";
yield return new object[] { null, defaultStyle, null, typeof(ArgumentNullException) };
yield return new object[] { "79228162514264337593543950336", defaultStyle, null, typeof(OverflowException) };
yield return new object[] { "", defaultStyle, null, typeof(FormatException) };
yield return new object[] { " ", defaultStyle, null, typeof(FormatException) };
yield return new object[] { "Garbage", defaultStyle, null, typeof(FormatException) };
yield return new object[] { "ab", defaultStyle, null, typeof(FormatException) }; // Hex value
yield return new object[] { "(123)", defaultStyle, null, typeof(FormatException) }; // Parentheses
yield return new object[] { 100.ToString("C0"), defaultStyle, null, typeof(FormatException) }; // Currency
yield return new object[] { (123.456m).ToString(), NumberStyles.Integer, null, typeof(FormatException) }; // Decimal
yield return new object[] { " " + (123.456m).ToString(), NumberStyles.None, null, typeof(FormatException) }; // Leading space
yield return new object[] { (123.456m).ToString() + " ", NumberStyles.None, null, typeof(FormatException) }; // Leading space
yield return new object[] { "1E23", NumberStyles.None, null, typeof(FormatException) }; // Exponent
yield return new object[] { "ab", NumberStyles.None, null, typeof(FormatException) }; // Hex value
yield return new object[] { " 123 ", NumberStyles.None, null, typeof(FormatException) }; // Trailing and leading whitespace
}
[Theory]
[MemberData(nameof(Parse_Invalid_TestData))]
public static void Parse_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType)
{
bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo;
decimal result;
if ((style & ~NumberStyles.Number) == 0 && style != NumberStyles.None && (style & NumberStyles.AllowLeadingWhite) == (style & NumberStyles.AllowTrailingWhite))
{
// Use Parse(string) or Parse(string, IFormatProvider)
if (isDefaultProvider)
{
Assert.False(decimal.TryParse(value, out result));
Assert.Equal(default(decimal), result);
Assert.Throws(exceptionType, () => decimal.Parse(value));
}
Assert.Throws(exceptionType, () => decimal.Parse(value, provider));
}
// Use Parse(string, NumberStyles, IFormatProvider)
Assert.False(decimal.TryParse(value, style, provider, out result));
Assert.Equal(default(decimal), result);
Assert.Throws(exceptionType, () => decimal.Parse(value, style, provider));
if (isDefaultProvider)
{
// Use Parse(string, NumberStyles) or Parse(string, NumberStyles, IFormatProvider)
Assert.False(decimal.TryParse(value, style, NumberFormatInfo.CurrentInfo, out result));
Assert.Equal(default(decimal), result);
Assert.Throws(exceptionType, () => decimal.Parse(value, style));
Assert.Throws(exceptionType, () => decimal.Parse(value, style, NumberFormatInfo.CurrentInfo));
}
}
public static IEnumerable<object[]> Parse_ValidWithOffsetCount_TestData()
{
foreach (object[] inputs in Parse_Valid_TestData())
{
yield return new object[] { inputs[0], 0, ((string)inputs[0]).Length, inputs[1], inputs[2], inputs[3] };
}
yield return new object[] { "-123", 1, 3, NumberStyles.Number, null, 123m };
yield return new object[] { "-123", 0, 3, NumberStyles.Number, null, -12m };
yield return new object[] { 1000.ToString("N0"), 0, 4, NumberStyles.AllowThousands, null, 100m };
yield return new object[] { 1000.ToString("N0"), 2, 3, NumberStyles.AllowThousands, null, 0m };
yield return new object[] { "(123)", 1, 3, NumberStyles.AllowParentheses, new NumberFormatInfo() { NumberDecimalSeparator = "." }, 123m };
yield return new object[] { "1234567890123456789012345.678456", 1, 4, NumberStyles.Number, new NumberFormatInfo() { NumberDecimalSeparator = "." }, 2345m };
}
[Theory]
[MemberData(nameof(Parse_ValidWithOffsetCount_TestData))]
public static void Parse_Span_Valid(string value, int offset, int count, NumberStyles style, IFormatProvider provider, decimal expected)
{
bool isDefaultProvider = provider == null || provider == NumberFormatInfo.CurrentInfo;
decimal result;
if ((style & ~NumberStyles.Number) == 0 && style != NumberStyles.None)
{
// Use Parse(string) or Parse(string, IFormatProvider)
if (isDefaultProvider)
{
Assert.True(decimal.TryParse(value.AsSpan(offset, count), out result));
Assert.Equal(expected, result);
Assert.Equal(expected, decimal.Parse(value.AsSpan(offset, count)));
}
Assert.Equal(expected, decimal.Parse(value.AsSpan(offset, count), provider: provider));
}
Assert.Equal(expected, decimal.Parse(value.AsSpan(offset, count), style, provider));
Assert.True(decimal.TryParse(value.AsSpan(offset, count), style, provider, out result));
Assert.Equal(expected, result);
}
[Theory]
[MemberData(nameof(Parse_Invalid_TestData))]
public static void Parse_Span_Invalid(string value, NumberStyles style, IFormatProvider provider, Type exceptionType)
{
if (value != null)
{
Assert.Throws(exceptionType, () => decimal.Parse(value.AsSpan(), style, provider));
Assert.False(decimal.TryParse(value.AsSpan(), style, provider, out decimal result));
Assert.Equal(0, result);
}
}
public static IEnumerable<object[]> Remainder_Valid_TestData()
{
decimal NegativeZero = new decimal(0, 0, 0, true, 0);
yield return new object[] { 5m, 3m, 2m };
yield return new object[] { 5m, -3m, 2m };
yield return new object[] { -5m, 3m, -2m };
yield return new object[] { -5m, -3m, -2m };
yield return new object[] { 3m, 5m, 3m };
yield return new object[] { 3m, -5m, 3m };
yield return new object[] { -3m, 5m, -3m };
yield return new object[] { -3m, -5m, -3m };
yield return new object[] { 10m, -3m, 1m };
yield return new object[] { -10m, 3m, -1m };
yield return new object[] { -2.0m, 0.5m, -0.0m };
yield return new object[] { 2.3m, 0.531m, 0.176m };
yield return new object[] { 0.00123m, 3242m, 0.00123m };
yield return new object[] { 3242m, 0.00123m, 0.00044m };
yield return new object[] { 17.3m, 3m, 2.3m };
yield return new object[] { 8.55m, 2.25m, 1.80m };
yield return new object[] { 0.00m, 3m, 0.00m };
yield return new object[] { NegativeZero, 2.2m, NegativeZero };
// Max/Min
yield return new object[] { decimal.MaxValue, decimal.MaxValue, 0m };
yield return new object[] { decimal.MaxValue, decimal.MinValue, 0m };
yield return new object[] { decimal.MaxValue, 1, 0m };
yield return new object[] { decimal.MaxValue, 2394713m, 1494647m };
yield return new object[] { decimal.MaxValue, -32768m, 32767m };
yield return new object[] { -0.00m, decimal.MaxValue, -0.00m };
yield return new object[] { 1.23984m, decimal.MaxValue, 1.23984m };
yield return new object[] { 2398412.12983m, decimal.MaxValue, 2398412.12983m };
yield return new object[] { -0.12938m, decimal.MaxValue, -0.12938m };
yield return new object[] { decimal.MinValue, decimal.MinValue, NegativeZero };
yield return new object[] { decimal.MinValue, decimal.MaxValue, NegativeZero };
yield return new object[] { decimal.MinValue, 1, NegativeZero };
yield return new object[] { decimal.MinValue, 2394713m, -1494647m };
yield return new object[] { decimal.MinValue, -32768m, -32767m };
yield return new object[] { 0.0m, decimal.MinValue, 0.0m };
yield return new object[] { 1.23984m, decimal.MinValue, 1.23984m };
yield return new object[] { 2398412.12983m, decimal.MinValue, 2398412.12983m };
yield return new object[] { -0.12938m, decimal.MinValue, -0.12938m };
yield return new object[] { 57675350989891243676868034225m, 7m, 5m };
yield return new object[] { -57675350989891243676868034225m, 7m, -5m };
yield return new object[] { 57675350989891243676868034225m, -7m, 5m };
yield return new object[] { -57675350989891243676868034225m, -7m, -5m };
yield return new object[] { 792281625142643375935439503.4m, 0.1m, 0.0m };
yield return new object[] { 79228162514264337593543950.34m, 0.1m, 0.04m };
yield return new object[] { 7922816251426433759354395.034m, 0.1m, 0.034m };
yield return new object[] { 792281625142643375935439.5034m, 0.1m, 0.0034m };
yield return new object[] { 79228162514264337593543950335m, 10m, 5m };
yield return new object[] { 79228162514264337567774146561m, 10m, 1m };
yield return new object[] { 79228162514264337567774146560m, 10m, 0m };
yield return new object[] { 79228162514264337567774146559m, 10m, 9m };
}
[Theory]
[MemberData(nameof(Remainder_Valid_TestData))]
public static void Remainder(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 % d2);
Assert.Equal(expected, decimal.Remainder(d1, d2));
}
public static IEnumerable<object[]> Remainder_Valid_TestDataV2()
{
yield return new object[] { decimal.MaxValue, 0.1m, 0.0m };
yield return new object[] { decimal.MaxValue, 7.081881059m, 3.702941036m };
yield return new object[] { decimal.MaxValue, 2004094637636.6280382536104438m, 1980741879937.1051521151154118m };
yield return new object[] { decimal.MaxValue, new decimal(0, 0, 1, false, 28), 0.0000000013968756053316206592m };
yield return new object[] { decimal.MaxValue, new decimal(0, 1, 0, false, 28), 0.0000000000000000004026531840m };
yield return new object[] { decimal.MaxValue, new decimal(1, 0, 0, false, 28), 0.0000000000000000000000000000m };
yield return new object[] { 5m, 0.0000000000000000000000000003m, 0.0000000000000000000000000002m };
yield return new object[] { 5.94499443m, 0.0000000000000000000000000007m, 0.0000000000000000000000000005m };
yield return new object[] { 1667m, 325.66574961026426932314500573m, 38.67125194867865338427497135m };
yield return new object[] { 1667m, 0.00000000013630700224712809m, 0.00000000002527942770321278m };
yield return new object[] { 60596869520933069.9m, 8063773.1275438997671m, 5700076.9722872002614m };
}
[Theory]
[MemberData(nameof(Remainder_Valid_TestDataV2))]
public static void RemainderV2(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 % d2);
Assert.Equal(expected, decimal.Remainder(d1, d2));
}
public static IEnumerable<object[]> Remainder_Invalid_TestData()
{
yield return new object[] { 5m, 0m };
}
[Theory]
[MemberData(nameof(Remainder_Invalid_TestData))]
public static void Remainder_ZeroDenominator_ThrowsDivideByZeroException(decimal d1, decimal d2)
{
Assert.Throws<DivideByZeroException>(() => d1 % d2);
Assert.Throws<DivideByZeroException>(() => decimal.Remainder(d1, d2));
}
public static IEnumerable<object[]> Round_Valid_TestData()
{
yield return new object[] { 0m, 0m };
yield return new object[] { 0.1m, 0m };
yield return new object[] { 0.5m, 0m };
yield return new object[] { 0.7m, 1m };
yield return new object[] { 1.3m, 1m };
yield return new object[] { 1.5m, 2m };
yield return new object[] { -0.1m, 0m };
yield return new object[] { -0.5m, 0m };
yield return new object[] { -0.7m, -1m };
yield return new object[] { -1.3m, -1m };
yield return new object[] { -1.5m, -2m };
}
[Theory]
[MemberData(nameof(Round_Valid_TestData))]
public static void Round(decimal d1, decimal expected)
{
Assert.Equal(expected, decimal.Round(d1));
}
public static IEnumerable<object[]> Round_Digit_Valid_TestData()
{
yield return new object[] { 1.45m, 1, 1.4m };
yield return new object[] { 1.55m, 1, 1.6m };
yield return new object[] { 123.456789m, 4, 123.4568m };
yield return new object[] { 123.456789m, 6, 123.456789m };
yield return new object[] { 123.456789m, 8, 123.456789m };
yield return new object[] { -123.456m, 0, -123m };
yield return new object[] { -123.0000000m, 3, -123.000m };
yield return new object[] { -123.0000000m, 11, -123.0000000m };
yield return new object[] { -9999999999.9999999999, 9, -10000000000.000000000m };
yield return new object[] { -9999999999.9999999999, 10, -9999999999.9999999999 };
}
[Theory]
[MemberData(nameof(Round_Digit_Valid_TestData))]
public static void Round_Digits_ReturnsExpected(decimal d, int digits, decimal expected)
{
Assert.Equal(expected, decimal.Round(d, digits));
}
public static IEnumerable<object[]> Round_Digit_Mid_Valid_TestData()
{
yield return new object[] { 1.45m, 1, MidpointRounding.ToEven, 1.4m };
yield return new object[] { 1.45m, 1, MidpointRounding.AwayFromZero, 1.5m };
yield return new object[] { 1.55m, 1, MidpointRounding.ToEven, 1.6m };
yield return new object[] { 1.55m, 1, MidpointRounding.AwayFromZero, 1.6m };
yield return new object[] { -1.45m, 1, MidpointRounding.ToEven, -1.4m };
yield return new object[] { -1.45m, 1, MidpointRounding.AwayFromZero, -1.5m };
yield return new object[] { 123.456789m, 4, MidpointRounding.ToEven, 123.4568m };
yield return new object[] { 123.456789m, 4, MidpointRounding.AwayFromZero, 123.4568m };
yield return new object[] { 123.456789m, 6, MidpointRounding.ToEven, 123.456789m };
yield return new object[] { 123.456789m, 6, MidpointRounding.AwayFromZero, 123.456789m };
yield return new object[] { 123.456789m, 8, MidpointRounding.ToEven, 123.456789m };
yield return new object[] { 123.456789m, 8, MidpointRounding.AwayFromZero, 123.456789m };
yield return new object[] { -123.456m, 0, MidpointRounding.ToEven, -123m };
yield return new object[] { -123.456m, 0, MidpointRounding.AwayFromZero, -123m };
yield return new object[] { -123.0000000m, 3, MidpointRounding.ToEven, -123.000m };
yield return new object[] { -123.0000000m, 3, MidpointRounding.AwayFromZero, -123.000m };
yield return new object[] { -123.0000000m, 11, MidpointRounding.ToEven, -123.0000000m };
yield return new object[] { -123.0000000m, 11, MidpointRounding.AwayFromZero, -123.0000000m };
yield return new object[] { -9999999999.9999999999, 9, MidpointRounding.ToEven, -10000000000.000000000m };
yield return new object[] { -9999999999.9999999999, 9, MidpointRounding.AwayFromZero, -10000000000.000000000m };
yield return new object[] { -9999999999.9999999999, 10, MidpointRounding.ToEven, -9999999999.9999999999 };
yield return new object[] { -9999999999.9999999999, 10, MidpointRounding.AwayFromZero, -9999999999.9999999999 };
}
[Theory]
[MemberData(nameof(Round_Digit_Mid_Valid_TestData))]
public static void Round_DigitsMode_ReturnsExpected(decimal d, int digits, MidpointRounding mode, decimal expected)
{
Assert.Equal(expected, decimal.Round(d, digits, mode));
}
public static IEnumerable<object[]> Round_Mid_Valid_TestData()
{
yield return new object[] { 0m, MidpointRounding.ToEven, 0m };
yield return new object[] { 0m, MidpointRounding.AwayFromZero, 0m };
yield return new object[] { 0.1m, MidpointRounding.ToEven, 0m };
yield return new object[] { 0.1m, MidpointRounding.AwayFromZero, 0m };
yield return new object[] { 0.5m, MidpointRounding.ToEven, 0m };
yield return new object[] { 0.5m, MidpointRounding.AwayFromZero, 1m };
yield return new object[] { 0.7m, MidpointRounding.ToEven, 1m };
yield return new object[] { 0.7m, MidpointRounding.AwayFromZero, 1m };
yield return new object[] { 1.3m, MidpointRounding.ToEven, 1m };
yield return new object[] { 1.3m, MidpointRounding.AwayFromZero, 1m };
yield return new object[] { 1.5m, MidpointRounding.ToEven, 2m };
yield return new object[] { 1.5m, MidpointRounding.AwayFromZero, 2m };
yield return new object[] { -0.1m, MidpointRounding.ToEven, 0m };
yield return new object[] { -0.1m, MidpointRounding.AwayFromZero, 0m };
yield return new object[] { -0.5m, MidpointRounding.ToEven, 0m };
yield return new object[] { -0.5m, MidpointRounding.AwayFromZero, -1m };
yield return new object[] { -0.7m, MidpointRounding.ToEven, -1m };
yield return new object[] { -0.7m, MidpointRounding.AwayFromZero, -1m };
yield return new object[] { -1.3m, MidpointRounding.ToEven, -1m };
yield return new object[] { -1.3m, MidpointRounding.AwayFromZero, -1m };
yield return new object[] { -1.5m, MidpointRounding.ToEven, -2m };
yield return new object[] { -1.5m, MidpointRounding.AwayFromZero, -2m };
}
[Theory]
[MemberData(nameof(Round_Mid_Valid_TestData))]
public void Round_MidpointRounding_ReturnsExpected(decimal d, MidpointRounding mode, decimal expected)
{
Assert.Equal(expected, decimal.Round(d, mode));
}
[Theory]
[InlineData(-1)]
[InlineData(29)]
public void Round_InvalidDecimals_ThrowsArgumentOutOfRangeException(int decimals)
{
AssertExtensions.Throws<ArgumentOutOfRangeException>("decimals", () => decimal.Round(1, decimals));
AssertExtensions.Throws<ArgumentOutOfRangeException>("decimals", () => decimal.Round(1, decimals, MidpointRounding.AwayFromZero));
}
public static IEnumerable<object[]> Subtract_Valid_TestData()
{
yield return new object[] { 1m, 1m, 0m };
yield return new object[] { 1m, 0m, 1m };
yield return new object[] { 0m, 1m, -1m };
yield return new object[] { 1m, 1m, 0m };
yield return new object[] { -1m, 1m, -2m };
yield return new object[] { 1m, -1m, 2m };
yield return new object[] { decimal.MaxValue, decimal.Zero, decimal.MaxValue };
yield return new object[] { decimal.MinValue, decimal.Zero, decimal.MinValue };
yield return new object[] { 79228162514264337593543950330m, -5, decimal.MaxValue };
yield return new object[] { 79228162514264337593543950330m, 5, 79228162514264337593543950325m };
yield return new object[] { -79228162514264337593543950330m, 5, decimal.MinValue };
yield return new object[] { -79228162514264337593543950330m, -5, -79228162514264337593543950325m };
yield return new object[] { 1234.5678m, 0.00009m, 1234.56771m };
yield return new object[] { -1234.5678m, 0.00009m, -1234.56789m };
yield return new object[] { 0.1111111111111111111111111111m, 0.1111111111111111111111111111m, 0 };
yield return new object[] { 0.2222222222222222222222222222m, 0.1111111111111111111111111111m, 0.1111111111111111111111111111m };
yield return new object[] { 1.1111111111111111111111111110m, 0.5555555555555555555555555555m, 0.5555555555555555555555555555m };
}
[Theory]
[MemberData(nameof(Subtract_Valid_TestData))]
public static void Subtract(decimal d1, decimal d2, decimal expected)
{
Assert.Equal(expected, d1 - d2);
Assert.Equal(expected, decimal.Subtract(d1, d2));
decimal d3 = d1;
d3 -= d2;
Assert.Equal(expected, d3);
}
public static IEnumerable<object[]> Subtract_Invalid_TestData()
{
yield return new object[] { 79228162514264337593543950330m, -6 };
yield return new object[] { -79228162514264337593543950330m, 6 };
}
[Theory]
[MemberData(nameof(Subtract_Invalid_TestData))]
public static void Subtract_Invalid(decimal d1, decimal d2)
{
Assert.Throws<OverflowException>(() => decimal.Subtract(d1, d2));
Assert.Throws<OverflowException>(() => d1 - d2);
decimal d3 = d1;
Assert.Throws<OverflowException>(() => d3 -= d2);
}
public static IEnumerable<object[]> ToOACurrency_TestData()
{
yield return new object[] { 0m, 0L };
yield return new object[] { 1m, 10000L };
yield return new object[] { 1.000000000000000m, 10000L };
yield return new object[] { 10000000000m, 100000000000000L };
yield return new object[] { 10000000000.00000000000000000m, 100000000000000L };
yield return new object[] { 0.000000000123456789m, 0L };
yield return new object[] { 0.123456789m, 1235L };
yield return new object[] { 123456789m, 1234567890000L };
yield return new object[] { 4294967295m, 42949672950000L };
yield return new object[] { -79.228162514264337593543950335m, -792282L };
yield return new object[] { -79228162514264.337593543950335m, -792281625142643376L };
}
[Theory]
[MemberData(nameof(ToOACurrency_TestData))]
public void ToOACurrency_Value_ReturnsExpected(decimal value, long expected)
{
Assert.Equal(expected, decimal.ToOACurrency(value));
}
[Fact]
public void ToOACurrency_InvalidAsLong_ThrowsOverflowException()
{
Assert.Throws<OverflowException>(() => decimal.ToOACurrency(new decimal(long.MaxValue) + 1));
Assert.Throws<OverflowException>(() => decimal.ToOACurrency(new decimal(long.MinValue) - 1));
}
[Fact]
public static void ToByte()
{
Assert.Equal(byte.MinValue, decimal.ToByte(byte.MinValue));
Assert.Equal(123, decimal.ToByte(123));
Assert.Equal(123, decimal.ToByte(123.123m));
Assert.Equal(byte.MaxValue, decimal.ToByte(byte.MaxValue));
}
[Fact]
public static void ToByte_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToByte(byte.MinValue - 1)); // Decimal < byte.MinValue
Assert.Throws<OverflowException>(() => decimal.ToByte(byte.MaxValue + 1)); // Decimal > byte.MaxValue
}
[Fact]
public static void ToDouble()
{
double d = decimal.ToDouble(new decimal(0, 0, 1, false, 0));
double dbl = 123456789.123456;
Assert.Equal(dbl, decimal.ToDouble((decimal)dbl));
Assert.Equal(-dbl, decimal.ToDouble((decimal)-dbl));
dbl = 1e20;
Assert.Equal(dbl, decimal.ToDouble((decimal)dbl));
Assert.Equal(-dbl, decimal.ToDouble((decimal)-dbl));
dbl = 1e27;
Assert.Equal(dbl, decimal.ToDouble((decimal)dbl));
Assert.Equal(-dbl, decimal.ToDouble((decimal)-dbl));
dbl = long.MaxValue;
// Need to pass in the Int64.MaxValue to ToDouble and not dbl because the conversion to double is a little lossy and we want precision
Assert.Equal(dbl, decimal.ToDouble(long.MaxValue));
Assert.Equal(-dbl, decimal.ToDouble(-long.MaxValue));
}
[Fact]
public static void ToInt16()
{
Assert.Equal(short.MinValue, decimal.ToInt16(short.MinValue));
Assert.Equal(-123, decimal.ToInt16(-123));
Assert.Equal(0, decimal.ToInt16(0));
Assert.Equal(123, decimal.ToInt16(123));
Assert.Equal(123, decimal.ToInt16(123.123m));
Assert.Equal(short.MaxValue, decimal.ToInt16(short.MaxValue));
}
[Fact]
public static void ToInt16_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToInt16(short.MinValue - 1)); // Decimal < short.MinValue
Assert.Throws<OverflowException>(() => decimal.ToInt16(short.MaxValue + 1)); // Decimal > short.MaxValue
Assert.Throws<OverflowException>(() => decimal.ToInt16((long)int.MinValue - 1)); // Decimal < short.MinValue
Assert.Throws<OverflowException>(() => decimal.ToInt16((long)int.MaxValue + 1)); // Decimal > short.MaxValue
}
[Fact]
public static void ToInt32()
{
Assert.Equal(int.MinValue, decimal.ToInt32(int.MinValue));
Assert.Equal(-123, decimal.ToInt32(-123));
Assert.Equal(0, decimal.ToInt32(0));
Assert.Equal(123, decimal.ToInt32(123));
Assert.Equal(123, decimal.ToInt32(123.123m));
Assert.Equal(int.MaxValue, decimal.ToInt32(int.MaxValue));
}
[Fact]
public static void ToInt32_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToInt32((long)int.MinValue - 1)); // Decimal < int.MinValue
Assert.Throws<OverflowException>(() => decimal.ToInt32((long)int.MaxValue + 1)); // Decimal > int.MaxValue
}
[Fact]
public static void ToInt64()
{
Assert.Equal(long.MinValue, decimal.ToInt64(long.MinValue));
Assert.Equal(-123, decimal.ToInt64(-123));
Assert.Equal(0, decimal.ToInt64(0));
Assert.Equal(123, decimal.ToInt64(123));
Assert.Equal(123, decimal.ToInt64(123.123m));
Assert.Equal(long.MaxValue, decimal.ToInt64(long.MaxValue));
}
[Fact]
public static void ToInt64_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToUInt64(decimal.MinValue)); // Decimal < long.MinValue
Assert.Throws<OverflowException>(() => decimal.ToUInt64(decimal.MaxValue)); // Decimal > long.MaxValue
}
[Fact]
public static void ToSByte()
{
Assert.Equal(sbyte.MinValue, decimal.ToSByte(sbyte.MinValue));
Assert.Equal(-123, decimal.ToSByte(-123));
Assert.Equal(0, decimal.ToSByte(0));
Assert.Equal(123, decimal.ToSByte(123));
Assert.Equal(123, decimal.ToSByte(123.123m));
Assert.Equal(sbyte.MaxValue, decimal.ToSByte(sbyte.MaxValue));
}
[Fact]
public static void ToSByte_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToSByte(sbyte.MinValue - 1)); // Decimal < sbyte.MinValue
Assert.Throws<OverflowException>(() => decimal.ToSByte(sbyte.MaxValue + 1)); // Decimal > sbyte.MaxValue
Assert.Throws<OverflowException>(() => decimal.ToSByte((long)int.MinValue - 1)); // Decimal < sbyte.MinValue
Assert.Throws<OverflowException>(() => decimal.ToSByte((long)int.MaxValue + 1)); // Decimal > sbyte.MaxValue
}
[Fact]
public static void ToSingle()
{
float f = 12345.12f;
Assert.Equal(f, decimal.ToSingle((decimal)f));
Assert.Equal(-f, decimal.ToSingle((decimal)-f));
f = 1e20f;
Assert.Equal(f, decimal.ToSingle((decimal)f));
Assert.Equal(-f, decimal.ToSingle((decimal)-f));
f = 1e27f;
Assert.Equal(f, decimal.ToSingle((decimal)f));
Assert.Equal(-f, decimal.ToSingle((decimal)-f));
}
[Fact]
public static void ToUInt16()
{
Assert.Equal(ushort.MinValue, decimal.ToUInt16(ushort.MinValue));
Assert.Equal(123, decimal.ToByte(123));
Assert.Equal(123, decimal.ToByte(123.123m));
Assert.Equal(ushort.MaxValue, decimal.ToUInt16(ushort.MaxValue));
}
[Fact]
public static void ToUInt16_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToUInt16(ushort.MinValue - 1)); // Decimal < ushort.MinValue
Assert.Throws<OverflowException>(() => decimal.ToUInt16(ushort.MaxValue + 1)); // Decimal > ushort.MaxValue
}
[Fact]
public static void ToUInt32()
{
Assert.Equal(uint.MinValue, decimal.ToUInt32(uint.MinValue));
Assert.Equal((uint)123, decimal.ToUInt32(123));
Assert.Equal((uint)123, decimal.ToUInt32(123.123m));
Assert.Equal(uint.MaxValue, decimal.ToUInt32(uint.MaxValue));
}
[Fact]
public static void ToUInt32_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToUInt32((long)uint.MinValue - 1)); // Decimal < uint.MinValue
Assert.Throws<OverflowException>(() => decimal.ToUInt32((long)uint.MaxValue + 1)); // Decimal > uint.MaxValue
}
[Fact]
public static void ToUInt64()
{
Assert.Equal(ulong.MinValue, decimal.ToUInt64(ulong.MinValue));
Assert.Equal((ulong)123, decimal.ToUInt64(123));
Assert.Equal((ulong)123, decimal.ToUInt64(123.123m));
Assert.Equal(ulong.MaxValue, decimal.ToUInt64(ulong.MaxValue));
}
[Fact]
public static void ToUInt64_Invalid()
{
Assert.Throws<OverflowException>(() => decimal.ToUInt64((long)ulong.MinValue - 1)); // Decimal < uint.MinValue
}
public static IEnumerable<object[]> ToString_TestData()
{
foreach (NumberFormatInfo defaultFormat in new[] { null, NumberFormatInfo.CurrentInfo })
{
yield return new object[] { decimal.MinValue, "G", defaultFormat, "-79228162514264337593543950335" };
yield return new object[] { (decimal)-4567, "G", defaultFormat, "-4567" };
yield return new object[] { (decimal)-4567.89101, "G", defaultFormat, "-4567.89101" };
yield return new object[] { (decimal)0, "G", defaultFormat, "0" };
yield return new object[] { (decimal)4567, "G", defaultFormat, "4567" };
yield return new object[] { (decimal)4567.89101, "G", defaultFormat, "4567.89101" };
yield return new object[] { decimal.MaxValue, "G", defaultFormat, "79228162514264337593543950335" };
yield return new object[] { decimal.MinusOne, "G", defaultFormat, "-1" };
yield return new object[] { decimal.Zero, "G", defaultFormat, "0" };
yield return new object[] { decimal.One, "G", defaultFormat, "1" };
yield return new object[] { (decimal)2468, "N", defaultFormat, "2,468.00" };
yield return new object[] { (decimal)2467, "[#-##-#]", defaultFormat, "[2-46-7]" };
}
NumberFormatInfo invariantFormat = NumberFormatInfo.InvariantInfo;
yield return new object[] { 32.5m, "C100", invariantFormat, "¤32.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" };
yield return new object[] { 32.5m, "P100", invariantFormat, "3,250.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %" };
yield return new object[] { 32.5m, "E100", invariantFormat, "3.2500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+001" };
yield return new object[] { 32.5m, "F100", invariantFormat, "32.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" };
yield return new object[] { 32.5m, "N100", invariantFormat, "32.5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" };
// Changing the negative pattern doesn't do anything without also passing in a format string
var customFormat1 = new NumberFormatInfo();
customFormat1.NumberNegativePattern = 0;
yield return new object[] { (decimal)-6310, "G", customFormat1, "-6310" };
var customFormat2 = new NumberFormatInfo();
customFormat2.NegativeSign = "#";
customFormat2.NumberDecimalSeparator = "~";
customFormat2.NumberGroupSeparator = "*";
yield return new object[] { (decimal)-2468, "N", customFormat2, "#2*468~00" };
yield return new object[] { (decimal)2468, "N", customFormat2, "2*468~00" };
var customFormat3 = new NumberFormatInfo();
customFormat3.NegativeSign = "xx"; // Set to trash to make sure it doesn't show up
customFormat3.NumberGroupSeparator = "*";
customFormat3.NumberNegativePattern = 0;
yield return new object[] { (decimal)-2468, "N", customFormat3, "(2*468.00)" };
var customFormat4 = new NumberFormatInfo()
{
NegativeSign = "#",
NumberDecimalSeparator = "~",
NumberGroupSeparator = "*",
PositiveSign = "&",
NumberDecimalDigits = 2,
PercentSymbol = "@",
PercentGroupSeparator = ",",
PercentDecimalSeparator = ".",
PercentDecimalDigits = 5
};
yield return new object[] { (decimal)123, "E", customFormat4, "1~230000E&002" };
yield return new object[] { (decimal)123, "F", customFormat4, "123~00" };
yield return new object[] { (decimal)123, "P", customFormat4, "12,300.00000 @" };
}
[Fact]
public static void Test_ToString()
{
using (new ThreadCultureChange(CultureInfo.InvariantCulture))
{
foreach (object[] testdata in ToString_TestData())
{
ToString((decimal)testdata[0], (string)testdata[1], (IFormatProvider)testdata[2], (string)testdata[3]);
}
}
}
private static void ToString(decimal f, string format, IFormatProvider provider, string expected)
{
bool isDefaultProvider = provider == null;
if (string.IsNullOrEmpty(format) || format.ToUpperInvariant() == "G")
{
if (isDefaultProvider)
{
Assert.Equal(expected, f.ToString());
Assert.Equal(expected, f.ToString((IFormatProvider)null));
}
Assert.Equal(expected, f.ToString(provider));
}
if (isDefaultProvider)
{
Assert.Equal(expected.Replace('e', 'E'), f.ToString(format.ToUpperInvariant())); // If format is upper case, then exponents are printed in upper case
Assert.Equal(expected.Replace('E', 'e'), f.ToString(format.ToLowerInvariant())); // If format is lower case, then exponents are printed in lower case
Assert.Equal(expected.Replace('e', 'E'), f.ToString(format.ToUpperInvariant(), null));
Assert.Equal(expected.Replace('E', 'e'), f.ToString(format.ToLowerInvariant(), null));
}
Assert.Equal(expected.Replace('e', 'E'), f.ToString(format.ToUpperInvariant(), provider));
Assert.Equal(expected.Replace('E', 'e'), f.ToString(format.ToLowerInvariant(), provider));
}
[Fact]
public static void ToString_InvalidFormat_ThrowsFormatException()
{
decimal f = 123;
Assert.Throws<FormatException>(() => f.ToString("Y"));
Assert.Throws<FormatException>(() => f.ToString("Y", null));
long intMaxPlus1 = (long)int.MaxValue + 1;
string intMaxPlus1String = intMaxPlus1.ToString();
Assert.Throws<FormatException>(() => f.ToString("E" + intMaxPlus1String));
}
[Theory]
[InlineData("3.00")]
public void TestRoundTripDecimalToString(string input)
{
decimal d = Decimal.Parse(input, NumberStyles.Number, NumberFormatInfo.InvariantInfo);
string dString = d.ToString(CultureInfo.InvariantCulture);
Assert.Equal(input, dString);
}
public static IEnumerable<object[]> Truncate_TestData()
{
yield return new object[] { 123m, 123m };
yield return new object[] { 123.123m, 123m };
yield return new object[] { 123.456m, 123m };
yield return new object[] { -123.123m, -123m };
yield return new object[] { -123.456m, -123m };
}
[Theory]
[MemberData(nameof(Truncate_TestData))]
public static void Truncate(decimal d, decimal expected)
{
Assert.Equal(expected, decimal.Truncate(d));
}
public static IEnumerable<object[]> Increment_TestData()
{
yield return new object[] { 1m, 2m };
yield return new object[] { 0m, 1m };
yield return new object[] { -1m, -0m };
yield return new object[] { 12345m, 12346m };
yield return new object[] { 12345.678m, 12346.678m };
yield return new object[] { -12345.678m, -12344.678m };
}
[Theory]
[MemberData(nameof(Increment_TestData))]
public static void IncrementOperator(decimal d, decimal expected)
{
Assert.Equal(expected, ++d);
}
public static IEnumerable<object[]> Decrement_TestData()
{
yield return new object[] { 1m, 0m };
yield return new object[] { 0m, -1m };
yield return new object[] { -1m, -2m };
yield return new object[] { 12345m, 12344m };
yield return new object[] { 12345.678m, 12344.678m };
yield return new object[] { -12345.678m, -12346.678m };
}
[Theory]
[MemberData(nameof(Decrement_TestData))]
public static void DecrementOperator(decimal d, decimal expected)
{
Assert.Equal(expected, --d);
}
public static class BigIntegerCompare
{
[Fact]
public static void Test()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
int expected = b1.CompareTo(bigDecimals[j]);
int actual = d1.CompareTo(d2);
if (expected != actual)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " CMP " + d2);
}
}
}
}
public static class BigIntegerAdd
{
[Fact]
public static void Test()
{
int overflowBudget = 1000;
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
BigDecimal expected = b1.Add(bigDecimals[j], out bool expectedOverflow);
if (expectedOverflow)
{
if (--overflowBudget < 0)
continue;
try
{
decimal actual = d1 + d2;
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " + " + d2);
}
catch (OverflowException) { }
}
else
unsafe
{
decimal actual = d1 + d2;
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " + " + d2);
}
}
}
}
}
public static class BigIntegerMul
{
[Fact]
public static void Test()
{
int overflowBudget = 1000;
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
BigDecimal expected = b1.Mul(bigDecimals[j], out bool expectedOverflow);
if (expectedOverflow)
{
if (--overflowBudget < 0)
continue;
try
{
decimal actual = d1 * d2;
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " * " + d2);
}
catch (OverflowException) { }
}
else
unsafe
{
decimal actual = d1 * d2;
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " * " + d2);
}
}
}
}
}
public static class BigIntegerDiv
{
[Fact]
public static void Test()
{
int overflowBudget = 1000;
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
if (Math.Sign(d2) == 0)
continue;
BigDecimal expected = b1.Div(bigDecimals[j], out bool expectedOverflow);
if (expectedOverflow)
{
if (--overflowBudget < 0)
continue;
try
{
decimal actual = d1 / d2;
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " / " + d2);
}
catch (OverflowException) { }
}
else
unsafe
{
decimal actual = d1 / d2;
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " / " + d2);
}
}
}
}
}
public static class BigIntegerMod
{
[Fact]
public static void Test()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j < decimalValues.Length; j++)
{
decimal d2 = decimalValues[j];
if (Math.Sign(d2) == 0)
continue;
BigDecimal expected = b1.Mod(bigDecimals[j]);
try
{
decimal actual = d1 % d2;
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " % " + d2);
}
}
catch (OverflowException actual)
{
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " % " + d2);
}
}
}
}
}
[Fact]
public static void BigInteger_Floor()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal expected = bigDecimals[i].Floor();
decimal actual = decimal.Floor(d1);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " Floor");
}
}
}
[Fact]
public static void BigInteger_Ceiling()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal expected = bigDecimals[i].Ceiling();
decimal actual = decimal.Ceiling(d1);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " Ceiling");
}
}
}
[Fact]
public static void BigInteger_Truncate()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal expected = bigDecimals[i].Truncate();
decimal actual = decimal.Truncate(d1);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " Truncate");
}
}
}
[Fact]
public static void BigInteger_ToInt32()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
int expected = bigDecimals[i].ToInt32(out bool expectedOverflow);
if (expectedOverflow)
{
try
{
int actual = decimal.ToInt32(d1);
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " ToInt32");
}
catch (OverflowException) { }
}
else
{
int actual = decimal.ToInt32(d1);
if (expected != actual)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " ToInt32");
}
}
}
[Fact]
public static void BigInteger_ToOACurrency()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
long expected = bigDecimals[i].ToOACurrency(out bool expectedOverflow);
if (expectedOverflow)
{
try
{
long actual = decimal.ToOACurrency(d1);
throw new Xunit.Sdk.AssertActualExpectedException(typeof(OverflowException), actual, d1 + " ToOACurrency");
}
catch (OverflowException) { }
}
else
{
long actual = decimal.ToOACurrency(d1);
if (expected != actual)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " ToOACurrency");
}
}
}
[Fact]
public static void BigInteger_Round()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j <= 28; j++)
{
BigDecimal expected = b1.Round(j);
decimal actual = decimal.Round(d1, j);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " Round(" + j + ")");
}
}
}
}
[Fact]
public static void BigInteger_RoundAwayFromZero()
{
decimal[] decimalValues = GetRandomData(out BigDecimal[] bigDecimals);
for (int i = 0; i < decimalValues.Length; i++)
{
decimal d1 = decimalValues[i];
BigDecimal b1 = bigDecimals[i];
for (int j = 0; j <= 28; j++)
{
BigDecimal expected = b1.RoundAwayFromZero(j);
decimal actual = decimal.Round(d1, j, MidpointRounding.AwayFromZero);
unsafe
{
if (expected.Scale != (byte)(*(uint*)&actual >> BigDecimal.ScaleShift) || expected.CompareTo(new BigDecimal(actual)) != 0)
throw new Xunit.Sdk.AssertActualExpectedException(expected, actual, d1 + " RoundAwayFromZero(" + j + ")");
}
}
}
}
[Fact]
public static void GetHashCodeTest()
{
var dict = new Dictionary<string, (int hash, string value)>();
foreach (decimal d in GetRandomData(out _, hash: true))
{
string value = d.ToString(CultureInfo.InvariantCulture);
string key = value[value.Length - 1] == '0' && value.Contains('.') ? value.AsSpan().TrimEnd('0').TrimEnd('.').ToString() : value;
int hash = d.GetHashCode();
if (!dict.TryGetValue(key, out var ex))
{
dict.Add(key, (hash, value));
}
else if (ex.hash != hash)
{
throw new Xunit.Sdk.XunitException($"Decimal {key} has multiple hash codes: {ex.hash} ({ex.value}) and {hash} ({value})");
}
}
}
static decimal[] GetRandomData(out BigDecimal[] bigDecimals, bool hash = false)
{
// some static data to test the limits
var list = new List<decimal> { new decimal(0, 0, 0, true, 0), decimal.Zero, decimal.MinusOne, decimal.One, decimal.MinValue, decimal.MaxValue,
new decimal(1, 0, 0, true, 28), new decimal(1, 0, 0, false, 28),
new decimal(123877878, -16789245, 1086421879, true, 16), new decimal(527635459, -80701438, 1767087216, true, 24), new decimal(253511426, -909347550, -753557281, false, 12) };
// ~1000 different random decimals covering every scale and sign with ~20 different bitpatterns each
var rnd = new Random(42);
var unique = new HashSet<string>();
for (byte scale = 0; scale <= 28; scale++)
for (int sign = 0; sign <= 1; sign++)
for (int high = 0; high <= 96; high = IncBitLimits(high))
for (int low = 0; low < high || (high | low) == 0; low = IncBitLimits(high))
{
var d = new decimal(GetDigits(low, high), GetDigits(low - 32, high - 32), GetDigits(low - 64, high - 64), sign != 0, scale);
if (!unique.Add(d.ToString(CultureInfo.InvariantCulture)))
continue; // skip duplicates
list.Add(d);
if (hash)
{
// generate all possible variants of the number up-to max decimal scale
for (byte lastScale = scale; lastScale < 28;)
{
d *= 1.0m;
unsafe
{
byte curScale = (byte)(*(uint*)&d >> BigDecimal.ScaleShift);
if (curScale <= lastScale)
break;
lastScale = curScale;
}
list.Add(d);
}
}
}
decimal[] decimalValues = list.ToArray();
bigDecimals = hash ? null : Array.ConvertAll(decimalValues, d => new BigDecimal(d));
return decimalValues;
// While the decimals are random in general,
// they are particularly focused on numbers starting or ending at bits 0-3, 30-34, 62-66, 94-96 to focus more on the corner cases around uint32 boundaries.
int IncBitLimits(int i)
{
switch (i)
{
case 3:
return 30;
case 34:
return 62;
case 66:
return 94;
default:
return i + 1;
}
}
// Generates a random number, only bits between low and high can be set.
int GetDigits(int low, int high)
{
if (high <= 0 || low >= 32)
return 0;
uint res = 0;
if (high <= 32)
res = 1u << (high - 1);
res |= (uint)Math.Ceiling((uint.MaxValue >> Math.Max(0, 32 - high)) * rnd.NextDouble());
if (low > 0)
res = (res >> low) << low;
return (int)res;
}
}
/// <summary>
/// Decimal implementation roughly based on the oleaut32 native decimal code (especially ScaleResult), but optimized for simplicity instead of speed
/// </summary>
struct BigDecimal
{
public readonly BigInteger Integer;
public readonly byte Scale;
public unsafe BigDecimal(decimal value)
{
Scale = (byte)(*(uint*)&value >> ScaleShift);
*(uint*)&value &= ~ScaleMask;
Integer = new BigInteger(value);
}
private const uint ScaleMask = 0x00FF0000;
public const int ScaleShift = 16;
public override string ToString()
{
if (Scale == 0)
return Integer.ToString();
var s = Integer.ToString("D" + (Scale + 1));
return s.Insert(s.Length - Scale, ".");
}
BigDecimal(BigInteger integer, byte scale)
{
Integer = integer;
Scale = scale;
}
static readonly BigInteger[] Pow10 = Enumerable.Range(0, 60).Select(i => BigInteger.Pow(10, i)).ToArray();
public int CompareTo(BigDecimal value)
{
int sd = Scale - value.Scale;
if (sd > 0)
return Integer.CompareTo(value.Integer * Pow10[sd]);
else if (sd < 0)
return (Integer * Pow10[-sd]).CompareTo(value.Integer);
else
return Integer.CompareTo(value.Integer);
}
public BigDecimal Add(BigDecimal value, out bool overflow)
{
int sd = Scale - value.Scale;
BigInteger a = Integer, b = value.Integer;
if (sd > 0)
b *= Pow10[sd];
else if (sd < 0)
a *= Pow10[-sd];
var res = a + b;
int scale = Math.Max(Scale, value.Scale);
overflow = ScaleResult(ref res, ref scale);
return new BigDecimal(res, (byte)scale);
}
public BigDecimal Mul(BigDecimal value, out bool overflow)
{
var res = Integer * value.Integer;
int scale = Scale + value.Scale;
if (res.IsZero)
{
overflow = false;
// VarDecMul quirk: multipling by zero results in a scaled zero (e.g., 0.000) only if the intermediate scale is <=47 and both inputs fit in 32 bits!
if (scale <= 47 && BigInteger.Abs(Integer) <= MaxInteger32 && BigInteger.Abs(value.Integer) <= MaxInteger32)
scale = Math.Min(scale, 28);
else
scale = 0;
}
else
{
overflow = ScaleResult(ref res, ref scale);
// VarDecMul quirk: rounding to zero results in a scaled zero (e.g., 0.000), except if the intermediate scale is >47 and both inputs fit in 32 bits!
if (res.IsZero && scale == 28 && Scale + value.Scale > 47 && BigInteger.Abs(Integer) <= MaxInteger32 && BigInteger.Abs(value.Integer) <= MaxInteger32)
scale = 0;
}
return new BigDecimal(res, (byte)scale);
}
public BigDecimal Div(BigDecimal value, out bool overflow)
{
int scale = Scale - value.Scale;
var dividend = Integer;
if (scale < 0)
{
dividend *= Pow10[-scale];
scale = 0;
}
var quo = BigInteger.DivRem(dividend, value.Integer, out var remainder);
if (remainder.IsZero)
overflow = BigInteger.Abs(quo) > MaxInteger;
else
{
// We have computed a quotient based on the natural scale ( <dividend scale> - <divisor scale> ).
// We have a non-zero remainder, so now we increase the scale to DEC_SCALE_MAX+1 to include more quotient bits.
var pow = Pow10[29 - scale];
quo *= pow;
quo += BigInteger.DivRem(remainder * pow, value.Integer, out remainder);
scale = 29;
overflow = ScaleResult(ref quo, ref scale, !remainder.IsZero);
// Unscale the result (removes extra zeroes).
while (scale > 0 && quo.IsEven)
{
var tmp = BigInteger.DivRem(quo, 10, out remainder);
if (!remainder.IsZero)
break;
quo = tmp;
scale--;
}
}
return new BigDecimal(quo, (byte)scale);
}
public BigDecimal Mod(BigDecimal den)
{
if (den.Integer.IsZero)
{
throw new DivideByZeroException();
}
int sign = Integer.Sign;
if (sign == 0)
{
return this;
}
if (den.Integer.Sign != sign)
{
den = -den;
}
int cmp = CompareTo(den) * sign;
if (cmp <= 0)
{
return cmp < 0 ? this : new BigDecimal(default, Math.Max(Scale, den.Scale));
}
int sd = Scale - den.Scale;
BigInteger a = Integer, b = den.Integer;
if (sd > 0)
b *= Pow10[sd];
else if (sd < 0)
a *= Pow10[-sd];
return new BigDecimal(a % b, Math.Max(Scale, den.Scale));
}
public static BigDecimal operator -(BigDecimal value) => new BigDecimal(-value.Integer, value.Scale);
static readonly BigInteger MaxInteger = (new BigInteger(ulong.MaxValue) << 32) | uint.MaxValue;
static readonly BigInteger MaxInteger32 = uint.MaxValue;
static readonly double Log2To10 = Math.Log(2) / Math.Log(10);
/// <summary>
/// Returns Log10 for the given number, offset by 96bits.
/// </summary>
static int ScaleOverMaxInteger(BigInteger abs) => abs.IsZero ? -28 : (int)(((int)BigInteger.Log(abs, 2) - 95) * Log2To10);
/// <summary>
/// See if we need to scale the result to fit it in 96 bits.
/// Perform needed scaling. Adjust scale factor accordingly.
/// </summary>
static bool ScaleResult(ref BigInteger res, ref int scale, bool sticky = false)
{
int newScale = 0;
var abs = BigInteger.Abs(res);
if (abs > MaxInteger)
{
// Find the min scale factor to make the result to fit it in 96 bits, 0 - 29.
// This reduces the scale factor of the result. If it exceeds the current scale of the result, we'll overflow.
newScale = Math.Max(1, ScaleOverMaxInteger(abs));
if (newScale > scale)
return true;
}
// Make sure we scale by enough to bring the current scale factor into valid range.
newScale = Math.Max(newScale, scale - 28);
if (newScale != 0)
{
// Scale by the power of 10 given by newScale.
// This is not guaranteed to bring the number within 96 bits -- it could be 1 power of 10 short.
scale -= newScale;
var pow = Pow10[newScale];
while (true)
{
abs = BigInteger.DivRem(abs, pow, out var remainder);
// If we didn't scale enough, divide by 10 more.
if (abs > MaxInteger)
{
if (scale == 0)
return true;
pow = 10;
scale--;
sticky |= !remainder.IsZero;
continue;
}
// Round final result. See if remainder >= 1/2 of divisor.
// If remainder == 1/2 divisor, round up if odd or sticky bit set.
pow >>= 1;
if (remainder < pow || remainder == pow && !sticky && abs.IsEven)
break;
if (++abs <= MaxInteger)
break;
// The rounding caused us to carry beyond 96 bits. Scale by 10 more.
if (scale == 0)
return true;
pow = 10;
scale--;
sticky = false;
}
res = res.Sign < 0 ? -abs : abs;
}
return false;
}
public BigDecimal Floor() => FloorCeiling(Integer.Sign < 0);
public BigDecimal Ceiling() => FloorCeiling(Integer.Sign > 0);
BigDecimal FloorCeiling(bool up)
{
if (Scale == 0)
return this;
var res = BigInteger.DivRem(Integer, Pow10[Scale], out var remainder);
if (up && !remainder.IsZero)
res += Integer.Sign;
return new BigDecimal(res, 0);
}
public BigDecimal Truncate() => Scale == 0 ? this : new BigDecimal(Integer / Pow10[Scale], 0);
public int ToInt32(out bool expectedOverflow)
{
var i = Truncate().Integer;
return (expectedOverflow = i < int.MinValue || i > int.MaxValue) ? 0 : (int)i;
}
public long ToOACurrency(out bool expectedOverflow)
{
var i = Integer;
if (Scale < 4)
i *= Pow10[4 - Scale];
else if (Scale > 4)
i = RoundToEven(i, Scale - 4);
return (expectedOverflow = i < long.MinValue || i > long.MaxValue) ? 0 : (long)i;
}
static BigInteger RoundToEven(BigInteger value, int scale)
{
var pow = Pow10[scale];
var res = BigInteger.DivRem(value, pow, out var remainder);
pow >>= 1;
remainder = BigInteger.Abs(remainder);
if (remainder > pow || remainder == pow && !res.IsEven)
res += value.Sign;
return res;
}
public BigDecimal Round(int scale)
{
var diff = Scale - scale;
if (diff <= 0)
return this;
return new BigDecimal(RoundToEven(Integer, diff), (byte)scale);
}
public BigDecimal RoundAwayFromZero(int scale)
{
var diff = Scale - scale;
if (diff <= 0)
return this;
var pow = Pow10[diff];
var res = BigInteger.DivRem(Integer, pow, out var remainder);
if (BigInteger.Abs(remainder) >= (pow >> 1))
res += Integer.Sign;
return new BigDecimal(res, (byte)scale);
}
}
[Theory]
[InlineData(MidpointRounding.ToEven - 1)]
[InlineData(MidpointRounding.ToPositiveInfinity + 1)]
public void Round_InvalidMidpointRounding_ThrowsArgumentException(MidpointRounding mode)
{
AssertExtensions.Throws<ArgumentException>("mode", () => decimal.Round(1, 2, mode));
}
[Fact]
public static void TryFormat()
{
using (new ThreadCultureChange(CultureInfo.InvariantCulture))
{
foreach (object[] testdata in ToString_TestData())
{
decimal localI = (decimal)testdata[0];
string localFormat = (string)testdata[1];
IFormatProvider localProvider = (IFormatProvider)testdata[2];
string localExpected = (string)testdata[3];
try
{
char[] actual;
int charsWritten;
// Just right
actual = new char[localExpected.Length];
Assert.True(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat, localProvider));
Assert.Equal(localExpected.Length, charsWritten);
Assert.Equal(localExpected, new string(actual));
// Longer than needed
actual = new char[localExpected.Length + 1];
Assert.True(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat, localProvider));
Assert.Equal(localExpected.Length, charsWritten);
Assert.Equal(localExpected, new string(actual, 0, charsWritten));
// Too short
if (localExpected.Length > 0)
{
actual = new char[localExpected.Length - 1];
Assert.False(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat, localProvider));
Assert.Equal(0, charsWritten);
}
if (localFormat != null)
{
// Upper localFormat
actual = new char[localExpected.Length];
Assert.True(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat.ToUpperInvariant(), localProvider));
Assert.Equal(localExpected.Length, charsWritten);
Assert.Equal(localExpected.ToUpperInvariant(), new string(actual));
// Lower format
actual = new char[localExpected.Length];
Assert.True(localI.TryFormat(actual.AsSpan(), out charsWritten, localFormat.ToLowerInvariant(), localProvider));
Assert.Equal(localExpected.Length, charsWritten);
Assert.Equal(localExpected.ToLowerInvariant(), new string(actual));
}
}
catch (Exception exc)
{
throw new Exception($"Failed on `{localI}`, `{localFormat}`, `{localProvider}`, `{localExpected}`. {exc}");
}
}
}
}
}
}
| 1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/tests/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/NativeDependencyTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
using TestLibrary;
using Xunit;
namespace AssemblyDependencyResolverTests
{
class NativeDependencyTests : TestBase
{
string _componentDirectory;
string _componentAssemblyPath;
protected override void Initialize()
{
HostPolicyMock.Initialize(TestBasePath, CoreRoot);
_componentDirectory = Path.Combine(TestBasePath, $"TestComponent_{Guid.NewGuid().ToString().Substring(0, 8)}");
Directory.CreateDirectory(_componentDirectory);
_componentAssemblyPath = CreateMockFile("TestComponent.dll");
}
protected override void Cleanup()
{
if (Directory.Exists(_componentDirectory))
{
Directory.Delete(_componentDirectory, recursive: true);
}
}
public void TestSimpleNameAndNoPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("{0}", "{0}", OS.Windows | OS.OSX | OS.Linux);
}
public void TestSimpleNameAndNoPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("{0}.dll", "{0}", OS.Windows);
ValidateNativeLibraryResolutions("{0}.dylib", "{0}", OS.OSX);
ValidateNativeLibraryResolutions("{0}.so", "{0}", OS.Linux);
}
public void TestSimpleNameAndLibPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("lib{0}", "{0}", OS.OSX | OS.Linux);
}
public void TestRelativeNameAndLibPrefixAndNoSuffix()
{
// The lib prefix is not added if the lookup is a relative path.
ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}", "{0}", 0);
}
public void TestSimpleNameAndLibPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("lib{0}.dll", "{0}", 0);
ValidateNativeLibraryResolutions("lib{0}.dylib", "{0}", OS.OSX);
ValidateNativeLibraryResolutions("lib{0}.so", "{0}", OS.Linux);
}
public void TestNameWithSuffixAndNoPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("{0}", "{0}.dll", 0);
ValidateNativeLibraryResolutions("{0}", "{0}.dylib", 0);
ValidateNativeLibraryResolutions("{0}", "{0}.so", 0);
}
public void TestNameWithSuffixAndNoPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("{0}.dll", "{0}.dll", OS.Windows | OS.OSX | OS.Linux);
ValidateNativeLibraryResolutions("{0}.dylib", "{0}.dylib", OS.Windows | OS.OSX | OS.Linux);
ValidateNativeLibraryResolutions("{0}.so", "{0}.so", OS.Windows | OS.OSX | OS.Linux);
}
public void TestNameWithSuffixAndNoPrefixAndDoubleSuffix()
{
// Unixes add the suffix even if one is already present.
ValidateNativeLibraryResolutions("{0}.dll.dll", "{0}.dll", 0);
ValidateNativeLibraryResolutions("{0}.dylib.dylib", "{0}.dylib", OS.OSX);
ValidateNativeLibraryResolutions("{0}.so.so", "{0}.so", OS.Linux);
}
public void TestNameWithSuffixAndPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("lib{0}", "{0}.dll", 0);
ValidateNativeLibraryResolutions("lib{0}", "{0}.dylib", 0);
ValidateNativeLibraryResolutions("lib{0}", "{0}.so", 0);
}
public void TestNameWithSuffixAndPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("lib{0}.dll", "{0}.dll", OS.OSX | OS.Linux);
ValidateNativeLibraryResolutions("lib{0}.dylib", "{0}.dylib", OS.OSX | OS.Linux);
ValidateNativeLibraryResolutions("lib{0}.so", "{0}.so", OS.OSX | OS.Linux);
}
public void TestRelativeNameWithSuffixAndPrefixAndSuffix()
{
// The lib prefix is not added if the lookup is a relative path
ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.dll", "{0}.dll", 0);
ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.dylib", "{0}.dylib", 0);
ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.so", "{0}.so", 0);
}
public void TestNameWithPrefixAndNoPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("{0}", "lib{0}", 0);
}
public void TestNameWithPrefixAndPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("lib{0}", "lib{0}", OS.Windows | OS.OSX | OS.Linux);
}
public void TestNameWithPrefixAndNoPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("{0}.dll", "lib{0}", 0);
ValidateNativeLibraryResolutions("{0}.dylib", "lib{0}", 0);
ValidateNativeLibraryResolutions("{0}.so", "lib{0}", 0);
}
public void TestNameWithPrefixAndPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("lib{0}.dll", "lib{0}", OS.Windows);
ValidateNativeLibraryResolutions("lib{0}.dylib", "lib{0}", OS.OSX);
ValidateNativeLibraryResolutions("lib{0}.so", "lib{0}", OS.Linux);
}
public void TestWindowsAddsSuffixEvenWithOnePresent()
{
ValidateNativeLibraryResolutions("{0}.ext.dll", "{0}.ext", OS.Windows);
}
public void TestWindowsDoesntAddSuffixWhenExectubaleIsPresent()
{
ValidateNativeLibraryResolutions("{0}.dll.dll", "{0}.dll", 0);
ValidateNativeLibraryResolutions("{0}.dll.exe", "{0}.dll", 0);
ValidateNativeLibraryResolutions("{0}.exe.dll", "{0}.exe", 0);
ValidateNativeLibraryResolutions("{0}.exe.exe", "{0}.exe", 0);
}
private void TestLookupWithSuffixPrefersUnmodifiedSuffixOnUnixes()
{
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "lib{0}.dylib", "{0}.dylib", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "lib{0}.so", "{0}.so", OS.Linux);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "{0}.dylib.dylib", "{0}.dylib", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "{0}.so.so", "{0}.so", OS.Linux);
}
private void TestLookupWithoutSuffixPrefersWithSuffixOnUnixes()
{
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "lib{0}.dylib", "{0}", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "lib{0}.so", "{0}", OS.Linux);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "{0}", "{0}", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "{0}", "{0}", OS.Linux);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "lib{0}", "{0}", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "lib{0}", "{0}", OS.Linux);
}
public void TestFullPathLookupWithMatchingFileName()
{
ValidateFullPathNativeLibraryResolutions("{0}", "{0}", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("{0}.dll", "{0}.dll", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("{0}.dylib", "{0}.dylib", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("{0}.so", "{0}.so", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("lib{0}", "lib{0}", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "lib{0}.dll", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "lib{0}.dylib", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("lib{0}.so", "lib{0}.so", OS.Windows | OS.OSX | OS.Linux);
}
public void TestFullPathLookupWithDifferentFileName()
{
ValidateFullPathNativeLibraryResolutions("lib{0}", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("{0}.dll", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("{0}.dylib", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("{0}.so", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.so", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "{0}.dll", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "{0}.dylib", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.so", "{0}.so", 0);
}
[Flags]
private enum OS
{
Windows = 0x1,
OSX = 0x2,
Linux = 0x4
}
private void ValidateNativeLibraryResolutions(
string fileNamePattern,
string lookupNamePattern,
OS resolvesOnOSes)
{
string newDirectory = Guid.NewGuid().ToString().Substring(0, 8);
string nativeLibraryPath = CreateMockFile(Path.Combine(newDirectory, string.Format(fileNamePattern, "NativeLibrary")));
ValidateNativeLibraryResolutions(
Path.GetDirectoryName(nativeLibraryPath),
nativeLibraryPath,
string.Format(lookupNamePattern, "NativeLibrary"),
resolvesOnOSes);
}
private void ValidateNativeLibraryWithRelativeLookupResolutions(
string fileNamePattern,
string lookupNamePattern,
OS resolvesOnOSes)
{
string newDirectory = Guid.NewGuid().ToString().Substring(0, 8);
string nativeLibraryPath = CreateMockFile(Path.Combine(newDirectory, string.Format(fileNamePattern, "NativeLibrary")));
ValidateNativeLibraryResolutions(
Path.GetDirectoryName(Path.GetDirectoryName(nativeLibraryPath)),
nativeLibraryPath,
Path.Combine(newDirectory, string.Format(lookupNamePattern, "NativeLibrary")),
resolvesOnOSes);
}
private void ValidateFullPathNativeLibraryResolutions(
string fileNamePattern,
string lookupNamePattern,
OS resolvesOnOSes)
{
string newDirectory = Guid.NewGuid().ToString().Substring(0, 8);
string nativeLibraryPath = CreateMockFile(Path.Combine(newDirectory, string.Format(fileNamePattern, "NativeLibrary")));
ValidateNativeLibraryResolutions(
Path.GetDirectoryName(nativeLibraryPath),
nativeLibraryPath,
Path.Combine(Path.GetDirectoryName(nativeLibraryPath), string.Format(lookupNamePattern, "NativeLibrary")),
resolvesOnOSes);
}
private void ValidateNativeLibraryResolutionsWithTwoFiles(
string fileNameToResolvePattern,
string otherFileNamePattern,
string lookupNamePattern,
OS resolvesOnOSes)
{
string newDirectory = Guid.NewGuid().ToString().Substring(0, 8);
string nativeLibraryPath = CreateMockFile(Path.Combine(newDirectory, string.Format(fileNameToResolvePattern, "NativeLibrary")));
CreateMockFile(Path.Combine(newDirectory, string.Format(otherFileNamePattern, "NativeLibrary")));
ValidateNativeLibraryResolutions(
Path.GetDirectoryName(nativeLibraryPath),
nativeLibraryPath,
string.Format(lookupNamePattern, "NativeLibrary"),
resolvesOnOSes);
}
private void ValidateNativeLibraryResolutions(
string nativeLibraryPaths,
string expectedResolvedFilePath,
string lookupName,
OS resolvesOnOSes)
{
using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
$"{nativeLibraryPaths}",
""))
{
AssemblyDependencyResolver resolver = new AssemblyDependencyResolver(
Path.Combine(TestBasePath, _componentAssemblyPath));
string result = resolver.ResolveUnmanagedDllToPath(lookupName);
if (OperatingSystem.IsWindows())
{
if (resolvesOnOSes.HasFlag(OS.Windows))
{
Assert.Equal(expectedResolvedFilePath, result);
}
else
{
Assert.Null(result);
}
}
else if (OperatingSystem.IsMacOS())
{
if (resolvesOnOSes.HasFlag(OS.OSX))
{
Assert.Equal(expectedResolvedFilePath, result);
}
else
{
Assert.Null(result);
}
}
else
{
if (resolvesOnOSes.HasFlag(OS.Linux))
{
Assert.Equal(expectedResolvedFilePath, result);
}
else
{
Assert.Null(result);
}
}
}
}
private string CreateMockFile(string relativePath)
{
string fullPath = Path.Combine(_componentDirectory, relativePath);
if (!File.Exists(fullPath))
{
string directory = Path.GetDirectoryName(fullPath);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
File.WriteAllText(fullPath, "Mock file");
}
return fullPath;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Loader;
using TestLibrary;
using Xunit;
namespace AssemblyDependencyResolverTests
{
class NativeDependencyTests : TestBase
{
string _componentDirectory;
string _componentAssemblyPath;
protected override void Initialize()
{
HostPolicyMock.Initialize(TestBasePath, CoreRoot);
_componentDirectory = Path.Combine(TestBasePath, $"TestComponent_{Guid.NewGuid().ToString().Substring(0, 8)}");
Directory.CreateDirectory(_componentDirectory);
_componentAssemblyPath = CreateMockFile("TestComponent.dll");
}
protected override void Cleanup()
{
if (Directory.Exists(_componentDirectory))
{
Directory.Delete(_componentDirectory, recursive: true);
}
}
public void TestSimpleNameAndNoPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("{0}", "{0}", OS.Windows | OS.OSX | OS.Linux);
}
public void TestSimpleNameAndNoPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("{0}.dll", "{0}", OS.Windows);
ValidateNativeLibraryResolutions("{0}.dylib", "{0}", OS.OSX);
ValidateNativeLibraryResolutions("{0}.so", "{0}", OS.Linux);
}
public void TestSimpleNameAndLibPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("lib{0}", "{0}", OS.OSX | OS.Linux);
}
public void TestRelativeNameAndLibPrefixAndNoSuffix()
{
// The lib prefix is not added if the lookup is a relative path.
ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}", "{0}", 0);
}
public void TestSimpleNameAndLibPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("lib{0}.dll", "{0}", 0);
ValidateNativeLibraryResolutions("lib{0}.dylib", "{0}", OS.OSX);
ValidateNativeLibraryResolutions("lib{0}.so", "{0}", OS.Linux);
}
public void TestNameWithSuffixAndNoPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("{0}", "{0}.dll", 0);
ValidateNativeLibraryResolutions("{0}", "{0}.dylib", 0);
ValidateNativeLibraryResolutions("{0}", "{0}.so", 0);
}
public void TestNameWithSuffixAndNoPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("{0}.dll", "{0}.dll", OS.Windows | OS.OSX | OS.Linux);
ValidateNativeLibraryResolutions("{0}.dylib", "{0}.dylib", OS.Windows | OS.OSX | OS.Linux);
ValidateNativeLibraryResolutions("{0}.so", "{0}.so", OS.Windows | OS.OSX | OS.Linux);
}
public void TestNameWithSuffixAndNoPrefixAndDoubleSuffix()
{
// Unixes add the suffix even if one is already present.
ValidateNativeLibraryResolutions("{0}.dll.dll", "{0}.dll", 0);
ValidateNativeLibraryResolutions("{0}.dylib.dylib", "{0}.dylib", OS.OSX);
ValidateNativeLibraryResolutions("{0}.so.so", "{0}.so", OS.Linux);
}
public void TestNameWithSuffixAndPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("lib{0}", "{0}.dll", 0);
ValidateNativeLibraryResolutions("lib{0}", "{0}.dylib", 0);
ValidateNativeLibraryResolutions("lib{0}", "{0}.so", 0);
}
public void TestNameWithSuffixAndPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("lib{0}.dll", "{0}.dll", OS.OSX | OS.Linux);
ValidateNativeLibraryResolutions("lib{0}.dylib", "{0}.dylib", OS.OSX | OS.Linux);
ValidateNativeLibraryResolutions("lib{0}.so", "{0}.so", OS.OSX | OS.Linux);
}
public void TestRelativeNameWithSuffixAndPrefixAndSuffix()
{
// The lib prefix is not added if the lookup is a relative path
ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.dll", "{0}.dll", 0);
ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.dylib", "{0}.dylib", 0);
ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.so", "{0}.so", 0);
}
public void TestNameWithPrefixAndNoPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("{0}", "lib{0}", 0);
}
public void TestNameWithPrefixAndPrefixAndNoSuffix()
{
ValidateNativeLibraryResolutions("lib{0}", "lib{0}", OS.Windows | OS.OSX | OS.Linux);
}
public void TestNameWithPrefixAndNoPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("{0}.dll", "lib{0}", 0);
ValidateNativeLibraryResolutions("{0}.dylib", "lib{0}", 0);
ValidateNativeLibraryResolutions("{0}.so", "lib{0}", 0);
}
public void TestNameWithPrefixAndPrefixAndSuffix()
{
ValidateNativeLibraryResolutions("lib{0}.dll", "lib{0}", OS.Windows);
ValidateNativeLibraryResolutions("lib{0}.dylib", "lib{0}", OS.OSX);
ValidateNativeLibraryResolutions("lib{0}.so", "lib{0}", OS.Linux);
}
public void TestWindowsAddsSuffixEvenWithOnePresent()
{
ValidateNativeLibraryResolutions("{0}.ext.dll", "{0}.ext", OS.Windows);
}
public void TestWindowsDoesntAddSuffixWhenExectubaleIsPresent()
{
ValidateNativeLibraryResolutions("{0}.dll.dll", "{0}.dll", 0);
ValidateNativeLibraryResolutions("{0}.dll.exe", "{0}.dll", 0);
ValidateNativeLibraryResolutions("{0}.exe.dll", "{0}.exe", 0);
ValidateNativeLibraryResolutions("{0}.exe.exe", "{0}.exe", 0);
}
private void TestLookupWithSuffixPrefersUnmodifiedSuffixOnUnixes()
{
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "lib{0}.dylib", "{0}.dylib", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "lib{0}.so", "{0}.so", OS.Linux);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "{0}.dylib.dylib", "{0}.dylib", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "{0}.so.so", "{0}.so", OS.Linux);
}
private void TestLookupWithoutSuffixPrefersWithSuffixOnUnixes()
{
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "lib{0}.dylib", "{0}", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "lib{0}.so", "{0}", OS.Linux);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "{0}", "{0}", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "{0}", "{0}", OS.Linux);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.dylib", "lib{0}", "{0}", OS.OSX);
ValidateNativeLibraryResolutionsWithTwoFiles("{0}.so", "lib{0}", "{0}", OS.Linux);
}
public void TestFullPathLookupWithMatchingFileName()
{
ValidateFullPathNativeLibraryResolutions("{0}", "{0}", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("{0}.dll", "{0}.dll", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("{0}.dylib", "{0}.dylib", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("{0}.so", "{0}.so", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("lib{0}", "lib{0}", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "lib{0}.dll", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "lib{0}.dylib", OS.Windows | OS.OSX | OS.Linux);
ValidateFullPathNativeLibraryResolutions("lib{0}.so", "lib{0}.so", OS.Windows | OS.OSX | OS.Linux);
}
public void TestFullPathLookupWithDifferentFileName()
{
ValidateFullPathNativeLibraryResolutions("lib{0}", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("{0}.dll", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("{0}.dylib", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("{0}.so", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.so", "{0}", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "{0}.dll", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "{0}.dylib", 0);
ValidateFullPathNativeLibraryResolutions("lib{0}.so", "{0}.so", 0);
}
[Flags]
private enum OS
{
Windows = 0x1,
OSX = 0x2,
Linux = 0x4
}
private void ValidateNativeLibraryResolutions(
string fileNamePattern,
string lookupNamePattern,
OS resolvesOnOSes)
{
string newDirectory = Guid.NewGuid().ToString().Substring(0, 8);
string nativeLibraryPath = CreateMockFile(Path.Combine(newDirectory, string.Format(fileNamePattern, "NativeLibrary")));
ValidateNativeLibraryResolutions(
Path.GetDirectoryName(nativeLibraryPath),
nativeLibraryPath,
string.Format(lookupNamePattern, "NativeLibrary"),
resolvesOnOSes);
}
private void ValidateNativeLibraryWithRelativeLookupResolutions(
string fileNamePattern,
string lookupNamePattern,
OS resolvesOnOSes)
{
string newDirectory = Guid.NewGuid().ToString().Substring(0, 8);
string nativeLibraryPath = CreateMockFile(Path.Combine(newDirectory, string.Format(fileNamePattern, "NativeLibrary")));
ValidateNativeLibraryResolutions(
Path.GetDirectoryName(Path.GetDirectoryName(nativeLibraryPath)),
nativeLibraryPath,
Path.Combine(newDirectory, string.Format(lookupNamePattern, "NativeLibrary")),
resolvesOnOSes);
}
private void ValidateFullPathNativeLibraryResolutions(
string fileNamePattern,
string lookupNamePattern,
OS resolvesOnOSes)
{
string newDirectory = Guid.NewGuid().ToString().Substring(0, 8);
string nativeLibraryPath = CreateMockFile(Path.Combine(newDirectory, string.Format(fileNamePattern, "NativeLibrary")));
ValidateNativeLibraryResolutions(
Path.GetDirectoryName(nativeLibraryPath),
nativeLibraryPath,
Path.Combine(Path.GetDirectoryName(nativeLibraryPath), string.Format(lookupNamePattern, "NativeLibrary")),
resolvesOnOSes);
}
private void ValidateNativeLibraryResolutionsWithTwoFiles(
string fileNameToResolvePattern,
string otherFileNamePattern,
string lookupNamePattern,
OS resolvesOnOSes)
{
string newDirectory = Guid.NewGuid().ToString().Substring(0, 8);
string nativeLibraryPath = CreateMockFile(Path.Combine(newDirectory, string.Format(fileNameToResolvePattern, "NativeLibrary")));
CreateMockFile(Path.Combine(newDirectory, string.Format(otherFileNamePattern, "NativeLibrary")));
ValidateNativeLibraryResolutions(
Path.GetDirectoryName(nativeLibraryPath),
nativeLibraryPath,
string.Format(lookupNamePattern, "NativeLibrary"),
resolvesOnOSes);
}
private void ValidateNativeLibraryResolutions(
string nativeLibraryPaths,
string expectedResolvedFilePath,
string lookupName,
OS resolvesOnOSes)
{
using (HostPolicyMock.Mock_corehost_resolve_component_dependencies(
0,
"",
$"{nativeLibraryPaths}",
""))
{
AssemblyDependencyResolver resolver = new AssemblyDependencyResolver(
Path.Combine(TestBasePath, _componentAssemblyPath));
string result = resolver.ResolveUnmanagedDllToPath(lookupName);
if (OperatingSystem.IsWindows())
{
if (resolvesOnOSes.HasFlag(OS.Windows))
{
Assert.Equal(expectedResolvedFilePath, result);
}
else
{
Assert.Null(result);
}
}
else if (OperatingSystem.IsMacOS())
{
if (resolvesOnOSes.HasFlag(OS.OSX))
{
Assert.Equal(expectedResolvedFilePath, result);
}
else
{
Assert.Null(result);
}
}
else
{
if (resolvesOnOSes.HasFlag(OS.Linux))
{
Assert.Equal(expectedResolvedFilePath, result);
}
else
{
Assert.Null(result);
}
}
}
}
private string CreateMockFile(string relativePath)
{
string fullPath = Path.Combine(_componentDirectory, relativePath);
if (!File.Exists(fullPath))
{
string directory = Path.GetDirectoryName(fullPath);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
File.WriteAllText(fullPath, "Mock file");
}
return fullPath;
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/JitHelper.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Internal.TypeSystem;
using Internal.IL;
using Internal.ReadyToRunConstants;
namespace ILCompiler
{
internal class JitHelper
{
/// <summary>
/// Returns JIT helper entrypoint. JIT helpers can be either implemented by entrypoint with given mangled name or
/// by a method in class library.
/// </summary>
public static void GetEntryPoint(TypeSystemContext context, ReadyToRunHelper id, out string mangledName, out MethodDesc methodDesc)
{
mangledName = null;
methodDesc = null;
switch (id)
{
case ReadyToRunHelper.Throw:
mangledName = "RhpThrowEx";
break;
case ReadyToRunHelper.Rethrow:
mangledName = "RhpRethrow";
break;
case ReadyToRunHelper.Overflow:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowOverflowException");
break;
case ReadyToRunHelper.RngChkFail:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowIndexOutOfRangeException");
break;
case ReadyToRunHelper.FailFast:
mangledName = "RhpFallbackFailFast"; // TODO: Report stack buffer overrun
break;
case ReadyToRunHelper.ThrowNullRef:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowNullReferenceException");
break;
case ReadyToRunHelper.ThrowDivZero:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowDivideByZeroException");
break;
case ReadyToRunHelper.ThrowArgumentOutOfRange:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowArgumentOutOfRangeException");
break;
case ReadyToRunHelper.ThrowArgument:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowArgumentException");
break;
case ReadyToRunHelper.ThrowPlatformNotSupported:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowPlatformNotSupportedException");
break;
case ReadyToRunHelper.ThrowNotImplemented:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowNotImplementedException");
break;
case ReadyToRunHelper.DebugBreak:
mangledName = "RhDebugBreak";
break;
case ReadyToRunHelper.WriteBarrier:
mangledName = context.Target.Architecture == TargetArchitecture.ARM64 ? "RhpAssignRefArm64" : "RhpAssignRef";
break;
case ReadyToRunHelper.CheckedWriteBarrier:
mangledName = context.Target.Architecture == TargetArchitecture.ARM64 ? "RhpCheckedAssignRefArm64" : "RhpCheckedAssignRef";
break;
case ReadyToRunHelper.ByRefWriteBarrier:
mangledName = context.Target.Architecture == TargetArchitecture.ARM64 ? "RhpByRefAssignRefArm64" : "RhpByRefAssignRef";
break;
case ReadyToRunHelper.WriteBarrier_EAX:
mangledName = "RhpAssignRefEAX";
break;
case ReadyToRunHelper.WriteBarrier_ECX:
mangledName = "RhpAssignRefECX";
break;
case ReadyToRunHelper.CheckedWriteBarrier_EAX:
mangledName = "RhpCheckedAssignRefEAX";
break;
case ReadyToRunHelper.CheckedWriteBarrier_ECX:
mangledName = "RhpCheckedAssignRefECX";
break;
case ReadyToRunHelper.Box:
case ReadyToRunHelper.Box_Nullable:
mangledName = "RhBox";
break;
case ReadyToRunHelper.Unbox:
mangledName = "RhUnbox2";
break;
case ReadyToRunHelper.Unbox_Nullable:
mangledName = "RhUnboxNullable";
break;
case ReadyToRunHelper.NewMultiDimArr:
methodDesc = context.GetHelperEntryPoint("ArrayHelpers", "NewObjArray");
break;
case ReadyToRunHelper.NewArray:
mangledName = "RhNewArray";
break;
case ReadyToRunHelper.NewObject:
mangledName = "RhNewObject";
break;
case ReadyToRunHelper.Stelem_Ref:
mangledName = "RhpStelemRef";
break;
case ReadyToRunHelper.Ldelema_Ref:
mangledName = "RhpLdelemaRef";
break;
case ReadyToRunHelper.MemCpy:
mangledName = "memcpy"; // TODO: Null reference handling
break;
case ReadyToRunHelper.MemSet:
mangledName = "memset"; // TODO: Null reference handling
break;
case ReadyToRunHelper.GetRuntimeTypeHandle:
methodDesc = context.GetHelperEntryPoint("LdTokenHelpers", "GetRuntimeTypeHandle");
break;
case ReadyToRunHelper.GetRuntimeType:
methodDesc = context.GetHelperEntryPoint("LdTokenHelpers", "GetRuntimeType");
break;
case ReadyToRunHelper.GetRuntimeMethodHandle:
methodDesc = context.GetHelperEntryPoint("LdTokenHelpers", "GetRuntimeMethodHandle");
break;
case ReadyToRunHelper.GetRuntimeFieldHandle:
methodDesc = context.GetHelperEntryPoint("LdTokenHelpers", "GetRuntimeFieldHandle");
break;
case ReadyToRunHelper.AreTypesEquivalent:
mangledName = "RhTypeCast_AreTypesEquivalent";
break;
case ReadyToRunHelper.Lng2Dbl:
mangledName = "RhpLng2Dbl";
break;
case ReadyToRunHelper.ULng2Dbl:
mangledName = "RhpULng2Dbl";
break;
case ReadyToRunHelper.Dbl2Lng:
mangledName = "RhpDbl2Lng";
break;
case ReadyToRunHelper.Dbl2ULng:
mangledName = "RhpDbl2ULng";
break;
case ReadyToRunHelper.Dbl2Int:
mangledName = "RhpDbl2Int";
break;
case ReadyToRunHelper.Dbl2UInt:
mangledName = "RhpDbl2UInt";
break;
case ReadyToRunHelper.Dbl2IntOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "Dbl2IntOvf");
break;
case ReadyToRunHelper.Dbl2UIntOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "Dbl2UIntOvf");
break;
case ReadyToRunHelper.Dbl2LngOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "Dbl2LngOvf");
break;
case ReadyToRunHelper.Dbl2ULngOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "Dbl2ULngOvf");
break;
case ReadyToRunHelper.DblRem:
mangledName = "RhpDblRem";
break;
case ReadyToRunHelper.FltRem:
mangledName = "RhpFltRem";
break;
case ReadyToRunHelper.DblRound:
mangledName = "RhpDblRound";
break;
case ReadyToRunHelper.FltRound:
mangledName = "RhpFltRound";
break;
case ReadyToRunHelper.LMul:
mangledName = "RhpLMul";
break;
case ReadyToRunHelper.LMulOfv:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "LMulOvf");
break;
case ReadyToRunHelper.ULMulOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "ULMulOvf");
break;
case ReadyToRunHelper.Mod:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "IMod");
break;
case ReadyToRunHelper.UMod:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "UMod");
break;
case ReadyToRunHelper.ULMod:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "ULMod");
break;
case ReadyToRunHelper.LMod:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "LMod");
break;
case ReadyToRunHelper.Div:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "IDiv");
break;
case ReadyToRunHelper.UDiv:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "UDiv");
break;
case ReadyToRunHelper.ULDiv:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "ULDiv");
break;
case ReadyToRunHelper.LDiv:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "LDiv");
break;
case ReadyToRunHelper.LRsz:
mangledName = "RhpLRsz";
break;
case ReadyToRunHelper.LRsh:
mangledName = "RhpLRsh";
break;
case ReadyToRunHelper.LLsh:
mangledName = "RhpLLsh";
break;
case ReadyToRunHelper.PInvokeBegin:
mangledName = "RhpPInvoke";
break;
case ReadyToRunHelper.PInvokeEnd:
mangledName = "RhpPInvokeReturn";
break;
case ReadyToRunHelper.ReversePInvokeEnter:
mangledName = "RhpReversePInvoke";
break;
case ReadyToRunHelper.ReversePInvokeExit:
mangledName = "RhpReversePInvokeReturn";
break;
case ReadyToRunHelper.CheckCastAny:
mangledName = "RhTypeCast_CheckCast";
break;
case ReadyToRunHelper.CheckInstanceAny:
mangledName = "RhTypeCast_IsInstanceOf";
break;
case ReadyToRunHelper.CheckCastInterface:
mangledName = "RhTypeCast_CheckCastInterface";
break;
case ReadyToRunHelper.CheckInstanceInterface:
mangledName = "RhTypeCast_IsInstanceOfInterface";
break;
case ReadyToRunHelper.CheckCastClass:
mangledName = "RhTypeCast_CheckCastClass";
break;
case ReadyToRunHelper.CheckInstanceClass:
mangledName = "RhTypeCast_IsInstanceOfClass";
break;
case ReadyToRunHelper.CheckCastArray:
mangledName = "RhTypeCast_CheckCastArray";
break;
case ReadyToRunHelper.CheckInstanceArray:
mangledName = "RhTypeCast_IsInstanceOfArray";
break;
case ReadyToRunHelper.MonitorEnter:
methodDesc = context.GetHelperEntryPoint("SynchronizedMethodHelpers", "MonitorEnter");
break;
case ReadyToRunHelper.MonitorExit:
methodDesc = context.GetHelperEntryPoint("SynchronizedMethodHelpers", "MonitorExit");
break;
case ReadyToRunHelper.MonitorEnterStatic:
methodDesc = context.GetHelperEntryPoint("SynchronizedMethodHelpers", "MonitorEnterStatic");
break;
case ReadyToRunHelper.MonitorExitStatic:
methodDesc = context.GetHelperEntryPoint("SynchronizedMethodHelpers", "MonitorExitStatic");
break;
case ReadyToRunHelper.GVMLookupForSlot:
methodDesc = context.SystemModule.GetKnownType("System.Runtime", "TypeLoaderExports").GetKnownMethod("GVMLookupForSlot", null);
break;
case ReadyToRunHelper.TypeHandleToRuntimeType:
methodDesc = context.GetHelperEntryPoint("TypedReferenceHelpers", "TypeHandleToRuntimeTypeMaybeNull");
break;
case ReadyToRunHelper.GetRefAny:
methodDesc = context.GetHelperEntryPoint("TypedReferenceHelpers", "GetRefAny");
break;
case ReadyToRunHelper.TypeHandleToRuntimeTypeHandle:
methodDesc = context.GetHelperEntryPoint("TypedReferenceHelpers", "TypeHandleToRuntimeTypeHandleMaybeNull");
break;
case ReadyToRunHelper.GetCurrentManagedThreadId:
methodDesc = context.SystemModule.GetKnownType("System", "Environment").GetKnownMethod("get_CurrentManagedThreadId", null);
break;
default:
throw new NotImplementedException(id.ToString());
}
}
//
// These methods are static compiler equivalent of RhGetRuntimeHelperForType
//
public static string GetNewObjectHelperForType(TypeDesc type)
{
if (type.RequiresAlign8())
{
if (type.HasFinalizer)
return "RhpNewFinalizableAlign8";
if (type.IsValueType)
return "RhpNewFastMisalign";
return "RhpNewFastAlign8";
}
if (type.HasFinalizer)
return "RhpNewFinalizable";
return "RhpNewFast";
}
public static string GetNewArrayHelperForType(TypeDesc type)
{
if (type.RequiresAlign8())
return "RhpNewArrayAlign8";
return "RhpNewArray";
}
public static string GetCastingHelperNameForType(TypeDesc type, bool throwing)
{
if (type.IsArray)
return throwing ? "RhTypeCast_CheckCastArray" : "RhTypeCast_IsInstanceOfArray";
if (type.IsInterface)
return throwing ? "RhTypeCast_CheckCastInterface" : "RhTypeCast_IsInstanceOfInterface";
if (type.IsDefType)
return throwing ? "RhTypeCast_CheckCastClass" : "RhTypeCast_IsInstanceOfClass";
// No specialized helper for the rest of the types because they don't make much sense anyway.
return throwing ? "RhTypeCast_CheckCast" : "RhTypeCast_IsInstanceOf";
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Internal.TypeSystem;
using Internal.IL;
using Internal.ReadyToRunConstants;
namespace ILCompiler
{
internal class JitHelper
{
/// <summary>
/// Returns JIT helper entrypoint. JIT helpers can be either implemented by entrypoint with given mangled name or
/// by a method in class library.
/// </summary>
public static void GetEntryPoint(TypeSystemContext context, ReadyToRunHelper id, out string mangledName, out MethodDesc methodDesc)
{
mangledName = null;
methodDesc = null;
switch (id)
{
case ReadyToRunHelper.Throw:
mangledName = "RhpThrowEx";
break;
case ReadyToRunHelper.Rethrow:
mangledName = "RhpRethrow";
break;
case ReadyToRunHelper.Overflow:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowOverflowException");
break;
case ReadyToRunHelper.RngChkFail:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowIndexOutOfRangeException");
break;
case ReadyToRunHelper.FailFast:
mangledName = "RhpFallbackFailFast"; // TODO: Report stack buffer overrun
break;
case ReadyToRunHelper.ThrowNullRef:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowNullReferenceException");
break;
case ReadyToRunHelper.ThrowDivZero:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowDivideByZeroException");
break;
case ReadyToRunHelper.ThrowArgumentOutOfRange:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowArgumentOutOfRangeException");
break;
case ReadyToRunHelper.ThrowArgument:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowArgumentException");
break;
case ReadyToRunHelper.ThrowPlatformNotSupported:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowPlatformNotSupportedException");
break;
case ReadyToRunHelper.ThrowNotImplemented:
methodDesc = context.GetHelperEntryPoint("ThrowHelpers", "ThrowNotImplementedException");
break;
case ReadyToRunHelper.DebugBreak:
mangledName = "RhDebugBreak";
break;
case ReadyToRunHelper.WriteBarrier:
mangledName = context.Target.Architecture == TargetArchitecture.ARM64 ? "RhpAssignRefArm64" : "RhpAssignRef";
break;
case ReadyToRunHelper.CheckedWriteBarrier:
mangledName = context.Target.Architecture == TargetArchitecture.ARM64 ? "RhpCheckedAssignRefArm64" : "RhpCheckedAssignRef";
break;
case ReadyToRunHelper.ByRefWriteBarrier:
mangledName = context.Target.Architecture == TargetArchitecture.ARM64 ? "RhpByRefAssignRefArm64" : "RhpByRefAssignRef";
break;
case ReadyToRunHelper.WriteBarrier_EAX:
mangledName = "RhpAssignRefEAX";
break;
case ReadyToRunHelper.WriteBarrier_ECX:
mangledName = "RhpAssignRefECX";
break;
case ReadyToRunHelper.CheckedWriteBarrier_EAX:
mangledName = "RhpCheckedAssignRefEAX";
break;
case ReadyToRunHelper.CheckedWriteBarrier_ECX:
mangledName = "RhpCheckedAssignRefECX";
break;
case ReadyToRunHelper.Box:
case ReadyToRunHelper.Box_Nullable:
mangledName = "RhBox";
break;
case ReadyToRunHelper.Unbox:
mangledName = "RhUnbox2";
break;
case ReadyToRunHelper.Unbox_Nullable:
mangledName = "RhUnboxNullable";
break;
case ReadyToRunHelper.NewMultiDimArr:
methodDesc = context.GetHelperEntryPoint("ArrayHelpers", "NewObjArray");
break;
case ReadyToRunHelper.NewArray:
mangledName = "RhNewArray";
break;
case ReadyToRunHelper.NewObject:
mangledName = "RhNewObject";
break;
case ReadyToRunHelper.Stelem_Ref:
mangledName = "RhpStelemRef";
break;
case ReadyToRunHelper.Ldelema_Ref:
mangledName = "RhpLdelemaRef";
break;
case ReadyToRunHelper.MemCpy:
mangledName = "memcpy"; // TODO: Null reference handling
break;
case ReadyToRunHelper.MemSet:
mangledName = "memset"; // TODO: Null reference handling
break;
case ReadyToRunHelper.GetRuntimeTypeHandle:
methodDesc = context.GetHelperEntryPoint("LdTokenHelpers", "GetRuntimeTypeHandle");
break;
case ReadyToRunHelper.GetRuntimeType:
methodDesc = context.GetHelperEntryPoint("LdTokenHelpers", "GetRuntimeType");
break;
case ReadyToRunHelper.GetRuntimeMethodHandle:
methodDesc = context.GetHelperEntryPoint("LdTokenHelpers", "GetRuntimeMethodHandle");
break;
case ReadyToRunHelper.GetRuntimeFieldHandle:
methodDesc = context.GetHelperEntryPoint("LdTokenHelpers", "GetRuntimeFieldHandle");
break;
case ReadyToRunHelper.AreTypesEquivalent:
mangledName = "RhTypeCast_AreTypesEquivalent";
break;
case ReadyToRunHelper.Lng2Dbl:
mangledName = "RhpLng2Dbl";
break;
case ReadyToRunHelper.ULng2Dbl:
mangledName = "RhpULng2Dbl";
break;
case ReadyToRunHelper.Dbl2Lng:
mangledName = "RhpDbl2Lng";
break;
case ReadyToRunHelper.Dbl2ULng:
mangledName = "RhpDbl2ULng";
break;
case ReadyToRunHelper.Dbl2Int:
mangledName = "RhpDbl2Int";
break;
case ReadyToRunHelper.Dbl2UInt:
mangledName = "RhpDbl2UInt";
break;
case ReadyToRunHelper.Dbl2IntOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "Dbl2IntOvf");
break;
case ReadyToRunHelper.Dbl2UIntOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "Dbl2UIntOvf");
break;
case ReadyToRunHelper.Dbl2LngOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "Dbl2LngOvf");
break;
case ReadyToRunHelper.Dbl2ULngOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "Dbl2ULngOvf");
break;
case ReadyToRunHelper.DblRem:
mangledName = "RhpDblRem";
break;
case ReadyToRunHelper.FltRem:
mangledName = "RhpFltRem";
break;
case ReadyToRunHelper.DblRound:
mangledName = "RhpDblRound";
break;
case ReadyToRunHelper.FltRound:
mangledName = "RhpFltRound";
break;
case ReadyToRunHelper.LMul:
mangledName = "RhpLMul";
break;
case ReadyToRunHelper.LMulOfv:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "LMulOvf");
break;
case ReadyToRunHelper.ULMulOvf:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "ULMulOvf");
break;
case ReadyToRunHelper.Mod:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "IMod");
break;
case ReadyToRunHelper.UMod:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "UMod");
break;
case ReadyToRunHelper.ULMod:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "ULMod");
break;
case ReadyToRunHelper.LMod:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "LMod");
break;
case ReadyToRunHelper.Div:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "IDiv");
break;
case ReadyToRunHelper.UDiv:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "UDiv");
break;
case ReadyToRunHelper.ULDiv:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "ULDiv");
break;
case ReadyToRunHelper.LDiv:
methodDesc = context.GetHelperEntryPoint("MathHelpers", "LDiv");
break;
case ReadyToRunHelper.LRsz:
mangledName = "RhpLRsz";
break;
case ReadyToRunHelper.LRsh:
mangledName = "RhpLRsh";
break;
case ReadyToRunHelper.LLsh:
mangledName = "RhpLLsh";
break;
case ReadyToRunHelper.PInvokeBegin:
mangledName = "RhpPInvoke";
break;
case ReadyToRunHelper.PInvokeEnd:
mangledName = "RhpPInvokeReturn";
break;
case ReadyToRunHelper.ReversePInvokeEnter:
mangledName = "RhpReversePInvoke";
break;
case ReadyToRunHelper.ReversePInvokeExit:
mangledName = "RhpReversePInvokeReturn";
break;
case ReadyToRunHelper.CheckCastAny:
mangledName = "RhTypeCast_CheckCast";
break;
case ReadyToRunHelper.CheckInstanceAny:
mangledName = "RhTypeCast_IsInstanceOf";
break;
case ReadyToRunHelper.CheckCastInterface:
mangledName = "RhTypeCast_CheckCastInterface";
break;
case ReadyToRunHelper.CheckInstanceInterface:
mangledName = "RhTypeCast_IsInstanceOfInterface";
break;
case ReadyToRunHelper.CheckCastClass:
mangledName = "RhTypeCast_CheckCastClass";
break;
case ReadyToRunHelper.CheckInstanceClass:
mangledName = "RhTypeCast_IsInstanceOfClass";
break;
case ReadyToRunHelper.CheckCastArray:
mangledName = "RhTypeCast_CheckCastArray";
break;
case ReadyToRunHelper.CheckInstanceArray:
mangledName = "RhTypeCast_IsInstanceOfArray";
break;
case ReadyToRunHelper.MonitorEnter:
methodDesc = context.GetHelperEntryPoint("SynchronizedMethodHelpers", "MonitorEnter");
break;
case ReadyToRunHelper.MonitorExit:
methodDesc = context.GetHelperEntryPoint("SynchronizedMethodHelpers", "MonitorExit");
break;
case ReadyToRunHelper.MonitorEnterStatic:
methodDesc = context.GetHelperEntryPoint("SynchronizedMethodHelpers", "MonitorEnterStatic");
break;
case ReadyToRunHelper.MonitorExitStatic:
methodDesc = context.GetHelperEntryPoint("SynchronizedMethodHelpers", "MonitorExitStatic");
break;
case ReadyToRunHelper.GVMLookupForSlot:
methodDesc = context.SystemModule.GetKnownType("System.Runtime", "TypeLoaderExports").GetKnownMethod("GVMLookupForSlot", null);
break;
case ReadyToRunHelper.TypeHandleToRuntimeType:
methodDesc = context.GetHelperEntryPoint("TypedReferenceHelpers", "TypeHandleToRuntimeTypeMaybeNull");
break;
case ReadyToRunHelper.GetRefAny:
methodDesc = context.GetHelperEntryPoint("TypedReferenceHelpers", "GetRefAny");
break;
case ReadyToRunHelper.TypeHandleToRuntimeTypeHandle:
methodDesc = context.GetHelperEntryPoint("TypedReferenceHelpers", "TypeHandleToRuntimeTypeHandleMaybeNull");
break;
case ReadyToRunHelper.GetCurrentManagedThreadId:
methodDesc = context.SystemModule.GetKnownType("System", "Environment").GetKnownMethod("get_CurrentManagedThreadId", null);
break;
default:
throw new NotImplementedException(id.ToString());
}
}
//
// These methods are static compiler equivalent of RhGetRuntimeHelperForType
//
public static string GetNewObjectHelperForType(TypeDesc type)
{
if (type.RequiresAlign8())
{
if (type.HasFinalizer)
return "RhpNewFinalizableAlign8";
if (type.IsValueType)
return "RhpNewFastMisalign";
return "RhpNewFastAlign8";
}
if (type.HasFinalizer)
return "RhpNewFinalizable";
return "RhpNewFast";
}
public static string GetNewArrayHelperForType(TypeDesc type)
{
if (type.RequiresAlign8())
return "RhpNewArrayAlign8";
return "RhpNewArray";
}
public static string GetCastingHelperNameForType(TypeDesc type, bool throwing)
{
if (type.IsArray)
return throwing ? "RhTypeCast_CheckCastArray" : "RhTypeCast_IsInstanceOfArray";
if (type.IsInterface)
return throwing ? "RhTypeCast_CheckCastInterface" : "RhTypeCast_IsInstanceOfInterface";
if (type.IsDefType)
return throwing ? "RhTypeCast_CheckCastClass" : "RhTypeCast_IsInstanceOfClass";
// No specialized helper for the rest of the types because they don't make much sense anyway.
return throwing ? "RhTypeCast_CheckCast" : "RhTypeCast_IsInstanceOf";
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Reflection.PortableExecutable;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using Microsoft.CodeAnalysis.Debugging;
using System.IO.Compression;
using System.Reflection;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Text;
namespace Microsoft.WebAssembly.Diagnostics
{
internal static class PortableCustomDebugInfoKinds
{
public static readonly Guid AsyncMethodSteppingInformationBlob = new Guid("54FD2AC5-E925-401A-9C2A-F94F171072F8");
public static readonly Guid StateMachineHoistedLocalScopes = new Guid("6DA9A61E-F8C7-4874-BE62-68BC5630DF71");
public static readonly Guid DynamicLocalVariables = new Guid("83C563C4-B4F3-47D5-B824-BA5441477EA8");
public static readonly Guid TupleElementNames = new Guid("ED9FDF71-8879-4747-8ED3-FE5EDE3CE710");
public static readonly Guid DefaultNamespace = new Guid("58b2eab6-209f-4e4e-a22c-b2d0f910c782");
public static readonly Guid EncLocalSlotMap = new Guid("755F52A8-91C5-45BE-B4B8-209571E552BD");
public static readonly Guid EncLambdaAndClosureMap = new Guid("A643004C-0240-496F-A783-30D64F4979DE");
public static readonly Guid SourceLink = new Guid("CC110556-A091-4D38-9FEC-25AB9A351A6A");
public static readonly Guid EmbeddedSource = new Guid("0E8A571B-6926-466E-B4AD-8AB04611F5FE");
public static readonly Guid CompilationMetadataReferences = new Guid("7E4D4708-096E-4C5C-AEDA-CB10BA6A740D");
public static readonly Guid CompilationOptions = new Guid("B5FEEC05-8CD0-4A83-96DA-466284BB4BD8");
}
internal static class HashKinds
{
public static readonly Guid SHA1 = new Guid("ff1816ec-aa5e-4d10-87f7-6f4963833460");
public static readonly Guid SHA256 = new Guid("8829d00f-11b8-4213-878b-770e8597ac16");
}
internal class BreakpointRequest
{
public string Id { get; private set; }
public string Assembly { get; private set; }
public string File { get; private set; }
public int Line { get; private set; }
public int Column { get; private set; }
public string Condition { get; private set; }
public MethodInfo Method { get; set; }
private JObject request;
public bool IsResolved => Assembly != null;
public List<Breakpoint> Locations { get; set; } = new List<Breakpoint>();
public override string ToString() => $"BreakpointRequest Assembly: {Assembly} File: {File} Line: {Line} Column: {Column}";
public object AsSetBreakpointByUrlResponse(IEnumerable<object> jsloc) => new { breakpointId = Id, locations = Locations.Select(l => l.Location.AsLocation()).Concat(jsloc) };
public BreakpointRequest()
{ }
public BreakpointRequest(string id, MethodInfo method)
{
Id = id;
Method = method;
}
public BreakpointRequest(string id, JObject request)
{
Id = id;
this.request = request;
Condition = request?["condition"]?.Value<string>();
}
public static BreakpointRequest Parse(string id, JObject args)
{
return new BreakpointRequest(id, args);
}
public BreakpointRequest Clone() => new BreakpointRequest { Id = Id, request = request };
public bool IsMatch(SourceFile sourceFile)
{
string url = request?["url"]?.Value<string>();
if (url == null)
{
string urlRegex = request?["urlRegex"].Value<string>();
var regex = new Regex(urlRegex);
return regex.IsMatch(sourceFile.Url.ToString()) || regex.IsMatch(sourceFile.DocUrl);
}
return sourceFile.Url.ToString() == url || sourceFile.DotNetUrl == url;
}
public bool TryResolve(SourceFile sourceFile)
{
if (!IsMatch(sourceFile))
return false;
int? line = request?["lineNumber"]?.Value<int>();
int? column = request?["columnNumber"]?.Value<int>();
if (line == null || column == null)
return false;
Assembly = sourceFile.AssemblyName;
File = sourceFile.DebuggerFileName;
Line = line.Value;
Column = column.Value;
return true;
}
public bool TryResolve(DebugStore store)
{
if (request == null || store == null)
return false;
return store.AllSources().FirstOrDefault(source => TryResolve(source)) != null;
}
}
internal class VarInfo
{
public VarInfo(LocalVariable v, MetadataReader pdbReader)
{
this.Name = pdbReader.GetString(v.Name);
this.Index = v.Index;
}
public VarInfo(Parameter p, MetadataReader pdbReader)
{
this.Name = pdbReader.GetString(p.Name);
this.Index = (p.SequenceNumber) * -1;
}
public string Name { get; }
public int Index { get; }
public override string ToString() => $"(var-info [{Index}] '{Name}')";
}
internal class IlLocation
{
public IlLocation(MethodInfo method, int offset)
{
Method = method;
Offset = offset;
}
public MethodInfo Method { get; }
public int Offset { get; }
}
internal class SourceLocation
{
private SourceId id;
private int line;
private int column;
private IlLocation ilLocation;
public SourceLocation(SourceId id, int line, int column)
{
this.id = id;
this.line = line;
this.column = column;
}
public SourceLocation(MethodInfo mi, SequencePoint sp)
{
this.id = mi.SourceId;
this.line = sp.StartLine - 1;
this.column = sp.StartColumn - 1;
this.ilLocation = new IlLocation(mi, sp.Offset);
}
public SourceId Id { get => id; }
public int Line { get => line; }
public int Column { get => column; }
public IlLocation IlLocation => this.ilLocation;
public override string ToString() => $"{id}:{Line}:{Column}";
public static SourceLocation Parse(JObject obj)
{
if (obj == null)
return null;
if (!SourceId.TryParse(obj["scriptId"]?.Value<string>(), out SourceId id))
return null;
int? line = obj["lineNumber"]?.Value<int>();
int? column = obj["columnNumber"]?.Value<int>();
if (id == null || line == null || column == null)
return null;
return new SourceLocation(id, line.Value, column.Value);
}
internal class LocationComparer : EqualityComparer<SourceLocation>
{
public override bool Equals(SourceLocation l1, SourceLocation l2)
{
if (l1 == null && l2 == null)
return true;
else if (l1 == null || l2 == null)
return false;
return (l1.Line == l2.Line &&
l1.Column == l2.Column &&
l1.Id == l2.Id);
}
public override int GetHashCode(SourceLocation loc)
{
int hCode = loc.Line ^ loc.Column;
return loc.Id.GetHashCode() ^ hCode.GetHashCode();
}
}
internal object AsLocation() => new
{
scriptId = id.ToString(),
lineNumber = line,
columnNumber = column
};
}
internal class SourceId
{
private const string Scheme = "dotnet://";
private readonly int assembly, document;
public int Assembly => assembly;
public int Document => document;
internal SourceId(int assembly, int document)
{
this.assembly = assembly;
this.document = document;
}
public SourceId(string id)
{
if (!TryParse(id, out assembly, out document))
throw new ArgumentException("invalid source identifier", nameof(id));
}
public static bool TryParse(string id, out SourceId source)
{
source = null;
if (!TryParse(id, out int assembly, out int document))
return false;
source = new SourceId(assembly, document);
return true;
}
private static bool TryParse(string id, out int assembly, out int document)
{
assembly = document = 0;
if (id == null || !id.StartsWith(Scheme, StringComparison.Ordinal))
return false;
string[] sp = id.Substring(Scheme.Length).Split('_');
if (sp.Length != 2)
return false;
if (!int.TryParse(sp[0], out assembly))
return false;
if (!int.TryParse(sp[1], out document))
return false;
return true;
}
public override string ToString() => $"{Scheme}{assembly}_{document}";
public override bool Equals(object obj)
{
if (obj == null)
return false;
SourceId that = obj as SourceId;
return that.assembly == this.assembly && that.document == this.document;
}
public override int GetHashCode() => assembly.GetHashCode() ^ document.GetHashCode();
public static bool operator ==(SourceId a, SourceId b) => a is null ? b is null : a.Equals(b);
public static bool operator !=(SourceId a, SourceId b) => !a.Equals(b);
}
internal class MethodInfo
{
private MethodDefinition methodDef;
private SourceFile source;
public SourceId SourceId => source.SourceId;
public string Name { get; }
public MethodDebugInformation DebugInformation;
public MethodDefinitionHandle methodDefHandle;
private MetadataReader pdbMetadataReader;
public SourceLocation StartLocation { get; set; }
public SourceLocation EndLocation { get; set; }
public AssemblyInfo Assembly { get; }
public int Token { get; }
internal bool IsEnCMethod;
internal LocalScopeHandleCollection localScopes;
public bool IsStatic() => (methodDef.Attributes & MethodAttributes.Static) != 0;
public int IsAsync { get; set; }
public DebuggerAttributesInfo DebuggerAttrInfo { get; set; }
public TypeInfo TypeInfo { get; }
public bool HasSequencePoints { get => !DebugInformation.SequencePointsBlob.IsNil; }
private ParameterInfo[] _parametersInfo;
public MethodInfo(AssemblyInfo assembly, MethodDefinitionHandle methodDefHandle, int token, SourceFile source, TypeInfo type, MetadataReader asmMetadataReader, MetadataReader pdbMetadataReader)
{
this.IsAsync = -1;
this.Assembly = assembly;
this.methodDef = asmMetadataReader.GetMethodDefinition(methodDefHandle);
this.DebugInformation = pdbMetadataReader.GetMethodDebugInformation(methodDefHandle.ToDebugInformationHandle());
this.source = source;
this.Token = token;
this.methodDefHandle = methodDefHandle;
this.Name = asmMetadataReader.GetString(methodDef.Name);
this.pdbMetadataReader = pdbMetadataReader;
this.IsEnCMethod = false;
this.TypeInfo = type;
if (HasSequencePoints)
{
var sps = DebugInformation.GetSequencePoints();
SequencePoint start = sps.First();
SequencePoint end = sps.First();
foreach (SequencePoint sp in sps)
{
if (sp.IsHidden)
continue;
if (sp.StartLine < start.StartLine)
start = sp;
else if (sp.StartLine == start.StartLine && sp.StartColumn < start.StartColumn)
start = sp;
if (end.EndLine == SequencePoint.HiddenLine)
end = sp;
if (sp.EndLine > end.EndLine)
end = sp;
else if (sp.EndLine == end.EndLine && sp.EndColumn > end.EndColumn)
end = sp;
}
StartLocation = new SourceLocation(this, start);
EndLocation = new SourceLocation(this, end);
DebuggerAttrInfo = new DebuggerAttributesInfo();
foreach (var cattr in methodDef.GetCustomAttributes())
{
var ctorHandle = asmMetadataReader.GetCustomAttribute(cattr).Constructor;
if (ctorHandle.Kind == HandleKind.MemberReference)
{
var container = asmMetadataReader.GetMemberReference((MemberReferenceHandle)ctorHandle).Parent;
var name = asmMetadataReader.GetString(asmMetadataReader.GetTypeReference((TypeReferenceHandle)container).Name);
switch (name)
{
case "DebuggerHiddenAttribute":
DebuggerAttrInfo.HasDebuggerHidden = true;
break;
case "DebuggerStepThroughAttribute":
DebuggerAttrInfo.HasStepThrough = true;
break;
case "DebuggerNonUserCodeAttribute":
DebuggerAttrInfo.HasNonUserCode = true;
break;
case "DebuggerStepperBoundaryAttribute":
DebuggerAttrInfo.HasStepperBoundary = true;
break;
}
}
}
DebuggerAttrInfo.ClearInsignificantAttrFlags();
}
localScopes = pdbMetadataReader.GetLocalScopes(methodDefHandle);
}
public ParameterInfo[] GetParametersInfo()
{
if (_parametersInfo != null)
return _parametersInfo;
var paramsHandles = methodDef.GetParameters().ToArray();
var paramsCnt = paramsHandles.Length;
var paramsInfo = new ParameterInfo[paramsCnt];
for (int i = 0; i < paramsCnt; i++)
{
var parameter = Assembly.asmMetadataReader.GetParameter(paramsHandles[i]);
var paramName = Assembly.asmMetadataReader.GetString(parameter.Name);
var isOptional = parameter.Attributes.HasFlag(ParameterAttributes.Optional) && parameter.Attributes.HasFlag(ParameterAttributes.HasDefault);
if (!isOptional)
{
paramsInfo[i] = new ParameterInfo(paramName);
continue;
}
var constantHandle = parameter.GetDefaultValue();
var blobHandle = Assembly.asmMetadataReader.GetConstant(constantHandle);
var paramBytes = Assembly.asmMetadataReader.GetBlobBytes(blobHandle.Value);
paramsInfo[i] = new ParameterInfo(
paramName,
blobHandle.TypeCode,
paramBytes
);
}
_parametersInfo = paramsInfo;
return paramsInfo;
}
public void UpdateEnC(MetadataReader asmMetadataReader, MetadataReader pdbMetadataReaderParm, int method_idx)
{
this.DebugInformation = pdbMetadataReaderParm.GetMethodDebugInformation(MetadataTokens.MethodDebugInformationHandle(method_idx));
this.pdbMetadataReader = pdbMetadataReaderParm;
this.IsEnCMethod = true;
if (HasSequencePoints)
{
var sps = DebugInformation.GetSequencePoints();
SequencePoint start = sps.First();
SequencePoint end = sps.First();
foreach (SequencePoint sp in sps)
{
if (sp.StartLine < start.StartLine)
start = sp;
else if (sp.StartLine == start.StartLine && sp.StartColumn < start.StartColumn)
start = sp;
if (sp.EndLine > end.EndLine)
end = sp;
else if (sp.EndLine == end.EndLine && sp.EndColumn > end.EndColumn)
end = sp;
}
StartLocation = new SourceLocation(this, start);
EndLocation = new SourceLocation(this, end);
}
localScopes = pdbMetadataReader.GetLocalScopes(MetadataTokens.MethodDefinitionHandle(method_idx));
}
public SourceLocation GetLocationByIl(int pos)
{
SequencePoint? prev = null;
if (HasSequencePoints) {
foreach (SequencePoint sp in DebugInformation.GetSequencePoints())
{
if (sp.Offset > pos)
{
//get the earlier line number if the offset is in a hidden sequence point and has a earlier line number available
// if is doesn't continue and get the next line number that is not in a hidden sequence point
if (sp.IsHidden && prev == null)
continue;
break;
}
if (!sp.IsHidden)
prev = sp;
}
if (prev.HasValue)
return new SourceLocation(this, prev.Value);
}
return null;
}
public VarInfo[] GetLiveVarsAt(int offset)
{
var res = new List<VarInfo>();
foreach (var parameterHandle in methodDef.GetParameters())
{
var parameter = Assembly.asmMetadataReader.GetParameter(parameterHandle);
res.Add(new VarInfo(parameter, Assembly.asmMetadataReader));
}
foreach (var localScopeHandle in localScopes)
{
var localScope = pdbMetadataReader.GetLocalScope(localScopeHandle);
if (localScope.StartOffset <= offset && localScope.EndOffset > offset)
{
var localVariables = localScope.GetLocalVariables();
foreach (var localVariableHandle in localVariables)
{
var localVariable = pdbMetadataReader.GetLocalVariable(localVariableHandle);
if (localVariable.Attributes != LocalVariableAttributes.DebuggerHidden)
res.Add(new VarInfo(localVariable, pdbMetadataReader));
}
}
}
return res.ToArray();
}
public override string ToString() => "MethodInfo(" + Name + ")";
public class DebuggerAttributesInfo
{
internal bool HasDebuggerHidden { get; set; }
internal bool HasStepThrough { get; set; }
internal bool HasNonUserCode { get; set; }
public bool HasStepperBoundary { get; internal set; }
internal void ClearInsignificantAttrFlags()
{
// hierarchy: hidden > stepThrough > nonUserCode > boundary
if (HasDebuggerHidden)
HasStepThrough = HasNonUserCode = HasStepperBoundary = false;
else if (HasStepThrough)
HasNonUserCode = HasStepperBoundary = false;
else if (HasNonUserCode)
HasStepperBoundary = false;
}
public bool DoAttributesAffectCallStack(bool justMyCodeEnabled)
{
return HasStepThrough ||
HasDebuggerHidden ||
HasStepperBoundary ||
(HasNonUserCode && justMyCodeEnabled);
}
public bool ShouldStepOut(EventKind eventKind)
{
return HasDebuggerHidden || (HasStepperBoundary && eventKind == EventKind.Step);
}
}
public bool IsLexicallyContainedInMethod(MethodInfo containerMethod)
=> (StartLocation.Line > containerMethod.StartLocation.Line ||
(StartLocation.Line == containerMethod.StartLocation.Line && StartLocation.Column > containerMethod.StartLocation.Column)) &&
(EndLocation.Line < containerMethod.EndLocation.Line ||
(EndLocation.Line == containerMethod.EndLocation.Line && EndLocation.Column < containerMethod.EndLocation.Column));
}
internal class ParameterInfo
{
public string Name { get; init; }
public ElementType? TypeCode { get; init; }
public object Value { get; init; }
public ParameterInfo(string name, ConstantTypeCode? typeCode = null, byte[] value = null)
{
Name = name;
if (value == null)
return;
switch (typeCode)
{
case ConstantTypeCode.Boolean:
Value = BitConverter.ToBoolean(value) ? 1 : 0;
TypeCode = ElementType.Boolean;
break;
case ConstantTypeCode.Char:
Value = (int)BitConverter.ToChar(value);
TypeCode = ElementType.Char;
break;
case ConstantTypeCode.Byte:
Value = (int)value[0];
TypeCode = ElementType.U1;
break;
case ConstantTypeCode.SByte:
Value = (uint)value[0];
TypeCode = ElementType.I1;
break;
case ConstantTypeCode.Int16:
Value = (int)BitConverter.ToUInt16(value, 0);
TypeCode = ElementType.I2;
break;
case ConstantTypeCode.UInt16:
Value = (uint)BitConverter.ToUInt16(value, 0);
TypeCode = ElementType.U2;
break;
case ConstantTypeCode.Int32:
Value = BitConverter.ToInt32(value, 0);
TypeCode = ElementType.I4;
break;
case ConstantTypeCode.UInt32:
Value = BitConverter.ToUInt32(value, 0);
TypeCode = ElementType.U4;
break;
case ConstantTypeCode.Int64:
Value = BitConverter.ToInt64(value, 0);
TypeCode = ElementType.I8;
break;
case ConstantTypeCode.UInt64:
Value = BitConverter.ToUInt64(value, 0);
TypeCode = ElementType.U8;
break;
case ConstantTypeCode.Single:
Value = BitConverter.ToSingle(value, 0);
TypeCode = ElementType.R4;
break;
case ConstantTypeCode.Double:
Value = BitConverter.ToDouble(value, 0);
TypeCode = ElementType.R8;
break;
case ConstantTypeCode.String:
Value = Encoding.Unicode.GetString(value);
TypeCode = ElementType.String;
break;
case ConstantTypeCode.NullReference:
Value = (byte)ValueTypeId.Null;
TypeCode = null;
break;
}
}
}
internal class TypeInfo
{
private readonly ILogger logger;
internal AssemblyInfo assembly;
private TypeDefinition type;
private List<MethodInfo> methods;
internal int Token { get; }
internal string Namespace { get; }
public Dictionary<string, DebuggerBrowsableState?> DebuggerBrowsableFields = new();
public Dictionary<string, DebuggerBrowsableState?> DebuggerBrowsableProperties = new();
public TypeInfo(AssemblyInfo assembly, TypeDefinitionHandle typeHandle, TypeDefinition type, ILogger logger)
{
this.logger = logger;
this.assembly = assembly;
var metadataReader = assembly.asmMetadataReader;
Token = MetadataTokens.GetToken(metadataReader, typeHandle);
this.type = type;
methods = new List<MethodInfo>();
Name = metadataReader.GetString(type.Name);
var declaringType = type;
while (declaringType.IsNested)
{
declaringType = metadataReader.GetTypeDefinition(declaringType.GetDeclaringType());
Name = metadataReader.GetString(declaringType.Name) + "." + Name;
}
Namespace = metadataReader.GetString(declaringType.Namespace);
if (Namespace.Length > 0)
FullName = Namespace + "." + Name;
else
FullName = Name;
foreach (var field in type.GetFields())
{
try
{
var fieldDefinition = metadataReader.GetFieldDefinition(field);
var fieldName = metadataReader.GetString(fieldDefinition.Name);
AppendToBrowsable(DebuggerBrowsableFields, fieldDefinition.GetCustomAttributes(), fieldName);
}
catch (Exception ex)
{
logger.LogDebug($"Failed to read browsable attributes of a field. ({ex.Message})");
continue;
}
}
foreach (var prop in type.GetProperties())
{
try
{
var propDefinition = metadataReader.GetPropertyDefinition(prop);
var propName = metadataReader.GetString(propDefinition.Name);
AppendToBrowsable(DebuggerBrowsableProperties, propDefinition.GetCustomAttributes(), propName);
}
catch (Exception ex)
{
logger.LogDebug($"Failed to read browsable attributes of a property. ({ex.Message})");
continue;
}
}
void AppendToBrowsable(Dictionary<string, DebuggerBrowsableState?> dict, CustomAttributeHandleCollection customAttrs, string fieldName)
{
foreach (var cattr in customAttrs)
{
try
{
var ctorHandle = metadataReader.GetCustomAttribute(cattr).Constructor;
if (ctorHandle.Kind != HandleKind.MemberReference)
continue;
var container = metadataReader.GetMemberReference((MemberReferenceHandle)ctorHandle).Parent;
var valueBytes = metadataReader.GetBlobBytes(metadataReader.GetCustomAttribute(cattr).Value);
var attributeName = metadataReader.GetString(metadataReader.GetTypeReference((TypeReferenceHandle)container).Name);
if (attributeName != "DebuggerBrowsableAttribute")
continue;
var state = (DebuggerBrowsableState)valueBytes[2];
if (!Enum.IsDefined(typeof(DebuggerBrowsableState), state))
continue;
dict.Add(fieldName, state);
break;
}
catch
{
continue;
}
}
}
}
public TypeInfo(AssemblyInfo assembly, string name)
{
Name = name;
FullName = name;
}
public string Name { get; }
public string FullName { get; }
public List<MethodInfo> Methods => methods;
public override string ToString() => "TypeInfo('" + FullName + "')";
}
internal class AssemblyInfo
{
private static int next_id;
private readonly int id;
private readonly ILogger logger;
private Dictionary<int, MethodInfo> methods = new Dictionary<int, MethodInfo>();
private Dictionary<string, string> sourceLinkMappings = new Dictionary<string, string>();
private readonly List<SourceFile> sources = new List<SourceFile>();
internal string Url { get; }
//The caller must keep the PEReader alive and undisposed throughout the lifetime of the metadata reader
internal PEReader peReader;
internal MetadataReader asmMetadataReader { get; }
internal MetadataReader pdbMetadataReader { get; set; }
internal List<MetadataReader> enCMetadataReader = new List<MetadataReader>();
private int debugId;
internal int PdbAge { get; }
internal System.Guid PdbGuid { get; }
internal string PdbName { get; }
internal bool PdbInformationAvailable { get; }
public bool TriedToLoadSymbolsOnDemand { get; set; }
public unsafe AssemblyInfo(MonoProxy monoProxy, SessionId sessionId, string url, byte[] assembly, byte[] pdb, CancellationToken token)
{
debugId = -1;
this.id = Interlocked.Increment(ref next_id);
using var asmStream = new MemoryStream(assembly);
peReader = new PEReader(asmStream);
var entries = peReader.ReadDebugDirectory();
if (entries.Length > 0)
{
var codeView = entries[0];
CodeViewDebugDirectoryData codeViewData = peReader.ReadCodeViewDebugDirectoryData(codeView);
PdbAge = codeViewData.Age;
PdbGuid = codeViewData.Guid;
PdbName = codeViewData.Path;
PdbInformationAvailable = true;
}
asmMetadataReader = PEReaderExtensions.GetMetadataReader(peReader);
var asmDef = asmMetadataReader.GetAssemblyDefinition();
Name = asmDef.GetAssemblyName().Name + ".dll";
if (pdb != null)
{
var pdbStream = new MemoryStream(pdb);
try
{
// MetadataReaderProvider.FromPortablePdbStream takes ownership of the stream
pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader();
}
catch (BadImageFormatException)
{
monoProxy.SendLog(sessionId, $"Warning: Unable to read debug information of: {Name} (use DebugType=Portable/Embedded)", token);
}
}
else
{
var embeddedPdbEntry = entries.FirstOrDefault(e => e.Type == DebugDirectoryEntryType.EmbeddedPortablePdb);
if (embeddedPdbEntry.DataSize != 0)
{
pdbMetadataReader = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embeddedPdbEntry).GetMetadataReader();
}
}
Populate();
}
public async Task<int> GetDebugId(MonoSDBHelper sdbAgent, CancellationToken token)
{
if (debugId > 0)
return debugId;
debugId = await sdbAgent.GetAssemblyId(Name, token);
return debugId;
}
public void SetDebugId(int id)
{
if (debugId <= 0 && debugId != id)
debugId = id;
}
public bool EnC(byte[] meta, byte[] pdb)
{
var asmStream = new MemoryStream(meta);
MetadataReader asmMetadataReader = MetadataReaderProvider.FromMetadataStream(asmStream).GetMetadataReader();
var pdbStream = new MemoryStream(pdb);
MetadataReader pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader();
enCMetadataReader.Add(asmMetadataReader);
enCMetadataReader.Add(pdbMetadataReader);
PopulateEnC(asmMetadataReader, pdbMetadataReader);
return true;
}
public AssemblyInfo(ILogger logger)
{
this.logger = logger;
}
private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pdbMetadataReaderParm)
{
int i = 1;
foreach (EntityHandle encMapHandle in asmMetadataReaderParm.GetEditAndContinueMapEntries())
{
if (encMapHandle.Kind == HandleKind.MethodDebugInformation)
{
var method = methods[asmMetadataReader.GetRowNumber(encMapHandle)];
method.UpdateEnC(asmMetadataReaderParm, pdbMetadataReaderParm, i);
i++;
}
}
}
private void Populate()
{
var d2s = new Dictionary<int, SourceFile>();
SourceFile FindSource(DocumentHandle doc, int rowid, string documentName)
{
if (d2s.TryGetValue(rowid, out SourceFile source))
return source;
var src = new SourceFile(this, sources.Count, doc, GetSourceLinkUrl(documentName), documentName);
sources.Add(src);
d2s[rowid] = src;
return src;
};
foreach (DocumentHandle dh in asmMetadataReader.Documents)
{
asmMetadataReader.GetDocument(dh);
}
if (pdbMetadataReader != null)
ProcessSourceLink();
foreach (TypeDefinitionHandle type in asmMetadataReader.TypeDefinitions)
{
var typeDefinition = asmMetadataReader.GetTypeDefinition(type);
var typeInfo = new TypeInfo(this, type, typeDefinition, logger);
TypesByName[typeInfo.FullName] = typeInfo;
TypesByToken[typeInfo.Token] = typeInfo;
if (pdbMetadataReader != null)
{
foreach (MethodDefinitionHandle method in typeDefinition.GetMethods())
{
var methodDefinition = asmMetadataReader.GetMethodDefinition(method);
if (!method.ToDebugInformationHandle().IsNil)
{
var methodDebugInformation = pdbMetadataReader.GetMethodDebugInformation(method.ToDebugInformationHandle());
if (!methodDebugInformation.Document.IsNil)
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
SourceFile source = FindSource(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
methods[asmMetadataReader.GetRowNumber(method)] = methodInfo;
if (source != null)
source.AddMethod(methodInfo);
typeInfo.Methods.Add(methodInfo);
}
}
}
}
}
}
private void ProcessSourceLink()
{
var sourceLinkDebugInfo =
(from cdiHandle in pdbMetadataReader.GetCustomDebugInformation(EntityHandle.ModuleDefinition)
let cdi = pdbMetadataReader.GetCustomDebugInformation(cdiHandle)
where pdbMetadataReader.GetGuid(cdi.Kind) == PortableCustomDebugInfoKinds.SourceLink
select pdbMetadataReader.GetBlobBytes(cdi.Value)).SingleOrDefault();
if (sourceLinkDebugInfo != null)
{
var sourceLinkContent = System.Text.Encoding.UTF8.GetString(sourceLinkDebugInfo, 0, sourceLinkDebugInfo.Length);
if (sourceLinkContent != null)
{
JToken jObject = JObject.Parse(sourceLinkContent)["documents"];
sourceLinkMappings = JsonConvert.DeserializeObject<Dictionary<string, string>>(jObject.ToString());
}
}
}
private Uri GetSourceLinkUrl(string document)
{
if (sourceLinkMappings.TryGetValue(document, out string url))
return new Uri(url);
foreach (KeyValuePair<string, string> sourceLinkDocument in sourceLinkMappings)
{
string key = sourceLinkDocument.Key;
if (!key.EndsWith("*"))
{
continue;
}
string keyTrim = key.TrimEnd('*');
if (document.StartsWith(keyTrim, StringComparison.OrdinalIgnoreCase))
{
string docUrlPart = document.Replace(keyTrim, "");
return new Uri(sourceLinkDocument.Value.TrimEnd('*') + docUrlPart);
}
}
return null;
}
public IEnumerable<SourceFile> Sources => this.sources;
public Dictionary<int, MethodInfo> Methods => this.methods;
public Dictionary<string, TypeInfo> TypesByName { get; } = new();
public Dictionary<int, TypeInfo> TypesByToken { get; } = new();
public int Id => id;
public string Name { get; }
public bool HasSymbols => pdbMetadataReader != null;
// "System.Threading", instead of "System.Threading, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
public string AssemblyNameUnqualified { get; }
public SourceFile GetDocById(int document)
{
return sources.FirstOrDefault(s => s.SourceId.Document == document);
}
public MethodInfo GetMethodByToken(int token)
{
methods.TryGetValue(token, out MethodInfo value);
return value;
}
public TypeInfo GetTypeByName(string name)
{
TypesByName.TryGetValue(name, out TypeInfo res);
return res;
}
internal void UpdatePdbInformation(Stream streamToReadFrom)
{
var pdbStream = new MemoryStream();
streamToReadFrom.CopyTo(pdbStream);
pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader();
}
}
internal class SourceFile
{
private Dictionary<int, MethodInfo> methods;
private AssemblyInfo assembly;
private int id;
private Document doc;
private DocumentHandle docHandle;
private string url;
internal SourceFile(AssemblyInfo assembly, int id, DocumentHandle docHandle, Uri sourceLinkUri, string url)
{
this.methods = new Dictionary<int, MethodInfo>();
this.SourceLinkUri = sourceLinkUri;
this.assembly = assembly;
this.id = id;
this.doc = assembly.pdbMetadataReader.GetDocument(docHandle);
this.docHandle = docHandle;
this.url = url;
this.DebuggerFileName = url.Replace("\\", "/").Replace(":", "");
var urlWithSpecialCharCodedHex = EscapeAscii(url);
this.SourceUri = new Uri((Path.IsPathRooted(url) ? "file://" : "") + urlWithSpecialCharCodedHex, UriKind.RelativeOrAbsolute);
if (SourceUri.IsFile && File.Exists(SourceUri.LocalPath))
{
this.Url = this.SourceUri.ToString();
}
else
{
this.Url = DotNetUrl;
}
}
private static string EscapeAscii(string path)
{
var builder = new StringBuilder();
foreach (char c in path)
{
switch (c)
{
case var _ when c >= 'a' && c <= 'z':
case var _ when c >= 'A' && c <= 'Z':
case var _ when char.IsDigit(c):
case var _ when c > 255:
case var _ when c == '+' || c == ':' || c == '.' || c == '-' || c == '_' || c == '~':
builder.Append(c);
break;
case var _ when c == Path.DirectorySeparatorChar:
case var _ when c == Path.AltDirectorySeparatorChar:
case var _ when c == '\\':
builder.Append(c);
break;
default:
builder.Append(string.Format($"%{((int)c):X2}"));
break;
}
}
return builder.ToString();
}
internal void AddMethod(MethodInfo mi)
{
if (!this.methods.ContainsKey(mi.Token))
{
this.methods[mi.Token] = mi;
}
}
public string DebuggerFileName { get; }
public string Url { get; }
public string AssemblyName => assembly.Name;
public string DotNetUrl => $"dotnet://{assembly.Name}/{DebuggerFileName}";
public SourceId SourceId => new SourceId(assembly.Id, this.id);
public Uri SourceLinkUri { get; }
public Uri SourceUri { get; }
public IEnumerable<MethodInfo> Methods => this.methods.Values;
public string DocUrl => url;
public (int startLine, int startColumn, int endLine, int endColumn) GetExtents()
{
MethodInfo start = Methods.OrderBy(m => m.StartLocation.Line).ThenBy(m => m.StartLocation.Column).First();
MethodInfo end = Methods.OrderByDescending(m => m.EndLocation.Line).ThenByDescending(m => m.EndLocation.Column).First();
return (start.StartLocation.Line, start.StartLocation.Column, end.EndLocation.Line, end.EndLocation.Column);
}
private async Task<MemoryStream> GetDataAsync(Uri uri, CancellationToken token)
{
var mem = new MemoryStream();
try
{
if (uri.IsFile && File.Exists(uri.LocalPath))
{
using (FileStream file = File.Open(SourceUri.LocalPath, FileMode.Open))
{
await file.CopyToAsync(mem, token).ConfigureAwait(false);
mem.Position = 0;
}
}
else if (uri.Scheme == "http" || uri.Scheme == "https")
{
using (var client = new HttpClient())
using (Stream stream = await client.GetStreamAsync(uri, token))
{
await stream.CopyToAsync(mem, token).ConfigureAwait(false);
mem.Position = 0;
}
}
}
catch (Exception)
{
return null;
}
return mem;
}
private static HashAlgorithm GetHashAlgorithm(Guid algorithm)
{
if (algorithm.Equals(HashKinds.SHA1))
#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
return SHA1.Create();
#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms
if (algorithm.Equals(HashKinds.SHA256))
return SHA256.Create();
return null;
}
private bool CheckPdbHash(byte[] computedHash)
{
var hash = assembly.pdbMetadataReader.GetBlobBytes(doc.Hash);
if (computedHash.Length != hash.Length)
return false;
for (int i = 0; i < computedHash.Length; i++)
if (computedHash[i] != hash[i])
return false;
return true;
}
private byte[] ComputePdbHash(Stream sourceStream)
{
HashAlgorithm algorithm = GetHashAlgorithm(assembly.pdbMetadataReader.GetGuid(doc.HashAlgorithm));
if (algorithm != null)
using (algorithm)
return algorithm.ComputeHash(sourceStream);
return Array.Empty<byte>();
}
public async Task<Stream> GetSourceAsync(bool checkHash, CancellationToken token = default(CancellationToken))
{
var reader = assembly.pdbMetadataReader;
byte[] bytes = (from handle in reader.GetCustomDebugInformation(docHandle)
let cdi = reader.GetCustomDebugInformation(handle)
where reader.GetGuid(cdi.Kind) == PortableCustomDebugInfoKinds.EmbeddedSource
select reader.GetBlobBytes(cdi.Value)).SingleOrDefault();
if (bytes != null)
{
int uncompressedSize = BitConverter.ToInt32(bytes, 0);
var stream = new MemoryStream(bytes, sizeof(int), bytes.Length - sizeof(int));
if (uncompressedSize != 0)
{
return new DeflateStream(stream, CompressionMode.Decompress);
}
}
foreach (Uri url in new[] { SourceUri, SourceLinkUri })
{
MemoryStream mem = await GetDataAsync(url, token).ConfigureAwait(false);
if (mem != null && mem.Length > 0 && (!checkHash || CheckPdbHash(ComputePdbHash(mem))))
{
mem.Position = 0;
return mem;
}
}
return MemoryStream.Null;
}
public object ToScriptSource(int executionContextId, object executionContextAuxData)
{
return new
{
scriptId = SourceId.ToString(),
url = Url,
executionContextId,
executionContextAuxData,
//hash: should be the v8 hash algo, managed implementation is pending
dotNetUrl = DotNetUrl,
};
}
}
internal class DebugStore
{
internal List<AssemblyInfo> assemblies = new List<AssemblyInfo>();
private readonly HttpClient client;
private readonly ILogger logger;
private readonly MonoProxy monoProxy;
public DebugStore(MonoProxy monoProxy, ILogger logger, HttpClient client)
{
this.client = client;
this.logger = logger;
this.monoProxy = monoProxy;
}
public DebugStore(MonoProxy monoProxy, ILogger logger) : this(monoProxy, logger, new HttpClient())
{ }
private class DebugItem
{
public string Url { get; set; }
public Task<byte[][]> Data { get; set; }
}
public IEnumerable<MethodInfo> EnC(AssemblyInfo asm, byte[] meta_data, byte[] pdb_data)
{
asm.EnC(meta_data, pdb_data);
foreach (var method in asm.Methods)
{
if (method.Value.IsEnCMethod)
yield return method.Value;
}
}
public IEnumerable<SourceFile> Add(SessionId id, string name, byte[] assembly_data, byte[] pdb_data, CancellationToken token)
{
AssemblyInfo assembly;
try
{
assembly = new AssemblyInfo(monoProxy, id, name, assembly_data, pdb_data, token);
}
catch (Exception e)
{
logger.LogDebug($"Failed to load assembly: ({e.Message})");
yield break;
}
if (assembly == null)
yield break;
if (GetAssemblyByName(assembly.Name) != null)
{
logger.LogDebug($"Skipping adding {assembly.Name} into the debug store, as it already exists");
yield break;
}
assemblies.Add(assembly);
foreach (var source in assembly.Sources)
{
yield return source;
}
}
public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_files, [EnumeratorCancellation] CancellationToken token)
{
var asm_files = new List<string>();
var pdb_files = new List<string>();
foreach (string file_name in loaded_files)
{
if (file_name.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase))
pdb_files.Add(file_name);
else
asm_files.Add(file_name);
}
List<DebugItem> steps = new List<DebugItem>();
foreach (string url in asm_files)
{
try
{
string candidate_pdb = Path.ChangeExtension(url, "pdb");
string pdb = pdb_files.FirstOrDefault(n => n == candidate_pdb);
steps.Add(
new DebugItem
{
Url = url,
Data = Task.WhenAll(client.GetByteArrayAsync(url, token), pdb != null ? client.GetByteArrayAsync(pdb, token) : Task.FromResult<byte[]>(null))
});
}
catch (Exception e)
{
logger.LogDebug($"Failed to read {url} ({e.Message})");
}
}
foreach (DebugItem step in steps)
{
AssemblyInfo assembly = null;
try
{
byte[][] bytes = await step.Data.ConfigureAwait(false);
assembly = new AssemblyInfo(monoProxy, id, step.Url, bytes[0], bytes[1], token);
}
catch (Exception e)
{
logger.LogDebug($"Failed to load {step.Url} ({e.Message})");
}
if (assembly == null)
continue;
if (GetAssemblyByName(assembly.Name) != null)
{
logger.LogDebug($"Skipping loading {assembly.Name} into the debug store, as it already exists");
continue;
}
assemblies.Add(assembly);
foreach (SourceFile source in assembly.Sources)
yield return source;
}
}
public IEnumerable<SourceFile> AllSources() => assemblies.SelectMany(a => a.Sources);
public SourceFile GetFileById(SourceId id) => AllSources().SingleOrDefault(f => f.SourceId.Equals(id));
public AssemblyInfo GetAssemblyByName(string name) => assemblies.FirstOrDefault(a => a.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
/*
V8 uses zero based indexing for both line and column.
PPDBs uses one based indexing for both line and column.
*/
private static bool Match(SequencePoint sp, SourceLocation start, SourceLocation end)
{
(int Line, int Column) spStart = (Line: sp.StartLine - 1, Column: sp.StartColumn - 1);
(int Line, int Column) spEnd = (Line: sp.EndLine - 1, Column: sp.EndColumn - 1);
if (start.Line > spEnd.Line)
return false;
if (start.Column > spEnd.Column && start.Line == spEnd.Line)
return false;
if (end.Line < spStart.Line)
return false;
if (end.Column < spStart.Column && end.Line == spStart.Line && end.Column != -1)
return false;
return true;
}
public List<SourceLocation> FindPossibleBreakpoints(SourceLocation start, SourceLocation end)
{
//XXX FIXME no idea what todo with locations on different files
if (start.Id != end.Id)
{
logger.LogDebug($"FindPossibleBreakpoints: documents differ (start: {start.Id}) (end {end.Id}");
return null;
}
SourceId sourceId = start.Id;
SourceFile doc = GetFileById(sourceId);
var res = new List<SourceLocation>();
if (doc == null)
{
logger.LogDebug($"Could not find document {sourceId}");
return res;
}
foreach (MethodInfo method in doc.Methods)
res.AddRange(FindBreakpointLocations(start, end, method));
return res;
}
public IEnumerable<SourceLocation> FindBreakpointLocations(SourceLocation start, SourceLocation end, MethodInfo method)
{
if (!method.HasSequencePoints)
yield break;
foreach (SequencePoint sequencePoint in method.DebugInformation.GetSequencePoints())
{
if (!sequencePoint.IsHidden && Match(sequencePoint, start, end))
yield return new SourceLocation(method, sequencePoint);
}
}
/*
V8 uses zero based indexing for both line and column.
PPDBs uses one based indexing for both line and column.
*/
private static bool Match(SequencePoint sp, int line, int column)
{
(int line, int column) bp = (line: line + 1, column: column + 1);
if (sp.StartLine > bp.line || sp.EndLine < bp.line)
return false;
//Chrome sends a zero column even if getPossibleBreakpoints say something else
if (column == 0)
return true;
if (sp.StartColumn > bp.column && sp.StartLine == bp.line)
return false;
if (sp.EndColumn < bp.column && sp.EndLine == bp.line)
return false;
return true;
}
public IEnumerable<SourceLocation> FindBreakpointLocations(BreakpointRequest request)
{
request.TryResolve(this);
AssemblyInfo asm = assemblies.FirstOrDefault(a => a.Name.Equals(request.Assembly, StringComparison.OrdinalIgnoreCase));
SourceFile sourceFile = asm?.Sources?.SingleOrDefault(s => s.DebuggerFileName.Equals(request.File, StringComparison.OrdinalIgnoreCase));
if (sourceFile == null)
yield break;
foreach (MethodInfo method in sourceFile.Methods)
{
if (!method.DebugInformation.SequencePointsBlob.IsNil)
{
foreach (SequencePoint sequencePoint in method.DebugInformation.GetSequencePoints())
{
if (!sequencePoint.IsHidden && Match(sequencePoint, request.Line, request.Column))
yield return new SourceLocation(method, sequencePoint);
}
}
}
}
public string ToUrl(SourceLocation location) => location != null ? GetFileById(location.Id).Url : "";
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Reflection.PortableExecutable;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using Microsoft.CodeAnalysis.Debugging;
using System.IO.Compression;
using System.Reflection;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Text;
namespace Microsoft.WebAssembly.Diagnostics
{
internal static class PortableCustomDebugInfoKinds
{
public static readonly Guid AsyncMethodSteppingInformationBlob = new Guid("54FD2AC5-E925-401A-9C2A-F94F171072F8");
public static readonly Guid StateMachineHoistedLocalScopes = new Guid("6DA9A61E-F8C7-4874-BE62-68BC5630DF71");
public static readonly Guid DynamicLocalVariables = new Guid("83C563C4-B4F3-47D5-B824-BA5441477EA8");
public static readonly Guid TupleElementNames = new Guid("ED9FDF71-8879-4747-8ED3-FE5EDE3CE710");
public static readonly Guid DefaultNamespace = new Guid("58b2eab6-209f-4e4e-a22c-b2d0f910c782");
public static readonly Guid EncLocalSlotMap = new Guid("755F52A8-91C5-45BE-B4B8-209571E552BD");
public static readonly Guid EncLambdaAndClosureMap = new Guid("A643004C-0240-496F-A783-30D64F4979DE");
public static readonly Guid SourceLink = new Guid("CC110556-A091-4D38-9FEC-25AB9A351A6A");
public static readonly Guid EmbeddedSource = new Guid("0E8A571B-6926-466E-B4AD-8AB04611F5FE");
public static readonly Guid CompilationMetadataReferences = new Guid("7E4D4708-096E-4C5C-AEDA-CB10BA6A740D");
public static readonly Guid CompilationOptions = new Guid("B5FEEC05-8CD0-4A83-96DA-466284BB4BD8");
}
internal static class HashKinds
{
public static readonly Guid SHA1 = new Guid("ff1816ec-aa5e-4d10-87f7-6f4963833460");
public static readonly Guid SHA256 = new Guid("8829d00f-11b8-4213-878b-770e8597ac16");
}
internal class BreakpointRequest
{
public string Id { get; private set; }
public string Assembly { get; private set; }
public string File { get; private set; }
public int Line { get; private set; }
public int Column { get; private set; }
public string Condition { get; private set; }
public MethodInfo Method { get; set; }
private JObject request;
public bool IsResolved => Assembly != null;
public List<Breakpoint> Locations { get; set; } = new List<Breakpoint>();
public override string ToString() => $"BreakpointRequest Assembly: {Assembly} File: {File} Line: {Line} Column: {Column}";
public object AsSetBreakpointByUrlResponse(IEnumerable<object> jsloc) => new { breakpointId = Id, locations = Locations.Select(l => l.Location.AsLocation()).Concat(jsloc) };
public BreakpointRequest()
{ }
public BreakpointRequest(string id, MethodInfo method)
{
Id = id;
Method = method;
}
public BreakpointRequest(string id, JObject request)
{
Id = id;
this.request = request;
Condition = request?["condition"]?.Value<string>();
}
public static BreakpointRequest Parse(string id, JObject args)
{
return new BreakpointRequest(id, args);
}
public BreakpointRequest Clone() => new BreakpointRequest { Id = Id, request = request };
public bool IsMatch(SourceFile sourceFile)
{
string url = request?["url"]?.Value<string>();
if (url == null)
{
string urlRegex = request?["urlRegex"].Value<string>();
var regex = new Regex(urlRegex);
return regex.IsMatch(sourceFile.Url.ToString()) || regex.IsMatch(sourceFile.DocUrl);
}
return sourceFile.Url.ToString() == url || sourceFile.DotNetUrl == url;
}
public bool TryResolve(SourceFile sourceFile)
{
if (!IsMatch(sourceFile))
return false;
int? line = request?["lineNumber"]?.Value<int>();
int? column = request?["columnNumber"]?.Value<int>();
if (line == null || column == null)
return false;
Assembly = sourceFile.AssemblyName;
File = sourceFile.DebuggerFileName;
Line = line.Value;
Column = column.Value;
return true;
}
public bool TryResolve(DebugStore store)
{
if (request == null || store == null)
return false;
return store.AllSources().FirstOrDefault(source => TryResolve(source)) != null;
}
}
internal class VarInfo
{
public VarInfo(LocalVariable v, MetadataReader pdbReader)
{
this.Name = pdbReader.GetString(v.Name);
this.Index = v.Index;
}
public VarInfo(Parameter p, MetadataReader pdbReader)
{
this.Name = pdbReader.GetString(p.Name);
this.Index = (p.SequenceNumber) * -1;
}
public string Name { get; }
public int Index { get; }
public override string ToString() => $"(var-info [{Index}] '{Name}')";
}
internal class IlLocation
{
public IlLocation(MethodInfo method, int offset)
{
Method = method;
Offset = offset;
}
public MethodInfo Method { get; }
public int Offset { get; }
}
internal class SourceLocation
{
private SourceId id;
private int line;
private int column;
private IlLocation ilLocation;
public SourceLocation(SourceId id, int line, int column)
{
this.id = id;
this.line = line;
this.column = column;
}
public SourceLocation(MethodInfo mi, SequencePoint sp)
{
this.id = mi.SourceId;
this.line = sp.StartLine - 1;
this.column = sp.StartColumn - 1;
this.ilLocation = new IlLocation(mi, sp.Offset);
}
public SourceId Id { get => id; }
public int Line { get => line; }
public int Column { get => column; }
public IlLocation IlLocation => this.ilLocation;
public override string ToString() => $"{id}:{Line}:{Column}";
public static SourceLocation Parse(JObject obj)
{
if (obj == null)
return null;
if (!SourceId.TryParse(obj["scriptId"]?.Value<string>(), out SourceId id))
return null;
int? line = obj["lineNumber"]?.Value<int>();
int? column = obj["columnNumber"]?.Value<int>();
if (id == null || line == null || column == null)
return null;
return new SourceLocation(id, line.Value, column.Value);
}
internal class LocationComparer : EqualityComparer<SourceLocation>
{
public override bool Equals(SourceLocation l1, SourceLocation l2)
{
if (l1 == null && l2 == null)
return true;
else if (l1 == null || l2 == null)
return false;
return (l1.Line == l2.Line &&
l1.Column == l2.Column &&
l1.Id == l2.Id);
}
public override int GetHashCode(SourceLocation loc)
{
int hCode = loc.Line ^ loc.Column;
return loc.Id.GetHashCode() ^ hCode.GetHashCode();
}
}
internal object AsLocation() => new
{
scriptId = id.ToString(),
lineNumber = line,
columnNumber = column
};
}
internal class SourceId
{
private const string Scheme = "dotnet://";
private readonly int assembly, document;
public int Assembly => assembly;
public int Document => document;
internal SourceId(int assembly, int document)
{
this.assembly = assembly;
this.document = document;
}
public SourceId(string id)
{
if (!TryParse(id, out assembly, out document))
throw new ArgumentException("invalid source identifier", nameof(id));
}
public static bool TryParse(string id, out SourceId source)
{
source = null;
if (!TryParse(id, out int assembly, out int document))
return false;
source = new SourceId(assembly, document);
return true;
}
private static bool TryParse(string id, out int assembly, out int document)
{
assembly = document = 0;
if (id == null || !id.StartsWith(Scheme, StringComparison.Ordinal))
return false;
string[] sp = id.Substring(Scheme.Length).Split('_');
if (sp.Length != 2)
return false;
if (!int.TryParse(sp[0], out assembly))
return false;
if (!int.TryParse(sp[1], out document))
return false;
return true;
}
public override string ToString() => $"{Scheme}{assembly}_{document}";
public override bool Equals(object obj)
{
if (obj == null)
return false;
SourceId that = obj as SourceId;
return that.assembly == this.assembly && that.document == this.document;
}
public override int GetHashCode() => assembly.GetHashCode() ^ document.GetHashCode();
public static bool operator ==(SourceId a, SourceId b) => a is null ? b is null : a.Equals(b);
public static bool operator !=(SourceId a, SourceId b) => !a.Equals(b);
}
internal class MethodInfo
{
private MethodDefinition methodDef;
private SourceFile source;
public SourceId SourceId => source.SourceId;
public string Name { get; }
public MethodDebugInformation DebugInformation;
public MethodDefinitionHandle methodDefHandle;
private MetadataReader pdbMetadataReader;
public SourceLocation StartLocation { get; set; }
public SourceLocation EndLocation { get; set; }
public AssemblyInfo Assembly { get; }
public int Token { get; }
internal bool IsEnCMethod;
internal LocalScopeHandleCollection localScopes;
public bool IsStatic() => (methodDef.Attributes & MethodAttributes.Static) != 0;
public int IsAsync { get; set; }
public DebuggerAttributesInfo DebuggerAttrInfo { get; set; }
public TypeInfo TypeInfo { get; }
public bool HasSequencePoints { get => !DebugInformation.SequencePointsBlob.IsNil; }
private ParameterInfo[] _parametersInfo;
public MethodInfo(AssemblyInfo assembly, MethodDefinitionHandle methodDefHandle, int token, SourceFile source, TypeInfo type, MetadataReader asmMetadataReader, MetadataReader pdbMetadataReader)
{
this.IsAsync = -1;
this.Assembly = assembly;
this.methodDef = asmMetadataReader.GetMethodDefinition(methodDefHandle);
this.DebugInformation = pdbMetadataReader.GetMethodDebugInformation(methodDefHandle.ToDebugInformationHandle());
this.source = source;
this.Token = token;
this.methodDefHandle = methodDefHandle;
this.Name = asmMetadataReader.GetString(methodDef.Name);
this.pdbMetadataReader = pdbMetadataReader;
this.IsEnCMethod = false;
this.TypeInfo = type;
if (HasSequencePoints)
{
var sps = DebugInformation.GetSequencePoints();
SequencePoint start = sps.First();
SequencePoint end = sps.First();
foreach (SequencePoint sp in sps)
{
if (sp.IsHidden)
continue;
if (sp.StartLine < start.StartLine)
start = sp;
else if (sp.StartLine == start.StartLine && sp.StartColumn < start.StartColumn)
start = sp;
if (end.EndLine == SequencePoint.HiddenLine)
end = sp;
if (sp.EndLine > end.EndLine)
end = sp;
else if (sp.EndLine == end.EndLine && sp.EndColumn > end.EndColumn)
end = sp;
}
StartLocation = new SourceLocation(this, start);
EndLocation = new SourceLocation(this, end);
DebuggerAttrInfo = new DebuggerAttributesInfo();
foreach (var cattr in methodDef.GetCustomAttributes())
{
var ctorHandle = asmMetadataReader.GetCustomAttribute(cattr).Constructor;
if (ctorHandle.Kind == HandleKind.MemberReference)
{
var container = asmMetadataReader.GetMemberReference((MemberReferenceHandle)ctorHandle).Parent;
var name = asmMetadataReader.GetString(asmMetadataReader.GetTypeReference((TypeReferenceHandle)container).Name);
switch (name)
{
case "DebuggerHiddenAttribute":
DebuggerAttrInfo.HasDebuggerHidden = true;
break;
case "DebuggerStepThroughAttribute":
DebuggerAttrInfo.HasStepThrough = true;
break;
case "DebuggerNonUserCodeAttribute":
DebuggerAttrInfo.HasNonUserCode = true;
break;
case "DebuggerStepperBoundaryAttribute":
DebuggerAttrInfo.HasStepperBoundary = true;
break;
}
}
}
DebuggerAttrInfo.ClearInsignificantAttrFlags();
}
localScopes = pdbMetadataReader.GetLocalScopes(methodDefHandle);
}
public ParameterInfo[] GetParametersInfo()
{
if (_parametersInfo != null)
return _parametersInfo;
var paramsHandles = methodDef.GetParameters().ToArray();
var paramsCnt = paramsHandles.Length;
var paramsInfo = new ParameterInfo[paramsCnt];
for (int i = 0; i < paramsCnt; i++)
{
var parameter = Assembly.asmMetadataReader.GetParameter(paramsHandles[i]);
var paramName = Assembly.asmMetadataReader.GetString(parameter.Name);
var isOptional = parameter.Attributes.HasFlag(ParameterAttributes.Optional) && parameter.Attributes.HasFlag(ParameterAttributes.HasDefault);
if (!isOptional)
{
paramsInfo[i] = new ParameterInfo(paramName);
continue;
}
var constantHandle = parameter.GetDefaultValue();
var blobHandle = Assembly.asmMetadataReader.GetConstant(constantHandle);
var paramBytes = Assembly.asmMetadataReader.GetBlobBytes(blobHandle.Value);
paramsInfo[i] = new ParameterInfo(
paramName,
blobHandle.TypeCode,
paramBytes
);
}
_parametersInfo = paramsInfo;
return paramsInfo;
}
public void UpdateEnC(MetadataReader asmMetadataReader, MetadataReader pdbMetadataReaderParm, int method_idx)
{
this.DebugInformation = pdbMetadataReaderParm.GetMethodDebugInformation(MetadataTokens.MethodDebugInformationHandle(method_idx));
this.pdbMetadataReader = pdbMetadataReaderParm;
this.IsEnCMethod = true;
if (HasSequencePoints)
{
var sps = DebugInformation.GetSequencePoints();
SequencePoint start = sps.First();
SequencePoint end = sps.First();
foreach (SequencePoint sp in sps)
{
if (sp.StartLine < start.StartLine)
start = sp;
else if (sp.StartLine == start.StartLine && sp.StartColumn < start.StartColumn)
start = sp;
if (sp.EndLine > end.EndLine)
end = sp;
else if (sp.EndLine == end.EndLine && sp.EndColumn > end.EndColumn)
end = sp;
}
StartLocation = new SourceLocation(this, start);
EndLocation = new SourceLocation(this, end);
}
localScopes = pdbMetadataReader.GetLocalScopes(MetadataTokens.MethodDefinitionHandle(method_idx));
}
public SourceLocation GetLocationByIl(int pos)
{
SequencePoint? prev = null;
if (HasSequencePoints) {
foreach (SequencePoint sp in DebugInformation.GetSequencePoints())
{
if (sp.Offset > pos)
{
//get the earlier line number if the offset is in a hidden sequence point and has a earlier line number available
// if is doesn't continue and get the next line number that is not in a hidden sequence point
if (sp.IsHidden && prev == null)
continue;
break;
}
if (!sp.IsHidden)
prev = sp;
}
if (prev.HasValue)
return new SourceLocation(this, prev.Value);
}
return null;
}
public VarInfo[] GetLiveVarsAt(int offset)
{
var res = new List<VarInfo>();
foreach (var parameterHandle in methodDef.GetParameters())
{
var parameter = Assembly.asmMetadataReader.GetParameter(parameterHandle);
res.Add(new VarInfo(parameter, Assembly.asmMetadataReader));
}
foreach (var localScopeHandle in localScopes)
{
var localScope = pdbMetadataReader.GetLocalScope(localScopeHandle);
if (localScope.StartOffset <= offset && localScope.EndOffset > offset)
{
var localVariables = localScope.GetLocalVariables();
foreach (var localVariableHandle in localVariables)
{
var localVariable = pdbMetadataReader.GetLocalVariable(localVariableHandle);
if (localVariable.Attributes != LocalVariableAttributes.DebuggerHidden)
res.Add(new VarInfo(localVariable, pdbMetadataReader));
}
}
}
return res.ToArray();
}
public override string ToString() => "MethodInfo(" + Name + ")";
public class DebuggerAttributesInfo
{
internal bool HasDebuggerHidden { get; set; }
internal bool HasStepThrough { get; set; }
internal bool HasNonUserCode { get; set; }
public bool HasStepperBoundary { get; internal set; }
internal void ClearInsignificantAttrFlags()
{
// hierarchy: hidden > stepThrough > nonUserCode > boundary
if (HasDebuggerHidden)
HasStepThrough = HasNonUserCode = HasStepperBoundary = false;
else if (HasStepThrough)
HasNonUserCode = HasStepperBoundary = false;
else if (HasNonUserCode)
HasStepperBoundary = false;
}
public bool DoAttributesAffectCallStack(bool justMyCodeEnabled)
{
return HasStepThrough ||
HasDebuggerHidden ||
HasStepperBoundary ||
(HasNonUserCode && justMyCodeEnabled);
}
public bool ShouldStepOut(EventKind eventKind)
{
return HasDebuggerHidden || (HasStepperBoundary && eventKind == EventKind.Step);
}
}
public bool IsLexicallyContainedInMethod(MethodInfo containerMethod)
=> (StartLocation.Line > containerMethod.StartLocation.Line ||
(StartLocation.Line == containerMethod.StartLocation.Line && StartLocation.Column > containerMethod.StartLocation.Column)) &&
(EndLocation.Line < containerMethod.EndLocation.Line ||
(EndLocation.Line == containerMethod.EndLocation.Line && EndLocation.Column < containerMethod.EndLocation.Column));
}
internal class ParameterInfo
{
public string Name { get; init; }
public ElementType? TypeCode { get; init; }
public object Value { get; init; }
public ParameterInfo(string name, ConstantTypeCode? typeCode = null, byte[] value = null)
{
Name = name;
if (value == null)
return;
switch (typeCode)
{
case ConstantTypeCode.Boolean:
Value = BitConverter.ToBoolean(value) ? 1 : 0;
TypeCode = ElementType.Boolean;
break;
case ConstantTypeCode.Char:
Value = (int)BitConverter.ToChar(value);
TypeCode = ElementType.Char;
break;
case ConstantTypeCode.Byte:
Value = (int)value[0];
TypeCode = ElementType.U1;
break;
case ConstantTypeCode.SByte:
Value = (uint)value[0];
TypeCode = ElementType.I1;
break;
case ConstantTypeCode.Int16:
Value = (int)BitConverter.ToUInt16(value, 0);
TypeCode = ElementType.I2;
break;
case ConstantTypeCode.UInt16:
Value = (uint)BitConverter.ToUInt16(value, 0);
TypeCode = ElementType.U2;
break;
case ConstantTypeCode.Int32:
Value = BitConverter.ToInt32(value, 0);
TypeCode = ElementType.I4;
break;
case ConstantTypeCode.UInt32:
Value = BitConverter.ToUInt32(value, 0);
TypeCode = ElementType.U4;
break;
case ConstantTypeCode.Int64:
Value = BitConverter.ToInt64(value, 0);
TypeCode = ElementType.I8;
break;
case ConstantTypeCode.UInt64:
Value = BitConverter.ToUInt64(value, 0);
TypeCode = ElementType.U8;
break;
case ConstantTypeCode.Single:
Value = BitConverter.ToSingle(value, 0);
TypeCode = ElementType.R4;
break;
case ConstantTypeCode.Double:
Value = BitConverter.ToDouble(value, 0);
TypeCode = ElementType.R8;
break;
case ConstantTypeCode.String:
Value = Encoding.Unicode.GetString(value);
TypeCode = ElementType.String;
break;
case ConstantTypeCode.NullReference:
Value = (byte)ValueTypeId.Null;
TypeCode = null;
break;
}
}
}
internal class TypeInfo
{
private readonly ILogger logger;
internal AssemblyInfo assembly;
private TypeDefinition type;
private List<MethodInfo> methods;
internal int Token { get; }
internal string Namespace { get; }
public Dictionary<string, DebuggerBrowsableState?> DebuggerBrowsableFields = new();
public Dictionary<string, DebuggerBrowsableState?> DebuggerBrowsableProperties = new();
public TypeInfo(AssemblyInfo assembly, TypeDefinitionHandle typeHandle, TypeDefinition type, ILogger logger)
{
this.logger = logger;
this.assembly = assembly;
var metadataReader = assembly.asmMetadataReader;
Token = MetadataTokens.GetToken(metadataReader, typeHandle);
this.type = type;
methods = new List<MethodInfo>();
Name = metadataReader.GetString(type.Name);
var declaringType = type;
while (declaringType.IsNested)
{
declaringType = metadataReader.GetTypeDefinition(declaringType.GetDeclaringType());
Name = metadataReader.GetString(declaringType.Name) + "." + Name;
}
Namespace = metadataReader.GetString(declaringType.Namespace);
if (Namespace.Length > 0)
FullName = Namespace + "." + Name;
else
FullName = Name;
foreach (var field in type.GetFields())
{
try
{
var fieldDefinition = metadataReader.GetFieldDefinition(field);
var fieldName = metadataReader.GetString(fieldDefinition.Name);
AppendToBrowsable(DebuggerBrowsableFields, fieldDefinition.GetCustomAttributes(), fieldName);
}
catch (Exception ex)
{
logger.LogDebug($"Failed to read browsable attributes of a field. ({ex.Message})");
continue;
}
}
foreach (var prop in type.GetProperties())
{
try
{
var propDefinition = metadataReader.GetPropertyDefinition(prop);
var propName = metadataReader.GetString(propDefinition.Name);
AppendToBrowsable(DebuggerBrowsableProperties, propDefinition.GetCustomAttributes(), propName);
}
catch (Exception ex)
{
logger.LogDebug($"Failed to read browsable attributes of a property. ({ex.Message})");
continue;
}
}
void AppendToBrowsable(Dictionary<string, DebuggerBrowsableState?> dict, CustomAttributeHandleCollection customAttrs, string fieldName)
{
foreach (var cattr in customAttrs)
{
try
{
var ctorHandle = metadataReader.GetCustomAttribute(cattr).Constructor;
if (ctorHandle.Kind != HandleKind.MemberReference)
continue;
var container = metadataReader.GetMemberReference((MemberReferenceHandle)ctorHandle).Parent;
var valueBytes = metadataReader.GetBlobBytes(metadataReader.GetCustomAttribute(cattr).Value);
var attributeName = metadataReader.GetString(metadataReader.GetTypeReference((TypeReferenceHandle)container).Name);
if (attributeName != "DebuggerBrowsableAttribute")
continue;
var state = (DebuggerBrowsableState)valueBytes[2];
if (!Enum.IsDefined(typeof(DebuggerBrowsableState), state))
continue;
dict.Add(fieldName, state);
break;
}
catch
{
continue;
}
}
}
}
public TypeInfo(AssemblyInfo assembly, string name)
{
Name = name;
FullName = name;
}
public string Name { get; }
public string FullName { get; }
public List<MethodInfo> Methods => methods;
public override string ToString() => "TypeInfo('" + FullName + "')";
}
internal class AssemblyInfo
{
private static int next_id;
private readonly int id;
private readonly ILogger logger;
private Dictionary<int, MethodInfo> methods = new Dictionary<int, MethodInfo>();
private Dictionary<string, string> sourceLinkMappings = new Dictionary<string, string>();
private readonly List<SourceFile> sources = new List<SourceFile>();
internal string Url { get; }
//The caller must keep the PEReader alive and undisposed throughout the lifetime of the metadata reader
internal PEReader peReader;
internal MetadataReader asmMetadataReader { get; }
internal MetadataReader pdbMetadataReader { get; set; }
internal List<MetadataReader> enCMetadataReader = new List<MetadataReader>();
private int debugId;
internal int PdbAge { get; }
internal System.Guid PdbGuid { get; }
internal string PdbName { get; }
internal bool PdbInformationAvailable { get; }
public bool TriedToLoadSymbolsOnDemand { get; set; }
public unsafe AssemblyInfo(MonoProxy monoProxy, SessionId sessionId, string url, byte[] assembly, byte[] pdb, CancellationToken token)
{
debugId = -1;
this.id = Interlocked.Increment(ref next_id);
using var asmStream = new MemoryStream(assembly);
peReader = new PEReader(asmStream);
var entries = peReader.ReadDebugDirectory();
if (entries.Length > 0)
{
var codeView = entries[0];
CodeViewDebugDirectoryData codeViewData = peReader.ReadCodeViewDebugDirectoryData(codeView);
PdbAge = codeViewData.Age;
PdbGuid = codeViewData.Guid;
PdbName = codeViewData.Path;
PdbInformationAvailable = true;
}
asmMetadataReader = PEReaderExtensions.GetMetadataReader(peReader);
var asmDef = asmMetadataReader.GetAssemblyDefinition();
Name = asmDef.GetAssemblyName().Name + ".dll";
if (pdb != null)
{
var pdbStream = new MemoryStream(pdb);
try
{
// MetadataReaderProvider.FromPortablePdbStream takes ownership of the stream
pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader();
}
catch (BadImageFormatException)
{
monoProxy.SendLog(sessionId, $"Warning: Unable to read debug information of: {Name} (use DebugType=Portable/Embedded)", token);
}
}
else
{
var embeddedPdbEntry = entries.FirstOrDefault(e => e.Type == DebugDirectoryEntryType.EmbeddedPortablePdb);
if (embeddedPdbEntry.DataSize != 0)
{
pdbMetadataReader = peReader.ReadEmbeddedPortablePdbDebugDirectoryData(embeddedPdbEntry).GetMetadataReader();
}
}
Populate();
}
public async Task<int> GetDebugId(MonoSDBHelper sdbAgent, CancellationToken token)
{
if (debugId > 0)
return debugId;
debugId = await sdbAgent.GetAssemblyId(Name, token);
return debugId;
}
public void SetDebugId(int id)
{
if (debugId <= 0 && debugId != id)
debugId = id;
}
public bool EnC(byte[] meta, byte[] pdb)
{
var asmStream = new MemoryStream(meta);
MetadataReader asmMetadataReader = MetadataReaderProvider.FromMetadataStream(asmStream).GetMetadataReader();
var pdbStream = new MemoryStream(pdb);
MetadataReader pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader();
enCMetadataReader.Add(asmMetadataReader);
enCMetadataReader.Add(pdbMetadataReader);
PopulateEnC(asmMetadataReader, pdbMetadataReader);
return true;
}
public AssemblyInfo(ILogger logger)
{
this.logger = logger;
}
private void PopulateEnC(MetadataReader asmMetadataReaderParm, MetadataReader pdbMetadataReaderParm)
{
int i = 1;
foreach (EntityHandle encMapHandle in asmMetadataReaderParm.GetEditAndContinueMapEntries())
{
if (encMapHandle.Kind == HandleKind.MethodDebugInformation)
{
var method = methods[asmMetadataReader.GetRowNumber(encMapHandle)];
method.UpdateEnC(asmMetadataReaderParm, pdbMetadataReaderParm, i);
i++;
}
}
}
private void Populate()
{
var d2s = new Dictionary<int, SourceFile>();
SourceFile FindSource(DocumentHandle doc, int rowid, string documentName)
{
if (d2s.TryGetValue(rowid, out SourceFile source))
return source;
var src = new SourceFile(this, sources.Count, doc, GetSourceLinkUrl(documentName), documentName);
sources.Add(src);
d2s[rowid] = src;
return src;
};
foreach (DocumentHandle dh in asmMetadataReader.Documents)
{
asmMetadataReader.GetDocument(dh);
}
if (pdbMetadataReader != null)
ProcessSourceLink();
foreach (TypeDefinitionHandle type in asmMetadataReader.TypeDefinitions)
{
var typeDefinition = asmMetadataReader.GetTypeDefinition(type);
var typeInfo = new TypeInfo(this, type, typeDefinition, logger);
TypesByName[typeInfo.FullName] = typeInfo;
TypesByToken[typeInfo.Token] = typeInfo;
if (pdbMetadataReader != null)
{
foreach (MethodDefinitionHandle method in typeDefinition.GetMethods())
{
var methodDefinition = asmMetadataReader.GetMethodDefinition(method);
if (!method.ToDebugInformationHandle().IsNil)
{
var methodDebugInformation = pdbMetadataReader.GetMethodDebugInformation(method.ToDebugInformationHandle());
if (!methodDebugInformation.Document.IsNil)
{
var document = pdbMetadataReader.GetDocument(methodDebugInformation.Document);
var documentName = pdbMetadataReader.GetString(document.Name);
SourceFile source = FindSource(methodDebugInformation.Document, asmMetadataReader.GetRowNumber(methodDebugInformation.Document), documentName);
var methodInfo = new MethodInfo(this, method, asmMetadataReader.GetRowNumber(method), source, typeInfo, asmMetadataReader, pdbMetadataReader);
methods[asmMetadataReader.GetRowNumber(method)] = methodInfo;
if (source != null)
source.AddMethod(methodInfo);
typeInfo.Methods.Add(methodInfo);
}
}
}
}
}
}
private void ProcessSourceLink()
{
var sourceLinkDebugInfo =
(from cdiHandle in pdbMetadataReader.GetCustomDebugInformation(EntityHandle.ModuleDefinition)
let cdi = pdbMetadataReader.GetCustomDebugInformation(cdiHandle)
where pdbMetadataReader.GetGuid(cdi.Kind) == PortableCustomDebugInfoKinds.SourceLink
select pdbMetadataReader.GetBlobBytes(cdi.Value)).SingleOrDefault();
if (sourceLinkDebugInfo != null)
{
var sourceLinkContent = System.Text.Encoding.UTF8.GetString(sourceLinkDebugInfo, 0, sourceLinkDebugInfo.Length);
if (sourceLinkContent != null)
{
JToken jObject = JObject.Parse(sourceLinkContent)["documents"];
sourceLinkMappings = JsonConvert.DeserializeObject<Dictionary<string, string>>(jObject.ToString());
}
}
}
private Uri GetSourceLinkUrl(string document)
{
if (sourceLinkMappings.TryGetValue(document, out string url))
return new Uri(url);
foreach (KeyValuePair<string, string> sourceLinkDocument in sourceLinkMappings)
{
string key = sourceLinkDocument.Key;
if (!key.EndsWith("*"))
{
continue;
}
string keyTrim = key.TrimEnd('*');
if (document.StartsWith(keyTrim, StringComparison.OrdinalIgnoreCase))
{
string docUrlPart = document.Replace(keyTrim, "");
return new Uri(sourceLinkDocument.Value.TrimEnd('*') + docUrlPart);
}
}
return null;
}
public IEnumerable<SourceFile> Sources => this.sources;
public Dictionary<int, MethodInfo> Methods => this.methods;
public Dictionary<string, TypeInfo> TypesByName { get; } = new();
public Dictionary<int, TypeInfo> TypesByToken { get; } = new();
public int Id => id;
public string Name { get; }
public bool HasSymbols => pdbMetadataReader != null;
// "System.Threading", instead of "System.Threading, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
public string AssemblyNameUnqualified { get; }
public SourceFile GetDocById(int document)
{
return sources.FirstOrDefault(s => s.SourceId.Document == document);
}
public MethodInfo GetMethodByToken(int token)
{
methods.TryGetValue(token, out MethodInfo value);
return value;
}
public TypeInfo GetTypeByName(string name)
{
TypesByName.TryGetValue(name, out TypeInfo res);
return res;
}
internal void UpdatePdbInformation(Stream streamToReadFrom)
{
var pdbStream = new MemoryStream();
streamToReadFrom.CopyTo(pdbStream);
pdbMetadataReader = MetadataReaderProvider.FromPortablePdbStream(pdbStream).GetMetadataReader();
}
}
internal class SourceFile
{
private Dictionary<int, MethodInfo> methods;
private AssemblyInfo assembly;
private int id;
private Document doc;
private DocumentHandle docHandle;
private string url;
internal SourceFile(AssemblyInfo assembly, int id, DocumentHandle docHandle, Uri sourceLinkUri, string url)
{
this.methods = new Dictionary<int, MethodInfo>();
this.SourceLinkUri = sourceLinkUri;
this.assembly = assembly;
this.id = id;
this.doc = assembly.pdbMetadataReader.GetDocument(docHandle);
this.docHandle = docHandle;
this.url = url;
this.DebuggerFileName = url.Replace("\\", "/").Replace(":", "");
var urlWithSpecialCharCodedHex = EscapeAscii(url);
this.SourceUri = new Uri((Path.IsPathRooted(url) ? "file://" : "") + urlWithSpecialCharCodedHex, UriKind.RelativeOrAbsolute);
if (SourceUri.IsFile && File.Exists(SourceUri.LocalPath))
{
this.Url = this.SourceUri.ToString();
}
else
{
this.Url = DotNetUrl;
}
}
private static string EscapeAscii(string path)
{
var builder = new StringBuilder();
foreach (char c in path)
{
switch (c)
{
case var _ when c >= 'a' && c <= 'z':
case var _ when c >= 'A' && c <= 'Z':
case var _ when char.IsDigit(c):
case var _ when c > 255:
case var _ when c == '+' || c == ':' || c == '.' || c == '-' || c == '_' || c == '~':
builder.Append(c);
break;
case var _ when c == Path.DirectorySeparatorChar:
case var _ when c == Path.AltDirectorySeparatorChar:
case var _ when c == '\\':
builder.Append(c);
break;
default:
builder.Append(string.Format($"%{((int)c):X2}"));
break;
}
}
return builder.ToString();
}
internal void AddMethod(MethodInfo mi)
{
if (!this.methods.ContainsKey(mi.Token))
{
this.methods[mi.Token] = mi;
}
}
public string DebuggerFileName { get; }
public string Url { get; }
public string AssemblyName => assembly.Name;
public string DotNetUrl => $"dotnet://{assembly.Name}/{DebuggerFileName}";
public SourceId SourceId => new SourceId(assembly.Id, this.id);
public Uri SourceLinkUri { get; }
public Uri SourceUri { get; }
public IEnumerable<MethodInfo> Methods => this.methods.Values;
public string DocUrl => url;
public (int startLine, int startColumn, int endLine, int endColumn) GetExtents()
{
MethodInfo start = Methods.OrderBy(m => m.StartLocation.Line).ThenBy(m => m.StartLocation.Column).First();
MethodInfo end = Methods.OrderByDescending(m => m.EndLocation.Line).ThenByDescending(m => m.EndLocation.Column).First();
return (start.StartLocation.Line, start.StartLocation.Column, end.EndLocation.Line, end.EndLocation.Column);
}
private async Task<MemoryStream> GetDataAsync(Uri uri, CancellationToken token)
{
var mem = new MemoryStream();
try
{
if (uri.IsFile && File.Exists(uri.LocalPath))
{
using (FileStream file = File.Open(SourceUri.LocalPath, FileMode.Open))
{
await file.CopyToAsync(mem, token).ConfigureAwait(false);
mem.Position = 0;
}
}
else if (uri.Scheme == "http" || uri.Scheme == "https")
{
using (var client = new HttpClient())
using (Stream stream = await client.GetStreamAsync(uri, token))
{
await stream.CopyToAsync(mem, token).ConfigureAwait(false);
mem.Position = 0;
}
}
}
catch (Exception)
{
return null;
}
return mem;
}
private static HashAlgorithm GetHashAlgorithm(Guid algorithm)
{
if (algorithm.Equals(HashKinds.SHA1))
#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
return SHA1.Create();
#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms
if (algorithm.Equals(HashKinds.SHA256))
return SHA256.Create();
return null;
}
private bool CheckPdbHash(byte[] computedHash)
{
var hash = assembly.pdbMetadataReader.GetBlobBytes(doc.Hash);
if (computedHash.Length != hash.Length)
return false;
for (int i = 0; i < computedHash.Length; i++)
if (computedHash[i] != hash[i])
return false;
return true;
}
private byte[] ComputePdbHash(Stream sourceStream)
{
HashAlgorithm algorithm = GetHashAlgorithm(assembly.pdbMetadataReader.GetGuid(doc.HashAlgorithm));
if (algorithm != null)
using (algorithm)
return algorithm.ComputeHash(sourceStream);
return Array.Empty<byte>();
}
public async Task<Stream> GetSourceAsync(bool checkHash, CancellationToken token = default(CancellationToken))
{
var reader = assembly.pdbMetadataReader;
byte[] bytes = (from handle in reader.GetCustomDebugInformation(docHandle)
let cdi = reader.GetCustomDebugInformation(handle)
where reader.GetGuid(cdi.Kind) == PortableCustomDebugInfoKinds.EmbeddedSource
select reader.GetBlobBytes(cdi.Value)).SingleOrDefault();
if (bytes != null)
{
int uncompressedSize = BitConverter.ToInt32(bytes, 0);
var stream = new MemoryStream(bytes, sizeof(int), bytes.Length - sizeof(int));
if (uncompressedSize != 0)
{
return new DeflateStream(stream, CompressionMode.Decompress);
}
}
foreach (Uri url in new[] { SourceUri, SourceLinkUri })
{
MemoryStream mem = await GetDataAsync(url, token).ConfigureAwait(false);
if (mem != null && mem.Length > 0 && (!checkHash || CheckPdbHash(ComputePdbHash(mem))))
{
mem.Position = 0;
return mem;
}
}
return MemoryStream.Null;
}
public object ToScriptSource(int executionContextId, object executionContextAuxData)
{
return new
{
scriptId = SourceId.ToString(),
url = Url,
executionContextId,
executionContextAuxData,
//hash: should be the v8 hash algo, managed implementation is pending
dotNetUrl = DotNetUrl,
};
}
}
internal class DebugStore
{
internal List<AssemblyInfo> assemblies = new List<AssemblyInfo>();
private readonly HttpClient client;
private readonly ILogger logger;
private readonly MonoProxy monoProxy;
public DebugStore(MonoProxy monoProxy, ILogger logger, HttpClient client)
{
this.client = client;
this.logger = logger;
this.monoProxy = monoProxy;
}
public DebugStore(MonoProxy monoProxy, ILogger logger) : this(monoProxy, logger, new HttpClient())
{ }
private class DebugItem
{
public string Url { get; set; }
public Task<byte[][]> Data { get; set; }
}
public IEnumerable<MethodInfo> EnC(AssemblyInfo asm, byte[] meta_data, byte[] pdb_data)
{
asm.EnC(meta_data, pdb_data);
foreach (var method in asm.Methods)
{
if (method.Value.IsEnCMethod)
yield return method.Value;
}
}
public IEnumerable<SourceFile> Add(SessionId id, string name, byte[] assembly_data, byte[] pdb_data, CancellationToken token)
{
AssemblyInfo assembly;
try
{
assembly = new AssemblyInfo(monoProxy, id, name, assembly_data, pdb_data, token);
}
catch (Exception e)
{
logger.LogDebug($"Failed to load assembly: ({e.Message})");
yield break;
}
if (assembly == null)
yield break;
if (GetAssemblyByName(assembly.Name) != null)
{
logger.LogDebug($"Skipping adding {assembly.Name} into the debug store, as it already exists");
yield break;
}
assemblies.Add(assembly);
foreach (var source in assembly.Sources)
{
yield return source;
}
}
public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_files, [EnumeratorCancellation] CancellationToken token)
{
var asm_files = new List<string>();
var pdb_files = new List<string>();
foreach (string file_name in loaded_files)
{
if (file_name.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase))
pdb_files.Add(file_name);
else
asm_files.Add(file_name);
}
List<DebugItem> steps = new List<DebugItem>();
foreach (string url in asm_files)
{
try
{
string candidate_pdb = Path.ChangeExtension(url, "pdb");
string pdb = pdb_files.FirstOrDefault(n => n == candidate_pdb);
steps.Add(
new DebugItem
{
Url = url,
Data = Task.WhenAll(client.GetByteArrayAsync(url, token), pdb != null ? client.GetByteArrayAsync(pdb, token) : Task.FromResult<byte[]>(null))
});
}
catch (Exception e)
{
logger.LogDebug($"Failed to read {url} ({e.Message})");
}
}
foreach (DebugItem step in steps)
{
AssemblyInfo assembly = null;
try
{
byte[][] bytes = await step.Data.ConfigureAwait(false);
assembly = new AssemblyInfo(monoProxy, id, step.Url, bytes[0], bytes[1], token);
}
catch (Exception e)
{
logger.LogDebug($"Failed to load {step.Url} ({e.Message})");
}
if (assembly == null)
continue;
if (GetAssemblyByName(assembly.Name) != null)
{
logger.LogDebug($"Skipping loading {assembly.Name} into the debug store, as it already exists");
continue;
}
assemblies.Add(assembly);
foreach (SourceFile source in assembly.Sources)
yield return source;
}
}
public IEnumerable<SourceFile> AllSources() => assemblies.SelectMany(a => a.Sources);
public SourceFile GetFileById(SourceId id) => AllSources().SingleOrDefault(f => f.SourceId.Equals(id));
public AssemblyInfo GetAssemblyByName(string name) => assemblies.FirstOrDefault(a => a.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
/*
V8 uses zero based indexing for both line and column.
PPDBs uses one based indexing for both line and column.
*/
private static bool Match(SequencePoint sp, SourceLocation start, SourceLocation end)
{
(int Line, int Column) spStart = (Line: sp.StartLine - 1, Column: sp.StartColumn - 1);
(int Line, int Column) spEnd = (Line: sp.EndLine - 1, Column: sp.EndColumn - 1);
if (start.Line > spEnd.Line)
return false;
if (start.Column > spEnd.Column && start.Line == spEnd.Line)
return false;
if (end.Line < spStart.Line)
return false;
if (end.Column < spStart.Column && end.Line == spStart.Line && end.Column != -1)
return false;
return true;
}
public List<SourceLocation> FindPossibleBreakpoints(SourceLocation start, SourceLocation end)
{
//XXX FIXME no idea what todo with locations on different files
if (start.Id != end.Id)
{
logger.LogDebug($"FindPossibleBreakpoints: documents differ (start: {start.Id}) (end {end.Id}");
return null;
}
SourceId sourceId = start.Id;
SourceFile doc = GetFileById(sourceId);
var res = new List<SourceLocation>();
if (doc == null)
{
logger.LogDebug($"Could not find document {sourceId}");
return res;
}
foreach (MethodInfo method in doc.Methods)
res.AddRange(FindBreakpointLocations(start, end, method));
return res;
}
public IEnumerable<SourceLocation> FindBreakpointLocations(SourceLocation start, SourceLocation end, MethodInfo method)
{
if (!method.HasSequencePoints)
yield break;
foreach (SequencePoint sequencePoint in method.DebugInformation.GetSequencePoints())
{
if (!sequencePoint.IsHidden && Match(sequencePoint, start, end))
yield return new SourceLocation(method, sequencePoint);
}
}
/*
V8 uses zero based indexing for both line and column.
PPDBs uses one based indexing for both line and column.
*/
private static bool Match(SequencePoint sp, int line, int column)
{
(int line, int column) bp = (line: line + 1, column: column + 1);
if (sp.StartLine > bp.line || sp.EndLine < bp.line)
return false;
//Chrome sends a zero column even if getPossibleBreakpoints say something else
if (column == 0)
return true;
if (sp.StartColumn > bp.column && sp.StartLine == bp.line)
return false;
if (sp.EndColumn < bp.column && sp.EndLine == bp.line)
return false;
return true;
}
public IEnumerable<SourceLocation> FindBreakpointLocations(BreakpointRequest request)
{
request.TryResolve(this);
AssemblyInfo asm = assemblies.FirstOrDefault(a => a.Name.Equals(request.Assembly, StringComparison.OrdinalIgnoreCase));
SourceFile sourceFile = asm?.Sources?.SingleOrDefault(s => s.DebuggerFileName.Equals(request.File, StringComparison.OrdinalIgnoreCase));
if (sourceFile == null)
yield break;
foreach (MethodInfo method in sourceFile.Methods)
{
if (!method.DebugInformation.SequencePointsBlob.IsNil)
{
foreach (SequencePoint sequencePoint in method.DebugInformation.GetSequencePoints())
{
if (!sequencePoint.IsHidden && Match(sequencePoint, request.Line, request.Column))
yield return new SourceLocation(method, sequencePoint);
}
}
}
}
public string ToUrl(SourceLocation location) => location != null ? GetFileById(location.Id).Url : "";
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/TraceInternal.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Diagnostics
{
internal static class TraceInternal
{
// this is internal so TraceSource can use it. We want to lock on the same object because both TraceInternal and
// TraceSource could be writing to the same listeners at the same time.
internal static readonly object critSec = new object();
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Diagnostics
{
internal static class TraceInternal
{
// this is internal so TraceSource can use it. We want to lock on the same object because both TraceInternal and
// TraceSource could be writing to the same listeners at the same time.
internal static readonly object critSec = new object();
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogQuery.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Diagnostics.Eventing.Reader
{
/// <summary>
/// Allows a user to define events of interest. An instance of this
/// class is passed to an EventReader to actually obtain the EventRecords.
/// The EventLogQuery can be as simple specifying that all events are of
/// interest, or it can contain query / xpath expressions that indicate exactly
/// what characteristics events should have.
/// </summary>
public class EventLogQuery
{
public EventLogQuery(string path, PathType pathType)
: this(path, pathType, null)
{
}
public EventLogQuery(string path, PathType pathType, string query)
{
Session = EventLogSession.GlobalSession;
Path = path; // can be null
ThePathType = pathType;
if (query == null)
{
if (path == null)
throw new ArgumentNullException(nameof(path));
}
else
{
Query = query;
}
}
public EventLogSession Session { get; set; }
public bool TolerateQueryErrors { get; set; }
public bool ReverseDirection { get; set; }
internal string Path { get; }
internal PathType ThePathType { get; }
internal string Query { get; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Diagnostics.Eventing.Reader
{
/// <summary>
/// Allows a user to define events of interest. An instance of this
/// class is passed to an EventReader to actually obtain the EventRecords.
/// The EventLogQuery can be as simple specifying that all events are of
/// interest, or it can contain query / xpath expressions that indicate exactly
/// what characteristics events should have.
/// </summary>
public class EventLogQuery
{
public EventLogQuery(string path, PathType pathType)
: this(path, pathType, null)
{
}
public EventLogQuery(string path, PathType pathType, string query)
{
Session = EventLogSession.GlobalSession;
Path = path; // can be null
ThePathType = pathType;
if (query == null)
{
if (path == null)
throw new ArgumentNullException(nameof(path));
}
else
{
Query = query;
}
}
public EventLogSession Session { get; set; }
public bool TolerateQueryErrors { get; set; }
public bool ReverseDirection { get; set; }
internal string Path { get; }
internal PathType ThePathType { get; }
internal string Query { get; }
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/tests/JIT/HardwareIntrinsics/General/Vector128/Dot.SByte.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace JIT.HardwareIntrinsics.General
{
public static partial class Program
{
private static void DotSByte()
{
var test = new VectorBinaryOpTest__DotSByte();
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
// Validates passing a static member works
test.RunClsVarScenario();
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
// Validates passing an instance member of a class works
test.RunClassFldScenario();
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class VectorBinaryOpTest__DotSByte
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private GCHandle inHandle1;
private GCHandle inHandle2;
private ulong alignment;
public DataTable(SByte[] inArray1, SByte[] inArray2, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<SByte>();
if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<SByte, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector128<SByte> _fld1;
public Vector128<SByte> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
return testStruct;
}
public void RunStructFldScenario(VectorBinaryOpTest__DotSByte testClass)
{
var result = Vector128.Dot(_fld1, _fld2);
testClass.ValidateResult(_fld1, _fld2, result);
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
private static Vector128<SByte> _clsVar1;
private static Vector128<SByte> _clsVar2;
private Vector128<SByte> _fld1;
private Vector128<SByte> _fld2;
private DataTable _dataTable;
static VectorBinaryOpTest__DotSByte()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public VectorBinaryOpTest__DotSByte()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
_dataTable = new DataTable(_data1, _data2, LargestVectorSize);
}
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = Vector128.Dot(
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr)
);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var method = typeof(Vector128).GetMethod(nameof(Vector128.Dot), new Type[] {
typeof(Vector128<SByte>),
typeof(Vector128<SByte>)
});
if (method is null)
{
method = typeof(Vector128).GetMethod(nameof(Vector128.Dot), 1, new Type[] {
typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)),
typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0))
});
}
if (method.IsGenericMethodDefinition)
{
method = method.MakeGenericMethod(typeof(SByte));
}
var result = method.Invoke(null, new object[] {
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr)
});
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, (SByte)(result));
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = Vector128.Dot(
_clsVar1,
_clsVar2
);
ValidateResult(_clsVar1, _clsVar2, result);
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr);
var result = Vector128.Dot(op1, op2);
ValidateResult(op1, op2, result);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new VectorBinaryOpTest__DotSByte();
var result = Vector128.Dot(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = Vector128.Dot(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = Vector128.Dot(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
private void ValidateResult(Vector128<SByte> op1, Vector128<SByte> op2, SByte result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), op2);
ValidateResult(inArray1, inArray2, result, method);
}
private void ValidateResult(void* op1, void* op2, SByte result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<SByte>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
private void ValidateResult(SByte[] left, SByte[] right, SByte result, [CallerMemberName] string method = "")
{
bool succeeded = true;
SByte actualResult = default;
SByte intermResult = default;
for (var i = 0; i < Op1ElementCount; i++)
{
if ((i % Vector128<SByte>.Count) == 0)
{
actualResult += intermResult;
intermResult = default;
}
intermResult += (SByte)(left[i] * right[i]);
}
actualResult += intermResult;
if (actualResult != result)
{
succeeded = false;
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.Dot)}<SByte>(Vector128<SByte>, Vector128<SByte>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: {result}");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace JIT.HardwareIntrinsics.General
{
public static partial class Program
{
private static void DotSByte()
{
var test = new VectorBinaryOpTest__DotSByte();
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
// Validates passing a static member works
test.RunClsVarScenario();
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
// Validates passing an instance member of a class works
test.RunClassFldScenario();
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class VectorBinaryOpTest__DotSByte
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private GCHandle inHandle1;
private GCHandle inHandle2;
private ulong alignment;
public DataTable(SByte[] inArray1, SByte[] inArray2, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<SByte>();
if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<SByte, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector128<SByte> _fld1;
public Vector128<SByte> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
return testStruct;
}
public void RunStructFldScenario(VectorBinaryOpTest__DotSByte testClass)
{
var result = Vector128.Dot(_fld1, _fld2);
testClass.ValidateResult(_fld1, _fld2, result);
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static SByte[] _data2 = new SByte[Op2ElementCount];
private static Vector128<SByte> _clsVar1;
private static Vector128<SByte> _clsVar2;
private Vector128<SByte> _fld1;
private Vector128<SByte> _fld2;
private DataTable _dataTable;
static VectorBinaryOpTest__DotSByte()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public VectorBinaryOpTest__DotSByte()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); }
_dataTable = new DataTable(_data1, _data2, LargestVectorSize);
}
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = Vector128.Dot(
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr)
);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var method = typeof(Vector128).GetMethod(nameof(Vector128.Dot), new Type[] {
typeof(Vector128<SByte>),
typeof(Vector128<SByte>)
});
if (method is null)
{
method = typeof(Vector128).GetMethod(nameof(Vector128.Dot), 1, new Type[] {
typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)),
typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0))
});
}
if (method.IsGenericMethodDefinition)
{
method = method.MakeGenericMethod(typeof(SByte));
}
var result = method.Invoke(null, new object[] {
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr)
});
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, (SByte)(result));
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = Vector128.Dot(
_clsVar1,
_clsVar2
);
ValidateResult(_clsVar1, _clsVar2, result);
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr);
var result = Vector128.Dot(op1, op2);
ValidateResult(op1, op2, result);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new VectorBinaryOpTest__DotSByte();
var result = Vector128.Dot(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = Vector128.Dot(_fld1, _fld2);
ValidateResult(_fld1, _fld2, result);
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = Vector128.Dot(test._fld1, test._fld2);
ValidateResult(test._fld1, test._fld2, result);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
private void ValidateResult(Vector128<SByte> op1, Vector128<SByte> op2, SByte result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), op2);
ValidateResult(inArray1, inArray2, result, method);
}
private void ValidateResult(void* op1, void* op2, SByte result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] inArray2 = new SByte[Op2ElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<SByte>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<SByte>>());
ValidateResult(inArray1, inArray2, result, method);
}
private void ValidateResult(SByte[] left, SByte[] right, SByte result, [CallerMemberName] string method = "")
{
bool succeeded = true;
SByte actualResult = default;
SByte intermResult = default;
for (var i = 0; i < Op1ElementCount; i++)
{
if ((i % Vector128<SByte>.Count) == 0)
{
actualResult += intermResult;
intermResult = default;
}
intermResult += (SByte)(left[i] * right[i]);
}
actualResult += intermResult;
if (actualResult != result)
{
succeeded = false;
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.Dot)}<SByte>(Vector128<SByte>, Vector128<SByte>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: {result}");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Private.Xml.Linq/src/System/Xml/Linq/XHelper.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Debug = System.Diagnostics.Debug;
using System.Reflection;
namespace System.Xml.Linq
{
internal static class XHelper
{
internal static bool IsInstanceOfType(object? o, Type type)
{
Debug.Assert(type != null);
return o != null && type.IsAssignableFrom(o.GetType());
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Debug = System.Diagnostics.Debug;
using System.Reflection;
namespace System.Xml.Linq
{
internal static class XHelper
{
internal static bool IsInstanceOfType(object? o, Type type)
{
Debug.Assert(type != null);
return o != null && type.IsAssignableFrom(o.GetType());
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Speech/src/Internal/SrgsCompiler/CfgScriptRef.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
using System.Speech.Internal.SrgsParser;
namespace System.Speech.Internal.SrgsCompiler
{
[StructLayout(LayoutKind.Sequential)]
internal struct CfgScriptRef
{
#region Internal Fields
// should be private but the order is absolutely key for marshalling
internal int _idRule;
internal int _idMethod;
internal RuleMethodScript _method;
#endregion
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
using System.Speech.Internal.SrgsParser;
namespace System.Speech.Internal.SrgsCompiler
{
[StructLayout(LayoutKind.Sequential)]
internal struct CfgScriptRef
{
#region Internal Fields
// should be private but the order is absolutely key for marshalling
internal int _idRule;
internal int _idMethod;
internal RuleMethodScript _method;
#endregion
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpStreamAsyncResult.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// System.Net.HttpStreamAsyncResult
//
// Authors:
// Gonzalo Paniagua Javier ([email protected])
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Threading;
using System.Threading.Tasks;
namespace System.Net
{
internal sealed class HttpStreamAsyncResult : IAsyncResult
{
private object _locker = new object();
private ManualResetEvent? _handle;
private bool _completed;
internal readonly object _parent;
internal byte[]? _buffer;
internal int _offset;
internal int _count;
internal AsyncCallback? _callback;
internal object? _state;
internal int _synchRead;
internal Exception? _error;
internal bool _endCalled;
internal HttpStreamAsyncResult(object parent)
{
_parent = parent;
}
public void Complete(Exception e)
{
_error = e;
Complete();
}
public void Complete()
{
lock (_locker)
{
if (_completed)
return;
_completed = true;
if (_handle != null)
_handle.Set();
if (_callback != null)
Task.Run(() => _callback(this));
}
}
public object? AsyncState
{
get { return _state; }
}
public WaitHandle AsyncWaitHandle
{
get
{
lock (_locker)
{
if (_handle == null)
_handle = new ManualResetEvent(_completed);
}
return _handle;
}
}
public bool CompletedSynchronously => false;
public bool IsCompleted
{
get
{
lock (_locker)
{
return _completed;
}
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// System.Net.HttpStreamAsyncResult
//
// Authors:
// Gonzalo Paniagua Javier ([email protected])
//
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Threading;
using System.Threading.Tasks;
namespace System.Net
{
internal sealed class HttpStreamAsyncResult : IAsyncResult
{
private object _locker = new object();
private ManualResetEvent? _handle;
private bool _completed;
internal readonly object _parent;
internal byte[]? _buffer;
internal int _offset;
internal int _count;
internal AsyncCallback? _callback;
internal object? _state;
internal int _synchRead;
internal Exception? _error;
internal bool _endCalled;
internal HttpStreamAsyncResult(object parent)
{
_parent = parent;
}
public void Complete(Exception e)
{
_error = e;
Complete();
}
public void Complete()
{
lock (_locker)
{
if (_completed)
return;
_completed = true;
if (_handle != null)
_handle.Set();
if (_callback != null)
Task.Run(() => _callback(this));
}
}
public object? AsyncState
{
get { return _state; }
}
public WaitHandle AsyncWaitHandle
{
get
{
lock (_locker)
{
if (_handle == null)
_handle = new ManualResetEvent(_completed);
}
return _handle;
}
}
public bool CompletedSynchronously => false;
public bool IsCompleted
{
get
{
lock (_locker)
{
return _completed;
}
}
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Security.AccessControl/tests/DiscretionaryAcl/DiscretionaryAcl_Constructor2.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using Xunit;
namespace System.Security.AccessControl.Tests
{
public class DiscretionaryAcl_Constructor2
{
public static IEnumerable<object[]> DiscretionaryACL_Constructor2()
{
yield return new object[] { false, false, 0, 0 };
yield return new object[] { false, true, 127, 0 };
yield return new object[] { true, false, 255, 0 };
yield return new object[] { true, true, 0, 0 };
yield return new object[] { false, false, 127, 1 };
yield return new object[] { false, true, 255, 1 };
yield return new object[] { true, false, 2, 1 };
yield return new object[] { true, true, 4, 1 };
}
[Theory]
[MemberData(nameof(DiscretionaryACL_Constructor2))]
public static bool Constructor2(bool isContainer, bool isDS, byte revision, int capacity)
{
bool result = true;
byte[] dAclBinaryForm = null;
byte[] rAclBinaryForm = null;
RawAcl rawAcl = null;
DiscretionaryAcl discretionaryAcl = null;
discretionaryAcl = new DiscretionaryAcl(isContainer, isDS, revision, capacity);
rawAcl = new RawAcl(revision, capacity);
if (isContainer == discretionaryAcl.IsContainer &&
isDS == discretionaryAcl.IsDS &&
revision == discretionaryAcl.Revision &&
0 == discretionaryAcl.Count &&
8 == discretionaryAcl.BinaryLength &&
true == discretionaryAcl.IsCanonical)
{
dAclBinaryForm = new byte[discretionaryAcl.BinaryLength];
rAclBinaryForm = new byte[rawAcl.BinaryLength];
discretionaryAcl.GetBinaryForm(dAclBinaryForm, 0);
rawAcl.GetBinaryForm(rAclBinaryForm, 0);
if (!Utils.IsBinaryFormEqual(dAclBinaryForm, rAclBinaryForm))
result = false;
//redundant index check
for (int i = 0; i < discretionaryAcl.Count; i++)
{
if (!Utils.IsAceEqual(discretionaryAcl[i], rawAcl[i]))
{
result = false;
break;
}
}
}
else
{
result = false;
}
Assert.True(result);
return result;
}
[Fact]
public static void Constructor2_NegativeCapacity()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new DiscretionaryAcl(false, false, 0, -1));
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using Xunit;
namespace System.Security.AccessControl.Tests
{
public class DiscretionaryAcl_Constructor2
{
public static IEnumerable<object[]> DiscretionaryACL_Constructor2()
{
yield return new object[] { false, false, 0, 0 };
yield return new object[] { false, true, 127, 0 };
yield return new object[] { true, false, 255, 0 };
yield return new object[] { true, true, 0, 0 };
yield return new object[] { false, false, 127, 1 };
yield return new object[] { false, true, 255, 1 };
yield return new object[] { true, false, 2, 1 };
yield return new object[] { true, true, 4, 1 };
}
[Theory]
[MemberData(nameof(DiscretionaryACL_Constructor2))]
public static bool Constructor2(bool isContainer, bool isDS, byte revision, int capacity)
{
bool result = true;
byte[] dAclBinaryForm = null;
byte[] rAclBinaryForm = null;
RawAcl rawAcl = null;
DiscretionaryAcl discretionaryAcl = null;
discretionaryAcl = new DiscretionaryAcl(isContainer, isDS, revision, capacity);
rawAcl = new RawAcl(revision, capacity);
if (isContainer == discretionaryAcl.IsContainer &&
isDS == discretionaryAcl.IsDS &&
revision == discretionaryAcl.Revision &&
0 == discretionaryAcl.Count &&
8 == discretionaryAcl.BinaryLength &&
true == discretionaryAcl.IsCanonical)
{
dAclBinaryForm = new byte[discretionaryAcl.BinaryLength];
rAclBinaryForm = new byte[rawAcl.BinaryLength];
discretionaryAcl.GetBinaryForm(dAclBinaryForm, 0);
rawAcl.GetBinaryForm(rAclBinaryForm, 0);
if (!Utils.IsBinaryFormEqual(dAclBinaryForm, rAclBinaryForm))
result = false;
//redundant index check
for (int i = 0; i < discretionaryAcl.Count; i++)
{
if (!Utils.IsAceEqual(discretionaryAcl[i], rawAcl[i]))
{
result = false;
break;
}
}
}
else
{
result = false;
}
Assert.True(result);
return result;
}
[Fact]
public static void Constructor2_NegativeCapacity()
{
Assert.Throws<ArgumentOutOfRangeException>(() => new DiscretionaryAcl(false, false, 0, -1));
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/MaxAcross.Vector128.SByte.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void MaxAcross_Vector128_SByte()
{
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_SByte();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleUnaryOpTest__MaxAcross_Vector128_SByte
{
private struct DataTable
{
private byte[] inArray1;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle outHandle;
private ulong alignment;
public DataTable(SByte[] inArray1, SByte[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector128<SByte> _fld1;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
return testStruct;
}
public void RunStructFldScenario(SimpleUnaryOpTest__MaxAcross_Vector128_SByte testClass)
{
var result = AdvSimd.Arm64.MaxAcross(_fld1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleUnaryOpTest__MaxAcross_Vector128_SByte testClass)
{
fixed (Vector128<SByte>* pFld1 = &_fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(pFld1))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static Vector128<SByte> _clsVar1;
private Vector128<SByte> _fld1;
private DataTable _dataTable;
static SimpleUnaryOpTest__MaxAcross_Vector128_SByte()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__MaxAcross_Vector128_SByte()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
_dataTable = new DataTable(_data1, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.MaxAcross(
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(_dataTable.inArray1Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.MaxAcross), new Type[] { typeof(Vector128<SByte>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.MaxAcross), new Type[] { typeof(Vector128<SByte>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector128((SByte*)(_dataTable.inArray1Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.MaxAcross(
_clsVar1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector128<SByte>* pClsVar1 = &_clsVar1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(pClsVar1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr);
var result = AdvSimd.Arm64.MaxAcross(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector128((SByte*)(_dataTable.inArray1Ptr));
var result = AdvSimd.Arm64.MaxAcross(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_SByte();
var result = AdvSimd.Arm64.MaxAcross(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_SByte();
fixed (Vector128<SByte>* pFld1 = &test._fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(pFld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.MaxAcross(_fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector128<SByte>* pFld1 = &_fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(pFld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.MaxAcross(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(&test._fld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector128<SByte> op1, void* result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<SByte>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.MaxAcross(firstOp) != result[0])
{
succeeded = false;
}
else
{
for (int i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.MaxAcross)}<SByte>(Vector128<SByte>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void MaxAcross_Vector128_SByte()
{
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_SByte();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleUnaryOpTest__MaxAcross_Vector128_SByte
{
private struct DataTable
{
private byte[] inArray1;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle outHandle;
private ulong alignment;
public DataTable(SByte[] inArray1, SByte[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector128<SByte> _fld1;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
return testStruct;
}
public void RunStructFldScenario(SimpleUnaryOpTest__MaxAcross_Vector128_SByte testClass)
{
var result = AdvSimd.Arm64.MaxAcross(_fld1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleUnaryOpTest__MaxAcross_Vector128_SByte testClass)
{
fixed (Vector128<SByte>* pFld1 = &_fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(pFld1))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte);
private static SByte[] _data1 = new SByte[Op1ElementCount];
private static Vector128<SByte> _clsVar1;
private Vector128<SByte> _fld1;
private DataTable _dataTable;
static SimpleUnaryOpTest__MaxAcross_Vector128_SByte()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
}
public SimpleUnaryOpTest__MaxAcross_Vector128_SByte()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); }
_dataTable = new DataTable(_data1, new SByte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.MaxAcross(
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(_dataTable.inArray1Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.MaxAcross), new Type[] { typeof(Vector128<SByte>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.MaxAcross), new Type[] { typeof(Vector128<SByte>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector128((SByte*)(_dataTable.inArray1Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.MaxAcross(
_clsVar1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector128<SByte>* pClsVar1 = &_clsVar1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(pClsVar1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr);
var result = AdvSimd.Arm64.MaxAcross(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector128((SByte*)(_dataTable.inArray1Ptr));
var result = AdvSimd.Arm64.MaxAcross(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_SByte();
var result = AdvSimd.Arm64.MaxAcross(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleUnaryOpTest__MaxAcross_Vector128_SByte();
fixed (Vector128<SByte>* pFld1 = &test._fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(pFld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.MaxAcross(_fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector128<SByte>* pFld1 = &_fld1)
{
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(pFld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.MaxAcross(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.MaxAcross(
AdvSimd.LoadVector128((SByte*)(&test._fld1))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector128<SByte> op1, void* result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "")
{
SByte[] inArray1 = new SByte[Op1ElementCount];
SByte[] outArray = new SByte[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<SByte>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(SByte[] firstOp, SByte[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.MaxAcross(firstOp) != result[0])
{
succeeded = false;
}
else
{
for (int i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.MaxAcross)}<SByte>(Vector128<SByte>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M13-RTM/b113239/b113239.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics;
using System.Text;
public class A
{
public static void A1(ulong p1, byte[] p2, int p3, int p4)
{
byte[] tmp;
tmp = BitConverter.GetBytes((ushort)p1);
Buffer.BlockCopy(tmp, 0, p2, p3, 2);
return;
}
public static void A2(ulong p1, byte[] p2, int p3, int p4, bool p5)
{
switch (p4)
{
case 12:
A.A1(p1, p2, p3 + 0, 8);
break;
}
}
}
public class B
{
public static int B1(long OPD2_VAL, long OPD3_VAL, byte[] OPD1, int OPD1_OFS, int OPD1_L)
{
ulong wopd2H = 0;
ulong wopd2L = 0;
ulong wopd3H = 0;
ulong wopd3L = 0;
ulong wopd1H = 0;
ulong wopd1L = 0;
long wressign = 0;
Console.Write("OPD2_VAL: ");
Console.WriteLine(-123456781234567L);
wressign = (-123456781234567L >> 63) ^ (OPD3_VAL >> 63);
ulong wtmp;
if (-123456781234567L < 0)
{
wtmp = (ulong)(-123456781234567L * -1);
}
else
{
wtmp = (ulong)(123456781234567L);
}
wopd2H = (ulong)wtmp >> 32;
wopd2L = (ulong)((uint)wtmp);
if (OPD3_VAL < 0)
{
wtmp = (ulong)(OPD3_VAL * -1);
}
else
{
wtmp = (ulong)(OPD3_VAL);
}
wopd3H = (ulong)wtmp >> 32;
wopd3L = (ulong)((uint)wtmp);
Console.Write("wopd3L: ");
Console.WriteLine(wopd3L);
ulong wtmp11 = wopd2L * wopd3L;
ulong wtmp12 = wopd2H * wopd3L;
ulong wtmp13 = wopd2L * wopd3H;
ulong wtmp14 = wopd2H * wopd3H;
Console.Write("wtmp12: ");
Console.WriteLine(wtmp12);
Console.Write("wtmp13: ");
Console.WriteLine(wtmp13);
Console.Write("wtmp14: ");
Console.WriteLine(wtmp14);
ulong wtmp21 = (ulong)((uint)wtmp11);
ulong wtmp22 = (ulong)(wtmp11 >> 32)
+ (ulong)((uint)wtmp12)
+ (ulong)((uint)wtmp13);
ulong wtmp23 = (ulong)(wtmp22 >> 32)
+ (ulong)(wtmp12 >> 32)
+ (ulong)(wtmp13 >> 32)
+ (ulong)((uint)wtmp14);
ulong wtmp24 = (ulong)(wtmp23 >> 32)
+ (ulong)(wtmp14 >> 32);
Console.Write("wtmp22: ");
Console.WriteLine(wtmp22);
Console.Write("wtmp23 (must be 826247535): ");
Console.WriteLine(wtmp23);
if (wtmp23 != 826247535)
{
Console.WriteLine("FAILED");
return -1;
}
Console.Write("wtmp24 (must be 0): ");
Console.WriteLine(wtmp24);
if (wtmp24 != 0)
{
Console.WriteLine("FAILED");
return -1;
}
wopd1L = (wtmp22 << 32) | wtmp21;
wopd1H = (wtmp24 << 32) | (ulong)((uint)wtmp23);
if (wressign < 0L)
{
wopd1L = (~wopd1L) + 1UL;
wopd1H = ~wopd1H;
if (wopd1L == 0UL) wopd1H++;
}
A.A2((ulong)wopd1L, OPD1, OPD1_OFS, OPD1_L, true);
A.A2((ulong)wopd1H, OPD1, OPD1_OFS, OPD1_L, false);
Console.WriteLine("PASSED");
return 100;
}
}
internal class Test_b113239
{
public static int Main()
{
byte[] block = new byte[20];
int retval = B.B1(-123456781234567L, -123456781234567L, block, 0, 0);
return retval;
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics;
using System.Text;
public class A
{
public static void A1(ulong p1, byte[] p2, int p3, int p4)
{
byte[] tmp;
tmp = BitConverter.GetBytes((ushort)p1);
Buffer.BlockCopy(tmp, 0, p2, p3, 2);
return;
}
public static void A2(ulong p1, byte[] p2, int p3, int p4, bool p5)
{
switch (p4)
{
case 12:
A.A1(p1, p2, p3 + 0, 8);
break;
}
}
}
public class B
{
public static int B1(long OPD2_VAL, long OPD3_VAL, byte[] OPD1, int OPD1_OFS, int OPD1_L)
{
ulong wopd2H = 0;
ulong wopd2L = 0;
ulong wopd3H = 0;
ulong wopd3L = 0;
ulong wopd1H = 0;
ulong wopd1L = 0;
long wressign = 0;
Console.Write("OPD2_VAL: ");
Console.WriteLine(-123456781234567L);
wressign = (-123456781234567L >> 63) ^ (OPD3_VAL >> 63);
ulong wtmp;
if (-123456781234567L < 0)
{
wtmp = (ulong)(-123456781234567L * -1);
}
else
{
wtmp = (ulong)(123456781234567L);
}
wopd2H = (ulong)wtmp >> 32;
wopd2L = (ulong)((uint)wtmp);
if (OPD3_VAL < 0)
{
wtmp = (ulong)(OPD3_VAL * -1);
}
else
{
wtmp = (ulong)(OPD3_VAL);
}
wopd3H = (ulong)wtmp >> 32;
wopd3L = (ulong)((uint)wtmp);
Console.Write("wopd3L: ");
Console.WriteLine(wopd3L);
ulong wtmp11 = wopd2L * wopd3L;
ulong wtmp12 = wopd2H * wopd3L;
ulong wtmp13 = wopd2L * wopd3H;
ulong wtmp14 = wopd2H * wopd3H;
Console.Write("wtmp12: ");
Console.WriteLine(wtmp12);
Console.Write("wtmp13: ");
Console.WriteLine(wtmp13);
Console.Write("wtmp14: ");
Console.WriteLine(wtmp14);
ulong wtmp21 = (ulong)((uint)wtmp11);
ulong wtmp22 = (ulong)(wtmp11 >> 32)
+ (ulong)((uint)wtmp12)
+ (ulong)((uint)wtmp13);
ulong wtmp23 = (ulong)(wtmp22 >> 32)
+ (ulong)(wtmp12 >> 32)
+ (ulong)(wtmp13 >> 32)
+ (ulong)((uint)wtmp14);
ulong wtmp24 = (ulong)(wtmp23 >> 32)
+ (ulong)(wtmp14 >> 32);
Console.Write("wtmp22: ");
Console.WriteLine(wtmp22);
Console.Write("wtmp23 (must be 826247535): ");
Console.WriteLine(wtmp23);
if (wtmp23 != 826247535)
{
Console.WriteLine("FAILED");
return -1;
}
Console.Write("wtmp24 (must be 0): ");
Console.WriteLine(wtmp24);
if (wtmp24 != 0)
{
Console.WriteLine("FAILED");
return -1;
}
wopd1L = (wtmp22 << 32) | wtmp21;
wopd1H = (wtmp24 << 32) | (ulong)((uint)wtmp23);
if (wressign < 0L)
{
wopd1L = (~wopd1L) + 1UL;
wopd1H = ~wopd1H;
if (wopd1L == 0UL) wopd1H++;
}
A.A2((ulong)wopd1L, OPD1, OPD1_OFS, OPD1_L, true);
A.A2((ulong)wopd1H, OPD1, OPD1_OFS, OPD1_L, false);
Console.WriteLine("PASSED");
return 100;
}
}
internal class Test_b113239
{
public static int Main()
{
byte[] block = new byte[20];
int retval = B.B1(-123456781234567L, -123456781234567L, block, 0, 0);
return retval;
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/TypeLibVarAttributeTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.Runtime.InteropServices.Tests
{
public class TypeLibVarAttributeTests
{
[Theory]
[InlineData((TypeLibVarFlags)(-1))]
[InlineData((TypeLibVarFlags)0)]
[InlineData(TypeLibVarFlags.FBindable)]
public void Ctor_TypeLibVarFlags(TypeLibVarFlags flags)
{
var attribute = new TypeLibVarAttribute(flags);
Assert.Equal(flags, attribute.Value);
}
[Theory]
[InlineData(-1)]
[InlineData(0)]
[InlineData(4)]
public void Ctor_ShortFlags(short flags)
{
var attribute = new TypeLibVarAttribute(flags);
Assert.Equal((TypeLibVarFlags)flags, attribute.Value);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.Runtime.InteropServices.Tests
{
public class TypeLibVarAttributeTests
{
[Theory]
[InlineData((TypeLibVarFlags)(-1))]
[InlineData((TypeLibVarFlags)0)]
[InlineData(TypeLibVarFlags.FBindable)]
public void Ctor_TypeLibVarFlags(TypeLibVarFlags flags)
{
var attribute = new TypeLibVarAttribute(flags);
Assert.Equal(flags, attribute.Value);
}
[Theory]
[InlineData(-1)]
[InlineData(0)]
[InlineData(4)]
public void Ctor_ShortFlags(short flags)
{
var attribute = new TypeLibVarAttribute(flags);
Assert.Equal((TypeLibVarFlags)flags, attribute.Value);
}
}
}
| -1 |
dotnet/runtime
| 66,403 |
Implement System.Decimal.Scale
|
Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
MichalPetryka
| 2022-03-09T19:07:55Z | 2022-03-10T03:26:37Z |
c2ec86b1c552ac8a1749f9f98e012f707e325660
|
4ba076e988db4b68bacad7450b945a4e07730025
|
Implement System.Decimal.Scale. Adds System.Decimal.Scale, a property that
returns the scaling factor of the decimal.
Closes #65074.
|
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/ShiftRightLogicalRoundedNarrowingSaturateUpper.Vector128.Int32.1.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1()
{
var test = new ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Int32[] inArray1, Int64[] inArray2, Int32[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int64>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int64, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Int32> _fld1;
public Vector128<Int64> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref testStruct._fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
return testStruct;
}
public void RunStructFldScenario(ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1 testClass)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(_fld1, _fld2, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1 testClass)
{
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector128<Int64>* pFld2 = &_fld2)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector128((Int64*)(pFld2)),
1
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static readonly byte Imm = 1;
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
private static Vector64<Int32> _clsVar1;
private static Vector128<Int64> _clsVar2;
private Vector64<Int32> _fld1;
private Vector128<Int64> _fld2;
private DataTable _dataTable;
static ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); }
_dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector128((Int64*)(_dataTable.inArray2Ptr)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper), new Type[] { typeof(Vector64<Int32>), typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper), new Type[] { typeof(Vector64<Int32>), typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector128((Int64*)(_dataTable.inArray2Ptr)),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
_clsVar1,
_clsVar2,
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<Int32>* pClsVar1 = &_clsVar1)
fixed (Vector128<Int64>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(pClsVar1)),
AdvSimd.LoadVector128((Int64*)(pClsVar2)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr);
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(op1, op2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector128((Int64*)(_dataTable.inArray2Ptr));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(op1, op2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1();
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(test._fld1, test._fld2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1();
fixed (Vector64<Int32>* pFld1 = &test._fld1)
fixed (Vector128<Int64>* pFld2 = &test._fld2)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector128((Int64*)(pFld2)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(_fld1, _fld2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector128<Int64>* pFld2 = &_fld2)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector128((Int64*)(pFld2)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(test._fld1, test._fld2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(&test._fld1)),
AdvSimd.LoadVector128((Int64*)(&test._fld2)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<Int32> firstOp, Vector128<Int64> secondOp, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), firstOp);
Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), secondOp);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* firstOp, void* secondOp, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] firstOp, Int64[] secondOp, Int32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < RetElementCount; i++)
{
if (Helpers.ShiftRightLogicalRoundedNarrowingSaturateUpper(firstOp, secondOp, Imm, i) != result[i])
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper)}<Int32>(Vector64<Int32>, Vector128<Int64>, 1): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" secondOp: ({string.Join(", ", secondOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1()
{
var test = new ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Int32[] inArray1, Int64[] inArray2, Int32[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int64>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int64, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Int32> _fld1;
public Vector128<Int64> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref testStruct._fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
return testStruct;
}
public void RunStructFldScenario(ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1 testClass)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(_fld1, _fld2, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1 testClass)
{
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector128<Int64>* pFld2 = &_fld2)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector128((Int64*)(pFld2)),
1
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32);
private static readonly byte Imm = 1;
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static Int64[] _data2 = new Int64[Op2ElementCount];
private static Vector64<Int32> _clsVar1;
private static Vector128<Int64> _clsVar2;
private Vector64<Int32> _fld1;
private Vector128<Int64> _fld2;
private DataTable _dataTable;
static ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
}
public ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); }
_dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector128((Int64*)(_dataTable.inArray2Ptr)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper), new Type[] { typeof(Vector64<Int32>), typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper), new Type[] { typeof(Vector64<Int32>), typeof(Vector128<Int64>), typeof(byte) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector128((Int64*)(_dataTable.inArray2Ptr)),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
_clsVar1,
_clsVar2,
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<Int32>* pClsVar1 = &_clsVar1)
fixed (Vector128<Int64>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(pClsVar1)),
AdvSimd.LoadVector128((Int64*)(pClsVar2)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr);
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(op1, op2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector128((Int64*)(_dataTable.inArray2Ptr));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(op1, op2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1();
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(test._fld1, test._fld2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new ImmBinaryOpTest__ShiftRightLogicalRoundedNarrowingSaturateUpper_Vector128_Int32_1();
fixed (Vector64<Int32>* pFld1 = &test._fld1)
fixed (Vector128<Int64>* pFld2 = &test._fld2)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector128((Int64*)(pFld2)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(_fld1, _fld2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector128<Int64>* pFld2 = &_fld2)
{
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector128((Int64*)(pFld2)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(test._fld1, test._fld2, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper(
AdvSimd.LoadVector64((Int32*)(&test._fld1)),
AdvSimd.LoadVector128((Int64*)(&test._fld2)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<Int32> firstOp, Vector128<Int64> secondOp, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), firstOp);
Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), secondOp);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* firstOp, void* secondOp, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
Int64[] inArray2 = new Int64[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(secondOp), (uint)Unsafe.SizeOf<Vector128<Int64>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] firstOp, Int64[] secondOp, Int32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < RetElementCount; i++)
{
if (Helpers.ShiftRightLogicalRoundedNarrowingSaturateUpper(firstOp, secondOp, Imm, i) != result[i])
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ShiftRightLogicalRoundedNarrowingSaturateUpper)}<Int32>(Vector64<Int32>, Vector128<Int64>, 1): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" secondOp: ({string.Join(", ", secondOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.