This PR separates cleaning up caller allocated resources and callee allocated resources into separate stages in the managed to unmanaged direction. Caller allocated parameters (anything except 'out') will clean up the same way. Callee allocated parameters ('out' parameters) will be cleaned up only if the invocation succeeded.
* Calendar WIP.
* Genitive months.
* Short pattern.
* NativeCalendarName does not exist on WebAPI - use EnglishCalendarName.
* Fix failures in Locales caused by calendars data removal.
* Fix to previous commit.
* Whitespace.
* Implemented Eras.
* Populate NativeName with EnglishName.
* Fix tests.
* Typos + comments removal + block failing test.
* AM/PM designators are not in ICU anymore.
* ShortTimePattern is ready.
* Fix some failing tests.
* LongTimePatterns is ready.
* Ask about all culture info from JS at once.
* Fix remaining tests.
* Calendar Globalization tests fixed.
* Adding test files to projects.
* Build fix.
* Fix the fix.
* .
* Fix tests.
* Load locale info on request + fix Browser scenario tests.
* Fix test on v8.
* Forgotten clean-up.
* Small cleanup in ts.
* V8 11 is behaves more like browser.
* Fixed skipped failing tests.
* Syntax
* V8 returns the same as Browser.
* This API is not affected, no need to test. + Add documentation.
* Revert unintentional change.
* Feedback.
* @radical's feedback + fix after removing unnecessary set.
* Fix.
* Feedback.
* Fix tests.
* Remove `AssemblyMetadata(".NETFrameworkAssembly", "")` attributes
This is likely a .NET Native leftover that is currently (ironically) breaking .NET Native. This attribute indicates to the .NET Native compiler that the assembly can be trimmed.
We're currently setting this on assemblies that no longer carry RD.XML to make this safe. Without this attribute, the assembly will be treated like any other and not trimmed.
Fixes#44697.
* Delete mention of the attribute in docs
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Set the CORINFO_EH_CLAUSE_SAMETRY on CORINFO_EH_CLAUSE
This change makes setting the `CORINFO_EH_CLAUSE_SAMETRY` on
`CORINFO_EH_CLAUSE` to happen for coreclr to. It is a prerequisity for the
port of exception handling from nativeaot to coreclr and it is a noop on
coreclr with the old exception handling.
* Fix comments
* Add clr-abi note and r2rdump support for the flag
* Fix markdown LINT error
* Update docs/design/coreclr/botr/clr-abi.md
* Update docs/design/coreclr/botr/clr-abi.md
* Update the ABI doc
---------
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* CoreCLR and NativeAOT
* Add UnsafeAccessorAttribute API
* Implement IL generation for all accessor paths
* Implement static/instance field lookup - non-generic
* Implement static/instance method lookup - non-generic
* Defined ambiguity logic with respect to
custom modifiers.
- First pass ignore custom modifiers
- If ambiguity detected, rerun algorithm but
require precise matching of custom modifiers.
- If there is no clear match throw AmbiguousImplementationException.
* Cleanup memory management confusion
with ILStubResolver.
* Fix non-standard C++
* Remove CORINFO_MODULE_ALLACCESS scope
* Remove enum METHOD_TYPE.
* Update BOTR on TypeDesc
* Skip type validation by default in ReadyToRun images
- Technically, this is a breaking change, so I've provided a means for disabling the type validation skip
- The model is that the C# compile won't get these details wrong, so disable the checks when run through crossgen2. The idea is that we'll get these things checked during normal, non-R2R usage of the app, and publish won't check these details.
* Replace expensive lookups of generic parameter and nested class data with R2R optimized forms
* Store index of MethodDesc as well as ChunkIndex. Makes MethodDesc::GetTemporaryEntryPoint *much* faster
* Optimize the path for computing if a method is eligible for tiered compilation
* Remove CanShareVtableChunksFrom concept
- it was only needed to support NGen
* Fix up some more issues
* Bring back late virtual propagation in the presence of covariant overrides only
* Check correct flag on EEClass
* Drive by fix for GetRestoredSlot. We don't need the handling of unrestored slots anymore
* Fix composite build with new tables
* Uniquify the mangled names
* Add more __
* Initial pass at type skip verifation checker
* Fix logging and some correctness issues
* Enable the more of type checking
- Notably, the recursive stuff now works
- Also fix a bug in constraint checking involving open types in the type system
* Fix build breaks involving new feature of GenericParameterDesc
* Add documentation for R2R format changes
Fix command line parameter to be more reasonable, and allow logging on command
Fix the rest of issues noted in crossgen2 testing
* Fix implementation of CompareMethodContraints. instead of using IsGeneric map, check to see if the method is generic in the first place. It turns out we have an efficient way to check in every place that matters
* Fix nits noticed by Aaron
* Add some const correctness to the world
* Fix issues noted by Michal, as well as remaining constrain checking issues
* Code review details
* Code review from trylek
* Initial change.
* Filename update.
* WBT for WASM.
* Updated docs.
* Run Hybrid wbt on CI.
* Feedback + hierarchy compatible with #86255.
* Feedback. Test program code to assets.
* Ensure Vector2/3/4, Quaternion, and Plane don't have a false dependency on Vector<T>
* Apply JIT formatting patch
* Fixing a build issue
* Handle an SPMI assert
* Fixing a couple small typos
* Remove getMaxIntrinsicSIMDVectorLength from the JIT/EE interface
* Update src/coreclr/vm/methodtablebuilder.cpp
---------
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Add an undocumented switch to allow controlling the preferred vector width emitted implicitly by the JIT
* Resolving issues and responding to PR feedback
* Simplifying the xarch cpu info check
* A bit faster version of indexing. WIP
* Tiny speedup.
* Fixed IndexOf, ToDo: LastIndexOf.
* All tests pass.
* Updated docs.
* Update docs.
* Slicing + saving previous absolute index instead of pushing the iterator to the start position.
* Refactored.
* Fixed tests on browser.
* Str1 and str2 was confusing.
* Fix CI- correctly trimming Hybrid properties.
* Previous commit should target only Browser.
* Applied @mkhamoyan's suggestion to avoid code duplication.
* Applied @pavelsavara's review.
* Get rid of build errors.
* Revert.
See https://github.com/markples/utils/tree/for-PR-dotnet-runtime-85847-others for ILTransform tool. As usual, I recommend viewing the commit list since it partitions the changes in a more readable way and paying more attention to manual changes.
* [ILTransform -public] Make test entrypoints accessible
* [ILTransform -ilfact] Main->TestEntryPoint, [Fact], remove OutputType=Exe
* Manual fixes for xUnit1013 - internal methods
* Add merged group
* Update porting-ryujit.md with info on merged test groups
Define a WebAssembly module wrapper for Webcil assemblies.
Contributes to #80807
### Why
In some settings serving `application/octet-stream` data, or files with weird extensions will trigger firewalls or AV tools. But let's assume that if you're interested in deploying a .NET WebAssembly app, you're in an environment that can at least serve WebAssembly modules.
### How
Essentially we serve this WebAssembly module:
```wat
(module
(data "\0f\00\00\00") ;; data segment 0: payload size
(data "webcil Payload\cc") ;; data segment 1: webcil payload
(memory (import "webcil" "memory") 1)
(global (export "webcilVersion") i32 (i32.const 0))
(func (export "getWebcilSize") (param $destPtr i32) (result)
local.get $destPtr
i32.const 0
i32.const 4
memory.init 0)
(func (export "getWebcilPayload") (param $d i32) (param $n i32) (result)
local.get $d
i32.const 0
local.get $n
memory.init 1))
```
The module exports two WebAssembly functions `getWebcilSize` and `getWebcilPayload` that write some bytes (being the size or payload of the webcil assembly) to the linear memory at a given offset. The module also exports the constant `webcilVersion` to version the wrapper format.
So a runtime or tool that wants to consume the webcil module can do something like:
```js
const wasmModule = new WebAssembly.Module (...);
const wasmMemory = new WebAssembly.Memory ({initial: 1});
const wasmInstance =
new WebAssembly.Instance(wasmModule, {webcil: {memory: wasmMemory}});
const { getWebcilPayload, webcilVersion, getWebcilSize } = wasmInstance.exports;
console.log (`Version ${webcilVersion.value}`);
getWebcilSize(0);
const size = new Int32Array (wasmMemory.buffer)[0]
console.log (`Size ${size}`);
console.log (new Uint8Array(wasmMemory.buffer).subarray(0, 20));
getWebcilPayload(4, size);
console.log (new Uint8Array(wasmMemory.buffer).subarray(0, 20));
```
### How (Part 2)
But actually, we will define the wrapper to consist of exactly 2 data segments in the WebAssembly data section: segment 0 is 4 bytes and encodes the webcil payload size; and segment 1 is of variable size and contains the webcil payload.
So to load a webcil-in-wasm module, the runtime gets the _raw bytes_ of the WebAssembly module (ie: without instantiating it), and parses it to find the data section, assert that there are 2 segments, ensure they're both passive, and get the data directly from segment 1.
---
* Add option to emit webcil inside a wasm module wrapper
* [mono][loader] implement a webcil-in-wasm reader
* reword WebcilWasmWrapper summary comment
* update the Webcil spec to include the WebAssembly wrapper module
* Adjust RVA map offsets to account for wasm prefix
MonoImage:raw_data is used as a base when applying the RVA map to map virtual addresses to physical offsets in the assembly. With webcil-in-wasm there's an extra wasm prefix before the webcil payload starts, so we need to account for this extra data when creating the mapping.
An alternative is to compute the correct offsets as part of generating the webcil, but that would entangle the wasm module and the webcil payload. The current (somewhat hacky approach) keeps them logically separate.
* Add a note about the rva mapping to the spec
* Serve webcil-in-wasm as .wasm
* remove old .webcil support from Sdk Pack Tasks
* Implement support for webcil in wasm in the managed WebcilReader
* align webcil payload to a 4-byte boundary within the wasm module
Add padding to data segment 0 to ensure that data segment 1's payload (ie the webcil content itself) is 4-byte aligned
* assert that webcil raw data is 4-byte aligned
* add 4-byte alignment requirement to the webcil spec
* Don't modify MonoImageStorage:raw_data
instead just keep track of the webcil offset in the MonoImageStorage.
This introduces a situation where MonoImage:raw_data is different from MonoImageStorage:raw_data. The one to use for accessing IL and metadata is MonoImage:raw_data.
The storage pointer is just used by the image loading machinery
---------
Co-authored-by: Larry Ewing <lewing@microsoft.com>
* Implement analyzer for platform intrinsics use in System.Private.CoreLib
This analyzer detects the use of all platform intrinsics and checks to
ensure that they are all used either protected by an if statement OR
ternary operator which checks an appropriate IsSupported flag, or that
the intrinsic is used within a method where the behavior of platform
support for the intrinsic is not allowed to vary between compile time
and runtime. The analyzer attempts to be conservative about allowed patterns.
All existing code in System.Private.CoreLib has been annotated to avoid producing
errors.
See the markdown document for details.
Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
Fixes#74035
We can't remove the built-in marshalling support from the generator yet, but once the out-of-band packages we ship don't support .NET 6. we can remove the built-in support that emits the marshalling code in the stub. I believe the .NET 9 packages won't support .NET 6, so once we snap for .NET 9 and update how we ship the packages, we can clean this up.
This PR also adds a requested feature to the SafeHandle marshaller: If the call to native code fails, we'll call Dispose() on the pre-allocated handle to avoid leaking it to the finalizer queue.
* EnC non-functional changes
- Update inappropriate naming
- Update many logging statements
- Remove unused code
* EnC support for fields on generic types
* EnC support for methods on generic types
* Fix use after free introduced in EnC breakpoint.
Fix off by one for string logging.
* update new feature capabilities, JIT GUID
* Fix non-enc build
* Fix EnCFieldIndex check
* Remove IsFdPrivate assert
---------
Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
Co-authored-by: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com>
Co-authored-by: Tom McDonald <tommcdon@microsoft.com>
* Implementation.
* HG does not belong to legacy code.
* No need to create new instance when existing one is exported.
* TextEncoder's behavior varies between hosts.
* Nit
* Cutting prevents us from using IgnoreSymbols.
* Fixed asserts.
* Fix.
* Match platform with behavior.
* Missing changes to prev commit.
* Throw on SortKey.
* Fix NLS tests.
* Do not add these files for WASI.
* Removed WASI from targets.
* Run tests with HG only on browser, rename.
* Missing WASI removal.
* General docs fix.
* Storing exception text as resource string.
* Remove WASI targets from HybridGlobalization.
* Update docs.
* Run tests only on browser.
* Do not add these files for WASI.
* Tests run only on browser.
* Missing removal.
Add an config option to use a "scalable" profile helper for edge counters,
where we try and avoid contention by probablistic updates once the counter
value exceeds some threshold (currently 8192). Using the current xorshift
RNG this gives the counter a two-sigma accuracy of around +/- 2%.
The idea is loosely based on "Scalable Statistics Counters" by Dice, Lev,
and Moir (SPAA’13).
Also allow the scalable and interlocked profile modes to operate at the same
time, recording two sets of counts per probe, so we can verify that this new mode
is sufficiently accurate.
* Added support for hybrid globalization comparison.
* Clean-up. Added exception test cases to docs.
* Nit changes from @kg's review.
* Applied @kg's review.
* Revert unintentional change.
* Refactor: all hybrid globalization js methods in one file.
* Color the syntax.
* Undeline the fact that this PR is only for WASM.
* Move interop functions to proper location.
* Enabled `HybridGlobalization` mode.
* Enabled non-icu change case.
* Tests.
* Revert not connected changes.
* Fix: Add the new file to the project.
* Fix: this PR is for Browser, so add it to condition.
* Fixed calls to js.
* Trying to fix CI.
* False is default, redundant lines.
* Trying to fix the CI.
* Remove redundant code.
* This PR is partial solution, this file will be added in a follow-up.
* Fix for EAT lib tests.
* We do not trim anything for Hybrid currently.
* Check if functions invoked only in specific modes.
* Change confusing name + move the common property to the main part of the class.
* Applied @mkhamoyan's suggestion.
* Fix previous commit: missing directive.
* Fix previous commit: missing directive.
* It's not IOS-connected.
* Move hybrid tests to correct dir + separate ios and wasm + update sln.
* Invariant and hybrid cannot be both true.
* Remove old version of hybrid tests proj.
* Applied @kg's review.