设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2431|回复: 0
打印 上一主题 下一主题

【翻译】关于:MUW structure (STM word、hash code、字符状态位、对象的同步锁、EMU)

[复制链接]
跳转到指定楼层
1#
发表于 2014-2-26 08:57:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
MUW structure
-------------
The structure of the MUW on a 32-bit system is as follows:
  | 31            3 | 2  | 1 0 |
  |      payload    |mark| tag |

And on a 64-bit system:
  | 63            3 | 2  | 1 0 |
  |      payload    |mark| tag |

This class provides fast-path code for a number of operations which
potentially require additional information to be associated with each
object in the heap:
这个类提供"快速管道"代码,用于操作一批建立在堆上的对象,这些对象需要更
多的相关信息.

- Object ownership and versioning information needed by the STM
  implementation.
- 对象拥有"STM?"执行,所需的所有权信息和版本信息。

- Location-insensitive hash codes that have been allocated to objects.
- 对位置不敏感的,并且已经分配给对象的hashcode。

- Monitor objects that have been associate with objects.
- 将同步对象锁与对象进行关联.

- StringState bits associated with String objects
- 将StringState位与String对象相关

Overview
--------
Each object has a value of type MultiUseWord (MUW) held as a header
word.  This can be used directly for any *one* of the three purposes
listed above.  If more than one kind of usage is required on the same
object then the MUW is "inflated" -- i.e. replaced by a value that
indicates an external multi-use object (EMU) which contains space for
all three purposes.
对象都会有一个类型相关的MUW值,作为"header word?".能够直接用于上这三个
目标之一.如果一个对象需要同时使用多个属性,MUW将被扩充后的EMU取代,MUW
的值能提供更多的空间,达到上述三个目标。

NB: the StringState and HashCode words share the same storage locations,
distinguished by value.  We rely on ChooseHashCode to not use small
integer values corresponding to the StringState enumeration.
注:StringState和hashCode能够被区分,并共享相同的存储位置.我们避免选择
小数值的HashCode来对应StringState枚举值。

In addition, the MUW provides a single per-object 'mark' bit.  This
is used in the MemoryAccounting module when counting the volume of
different kinds of object in the heap.  Placing this bit in the MUW
(rather than using spare vtable-bits as the GC does) allows
memory accounting to be invoked at any time (e.g. after a crash during
a GC).
此外,MUW提供了每个单一对象的'mark'标志.这个主要是用于MemoryAccounting
模块计算不同类型的对象在堆中的容量。设置该MUW标志(好于将虚表位置为GC)
允许内存在任何时候计数(比如,在GC操作崩溃后).

On 32-bit systems, this allows us to support pointers through the entire
4 GB address range.  However, it means that pointers must be constrained
to fit in the limited space of the payload.  For instance, the Monitor
is 8-byte aligned so the low 3 bits are available for encoding the tag
and mark.
在32位系统中,这种结构完全支持4GB范围的内存寻址.但是,这也意味着指针必须适
应有限空间的有效荷载.例如,"Monitor?"是8位对齐的,所以最后3位是空闲的,可用
于tag和mark的编码.

By convention, all modules using the mark bit must (a) work with the
world stopped and (b) leave all object's mark bits 0 after their operation.
(They may assume this is true when they start).  This restriction avoids
needing to mask off the mark bit in common code paths in this file.
按照惯例,所有模块使用该Mark掩码,首先在操作时必须稍等片刻,然后在离开所有
对象时要将mark掩码复位.(假设开始时是这样的)。些约定能够避免,在该文件中
通用代码的标志位复位工作.

The payload field forms the majority of the MUW.  The contents of the
payload are taken from bits 3..31 in the MUW, padded with three 0-bits
at the least significant end.  This means that the payload can hold a
pointer to an 8-byte aligned address.
有效载荷位域构成了MUW的主体。载荷内容取自MUW中3..31位,在未尾填充的3个0
标志着结束。这意味着,有效载荷可以容纳一个指针,并指向8字节对齐的地址.

The tag values distinguish between four states that the MUW can be in:
tag标记值区分了下列4种MUW

00 => The MUW is either unused (if the payload is 0), or holds the
      STM word for the object (if the payload is non-0).
00 => 如果地址为0,表示未使用,否则包含object的"STM word?".

01 => The payload holds the object's hash code or StringState bits.
01 => 包含object's的hash code或"字符状态位?".

10 => The payload refers to the object's Monitor.
10 => 指向该对象的同步锁.

11 => The payload refers to an external multi-use object (EMU).
11 => 指向"EMU?"
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-3 11:18 , Processed in 0.086260 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表