Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
f1e6a83b
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f1e6a83b
编写于
3月 09, 2023
作者:
J
Jackson Schuster
提交者:
GitHub
3月 09, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename ManagedVirtualMethodTable and adjust VTable indices (#83158)
上级
a92ed6e2
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
7 deletion
+8
-7
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs
...rvices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs
+5
-5
src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/IIUnknownInterfaceType.cs
...ervices/tests/Ancillary.Interop/IIUnknownInterfaceType.cs
+2
-1
src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/IUnknownDerivedAttribute.cs
...vices/tests/Ancillary.Interop/IUnknownDerivedAttribute.cs
+1
-1
未找到文件。
src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs
浏览文件 @
f1e6a83b
...
...
@@ -134,7 +134,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
var
syntax
=
(
MethodDeclarationSyntax
)
interfaceData
.
Syntax
.
FindNode
(
locationInAttributeSyntax
.
SourceSpan
);
var
method
=
(
IMethodSymbol
)
member
;
Diagnostic
?
diagnostic
=
GetDiagnosticIfInvalidMethodForGeneration
(
syntax
,
method
);
methods
.
Add
((
syntax
,
method
,
diagnostic
is
n
ot
n
ull
?
methodVtableOffset
++
:
0
,
diagnostic
));
methods
.
Add
((
syntax
,
method
,
diagnostic
is
null
?
methodVtableOffset
++
:
0
,
diagnostic
));
}
}
}
...
...
@@ -313,7 +313,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
private
static
void
**
m_vtable
;
public
static
void
*
VirtualMethodTableManagedImplementation
public
static
void
*
*
ManagedVirtualMethodTable
{
get
{
...
...
@@ -555,7 +555,7 @@ private static InterfaceDeclarationSyntax GenerateImplementationVTable(Immutable
ReturnStatement
(
LiteralExpression
(
SyntaxKind
.
NullLiteralExpression
)))));
}
// void** vtable = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(<interfaceType>, sizeof(void*) * <
interfaceMethodStubs.Array.Length
>);
// void** vtable = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(<interfaceType>, sizeof(void*) * <
max(vtableIndex) + 1
>);
var
vtableDeclarationStatement
=
LocalDeclarationStatement
(
VariableDeclaration
(
...
...
@@ -575,7 +575,7 @@ private static InterfaceDeclarationSyntax GenerateImplementationVTable(Immutable
BinaryExpression
(
SyntaxKind
.
MultiplyExpression
,
SizeOfExpression
(
PointerType
(
PredefinedType
(
Token
(
SyntaxKind
.
VoidKeyword
)))),
LiteralExpression
(
SyntaxKind
.
NumericLiteralExpression
,
Literal
(
interfaceMethodStubs
.
Length
)))))))))));
LiteralExpression
(
SyntaxKind
.
NumericLiteralExpression
,
Literal
(
1
+
interfaceMethodStubs
.
Max
(
x
=>
x
.
VtableIndexData
.
Index
)
)))))))))));
var
fillIUnknownSlots
=
Block
()
.
AddStatements
(
...
...
@@ -680,7 +680,7 @@ private static ClassDeclarationSyntax GenerateInterfaceInformation(ComInterfaceC
FieldDeclaration
(
VariableDeclaration
(
VoidStarStarSyntax
,
SingletonSeparatedList
(
VariableDeclarator
(
vtableFieldName
))))
.
AddModifiers
(
Token
(
SyntaxKind
.
PrivateKeyword
),
Token
(
SyntaxKind
.
StaticKeyword
)),
// public static void* VirtualMethodTableManagedImplementation => _vtable != null ? _vtable : (_vtable = InterfaceImplementation.CreateManagedVirtualMethodTable());
PropertyDeclaration
(
PointerType
(
PredefinedType
(
Token
(
SyntaxKind
.
VoidKeyword
))),
"VirtualMethodTableManagedImplementation
"
)
PropertyDeclaration
(
VoidStarStarSyntax
,
"ManagedVirtualMethodTable
"
)
.
AddModifiers
(
Token
(
SyntaxKind
.
PublicKeyword
),
Token
(
SyntaxKind
.
StaticKeyword
))
.
WithExpressionBody
(
ArrowExpressionClause
(
...
...
src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/IIUnknownInterfaceType.cs
浏览文件 @
f1e6a83b
...
...
@@ -6,8 +6,9 @@
namespace
System.Runtime.InteropServices.Marshalling
{
public
interface
IIUnknownInterfaceType
:
IUnmanaged
InterfaceType
public
unsafe
interface
IIUnknown
InterfaceType
{
public
abstract
static
Guid
Iid
{
get
;
}
public
abstract
static
void
**
ManagedVirtualMethodTable
{
get
;
}
}
}
src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/IUnknownDerivedAttribute.cs
浏览文件 @
f1e6a83b
...
...
@@ -21,6 +21,6 @@ public IUnknownDerivedAttribute()
public
Type
Implementation
=>
typeof
(
TImpl
);
/// <inheritdoc />
public
unsafe
void
*
VirtualMethodTableManagedImplementation
=>
T
.
VirtualMethodTableManagedImplementation
;
public
unsafe
void
*
VirtualMethodTableManagedImplementation
=>
T
.
ManagedVirtualMethodTable
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录