-
Notifications
You must be signed in to change notification settings - Fork 39
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
CodeGen: implement the wide architecture set #356
Merged
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
f556c45
(#354) CodeGen: implement the wide architecture set
ForNeVeR 2c8853a
(#354) Runtime: introduce the CPtr type
ForNeVeR 15ed227
(#354) FunctionType: add a TODO about the wide architecture
ForNeVeR 244b6bd
(#354) Docs: document the current decision on pointer portability
ForNeVeR 8ed11c6
(#354) CPtr, FPtr: add tests
ForNeVeR 7c73251
(#354) VoidPtr, FuncPtr
ForNeVeR 3833c05
(#354) Add more tests
ForNeVeR bfbbec1
(#354) Functions: add TODO
ForNeVeR 6f39aa4
(#356) Docs: document the new pointer types in the architecture set d…
ForNeVeR 7cf15f0
(#384) Docs: more clarification
ForNeVeR b5512a0
(#354) Docs: more clarifications
ForNeVeR 665c544
Merge branch 'main' into feature/354.wide-arch
ForNeVeR ec67da2
(#354) Roll back the runtime lib changes
ForNeVeR 704d062
(#354) Runtime: roll back the unnecessary changes
ForNeVeR 1fefa3a
(#354) Apply test data diff
ForNeVeR e74fb50
(#356) Test fixes
ForNeVeR a43396e
(#354) Tests: add .NET interop tests
ForNeVeR a1689a2
(#354) Tests: add .NET pointer interop tests
ForNeVeR b97e32a
(#356) Refactor CodeGenNetInteropTests
ForNeVeR e63f01a
(#354) Tests: add CSharpCompilationUtil
ForNeVeR 95a209d
(#354) Tests: compile C# projects with unsafe enabled
ForNeVeR 9a5e3a4
(#354) Finish .NET compilation support for tests
ForNeVeR 2424b21
(#354) Tests: add a test for CPtr in struct generation
ForNeVeR b4ef7d7
(#354) Basic support for new runtime wide pointer wrappers
ForNeVeR 4350ca1
(#354) CodeGen: support CPtr interop on the Wide architecture
ForNeVeR e6b682d
(#354) CodeGen: add a test for CPtr<CPtr<T>>
ForNeVeR 8667d7d
(#354) More tests for pointer interop
ForNeVeR a653fb7
Merge remote-tracking branch 'origin/main' into feature/354.wide-arch
ForNeVeR 3f530d6
(#354) Fix compilation, deduplicate some redundant tests
ForNeVeR d94ea64
(#354) CodeGen: implement generic delegate cache
ForNeVeR 19b4a1e
(#354) CodeGen: fix the remaining tests
ForNeVeR 2d4c688
(#354) CodeGen: more tests for the various types of pointer interop
ForNeVeR 84e53f9
(#354) CodeGen: match compatibility ptr types with the actual pointer…
ForNeVeR 8e894e0
(#354) FunctionCallExpression: extract the type conversion into a sep…
ForNeVeR 2e93313
(#354) CodeGen: groundwork for CLR type conversion
ForNeVeR fc71a17
(#354) CodeGen: call implicit cast operator for VoidPtr
ForNeVeR ee109a1
(#354) CodeGen: emit additional type case before calling the cast ope…
ForNeVeR 6614b32
Merge remote-tracking branch 'origin/main' into feature/354.wide-arch
ForNeVeR e64f5d5
(#354) CodeGen: move further on CPtr cast operator
ForNeVeR e4c9183
(#354) CodeGen: support proper CPtr interop
ForNeVeR 1a9bf18
(#354) FuncPtr conversion via constructor
ForNeVeR 118e2d7
Merge branch 'main' into feature/354.wide-arch
ForNeVeR 862f518
(#354) Tests: fix for unsafe class
ForNeVeR 12b22d4
(#354) CodeGen: improve validation of vararg CLI imports
ForNeVeR 3259db0
(#354) Tests: fix the runtimes properly
ForNeVeR 10d1cd7
(#354) CodeGen: add integration tests
ForNeVeR 193c090
(#354) CodeGen: proper FuncPtr conversion
ForNeVeR 44c0f1a
(#354) CodeGen: add an integration test for function pointers inside …
ForNeVeR 72ced1b
(#354) TODO sweep, better typoe checks
ForNeVeR 0b133df
Merge branch 'main' into feature/354.wide-arch
ForNeVeR 69a5c06
(#354) FunctionInfo: add a TODO
ForNeVeR 4b2783f
(#354) Integration tests: drop an incorrect project item
ForNeVeR ad2fcd6
(#354) IntegrationTestContext: code cleanup
ForNeVeR 443597e
(#354) Docs: small improvement
ForNeVeR b76311e
(#78, #285, #487, #488, #489, #490, #491, #492) Connect TODOs with th…
ForNeVeR 79e2967
(#487, #493) Connect TODOs with the issues
ForNeVeR 171fbee
WipException.ToDo: better documentation
ForNeVeR d76e339
Build: use the last version of JetBrains.Annotations everywhere
ForNeVeR File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace Cesium.Runtime.Tests; | ||
|
||
public unsafe class PtrTests | ||
{ | ||
[Fact] | ||
public void CPtrTests() | ||
{ | ||
CPtr v = (void*)0x1234; | ||
Assert.Equal(0x1234L, (long)v.AsPtr()); | ||
Assert.Equal(0x1234L, (long)v.AsPtr<byte>()); | ||
|
||
Assert.Equal(sizeof(long), sizeof(CPtr)); | ||
|
||
CPtr<int> t = (int*)0x2345; | ||
Assert.Equal(0x2345L, (long)t.AsPtr()); | ||
Assert.Equal((IntPtr)0x2345, t.AsIntPtr()); | ||
Assert.Equal(0x2345L, (long)t.AsPtr<byte>()); | ||
|
||
Assert.Equal(sizeof(long), sizeof(CPtr<int>)); | ||
} | ||
|
||
[Fact] | ||
public void FPtrTests() | ||
{ | ||
var a = new FPtr<Action>((void*)0x1234); | ||
Assert.Equal(0x1234L, (long)a.AsPtr()); | ||
Assert.Equal(sizeof(long), sizeof(FPtr<Action>)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Cesium.Runtime; | ||
|
||
/// <summary>A class encapsulating a C function pointer.</summary> | ||
public readonly unsafe struct FPtr<TDelegate> where TDelegate : Delegate // TODO: Think about vararg and empty parameter list encoding. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
{ | ||
private readonly long _value; | ||
|
||
public FPtr(void* ptr) | ||
{ | ||
_value = (long)ptr; | ||
} | ||
|
||
public void* AsPtr() => (void*)_value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
And maybe
VoidPtr
. I do like CPtr, but it sounds too broad for me. But that's just remark. I do have only vague feeling here.