打包__nogc类 [英] Packing for __nogc classes
问题描述
__nogc类的打包对齐是否作为程序集的一部分存储?
我认为它必须作为编译器,在引用程序集时,无法知道如何知道如何原始数据以其他方式打包。但是,根据我的理解,
属性只是__gc和__value类特定的,不适用于
__nogc类。它是否正确 ?如果是这样,如何存储
__nogc类的包装对齐?
Is the packing alignment of __nogc classes stored as part of the assembly ?
I think it must as the compiler, when referencing the assembly, could not
know how the original data is packed otherwise. Yet, in my understanding,
attributes are only __gc and __value class specific and do not apply to
__nogc classes. Is this correct ? If so, how is the packing alignment of
__nogc classes stored ?
推荐答案
它存放在一个果酱罐中橱柜。
" Edward Diener" < ED ****** @ tropicsoft.com>在消息中写道
新闻:OP ************** @ TK2MSFTNGP11.phx.gbl ...
Its stored in a jam jar in the cupboard.
"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
是否包装对齐__nogc类存储为程序集
的一部分?我认为必须作为编译器,在引用程序集时,无法知道原始数据是如何打包的。但是,根据我的理解,
属性只是__gc和__value类特定的,不适用于
__nogc类。它是否正确 ?如果是这样,
__nogc类的包装对齐是如何存储的?
Is the packing alignment of __nogc classes stored as part of the assembly ? I think it must as the compiler, when referencing the assembly, could not
know how the original data is packed otherwise. Yet, in my understanding,
attributes are only __gc and __value class specific and do not apply to
__nogc classes. Is this correct ? If so, how is the packing alignment of
__nogc classes stored ?
..写道:
它存放在橱柜里的果酱罐里。
毫无疑问,还有Java咖啡。
Edward Diener < ED ****** @ tropicsoft.com>在消息中写道
新闻:OP ************** @ TK2MSFTNGP11.phx.gbl ...
Its stored in a jam jar in the cupboard.
Along with the Java coffee no doubt.
"Edward Diener" <ed******@tropicsoft.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
__nogc类的打包对齐是否存储为
组装的一部分?我认为它必须作为编译器,在引用
程序集时,无法知道原始数据是如何打包的。
然而,据我所知,属性只有__gc和__value类
具体并且不适用于__nogc类。它是否正确 ?如果
那么,如何存储__nogc类的打包对齐?
Is the packing alignment of __nogc classes stored as part of the
assembly ? I think it must as the compiler, when referencing the
assembly, could not know how the original data is packed otherwise.
Yet, in my understanding, attributes are only __gc and __value class
specific and do not apply to __nogc classes. Is this correct ? If
so, how is the packing alignment of __nogc classes stored ?
嗨爱德华,
Hi Edward,
__nogc类的打包对齐是否作为程序集
的一部分存储?我认为必须作为编译器,在引用程序集时,无法知道原始数据是如何打包的。但是,根据我的理解,
属性只是__gc和__value类特定的,不适用于
__nogc类。它是否正确 ?如果是这样,
__nogc类的包装对齐是如何存储的?
Is the packing alignment of __nogc classes stored as part of the assembly ? I think it must as the compiler, when referencing the assembly, could not
know how the original data is packed otherwise. Yet, in my understanding,
attributes are only __gc and __value class specific and do not apply to
__nogc classes. Is this correct ? If so, how is the packing alignment of
__nogc classes stored ?
好吧,我认为包装实际上并没有存储。当编译器
为__nogc类创建元数据(确实是非常基本的元数据)时,它通过将它们创建为不透明的值类型来实现这一点,这意味着它基本上创建了
它们作为不包含成员的值类型,只有
布局和大小的基本信息。
这是一个例子这样的__nogc类代表:
..class private sequential ansi sealed A
extends [mscorlib] System.ValueType
{
.pack 1
.size 12
} // A级结束
注意.pack和.size指令,它告诉运行时如何打包类型和类型的大小。
AFAIK,编译器将*总是*使用.pack 1标记__nogc类型,即使
实际包装不同。但是,编译器*将*调整.size
指令,以便它根据它的包装反映内存中对象的实际大小
。在这种情况下,我尝试用一个类来支持
一个int,一个char和另一个int,打包设置为4.如果我将它设置为1,那么
然后代码会说'.size 9"等等。
-
Tomas Restrepo
**** @ mvps.org
这篇关于打包__nogc类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!