David Maas

Results 121 issues of David Maas

Edit in 2022: I've been doing a lot of work on this lately. I prototyped some things and I've settled on something similar to the mutable pipelines stuff below. Right...

Area-Transformation

https://github.com/MochiLibraries/Biohazrd/issues/236 fundamentally changed how functions are emitted by Biohazrd. For the time being I have both emit strategies implemented and the new trampoline emit strategy is only used if `CreateTrampolinesTransformation`...

Area-OutputGeneration
TechDebt

The [trampolines api work](https://github.com/MochiLibraries/Biohazrd/issues/236) revealed a subtle bug in [our logic](https://github.com/MochiLibraries/Biohazrd/blob/93ad67a91c09781d09fa858f11598862b4f5d376/Biohazrd.CSharp/CSharpLibraryGenerator.Records.cs#L90) for associating VTable entries with their corresponding functions. Right now we resolve using `TranslatedVTableEntry.MethodReference`. This works *most* of the...

Area-OutputGeneration
Workaround
TechDebt

Historically we've had the declaration associated with the type being written available in the context of getting a type as a string. This is somewhat problematic because it doesn't actually...

Area-OutputGeneration
Concept-ApiClarity
TechDebt

Right now we use `MarshalAs` for `bool` where possible and `NativeBoolean` where not. We should instead prefer using trampolines where possible and `NativeBoolean` where not.

Area-OutputGeneration
Concept-OutputPerformance
Concept-OutputFriendliness

.NET 7 is introducing [a new attribute for disabling runtime marshaling across the entire assembly](https://github.com/dotnet/runtime/issues/60639). Biohazrd should use this when possible to eliminate some of the oddities around `bool`/`char` handling....

Area-OutputGeneration
Language-C#
Concept-OutputFriendliness

One thing that became apparent during #40 is that there may be room for mixin-style transformations. Right now constant array transformation happens as part of `CSharpTypeReductionTransformation`. This was done because...

Area-Transformation

C++ references and C# byrefs have similar (if not identical) semantics. Right now C++ references are emitted as C# pointers which isn't as nice to work with as the C++...

Concept-CppFeatures
Area-OutputGeneration
Concept-OutputFriendliness

Relates to https://github.com/MochiLibraries/Biohazrd/issues/233 Having marshaling disabled introduces an awkward situation for function pointers which cross assembly bounds. If a function pointer from a no-marshaling assembly is invoked from a legacy...

Language-C#
Concept-OutputUsability
Concept-OutputFriendliness
Area-CodeAnalysis

C#-side trampolines can pollute stack traces. Consider adding [`DebuggerHiddenAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debuggerhiddenattribute), [`DebuggerStepThroughAttribute`](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debuggerstepthroughattribute), and `StackTraceHiddenAttribute` (depends on https://github.com/dotnet/runtime/issues/29681) to these methods. (Similar example from the BCL: https://github.com/dotnet/runtime/pull/32353/files) * [x] `DebuggerHiddenAttribute` * [x] `DebuggerStepThroughAttribute`...

Area-OutputGeneration
Language-C#
Concept-OutputFriendliness
RelativelySmall