Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Spannified internals of BigInteger
Proposed refactoring according with issue: dotnet/runtime#22609. The implementation plan consists of the following steps: - [x] Replace unmanaged pointers with managed ones as well as remove unsafe code and pinning - [x] Beautify stack allocation - [x] Use spans wherever possible, especially for memory slicing - [ ] Simplify (or probably remove at all) `BitsBuffer` value type - [ ] Spannify `FastReducer` value type - [ ] Attempt to replace some array allocations with span slicing - [ ] Square, Multiply and bitwise operations use heap-based allocation of arrays if their length is greater than or equal to stack allocation threshold. Maybe replace it with array pooling using shared `ArrayPool<T>`? - [ ] BMI intrinsics?? Spannified versions of internal and private static methods look pretty nice. However, I'm not sure about performance of passing span to the method. If RyuJIT uses scalar replacement then it's good news. Otherwise, maybe pass length and managed pointer to the first element as separate arguments to ensure that they passed through registers. This version was implemented in the first commit. I need advice here as well as preliminary code review because further work fully based on signatures of spannified methods. cc @tannergooding , @stephentoub
- Loading branch information