-
-
Notifications
You must be signed in to change notification settings - Fork 57
64 bit support #468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
64 bit support #468
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request updates the FlatSharp codebase to support 64‐bit sizes by changing various APIs from int to long and cleaning up obsolete polyfill usings for NETSTANDARD2_0. Key changes include:
- Converting serialization methods’ return types (GetMaxSize, Write) and related exception properties from int to long.
- Adjusting benchmark methods and constants to use long for lengths and serialization results.
- Updating runtime configurations for benchmarks to target Core80.
Reviewed Changes
Copilot reviewed 109 out of 118 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/FlatSharp.Runtime/GlobalUsings.cs | Removed obsolete polyfill global using for NETSTANDARD2_0. |
| src/FlatSharp.Runtime/GeneratedSerializerWrapper.cs | Updated API signatures from int to long and adjusted parameter types for 64-bit support. |
| src/FlatSharp.Runtime/FSThrow.cs & BufferTooSmallException.cs | Changed BufferTooSmall signature and SizeNeeded property to use long. |
| src/FlatSharp.Compiler/GlobalUsings.cs | Removed obsolete polyfill global using for NETSTANDARD2_0. |
| Benchmarks/MicroBench.Current/SerializeBenchmarks.cs | Updated benchmark methods to use long return types and introduced a new method for random entries serialization. |
| Benchmarks/MicroBench.Current/Program.cs | Updated runtime configuration from Core70 to Core80 and adjusted job settings. |
| Benchmarks/MicroBench.Current/Constants.cs | Added a new NestedTable random entries buffer and updated AllocateAndSerialize to use long. |
| Benchmarks/Benchmark/Serializers/FlatSharpValueStructs.cs & FlatSharpHelper.cs | Updated helper methods for serialization to return and process long values instead of int. |
Files not reviewed (9)
- .github/workflows/MonoAotValidation.yml: Language not supported
- src/Benchmarks/Benchmark/Benchmark.csproj: Language not supported
- src/Benchmarks/Microbench.fbs: Language not supported
- src/Directory.Build.props: Language not supported
- src/Directory.Packages.props: Language not supported
- src/FlatSharp.Compiler/FlatSharp.Compiler.csproj: Language not supported
- src/FlatSharp.Compiler/FlatSharp.Compiler.nuspec: Language not supported
- src/FlatSharp.Compiler/FlatSharp.Compiler.targets: Language not supported
- src/FlatSharp.Runtime/FlatSharp.Runtime.csproj: Language not supported
Comments suppressed due to low confidence (1)
src/Benchmarks/MicroBench.Current/SerializeBenchmarks.cs:57
- [nitpick] The method name 'Serialize_PrimitivesTable_RandomlyPopulated' suggests it serializes primitive tables but internally it uses the 'NestedTable.Serializer'. Consider renaming the method to better reflect the data type being serialized (e.g., Serialize_NestedTable_RandomEntries) for improved clarity.
public long Serialize_PrimitivesTable_RandomlyPopulated()
|
|
||
| private static byte[] AllocateAndSerialize<T>(T value) where T : class, IFlatBufferSerializable<T> | ||
| { | ||
| byte[] buffer = new byte[value.Serializer.GetMaxSize(value)]; |
Copilot
AI
Apr 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the buffer allocated using an int-based length is sufficient to handle the long value returned by the Write method. A mismatch here might cause issues if the length exceeds int.MaxValue.
| byte[] buffer = new byte[value.Serializer.GetMaxSize(value)]; | |
| long maxSize = value.Serializer.GetMaxSize(value); | |
| if (maxSize > int.MaxValue) | |
| { | |
| throw new InvalidOperationException($"Serialized data size exceeds the maximum buffer size of {int.MaxValue} bytes."); | |
| } | |
| byte[] buffer = new byte[(int)maxSize]; |
No description provided.