annotate graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java @ 19306:a0a760b0fb5f

pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
author Doug Simon <doug.simon@oracle.com>
date Thu, 12 Feb 2015 01:54:05 +0100
parents 835e950b38b9
children 2fd45bb25118
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
1 /*
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
4 *
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
8 *
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
13 * accompanied this code).
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
14 *
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
18 *
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
21 * questions.
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
22 */
8944
e7766460ddb3 Move tests into *.test packages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8635
diff changeset
23 package com.oracle.graal.replacements.test;
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
24
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
25 import org.junit.*;
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
26
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
27 import com.oracle.graal.api.code.*;
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
28 import com.oracle.graal.api.meta.*;
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
29 import com.oracle.graal.compiler.test.*;
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
30 import com.oracle.graal.nodes.*;
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
31 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
32 import com.oracle.graal.nodes.calc.*;
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
33 import com.oracle.graal.nodes.extended.*;
11800
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
34 import com.oracle.graal.phases.*;
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
35 import com.oracle.graal.phases.common.*;
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
36 import com.oracle.graal.phases.tiers.*;
8944
e7766460ddb3 Move tests into *.test packages.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8635
diff changeset
37 import com.oracle.graal.replacements.*;
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14945
diff changeset
38 import com.oracle.graal.replacements.ReplacementsImpl.FrameStateProcessing;
11800
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
39 import com.oracle.graal.replacements.Snippet.SnippetInliningPolicy;
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
40 import com.oracle.graal.word.*;
11752
7e7edb86fb43 Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11717
diff changeset
41 import com.oracle.graal.word.nodes.*;
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
42
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
43 /**
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
44 * Tests for the {@link Pointer} read and write operations.
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
45 */
8413
d9347ee39fbe rename: SnippetsInterface -> Snippets
Doug Simon <doug.simon@oracle.com>
parents: 8410
diff changeset
46 public class PointerTest extends GraalCompilerTest implements Snippets {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
47
18307
85f5227a7a37 add mutable/immutable factory methods to NamedLocationIdentity
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18259
diff changeset
48 private static final LocationIdentity ID = NamedLocationIdentity.mutable("ID");
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
49 private static final Kind[] KINDS = new Kind[]{Kind.Byte, Kind.Char, Kind.Short, Kind.Int, Kind.Long, Kind.Float, Kind.Double, Kind.Object};
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
50 private final TargetDescription target;
8628
77de2f3df379 renames: [HotSpot]ReplacementsInstaller -> [HotSpot]ReplacementsImpl
Doug Simon <doug.simon@oracle.com>
parents: 8416
diff changeset
51 private final ReplacementsImpl installer;
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
52
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
53 public PointerTest() {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12362
diff changeset
54 target = getCodeCache().getTarget();
19254
835e950b38b9 removed vestige usages of Assumptions independent of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19250
diff changeset
55 installer = new ReplacementsImpl(getProviders(), getSnippetReflection(), getTarget());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
56 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
57
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
58 private static final ThreadLocal<SnippetInliningPolicy> inliningPolicy = new ThreadLocal<>();
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
59
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
60 @Override
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
61 protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) {
18120
86ec7f6f71b3 refactored GraalCompilerTest API to be in terms of ResolvedJavaMethod instead of Method
Doug Simon <doug.simon@oracle.com>
parents: 17328
diff changeset
62 return installer.makeGraph(m, null, inliningPolicy.get(), FrameStateProcessing.CollapseFrameForSingleSideEffect);
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
63 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
64
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
65 @Test
10513
00b70a864d3b updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents: 9792
diff changeset
66 public void testRead1() {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
67 for (Kind kind : KINDS) {
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
68 assertRead(parseEager("read" + kind.name() + "1", AllowAssumptions.YES), kind, true, ID);
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
69 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
70 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
71
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
72 @Test
10513
00b70a864d3b updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents: 9792
diff changeset
73 public void testRead2() {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
74 for (Kind kind : KINDS) {
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
75 assertRead(parseEager("read" + kind.name() + "2", AllowAssumptions.YES), kind, true, ID);
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
76 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
77 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
78
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
79 @Test
10513
00b70a864d3b updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents: 9792
diff changeset
80 public void testRead3() {
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
81 for (Kind kind : KINDS) {
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
82 assertRead(parseEager("read" + kind.name() + "3", AllowAssumptions.YES), kind, true, LocationIdentity.ANY_LOCATION);
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
83 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
84 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
85
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
86 @Test
10513
00b70a864d3b updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents: 9792
diff changeset
87 public void testWrite1() {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
88 for (Kind kind : KINDS) {
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
89 assertWrite(parseEager("write" + kind.name() + "1", AllowAssumptions.YES), true, ID);
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
90 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
91 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
92
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
93 @Test
10513
00b70a864d3b updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents: 9792
diff changeset
94 public void testWrite2() {
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
95 for (Kind kind : KINDS) {
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
96 assertWrite(parseEager("write" + kind.name() + "2", AllowAssumptions.YES), true, ID);
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
97 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
98 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
99
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
100 @Test
10513
00b70a864d3b updated Checkstyle rules to prohibit underscores in method names and fixed current violations
Doug Simon <doug.simon@oracle.com>
parents: 9792
diff changeset
101 public void testWrite3() {
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
102 for (Kind kind : KINDS) {
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
103 assertWrite(parseEager("write" + kind.name() + "3", AllowAssumptions.YES), true, LocationIdentity.ANY_LOCATION);
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
104 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
105 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
106
9526
ae5cd887e67c Use a LocationIdentity interface instead of just Object for the location identity of a LocationNode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9525
diff changeset
107 private void assertRead(StructuredGraph graph, Kind kind, boolean indexConvert, LocationIdentity locationIdentity) {
11752
7e7edb86fb43 Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11717
diff changeset
108 WordCastNode cast = (WordCastNode) graph.start().next();
7e7edb86fb43 Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11717
diff changeset
109
14945
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
110 JavaReadNode read = (JavaReadNode) cast.next();
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
111 Assert.assertEquals(kind.getStackKind(), read.stamp().getStackKind());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
112
11752
7e7edb86fb43 Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11717
diff changeset
113 Assert.assertEquals(cast, read.object());
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
114 Assert.assertEquals(graph.getParameter(0), cast.getInput());
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
115 Assert.assertEquals(target.wordKind, cast.stamp().getStackKind());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
116
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
117 IndexedLocationNode location = (IndexedLocationNode) read.location();
9525
038fa65cbd8d Consistent naming of accessor methods in the LocationNode class hierarchy
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8944
diff changeset
118 Assert.assertEquals(locationIdentity, location.getLocationIdentity());
038fa65cbd8d Consistent naming of accessor methods in the LocationNode class hierarchy
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8944
diff changeset
119 Assert.assertEquals(1, location.getIndexScaling());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
120
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
121 if (indexConvert) {
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
122 SignExtendNode convert = (SignExtendNode) location.getIndex();
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
123 Assert.assertEquals(convert.getInputBits(), 32);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
124 Assert.assertEquals(convert.getResultBits(), 64);
16156
0993768dfc8e new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15263
diff changeset
125 Assert.assertEquals(graph.getParameter(1), convert.getValue());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
126 } else {
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
127 Assert.assertEquals(graph.getParameter(1), location.getIndex());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
128 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
129
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
130 ReturnNode ret = (ReturnNode) read.next();
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
131 Assert.assertEquals(read, ret.result());
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
132 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
133
18649
d138867d61c4 Remove getValueKind() from LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 18307
diff changeset
134 private void assertWrite(StructuredGraph graph, boolean indexConvert, LocationIdentity locationIdentity) {
11752
7e7edb86fb43 Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11717
diff changeset
135 WordCastNode cast = (WordCastNode) graph.start().next();
7e7edb86fb43 Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11717
diff changeset
136
14945
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
137 JavaWriteNode write = (JavaWriteNode) cast.next();
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
138 Assert.assertEquals(graph.getParameter(2), write.value());
17328
c9bb0da795d4 Backed out of changeset 17322:655f3e6b467b
Doug Simon <doug.simon@oracle.com>
parents: 17327
diff changeset
139 Assert.assertEquals(BytecodeFrame.AFTER_BCI, write.stateAfter().bci);
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
140
11752
7e7edb86fb43 Refactor the handling of unsafe casts to distinguish between word-object-conversions, PiNode-like type information, and real unsafe casts.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11717
diff changeset
141 Assert.assertEquals(cast, write.object());
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
142 Assert.assertEquals(graph.getParameter(0), cast.getInput());
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
143 Assert.assertEquals(target.wordKind, cast.stamp().getStackKind());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
144
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
145 IndexedLocationNode location = (IndexedLocationNode) write.location();
9525
038fa65cbd8d Consistent naming of accessor methods in the LocationNode class hierarchy
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8944
diff changeset
146 Assert.assertEquals(locationIdentity, location.getLocationIdentity());
038fa65cbd8d Consistent naming of accessor methods in the LocationNode class hierarchy
Christian Wimmer <christian.wimmer@oracle.com>
parents: 8944
diff changeset
147 Assert.assertEquals(1, location.getIndexScaling());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
148
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
149 if (indexConvert) {
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
150 SignExtendNode convert = (SignExtendNode) location.getIndex();
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
151 Assert.assertEquals(convert.getInputBits(), 32);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13618
diff changeset
152 Assert.assertEquals(convert.getResultBits(), 64);
16156
0993768dfc8e new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15263
diff changeset
153 Assert.assertEquals(graph.getParameter(1), convert.getValue());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
154 } else {
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 13135
diff changeset
155 Assert.assertEquals(graph.getParameter(1), location.getIndex());
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
156 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
157
11717
8a3b59397044 The SnippetFrameStateCleanupPhase now sets invalid framestates on the paths of side effecting instruction except for the last one where an AFTER_BCI is used.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10513
diff changeset
158 ReturnNode ret = (ReturnNode) write.next();
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
159 Assert.assertEquals(null, ret.result());
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
160 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
161
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
162 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
163 public static byte readByte1(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
164 return Word.fromObject(o).readByte(offset, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
165 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
166
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
167 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
168 public static byte readByte2(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
169 return Word.fromObject(o).readByte(Word.signed(offset), ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
170 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
171
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
172 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
173 public static byte readByte3(Object o, int offset) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
174 return Word.fromObject(o).readByte(offset);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
175 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
176
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
177 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
178 public static void writeByte1(Object o, int offset, byte value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
179 Word.fromObject(o).writeByte(offset, value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
180 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
181
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
182 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
183 public static void writeByte2(Object o, int offset, byte value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
184 Word.fromObject(o).writeByte(Word.signed(offset), value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
185 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
186
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
187 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
188 public static void writeByte3(Object o, int offset, byte value) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
189 Word.fromObject(o).writeByte(offset, value);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
190 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
191
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
192 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
193 public static char readChar1(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
194 return Word.fromObject(o).readChar(offset, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
195 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
196
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
197 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
198 public static char readChar2(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
199 return Word.fromObject(o).readChar(Word.signed(offset), ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
200 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
201
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
202 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
203 public static char readChar3(Object o, int offset) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
204 return Word.fromObject(o).readChar(offset);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
205 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
206
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
207 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
208 public static void writeChar1(Object o, int offset, char value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
209 Word.fromObject(o).writeChar(offset, value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
210 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
211
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
212 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
213 public static void writeChar2(Object o, int offset, char value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
214 Word.fromObject(o).writeChar(Word.signed(offset), value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
215 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
216
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
217 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
218 public static void writeChar3(Object o, int offset, char value) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
219 Word.fromObject(o).writeChar(offset, value);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
220 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
221
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
222 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
223 public static short readShort1(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
224 return Word.fromObject(o).readShort(offset, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
225 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
226
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
227 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
228 public static short readShort2(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
229 return Word.fromObject(o).readShort(Word.signed(offset), ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
230 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
231
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
232 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
233 public static short readShort3(Object o, int offset) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
234 return Word.fromObject(o).readShort(offset);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
235 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
236
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
237 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
238 public static void writeShort1(Object o, int offset, short value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
239 Word.fromObject(o).writeShort(offset, value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
240 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
241
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
242 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
243 public static void writeShort2(Object o, int offset, short value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
244 Word.fromObject(o).writeShort(Word.signed(offset), value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
245 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
246
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
247 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
248 public static void writeShort3(Object o, int offset, short value) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
249 Word.fromObject(o).writeShort(offset, value);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
250 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
251
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
252 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
253 public static int readInt1(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
254 return Word.fromObject(o).readInt(offset, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
255 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
256
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
257 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
258 public static int readInt2(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
259 return Word.fromObject(o).readInt(Word.signed(offset), ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
260 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
261
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
262 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
263 public static int readInt3(Object o, int offset) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
264 return Word.fromObject(o).readInt(offset);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
265 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
266
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
267 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
268 public static void writeInt1(Object o, int offset, int value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
269 Word.fromObject(o).writeInt(offset, value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
270 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
271
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
272 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
273 public static void writeInt2(Object o, int offset, int value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
274 Word.fromObject(o).writeInt(Word.signed(offset), value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
275 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
276
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
277 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
278 public static void writeInt3(Object o, int offset, int value) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
279 Word.fromObject(o).writeInt(offset, value);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
280 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
281
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
282 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
283 public static long readLong1(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
284 return Word.fromObject(o).readLong(offset, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
285 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
286
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
287 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
288 public static long readLong2(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
289 return Word.fromObject(o).readLong(Word.signed(offset), ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
290 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
291
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
292 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
293 public static long readLong3(Object o, int offset) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
294 return Word.fromObject(o).readLong(offset);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
295 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
296
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
297 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
298 public static void writeLong1(Object o, int offset, long value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
299 Word.fromObject(o).writeLong(offset, value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
300 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
301
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
302 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
303 public static void writeLong2(Object o, int offset, long value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
304 Word.fromObject(o).writeLong(Word.signed(offset), value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
305 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
306
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
307 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
308 public static void writeLong3(Object o, int offset, long value) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
309 Word.fromObject(o).writeLong(offset, value);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
310 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
311
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
312 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
313 public static float readFloat1(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
314 return Word.fromObject(o).readFloat(offset, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
315 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
316
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
317 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
318 public static float readFloat2(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
319 return Word.fromObject(o).readFloat(Word.signed(offset), ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
320 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
321
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
322 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
323 public static float readFloat3(Object o, int offset) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
324 return Word.fromObject(o).readFloat(offset);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
325 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
326
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
327 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
328 public static void writeFloat1(Object o, int offset, float value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
329 Word.fromObject(o).writeFloat(offset, value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
330 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
331
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
332 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
333 public static void writeFloat2(Object o, int offset, float value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
334 Word.fromObject(o).writeFloat(Word.signed(offset), value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
335 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
336
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
337 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
338 public static void writeFloat3(Object o, int offset, float value) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
339 Word.fromObject(o).writeFloat(offset, value);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
340 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
341
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
342 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
343 public static double readDouble1(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
344 return Word.fromObject(o).readDouble(offset, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
345 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
346
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
347 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
348 public static double readDouble2(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
349 return Word.fromObject(o).readDouble(Word.signed(offset), ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
350 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
351
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
352 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
353 public static double readDouble3(Object o, int offset) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
354 return Word.fromObject(o).readDouble(offset);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
355 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
356
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
357 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
358 public static void writeDouble1(Object o, int offset, double value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
359 Word.fromObject(o).writeDouble(offset, value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
360 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
361
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
362 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
363 public static void writeDouble2(Object o, int offset, double value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
364 Word.fromObject(o).writeDouble(Word.signed(offset), value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
365 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
366
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
367 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
368 public static void writeDouble3(Object o, int offset, double value) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
369 Word.fromObject(o).writeDouble(offset, value);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
370 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
371
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
372 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
373 public static Object readObject1(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
374 return Word.fromObject(o).readObject(offset, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
375 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
376
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
377 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
378 public static Object readObject2(Object o, int offset) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
379 return Word.fromObject(o).readObject(Word.signed(offset), ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
380 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
381
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
382 @Snippet
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
383 public static Object readObject3(Object o, int offset) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
384 return Word.fromObject(o).readObject(offset);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
385 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
386
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
387 @Snippet
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
388 public static void writeObject1(Object o, int offset, Object value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
389 Word.fromObject(o).writeObject(offset, value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
390 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
391
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
392 @Snippet
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
393 public static void writeObject2(Object o, int offset, Object value) {
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
394 Word.fromObject(o).writeObject(Word.signed(offset), value, ID);
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
395 }
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
396
7904
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
397 @Snippet
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
398 public static void writeObject3(Object o, int offset, Object value) {
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
399 Word.fromObject(o).writeObject(offset, value);
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
400 }
c8f2002d2194 reintroduce default Word read/write operations, more tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 7903
diff changeset
401
11800
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
402 private void assertNumWordCasts(String snippetName, int expectedWordCasts) {
19250
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 18649
diff changeset
403 HighTierContext context = new HighTierContext(getProviders(), null, null, OptimisticOptimizations.ALL);
11800
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
404
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19254
diff changeset
405 StructuredGraph graph = parseEager(snippetName, AllowAssumptions.YES);
11800
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
406 new CanonicalizerPhase(false).apply(graph, context);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
407 Assert.assertEquals(expectedWordCasts, graph.getNodes().filter(WordCastNode.class).count());
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
408 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
409
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
410 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
411 public void testUnusedFromObject() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
412 assertNumWordCasts("unusedFromObject", 0);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
413 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
414
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
415 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
416 public static void unusedFromObject(Object o) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
417 Word.fromObject(o);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
418 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
419
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
420 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
421 public void testUnusedRawValue() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
422 assertNumWordCasts("unusedRawValue", 0);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
423 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
424
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
425 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
426 public static void unusedRawValue(Object o) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
427 Word.fromObject(o).rawValue();
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
428 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
429
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
430 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
431 public void testUsedRawValue() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
432 assertNumWordCasts("usedRawValue", 1);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
433 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
434
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
435 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
436 public static long usedRawValue(Object o) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
437 return Word.fromObject(o).rawValue();
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
438 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
439
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
440 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
441 public void testUnusedToObject() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
442 assertNumWordCasts("unusedToObject", 0);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
443 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
444
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
445 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
446 public static void unusedToObject(Word w) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
447 w.toObject();
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
448 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
449
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
450 @Test
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
451 public void testUsedToObject() {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
452 assertNumWordCasts("usedToObject", 1);
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
453 }
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
454
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
455 @Snippet
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
456 public static Object usedToObject(Word w) {
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
457 return w.toObject();
a28f24553ffa Improvements to recent unsafe cast node changes
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11752
diff changeset
458 }
7903
f19c4d447e73 more bug fixes and tests for Word read/write operations
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
459 }