[97a262]: userguide / html / RVM / Unboxed Types.html Maximize Restore History

Download this file

Unboxed Types.html    59 lines (51 with data), 3.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>RVM : Unboxed Types</title>
<link rel="stylesheet" href="styles/site.css" type="text/css" />
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
<tr>
<td valign="top" class="pagebody">
<div class="pageheader">
<span class="pagetitle">
RVM : Unboxed Types
</span>
</div>
<div class="pagesubheading">
This page last changed on Jul 03, 2008 by <font color="#0050B2">dgrove</font>.
</div>
<p>If a type is boxed then it means that values of that type are represented by a pointer to a heap object. An unboxed type is represented by the value itself such as int, double, float, byte etc. Values of unboxed types appear only in the virtual machine's stack, registers, or as fields/elements of class/array instances.</p>
<p>The Jikes RVM also defines a number of other unboxed types. Due to a limitation of the way the compiler generates code the Jikes RVM must define an unboxed array type for each unboxed type. The unboxed types are;</p>
<ul>
<li>org.vmmagic.unboxed.Address</li>
<li>org.vmmagic.unboxed.Extent</li>
<li>org.vmmagic.unboxed.ObjectReference</li>
<li>org.vmmagic.unboxed.Offset</li>
<li>org.vmmagic.unboxed.Word</li>
<li>org.jikesrvm.ArchitectureSpecific.Code</li>
</ul>
<p>Unboxed types may inherit from Object but they are not objects. As such there are some restrictions on the use of unboxed types:</p>
<ul>
<li>A unboxed type instance must not be passed where an Object is expected. This will type-check, but it is not what you want. A corollary is to avoid overloading a method where the two overloaded versions of the method can only be distinguished by operating on an Object versus an unboxed type.</li>
<li>An unboxed type must not be synchronized on.</li>
<li>They have no virtual methods.</li>
<li>They do not support lock operations, generating hashcodes or any other method inherited from Object.</li>
<li>All methods must be compiler intrinsics.</li>
<li>Avoid making an array of an unboxed type. Instead represent it by the array version of unboxed type. i.e. <tt>org.vmmagic.unboxed.Address[]</tt> should be replaced with <tt>org.vmmagic.unboxed.AddressArray</tt> but <tt>org.vmmagic.unboxed.AddressArray[]</tt> is fine.</li>
</ul>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="12" background="http://docs.codehaus.org/images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
</tr>
<tr>
<td align="center"><font color="grey">Document generated by Confluence on Jul 04, 2010 19:57</font></td>
</tr>
</table>
</body>
</html>