Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
48b8063
start to bring across cpp implementation of gvm/shared generics
yowl Apr 20, 2019
ff20b77
merge
yowl Jun 24, 2019
76d8f95
Merge remote-tracking branch 'master/master' into wasm-gvm
yowl Jun 24, 2019
3bec953
add test
yowl Jun 24, 2019
a4e0ca1
some debugging code, stopped here as we need a GCStaticsNode first, o…
yowl Jul 4, 2019
4819816
Merge branch 'master' into wasm-gvm
yowl Jul 5, 2019
b5dd820
stub out some places where a lookup is needed.
yowl Jul 9, 2019
59f08ee
would get to the end of compiling but for the GVM dispatch path
yowl Jul 10, 2019
3072de8
add first attempt at hooking GVM - does not run.
yowl Jul 12, 2019
24636d8
add simpler test
yowl Jul 13, 2019
7b8ac4a
add hidden param to llvm signature
yowl Jul 17, 2019
4a1819e
compilation does not finish as markedstack and _deferred keep getting…
yowl Jul 20, 2019
8a51ab3
does compile at least until verify, but takes a long time. Some func…
yowl Jul 21, 2019
62df076
fill in some blanks to remove the first llvm verify errors
yowl Jul 21, 2019
15cf843
creates a valid llvm
yowl Jul 26, 2019
d5e40e2
change store to use canon form for cast. Remove most thrown exceptio…
yowl Jul 26, 2019
ea527cd
fixed some calls to ldftn for FatFunctionPointer path .
yowl Jul 27, 2019
f03c0f0
most delegate thunks are now correctly named
yowl Jul 27, 2019
9b077ee
add stub for generic helper
yowl Jul 27, 2019
e1e55de
fix type casts for pointers.
yowl Jul 31, 2019
9c73450
removes undefined references to unboxing stubs. crashes when running:
yowl Aug 3, 2019
793d8f2
do not derefence the generic look up - copy/paste error
yowl Aug 3, 2019
0740caa
adds the dependency to get the class ctor runner added
yowl Aug 4, 2019
861f482
remove hidden param from shadow stack counting
yowl Aug 7, 2019
82c3541
some pointer arithmetic fixes
yowl Aug 9, 2019
192f437
fix dict lookup from type
yowl Aug 15, 2019
e0daf2b
fixes some gen lookup stuff - runs for a while at least
yowl Aug 16, 2019
a6e6869
gets into the Program Main.
yowl Aug 18, 2019
fa5b47f
I believe this is getting the right pointer, but fat FatFunctionPoint…
yowl Aug 23, 2019
cb16438
half calli hidden
yowl Aug 24, 2019
60426eb
compiles but fails on what looks like first calli
yowl Aug 24, 2019
c753397
Runs nearly all the tests, commented out method.Invoke ones which are…
yowl Aug 25, 2019
4c5097d
add test for sbyte extend
yowl Sep 2, 2019
339bace
instrumentation
yowl Sep 2, 2019
57c8ce2
fix loading short ints and sbytes from stack where they need to be si…
yowl Sep 2, 2019
b5d22ea
Merge branch 'sbyteextend' into wasm-gvm
yowl Sep 2, 2019
3315208
move test higher to _fix_ printf stopping.
yowl Sep 2, 2019
41cbad2
fix for extending expressions in shifting
yowl Sep 2, 2019
61a4317
Add more sign extending for other stack loads.
yowl Sep 2, 2019
60ac49f
add test for sbyte br instructions which occur (and failed) in releas…
yowl Sep 3, 2019
68cbaeb
remove unsafe which wasn't needed.
yowl Sep 3, 2019
0f9c2bd
Merge branch 'sbyteextend' into wasm-gvm
yowl Sep 3, 2019
3dfaf95
Reorder hidden param to be after return slot.
yowl Sep 8, 2019
9fd2bb8
debug instr
yowl Sep 17, 2019
086ba4e
delegate test passes.
yowl Oct 28, 2019
65de74a
Now compiles 2 of the Generics methods, still passes HelloWasm
yowl Nov 1, 2019
721ac88
This fails on Console.WriteLine but gets past the first call
yowl Nov 8, 2019
30730a7
Generics WriteLine, remove some Debug
yowl Nov 9, 2019
3df58e0
Merge remote-tracking branch 'origin/master' into dt
yowl Nov 14, 2019
c267ede
add code for special unboxing thunk
yowl Nov 14, 2019
499cc34
Passes some of the GVM tests. Fails at the first Func Invoke
yowl Nov 15, 2019
8a22cbe
Makes it to the GVM delegate tests. Fails at Derived.Validate
yowl Nov 17, 2019
5ad6a2f
passes the gvm delegates included so far. Could clean up/PR here, bu…
yowl Nov 17, 2019
5077c61
This passes some of the TestDelegateToCanonMethods, but fails on Test…
yowl Nov 19, 2019
1d9b6bf
fix fatfunction test which started failing for some reason, after att…
yowl Nov 20, 2019
6fb8838
Passes RunReferenceTypeShared
yowl Nov 20, 2019
01748b8
This is now failing at
yowl Nov 21, 2019
f6042a0
Adds a test and a box for callvirt on value types where TryResolveCon…
yowl Nov 21, 2019
0c64812
remove short cr
yowl Nov 21, 2019
48a3b49
Merge branch 'constrained-value-virt-calls' into RunReferenceTypeShar…
yowl Nov 22, 2019
c264870
some debug
yowl Nov 22, 2019
932c98e
some debug
yowl Nov 22, 2019
a40c622
change callvirt to call where possible for constrained calls
yowl Nov 22, 2019
958c90b
Merge branch 'constrained-value-virt-calls' into RunReferenceTypeShar…
yowl Nov 22, 2019
5c4dd51
Fixes TestDelegateToCanonMethods
yowl Nov 22, 2019
5eff010
Passes TestConstrainedMethodCalls
yowl Nov 22, 2019
0ce2c92
Passes up to TestGvmDelegates
yowl Nov 23, 2019
c084dc5
passes TestGvmDependencies
yowl Nov 23, 2019
d0ac25e
Fails TestReflectionInvoke
yowl Nov 23, 2019
00621e9
zext uint32 to uint64
yowl Nov 27, 2019
29d6a28
change default to as it was
yowl Nov 27, 2019
ad33ae1
fix unsigned extend to uint64
yowl Nov 27, 2019
56c4adf
boxing singles fix
yowl Nov 27, 2019
dca647b
Passes the cpp tests and ByRefLikeVtables apparently.
yowl Nov 27, 2019
177c58b
Remove instrumentation
yowl Nov 28, 2019
d0a64ba
Merge remote-tracking branch 'origin/master' into RunReferenceTypeSha…
yowl Nov 28, 2019
83ea59e
merge master changes, remove more instrumentation.
yowl Nov 28, 2019
120e35c
remove more comments and merge to master
yowl Nov 28, 2019
e63c77f
passes the thread static tests
yowl Nov 28, 2019
f3ad8ff
run wasm target with firefox --headless
yowl Nov 28, 2019
53e6160
Clean up - remove comments/unused branches
yowl Nov 28, 2019
55a869e
End of simple cleanups.
yowl Nov 28, 2019
1aab055
address some simple TODO refactoring
yowl Nov 28, 2019
d76682e
Some clean up and refactoring
yowl Nov 30, 2019
362b314
remove isGvm parameter
yowl Nov 30, 2019
bad362e
more clean up
yowl Nov 30, 2019
6a92446
more clean up
yowl Dec 1, 2019
bf2106e
remove some casts
yowl Dec 1, 2019
156c1cc
remove more redundant parameters and code
yowl Dec 1, 2019
69f44c0
remove some temp changes
yowl Dec 1, 2019
3f06dde
Fix for ending blocks which contain gvm calls
yowl Dec 7, 2019
7a1439b
partial review changes - hits an assert
yowl Dec 14, 2019
59fc738
back out some unwanted csproj changes
yowl Dec 14, 2019
610afe8
Address some feedback
yowl Dec 14, 2019
0f4de2c
remove blank line
yowl Dec 14, 2019
5551668
Merge remote-tracking branch 'corert/master' into RunReferenceTypeSha…
yowl Dec 14, 2019
67c8530
temporary remove logic pending feedback
yowl Dec 16, 2019
10c605d
Merge remote-tracking branch 'corert/master' into RunReferenceTypeSha…
yowl Dec 26, 2019
841d63a
Fails
yowl Dec 27, 2019
b295a92
add test like HttpHeaders GetValuesAsStrings
yowl Dec 27, 2019
cee4c80
add test for storing generic call return value
yowl Dec 27, 2019
d5b42d7
constrained callvirt fix
yowl Dec 28, 2019
d5534b3
Add test and code for callvirt on valuetypes to box to the gen dict l…
yowl Dec 30, 2019
a8f238a
address feedback
yowl Dec 31, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/Common/src/Internal/Runtime/RuntimeConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@

namespace Internal.Runtime
{
internal static class FatFunctionPointerConstants
{
/// <summary>
/// Offset by which fat function pointers are shifted to distinguish them
/// from real function pointers.
/// </summary>
public const int Offset = 2;
}

internal static class IndirectionConstants
{
/// <summary>
Expand Down
17 changes: 17 additions & 0 deletions src/Common/src/TypeSystem/Aot/TargetDetails.Aot.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace Internal.TypeSystem
{
// Extension to TargetDetails related to Aot
partial class TargetDetails
{
/// <summary>
/// Offset by which fat function pointers are shifted to distinguish them
/// from real function pointers.
/// WebAssembly uses index tables, not addresses for function pointers, so the lower bits are not free to use.
/// </summary>
public int FatFunctionPointerOffset => Architecture == TargetArchitecture.Wasm32 ? 1 << 31 : 2;
}
}
2 changes: 1 addition & 1 deletion src/Common/src/TypeSystem/IL/ILImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ private void ImportBasicBlock(BasicBlock basicBlock)
ImportConvert(WellKnownType.UInt32, false, false);
break;
case ILOpcode.conv_u8:
ImportConvert(WellKnownType.UInt64, false, false);
ImportConvert(WellKnownType.UInt64, false, true);
break;
case ILOpcode.callvirt:
ImportCall(opCode, ReadILToken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ILCompiler.DependencyAnalysis
/// they are used by the dynamic type loader when dynamically instantiating types at runtime.
/// The data that we emit on canonical type instantiations should just be the minimum that is needed by the template
/// type loader.
/// Similarly, the dependencies that we track for canonicl type instantiations are minimal, and are just the ones used
/// Similarly, the dependencies that we track for canonical type instantiations are minimal, and are just the ones used
/// by the dynamic type loader
/// </summary>
public sealed class CanonicalEETypeNode : EETypeNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Internal.TypeSystem;

using Debug = System.Diagnostics.Debug;
using FatFunctionPointerConstants = Internal.Runtime.FatFunctionPointerConstants;

namespace ILCompiler.DependencyAnalysis
{
Expand Down Expand Up @@ -37,7 +36,7 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
}

int ISymbolDefinitionNode.Offset => 0;
int ISymbolNode.Offset => FatFunctionPointerConstants.Offset;
int ISymbolNode.Offset => Method.Context.Target.FatFunctionPointerOffset;

public override bool IsShareable => true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Internal.NativeFormat;

using InvokeTableFlags = Internal.Runtime.InvokeTableFlags;
using FatFunctionPointerConstants = Internal.Runtime.FatFunctionPointerConstants;

namespace ILCompiler.DependencyAnalysis
{
Expand Down
5 changes: 2 additions & 3 deletions src/ILCompiler.CppCodeGen/src/CppCodeGen/CppWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Internal.TypeSystem.Ecma;

using Debug = System.Diagnostics.Debug;
using FatFunctionPointerConstants = Internal.Runtime.FatFunctionPointerConstants;

namespace ILCompiler.CppCodeGen
{
Expand Down Expand Up @@ -2102,7 +2101,7 @@ private string GetCodeForReadyToRunGenericHelper(ReadyToRunGenericHelperNode nod
sb.Append(" = ((intptr_t)");
sb.Append(resVarName);
sb.Append(") + ");
sb.Append(FatFunctionPointerConstants.Offset.ToString());
sb.Append(constructor.Context.Target.FatFunctionPointerOffset.ToString());
sb.Append(";");
sb.AppendLine();

Expand Down Expand Up @@ -2290,7 +2289,7 @@ private void OutputStaticsCode(NodeFactory factory, Dictionary<TypeDesc, CppGene
sb.Append("(char *)");
sb.Append(GetCppFatFunctionPointerNameForMethod(cctor));
sb.Append("() + ");
sb.Append(FatFunctionPointerConstants.Offset.ToString());
sb.Append(cctor.Context.Target.FatFunctionPointerOffset.ToString());
}
else
{
Expand Down
22 changes: 10 additions & 12 deletions src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

using ILCompiler.DependencyAnalysis;

using FatFunctionPointerConstants = Internal.Runtime.FatFunctionPointerConstants;

namespace Internal.IL
{
internal partial class ILImporter
Expand Down Expand Up @@ -1376,7 +1374,7 @@ private void ImportCall(ILOpcode opcode, int token)
sb.Append("((intptr_t)");
sb.Append(_writer.GetCppSymbolNodeName(_nodeFactory, targetNode));
sb.Append("()) + ");
sb.Append(FatFunctionPointerConstants.Offset.ToString());
sb.Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
}
else
{
Expand Down Expand Up @@ -1518,13 +1516,13 @@ private void ImportCall(ILOpcode opcode, int token)
Append("if (");
Append(gvmSlotVarName);
Append(" & ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
Append(") {");
Append(functionPtr);
Append(" = *(intptr_t*)(");
Append(gvmSlotVarName);
Append(" - ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
Append(");} else {");
Append(functionPtr);
Append(" = ");
Expand Down Expand Up @@ -1725,7 +1723,7 @@ private void ImportCall(ILOpcode opcode, int token)
Append("if (");
Append(gvmSlotVarName);
Append(" & ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
Append(") {");

_writer.AppendSignatureTypeDef(_builder, typeDefName, canonMethodSignature,
Expand Down Expand Up @@ -1762,7 +1760,7 @@ private void ImportCall(ILOpcode opcode, int token)
Append("**(void***)(");
Append(gvmSlotVarName);
Append(" - ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
Append(" + sizeof(void*))");

if (canonMethodSignature.Length > 0)
Expand Down Expand Up @@ -2116,13 +2114,13 @@ private void ImportCalli(int token)
Append("if (");
Append(fatPtr);
Append(" & ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
Append(") {");
Append(fnPtrValue);
Append(" = *(intptr_t*)(");
Append(fatPtr);
Append(" - ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
Append(")");

AppendSemicolon();
Expand Down Expand Up @@ -2155,7 +2153,7 @@ private void ImportCalli(int token)
Append("**(void***)(");
Append(fatPtr);
Append(" - ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
Append(" + sizeof(void*))");

if (methodSignature.Length > 0)
Expand Down Expand Up @@ -2309,14 +2307,14 @@ private void ImportLdFtn(int token, ILOpcode opCode)
Append("(");
Append(GetGenericContext());
Append(")) + ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
}
else
{
Append("((intptr_t)");
AppendFatFunctionPointer(runtimeDeterminedMethod);
Append("()) + ");
Append(FatFunctionPointerConstants.Offset.ToString());
Append(_typeSystemContext.Target.FatFunctionPointerOffset.ToString());
}
}
else
Expand Down
3 changes: 3 additions & 0 deletions src/ILCompiler.TypeSystem/src/ILCompiler.TypeSystem.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
<Compile Include="..\..\Common\src\TypeSystem\Canon\TypeSystemContext.Canon.cs">
<Link>TypeSystem\Canon\TypeSystemContext.Canon.cs</Link>
</Compile>
<Compile Include="..\..\Common\src\TypeSystem\Aot\TargetDetails.Aot.cs">
<Link>TypeSystem\Aot\TargetDetails.Aot.cs</Link>
</Compile>
<Compile Include="..\..\Common\src\TypeSystem\CodeGen\FieldDesc.CodeGen.cs">
<Link>TypeSystem\CodeGen\FieldDesc.CodeGen.cs</Link>
</Compile>
Expand Down
14 changes: 14 additions & 0 deletions src/ILCompiler.WebAssembly/src/CodeGen/EvaluationStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,20 @@ public override StackEntry Duplicate(LLVMBuilderRef builder)
}
}

/// <summary>
/// Entry representing the generic return value of a function.
/// </summary>
internal class GenericReturnExpressionEntry : ExpressionEntry
{
public GenericReturnExpressionEntry(TypeDesc genericReturnTypeDesc, StackValueKind kind, string name, LLVMValueRef llvmValue, TypeDesc type = null)
: base(kind, name, llvmValue, type)
{
GenericReturnTypeDesc = genericReturnTypeDesc;
}

public TypeDesc GenericReturnTypeDesc { get; }
}

/// <summary>
/// Entry representing some expression
/// </summary>
Expand Down
Loading